2025-04-04 18:02:23 +01:00
|
|
|
//
|
2025-04-06 07:58:24 +01:00
|
|
|
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-05 11:17:38
|
2025-04-04 18:02:23 +01:00
|
|
|
//
|
|
|
|
$(document).ready(function() {
|
|
|
|
});
|
2025-04-06 07:58:24 +01:00
|
|
|
|
|
|
|
// Initialize multiselect with existing text values
|
|
|
|
function initMultiselect() {
|
|
|
|
const multiselect = document.getElementById('CountrySelect_select');
|
|
|
|
const textInput = document.getElementById('AccumCountryCodes_text');
|
|
|
|
|
|
|
|
// Split text input values and select corresponding options
|
|
|
|
textInput.value.split(',').forEach(value => {
|
|
|
|
const option = Array.from(multiselect.options).find(opt => opt.value === value.trim());
|
|
|
|
if (option) option.selected = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update text input when multiselect changes
|
|
|
|
function updateTextInput() {
|
|
|
|
const multiselect = document.getElementById('CountrySelect_select');
|
|
|
|
const textInput = document.getElementById('AccumCountryCodes_text');
|
|
|
|
|
|
|
|
// Get selected values as comma-separated string
|
|
|
|
const selectedValues = Array.from(multiselect.selectedOptions)
|
|
|
|
.map(option => option.value)
|
|
|
|
.join(',');
|
|
|
|
|
|
|
|
textInput.value = selectedValues;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize on page load
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
initMultiselect();
|
|
|
|
|
|
|
|
// Add change listener to multiselect
|
|
|
|
document.getElementById('CountrySelect_select')
|
|
|
|
.addEventListener('click', updateTextInput);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Initialize select with current object content
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
const objectElement = document.getElementById('mailstats_object');
|
|
|
|
const selectElement = document.getElementById('StatsDate_select');
|
|
|
|
|
|
|
|
// Extract current date from object's data URL
|
|
|
|
const currentDate = objectElement.data.match(/mailstats_for_(\d{4}-\d{2}-\d{2})\.html/)?.[1];
|
|
|
|
|
|
|
|
if (currentDate) {
|
|
|
|
selectElement.value = currentDate;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Update object content when selection changes
|
|
|
|
document.getElementById('StatsDate_select').addEventListener('change', function() {
|
|
|
|
const selectedDate = this.value;
|
|
|
|
const objectElement = document.getElementById('mailstats_object');
|
|
|
|
|
|
|
|
// Update object's data source
|
|
|
|
objectElement.data = `mailstats_for_${selectedDate}.html`;
|
|
|
|
|
|
|
|
// Force refresh using clone method (cross-browser workaround)
|
|
|
|
const clone = objectElement.cloneNode(true);
|
|
|
|
objectElement.replaceWith(clone);
|
|
|
|
});
|