clean-jsdoc-theme 4.0.0 → 4.0.4
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/.github/workflows/{codeql-analysis.yml → codeql.yml} +23 -18
- package/.github/workflows/greetings.yml +16 -0
- package/README.md +6 -4
- package/minify.js +4 -0
- package/package.json +1 -1
- package/static/scripts/core.js +7 -7
- package/static/scripts/core.min.js +3 -3
- package/static/scripts/search.js +6 -4
- package/static/scripts/search.min.js +11 -11
- package/static/scripts/third-party/hljs-original.js +5162 -0
- package/static/scripts/third-party/hljs.js +1 -1173
- package/static/styles/clean-jsdoc-theme-base.css +32 -14
- package/static/styles/clean-jsdoc-theme-dark.css +11 -15
- package/static/styles/clean-jsdoc-theme-light.css +13 -17
- package/static/styles/clean-jsdoc-theme.min.css +1 -1
- package/tmpl/container.tmpl +10 -10
- package/tmpl/details.tmpl +1 -1
- package/tmpl/examples.tmpl +1 -1
- package/tmpl/layout.tmpl +7 -7
- package/tmpl/members.tmpl +4 -4
- package/tmpl/method.tmpl +2 -2
- package/tmpl/mobile-sidebar.tmpl +2 -2
- package/tmpl/navbar-actions.tmpl +5 -5
- package/tmpl/navbar-menu.tmpl +4 -0
- package/tmpl/search.tmpl +1 -1
|
@@ -13,55 +13,60 @@ name: "CodeQL"
|
|
|
13
13
|
|
|
14
14
|
on:
|
|
15
15
|
push:
|
|
16
|
-
branches: [ master ]
|
|
16
|
+
branches: [ "master" ]
|
|
17
17
|
pull_request:
|
|
18
18
|
# The branches below must be a subset of the branches above
|
|
19
|
-
branches: [ master ]
|
|
19
|
+
branches: [ "master" ]
|
|
20
20
|
schedule:
|
|
21
|
-
- cron: '
|
|
21
|
+
- cron: '23 8 * * 1'
|
|
22
22
|
|
|
23
23
|
jobs:
|
|
24
24
|
analyze:
|
|
25
25
|
name: Analyze
|
|
26
26
|
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
27
31
|
|
|
28
32
|
strategy:
|
|
29
33
|
fail-fast: false
|
|
30
34
|
matrix:
|
|
31
35
|
language: [ 'javascript' ]
|
|
32
|
-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
33
|
-
# Learn more
|
|
34
|
-
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
35
38
|
|
|
36
39
|
steps:
|
|
37
40
|
- name: Checkout repository
|
|
38
|
-
uses: actions/checkout@
|
|
41
|
+
uses: actions/checkout@v3
|
|
39
42
|
|
|
40
43
|
# Initializes the CodeQL tools for scanning.
|
|
41
44
|
- name: Initialize CodeQL
|
|
42
|
-
uses: github/codeql-action/init@
|
|
45
|
+
uses: github/codeql-action/init@v2
|
|
43
46
|
with:
|
|
44
47
|
languages: ${{ matrix.language }}
|
|
45
48
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
46
49
|
# By default, queries listed here will override any specified in a config file.
|
|
47
50
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
53
|
+
# queries: security-extended,security-and-quality
|
|
49
54
|
|
|
55
|
+
|
|
50
56
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
51
57
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
52
58
|
- name: Autobuild
|
|
53
|
-
uses: github/codeql-action/autobuild@
|
|
59
|
+
uses: github/codeql-action/autobuild@v2
|
|
54
60
|
|
|
55
61
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
56
|
-
# 📚 https://
|
|
62
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
57
63
|
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
# uses a compiled language
|
|
64
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
65
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
#
|
|
64
|
-
#
|
|
67
|
+
# - run: |
|
|
68
|
+
# echo "Run, Build Application using script"
|
|
69
|
+
# ./location_of_script_within_repo/buildscript.sh
|
|
65
70
|
|
|
66
71
|
- name: Perform CodeQL Analysis
|
|
67
|
-
uses: github/codeql-action/analyze@
|
|
72
|
+
uses: github/codeql-action/analyze@v2
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Greetings
|
|
2
|
+
|
|
3
|
+
on: [pull_request_target, issues]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
greeting:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
permissions:
|
|
9
|
+
issues: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/first-interaction@v1
|
|
13
|
+
with:
|
|
14
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
15
|
+
issue-message: "Wonderful, you have created your first issue for clean-jsdoc-theme."
|
|
16
|
+
pr-message: "That's Amazing! Thanks for creating your first PR for clean-jsdoc-theme."
|
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.
|
|
@@ -11,12 +11,14 @@ Some salient features:
|
|
|
11
11
|
1. It has a premium-looking dark and light theme.
|
|
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
|
+
1. It updates regularly.
|
|
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).
|
|
14
16
|
|
|
15
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>.
|
|
16
18
|
|
|
17
19
|
## Demo
|
|
18
20
|
|
|
19
|
-
1. To view this theme, visit [ankdev.me/clean-jsdoc-theme/v4](https://ankdev.me/clean-jsdoc-theme/v4).
|
|
21
|
+
1. To view this theme, visit [https://ankdev.me/clean-jsdoc-theme/v4](https://ankdev.me/clean-jsdoc-theme/v4).
|
|
20
22
|
|
|
21
23
|
1. If you want to see a demo repo to set up this theme, visit [https://github.com/ankitskvmdam/clean-jsdoc-theme-example](https://github.com/ankitskvmdam/clean-jsdoc-theme-example). This repo will guide you step by step on how to setup jsdoc and clean-jsdoc-theme in your existing repo.
|
|
22
24
|
|
|
@@ -421,12 +423,12 @@ npm run build
|
|
|
421
423
|
## Contributors
|
|
422
424
|
|
|
423
425
|
<a href="https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors">
|
|
424
|
-
<img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" />
|
|
426
|
+
<img src="https://contrib.rocks/image?repo=ankitskvmdam/clean-jsdoc-theme" alt="clean-jsdoc-contributors" />
|
|
425
427
|
</a>
|
|
426
428
|
|
|
427
429
|
## Thanks
|
|
428
430
|
|
|
429
|
-
Thanks to [fuse.js](https://fusejs.io/), [hljs](https://highlightjs.org/),
|
|
431
|
+
Thanks to [fuse.js](https://fusejs.io/), [hljs](https://highlightjs.org/),[tippy.js](https://tippyjs.bootcss.com/), and all awesome contributors.
|
|
430
432
|
|
|
431
433
|
## Contact
|
|
432
434
|
|
package/minify.js
CHANGED
|
@@ -15,6 +15,10 @@ const uglifyFiles = [
|
|
|
15
15
|
{
|
|
16
16
|
src: path.join(scriptsPath, 'search.js'),
|
|
17
17
|
dest: path.join(scriptsPath, 'search.min.js')
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
src: path.join(scriptsPath, 'third-party', 'hljs-original.js'),
|
|
21
|
+
dest: path.join(scriptsPath, 'third-party', 'hljs.js')
|
|
18
22
|
}
|
|
19
23
|
];
|
|
20
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clean-jsdoc-theme",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
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
|
@@ -271,17 +271,17 @@ function hideTocOnSourcePage() {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
function getPreTopBar(id, lang) {
|
|
274
|
+
function getPreTopBar(id, lang = '') {
|
|
275
275
|
// tooltip
|
|
276
276
|
var tooltip = '<div class="tooltip" id="tooltip-' + id + '">Copied!</div>';
|
|
277
277
|
|
|
278
278
|
// template of copy to clipboard icon container
|
|
279
279
|
var copyToClipboard =
|
|
280
|
-
'<
|
|
280
|
+
'<button aria-label="copy code" class="icon-button" onclick="copyFunction(\'' +
|
|
281
281
|
id +
|
|
282
|
-
'\')"><
|
|
282
|
+
'\')"><svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>' +
|
|
283
283
|
tooltip +
|
|
284
|
-
'
|
|
284
|
+
'</button>';
|
|
285
285
|
|
|
286
286
|
var langNameDiv =
|
|
287
287
|
'<div class="code-lang-name-container"><div class="code-lang-name">' +
|
|
@@ -321,7 +321,7 @@ function processAllPre() {
|
|
|
321
321
|
targets.forEach(function(pre, idx) {
|
|
322
322
|
var div = getPreDiv();
|
|
323
323
|
var id = 'pre-id' + idx;
|
|
324
|
-
var lang = pre.getAttribute('data-lang');
|
|
324
|
+
var lang = pre.getAttribute('data-lang') || '';
|
|
325
325
|
var topBar = getPreTopBar(id, lang);
|
|
326
326
|
|
|
327
327
|
div.innerHTML = topBar;
|
|
@@ -413,7 +413,7 @@ function fontSizeTooltip() {
|
|
|
413
413
|
|
|
414
414
|
return `
|
|
415
415
|
<div class="font-size-tooltip">
|
|
416
|
-
<button class="icon-button ${
|
|
416
|
+
<button aria-label="decrease-font-size" class="icon-button ${
|
|
417
417
|
fontSize >= MAX_FONT_SIZE ? 'disabled' : ''
|
|
418
418
|
}" onclick="decrementFont(event)">
|
|
419
419
|
<svg>
|
|
@@ -423,7 +423,7 @@ function fontSizeTooltip() {
|
|
|
423
423
|
<div class="font-size-text" id="font-size-text">
|
|
424
424
|
${fontSize}
|
|
425
425
|
</div>
|
|
426
|
-
<button class="icon-button ${
|
|
426
|
+
<button aria-label="increase-font-size" class="icon-button ${
|
|
427
427
|
fontSize <= MIN_FONT_SIZE ? 'disabled' : ''
|
|
428
428
|
}" onclick="incrementFont(event)">
|
|
429
429
|
<svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
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='<
|
|
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("#footer"),o=document.querySelector("#navbar"),t=t.getBoundingClientRect().height,o=o.getBoundingClientRect().height,i=window.innerHeight-o-t-250;e.forEach(function(e,t){var o=getPreDiv(),t="pre-id"+t,n=getPreTopBar(t,e.getAttribute("data-lang")||"");o.innerHTML=n,e.style.maxHeight=i+"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("#font-size-text");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
2
|
<div class="font-size-tooltip">
|
|
3
|
-
<button class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
|
|
3
|
+
<button aria-label="decrease-font-size" class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
|
|
4
4
|
<svg>
|
|
5
5
|
<use xlink:href="#minus-icon"></use>
|
|
6
6
|
</svg>
|
|
@@ -8,7 +8,7 @@ var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSiz
|
|
|
8
8
|
<div class="font-size-text" id="font-size-text">
|
|
9
9
|
${e}
|
|
10
10
|
</div>
|
|
11
|
-
<button class="icon-button ${e<=MIN_FONT_SIZE?"disabled":""}" onclick="incrementFont(event)">
|
|
11
|
+
<button aria-label="increase-font-size" class="icon-button ${e<=MIN_FONT_SIZE?"disabled":""}" onclick="incrementFont(event)">
|
|
12
12
|
<svg>
|
|
13
13
|
<use xlink:href="#add-icon"></use>
|
|
14
14
|
</svg>
|
package/static/scripts/search.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/* global document */
|
|
2
2
|
|
|
3
3
|
var searchData;
|
|
4
|
+
var searchId = 'f73c3473-f750-4298-bb07-3837be4f2c2bff66efc0-857b-4d13-930d-9e8db5ae4338';
|
|
5
|
+
var searchHash = '#' + searchId;
|
|
4
6
|
|
|
5
7
|
function hideSearch() {
|
|
6
8
|
var container = document.querySelector('#search-container');
|
|
7
9
|
|
|
8
10
|
// eslint-disable-next-line no-undef
|
|
9
|
-
if (window.location.hash ===
|
|
11
|
+
if (window.location.hash === searchHash ) {
|
|
10
12
|
// eslint-disable-next-line no-undef
|
|
11
13
|
history.go(-1);
|
|
12
14
|
}
|
|
@@ -35,9 +37,9 @@ function showSearch() {
|
|
|
35
37
|
window.onhashchange = hideSearch;
|
|
36
38
|
|
|
37
39
|
// eslint-disable-next-line no-undef
|
|
38
|
-
if (window.location.hash !==
|
|
40
|
+
if (window.location.hash !== searchHash) {
|
|
39
41
|
// eslint-disable-next-line no-undef
|
|
40
|
-
history.pushState(null, null,
|
|
42
|
+
history.pushState(null, null, searchHash);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
if (container) {
|
|
@@ -238,7 +240,7 @@ window.addEventListener('DOMContentLoaded', onDomContentLoaded);
|
|
|
238
240
|
// eslint-disable-next-line no-undef
|
|
239
241
|
window.addEventListener('hashchange', function() {
|
|
240
242
|
// eslint-disable-next-line no-undef
|
|
241
|
-
if (window.location.hash ===
|
|
243
|
+
if (window.location.hash === searchHash) {
|
|
242
244
|
showSearch();
|
|
243
245
|
}
|
|
244
246
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var searchData;function hideSearch(){var e=document.querySelector("#search-container");
|
|
2
|
-
|
|
3
|
-
<a href="${r.item.link.replace('<a href="',"").replace(/">.*/,"")}" class="search-result-item">
|
|
4
|
-
<div class="search-result-item-title">
|
|
5
|
-
${t.title}
|
|
6
|
-
</div>
|
|
7
|
-
<div class="search-result-item-p">
|
|
8
|
-
${t.description||"No description available."}
|
|
9
|
-
</div>
|
|
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,
|
|
1
|
+
var searchData,searchId="f73c3473-f750-4298-bb07-3837be4f2c2bff66efc0-857b-4d13-930d-9e8db5ae4338",searchHash="#"+searchId;function hideSearch(){var e=document.querySelector("#search-container");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("#search-container"),n=document.querySelector("#search-input");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
|
+
|
|
3
|
+
<a href="${r.item.link.replace('<a href="',"").replace(/">.*/,"")}" class="search-result-item">
|
|
4
|
+
<div class="search-result-item-title">
|
|
5
|
+
${t.title}
|
|
6
|
+
</div>
|
|
7
|
+
<div class="search-result-item-p">
|
|
8
|
+
${t.description||"No description available."}
|
|
9
|
+
</div>
|
|
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,c){var a;return function(){var e=this,n=arguments;clearTimeout(a),a=setTimeout(function(){a=null,c||t.apply(e,n)},r),c&&!a&&t.apply(e,n)}}function search(e){var n=e.target.value,t=document.querySelector("#search-result-c"),r=["title","description"];if(t)if(n){if(!searchData)return t.innerHTML="Loading...",void fetchAllData({onSuccess:function(e){console.log("Onsucess"),c(getSearchResult(e,r,n))},onError:function(){t.innerHTML="Failed to load result."}});c(getSearchResult(searchData,r,n))}else t.innerHTML="Type anything to view search result";else console.error("Search result container not found");function c(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("#search-input"),n=document.querySelectorAll(".search-button"),t=document.querySelector("#search-container"),r=document.querySelector("#search-wrapper"),c=document.querySelector("#search-close-button"),a=debounce(search,300);c&&c.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",a)}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});
|