Skip to content

Commit 8ec56fa

Browse files
committed
update
1 parent 9c3e2c7 commit 8ec56fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2062
-3872
lines changed

404.html

Lines changed: 57 additions & 53 deletions
Large diffs are not rendered by default.

FontAwesome/css/font-awesome.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

FontAwesome/fonts/FontAwesome.ttf

-162 KB
Binary file not shown.
-162 KB
Binary file not shown.

FontAwesome/fonts/fontawesome-webfont.svg

Lines changed: 0 additions & 2671 deletions
This file was deleted.
-162 KB
Binary file not shown.
-95.7 KB
Binary file not shown.
-75.4 KB
Binary file not shown.

ayu-highlight.css renamed to ayu-highlight-3fdfc3ac.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Original by Dempfi (https://github.com/dempfi/ayu)
1313
.hljs-comment,
1414
.hljs-quote {
1515
color: #5c6773;
16-
font-style: italic;
1716
}
1817

1918
.hljs-variable,

book.js renamed to book-a0b12cfe.js

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ function playground_text(playground, hidden = true) {
8585
const re = /extern\s+crate\s+([a-zA-Z_0-9]+)\s*;/g;
8686
const snippet_crates = [];
8787
let item;
88-
// eslint-disable-next-line no-cond-assign
8988
while (item = re.exec(txt)) {
9089
snippet_crates.push(item[1]);
9190
}
@@ -97,6 +96,7 @@ function playground_text(playground, hidden = true) {
9796

9897
if (all_available) {
9998
play_button.classList.remove('hidden');
99+
play_button.hidden = false;
100100
} else {
101101
play_button.classList.add('hidden');
102102
}
@@ -207,26 +207,25 @@ function playground_text(playground, hidden = true) {
207207

208208
const buttons = document.createElement('div');
209209
buttons.className = 'buttons';
210-
buttons.innerHTML = '<button class="fa fa-eye" title="Show hidden lines" \
210+
buttons.innerHTML = '<button title="Show hidden lines" \
211211
aria-label="Show hidden lines"></button>';
212+
buttons.firstChild.innerHTML = document.getElementById('fa-eye').innerHTML;
212213

213214
// add expand button
214215
const pre_block = block.parentNode;
215216
pre_block.insertBefore(buttons, pre_block.firstChild);
216217

217-
pre_block.querySelector('.buttons').addEventListener('click', function(e) {
218-
if (e.target.classList.contains('fa-eye')) {
219-
e.target.classList.remove('fa-eye');
220-
e.target.classList.add('fa-eye-slash');
221-
e.target.title = 'Hide lines';
222-
e.target.setAttribute('aria-label', e.target.title);
218+
buttons.firstChild.addEventListener('click', function(e) {
219+
if (this.title === 'Show hidden lines') {
220+
this.innerHTML = document.getElementById('fa-eye-slash').innerHTML;
221+
this.title = 'Hide lines';
222+
this.setAttribute('aria-label', e.target.title);
223223

224224
block.classList.remove('hide-boring');
225-
} else if (e.target.classList.contains('fa-eye-slash')) {
226-
e.target.classList.remove('fa-eye-slash');
227-
e.target.classList.add('fa-eye');
228-
e.target.title = 'Show hidden lines';
229-
e.target.setAttribute('aria-label', e.target.title);
225+
} else if (this.title === 'Hide lines') {
226+
this.innerHTML = document.getElementById('fa-eye').innerHTML;
227+
this.title = 'Show hidden lines';
228+
this.setAttribute('aria-label', e.target.title);
230229

231230
block.classList.add('hide-boring');
232231
}
@@ -266,10 +265,11 @@ aria-label="Show hidden lines"></button>';
266265
}
267266

268267
const runCodeButton = document.createElement('button');
269-
runCodeButton.className = 'fa fa-play play-button';
268+
runCodeButton.className = 'play-button';
270269
runCodeButton.hidden = true;
271270
runCodeButton.title = 'Run this code';
272271
runCodeButton.setAttribute('aria-label', runCodeButton.title);
272+
runCodeButton.innerHTML = document.getElementById('fa-play').innerHTML;
273273

274274
buttons.insertBefore(runCodeButton, buttons.firstChild);
275275
runCodeButton.addEventListener('click', () => {
@@ -289,9 +289,11 @@ aria-label="Show hidden lines"></button>';
289289
const code_block = pre_block.querySelector('code');
290290
if (window.ace && code_block.classList.contains('editable')) {
291291
const undoChangesButton = document.createElement('button');
292-
undoChangesButton.className = 'fa fa-history reset-button';
292+
undoChangesButton.className = 'reset-button';
293293
undoChangesButton.title = 'Undo changes';
294294
undoChangesButton.setAttribute('aria-label', undoChangesButton.title);
295+
undoChangesButton.innerHTML +=
296+
document.getElementById('fa-clock-rotate-left').innerHTML;
295297

296298
buttons.insertBefore(undoChangesButton, buttons.firstChild);
297299

@@ -306,34 +308,34 @@ aria-label="Show hidden lines"></button>';
306308

307309
(function themes() {
308310
const html = document.querySelector('html');
309-
const themeToggleButton = document.getElementById('theme-toggle');
310-
const themePopup = document.getElementById('theme-list');
311+
const themeToggleButton = document.getElementById('mdbook-theme-toggle');
312+
const themePopup = document.getElementById('mdbook-theme-list');
311313
const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
312314
const themeIds = [];
313315
themePopup.querySelectorAll('button.theme').forEach(function(el) {
314316
themeIds.push(el.id);
315317
});
316318
const stylesheets = {
317-
ayuHighlight: document.querySelector('#ayu-highlight-css'),
318-
tomorrowNight: document.querySelector('#tomorrow-night-css'),
319-
highlight: document.querySelector('#highlight-css'),
319+
ayuHighlight: document.querySelector('#mdbook-ayu-highlight-css'),
320+
tomorrowNight: document.querySelector('#mdbook-tomorrow-night-css'),
321+
highlight: document.querySelector('#mdbook-highlight-css'),
320322
};
321323

322324
function showThemes() {
323325
themePopup.style.display = 'block';
324326
themeToggleButton.setAttribute('aria-expanded', true);
325-
themePopup.querySelector('button#' + get_theme()).focus();
327+
themePopup.querySelector('button#mdbook-theme-' + get_theme()).focus();
326328
}
327329

328330
function updateThemeSelected() {
329331
themePopup.querySelectorAll('.theme-selected').forEach(function(el) {
330332
el.classList.remove('theme-selected');
331333
});
332334
const selected = get_saved_theme() ?? 'default_theme';
333-
let element = themePopup.querySelector('button#' + selected);
335+
let element = themePopup.querySelector('button#mdbook-theme-' + selected);
334336
if (element === null) {
335337
// Fall back in case there is no "Default" item.
336-
element = themePopup.querySelector('button#' + get_theme());
338+
element = themePopup.querySelector('button#mdbook-theme-' + get_theme());
337339
}
338340
element.classList.add('theme-selected');
339341
}
@@ -348,7 +350,7 @@ aria-label="Show hidden lines"></button>';
348350
let theme = null;
349351
try {
350352
theme = localStorage.getItem('mdbook-theme');
351-
} catch (e) {
353+
} catch {
352354
// ignore error.
353355
}
354356
return theme;
@@ -360,7 +362,7 @@ aria-label="Show hidden lines"></button>';
360362

361363
function get_theme() {
362364
const theme = get_saved_theme();
363-
if (theme === null || theme === undefined || !themeIds.includes(theme)) {
365+
if (theme === null || theme === undefined || !themeIds.includes('mdbook-theme-' + theme)) {
364366
if (typeof default_dark_theme === 'undefined') {
365367
// A customized index.hbs might not define this, so fall back to
366368
// old behavior of determining the default on page load.
@@ -409,7 +411,7 @@ aria-label="Show hidden lines"></button>';
409411
if (store) {
410412
try {
411413
localStorage.setItem('mdbook-theme', theme);
412-
} catch (e) {
414+
} catch {
413415
// ignore error.
414416
}
415417
}
@@ -445,6 +447,8 @@ aria-label="Show hidden lines"></button>';
445447
} else {
446448
return;
447449
}
450+
theme = theme.replace(/^mdbook-theme-/, '');
451+
448452
if (theme === 'default_theme' || theme === null) {
449453
delete_saved_theme();
450454
set_theme(get_theme(), false);
@@ -515,11 +519,11 @@ aria-label="Show hidden lines"></button>';
515519
})();
516520

517521
(function sidebar() {
518-
const sidebar = document.getElementById('sidebar');
519-
const sidebarLinks = document.querySelectorAll('#sidebar a');
520-
const sidebarToggleButton = document.getElementById('sidebar-toggle');
521-
const sidebarResizeHandle = document.getElementById('sidebar-resize-handle');
522-
const sidebarCheckbox = document.getElementById('sidebar-toggle-anchor');
522+
const sidebar = document.getElementById('mdbook-sidebar');
523+
const sidebarLinks = document.querySelectorAll('#mdbook-sidebar a');
524+
const sidebarToggleButton = document.getElementById('mdbook-sidebar-toggle');
525+
const sidebarResizeHandle = document.getElementById('mdbook-sidebar-resize-handle');
526+
const sidebarCheckbox = document.getElementById('mdbook-sidebar-toggle-anchor');
523527
let firstContact = null;
524528

525529

@@ -555,7 +559,7 @@ aria-label="Show hidden lines"></button>';
555559
sidebar.setAttribute('aria-hidden', false);
556560
try {
557561
localStorage.setItem('mdbook-sidebar', 'visible');
558-
} catch (e) {
562+
} catch {
559563
// Ignore error.
560564
}
561565
}
@@ -569,7 +573,7 @@ aria-label="Show hidden lines"></button>';
569573
sidebar.setAttribute('aria-hidden', true);
570574
try {
571575
localStorage.setItem('mdbook-sidebar', 'hidden');
572-
} catch (e) {
576+
} catch {
573577
// Ignore error.
574578
}
575579
}
@@ -780,7 +784,7 @@ aria-label="Show hidden lines"></button>';
780784
})();
781785

782786
(function controllMenu() {
783-
const menu = document.getElementById('menu-bar');
787+
const menu = document.getElementById('mdbook-menu-bar');
784788

785789
(function controllPosition() {
786790
let scrollTop = document.scrollingElement.scrollTop;

0 commit comments

Comments
 (0)