clean-jsdoc-theme 4.1.6 → 4.1.7

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.
Files changed (67) hide show
  1. package/.eslintignore +4 -4
  2. package/.eslintrc.js +3 -3
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +43 -43
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +27 -27
  5. package/.github/dependabot.yml +9 -9
  6. package/.github/pull_request_template.md +16 -16
  7. package/.github/workflows/codeql.yml +72 -72
  8. package/.github/workflows/greetings.yml +16 -16
  9. package/.prettierignore +2 -2
  10. package/.prettierrc +5 -5
  11. package/.stylelintignore +3 -3
  12. package/.stylelintrc +23 -23
  13. package/.travis.yml +30 -30
  14. package/CHANGELOG.md +235 -235
  15. package/CODE_OF_CONDUCT.md +76 -76
  16. package/CODE_OF_CONDUCT_HINDI.md +46 -46
  17. package/CONTRIBUTING.md +24 -24
  18. package/LICENSE +21 -21
  19. package/README.md +456 -457
  20. package/SECURITY.md +21 -21
  21. package/helpers/down-arrow.js +9 -9
  22. package/jsdoc-config.json +61 -61
  23. package/minify.js +56 -52
  24. package/package.json +50 -50
  25. package/publish.js +1129 -1129
  26. package/static/scripts/core.js +656 -644
  27. package/static/scripts/core.min.js +2 -2
  28. package/static/scripts/resize.js +90 -90
  29. package/static/scripts/search.js +262 -289
  30. package/static/scripts/search.min.js +5 -10
  31. package/static/scripts/third-party/Apache-License-2.0.txt +202 -202
  32. package/static/scripts/third-party/fuse.js +8 -8
  33. package/static/scripts/third-party/hljs-line-num-original.js +365 -0
  34. package/static/scripts/third-party/hljs-line-num.js +1 -1
  35. package/static/scripts/third-party/hljs-original.js +5162 -5162
  36. package/static/scripts/third-party/popper.js +5 -5
  37. package/static/scripts/third-party/tippy.js +1 -1
  38. package/static/styles/clean-jsdoc-theme-base.css +969 -952
  39. package/static/styles/clean-jsdoc-theme-dark.css +407 -407
  40. package/static/styles/clean-jsdoc-theme-light.css +388 -388
  41. package/static/styles/clean-jsdoc-theme.min.css +1 -1
  42. package/tmpl/augments.tmpl +10 -10
  43. package/tmpl/container.tmpl +190 -190
  44. package/tmpl/details.tmpl +207 -207
  45. package/tmpl/example.tmpl +3 -3
  46. package/tmpl/examples.tmpl +40 -40
  47. package/tmpl/exceptions.tmpl +32 -32
  48. package/tmpl/icons.tmpl +72 -72
  49. package/tmpl/layout.tmpl +157 -155
  50. package/tmpl/mainpage.tmpl +10 -10
  51. package/tmpl/members.tmpl +42 -42
  52. package/tmpl/method.tmpl +139 -139
  53. package/tmpl/mobile-sidebar.tmpl +20 -20
  54. package/tmpl/navbar-actions.tmpl +18 -18
  55. package/tmpl/navbar-menu.tmpl +24 -24
  56. package/tmpl/navbar.tmpl +13 -13
  57. package/tmpl/params.tmpl +124 -124
  58. package/tmpl/properties.tmpl +109 -109
  59. package/tmpl/returns.tmpl +18 -18
  60. package/tmpl/search.tmpl +16 -16
  61. package/tmpl/sidebar-items.tmpl +23 -23
  62. package/tmpl/sidebar-title.tmpl +9 -9
  63. package/tmpl/sidebar.tmpl +8 -8
  64. package/tmpl/source.tmpl +12 -12
  65. package/tmpl/toc.tmpl +3 -3
  66. package/tmpl/tutorial.tmpl +19 -19
  67. package/tmpl/type.tmpl +6 -6
@@ -1,4 +1,4 @@
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-theme-icon":"#dark-theme-icon";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href",n)}),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,n,i,c;e&&(o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16,o&&(c+=o.scrollHeight),n&&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,t;isSourcePage()||""!==(e=window.location.hash)&&((t=document.getElementById(e.slice(1)))||(e=decodeURI(e),t=document.getElementById(e.slice(1))),t&&bringElementIntoView(t,!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 copy-code" 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,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.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`
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-theme-icon":"#dark-theme-icon";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href",n)}),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,n,i,c;e&&(o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16,o&&(c+=o.scrollHeight),n&&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,t;isSourcePage()||""!==(e=window.location.hash)&&((t=document.getElementById(e.slice(1)))||(e=decodeURI(e),t=document.getElementById(e.slice(1))),t&&bringElementIntoView(t,!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){console.log(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.trim()),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 copy-code" 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,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.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
2
  <div class="font-size-tooltip">
3
3
  <button aria-label="decrease-font-size" class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
4
4
  <svg>
@@ -20,4 +20,4 @@ var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSiz
20
20
  </button>
21
21
  </div>
22
22
 
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(".copy-code",{content:"Copy this code",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 hideMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.remove("show"),t&&t.setAttribute("data-isopen","false"),o&&o.setAttribute("xlink:href","#menu-icon")}function showMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.add("show"),t&&t.setAttribute("data-isopen","true"),o&&o.setAttribute("xlink:href","#close-icon")}function onMobileMenuClick(){("true"===document.querySelector("#mobile-menu").getAttribute("data-isopen")?hideMobileMenu:showMobileMenu)()}function initMobileMenu(){var e=document.querySelector("#mobile-menu");e&&e.addEventListener("click",onMobileMenuClick)}function addHrefToSidebarTitle(){document.querySelectorAll(".sidebar-title-anchor").forEach(function(e){e.setAttribute("href",baseURL)})}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(),addHrefToSidebarTitle()}!function(){var e=getTheme(),t=localStorage.getItem(themeLocalStorageKey);t?e!==t&&updateTheme(t):localStorage.setItem(themeLocalStorageKey,e)}(),function(){var e=getFontSize(),t=localStorage.getItem(fontSizeLocalStorageKey);t?(t=Number.parseInt(t,10))!==e&&updateFontSize(t):updateFontSize(e)}(),window.addEventListener("DOMContentLoaded",onDomContentLoaded);
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(".copy-code",{content:"Copy this code",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 hideMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.remove("show"),t&&t.setAttribute("data-isopen","false"),o&&o.setAttribute("xlink:href","#menu-icon")}function showMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.add("show"),t&&t.setAttribute("data-isopen","true"),o&&o.setAttribute("xlink:href","#close-icon")}function onMobileMenuClick(){("true"===document.querySelector("#mobile-menu").getAttribute("data-isopen")?hideMobileMenu:showMobileMenu)()}function initMobileMenu(){var e=document.querySelector("#mobile-menu");e&&e.addEventListener("click",onMobileMenuClick)}function addHrefToSidebarTitle(){document.querySelectorAll(".sidebar-title-anchor").forEach(function(e){e.setAttribute("href",baseURL)})}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(),addHrefToSidebarTitle()}!function(){var e=getTheme(),t=localStorage.getItem(themeLocalStorageKey);t?e!==t&&updateTheme(t):localStorage.setItem(themeLocalStorageKey,e)}(),function(){var e=getFontSize(),t=localStorage.getItem(fontSizeLocalStorageKey);t?(t=Number.parseInt(t,10))!==e&&updateFontSize(t):updateFontSize(e)}(),window.addEventListener("DOMContentLoaded",onDomContentLoaded),console.log("Hash event added"),window.addEventListener("hashchange",e=>{e=new URL(e.newURL);""!==e.hash&&bringIdToViewOnMount(e.hash)});
@@ -1,90 +1,90 @@
1
- /* global document */
2
- // This file is @deprecated
3
-
4
- var NAVBAR_OPTIONS = {};
5
-
6
- (function() {
7
- var NAVBAR_RESIZE_LOCAL_STORAGE_KEY = 'NAVBAR_RESIZE_LOCAL_STORAGE_KEY';
8
-
9
- var navbar = document.querySelector('#navbar');
10
- var footer = document.querySelector('#footer');
11
- var mainSection = document.querySelector('#main');
12
- // eslint-disable-next-line no-undef
13
- var localStorageResizeObject = JSON.parse(
14
- localStorage.getItem(NAVBAR_RESIZE_LOCAL_STORAGE_KEY)
15
- );
16
-
17
- /**
18
- * Check whether we have any resize value in local storage or not.
19
- * If we have resize value then resize the navbar.
20
- **/
21
- if (localStorageResizeObject) {
22
- navbar.style.width = localStorageResizeObject.width;
23
- mainSection.style.marginLeft = localStorageResizeObject.width;
24
- footer.style.marginLeft = localStorageResizeObject.width;
25
- }
26
-
27
- var navbarSlider = document.querySelector('#navbar-resize');
28
-
29
- function resizeNavbar(event) {
30
- var pageX = event.pageX,
31
- pageXPlusPx = event.pageX + 'px',
32
- min = Number.parseInt(NAVBAR_OPTIONS.min, 10) || 300,
33
- max = Number.parseInt(NAVBAR_OPTIONS.max, 10) || 600;
34
-
35
- /**
36
- * Just to add some checks. If min is smaller then 10 then
37
- * user may accidentally end up reducing the size of navbar
38
- * less than 10. In that case user will not able to resize navbar
39
- * because navbar slider will be hidden.
40
- */
41
- if (min < 10) {
42
- min = 10;
43
- }
44
-
45
- /**
46
- * Only resize if pageX in range between min and max
47
- * allowed value.
48
- */
49
- if (min < pageX && pageX < max) {
50
- navbar.style.width = pageXPlusPx;
51
- mainSection.style.marginLeft = pageXPlusPx;
52
- footer.style.marginLeft = pageXPlusPx;
53
- }
54
- }
55
-
56
- function setupEventListeners() {
57
- // eslint-disable-next-line no-undef
58
- window.addEventListener('mousemove', resizeNavbar);
59
- // eslint-disable-next-line no-undef
60
- window.addEventListener('touchmove', resizeNavbar);
61
- }
62
-
63
- function afterRemovingEventListeners() {
64
- // eslint-disable-next-line no-undef
65
- localStorage.setItem(
66
- NAVBAR_RESIZE_LOCAL_STORAGE_KEY,
67
- JSON.stringify({
68
- width: navbar.style.width
69
- })
70
- );
71
- }
72
-
73
- function removeEventListeners() {
74
- // eslint-disable-next-line no-undef
75
- window.removeEventListener('mousemove', resizeNavbar);
76
- // eslint-disable-next-line no-undef
77
- window.removeEventListener('touchend', resizeNavbar);
78
- afterRemovingEventListeners();
79
- }
80
-
81
- navbarSlider.addEventListener('mousedown', setupEventListeners);
82
- navbarSlider.addEventListener('touchstart', setupEventListeners);
83
- // eslint-disable-next-line no-undef
84
- window.addEventListener('mouseup', removeEventListeners);
85
- })();
86
-
87
- // eslint-disable-next-line no-unused-vars
88
- function setupResizeOptions(options) {
89
- NAVBAR_OPTIONS = options;
90
- }
1
+ /* global document */
2
+ // This file is @deprecated
3
+
4
+ var NAVBAR_OPTIONS = {};
5
+
6
+ (function() {
7
+ var NAVBAR_RESIZE_LOCAL_STORAGE_KEY = 'NAVBAR_RESIZE_LOCAL_STORAGE_KEY';
8
+
9
+ var navbar = document.querySelector('#navbar');
10
+ var footer = document.querySelector('#footer');
11
+ var mainSection = document.querySelector('#main');
12
+ // eslint-disable-next-line no-undef
13
+ var localStorageResizeObject = JSON.parse(
14
+ localStorage.getItem(NAVBAR_RESIZE_LOCAL_STORAGE_KEY)
15
+ );
16
+
17
+ /**
18
+ * Check whether we have any resize value in local storage or not.
19
+ * If we have resize value then resize the navbar.
20
+ **/
21
+ if (localStorageResizeObject) {
22
+ navbar.style.width = localStorageResizeObject.width;
23
+ mainSection.style.marginLeft = localStorageResizeObject.width;
24
+ footer.style.marginLeft = localStorageResizeObject.width;
25
+ }
26
+
27
+ var navbarSlider = document.querySelector('#navbar-resize');
28
+
29
+ function resizeNavbar(event) {
30
+ var pageX = event.pageX,
31
+ pageXPlusPx = event.pageX + 'px',
32
+ min = Number.parseInt(NAVBAR_OPTIONS.min, 10) || 300,
33
+ max = Number.parseInt(NAVBAR_OPTIONS.max, 10) || 600;
34
+
35
+ /**
36
+ * Just to add some checks. If min is smaller then 10 then
37
+ * user may accidentally end up reducing the size of navbar
38
+ * less than 10. In that case user will not able to resize navbar
39
+ * because navbar slider will be hidden.
40
+ */
41
+ if (min < 10) {
42
+ min = 10;
43
+ }
44
+
45
+ /**
46
+ * Only resize if pageX in range between min and max
47
+ * allowed value.
48
+ */
49
+ if (min < pageX && pageX < max) {
50
+ navbar.style.width = pageXPlusPx;
51
+ mainSection.style.marginLeft = pageXPlusPx;
52
+ footer.style.marginLeft = pageXPlusPx;
53
+ }
54
+ }
55
+
56
+ function setupEventListeners() {
57
+ // eslint-disable-next-line no-undef
58
+ window.addEventListener('mousemove', resizeNavbar);
59
+ // eslint-disable-next-line no-undef
60
+ window.addEventListener('touchmove', resizeNavbar);
61
+ }
62
+
63
+ function afterRemovingEventListeners() {
64
+ // eslint-disable-next-line no-undef
65
+ localStorage.setItem(
66
+ NAVBAR_RESIZE_LOCAL_STORAGE_KEY,
67
+ JSON.stringify({
68
+ width: navbar.style.width
69
+ })
70
+ );
71
+ }
72
+
73
+ function removeEventListeners() {
74
+ // eslint-disable-next-line no-undef
75
+ window.removeEventListener('mousemove', resizeNavbar);
76
+ // eslint-disable-next-line no-undef
77
+ window.removeEventListener('touchend', resizeNavbar);
78
+ afterRemovingEventListeners();
79
+ }
80
+
81
+ navbarSlider.addEventListener('mousedown', setupEventListeners);
82
+ navbarSlider.addEventListener('touchstart', setupEventListeners);
83
+ // eslint-disable-next-line no-undef
84
+ window.addEventListener('mouseup', removeEventListeners);
85
+ })();
86
+
87
+ // eslint-disable-next-line no-unused-vars
88
+ function setupResizeOptions(options) {
89
+ NAVBAR_OPTIONS = options;
90
+ }