splitting all js into individual files to comparmentalize and getting rid of onload event (in favour of defer)

This commit is contained in:
Simon Martens
2022-11-15 21:27:27 +01:00
parent e5052dd4ea
commit 5e90e917f1
30 changed files with 771 additions and 809 deletions

View File

@@ -0,0 +1,22 @@
const hideshowfiles = function() {
let elem = document.getElementById("ha-availablefileslist");
if (elem.classList.contains('hidden')) {
elem.classList.remove('hidden');
elem.classList.add('block');
}
else {
elem.classList.add('hidden');
elem.classList.remove('block');
}
}
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
var filesbutton = document.getElementById("ha-availablefiles");
if (filesbutton !== null)
filesbutton.addEventListener("click", () => hideshowfiles());