Salvata scelta stile via cookies (sotto webserver), modificato stile2

This commit is contained in:
Luca Trupiano 2023-03-21 18:32:38 +01:00
parent 06af9bbb09
commit 732d23c7a9
4 changed files with 61 additions and 46 deletions

File diff suppressed because one or more lines are too long

View File

@ -302,7 +302,7 @@ li::marker {
- lida2: - lida2:
$primary #734450 $primary #734450
$secondary $gray-600 #b8a387 - $secondary $gray-600 #b8a387 -
$success rgb(5, 74, 41) #054a29 $success rgb(65, 93, 67) #054a29 #415d43
$info #55327d $info #55327d
$warning #325a7d $warning #325a7d
$danger #7d325a $danger #7d325a
@ -339,18 +339,18 @@ li::marker {
background-color: rgba(222, 226, 230, 0.5); background-color: rgba(222, 226, 230, 0.5);
} }
/* ------- $success rgb(5, 74, 41) / #054a29 , #DEE2E6 -------- */ /* ------- $success rgb(65, 93, 67) / #415d43 , #DEE2E6 -------- */
.custom-control-input:active~.custom-control-label::before { .custom-control-input:active~.custom-control-label::before {
background-color: rgba(5, 74, 41, 0.5) !important; background-color: rgba(65, 93, 67, 0.5) !important;
border-color: rgba(5, 74, 41, 0.5) !important; border-color: rgba(65, 93, 67, 0.5) !important;
} }
.custom-control-input:focus:not(:checked)~.custom-control-label::before { .custom-control-input:focus:not(:checked)~.custom-control-label::before {
border-color: rgb(5, 74, 41) !important; border-color: rgb(65, 93, 67) !important;
} }
.custom-control-input:checked~.custom-control-label::before { .custom-control-input:checked~.custom-control-label::before {
border-color: rgb(5, 74, 41) !important; border-color: rgb(65, 93, 67) !important;
background-color: rgb(5, 74, 41) !important; background-color: rgb(65, 93, 67) !important;
} }
.ui-selectable .ui-selecting { .ui-selectable .ui-selecting {
background: #054a29; background: #054a29;
@ -396,27 +396,27 @@ li::marker {
/* ricerca avanzata */ /* ricerca avanzata */
.bg-lida10 { .bg-lida10 {
background-color: #3c7d5e !important; background-color: #8dac91 !important;
} }
/* clausola */ /* clausola */
.bg-lida11 { .bg-lida11 {
background-color: #5b826f !important; background-color: #c6d5c8 !important;
} }
/* AND */ /* AND */
.bg-lida12 { .bg-lida12 {
background-color: #2f7778 !important; background-color: #c8c6d5 !important;
} }
/* OR */ /* OR */
.bg-lida13 { .bg-lida13 {
background-color: #5b8182 !important; background-color: #d5c8c6 !important;
} }
/* visualizza e minimap */ /* visualizza e minimap */
.bg-lida-vis, #displayminimap { .bg-lida-vis, #displayminimap, .claCollBtn {
background-color: #f8f9fa! important; background-color: #f8f9fa! important;
} }
@ -426,3 +426,7 @@ li::marker {
padding-top: 0px; padding-top: 0px;
} }
.claLI {
border-color: #cbcbc0 !important;
}

View File

@ -27,6 +27,7 @@
<script <script
src="https://rdf.js.org/comunica-browser/versions/latest/engines/query-sparql/comunica-browser.js"></script> src="https://rdf.js.org/comunica-browser/versions/latest/engines/query-sparql/comunica-browser.js"></script>
<script type="text/javascript" src="https://bundle.run/sparqljs@3.4.1"></script> <script type="text/javascript" src="https://bundle.run/sparqljs@3.4.1"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script>
<!-- <!--
--> -->
<script type="module" <script type="module"

View File

@ -13,6 +13,45 @@ const cssTableMainHeight = 0.95; //.tableMain {height: 95%;}
$(document).ready(function() { $(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() { window.addEventListener("resize", function() {
clearTimeout(this.id); clearTimeout(this.id);
this.id = setTimeout(doneResizing, 300); this.id = setTimeout(doneResizing, 300);
@ -36,36 +75,7 @@ $(document).ready(function() {
// Evento: click sul cambio stile // Evento: click sul cambio stile
$('.stileLink').on('click', function() { $('.stileLink').on('click', function() {
var newStyle = $(this)[0].id; var newStyle = $(this)[0].id;
if (newStyle != currStyle) { setStyle(newStyle);
var bgImgEl = document.createElement("IMG");
bgImgEl.id = "bgImg";
currStyle = newStyle;
switch (newStyle) {
case "style1":
$("body").fadeOut(700, 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(700);
});
break;
case "style2":
$("body").fadeOut(700, 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(700);
});
break;
default:
};
$('#bgImg').replaceWith(bgImgEl);
drawMinimap(currentMinimap, false);
}
}); });
@ -1392,6 +1402,7 @@ $(document).ready(function() {
//console.log("fSize: "+fSize); //console.log("fSize: "+fSize);
return (fSize) + 'px'; return (fSize) + 'px';
}; };
}); });
$(window).on('load', function() { $(window).on('load', function() {
@ -1401,6 +1412,5 @@ $(window).on('load', function() {
$(visCantoClass).css("height", cantoHeightToSet); $(visCantoClass).css("height", cantoHeightToSet);
$(displayCantoId).css("max-height", maxCantoHeightToSet); $(displayCantoId).css("max-height", maxCantoHeightToSet);
$(displayCantoId).css("height", cantoHeightToSet); $(displayCantoId).css("height", cantoHeightToSet);
}); });