60 lines
2.0 KiB
JavaScript
60 lines
2.0 KiB
JavaScript
document.querySelectorAll('.slider').forEach(slider => {
|
|
slider.addEventListener('input', function () {
|
|
let min = parseFloat(this.min);
|
|
let max = parseFloat(this.max);
|
|
let curVal = parseFloat(this.value);
|
|
let val = ((curVal-min)/(max-min))*100;
|
|
// if (slider.id == 'zScale-slider') {
|
|
// this.style.background = `linear-gradient(to right, #fff ${val * 10}%, #aaa ${val * 10}%)`;
|
|
// } else {
|
|
this.style.background = `linear-gradient(to right, #fff ${val}%, #aaa ${val}%)`;
|
|
// }
|
|
});
|
|
});
|
|
|
|
document.querySelectorAll('input[type="checkbox"][name="layer"]').forEach(checkbox => {
|
|
checkbox.addEventListener('change', () => {
|
|
if(checkbox.closest('.checkbox-label').classList.contains('disabled')){
|
|
checkbox.checked = false;
|
|
}
|
|
const label = checkbox.closest('.checkbox-label');
|
|
const visibilityIcon = label.querySelector('.visibility-icon');
|
|
|
|
const visibleSrc = checkbox.dataset.iconVisible;
|
|
const invisibleSrc = checkbox.dataset.iconInvisible;
|
|
|
|
if (!checkbox.checked) {
|
|
// label.style.opacity = '0.2';
|
|
if (visibilityIcon) visibilityIcon.src = invisibleSrc;
|
|
} else {
|
|
// label.style.opacity = '1';
|
|
if (visibilityIcon) visibilityIcon.src = visibleSrc;
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
document.querySelectorAll('input[type="checkbox"][name="list-set"]').forEach(checkbox => {
|
|
checkbox.addEventListener('change', () => {
|
|
const label = checkbox.closest('.checkbox-label');
|
|
const visibilityIcon = label.querySelector('.visibility-icon');
|
|
|
|
const visibleSrc = checkbox.dataset.iconVisible;
|
|
const invisibleSrc = checkbox.dataset.iconInvisible;
|
|
|
|
if (!checkbox.checked) {
|
|
// label.style.opacity = '0.2';
|
|
if (visibilityIcon) visibilityIcon.src = invisibleSrc;
|
|
} else {
|
|
// label.style.opacity = '1';
|
|
if (visibilityIcon) visibilityIcon.src = visibleSrc;
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
document.querySelector('.dropdown-toggle').addEventListener('click', function () {
|
|
document.querySelector('.dropdown').classList.toggle('open');
|
|
}); |