-
+ {{- /* raw html content */ -}}
{{- if .Get "raw" -}}
{{- $content | safeHTML -}}
{{- else if .Get "code" -}}
-
+ {{- /* highlight code content without line number */ -}}
{{- $content = highlight $content (.Get "code") "linenos=false" -}}
-
+ {{- /* delete outer label */ -}}
{{- $content = replaceRE `
` "$1" $content -}}
-
+ {{- /* parsing markdown links */ -}}
{{- $content = replaceRE `(
]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)()` "$1$2$6
$3$1$5$6" $content -}}
-
+ {{- /* replace " " to " " and replace "\n" to "
" */ -}}
{{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "
" -}}
-
+ {{- /* fix "
" location error which is a bug of Typeit HTML parser */ -}}
{{- $content = replaceRE `
` "
" $content -}}
{{- $content | safeHTML -}}
@@ -27,7 +27,7 @@
{{- else -}}
{{- $tag := .Get "tag" | default "p" -}}
- {{- $content = $content | markdownify | chomp -}}
+ {{- $content = $content | chomp -}}
{{- $content | safeHTML -}}
diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml
index c44c16ff..d13d9280 100644
--- a/layouts/sitemap.xml
+++ b/layouts/sitemap.xml
@@ -9,7 +9,7 @@
{{- if not .Lastmod.IsZero -}}
- {{- safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) -}}
+ {{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}}
{{- end -}}
{{- with .Sitemap.ChangeFreq -}}
diff --git a/src/js/theme.js b/src/js/theme.js
index 76292605..21e39173 100644
--- a/src/js/theme.js
+++ b/src/js/theme.js
@@ -84,16 +84,6 @@
this.util.forEach(toc.querySelectorAll('a:first-child'), (link) => {
link.classList.add('toc-link');
});
-
- // when headings do not start with `h1`
- const oldTocList = toc.children[0];
- let newTocList = oldTocList;
- let temp;
- while (newTocList.children.length === 1
- && (temp = newTocList.children[0].children[0]).tagName === 'UL') {
- newTocList = temp;
- }
- if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList);
}
_initTocState(tocContainer) {
@@ -157,7 +147,7 @@
initToc() {
const tocContainer = document.getElementById('post-toc');
if (tocContainer !== null) {
- const toc = document.getElementById('TableOfContents');
+ const toc = tocContainer.getElementById('TableOfContents');
if (toc === null) {
tocContainer.parentElement.removeChild(tocContainer);
} else {
diff --git a/static/js/theme.min.js b/static/js/theme.min.js
index abfc2aea..708a25ea 100644
--- a/static/js/theme.min.js
+++ b/static/js/theme.min.js
@@ -1,4 +1,3 @@
-"use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d
.chroma"),function(a){var b=a.querySelectorAll("pre.chroma > code"),c=b[b.length-1],d=c?c.className.toLowerCase():"";a.className+=" "+d}),this.util.forEach(document.querySelectorAll(".highlight > pre.chroma"),function(a){var b=document.createElement("div");b.className=a.className;var c=document.createElement("table");b.appendChild(c);var d=document.createElement("tbody");c.appendChild(d);var e=document.createElement("tr");d.appendChild(e);var f=document.createElement("td");e.appendChild(f),a.parentElement.replaceChild(b,a),f.appendChild(a)})}},{key:"initTable",value:function initTable(){this.util.forEach(document.querySelectorAll(".content table"),function(a){var b=document.createElement("div");b.className="table-wrapper",a.parentElement.replaceChild(b,a),b.appendChild(a)})}},{key:"initHeaderLink",value:function initHeaderLink(){for(var a=1;6>=a;a++)this.util.forEach(document.querySelectorAll(".content > h"+a),function(a){a.classList.add("headerLink"),a.innerHTML="").concat(a.innerHTML)})}},{key:"_refactorToc",value:function _refactorToc(a){this.util.forEach(a.querySelectorAll("a:first-child"),function(a){a.classList.add("toc-link")});for(// when headings do not start with `h1`
-var b,c=a.children[0],d=c;1===d.children.length&&"UL"===(b=d.children[0].children[0]).tagName;)d=b;d!==c&&a.replaceChild(d,c)}},{key:"_initTocState",value:function _initTocState(a){var b=this;if("none"!==window.getComputedStyle(a,null).display){var c="normal"!==window.desktopHeaderMode,d=document.getElementById("header-desktop").getBoundingClientRect().height,e=20+(c?d:0),f=a.offsetTop,g=f-e+(c?0:d),h=document.getElementById("post-footer").offsetTop,j=a.getElementsByClassName("toc-link"),k=document.getElementsByClassName("headerLink")||[],l=a.querySelectorAll(".post-toc-content li"),m=5+(c?d:0),n=function(){var n=b.util.getScrollTop(),o=h-a.getBoundingClientRect().height,p=o-e+(c?0:d);np?(a.style.position="absolute",a.style.top="".concat(o,"px")):(a.style.position="fixed",a.style.top="".concat(e,"px")),b.util.forEach(j,function(a){a.classList.remove("active")}),b.util.forEach(l,function(a){a.classList.remove("has-active")});for(var q=k.length-1,r=0;rm||s<=m&&t>m){q=r;break}}if(-1!==q){j[q].classList.add("active");for(var u=j[q].parentElement;"NAV"!==u.tagName;)u.classList.add("has-active"),u=u.parentElement.parentElement}};n(),this._initTocOnce||(this.scrollEvents.push(n),this._initTocOnce=!0)}}},{key:"initToc",value:function initToc(){var a=this,b=document.getElementById("post-toc");if(null!==b){var c=document.getElementById("TableOfContents");null===c?b.parentElement.removeChild(b):(this._refactorToc(c),this._initTocState(b),window.addEventListener("resize",function(){window.setTimeout(function(){a._initTocState(b)},0)},!1))}}},{key:"initMermaid",value:function initMermaid(){window.mermaidMap&&(mermaid.initialize({startOnLoad:!1,theme:null}),Object.keys(mermaidMap).forEach(function(a){var b=document.getElementById(a);mermaid.mermaidAPI.render("d"+a,mermaidMap[a],function(a){b.innerHTML=a;var c=b.firstChild;c.style.width="100%"},b)}))}},{key:"initEcharts",value:function initEcharts(){if(window.echartsMap){for(var a=0;a .chroma"),function(a){var b=a.querySelectorAll("pre.chroma > code"),c=b[b.length-1],d=c?c.className.toLowerCase():"";a.className+=" "+d}),this.util.forEach(document.querySelectorAll(".highlight > pre.chroma"),function(a){var b=document.createElement("div");b.className=a.className;var c=document.createElement("table");b.appendChild(c);var d=document.createElement("tbody");c.appendChild(d);var e=document.createElement("tr");d.appendChild(e);var f=document.createElement("td");e.appendChild(f),a.parentElement.replaceChild(b,a),f.appendChild(a)})}},{key:"initTable",value:function initTable(){this.util.forEach(document.querySelectorAll(".content table"),function(a){var b=document.createElement("div");b.className="table-wrapper",a.parentElement.replaceChild(b,a),b.appendChild(a)})}},{key:"initHeaderLink",value:function initHeaderLink(){for(var a=1;6>=a;a++)this.util.forEach(document.querySelectorAll(".content > h"+a),function(a){a.classList.add("headerLink"),a.innerHTML="").concat(a.innerHTML)})}},{key:"_refactorToc",value:function _refactorToc(a){this.util.forEach(a.querySelectorAll("a:first-child"),function(a){a.classList.add("toc-link")})}},{key:"_initTocState",value:function _initTocState(a){var b=this;if("none"!==window.getComputedStyle(a,null).display){var c="normal"!==window.desktopHeaderMode,d=document.getElementById("header-desktop").getBoundingClientRect().height,e=20+(c?d:0),f=a.offsetTop,g=f-e+(c?0:d),h=document.getElementById("post-footer").offsetTop,j=a.getElementsByClassName("toc-link"),k=document.getElementsByClassName("headerLink")||[],l=a.querySelectorAll(".post-toc-content li"),m=5+(c?d:0),n=function(){var n=b.util.getScrollTop(),o=h-a.getBoundingClientRect().height,p=o-e+(c?0:d);np?(a.style.position="absolute",a.style.top="".concat(o,"px")):(a.style.position="fixed",a.style.top="".concat(e,"px")),b.util.forEach(j,function(a){a.classList.remove("active")}),b.util.forEach(l,function(a){a.classList.remove("has-active")});for(var q=k.length-1,r=0;rm||s<=m&&t>m){q=r;break}}if(-1!==q){j[q].classList.add("active");for(var u=j[q].parentElement;"NAV"!==u.tagName;)u.classList.add("has-active"),u=u.parentElement.parentElement}};n(),this._initTocOnce||(this.scrollEvents.push(n),this._initTocOnce=!0)}}},{key:"initToc",value:function initToc(){var a=this,b=document.getElementById("post-toc");if(null!==b){var c=b.getElementById("TableOfContents");null===c?b.parentElement.removeChild(b):(this._refactorToc(c),this._initTocState(b),window.addEventListener("resize",function(){window.setTimeout(function(){a._initTocState(b)},0)},!1))}}},{key:"initMermaid",value:function initMermaid(){window.mermaidMap&&(mermaid.initialize({startOnLoad:!1,theme:null}),Object.keys(mermaidMap).forEach(function(a){var b=document.getElementById(a);mermaid.mermaidAPI.render("d"+a,mermaidMap[a],function(a){b.innerHTML=a;var c=b.firstChild;c.style.width="100%"},b)}))}},{key:"initEcharts",value:function initEcharts(){if(window.echartsMap){for(var a=0;a {\n 'use strict';\n\n class Util {\n forEach(elements, handler) {\n elements = elements || [];\n for (let i = 0; i < elements.length; i++) {\n handler(elements[i]);\n }\n }\n\n getScrollTop() {\n return (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;\n }\n }\n\n class Theme {\n constructor() {\n this.util = new Util();\n this.scrollTop = 0;\n this.scrollEvents = [];\n }\n\n initMobileMenu() {\n document.getElementById('menu-toggle').onclick = () => {\n document.getElementById('menu-toggle').classList.toggle('active');\n document.getElementById('menu-mobile').classList.toggle('active');\n };\n }\n\n initSwitchTheme() {\n this.util.forEach(document.getElementsByClassName('theme-switch'), (button) => {\n button.onclick = () => {\n document.body.classList.toggle('dark-theme');\n window.isDark = !window.isDark;\n window.localStorage && window.localStorage.setItem('theme', window.isDark ? 'dark' : 'light');\n this.initEcharts();\n };\n });\n }\n\n initHighlight() {\n this.util.forEach(document.querySelectorAll('.highlight > .chroma'), (block) => {\n const codes = block.querySelectorAll('pre.chroma > code');\n const code = codes[codes.length - 1];\n const lang = code ? code.className.toLowerCase() : '';\n block.className += ' ' + lang;\n });\n this.util.forEach(document.querySelectorAll('.highlight > pre.chroma'), (block) => {\n const chroma = document.createElement('div');\n chroma.className = block.className;\n const table = document.createElement('table');\n chroma.appendChild(table);\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n const tr = document.createElement('tr');\n tbody.appendChild(tr);\n const td = document.createElement('td');\n tr.appendChild(td);\n block.parentElement.replaceChild(chroma, block);\n td.appendChild(block);\n });\n }\n\n initTable() {\n this.util.forEach(document.querySelectorAll('.content table'), (table) => {\n const wrapper = document.createElement('div');\n wrapper.className = 'table-wrapper';\n table.parentElement.replaceChild(wrapper, table);\n wrapper.appendChild(table);\n });\n }\n\n initHeaderLink() {\n for (let num = 1; num <= 6; num++) {\n this.util.forEach(document.querySelectorAll('.content > h' + num), (header) => {\n header.classList.add('headerLink');\n header.innerHTML = `${header.innerHTML}`;\n });\n }\n }\n\n _refactorToc(toc) {\n this.util.forEach(toc.querySelectorAll('a:first-child'), (link) => {\n link.classList.add('toc-link');\n });\n\n // when headings do not start with `h1`\n const oldTocList = toc.children[0];\n let newTocList = oldTocList;\n let temp;\n while (newTocList.children.length === 1\n && (temp = newTocList.children[0].children[0]).tagName === 'UL') {\n newTocList = temp;\n }\n if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList);\n }\n\n _initTocState(tocContainer) {\n if (window.getComputedStyle(tocContainer, null).display !== 'none') {\n const fixed = window.desktopHeaderMode !== 'normal';\n const fixedHeight = document.getElementById('header-desktop').getBoundingClientRect().height;\n const TOP_SPACING = 20 + (fixed ? fixedHeight : 0);\n const minTop = tocContainer.offsetTop;\n const minScrollTop = minTop - TOP_SPACING + (fixed ? 0 : fixedHeight);\n const footerTop = document.getElementById('post-footer').offsetTop;\n const toclinks = tocContainer.getElementsByClassName('toc-link');\n const headerLinks = document.getElementsByClassName('headerLink') || [];\n const tocLinkLis = tocContainer.querySelectorAll('.post-toc-content li');\n const INDEX_SPACING = 5 + (fixed ? fixedHeight : 0);\n\n const changeTocState = () => {\n const scrollTop = this.util.getScrollTop();\n const maxTop = footerTop - tocContainer.getBoundingClientRect().height;\n const maxScrollTop = maxTop - TOP_SPACING + (fixed ? 0 : fixedHeight);\n if (scrollTop < minScrollTop) {\n tocContainer.style.position = 'absolute';\n tocContainer.style.top = `${minTop}px`;\n } else if (scrollTop > maxScrollTop) {\n tocContainer.style.position = 'absolute';\n tocContainer.style.top = `${maxTop}px`;\n } else {\n tocContainer.style.position = 'fixed';\n tocContainer.style.top = `${TOP_SPACING}px`;\n }\n\n this.util.forEach(toclinks, (link) => { link.classList.remove('active'); });\n this.util.forEach(tocLinkLis, (link) => { link.classList.remove('has-active'); });\n let activeTocIndex = headerLinks.length - 1;\n for (let i = 0; i < headerLinks.length - 1; i++) {\n const thisTop = headerLinks[i].getBoundingClientRect().top;\n const nextTop = headerLinks[i + 1].getBoundingClientRect().top;\n if ((i == 0 && thisTop > INDEX_SPACING)\n || (thisTop <= INDEX_SPACING && nextTop > INDEX_SPACING)) {\n activeTocIndex = i;\n break;\n }\n }\n if (activeTocIndex !== -1) {\n toclinks[activeTocIndex].classList.add('active');\n let parent = toclinks[activeTocIndex].parentElement;\n while (parent.tagName !== 'NAV') {\n parent.classList.add('has-active');\n parent = parent.parentElement.parentElement;\n }\n }\n };\n changeTocState();\n\n if (!this._initTocOnce) {\n this.scrollEvents.push(changeTocState);\n this._initTocOnce = true;\n }\n }\n }\n\n initToc() {\n const tocContainer = document.getElementById('post-toc');\n if (tocContainer !== null) {\n const toc = document.getElementById('TableOfContents');\n if (toc === null) {\n tocContainer.parentElement.removeChild(tocContainer);\n } else {\n this._refactorToc(toc);\n this._initTocState(tocContainer);\n window.addEventListener('resize', () => {\n window.setTimeout(() => {\n this._initTocState(tocContainer);\n }, 0);\n }, false);\n }\n }\n }\n\n initMermaid() {\n if (window.mermaidMap) {\n mermaid.initialize({startOnLoad: false, theme: null});\n Object.keys(mermaidMap).forEach((id) => {\n const element = document.getElementById(id);\n mermaid.mermaidAPI.render(\"d\" + id, mermaidMap[id], (svgCode) => {\n element.innerHTML = svgCode;\n const svg = element.firstChild;\n svg.style.width = \"100%\"\n }, element);\n });\n }\n }\n\n initEcharts() {\n if (window.echartsMap) {\n for (let i = 0; i < echartsArr.length; i++) {\n echartsArr[i].dispose();\n }\n echartsArr = [];\n Object.keys(echartsMap).forEach((id) => {\n let myChart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});\n myChart.setOption(echartsMap[id]);\n echartsArr.push(myChart);\n });\n window.addEventListener(\"resize\", function () {\n this.setTimeout(() => {\n for (let i = 0; i < echartsArr.length; i++) {\n echartsArr[i].resize();\n }\n }, 0);\n }, false);\n }\n }\n\n initTypeit() {\n if (window.typeitArr) {\n for (let i = 0; i < typeitArr.length; i++) {\n const group = typeitArr[i];\n (function typeone(i) {\n const content = document.getElementById(`r${group[i]}`).innerHTML;\n if (i === group.length - 1) {\n new TypeIt(`#${group[i]}`, {\n strings: content,\n }).go();\n return;\n }\n let instance = new TypeIt(`#${group[i]}`, {\n strings: content,\n afterComplete: () => {\n instance.destroy();\n typeone(i + 1);\n },\n }).go();\n })(0);\n }\n }\n }\n\n initScroll() {\n for (let i = 0; i < this.scrollEvents.length; i++) {\n document.addEventListener('scroll', this.scrollEvents[i], false);\n }\n const initSmoothScroll = () => {\n const isMobile = window.matchMedia('only screen and (max-width: 560px)').matches;\n if ((!isMobile && window.desktopHeaderMode === 'normal')\n || (isMobile && window.mobileHeaderMode === 'normal')) {\n new SmoothScroll('[href^=\"#\"]', {speed: 300, speedAsDuration: true});\n } else {\n new SmoothScroll('[href^=\"#\"]', {speed: 300, speedAsDuration: true, header: '#header-desktop'});\n }\n };\n initSmoothScroll();\n window.addEventListener('resize', () => {\n window.setTimeout(() => {\n initSmoothScroll();\n }, 0);\n }, false);\n const headers = [];\n if (window.desktopHeaderMode === 'auto') headers.push(document.getElementById('header-desktop'));\n if (window.mobileHeaderMode === 'auto') headers.push(document.getElementById('header-mobile'));\n this.util.forEach(headers, (header) => {\n header.classList.add('animated');\n header.classList.add('faster');\n });\n const toTopButton = document.getElementById('dynamic-to-top');\n document.addEventListener('scroll', () => {\n const scrollTop = this.util.getScrollTop();\n this.util.forEach(headers, (header) => {\n if (this.scrollTop < scrollTop) {\n if (!header.classList.contains('fadeOutUp')) {\n header.classList.remove('fadeInDown');\n header.classList.add('fadeOutUp');\n }\n } else {\n if (!header.classList.contains('fadeInDown')) {\n header.classList.remove('fadeOutUp');\n header.classList.add('fadeInDown');\n }\n }\n if (scrollTop > 600) {\n if (this.scrollTop < scrollTop) {\n if (!toTopButton.classList.contains('fadeOut')) {\n toTopButton.classList.remove('fadeIn');\n toTopButton.classList.add('fadeOut');\n }\n } else {\n toTopButton.style.display = 'block';\n if (!toTopButton.classList.contains('fadeIn')) {\n toTopButton.classList.remove('fadeOut');\n toTopButton.classList.add('fadeIn');\n }\n }\n } else {\n toTopButton.style.display = 'none';\n }\n });\n this.scrollTop = scrollTop;\n }, false);\n }\n\n init() {\n this.initMobileMenu();\n this.initSwitchTheme();\n this.initHighlight();\n this.initTable();\n this.initHeaderLink();\n this.initMermaid();\n this.initEcharts();\n this.initTypeit();\n this.initToc();\n this.initScroll();\n }\n }\n\n const themeInit = () => {\n const theme = new Theme();\n theme.init();\n };\n\n if (document.readyState !== 'loading') {\n themeInit();\n } else {\n document.addEventListener('DOMContentLoaded', themeInit, false);\n }\n})();\n"]}
\ No newline at end of file
+{"version":3,"sources":["../../src/js/theme.js"],"names":[],"mappings":"+YAAA,CAAC,UAAM,CACH,aADG,GAGG,CAAA,CAHH,2HAIS,CAJT,CAImB,CAJnB,CAI4B,CACvB,CAAQ,CAAG,CAAQ,EAAI,EADA,CAEvB,IAAK,GAAI,CAAA,CAAC,CAAG,CAAb,CAAgB,CAAC,CAAG,CAAQ,CAAC,MAA7B,CAAqC,CAAC,EAAtC,CACI,CAAO,CAAC,CAAQ,CAAC,CAAD,CAAT,CAEd,CATF,mDAWgB,CACX,MAAQ,CAAA,QAAQ,CAAC,eAAT,EAA4B,QAAQ,CAAC,eAAT,CAAyB,SAAtD,EAAoE,QAAQ,CAAC,IAAT,CAAc,SAC5F,CAbF,SAgBG,CAhBH,yBAiBC,YAAc,yBACV,KAAK,IAAL,CAAY,GAAI,CAAA,CADN,CAEV,KAAK,SAAL,CAAiB,CAFP,CAGV,KAAK,YAAL,CAAoB,EACvB,CArBF,4EAuBkB,CACb,QAAQ,CAAC,cAAT,CAAwB,aAAxB,EAAuC,OAAvC,CAAiD,UAAM,CACnD,QAAQ,CAAC,cAAT,CAAwB,aAAxB,EAAuC,SAAvC,CAAiD,MAAjD,CAAwD,QAAxD,CADmD,CAEnD,QAAQ,CAAC,cAAT,CAAwB,aAAxB,EAAuC,SAAvC,CAAiD,MAAjD,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,IAAN,EACH,CA9SE,CAgTyB,SAAxB,GAAA,QAAQ,CAAC,UAhTV,CAmTC,QAAQ,CAAC,gBAAT,CAA0B,kBAA1B,CAA8C,CAA9C,IAnTD,CAiTC,CAAS,EAIhB,CArTD,G","file":"theme.min.js","sourcesContent":["(() => {\n 'use strict';\n\n class Util {\n forEach(elements, handler) {\n elements = elements || [];\n for (let i = 0; i < elements.length; i++) {\n handler(elements[i]);\n }\n }\n\n getScrollTop() {\n return (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;\n }\n }\n\n class Theme {\n constructor() {\n this.util = new Util();\n this.scrollTop = 0;\n this.scrollEvents = [];\n }\n\n initMobileMenu() {\n document.getElementById('menu-toggle').onclick = () => {\n document.getElementById('menu-toggle').classList.toggle('active');\n document.getElementById('menu-mobile').classList.toggle('active');\n };\n }\n\n initSwitchTheme() {\n this.util.forEach(document.getElementsByClassName('theme-switch'), (button) => {\n button.onclick = () => {\n document.body.classList.toggle('dark-theme');\n window.isDark = !window.isDark;\n window.localStorage && window.localStorage.setItem('theme', window.isDark ? 'dark' : 'light');\n this.initEcharts();\n };\n });\n }\n\n initHighlight() {\n this.util.forEach(document.querySelectorAll('.highlight > .chroma'), (block) => {\n const codes = block.querySelectorAll('pre.chroma > code');\n const code = codes[codes.length - 1];\n const lang = code ? code.className.toLowerCase() : '';\n block.className += ' ' + lang;\n });\n this.util.forEach(document.querySelectorAll('.highlight > pre.chroma'), (block) => {\n const chroma = document.createElement('div');\n chroma.className = block.className;\n const table = document.createElement('table');\n chroma.appendChild(table);\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n const tr = document.createElement('tr');\n tbody.appendChild(tr);\n const td = document.createElement('td');\n tr.appendChild(td);\n block.parentElement.replaceChild(chroma, block);\n td.appendChild(block);\n });\n }\n\n initTable() {\n this.util.forEach(document.querySelectorAll('.content table'), (table) => {\n const wrapper = document.createElement('div');\n wrapper.className = 'table-wrapper';\n table.parentElement.replaceChild(wrapper, table);\n wrapper.appendChild(table);\n });\n }\n\n initHeaderLink() {\n for (let num = 1; num <= 6; num++) {\n this.util.forEach(document.querySelectorAll('.content > h' + num), (header) => {\n header.classList.add('headerLink');\n header.innerHTML = `${header.innerHTML}`;\n });\n }\n }\n\n _refactorToc(toc) {\n this.util.forEach(toc.querySelectorAll('a:first-child'), (link) => {\n link.classList.add('toc-link');\n });\n }\n\n _initTocState(tocContainer) {\n if (window.getComputedStyle(tocContainer, null).display !== 'none') {\n const fixed = window.desktopHeaderMode !== 'normal';\n const fixedHeight = document.getElementById('header-desktop').getBoundingClientRect().height;\n const TOP_SPACING = 20 + (fixed ? fixedHeight : 0);\n const minTop = tocContainer.offsetTop;\n const minScrollTop = minTop - TOP_SPACING + (fixed ? 0 : fixedHeight);\n const footerTop = document.getElementById('post-footer').offsetTop;\n const toclinks = tocContainer.getElementsByClassName('toc-link');\n const headerLinks = document.getElementsByClassName('headerLink') || [];\n const tocLinkLis = tocContainer.querySelectorAll('.post-toc-content li');\n const INDEX_SPACING = 5 + (fixed ? fixedHeight : 0);\n\n const changeTocState = () => {\n const scrollTop = this.util.getScrollTop();\n const maxTop = footerTop - tocContainer.getBoundingClientRect().height;\n const maxScrollTop = maxTop - TOP_SPACING + (fixed ? 0 : fixedHeight);\n if (scrollTop < minScrollTop) {\n tocContainer.style.position = 'absolute';\n tocContainer.style.top = `${minTop}px`;\n } else if (scrollTop > maxScrollTop) {\n tocContainer.style.position = 'absolute';\n tocContainer.style.top = `${maxTop}px`;\n } else {\n tocContainer.style.position = 'fixed';\n tocContainer.style.top = `${TOP_SPACING}px`;\n }\n\n this.util.forEach(toclinks, (link) => { link.classList.remove('active'); });\n this.util.forEach(tocLinkLis, (link) => { link.classList.remove('has-active'); });\n let activeTocIndex = headerLinks.length - 1;\n for (let i = 0; i < headerLinks.length - 1; i++) {\n const thisTop = headerLinks[i].getBoundingClientRect().top;\n const nextTop = headerLinks[i + 1].getBoundingClientRect().top;\n if ((i == 0 && thisTop > INDEX_SPACING)\n || (thisTop <= INDEX_SPACING && nextTop > INDEX_SPACING)) {\n activeTocIndex = i;\n break;\n }\n }\n if (activeTocIndex !== -1) {\n toclinks[activeTocIndex].classList.add('active');\n let parent = toclinks[activeTocIndex].parentElement;\n while (parent.tagName !== 'NAV') {\n parent.classList.add('has-active');\n parent = parent.parentElement.parentElement;\n }\n }\n };\n changeTocState();\n\n if (!this._initTocOnce) {\n this.scrollEvents.push(changeTocState);\n this._initTocOnce = true;\n }\n }\n }\n\n initToc() {\n const tocContainer = document.getElementById('post-toc');\n if (tocContainer !== null) {\n const toc = tocContainer.getElementById('TableOfContents');\n if (toc === null) {\n tocContainer.parentElement.removeChild(tocContainer);\n } else {\n this._refactorToc(toc);\n this._initTocState(tocContainer);\n window.addEventListener('resize', () => {\n window.setTimeout(() => {\n this._initTocState(tocContainer);\n }, 0);\n }, false);\n }\n }\n }\n\n initMermaid() {\n if (window.mermaidMap) {\n mermaid.initialize({startOnLoad: false, theme: null});\n Object.keys(mermaidMap).forEach((id) => {\n const element = document.getElementById(id);\n mermaid.mermaidAPI.render(\"d\" + id, mermaidMap[id], (svgCode) => {\n element.innerHTML = svgCode;\n const svg = element.firstChild;\n svg.style.width = \"100%\"\n }, element);\n });\n }\n }\n\n initEcharts() {\n if (window.echartsMap) {\n for (let i = 0; i < echartsArr.length; i++) {\n echartsArr[i].dispose();\n }\n echartsArr = [];\n Object.keys(echartsMap).forEach((id) => {\n let myChart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});\n myChart.setOption(echartsMap[id]);\n echartsArr.push(myChart);\n });\n window.addEventListener(\"resize\", function () {\n this.setTimeout(() => {\n for (let i = 0; i < echartsArr.length; i++) {\n echartsArr[i].resize();\n }\n }, 0);\n }, false);\n }\n }\n\n initTypeit() {\n if (window.typeitArr) {\n for (let i = 0; i < typeitArr.length; i++) {\n const group = typeitArr[i];\n (function typeone(i) {\n const content = document.getElementById(`r${group[i]}`).innerHTML;\n if (i === group.length - 1) {\n new TypeIt(`#${group[i]}`, {\n strings: content,\n }).go();\n return;\n }\n let instance = new TypeIt(`#${group[i]}`, {\n strings: content,\n afterComplete: () => {\n instance.destroy();\n typeone(i + 1);\n },\n }).go();\n })(0);\n }\n }\n }\n\n initScroll() {\n for (let i = 0; i < this.scrollEvents.length; i++) {\n document.addEventListener('scroll', this.scrollEvents[i], false);\n }\n const initSmoothScroll = () => {\n const isMobile = window.matchMedia('only screen and (max-width: 560px)').matches;\n if ((!isMobile && window.desktopHeaderMode === 'normal')\n || (isMobile && window.mobileHeaderMode === 'normal')) {\n new SmoothScroll('[href^=\"#\"]', {speed: 300, speedAsDuration: true});\n } else {\n new SmoothScroll('[href^=\"#\"]', {speed: 300, speedAsDuration: true, header: '#header-desktop'});\n }\n };\n initSmoothScroll();\n window.addEventListener('resize', () => {\n window.setTimeout(() => {\n initSmoothScroll();\n }, 0);\n }, false);\n const headers = [];\n if (window.desktopHeaderMode === 'auto') headers.push(document.getElementById('header-desktop'));\n if (window.mobileHeaderMode === 'auto') headers.push(document.getElementById('header-mobile'));\n this.util.forEach(headers, (header) => {\n header.classList.add('animated');\n header.classList.add('faster');\n });\n const toTopButton = document.getElementById('dynamic-to-top');\n document.addEventListener('scroll', () => {\n const scrollTop = this.util.getScrollTop();\n this.util.forEach(headers, (header) => {\n if (this.scrollTop < scrollTop) {\n if (!header.classList.contains('fadeOutUp')) {\n header.classList.remove('fadeInDown');\n header.classList.add('fadeOutUp');\n }\n } else {\n if (!header.classList.contains('fadeInDown')) {\n header.classList.remove('fadeOutUp');\n header.classList.add('fadeInDown');\n }\n }\n if (scrollTop > 600) {\n if (this.scrollTop < scrollTop) {\n if (!toTopButton.classList.contains('fadeOut')) {\n toTopButton.classList.remove('fadeIn');\n toTopButton.classList.add('fadeOut');\n }\n } else {\n toTopButton.style.display = 'block';\n if (!toTopButton.classList.contains('fadeIn')) {\n toTopButton.classList.remove('fadeOut');\n toTopButton.classList.add('fadeIn');\n }\n }\n } else {\n toTopButton.style.display = 'none';\n }\n });\n this.scrollTop = scrollTop;\n }, false);\n }\n\n init() {\n this.initMobileMenu();\n this.initSwitchTheme();\n this.initHighlight();\n this.initTable();\n this.initHeaderLink();\n this.initMermaid();\n this.initEcharts();\n this.initTypeit();\n this.initToc();\n this.initScroll();\n }\n }\n\n const themeInit = () => {\n const theme = new Theme();\n theme.init();\n };\n\n if (document.readyState !== 'loading') {\n themeInit();\n } else {\n document.addEventListener('DOMContentLoaded', themeInit, false);\n }\n})();\n"]}
\ No newline at end of file