You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.7 KiB
91 lines
2.7 KiB
// Get the modal
|
|
var modal = document.getElementById("optionsModal");
|
|
|
|
// Get the button that opens the modal
|
|
var btn = document.getElementById("btn_options");
|
|
|
|
// Get the <span> element that closes the modal
|
|
var span = document.getElementsByClassName("close")[0];
|
|
|
|
// When the user clicks the button, open the modal
|
|
btn.onclick = function() {
|
|
modal.style.display = "block";
|
|
}
|
|
|
|
// When the user clicks on <span> (x), close the modal
|
|
span.onclick = function() {
|
|
modal.style.display = "none";
|
|
}
|
|
|
|
// When the user clicks anywhere outside of the modal, close it
|
|
window.onclick = function(event) {
|
|
if (event.target == modal) {
|
|
modal.style.display = "none";
|
|
}
|
|
}
|
|
|
|
var slider = document.getElementById("range_dots");
|
|
var output = document.getElementById("dotsNumber");
|
|
output.innerHTML = slider.value;
|
|
|
|
slider.oninput = function() {
|
|
output.innerHTML = this.value;
|
|
}
|
|
|
|
function saveOptions() {
|
|
setCookie("dotsAmount",document.getElementById("range_dots").value,30);
|
|
setCookie("displayMode",document.getElementById("displays").value,30);
|
|
setCookie("pause",(document.getElementById("no_pause").checked ? 0 : 1),30);
|
|
modal.style.display = "none";
|
|
}
|
|
|
|
//initialisation des valeurs des préférences
|
|
|
|
document.getElementById("gem").width=size/6;
|
|
|
|
if(getCookie("pause")!=1)
|
|
document.getElementById("no_pause").checked=true;
|
|
else
|
|
document.getElementById("yes_pause").checked=true;
|
|
|
|
document.getElementById((getCookie("displayMode")!="" ? getCookie("displayMode")+"_disp" : "gems_disp")).selected=true;
|
|
|
|
document.getElementById("range_dots").value= (getCookie("dotsAmount")!="" ? getCookie("dotsAmount") : 4);
|
|
output.innerHTML = (getCookie("dotsAmount")!="" ? getCookie("dotsAmount") : 4);
|
|
|
|
var customColorsAvailable=["#FF0000","#ffff00","#008000","#800080","#000000","#8b4513","#00ffff","#ffa500"];
|
|
|
|
|
|
for(var cpt=1;cpt<9;cpt++)
|
|
{
|
|
eval('pickr'+cpt+` = Pickr.create({
|
|
el: '.col`+cpt+`',
|
|
theme: 'monolith',
|
|
default: (getCookie("color_`+cpt+`")=="" ? customColorsAvailable[cpt-1] : getCookie("color_`+cpt+`")),
|
|
useAsButton: true,
|
|
|
|
components: {
|
|
|
|
// Main components
|
|
preview: true,
|
|
hue: true,
|
|
|
|
// Input / output Options
|
|
interaction: {
|
|
hex: true,
|
|
input: true,
|
|
clear: true,
|
|
save: true
|
|
}
|
|
}
|
|
});`);
|
|
|
|
eval("pickr"+cpt+`.on('init', function() {
|
|
document.getElementById("col`+cpt+`").style.background=pickr`+cpt+`.getSelectedColor().toHEXA().toString();
|
|
}).on('save', function () {
|
|
document.getElementById("col`+cpt+`").style.background=pickr`+cpt+`.getColor().toHEXA().toString();
|
|
setCookie("color_`+cpt+`",pickr`+cpt+`.getColor().toHEXA().toString(),30);
|
|
pickr`+cpt+`.hide();
|
|
});`);
|
|
|
|
} |