summaryrefslogtreecommitdiff
path: root/src/js/zen.js
diff options
context:
space:
mode:
authorache <ache@ache.one>2024-08-09 04:12:37 +0200
committerache <ache@ache.one>2024-08-09 09:22:49 +0200
commit63e297da167713e17fd271958b4109ea44e7075a (patch)
tree38071f632a6c70c89e52c7dae99a4686d76e83e9 /src/js/zen.js
parentUpdate toml parser (diff)
Lint JavaScriptnotes
Diffstat (limited to 'src/js/zen.js')
-rw-r--r--src/js/zen.js49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/js/zen.js b/src/js/zen.js
index be5f7d7..8437c81 100644
--- a/src/js/zen.js
+++ b/src/js/zen.js
@@ -1,19 +1,19 @@
-window.addEventListener('DOMContentLoaded', () => {
- let firstTime = window.location.pathname != '/' && window.pageYOffset < 800;
- const toggleArrow = document.querySelector('#harr');
- const hid = document.querySelector('#hid');
- const initValue = document.body.style.getPropertyValue('--width_panel_bis');
-
- toggleArrow.addEventListener('click', () => {
- if (toggleArrow.classList.contains('hide_arrow_off')) {
+window.addEventListener("DOMContentLoaded", () => {
+ let firstTime = window.location.pathname != "/" && window.pageYOffset < 800;
+ const toggleArrow = document.querySelector("#harr");
+ const hid = document.querySelector("#hid");
+ const initValue = document.body.style.getPropertyValue("--width_panel_bis");
+
+ toggleArrow.addEventListener("click", () => {
+ if (toggleArrow.classList.contains("hide_arrow_off")) {
firstTime = false;
showAbout();
showHID();
setTimeout(() => {
- toggleArrow.classList.remove('hide_arrow_off');
+ toggleArrow.classList.remove("hide_arrow_off");
}, 1000);
} else {
- toggleArrow.classList.add('hide_arrow_off');
+ toggleArrow.classList.add("hide_arrow_off");
hideAbout();
// If the screen is smaller than 500px, hide the HID
@@ -24,37 +24,44 @@ window.addEventListener('DOMContentLoaded', () => {
});
function hideAbout() {
- document.body.style.setProperty('--width_panel_bis', '0px');
+ document.body.style.setProperty("--width_panel_bis", "0px");
}
function showAbout() {
- document.body.style.setProperty('--width_panel_bis', initValue);
+ document.body.style.setProperty("--width_panel_bis", initValue);
}
function hideHID() {
- hid.style.setProperty('display', 'none');
+ hid.style.setProperty("display", "none");
}
function showHID() {
- hid.style.setProperty('display', '');
+ hid.style.setProperty("display", "");
}
- window.addEventListener('scroll', () => {
- if(!toggleArrow) return;
+ window.addEventListener("scroll", () => {
+ if (!toggleArrow) return;
if (window.pageYOffset >= 800) {
- if (firstTime && document.body.style.getPropertyValue('--width_panel_bis') === initValue) {
+ if (
+ firstTime &&
+ document.body.style.getPropertyValue("--width_panel_bis") === initValue
+ ) {
toggleArrow.click();
firstTime = true;
}
- toggleArrow.classList.add('hide_arrow_show');
+ toggleArrow.classList.add("hide_arrow_show");
// A hideAbout(header, articles);
- } else if (!toggleArrow.classList.contains('hide_arrow_off')) {
+ } else if (!toggleArrow.classList.contains("hide_arrow_off")) {
// A showAbout(header, articles);
- toggleArrow.classList.remove('hide_arrow_show');
+ toggleArrow.classList.remove("hide_arrow_show");
}
- if(firstTime && window.pageYOffset === 0 && document.body.style.getPropertyValue('--width_panel_bis') !== initValue) {
+ if (
+ firstTime &&
+ window.pageYOffset === 0 &&
+ document.body.style.getPropertyValue("--width_panel_bis") !== initValue
+ ) {
toggleArrow.click();
firstTime = true;
}