Skip to content

Commit 61eecb3

Browse files
Deploying to gh-pages from @ 1bdebab 🚀
1 parent 2734955 commit 61eecb3

Some content is hidden

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

62 files changed

+11125
-11866
lines changed

Diff for: 000_introduction.html

+190-207
Large diffs are not rendered by default.

Diff for: 001_getting_help.html

+195-214
Large diffs are not rendered by default.

Diff for: 002_buying_stuff.html

+195-214
Large diffs are not rendered by default.

Diff for: 005_legal_stuff.html

+195-214
Large diffs are not rendered by default.

Diff for: 006_3d_printing.html

+195-214
Large diffs are not rendered by default.

Diff for: 007_beyond_multi_rotors.html

+195-214
Large diffs are not rendered by default.

Diff for: 008_linklist.html

+195-214
Large diffs are not rendered by default.

Diff for: 009_miscellaneous.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/010_radio/010_radio.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/010_radio/011_radio_protocols.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/010_radio/012_radio_software.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/010_radio/013_radio_recommendations.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/020_simulator/020_simulator.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/020_simulator/021_flight_modes.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/020_simulator/022_racing_getting_started.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_decisions.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/030_video_systems.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/031_analog.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/032_digital_DJI/0320_DJI_general.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/032_digital_DJI/0321_DJI_v1.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/032_digital_DJI/0322_DJI_v2.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/032_digital_DJI/0323_DJI_v3.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/033_digital_HDZero.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/034_digital_caddx.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/030_video_systems/035_other_systems.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/040_flight_styles/040_flight_styles.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/040_flight_styles/041_pastime.html

+195-214
Large diffs are not rendered by default.

Diff for: 03_decisions/040_flight_styles/042_racing.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/000_copters.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/002_classes.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/010_components.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/011_frame.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/012_flight_controller.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/013_radio_receiver.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/014_video_transmitter.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/015_electronic_speed_controller.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/016_motor.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/017_propeller.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/010_components/018_miscellaneous.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/030_battery/030_battery.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/030_battery/031_battery_safety.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/030_battery/032_battery_charger.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/030_battery/033_battery_lifecycle.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/030_battery/034_battery_parallel_charging.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/040_my_first_copter/040_my_first_copter.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/040_my_first_copter/041_buying_a_copter.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/040_my_first_copter/042_building_a_copter.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/040_my_first_copter/043_soldering.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/040_my_first_copter/044_build_on_demand.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/050_hd_recording.html

+195-214
Large diffs are not rendered by default.

Diff for: 04_copters/060_additional_equipment.html

+195-214
Large diffs are not rendered by default.

Diff for: 404.html

+185-199
Large diffs are not rendered by default.

Diff for: CONTRIBUTORS.html

+190-207
Large diffs are not rendered by default.

Diff for: book.js

+61-50
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
window.onunload = function () { };
55

66
// Global variable, shared between modules
7-
function playground_text(playground) {
7+
function playground_text(playground, hidden = true) {
88
let code_block = playground.querySelector("code");
99

1010
if (window.ace && code_block.classList.contains("editable")) {
1111
let editor = window.ace.edit(code_block);
1212
return editor.getValue();
13-
} else {
13+
} else if (hidden) {
1414
return code_block.textContent;
15+
} else {
16+
return code_block.innerText;
1517
}
1618
}
1719

@@ -66,7 +68,7 @@ function playground_text(playground) {
6668
}
6769

6870
// updates the visibility of play button based on `no_run` class and
69-
// used crates vs ones available on http://play.rust-lang.org
71+
// used crates vs ones available on https://play.rust-lang.org
7072
function update_play_button(pre_block, playground_crates) {
7173
var play_button = pre_block.querySelector(".play-button");
7274

@@ -166,7 +168,6 @@ function playground_text(playground) {
166168
.filter(function (node) {return node.classList.contains("editable"); })
167169
.forEach(function (block) { block.classList.remove('language-rust'); });
168170

169-
Array
170171
code_nodes
171172
.filter(function (node) {return !node.classList.contains("editable"); })
172173
.forEach(function (block) { hljs.highlightBlock(block); });
@@ -178,7 +179,7 @@ function playground_text(playground) {
178179
// even if highlighting doesn't apply
179180
code_nodes.forEach(function (block) { block.classList.add('hljs'); });
180181

181-
Array.from(document.querySelectorAll("code.language-rust")).forEach(function (block) {
182+
Array.from(document.querySelectorAll("code.hljs")).forEach(function (block) {
182183

183184
var lines = Array.from(block.querySelectorAll('.boring'));
184185
// If no lines were hidden, return
@@ -224,7 +225,7 @@ function playground_text(playground) {
224225
}
225226

226227
var clipButton = document.createElement('button');
227-
clipButton.className = 'fa fa-copy clip-button';
228+
clipButton.className = 'clip-button';
228229
clipButton.title = 'Copy to clipboard';
229230
clipButton.setAttribute('aria-label', clipButton.title);
230231
clipButton.innerHTML = '<i class=\"tooltiptext\"></i>';
@@ -257,7 +258,7 @@ function playground_text(playground) {
257258

258259
if (window.playground_copyable) {
259260
var copyCodeClipboardButton = document.createElement('button');
260-
copyCodeClipboardButton.className = 'fa fa-copy clip-button';
261+
copyCodeClipboardButton.className = 'clip-button';
261262
copyCodeClipboardButton.innerHTML = '<i class="tooltiptext"></i>';
262263
copyCodeClipboardButton.title = 'Copy to clipboard';
263264
copyCodeClipboardButton.setAttribute('aria-label', copyCodeClipboardButton.title);
@@ -288,6 +289,10 @@ function playground_text(playground) {
288289
var themeToggleButton = document.getElementById('theme-toggle');
289290
var themePopup = document.getElementById('theme-list');
290291
var themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
292+
var themeIds = [];
293+
themePopup.querySelectorAll('button.theme').forEach(function (el) {
294+
themeIds.push(el.id);
295+
});
291296
var stylesheets = {
292297
ayuHighlight: document.querySelector("[href$='ayu-highlight.css']"),
293298
tomorrowNight: document.querySelector("[href$='tomorrow-night.css']"),
@@ -300,6 +305,13 @@ function playground_text(playground) {
300305
themePopup.querySelector("button#" + get_theme()).focus();
301306
}
302307

308+
function updateThemeSelected() {
309+
themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
310+
el.classList.remove('theme-selected');
311+
});
312+
themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
313+
}
314+
303315
function hideThemes() {
304316
themePopup.style.display = 'none';
305317
themeToggleButton.setAttribute('aria-expanded', false);
@@ -309,7 +321,7 @@ function playground_text(playground) {
309321
function get_theme() {
310322
var theme;
311323
try { theme = localStorage.getItem('mdbook-theme'); } catch (e) { }
312-
if (theme === null || theme === undefined) {
324+
if (theme === null || theme === undefined || !themeIds.includes(theme)) {
313325
return default_theme;
314326
} else {
315327
return theme;
@@ -338,7 +350,7 @@ function playground_text(playground) {
338350
}
339351

340352
setTimeout(function () {
341-
themeColorMetaTag.content = getComputedStyle(document.body).backgroundColor;
353+
themeColorMetaTag.content = getComputedStyle(document.documentElement).backgroundColor;
342354
}, 1);
343355

344356
if (window.ace && window.editors) {
@@ -355,6 +367,7 @@ function playground_text(playground) {
355367

356368
html.classList.remove(previousTheme);
357369
html.classList.add(theme);
370+
updateThemeSelected();
358371
}
359372

360373
// Set theme
@@ -432,16 +445,16 @@ function playground_text(playground) {
432445
})();
433446

434447
(function sidebar() {
435-
var html = document.querySelector("html");
448+
var body = document.querySelector("body");
436449
var sidebar = document.getElementById("sidebar");
437450
var sidebarLinks = document.querySelectorAll('#sidebar a');
438451
var sidebarToggleButton = document.getElementById("sidebar-toggle");
439452
var sidebarResizeHandle = document.getElementById("sidebar-resize-handle");
440453
var firstContact = null;
441454

442455
function showSidebar() {
443-
html.classList.remove('sidebar-hidden')
444-
html.classList.add('sidebar-visible');
456+
body.classList.remove('sidebar-hidden')
457+
body.classList.add('sidebar-visible');
445458
Array.from(sidebarLinks).forEach(function (link) {
446459
link.setAttribute('tabIndex', 0);
447460
});
@@ -450,20 +463,9 @@ function playground_text(playground) {
450463
try { localStorage.setItem('mdbook-sidebar', 'visible'); } catch (e) { }
451464
}
452465

453-
454-
var sidebarAnchorToggles = document.querySelectorAll('#sidebar a.toggle');
455-
456-
function toggleSection(ev) {
457-
ev.currentTarget.parentElement.classList.toggle('expanded');
458-
}
459-
460-
Array.from(sidebarAnchorToggles).forEach(function (el) {
461-
el.addEventListener('click', toggleSection);
462-
});
463-
464466
function hideSidebar() {
465-
html.classList.remove('sidebar-visible')
466-
html.classList.add('sidebar-hidden');
467+
body.classList.remove('sidebar-visible')
468+
body.classList.add('sidebar-hidden');
467469
Array.from(sidebarLinks).forEach(function (link) {
468470
link.setAttribute('tabIndex', -1);
469471
});
@@ -474,14 +476,14 @@ function playground_text(playground) {
474476

475477
// Toggle sidebar
476478
sidebarToggleButton.addEventListener('click', function sidebarToggle() {
477-
if (html.classList.contains("sidebar-hidden")) {
479+
if (body.classList.contains("sidebar-hidden")) {
478480
var current_width = parseInt(
479481
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
480482
if (current_width < 150) {
481483
document.documentElement.style.setProperty('--sidebar-width', '150px');
482484
}
483485
showSidebar();
484-
} else if (html.classList.contains("sidebar-visible")) {
486+
} else if (body.classList.contains("sidebar-visible")) {
485487
hideSidebar();
486488
} else {
487489
if (getComputedStyle(sidebar)['transform'] === 'none') {
@@ -497,14 +499,14 @@ function playground_text(playground) {
497499
function initResize(e) {
498500
window.addEventListener('mousemove', resize, false);
499501
window.addEventListener('mouseup', stopResize, false);
500-
html.classList.add('sidebar-resizing');
502+
body.classList.add('sidebar-resizing');
501503
}
502504
function resize(e) {
503505
var pos = (e.clientX - sidebar.offsetLeft);
504506
if (pos < 20) {
505507
hideSidebar();
506508
} else {
507-
if (html.classList.contains("sidebar-hidden")) {
509+
if (body.classList.contains("sidebar-hidden")) {
508510
showSidebar();
509511
}
510512
pos = Math.min(pos, window.innerWidth - 100);
@@ -513,7 +515,7 @@ function playground_text(playground) {
513515
}
514516
//on mouseup remove windows functions mousemove & mouseup
515517
function stopResize(e) {
516-
html.classList.remove('sidebar-resizing');
518+
body.classList.remove('sidebar-resizing');
517519
window.removeEventListener('mousemove', resize, false);
518520
window.removeEventListener('mouseup', stopResize, false);
519521
}
@@ -542,33 +544,41 @@ function playground_text(playground) {
542544
firstContact = null;
543545
}
544546
}, { passive: true });
545-
546-
// Scroll sidebar to current active section
547-
var activeSection = document.getElementById("sidebar").querySelector(".active");
548-
if (activeSection) {
549-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
550-
activeSection.scrollIntoView({ block: 'center' });
551-
}
552547
})();
553548

554549
(function chapterNavigation() {
555550
document.addEventListener('keydown', function (e) {
556551
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
557552
if (window.search && window.search.hasFocus()) { return; }
553+
var html = document.querySelector('html');
558554

555+
function next() {
556+
var nextButton = document.querySelector('.nav-chapters.next');
557+
if (nextButton) {
558+
window.location.href = nextButton.href;
559+
}
560+
}
561+
function prev() {
562+
var previousButton = document.querySelector('.nav-chapters.previous');
563+
if (previousButton) {
564+
window.location.href = previousButton.href;
565+
}
566+
}
559567
switch (e.key) {
560568
case 'ArrowRight':
561569
e.preventDefault();
562-
var nextButton = document.querySelector('.nav-chapters.next');
563-
if (nextButton) {
564-
window.location.href = nextButton.href;
570+
if (html.dir == 'rtl') {
571+
prev();
572+
} else {
573+
next();
565574
}
566575
break;
567576
case 'ArrowLeft':
568577
e.preventDefault();
569-
var previousButton = document.querySelector('.nav-chapters.previous');
570-
if (previousButton) {
571-
window.location.href = previousButton.href;
578+
if (html.dir == 'rtl') {
579+
next();
580+
} else {
581+
prev();
572582
}
573583
break;
574584
}
@@ -580,19 +590,19 @@ function playground_text(playground) {
580590

581591
function hideTooltip(elem) {
582592
elem.firstChild.innerText = "";
583-
elem.className = 'fa fa-copy clip-button';
593+
elem.className = 'clip-button';
584594
}
585595

586596
function showTooltip(elem, msg) {
587597
elem.firstChild.innerText = msg;
588-
elem.className = 'fa fa-copy tooltipped';
598+
elem.className = 'clip-button tooltipped';
589599
}
590600

591601
var clipboardSnippets = new ClipboardJS('.clip-button', {
592602
text: function (trigger) {
593603
hideTooltip(trigger);
594604
let playground = trigger.closest("pre");
595-
return playground_text(playground);
605+
return playground_text(playground, false);
596606
}
597607
});
598608

@@ -667,13 +677,14 @@ function playground_text(playground) {
667677
}, { passive: true });
668678
})();
669679
(function controllBorder() {
670-
menu.classList.remove('bordered');
671-
document.addEventListener('scroll', function () {
680+
function updateBorder() {
672681
if (menu.offsetTop === 0) {
673682
menu.classList.remove('bordered');
674683
} else {
675684
menu.classList.add('bordered');
676685
}
677-
}, { passive: true });
686+
}
687+
updateBorder();
688+
document.addEventListener('scroll', updateBorder, { passive: true });
678689
})();
679-
})();
690+
})();

0 commit comments

Comments
 (0)