Risolti bug caricamento cookie
This commit is contained in:
parent
6625523592
commit
d926e77986
|
@ -45,6 +45,28 @@
|
|||
|
||||
</head>
|
||||
<body class="body-vis">
|
||||
<script type="text/javascript">
|
||||
var currStyle = "style1";
|
||||
var newStyle = Cookies.get('LiDa_style');
|
||||
if (typeof newStyle !== "undefined") {
|
||||
switch (newStyle) {
|
||||
case "style1":
|
||||
$("#style1-Boot").prop('disabled', false);
|
||||
$("#style1-Custom").prop('disabled', false);
|
||||
$("#style2-Boot").prop('disabled', true);
|
||||
$("#style2-Custom").prop('disabled', true);
|
||||
break;
|
||||
case "style2":
|
||||
$("#style2-Boot").prop('disabled', false);
|
||||
$("#style2-Custom").prop('disabled', false);
|
||||
$("#style1-Boot").prop('disabled', true);
|
||||
$("#style1-Custom").prop('disabled', true);
|
||||
break;
|
||||
default:
|
||||
};
|
||||
currStyle = newStyle;
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="h-100 container-fluid">
|
||||
<div>
|
||||
|
|
|
@ -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 = '<li id="placeholderSort';
|
||||
const condLIplaceholderPart2 = '" class="mx-0 my-1 p-1 pl-3 list-group-item align-items-center border text-muted small bg-light ui-state-disabled ui-state-disabled-opacity-06">';
|
||||
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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue