Browse Source

Icons hidden, icons for all

Geindre Colin 3 years ago
parent
commit
8f33ff2a4e
2 changed files with 39 additions and 33 deletions
  1. 35
    33
      Y/Scripts/yfold.js
  2. 4
    0
      Y/ystyle2.css

+ 35
- 33
Y/Scripts/yfold.js View File

@@ -94,41 +94,43 @@ function toggleYfold(id) {
94 94
 
95 95
 window.onload = function() {
96 96
   console.log("DOM loaded.")
97
-  var snippet = document.getElementsByTagName("code")[0];
98
-  if ((snippet.classList.value.includes("page")) || (snippet.classList.value.includes("block"))) {
99
-    console.log(snippet);
100
-
101
-    let img = document.createElement('div');
102
-    img.innerHTML = '<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M407 128H185C153.52 128 128 153.52 128 185V407C128 438.48 153.52 464 185 464H407C438.48 464 464 438.48 464 407V185C464 153.52 438.48 128 407 128Z" stroke="black" stroke-width="32" stroke-linejoin="round"/><path d="M383.5 128L384 104C383.958 89.1609 378.044 74.9416 367.551 64.4487C357.058 53.9558 342.839 48.0422 328 48H112C95.0416 48.0501 78.792 54.8091 66.8005 66.8005C54.8091 78.792 48.0501 95.0416 48 112V328C48.0422 342.839 53.9558 357.058 64.4487 367.551C74.9416 378.044 89.1609 383.958 104 384H128" stroke="black" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/></svg>';
103
-    img.addEventListener('click', function() {
104
-      console.log(snippet.innerText);
105
-      navigator.clipboard.writeText(snippet.innerText).then(function() {
106
-        console.log("copié !");
107
-        img.classList = "valid"
108
-      }, function() {
109
-        console.log("pas copié !");
110
-        img.classList = "not-valid"
97
+  var snippets = document.getElementsByTagName("code");
98
+  for (var snippet of snippets) {
99
+    if ((snippet.classList.value.includes("page")) || (snippet.classList.value.includes("block"))) {
100
+      console.log(snippet);
101
+
102
+      let img = document.createElement('div');
103
+      img.innerHTML = '<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M407 128H185C153.52 128 128 153.52 128 185V407C128 438.48 153.52 464 185 464H407C438.48 464 464 438.48 464 407V185C464 153.52 438.48 128 407 128Z" stroke="black" stroke-width="32" stroke-linejoin="round"/><path d="M383.5 128L384 104C383.958 89.1609 378.044 74.9416 367.551 64.4487C357.058 53.9558 342.839 48.0422 328 48H112C95.0416 48.0501 78.792 54.8091 66.8005 66.8005C54.8091 78.792 48.0501 95.0416 48 112V328C48.0422 342.839 53.9558 357.058 64.4487 367.551C74.9416 378.044 89.1609 383.958 104 384H128" stroke="black" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/></svg>';
104
+      img.addEventListener('click', function() {
105
+        console.log(snippet.innerText);
106
+        navigator.clipboard.writeText(snippet.innerText).then(function() {
107
+          console.log("copié !");
108
+          img.classList = "valid"
109
+        }, function() {
110
+          console.log("pas copié !");
111
+          img.classList = "not-valid"
112
+        });
111 113
       });
112
-    });
113
-
114
-    let theme = document.createElement('div');
115
-    theme.setAttribute("class", "theme");
116
-    theme.innerHTML = '<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M256 464C370.875 464 464 370.875 464 256C464 141.125 370.875 48 256 48C141.125 48 48 141.125 48 256C48 370.875 141.125 464 256 464Z" stroke="black" stroke-width="32" stroke-linejoin="round"/><path d="M256 464C141.12 464 48 370.88 48 256C48 141.12 141.12 48 256 48V464Z" fill="black"/></svg>';
117
-
118
-    theme.addEventListener('click', function() {
119
-      snippet.classList.toggle("light");
120
-      console.log("theme switched !");
121
-      if (theme.classList == "theme darken") {
122
-        theme.classList = "theme lighten";
123
-      } else {
124
-        theme.classList = "theme darken";
125
-      }
126
-    });
127 114
 
128
-    snippet.appendChild(img)
129
-    snippet.appendChild(theme)
130
-  } else {
131
-    console.log(snippet.classList);
115
+      let theme = document.createElement('div');
116
+      theme.setAttribute("class", "theme");
117
+      theme.innerHTML = '<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M256 464C370.875 464 464 370.875 464 256C464 141.125 370.875 48 256 48C141.125 48 48 141.125 48 256C48 370.875 141.125 464 256 464Z" stroke="black" stroke-width="32" stroke-linejoin="round"/><path d="M256 464C141.12 464 48 370.88 48 256C48 141.12 141.12 48 256 48V464Z" fill="black"/></svg>';
118
+
119
+      theme.addEventListener('click', function() {
120
+        snippet.classList.toggle("light");
121
+        console.log("theme switched !");
122
+        if (theme.classList == "theme darken") {
123
+          theme.classList = "theme lighten";
124
+        } else {
125
+          theme.classList = "theme darken";
126
+        }
127
+      });
128
+
129
+      snippet.appendChild(img)
130
+      snippet.appendChild(theme)
131
+    } else {
132
+      console.log(snippet.classList);
133
+    }
132 134
   }
133 135
 
134 136
   if (typeof(Storage) !== "undefined") {

+ 4
- 0
Y/ystyle2.css View File

@@ -636,6 +636,10 @@ section.yfold.card > .yfold-content > h6
636 636
 	border-radius: 6px;
637 637
 	}
638 638
 
639
+code div {
640
+	display: none;
641
+}
642
+
639 643
 @keyframes appear
640 644
 	{
641 645
 	0%

Loading…
Cancel
Save