From edef1086563339f8058d2977708069ad5541d506 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:26:09 +0800 Subject: [PATCH] Remove sidebar ToC for articles with long headings --- js/toc.js | 10 ---------- .../cassette-beasts-more-than-a-pokemon-clone.html | 4 ++-- .../guides/kotor-sandral-matale-feud-guide.html | 4 ++-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/js/toc.js b/js/toc.js index e8013018..4658285b 100644 --- a/js/toc.js +++ b/js/toc.js @@ -1,6 +1,5 @@ // Auto generate table of contents // Code based on https://techindetail.com/table-of-contents-javascript/ - window.addEventListener('DOMContentLoaded', (event) => { const article = document.querySelector("article"); const headings = article.querySelectorAll("h2, h3"); @@ -55,15 +54,6 @@ window.addEventListener('DOMContentLoaded', (event) => { leftSidebar.classList.add('hidden'); } - // Open the article ToC and hide the left sidebar for small screen size - // Code based on https://codepen.io/neptotech/pen/RwjRjOZ - const windowWidth = window.innerWidth; - if (windowWidth < 480) { - toc.removeAttribute('open'); - } else { - toc.setAttribute('open', true); - } - // Remove the stickiness of the sidebar ToC if it is larger than screen height function preventSidebarOverflow() { if (document.documentElement.clientHeight < tocSidebar.offsetHeight + 50) { diff --git a/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone.html b/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone.html index c2ead7cf..e06643c6 100644 --- a/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone.html +++ b/shrines/cassettebeasts/articles/cassette-beasts-more-than-a-pokemon-clone.html @@ -34,11 +34,11 @@
-