diff --git a/index_4.2.html b/index_4.2.html index 296bd0a..bf306e8 100644 --- a/index_4.2.html +++ b/index_4.2.html @@ -45,6 +45,28 @@ +
diff --git a/js/script_4.2.js b/js/script_4.2.js index cb1b6b3..7ddca13 100644 --- a/js/script_4.2.js +++ b/js/script_4.2.js @@ -3,55 +3,19 @@ */ var getJsonQuery; -var currStyle = "style1"; var currPage = 0; var latestPhraseId = ""; var numeroPagine = 0; var latestOffset = 0; + const cssCantoHeight = 0.65; const cssTableMainHeight = 0.95; //.tableMain {height: 95%;} +const bgImgUrl1 = "./images/fefeff.png"; +const bgImgUrl2 = "./images/f8f9fa.png"; + $(document).ready(function() { - var newStyle = Cookies.get('LiDa_style'); - if(typeof newStyle !== "undefined") { - setStyle(newStyle, 0); - }; - - function setStyle(newStyle, fadeDuration = 700) { - if (newStyle != currStyle) { - var bgImgEl = document.createElement("IMG"); - bgImgEl.id = "bgImg"; - currStyle = newStyle; - switch (newStyle) { - case "style1": - $("body").fadeOut(fadeDuration, function() { - bgImgEl.src = bgImgUrl1; - $("#style1-Boot").prop('disabled', false); - $("#style1-Custom").prop('disabled', false); - $("#style2-Boot").prop('disabled', true); - $("#style2-Custom").prop('disabled', true); - $("body").fadeIn(fadeDuration); - }); - break; - case "style2": - $("body").fadeOut(fadeDuration, function() { - bgImgEl.src = bgImgUrl2; - $("#style2-Boot").prop('disabled', false); - $("#style2-Custom").prop('disabled', false); - $("#style1-Boot").prop('disabled', true); - $("#style1-Custom").prop('disabled', true); - $("body").fadeIn(fadeDuration); - }); - break; - default: - }; - $('#bgImg').replaceWith(bgImgEl); - drawMinimap(currentMinimap, false); - Cookies.set('LiDa_style', newStyle); - }; - }; - window.addEventListener("resize", function() { clearTimeout(this.id); this.id = setTimeout(doneResizing, 300); @@ -606,8 +570,6 @@ $(document).ready(function() { const condLIplaceholderText2d = 'Trascina qui almeno 2 clausole o condizioni, oppure attiva le clausole inattive'; const condLIplaceholderPart1 = '
  • '; - const bgImgUrl1 = "./images/fefeff.png"; - const bgImgUrl2 = "./images/f8f9fa.png"; // Variabili e costanti funzionali var minimapScrolling = false; @@ -1402,6 +1364,40 @@ $(document).ready(function() { //console.log("fSize: "+fSize); return (fSize) + 'px'; }; + + function setStyle(newStyle, fadeDuration = 700) { + if (newStyle != currStyle) { + var bgImgEl = document.createElement("IMG"); + bgImgEl.id = "bgImg"; + currStyle = newStyle; + switch (newStyle) { + case "style1": + $("body").fadeOut(fadeDuration, function() { + bgImgEl.src = bgImgUrl1; + $("#style1-Boot").prop('disabled', false); + $("#style1-Custom").prop('disabled', false); + $("#style2-Boot").prop('disabled', true); + $("#style2-Custom").prop('disabled', true); + $("body").fadeIn(fadeDuration); + }); + break; + case "style2": + $("body").fadeOut(fadeDuration, function() { + bgImgEl.src = bgImgUrl2; + $("#style2-Boot").prop('disabled', false); + $("#style2-Custom").prop('disabled', false); + $("#style1-Boot").prop('disabled', true); + $("#style1-Custom").prop('disabled', true); + $("body").fadeIn(fadeDuration); + }); + break; + default: + }; + $('#bgImg').replaceWith(bgImgEl); + drawMinimap(currentMinimap, false, 0); + Cookies.set('LiDa_style', newStyle); }; + }; + }); @@ -1412,5 +1408,17 @@ $(window).on('load', function() { $(visCantoClass).css("height", cantoHeightToSet); $(displayCantoId).css("max-height", maxCantoHeightToSet); $(displayCantoId).css("height", cantoHeightToSet); + var bgImgEl = document.createElement("IMG"); + bgImgEl.id = "bgImg"; + switch (currStyle) { + case "style1": + bgImgEl.src = bgImgUrl1; + break; + case "style2": + bgImgEl.src = bgImgUrl2; + break; + default: + }; + $('#bgImg').replaceWith(bgImgEl); });