38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import { ScraperUtils } from './scraper_utils.js';
|
|
|
|
class Common {
|
|
constructor() {
|
|
this.utils = new ScraperUtils();
|
|
this.addEventListeners();
|
|
this.scheduleUpdates();
|
|
}
|
|
|
|
scheduleUpdates() {
|
|
// Ensure server time updates every minute but only after initial fetch
|
|
setTimeout(() => {
|
|
setInterval(() => this.utils.updateServerTime(), 60000);
|
|
}, 5000); // Delay first scheduled update to prevent duplicate initial request
|
|
}
|
|
|
|
addEventListeners() {
|
|
if (this.utils.stopButton) {
|
|
this.utils.stopButton.addEventListener('click', () => this.utils.checkScrapingStatus());
|
|
}
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
new Common();
|
|
});
|
|
|
|
window.checkAllCheckboxes = function(tableId, checkAllId) {
|
|
var table = document.getElementById(tableId);
|
|
var checkAll = document.getElementById(checkAllId);
|
|
var checkboxes = table.querySelectorAll('input[type="checkbox"]');
|
|
|
|
checkboxes.forEach(function(checkbox) {
|
|
if (!checkbox.disabled) {
|
|
checkbox.checked = checkAll.checked;
|
|
}
|
|
});
|
|
}; |