Publish please
This commit is contained in:
1 parent
e7ebb210da
commit
1dae09d81f
142 files changed
+3244
No files matched your search
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
"use strict";function _objectDestructuringEmpty(e){if(e==null)throw new TypeError("Cannot destructure undefined")}function _createForOfIteratorHelper(e,t){if(n=typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"],!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&typeof e.length=="number")return n&&(e=n),s=0,o=function(){},{s:o,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(t){throw t},f:o};throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n,s,o,r,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,r=t},f:function(){try{!i&&n.return!=null&&n.return()}finally{if(a)throw r}}}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(e,t){if(!e)return;if(typeof e=="string")return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(e,t)}function _iterableToArray(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n,s=0;s<t.length;s++)n=t[s],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Util=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"forEach",value:function(t,n){t=t||[];for(var s=0;s<t.length;s++)n(t[s])}},{key:"getScrollTop",value:function(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}},{key:"isMobile",value:function(){return window.matchMedia("only screen and (max-width: 680px)").matches}},{key:"isTocStatic",value:function(){return window.matchMedia("only screen and (max-width: 960px)").matches}},{key:"animateCSS",value:function(t,n,s,o){Array.isArray(n)||(n=[n]),(i=t.classList).add.apply(i,["animate__animated"].concat(_toConsumableArray(n)));var i,a=function e(){var s;(s=t.classList).remove.apply(s,["animate__animated"].concat(_toConsumableArray(n))),t.removeEventListener("animationend",e),typeof o=="function"&&o()};s||t.addEventListener("animationend",a,!1)}}]),e}(),Theme=function(){function e(){_classCallCheck(this,e),this.config=window.config,this.data=this.config.data,this.isDark=document.body.getAttribute("theme")==="dark",this.util=new Util,this.newScrollTop=this.util.getScrollTop(),this.oldScrollTop=this.newScrollTop,this.scrollEventSet=new Set,this.resizeEventSet=new Set,this.switchThemeEventSet=new Set,this.clickMaskEventSet=new Set,window.objectFitImages&&objectFitImages()}return _createClass(e,[{key:"initRaw",value:function(){var t=this;this.util.forEach(document.querySelectorAll("[data-raw]"),function(e){e.innerHTML=t.data[e.id]})}},{key:"initSVGIcon",value:function(){this.util.forEach(document.querySelectorAll("[data-svg-src]"),function(e){fetch(e.getAttribute("data-svg-src")).then(function(e){return e.text()}).then(function(t){var n,s,o=document.createElement("div");o.insertAdjacentHTML("afterbegin",t),n=o.firstChild,n.setAttribute("data-svg-src",e.getAttribute("data-svg-src")),n.classList.add("icon"),s=n.getElementsByTagName("title"),s.length&&n.removeChild(s[0]),e.parentElement.replaceChild(n,e)}).catch(function(e){console.error(e)})})}},{key:"initTwemoji",value:function(){this.config.twemoji&&twemoji.parse(document.body)}},{key:"initMenuMobile",value:function(){var t=document.getElementById("menu-toggle-mobile"),n=document.getElementById("menu-mobile");t.addEventListener("click",function(){document.body.classList.toggle("blur"),t.classList.toggle("active"),n.classList.toggle("active")},!1),this._menuMobileOnClickMask=this._menuMobileOnClickMask||function(){t.classList.remove("active"),n.classList.remove("active")},this.clickMaskEventSet.add(this._menuMobileOnClickMask)}},{key:"initSwitchTheme",value:function(){var t=this;this.util.forEach(document.getElementsByClassName("theme-switch"),function(e){e.addEventListener("click",function(){document.body.getAttribute("theme")==="dark"?document.body.setAttribute("theme","light"):document.body.setAttribute("theme","dark"),t.isDark=!t.isDark,window.localStorage&&localStorage.setItem("theme",t.isDark?"dark":"light");var n,s,e=_createForOfIteratorHelper(t.switchThemeEventSet);try{for(e.s();!(n=e.n()).done;)s=n.value,s()}catch(t){e.e(t)}finally{e.f()}},!1)})}},{key:"initSearch",value:function(){var s,o,i,a,r,c,l,d,h,m,f,t=this,n=this.config.search,u=this.util.isMobile();if(!n||u&&this._searchMobileOnce||!u&&this._searchDesktopOnce)return;m=n.maxResultLength?n.maxResultLength:10,d=n.snippetLength?n.snippetLength:50,a=n.highlightTag?n.highlightTag:"em",i=u?"mobile":"desktop",c=document.getElementById("header-".concat(i)),l=document.getElementById("search-input-".concat(i)),f=document.getElementById("search-toggle-".concat(i)),r=document.getElementById("search-loading-".concat(i)),s=document.getElementById("search-clear-".concat(i)),u?(this._searchMobileOnce=!0,l.addEventListener("focus",function(){document.body.classList.add("blur"),c.classList.add("open")},!1),
Line truncated
|
||||
`).length<t.config.code.maxShownLines+2)&&e.classList.add("open"),t.config.code.copyTitle&&(n.setAttribute("data-clipboard-text",c),n.title=t.config.code.copyTitle,l=new ClipboardJS(n),l.on("success",function(){t.util.animateCSS(a,"animate__flash")}),s.appendChild(n)),e.insertBefore(s,e.firstChild))})}},{key:"initTable",value:function(){this.util.forEach(document.querySelectorAll(".content table"),function(e){var t=document.createElement("div");t.className="table-wrapper",e.parentElement.replaceChild(t,e),t.appendChild(e)})}},{key:"initHeaderLink",value:function(){for(var t=1;t<=6;t++)this.util.forEach(document.querySelectorAll(".single .content > h"+t),function(e){e.classList.add("headerLink"),e.insertAdjacentHTML("afterbegin",'<a href="#'.concat(e.id,'" class="header-mark"></a>'))})}},{key:"initToc",value:function(){var n,s,o,i,a,r,l,d,u,h,m,f,p,c=this,t=document.getElementById("TableOfContents");if(t===null)return;document.getElementById("toc-static").getAttribute("data-kept")||this.util.isTocStatic()?(h=document.getElementById("toc-content-static"),t.parentElement!==h&&(t.parentElement.removeChild(t),h.appendChild(t)),this._tocOnScroll&&this.scrollEventSet.delete(this._tocOnScroll)):(u=document.getElementById("toc-content-auto"),t.parentElement!==u&&(t.parentElement.removeChild(t),u.appendChild(t)),n=document.getElementById("toc-auto"),d=document.getElementsByClassName("page")[0],l=d.getBoundingClientRect(),n.style.left="".concat(l.left+l.width+20,"px"),n.style.maxWidth="".concat(d.getBoundingClientRect().left-20,"px"),n.style.visibility="visible",r=t.querySelectorAll("a:first-child"),f=t.getElementsByTagName("li"),s=document.getElementsByClassName("headerLink"),i=document.body.getAttribute("data-header-desktop")!=="normal",o=document.getElementById("header-desktop").offsetHeight,a=20+(i?o:0),m=n.offsetTop,p=m-a+(i?0:o),this._tocOnScroll=this._tocOnScroll||function(){var e,l,d,u,h,v,b=document.getElementById("post-footer").offsetTop,g=b-n.getBoundingClientRect().height,j=g-a+(i?0:o);c.newScrollTop<p?(n.style.position="absolute",n.style.top="".concat(m,"px")):c.newScrollTop>j?(n.style.position="absolute",n.style.top="".concat(g,"px")):(n.style.position="fixed",n.style.top="".concat(a,"px")),c.util.forEach(r,function(e){e.classList.remove("active")}),c.util.forEach(f,function(e){e.classList.remove("has-active")}),u=20+(i?o:0),d=s.length-1;for(e=0;e<s.length-1;e++)if(h=s[e].getBoundingClientRect().top,v=s[e+1].getBoundingClientRect().top,e==0&&h>u||h<=u&&v>u){d=e;break}if(d!==-1)for(r[d].classList.add("active"),l=r[d].parentElement;l!==t;)l.classList.add("has-active"),l=l.parentElement.parentElement},this._tocOnScroll(),this.scrollEventSet.add(this._tocOnScroll))}},{key:"initMath",value:function(){this.config.math&&renderMathInElement(document.body,this.config.math)}},{key:"initMermaid",value:function(){var t=this;this._mermaidOnSwitchTheme=this._mermaidOnSwitchTheme||function(){var e=document.getElementsByClassName("mermaid");e.length&&(mermaid.initialize({startOnLoad:!1,theme:t.isDark?"dark":"neutral",securityLevel:"loose"}),t.util.forEach(e,function(e){mermaid.render("svg-"+e.id,t.data[e.id],function(t){e.innerHTML=t},e)}))},this.switchThemeEventSet.add(this._mermaidOnSwitchTheme),this._mermaidOnSwitchTheme()}},{key:"initEcharts",value:function(){var t=this;this.config.echarts&&(echarts.registerTheme("light",this.config.echarts.lightTheme),echarts.registerTheme("dark",this.config.echarts.darkTheme),this._echartsOnSwitchTheme=this._echartsOnSwitchTheme||function(){t._echartsArr=t._echartsArr||[];for(var e=0;e<t._echartsArr.length;e++)t._echartsArr[e].dispose();t._echartsArr=[],t.util.forEach(document.getElementsByClassName("echarts"),function(e){var n=echarts.init(e,t.isDark?"dark":"light",{renderer:"svg"});n.setOption(JSON.parse(t.data[e.id])),t._echartsArr.push(n)})},this.switchThemeEventSet.add(this._echartsOnSwitchTheme),this._echartsOnSwitchTheme(),this._echartsOnResize=this._echartsOnResize||function(){for(var e=0;e<t._echartsArr.length;e++)t._echartsArr[e].resize()},this.resizeEventSet.add(this._echartsOnResize))}},{key:"initMapbox",value:function(){var t=this;this.config.mapbox&&(mapboxgl.accessToken=this.config.mapbox.accessToken,mapboxgl.setRTLTextPlugin(this.config.mapbox.RTLTextPlugin),this._mapboxArr=this._mapboxArr||[],this.util.forEach(document.getElementsByClassName("mapbox"),function(e){var n=t.data[e.id],o=n.lng,i=n.lat,a=n.zoom,r=n.lightStyle,m=n.darkStyle,c=n.marked,l=n.navigation,d=n.geolocate,u=n.scale,h=n.fullscreen,s=new mapboxgl.Map({container:e,center:[o,i],zoom:a,minZoom:.2,style:t.isDark?m:r,attributionControl:!1});c&&(new mapboxgl.Marker).setLngLat([o,i]).addTo(s),l&&s.addControl(new mapboxgl.NavigationControl,"bottom-right"),d&&s.addControl(new mapboxgl.GeolocateControl({positionOptions:{enableHighAccuracy:!0},showUserLocation:!0,trackUserLocation:!0}),"bottom-right"),u&&s.addControl(new mapboxgl.ScaleControl),h&&s.addControl(new mapboxgl.FullscreenControl),s.addControl(new
Line truncated
|
||||
Reference in new issue
Block a user