diff --git a/Y/Scripts/yfold.js b/Y/Scripts/yfold.js index 18c3f5a..7fe3313 100644 --- a/Y/Scripts/yfold.js +++ b/Y/Scripts/yfold.js @@ -91,36 +91,40 @@ function toggleYfold(id) { window.onload = function() { console.log("DOM loaded.") var snippet = document.getElementsByTagName("code")[0]; - console.log(snippet); + 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) + snippet.appendChild(img) + snippet.appendChild(theme) + } else { + console.log(snippet.classList); + } }; diff --git a/Y/ystyle.css b/Y/ystyle.css index e56f94b..79d4f5e 100644 --- a/Y/ystyle.css +++ b/Y/ystyle.css @@ -178,7 +178,7 @@ footer { bottom: 0px; width: 100%; min-height: 150px; - background: rgba(0, 0, 0, 0.8); + background: rgba(19,19,19,.8); padding: 30px 50px; display: flex; flex-direction: row; @@ -240,6 +240,7 @@ code * { } code div { + overflow: hidden; position: absolute; top: 12px; right: 12px; @@ -249,6 +250,7 @@ code div { width: 42px; background: #333; cursor: pointer; + overflow-x: hidden; } code div.theme {