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.

82 lines
2.4 KiB

var modal = document.getElementById("myModal");
function setting() {
var modal = document.getElementById("myModal");
modal.style.display = "block";
}
function closeSetting() {
var modal = document.getElementById("myModal");
if (event.target == modal) {
modal.style.display = "none";
}
}
window.onclick = function (event) {
closeSetting();
}
function darkMode() {
var checkbox = document.getElementById("darkcheck");
if (checkbox.checked == true) {
setColor("black");
}
else {
setColor("white");
}
}
function dysFont() {
var checkbox = document.getElementById("dyscheckbox");
var textToChange = document.querySelectorAll(".txt");
var font;
if (checkbox.checked == true) {
font = "dys";
}
else {
font = "main";
}
textToChange.forEach(function (item) {
let currText = item.id;
document.getElementById(currText).style.fontFamily = font;
})
document.getElementById("jeu-select").style.fontFamily = font;
}
function setColor(color) {
if (color == "black") {
document.body.style.color = whiteColor;
document.getElementById("body").style.backgroundColor = blackColor;
document.getElementById("setting_int").style.color = whiteColor;
document.getElementById("setting_int").style.backgroundColor = blackColor;
var hr = document.querySelectorAll("#hr");
hr.forEach(function(item){
console.log(item);
hr.style.border = "3px solid " + blackColor;
});
} else {
document.body.style.color = blackColor;
document.getElementById("body").style.backgroundColor = whiteColor;
document.getElementById("setting_int").style.color = blackColor;
document.getElementById("setting_int").style.backgroundColor = whiteColor;
var hr = document.querySelectorAll("#hr");
hr.forEach(function(item){
hr.style.border = "3px solid " + whiteColor;
});
}
}
function setLang(newLang) {
var textToChange = document.querySelectorAll(".txt");
if (newLang === "fr") {
textToChange.forEach(function (item) {
let currText = item.id;
document.getElementById(currText).innerHTML = lang.fr[currText];
})
}
else {
textToChange.forEach(function (item) {
let currText = item.id;
document.getElementById(currText).innerHTML = lang.en[currText];
})
}
}