Browse Source

moins noir

Mstrdav 3 years ago
parent
commit
a0f22d6a10
2 changed files with 36 additions and 30 deletions
  1. 33
    29
      Y/Scripts/yfold.js
  2. 3
    1
      Y/ystyle.css

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

@@ -91,36 +91,40 @@ function toggleYfold(id) {
91 91
 window.onload = function() {
92 92
   console.log("DOM loaded.")
93 93
   var snippet = document.getElementsByTagName("code")[0];
94
-  console.log(snippet);
95
-
96
-  let img = document.createElement('div');
97
-  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>';
98
-  img.addEventListener('click', function() {
99
-    console.log(snippet.innerText);
100
-    navigator.clipboard.writeText(snippet.innerText).then(function() {
101
-      console.log("copié !");
102
-      img.classList = "valid"
103
-    }, function() {
104
-      console.log("pas copié !");
105
-      img.classList = "not-valid"
94
+  if ((snippet.classList.value.includes("page")) || (snippet.classList.value.includes("block"))) {
95
+    console.log(snippet);
96
+
97
+    let img = document.createElement('div');
98
+    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>';
99
+    img.addEventListener('click', function() {
100
+      console.log(snippet.innerText);
101
+      navigator.clipboard.writeText(snippet.innerText).then(function() {
102
+        console.log("copié !");
103
+        img.classList = "valid"
104
+      }, function() {
105
+        console.log("pas copié !");
106
+        img.classList = "not-valid"
107
+      });
108
+    });
109
+
110
+    let theme = document.createElement('div');
111
+    theme.setAttribute("class", "theme");
112
+    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>';
113
+
114
+    theme.addEventListener('click', function() {
115
+      snippet.classList.toggle("light");
116
+      console.log("theme switched !");
117
+      if (theme.classList == "theme darken") {
118
+        theme.classList = "theme lighten";
119
+      } else {
120
+        theme.classList = "theme darken";
121
+      }
106 122
     });
107
-  });
108
-
109
-  let theme = document.createElement('div');
110
-  theme.setAttribute("class", "theme");
111
-  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>';
112
-
113
-  theme.addEventListener('click', function() {
114
-    snippet.classList.toggle("light");
115
-    console.log("theme switched !");
116
-    if (theme.classList == "theme darken") {
117
-      theme.classList = "theme lighten";
118
-    } else {
119
-      theme.classList = "theme darken";
120
-    }
121
-  });
122 123
 
123 124
 
124
-  snippet.appendChild(img)
125
-  snippet.appendChild(theme)
125
+    snippet.appendChild(img)
126
+    snippet.appendChild(theme)
127
+  } else {
128
+    console.log(snippet.classList);
129
+  }
126 130
 };

+ 3
- 1
Y/ystyle.css View File

@@ -178,7 +178,7 @@ footer {
178 178
   bottom: 0px;
179 179
   width: 100%;
180 180
   min-height: 150px;
181
-  background: rgba(0, 0, 0, 0.8);
181
+  background: rgba(19,19,19,.8);
182 182
   padding: 30px 50px;
183 183
   display: flex;
184 184
   flex-direction: row;
@@ -240,6 +240,7 @@ code * {
240 240
 }
241 241
 
242 242
 code div {
243
+  overflow: hidden;
243 244
   position: absolute;
244 245
   top: 12px;
245 246
   right: 12px;
@@ -249,6 +250,7 @@ code div {
249 250
   width: 42px;
250 251
   background: #333;
251 252
   cursor: pointer;
253
+  overflow-x: hidden;
252 254
 }
253 255
 
254 256
 code div.theme {

Loading…
Cancel
Save