|
16 | 16 | {%- set this_menu = sections[1].split("%") %} |
17 | 17 | {%- set this_menu_url = this_menu[0] | trim | safe %} |
18 | 18 | {%- set this_menu_name = this_menu[1] | trim | safe %} |
| 19 | + {%- if this_menu_name != "Index" %} |
19 | 20 | {%- set this_menu = [this_menu_url, this_menu_name] %} |
20 | 21 | {%- for section in sections[2:] %} |
21 | 22 | {%- set this_section = section.split("%")%} |
|
28 | 29 | {%- endfor %} |
29 | 30 | {%- set _ = menus.append(this_menu) %} |
30 | 31 | {%- endif %} |
| 32 | + {%- endif %} |
31 | 33 | {%- endfor %} |
32 | 34 | {%- set last_menu = menus[-1][1] %} |
33 | 35 |
|
|
61 | 63 | {%- set url = section[0] %} |
62 | 64 | {%- set entry = section[1] %} |
63 | 65 | {%- if entry == title %} |
64 | | - </ul> |
| 66 | + </ul> |
65 | 67 | {{ toc }} |
66 | | - <ul> |
| 68 | + <ul id="smallScreenMenuAfterTOC"> |
67 | 69 | {%- else %} |
68 | 70 | <li class="outer"> |
69 | 71 | <a href="{{ url }}">{{ entry }}</a> |
|
95 | 97 | <div class="header"> |
96 | 98 | <div class="logo"> |
97 | 99 | <a href="{{ pathto(master_doc) }}"> |
98 | | - <img class="logo" src="{{ pathto('_static/' ~ logo, 1) }}" alt="Logo" /> |
| 100 | + <img class="logo" src="{{ pathto('_static/smileiLogo_tutorials.svg', 1) }}" alt="Logo" /> |
99 | 101 | </a> |
100 | 102 | </div> |
101 | 103 |
|
|
160 | 162 | <g transform="translate(0,-932.36216)" > |
161 | 163 | <circle |
162 | 164 | r="25" cy="977.51044" cx="38.078663" |
163 | | - style="opacity:1;fill:none;stroke:#ffffff;stroke-width:10;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> |
| 165 | + style="opacity:1;fill:none;stroke:#ffffff;stroke:var(--header_text);stroke-width:10;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> |
164 | 166 | <rect |
165 | 167 | transform="matrix(0.36717877,0.93015039,-0.93427297,0.35655858,0,0)" |
166 | | - rx="4.9996676" ry="7.4995141" |
167 | | - y="316.16959" x="947.6142" |
| 168 | + rx="4.9996676" ry="7.4995141" x="947.6142" y="316.16959" |
168 | 169 | height="14.117695" width="46.476151" |
169 | | - style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;" /> |
| 170 | + style="opacity:1;fill:#ffffff;fill:var(--header_text);fill-opacity:1;stroke:none;" /> |
170 | 171 | <path |
171 | 172 | d="m 41.383282,962.25996 a 15,15 0 0 1 11.660107,11.6355" |
172 | | - style="opacity:1;fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> |
| 173 | + style="opacity:1;fill:none;stroke:#ffffff;stroke:var(--header_text);stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> |
173 | 174 | </g> |
174 | 175 | </svg> |
175 | 176 | </div> |
|
178 | 179 | xmlns="http://www.w3.org/2000/svg" |
179 | 180 | viewBox="0 0 80 120"> |
180 | 181 | <g |
181 | | - transform="translate(0,-932.36216)"> |
182 | | - <path |
183 | | - d="m 10,962.36216 60,60.00004" |
184 | | - style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> |
185 | | - <path |
186 | | - d="M 70,962.36216 10,1022.3622" |
187 | | - style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> |
| 182 | + transform="translate(0,-932.36216)" |
| 183 | + style="fill:none;stroke:#ffffff;stroke:var(--header_text);stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"> |
| 184 | + <path d="m 10,962.36216 60,60.00004" /> |
| 185 | + <path d="M 70,962.36216 10,1022.3622" /> |
188 | 186 | </g> |
189 | 187 | </svg> |
190 | 188 | </div> |
191 | 189 |
|
192 | | - <div id="smallScreenMenuButton" onclick="toggleSmallScreenMenu(event)"> |
| 190 | + <div id="smallScreenMenuButton" onclick="event.preventDefault(); toggleSmallScreenMenu(event)"> |
193 | 191 | <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" |
194 | 192 | viewBox="-20 -20 140 140"> |
195 | | - <g style="fill:#ffffff;stroke:none;"> |
| 193 | + <g style="fill:#ffffff; fill:var(--header_text);stroke:none;"> |
196 | 194 | <circle cx="15" cy="20" r="5" /> |
197 | 195 | <circle cx="35" cy="20" r="5" /> |
198 | 196 | <circle cx="85" cy="20" r="5" /> |
|
221 | 219 | {%- endblock %} |
222 | 220 |
|
223 | 221 |
|
224 | | -{%- block document %} |
225 | | - <div class="documentwrapper"> |
226 | | - <div class="body" role="main"> |
227 | | - {% block body %} {% endblock %} |
228 | | - {%- if title | lower == "index" %} |
229 | | - <div class="siteindex"><div> |
230 | | - |
231 | | - {%- for menu in menus %} |
232 | | - {%- set menu_name = menu[1] %} |
233 | | - {%- set sections = menu[2:] %} |
234 | | - <h2>{{ menu_name }}</h2> |
235 | | - <ul> |
236 | | - {%- for section in sections %} |
237 | | - {%- set url = section[0] %} |
238 | | - {%- set entry = section[1] %} |
239 | | - <li> |
240 | | - <a href="{{ url }}">{{ entry }}</a> |
241 | | - </li> |
242 | | - {%- endfor %} |
243 | | - </ul> |
244 | | - {%- endfor %} |
245 | | - |
246 | | - </div> |
247 | | - {%- endif %} |
248 | | - </div></div> |
249 | | - </div> |
250 | | -{%- endblock %} |
251 | | - |
252 | | - |
253 | 222 |
|
254 | 223 | {%- block footer %} |
255 | 224 | <div class="footer"> |
| 225 | + <div> |
| 226 | + <input type="button" id="themebutton" value="" onclick="switchTheme('')" /> |
| 227 | + </div> |
256 | 228 | <div> |
257 | 229 | <a href="site.html">Site index</a> |
258 | 230 | </div> |
@@ -288,6 +260,30 @@ <h2>{{ menu_name }}</h2> |
288 | 260 | for( var i=0; i<menus.length; i++ ) |
289 | 261 | menus[i].active = false; |
290 | 262 |
|
| 263 | + // Manage theme |
| 264 | + var theme="light"; |
| 265 | + function switchTheme(type) { |
| 266 | + if( type == "dark" || ( ! type && theme == "light" ) ) { |
| 267 | + theme = "dark"; |
| 268 | + document.documentElement.setAttribute('theme', 'dark'); |
| 269 | + window.name = "dark_theme" |
| 270 | + localStorage.setItem("_theme","dark") |
| 271 | + } else { |
| 272 | + theme = "light"; |
| 273 | + document.documentElement.setAttribute('theme', 'light'); |
| 274 | + window.name = "light_theme" |
| 275 | + localStorage.setItem("_theme","light") |
| 276 | + } |
| 277 | + } |
| 278 | + if( window.name && window.name == "light_theme" ) { |
| 279 | + switchTheme("light"); |
| 280 | + } else if ( window.name && window.name == "dark_theme" ) { |
| 281 | + switchTheme("dark"); |
| 282 | + } else if( stored_theme = localStorage.getItem("_theme") ) { |
| 283 | + switchTheme(stored_theme); |
| 284 | + } else if( window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) { |
| 285 | + switchTheme("dark"); |
| 286 | + } |
291 | 287 |
|
292 | 288 | var ul = nav_list.getElementsByTagName("ul")[0], li; |
293 | 289 | var keep_nav = false; |
@@ -322,13 +318,24 @@ <h2>{{ menu_name }}</h2> |
322 | 318 | } |
323 | 319 |
|
324 | 320 | function toggleSmallScreenMenu(e) { |
325 | | - e.preventDefault(); |
326 | 321 | if( smallScreenMenu.className != "on" ) { |
327 | 322 | smallScreenMenu.className = "on"; |
328 | 323 | smallScreenMenuButton.className = "pushed"; |
| 324 | + document.documentElement.style.overflow = "hidden"; |
329 | 325 | } else { |
330 | 326 | smallScreenMenu.className = "off"; |
331 | 327 | smallScreenMenuButton.className = ""; |
| 328 | + document.documentElement.style.overflow = ""; |
| 329 | + } |
| 330 | + } |
| 331 | + |
| 332 | + if (smallScreenMenuAfterTOC = document.getElementById("smallScreenMenuAfterTOC")) { |
| 333 | + var smallScreenMenuTOC = smallScreenMenuAfterTOC.previousElementSibling |
| 334 | + .getElementsByTagName("li")[0].getElementsByTagName("ul")[0].getElementsByTagName("li"); |
| 335 | + for (var i = 0; i < smallScreenMenuTOC.length; i++) { |
| 336 | + if (smallScreenMenuTOC[i].tagName = "a") { |
| 337 | + smallScreenMenuTOC[i].addEventListener("click", function(event){ toggleSmallScreenMenu(event); } ); |
| 338 | + } |
332 | 339 | } |
333 | 340 | } |
334 | 341 |
|
|
0 commit comments