From 8f33ff2a4ea3f202e868ab2f21c069e693f334dc Mon Sep 17 00:00:00 2001 From: Geindre Colin Date: Thu, 25 Feb 2021 08:29:22 +0100 Subject: [PATCH] Icons hidden, icons for all --- Y/Scripts/yfold.js | 62 ++++++++++++++++++++++++---------------------- Y/ystyle2.css | 4 +++ 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/Y/Scripts/yfold.js b/Y/Scripts/yfold.js index 6240a15..9ab6118 100644 --- a/Y/Scripts/yfold.js +++ b/Y/Scripts/yfold.js @@ -94,41 +94,43 @@ function toggleYfold(id) { window.onload = function() { console.log("DOM loaded.") - var snippet = document.getElementsByTagName("code")[0]; - if ((snippet.classList.value.includes("page")) || (snippet.classList.value.includes("block"))) { - console.log(snippet); + var snippets = document.getElementsByTagName("code"); + for (var snippet of snippets) { + if ((snippet.classList.value.includes("page")) || (snippet.classList.value.includes("block"))) { + console.log(snippet); - let img = document.createElement('div'); - img.innerHTML = ''; - img.addEventListener('click', function() { - console.log(snippet.innerText); - navigator.clipboard.writeText(snippet.innerText).then(function() { - console.log("copié !"); - img.classList = "valid" - }, function() { - console.log("pas copié !"); - img.classList = "not-valid" + let img = document.createElement('div'); + img.innerHTML = ''; + img.addEventListener('click', function() { + console.log(snippet.innerText); + navigator.clipboard.writeText(snippet.innerText).then(function() { + console.log("copié !"); + img.classList = "valid" + }, function() { + console.log("pas copié !"); + img.classList = "not-valid" + }); }); - }); - let theme = document.createElement('div'); - theme.setAttribute("class", "theme"); - theme.innerHTML = ''; + let theme = document.createElement('div'); + theme.setAttribute("class", "theme"); + theme.innerHTML = ''; - theme.addEventListener('click', function() { - snippet.classList.toggle("light"); - console.log("theme switched !"); - if (theme.classList == "theme darken") { - theme.classList = "theme lighten"; - } else { - theme.classList = "theme darken"; - } - }); + theme.addEventListener('click', function() { + snippet.classList.toggle("light"); + console.log("theme switched !"); + if (theme.classList == "theme darken") { + theme.classList = "theme lighten"; + } else { + theme.classList = "theme darken"; + } + }); - snippet.appendChild(img) - snippet.appendChild(theme) - } else { - console.log(snippet.classList); + snippet.appendChild(img) + snippet.appendChild(theme) + } else { + console.log(snippet.classList); + } } if (typeof(Storage) !== "undefined") { diff --git a/Y/ystyle2.css b/Y/ystyle2.css index ae66cc9..4d742be 100644 --- a/Y/ystyle2.css +++ b/Y/ystyle2.css @@ -636,6 +636,10 @@ section.yfold.card > .yfold-content > h6 border-radius: 6px; } +code div { + display: none; +} + @keyframes appear { 0%