Skip to content

Commit c07de5a

Browse files
1 parent be9e03e commit c07de5a

File tree

186 files changed

+78322
-69942
lines changed

Some content is hidden

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

186 files changed

+78322
-69942
lines changed

1207/404.html

Lines changed: 445 additions & 401 deletions
Large diffs are not rendered by default.

1207/algebra/all-submasks.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/balanced-ternary.html

Lines changed: 452 additions & 417 deletions
Large diffs are not rendered by default.

1207/algebra/big-integer.html

Lines changed: 451 additions & 412 deletions
Large diffs are not rendered by default.

1207/algebra/binary-exp.html

Lines changed: 456 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/bit-manipulation.html

Lines changed: 469 additions & 414 deletions
Large diffs are not rendered by default.

1207/algebra/chinese-remainder-theorem.html

Lines changed: 451 additions & 412 deletions
Large diffs are not rendered by default.

1207/algebra/continued-fractions.html

Lines changed: 478 additions & 435 deletions
Large diffs are not rendered by default.

1207/algebra/discrete-log.html

Lines changed: 456 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/discrete-root.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/divisors.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/euclid-algorithm.html

Lines changed: 470 additions & 415 deletions
Large diffs are not rendered by default.

1207/algebra/extended-euclid-algorithm.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/factorial-divisors.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/factorial-modulo.html

Lines changed: 452 additions & 417 deletions
Large diffs are not rendered by default.

1207/algebra/factoring-exp.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/factorization.html

Lines changed: 467 additions & 415 deletions
Large diffs are not rendered by default.

1207/algebra/fft.html

Lines changed: 469 additions & 414 deletions
Large diffs are not rendered by default.

1207/algebra/fibonacci-numbers.html

Lines changed: 452 additions & 417 deletions
Large diffs are not rendered by default.

1207/algebra/garners-algorithm.html

Lines changed: 450 additions & 411 deletions
Large diffs are not rendered by default.

1207/algebra/gray-code.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/linear-diophantine-equation.html

Lines changed: 474 additions & 418 deletions
Large diffs are not rendered by default.

1207/algebra/linear_congruence_equation.html

Lines changed: 451 additions & 412 deletions
Large diffs are not rendered by default.

1207/algebra/module-inverse.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/montgomery_multiplication.html

Lines changed: 451 additions & 412 deletions
Large diffs are not rendered by default.

1207/algebra/phi-function.html

Lines changed: 466 additions & 415 deletions
Large diffs are not rendered by default.

1207/algebra/polynomial.html

Lines changed: 453 additions & 414 deletions
Large diffs are not rendered by default.

1207/algebra/primality_tests.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/prime-sieve-linear.html

Lines changed: 452 additions & 413 deletions
Large diffs are not rendered by default.

1207/algebra/primitive-root.html

Lines changed: 452 additions & 417 deletions
Large diffs are not rendered by default.

1207/algebra/sieve-of-eratosthenes.html

Lines changed: 463 additions & 415 deletions
Large diffs are not rendered by default.

1207/assets/javascripts/bundle.525ec568.min.js

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

1207/assets/javascripts/bundle.525ec568.min.js.map

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

1207/assets/javascripts/bundle.c8b220af.min.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1207/assets/javascripts/bundle.c8b220af.min.js.map

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
(function() {
2+
const customDynamicStyle = document.createElement("style");
3+
document.head.appendChild(customDynamicStyle);
4+
5+
const TOGGLE_BUTTON_REFERENCE_ELEMENT_NOT_FOUND_WARNING = "[mkdocs-toggle-sidebar-plugin] Reference element for inserting 'toggle_button' not found. This version of the plugin may not be compatible with this version of the theme. Try updating both to the latest version. If that fails, you can open an GitHub issue.";
6+
7+
const loadBool = (name, default_value) => {
8+
const value = localStorage.getItem(`TOGGLE_SIDEBAR_${name}`);
9+
if (value == null) {
10+
return default_value;
11+
} else {
12+
return value == "1";
13+
}
14+
}
15+
16+
const loadNavigationState = () => loadBool("NAVIGATION", true);
17+
const loadTocState = () => loadBool("TOC", true);
18+
19+
const saveBool = (name, value) => {
20+
localStorage.setItem(`TOGGLE_SIDEBAR_${name}`, value ? "1" : "0");
21+
}
22+
23+
const toggleVisibility = (toggleNavigation, toggleTOC) => {
24+
let newNavigation = loadNavigationState();
25+
let newTOC = loadTocState();
26+
27+
if (toggleNavigation) {
28+
newNavigation = !newNavigation;
29+
saveBool("NAVIGATION", newNavigation);
30+
}
31+
if (toggleTOC) {
32+
newTOC = !newTOC;
33+
saveBool("TOC", newTOC);
34+
}
35+
36+
_setVisibility(newNavigation, newTOC);
37+
}
38+
39+
const _setVisibility = (newNavigation, newTOC) => {
40+
console.debug(`Setting new visibility: navigation=${newNavigation}, TOC=${newTOC}`);
41+
// combine this into one operation, so that it is more efficient (for toggling both) and easier to code with dynamic CSS generation
42+
customDynamicStyle.innerHTML = setCombinedVisibility(newNavigation, newTOC);
43+
}
44+
45+
// START OF INCLUDE
46+
// This gets replaced with the definitions of:
47+
// - setCombinedVisibility(showNavigation: bool, showTOC: bool) -> string (dynamic CSS)
48+
// - registerKeyboardEventHandler() -> void
49+
const setCombinedVisibility = (showNavigation, showTOC) => {
50+
// Hide the button when on mobile (and menu us shown as hamburger menu anyways).
51+
// The exact max-width is taken from the styling of the 'body > header > nav > a' element
52+
53+
let style = `
54+
.mkdocs-toggle-sidebar-button {
55+
cursor: pointer;
56+
margin-right: 5px;
57+
margin-left: 1rem;
58+
}
59+
60+
@media screen and (max-width: 76.1875em) {
61+
.mkdocs-toggle-sidebar-button {
62+
display: none;
63+
}
64+
}
65+
`;
66+
// The TOC has a different break point than the navigation.
67+
// It can be seen on the nav.md-nav--secondary:nth-child(1) element (60em)
68+
// If the screen is smaller, it is shown in the navigation section if you click the nested hamburger menu
69+
if (!showTOC) {
70+
style += `
71+
@media screen and (min-width: 60em) {
72+
div.md-sidebar.md-sidebar--secondary {
73+
display: none;
74+
}
75+
}
76+
`;
77+
}
78+
79+
// We always have to show the navigation in mobile view, otherwise the hamburger menu is broken
80+
if (!showNavigation) {
81+
style += `
82+
@media screen and (min-width: 76.1875em) {
83+
div.md-sidebar.md-sidebar--primary {
84+
display: none;
85+
}
86+
}
87+
`;
88+
}
89+
90+
return style;
91+
}
92+
93+
const addToggleButton = (toggleNavigation, toggleTOC) => {
94+
const toggleBtn = createDefaultToggleButton(toggleNavigation, toggleTOC);
95+
toggleBtn.classList.add("md-icon");
96+
97+
const titleElement = document.querySelector(".md-header__title");
98+
if (titleElement) {
99+
titleElement.parentNode.insertBefore(toggleBtn, titleElement.nextSibling);
100+
} else {
101+
console.warn(TOGGLE_BUTTON_REFERENCE_ELEMENT_NOT_FOUND_WARNING);
102+
}
103+
}
104+
105+
const registerKeyboardEventHandler = () => {
106+
// Custom key handlers: SEE https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/?h=key+bind#docsjavascriptsshortcutsjs
107+
keyboard$.subscribe(key => {
108+
if (key.mode === "global") {
109+
if (coreEventListenerLogic(key.type)) {
110+
// event handled, stop propagation
111+
key.claim();
112+
}
113+
}
114+
});
115+
}
116+
117+
// END OF INCLUDE
118+
119+
// argument: string, returns true if the key was handled and the event should be marked as already handled
120+
const coreEventListenerLogic = (keyChar) => {
121+
if (keyChar === "t") {
122+
toggleVisibility(false, true);
123+
return true;
124+
} else if (keyChar === "m") {
125+
toggleVisibility(true, false);
126+
return true;
127+
} else if (keyChar === "b") {
128+
toggleVisibility(true, true);
129+
return true;
130+
} else {
131+
return false;
132+
}
133+
}
134+
135+
window.addEventListener("load", () => {
136+
console.log("The mkdocs-toggle-sidebar-plugin is installed. It adds the following key bindings:\n T -> toggle table of contents sidebar\n M -> toggle navigation menu sidebar\n B -> toggle both sidebars (TOC and navigation)");
137+
138+
const toggle_button = "all";
139+
if (toggle_button == "none") {
140+
// do nothing
141+
} else if (toggle_button == "navigation") {
142+
addToggleButton(true, false);
143+
} else if (toggle_button == "toc") {
144+
addToggleButton(false, true);
145+
} else if (toggle_button == "all") {
146+
addToggleButton(true, true);
147+
} else {
148+
console.error(`[mkdocs-toggle-sidebar-plugin] Unknown value for toggle_button: '${toggleButtonType}'`);
149+
}
150+
151+
registerKeyboardEventHandler();
152+
customDynamicStyle.innerHTML = setCombinedVisibility(loadNavigationState(), loadTocState());
153+
});
154+
155+
const createDefaultToggleButton = (toggleNavigation, toggleTOC) => {
156+
const toggleBtn = document.createElement("div");
157+
toggleBtn.className = "mkdocs-toggle-sidebar-button";
158+
toggleBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"></path></svg>`;
159+
if (toggleNavigation && toggleTOC) {
160+
toggleBtn.title = "Toggle Navigation and Table of Contents";
161+
} else if (toggleNavigation) {
162+
toggleBtn.title = "Toggle Navigation";
163+
} else if (toggleTOC) {
164+
toggleBtn.title = "Toggle Table of Contents";
165+
}
166+
toggleBtn.addEventListener("click", () => toggleVisibility(toggleNavigation, toggleTOC));
167+
return toggleBtn;
168+
};
169+
170+
// Export functions that the user can call to modify the state
171+
window.MkdocsToggleSidebarPlugin = {
172+
setNavigationVisibility: (show) => {
173+
saveBool("NAVIGATION", show);
174+
_setVisibility(show, loadTocState());
175+
},
176+
setTocVisibility: (show) => {
177+
saveBool("TOC", show);
178+
_setVisibility(loadNavigationState(), show);
179+
},
180+
setAllVisibility: (showNavigation, showTOC) => {
181+
saveBool("NAVIGATION", showNavigation);
182+
saveBool("TOC", showTOC);
183+
_setVisibility(showNavigation, showTOC);
184+
},
185+
toggleNavigationVisibility: () => toggleVisibility(true, false),
186+
toggleTocVisibility: () => toggleVisibility(false, true),
187+
toggleAllVisibility: () => toggleVisibility(true, true)
188+
};
189+
}());

1207/assets/javascripts/workers/search.6ce7567c.min.js renamed to 1207/assets/javascripts/workers/search.f8cc74c7.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1207/assets/javascripts/workers/search.6ce7567c.min.js.map renamed to 1207/assets/javascripts/workers/search.f8cc74c7.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1207/assets/stylesheets/main.4af4bdda.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1207/assets/stylesheets/main.4af4bdda.min.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1207/assets/stylesheets/main.8c3ca2c6.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

1207/assets/stylesheets/main.8c3ca2c6.min.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)