Skip to content

Commit

Permalink
fix for multiple event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoexe committed Sep 26, 2024
1 parent b3537e5 commit 0861c91
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions sostituzioni/view/static/scripts/impostazioni.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ for (let index = 0; index < sezioni.length; index++) {

//////////////////////////////

const colortheme = document.querySelector("#colortheme select");

colortheme.onchange = () => {
const head = document.querySelector('head');
let element = document.querySelector('#colortheme_css')
if (!element) {
element = document.createElement('link');
element.id = 'colortheme_css';
element.rel = 'stylesheet';
element.type = 'text/css';
element.media = 'all';
head.appendChild(element);
}
element.href = 'static/style/theme/' + colortheme.value + '.css';
}

//////////////////////////////

function elimina_file(id) {
let file_container = document.getElementById(id);
file_container.querySelector(".img-container").classList.add("hidden");
Expand Down Expand Up @@ -89,11 +71,17 @@ for (element of document.querySelectorAll(".opzione-file-dropzone")) {
}


function modificato(id) {
if (!modifiche.includes(id)) {
modifiche.push(id);
function modificato(element) {
if (!modifiche.includes(element)) {
modifiche.push(element);
mostra_pulsante_applica();
}

switch (element.id) {
case "colortheme":
document.querySelector('#colortheme_css').href = 'static/style/theme/' + element.querySelector("select").value + '.css';
break;
}
}

function mostra_pulsante_applica() {
Expand Down

0 comments on commit 0861c91

Please sign in to comment.