22 lines
22 KiB
JavaScript
22 lines
22 KiB
JavaScript
|
|
<script>
|
||
|
|
|
||
|
|
var collapsibleMenu = true; // Enable or disable collapsible menu
|
||
|
|
var slidingMenu = true; // Enable or disable sliding menu
|
||
|
|
var hideDivider = true; // Enable or disable 'Divider' element in navigation
|
||
|
|
var addSiteTitleNavigation = true; // Add link to Site Title next to Site Logo
|
||
|
|
var removeBreadcrumbs = false; // Enable or disable Breadcrumbs
|
||
|
|
var removeTocCard = false; // Enable or disable 'Table of Contents' Card
|
||
|
|
var removeTagCard = false; // Enable or disable 'Tags' Card
|
||
|
|
var removeHistoryCard = true; // Enable or disable 'Last Edited By' Card
|
||
|
|
var customizeVideoPlayer = true; // Enable or disable video player customization
|
||
|
|
var removeBookmarkCard = false; // Enable or disable Bookmark/Share/Print Card
|
||
|
|
var sideColumnPosition = 'left'; // Side column position. Options: 'left'|'right'|false
|
||
|
|
|
||
|
|
var mouseLeftEdgeOpensMenu = false; // When mouse close to the left edge, reveals menu if unpinned
|
||
|
|
const leftEdge = 1; // Distance from the left edge in pixels to trigger menu reveal
|
||
|
|
|
||
|
|
const COOKIE_NAME = "mad-nav-pinned"; // Name of the cookie (used for menu pin status)
|
||
|
|
const COOKIE_DAYS = 365; // Cookie validity in days
|
||
|
|
|
||
|
|
const CM_LNK_ACTIVE="mad-cm-lnk-active",CM_LNK_ACTIVE2="mad-cm-lnk-active2",CM_COLLAPSIBLE="mad-cm-collapsible",CM_COLLAPSIBLE_ACTIVE="mad-cm-collapsible-active",CM_COLLAPSIBLE_INACTIVE="mad-cm-collapsible-inactive",CM_SECTION="mad-cm-section",CM_SECTION_EXPANDED="expanded",NO_LINE_NUMBERS_CLASS="next-codeblock-no-line-numbers";var menuItemType,header,navigation,main,footer,btnToTop,sideColumn,pageTitle,breadcrumbs,hideSideColumn,headerProcessed=navProcessed=mainProcessed=footerProcessed=!1,breadcrumbsHidden=!1,btnToTopProcessed=!1,btnToTopVisible=!1,curPathRel=window.location.pathname,curPathAbs=window.location.href,mo=new MutationObserver(moCallback),moConfig={attributes:!0,childList:!0,subtree:!0,characterDataOldValue:!0,attributeOldValue:!0},moTarget=document;if(slidingMenu){var icon_pinOff="mdi-pin-off-outline",icon_pinOn="mdi-pin-outline",icon_menu="mdi-menu",pmb=null,pmbHolder=null,mb=null,mbHolder=null,contentHolder=null,backToTopHolder=null,menuOpening=menuClosing=menuClosed=menuOpened=!1;""==(pinMenu=getCookie(COOKIE_NAME))?(pinMenu=!1,setCookie(COOKIE_NAME,pinMenu,COOKIE_DAYS)):pinMenu="false"!==pinMenu}else var pinMenu=!0;var mouseLeftEdgeOpensMenu,sideColumnHidden=!1,isMouseOverNav=!1,menuFirstHover=!0,mobileDevice=isMobileDevice();function isMobileDevice(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function fixMobileDeviceNodeValue(e){var t=e.nodeValue;if(t){if((o=t.split("#")).length>1){if(isNumeric(o[1])){level=parseInt(o[1]);var n=t.replace("#"+o[1]+"#","")}}else n=t;var o=n.split("#");e.nodeValue=o[0]}}function moStart(){mo.observe(moTarget,moConfig)}function moStop(){mo.disconnect()}function moCallback(e,t){for(const{addedNodes:t}of e)for(const e of t)e.tagName&&e.matches("NAV")&&e.style&&e.style.getPropertyValue("transform")&&(e.style.removeProperty?e.style.removeProperty("transform"):e.style.removeAttribute("transform"));header=document.querySelector("header[data-booted='true']"),navigation=document.querySelector("nav[data-booted='true']"),main=document.querySelector("main[data-booted='true']"),footer=document.querySelector("footer[data-booted='true']"),btnToTop=document.querySelector("i.mdi-arrow-up"),btnToTopVisible=!1,btnToTop&&(btnToTopVisible=!0,btnToTop=btnToTop.closest("button"),pinMenu||"5px"==btnToTop.style.left||(btnToTop.style.left="5px")),header&&!headerProcessed&&(customizeHeader(header),headerProcessed=!0),navigation&&!navProcessed&&(customizeNavigation(navigation),navProcessed=!0),main&&!mainProcessed&&(customizeMainContent(main),mainProcessed=!0),footer&&!footerProcessed&&(customizeFooter(footer),footerProcessed=!0),mouseLeftEdgeOpensMenu&&(document.onmousemove=handleMouseMove)}function customizeHeader(e){if(addSiteTitleNavigation){var t=e.querySelector("span.subheading");t&&(t.style.cssText="cursor: pointer;",t.addEventListener("click",function(){window.location="/"}),addSiteTitleNavigation=!1)}}function customizeNavigation(e){if(slidingMenu&&(e.style.removeProperty?e.style.removeProperty("transform"):e.style.removeAttribute("transform")),collapsibleMenu){var t=e.querySelector(".__view").children[0].children[1].childNodes;mobileDevice?t.forEach(function(e){e.childNodes[0]&&fixMobileDeviceNodeValue(e.childNodes[0]),e.childNodes[1]&&e.childNodes[1].childNodes[0]&&fixMobileDeviceNodeValue(e.childNodes[1].childNodes[0])}):(t.forEach(function(e){e.nextElementSibling,e.previousElementSibling;var t=e.previousElementSibling;if("DVD"==(menuItemType=getMenuItemType(e))&&hideDivider)e.style.display="none";else if(getMenuItemInfo(e,"level")>getMenuItemInfo(t,"level")){var n=groupItems(e);n.wrapGroup(CM_SECTION),t.classList.add(CM_COLLAPSIBLE,CM_COLLAPSIBLE_INACTIVE),sectionContainsActivePage(n)?t.classList.toggle(CM_COLLAPSIBLE_INACTIVE):t.href==curPathAbs&&(t.classList.add(CM_LNK_ACTIVE2),t.nextElementSibling.classList.add(CM_SECTION_EXPANDED),t.classList.toggle(CM_COLLAPSIBLE_ACTIVE),t.classList.toggle(CM_COLLAPSIBLE_INACTIVE)),"HDR"==getMenuItemType(t)&&t.addEventListener("click",e=>{e.target;sectionState(t.nextElementSibling,"toggle")}
|
||
|
|
</script>
|