clean-jsdoc-theme 4.0.4 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
- package/static/scripts/core.js +19 -10
- package/static/scripts/core.min.js +22 -22
- package/static/scripts/search.js +15 -10
- package/static/scripts/search.min.js +2 -2
- package/tmpl/layout.tmpl +3 -3
- package/tmpl/search.tmpl +5 -5
- package/tmpl/toc.tmpl +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# clean-jsdoc-theme
|
|
2
2
|
|
|
3
|
-
[](https://github.com/ankitskvmdam/clean-jsdoc-theme) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ](https://github.com/ankitskvmdam/clean-jsdoc-theme) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork)  [](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
|
|
4
4
|
<br>
|
|
5
5
|
|
|
6
6
|
clean-jsdoc-theme is a beautifully crafted theme for JSDoc 3. It is a clean and fully responsive theme with loads of customisation features.
|
|
@@ -12,7 +12,7 @@ Some salient features:
|
|
|
12
12
|
1. It minifies all the output HTML files (this helps in saving a few KBs).
|
|
13
13
|
1. It has search support. The search feature doesn't increase the size of output HTML files.
|
|
14
14
|
1. It updates regularly.
|
|
15
|
-
1. It is highly performant. Check lighthouse report
|
|
15
|
+
1. It is highly performant. [Check lighthouse report here](https://googlechrome.github.io/lighthouse/viewer/?psiurl=https%3A%2F%2Fankdev.me%2Fclean-jsdoc-theme%2Fv4%2Findex.html&strategy=desktop&category=performance&category=accessibility&category=best-practices&category=seo&category=pwa&utm_source=lh-chrome-ext).
|
|
16
16
|
|
|
17
17
|
We know that no library is perfect. That's why we are open to hearing from the community about the theme. For any suggestions, questions or bugs, feel free to create an <a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/issues">issue</a>.
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clean-jsdoc-theme",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "A beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template. This is a fully mobile responsive theme and also fully customizable theme.",
|
|
5
5
|
"main": "publish.js",
|
|
6
6
|
"scripts": {
|
package/static/scripts/core.js
CHANGED
|
@@ -307,21 +307,28 @@ function getPreDiv() {
|
|
|
307
307
|
|
|
308
308
|
function processAllPre() {
|
|
309
309
|
var targets = document.querySelectorAll('pre');
|
|
310
|
-
var footer = document.querySelector('#
|
|
311
|
-
var navbar = document.querySelector('#
|
|
310
|
+
var footer = document.querySelector('#PeOAagUepe');
|
|
311
|
+
var navbar = document.querySelector('#VuAckcnZhf');
|
|
312
312
|
|
|
313
|
-
var
|
|
314
|
-
var
|
|
313
|
+
var navbarHeight = 0;
|
|
314
|
+
var footerHeight = 0;
|
|
315
|
+
|
|
316
|
+
if (footer) {
|
|
317
|
+
footerHeight = footer.getBoundingClientRect().height;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (navbar) {
|
|
321
|
+
navbarHeight = navbar.getBoundingClientRect().height;
|
|
322
|
+
}
|
|
315
323
|
|
|
316
324
|
// eslint-disable-next-line no-undef
|
|
317
325
|
var preMaxHeight = window.innerHeight - navbarHeight - footerHeight - 250;
|
|
318
326
|
|
|
319
|
-
// var isSource = isSourcePage();
|
|
320
|
-
|
|
321
327
|
targets.forEach(function(pre, idx) {
|
|
322
328
|
var div = getPreDiv();
|
|
323
|
-
var id = '
|
|
324
|
-
|
|
329
|
+
var id = 'ScDloZOMdL' + idx;
|
|
330
|
+
|
|
331
|
+
var lang = pre.getAttribute('data-lang') || 'code';
|
|
325
332
|
var topBar = getPreTopBar(id, lang);
|
|
326
333
|
|
|
327
334
|
div.innerHTML = topBar;
|
|
@@ -367,7 +374,9 @@ function getFontSize() {
|
|
|
367
374
|
function updateFontSize(fontSize) {
|
|
368
375
|
html.style.fontSize = fontSize + 'px';
|
|
369
376
|
localStorage.setItem(fontSizeLocalStorageKey, fontSize);
|
|
370
|
-
var fontSizeText = document.querySelector(
|
|
377
|
+
var fontSizeText = document.querySelector(
|
|
378
|
+
'#b77a68a492f343baabea06fad81f651e'
|
|
379
|
+
);
|
|
371
380
|
|
|
372
381
|
if (fontSizeText) {
|
|
373
382
|
fontSizeText.innerHTML = fontSize;
|
|
@@ -420,7 +429,7 @@ function fontSizeTooltip() {
|
|
|
420
429
|
<use xlink:href="#minus-icon"></use>
|
|
421
430
|
</svg>
|
|
422
431
|
</button>
|
|
423
|
-
<div class="font-size-text" id="
|
|
432
|
+
<div class="font-size-text" id="b77a68a492f343baabea06fad81f651e">
|
|
424
433
|
${fontSize}
|
|
425
434
|
</div>
|
|
426
435
|
<button aria-label="increase-font-size" class="icon-button ${
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSizeLocalStorageKey="font-size",html=document.querySelector("html"),MAX_FONT_SIZE=30,MIN_FONT_SIZE=10,localStorage=window.localStorage;function getTheme(){return document.body.getAttribute("data-theme")}function updateTheme(e){var t=document.body,o=document.querySelectorAll(".theme-svg-use"),n="dark"===e?"light":"dark";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href","#"+n+"-theme-icon")}),localStorage.setItem(themeLocalStorageKey,e)}function toggleTheme(){updateTheme("dark"===document.body.getAttribute("data-theme")?"light":"dark")}function setAccordionIdToLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));t[e]=e,localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function removeAccordionIdFromLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));delete t[e],localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function getAccordionIdsFromLocalStorage(){return JSON.parse(localStorage.getItem(accordionLocalStorageKey))||{}}function toggleAccordion(e){"false"===e.getAttribute("data-isopen")?(e.setAttribute("data-isopen","true"),setAccordionIdToLocalStorage(e.id)):(e.setAttribute("data-isopen","false"),removeAccordionIdFromLocalStorage(e.id))}function initAccordion(){void 0!==localStorage.getItem(accordionLocalStorageKey)&&null!==localStorage.getItem(accordionLocalStorageKey)||localStorage.setItem(accordionLocalStorageKey,"{}");var e=document.querySelectorAll(".sidebar-section-title"),t=getAccordionIdsFromLocalStorage();e.forEach(function(e){e.addEventListener("click",function(){toggleAccordion(e)}),e.id in t&&toggleAccordion(e)})}function isSourcePage(){return Boolean(document.querySelector("#source-page"))}function bringElementIntoView(e,t=!0){var o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16;o&&(c+=o.scrollHeight),n.scrollBy(0,i-c),t&&history.pushState(null,null,"#"+e.id)}function bringLinkToView(e){e.preventDefault(),e.stopPropagation();var e=e.currentTarget.getAttribute("href");!e||(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e)}function bringIdToViewOnMount(){var e;isSourcePage()||""!==(e=window.location.hash)&&(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e,!1)}function createAnchorElement(e){var t=document.createElement("a");return t.textContent="#",t.href="#"+e,t.classList.add("link-anchor"),t.onclick=bringLinkToView,t}function addAnchor(){var e=document.querySelector(".main-content").querySelector("section");[e.querySelectorAll("h1"),e.querySelectorAll("h2"),e.querySelectorAll("h3"),e.querySelectorAll("h4")].forEach(function(e){e.forEach(function(e){var t=createAnchorElement(e.id);e.classList.add("has-anchor"),e.append(t)})})}function copy(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}function showTooltip(e){var t=document.getElementById(e);t.classList.add("show-tooltip"),setTimeout(function(){t.classList.remove("show-tooltip")},3e3)}function copyFunction(e){var t=document.getElementById(e);copy((t.querySelector(".linenums")||t.querySelector("code")).innerText),showTooltip("tooltip-"+e)}function hideTocOnSourcePage(){isSourcePage()&&(document.querySelector(".toc-container").style.display="none")}function getPreTopBar(e,t=""){e='<button aria-label="copy code" class="icon-button" onclick="copyFunction(\''+e+'\')"><svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>'+('<div class="tooltip" id="tooltip-'+e+'">Copied!</div>')+"</button>";return'<div class="pre-top-bar-container">'+('<div class="code-lang-name-container"><div class="code-lang-name">'+t.toLocaleUpperCase()+"</div></div>")+e+"</div>"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#
|
|
2
|
-
<div class="font-size-tooltip">
|
|
3
|
-
<button aria-label="decrease-font-size" class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
|
|
4
|
-
<svg>
|
|
5
|
-
<use xlink:href="#minus-icon"></use>
|
|
6
|
-
</svg>
|
|
7
|
-
</button>
|
|
8
|
-
<div class="font-size-text" id="
|
|
9
|
-
${e}
|
|
10
|
-
</div>
|
|
11
|
-
<button aria-label="increase-font-size" class="icon-button ${e<=MIN_FONT_SIZE?"disabled":""}" onclick="incrementFont(event)">
|
|
12
|
-
<svg>
|
|
13
|
-
<use xlink:href="#add-icon"></use>
|
|
14
|
-
</svg>
|
|
15
|
-
</button>
|
|
16
|
-
<button class="icon-button" onclick="updateFontSize(16)">
|
|
17
|
-
<svg>
|
|
18
|
-
<use xlink:href="#reset-icon"></use>
|
|
19
|
-
</svg>
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
1
|
+
var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSizeLocalStorageKey="font-size",html=document.querySelector("html"),MAX_FONT_SIZE=30,MIN_FONT_SIZE=10,localStorage=window.localStorage;function getTheme(){return document.body.getAttribute("data-theme")}function updateTheme(e){var t=document.body,o=document.querySelectorAll(".theme-svg-use"),n="dark"===e?"light":"dark";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href","#"+n+"-theme-icon")}),localStorage.setItem(themeLocalStorageKey,e)}function toggleTheme(){updateTheme("dark"===document.body.getAttribute("data-theme")?"light":"dark")}function setAccordionIdToLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));t[e]=e,localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function removeAccordionIdFromLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));delete t[e],localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function getAccordionIdsFromLocalStorage(){return JSON.parse(localStorage.getItem(accordionLocalStorageKey))||{}}function toggleAccordion(e){"false"===e.getAttribute("data-isopen")?(e.setAttribute("data-isopen","true"),setAccordionIdToLocalStorage(e.id)):(e.setAttribute("data-isopen","false"),removeAccordionIdFromLocalStorage(e.id))}function initAccordion(){void 0!==localStorage.getItem(accordionLocalStorageKey)&&null!==localStorage.getItem(accordionLocalStorageKey)||localStorage.setItem(accordionLocalStorageKey,"{}");var e=document.querySelectorAll(".sidebar-section-title"),t=getAccordionIdsFromLocalStorage();e.forEach(function(e){e.addEventListener("click",function(){toggleAccordion(e)}),e.id in t&&toggleAccordion(e)})}function isSourcePage(){return Boolean(document.querySelector("#source-page"))}function bringElementIntoView(e,t=!0){var o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16;o&&(c+=o.scrollHeight),n.scrollBy(0,i-c),t&&history.pushState(null,null,"#"+e.id)}function bringLinkToView(e){e.preventDefault(),e.stopPropagation();var e=e.currentTarget.getAttribute("href");!e||(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e)}function bringIdToViewOnMount(){var e;isSourcePage()||""!==(e=window.location.hash)&&(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e,!1)}function createAnchorElement(e){var t=document.createElement("a");return t.textContent="#",t.href="#"+e,t.classList.add("link-anchor"),t.onclick=bringLinkToView,t}function addAnchor(){var e=document.querySelector(".main-content").querySelector("section");[e.querySelectorAll("h1"),e.querySelectorAll("h2"),e.querySelectorAll("h3"),e.querySelectorAll("h4")].forEach(function(e){e.forEach(function(e){var t=createAnchorElement(e.id);e.classList.add("has-anchor"),e.append(t)})})}function copy(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}function showTooltip(e){var t=document.getElementById(e);t.classList.add("show-tooltip"),setTimeout(function(){t.classList.remove("show-tooltip")},3e3)}function copyFunction(e){var t=document.getElementById(e);copy((t.querySelector(".linenums")||t.querySelector("code")).innerText),showTooltip("tooltip-"+e)}function hideTocOnSourcePage(){isSourcePage()&&(document.querySelector(".toc-container").style.display="none")}function getPreTopBar(e,t=""){e='<button aria-label="copy code" class="icon-button" onclick="copyFunction(\''+e+'\')"><svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>'+('<div class="tooltip" id="tooltip-'+e+'">Copied!</div>')+"</button>";return'<div class="pre-top-bar-container">'+('<div class="code-lang-name-container"><div class="code-lang-name">'+t.toLocaleUpperCase()+"</div></div>")+e+"</div>"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#PeOAagUepe"),o=document.querySelector("#VuAckcnZhf"),n=0,i=0,c=(t&&(i=t.getBoundingClientRect().height),o&&(n=o.getBoundingClientRect().height),window.innerHeight-n-i-250);e.forEach(function(e,t){var o=getPreDiv(),t="ScDloZOMdL"+t,n=getPreTopBar(t,e.getAttribute("data-lang")||"code");o.innerHTML=n,e.style.maxHeight=c+"px",e.id=t,e.parentNode.insertBefore(o,e),o.appendChild(e)})}function highlightAndBringLineIntoView(){var e=window.location.hash.replace("#line","");try{var t='[data-line-number="'+e+'"',o=document.querySelector(t);o.scrollIntoView(),o.parentNode.classList.add("selected")}catch(e){console.error(e)}}function getFontSize(){var e=16;try{e=Number.parseInt(html.style.fontSize.split("px")[0],10)}catch(e){console.log(e)}return e}function updateFontSize(e){html.style.fontSize=e+"px",localStorage.setItem(fontSizeLocalStorageKey,e);var t=document.querySelector("#b77a68a492f343baabea06fad81f651e");t&&(t.innerHTML=e)}function incrementFont(e){var t=getFontSize();t<MAX_FONT_SIZE&&updateFontSize(t+1)}function decrementFont(e){var t=getFontSize();MIN_FONT_SIZE<t&&updateFontSize(t-1)}function fontSizeTooltip(){var e=getFontSize();return`
|
|
2
|
+
<div class="font-size-tooltip">
|
|
3
|
+
<button aria-label="decrease-font-size" class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
|
|
4
|
+
<svg>
|
|
5
|
+
<use xlink:href="#minus-icon"></use>
|
|
6
|
+
</svg>
|
|
7
|
+
</button>
|
|
8
|
+
<div class="font-size-text" id="b77a68a492f343baabea06fad81f651e">
|
|
9
|
+
${e}
|
|
10
|
+
</div>
|
|
11
|
+
<button aria-label="increase-font-size" class="icon-button ${e<=MIN_FONT_SIZE?"disabled":""}" onclick="incrementFont(event)">
|
|
12
|
+
<svg>
|
|
13
|
+
<use xlink:href="#add-icon"></use>
|
|
14
|
+
</svg>
|
|
15
|
+
</button>
|
|
16
|
+
<button class="icon-button" onclick="updateFontSize(16)">
|
|
17
|
+
<svg>
|
|
18
|
+
<use xlink:href="#reset-icon"></use>
|
|
19
|
+
</svg>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
23
|
`}function initTooltip(){tippy(".theme-toggle",{content:"Toggle Theme",delay:500}),tippy(".search-button",{content:"Search",delay:500}),tippy(".font-size",{content:"Change font size",delay:500}),tippy(".codepen-button",{content:"Open code in CodePen",placement:"left"}),tippy(".font-size",{content:fontSizeTooltip(),trigger:"click",interactive:!0,allowHTML:!0,placement:"left"})}function fixTable(){var e,t=document.querySelectorAll("table");if(!(900<window.innerWidth))for(e of t){if(e.classList.contains("hljs-ln"))return;var o=document.createElement("div");o.classList.add("table-div"),e.parentNode.insertBefore(o,e),o.appendChild(e)}}function onMobileMenuClick(e){var t=document.querySelector("#mobile-sidebar"),e=e.currentTarget,o=e.querySelector("use"),n="true"===e.getAttribute("data-isopen");t&&(n?(t.classList.remove("show"),e.setAttribute("data-isopen","false"),o.setAttribute("xlink:href","#menu-icon")):(t.classList.add("show"),e.setAttribute("data-isopen","true"),o.setAttribute("xlink:href","#close-icon")))}function initMobileMenu(){var e=document.querySelector("#mobile-menu");e&&e.addEventListener("click",onMobileMenuClick)}function onDomContentLoaded(){var e=document.querySelectorAll(".theme-toggle");initMobileMenu(),e&&e.forEach(function(e){e.addEventListener("click",toggleTheme)}),hljs.addPlugin({"after:highlightElement":function(e){e.el.parentNode.setAttribute("data-lang","code")}}),hljs.highlightAll(),hljs.initLineNumbersOnLoad({singleLine:!0}),initAccordion(),addAnchor(),processAllPre(),hideTocOnSourcePage(),setTimeout(function(){bringIdToViewOnMount(),isSourcePage()&&highlightAndBringLineIntoView()},1e3),initTooltip(),fixTable()}!function(){var e=getTheme(),t=localStorage.getItem(themeLocalStorageKey);t?e!==t&&updateTheme(t):localStorage.setItem(themeLocalStorageKey,e)}(),function(){var e,t=getFontSize(),o=localStorage.getItem(fontSizeLocalStorageKey);o?(e=Number.parseInt(o,10))!==t&&updateFontSize(e):localStorage.setItem(o,t)}(),window.addEventListener("DOMContentLoaded",onDomContentLoaded);
|
package/static/scripts/search.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
/* global document */
|
|
2
2
|
|
|
3
3
|
var searchData;
|
|
4
|
-
var searchId = '
|
|
4
|
+
var searchId = 'LiBfqbJVcV';
|
|
5
5
|
var searchHash = '#' + searchId;
|
|
6
|
+
var searchContainerID = '#PkfLWpAbet';
|
|
7
|
+
var searchWrapperID = '#iCxFxjkHbP';
|
|
8
|
+
var searchCloseButtonID = '#VjLlGakifb';
|
|
9
|
+
var searchInputID = '#vpcKVYIppa';
|
|
10
|
+
var searchResultCID = '#fWwVHRuDuN';
|
|
6
11
|
|
|
7
12
|
function hideSearch() {
|
|
8
|
-
var container = document.querySelector(
|
|
13
|
+
var container = document.querySelector(searchContainerID);
|
|
9
14
|
|
|
10
15
|
// eslint-disable-next-line no-undef
|
|
11
|
-
if (window.location.hash === searchHash
|
|
16
|
+
if (window.location.hash === searchHash) {
|
|
12
17
|
// eslint-disable-next-line no-undef
|
|
13
18
|
history.go(-1);
|
|
14
19
|
}
|
|
@@ -30,8 +35,8 @@ function listenKey(event) {
|
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
function showSearch() {
|
|
33
|
-
var container = document.querySelector(
|
|
34
|
-
var input = document.querySelector(
|
|
38
|
+
var container = document.querySelector(searchContainerID);
|
|
39
|
+
var input = document.querySelector(searchInputID);
|
|
35
40
|
|
|
36
41
|
// eslint-disable-next-line no-undef
|
|
37
42
|
window.onhashchange = hideSearch;
|
|
@@ -150,7 +155,7 @@ function debounce(func, wait, immediate) {
|
|
|
150
155
|
|
|
151
156
|
function search(event) {
|
|
152
157
|
var value = event.target.value;
|
|
153
|
-
var resultBox = document.querySelector(
|
|
158
|
+
var resultBox = document.querySelector(searchResultCID);
|
|
154
159
|
var keys = ['title', 'description'];
|
|
155
160
|
|
|
156
161
|
if (!resultBox) {
|
|
@@ -201,11 +206,11 @@ function search(event) {
|
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
function onDomContentLoaded() {
|
|
204
|
-
var input = document.querySelector(
|
|
209
|
+
var input = document.querySelector(searchInputID);
|
|
205
210
|
var searchButton = document.querySelectorAll('.search-button');
|
|
206
|
-
var searchContainer = document.querySelector(
|
|
207
|
-
var searchWrapper = document.querySelector(
|
|
208
|
-
var searchCloseButton = document.querySelector(
|
|
211
|
+
var searchContainer = document.querySelector(searchContainerID);
|
|
212
|
+
var searchWrapper = document.querySelector(searchWrapperID);
|
|
213
|
+
var searchCloseButton = document.querySelector(searchCloseButtonID);
|
|
209
214
|
|
|
210
215
|
var debouncedSearch = debounce(search, 300);
|
|
211
216
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var searchData,searchId="
|
|
1
|
+
var searchData,searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainerID="#PkfLWpAbet",searchWrapperID="#iCxFxjkHbP",searchCloseButtonID="#VjLlGakifb",searchInputID="#vpcKVYIppa",searchResultCID="#fWwVHRuDuN";function hideSearch(){var e=document.querySelector(searchContainerID);window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,e&&(e.style.display="none")}function listenKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenKey))}function showSearch(){var e=document.querySelector(searchContainerID),n=document.querySelector(searchInputID);window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),e&&(e.style.display="flex",window.addEventListener("keyup",listenKey)),n&&n.focus()}function fetchAllData(n={}){var e=baseURL+"data/search.json";fetch(e).then(function(e){return e.json()}).then(function(e){searchData=e.list,"function"==typeof n.onSuccess&&n.onSuccess(e.list)}).catch(function(e){console.error(e),"function"==typeof n.onError&&n.onError()})}function buildSearchResult(e){var n="";for(const r of e){var t=r.item;n+=`
|
|
2
2
|
|
|
3
3
|
<a href="${r.item.link.replace('<a href="',"").replace(/">.*/,"")}" class="search-result-item">
|
|
4
4
|
<div class="search-result-item-title">
|
|
@@ -8,4 +8,4 @@ var searchData,searchId="f73c3473-f750-4298-bb07-3837be4f2c2bff66efc0-857b-4d13-
|
|
|
8
8
|
${t.description||"No description available."}
|
|
9
9
|
</div>
|
|
10
10
|
</a>
|
|
11
|
-
`}return n}function getSearchResult(e,n,t){var n={shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:n},r=Fuse.createIndex(n.keys,e),e=new Fuse(e,n,r).search(t);return e=20<e.length?e.slice(0,20):e}function debounce(t,r,
|
|
11
|
+
`}return n}function getSearchResult(e,n,t){var n={shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:n},r=Fuse.createIndex(n.keys,e),e=new Fuse(e,n,r).search(t);return e=20<e.length?e.slice(0,20):e}function debounce(t,r,a){var c;return function(){var e=this,n=arguments;clearTimeout(c),c=setTimeout(function(){c=null,a||t.apply(e,n)},r),a&&!c&&t.apply(e,n)}}function search(e){var n=e.target.value,t=document.querySelector(searchResultCID),r=["title","description"];if(t)if(n){if(!searchData)return t.innerHTML="Loading...",void fetchAllData({onSuccess:function(e){console.log("Onsucess"),a(getSearchResult(e,r,n))},onError:function(){t.innerHTML="Failed to load result."}});a(getSearchResult(searchData,r,n))}else t.innerHTML="Type anything to view search result";else console.error("Search result container not found");function a(e){0===e.length?t.innerHTML="No result found! Try some different combination.":(e=buildSearchResult(e),t.innerHTML=e)}}function onDomContentLoaded(){var e=document.querySelector(searchInputID),n=document.querySelectorAll(".search-button"),t=document.querySelector(searchContainerID),r=document.querySelector(searchWrapperID),a=document.querySelector(searchCloseButtonID),c=debounce(search,300);a&&a.addEventListener("click",hideSearch),n&&n.forEach(function(e){e.addEventListener("click",showSearch)}),t&&t.addEventListener("click",hideSearch),r&&r.addEventListener("click",function(e){e.stopPropagation()}),e&&e.addEventListener("keyup",c)}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});
|
package/tmpl/layout.tmpl
CHANGED
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
<?js= this.partial('sidebar.tmpl') ?>
|
|
82
82
|
</div>
|
|
83
83
|
|
|
84
|
-
<div class="navbar-container" id="
|
|
84
|
+
<div class="navbar-container" id="VuAckcnZhf">
|
|
85
85
|
<?js= this.partial('navbar.tmpl') ?>
|
|
86
86
|
</div>
|
|
87
87
|
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
|
|
97
97
|
<?js if(this.footer) {?>
|
|
98
98
|
|
|
99
|
-
<footer class="footer" id="
|
|
99
|
+
<footer class="footer" id="PeOAagUepe">
|
|
100
100
|
<div class="wrapper">
|
|
101
101
|
<?js= this.footer ?>
|
|
102
102
|
</div>
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
|
|
131
131
|
<script type="text/javascript">
|
|
132
132
|
tocbot.init({
|
|
133
|
-
tocSelector: '#
|
|
133
|
+
tocSelector: '#eed4d2a0bfd64539bb9df78095dec881',
|
|
134
134
|
contentSelector: '.main-content',
|
|
135
135
|
headingSelector: 'h1, h2, h3',
|
|
136
136
|
hasInnerContainers: true,
|
package/tmpl/search.tmpl
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<div class="search-container" id="
|
|
2
|
-
<div class="wrapper" id="
|
|
3
|
-
<button class="icon-button search-close-button" id="
|
|
1
|
+
<div class="search-container" id="PkfLWpAbet" style="display: none">
|
|
2
|
+
<div class="wrapper" id="iCxFxjkHbP">
|
|
3
|
+
<button class="icon-button search-close-button" id="VjLlGakifb" aria-label='close search'>
|
|
4
4
|
<svg>
|
|
5
5
|
<use xlink:href="#close-icon"></use>
|
|
6
6
|
</svg>
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
</button>
|
|
9
9
|
<div class="search-box-c">
|
|
10
10
|
<svg><use xlink:href="#search-icon"></use></svg>
|
|
11
|
-
<input type="text" id="
|
|
11
|
+
<input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus>
|
|
12
12
|
</div>
|
|
13
|
-
<div class="search-result-c" id="
|
|
13
|
+
<div class="search-result-c" id="fWwVHRuDuN">
|
|
14
14
|
Type anything to view search result
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
package/tmpl/toc.tmpl
CHANGED