From 6e091b6fad270022f20003c7e13d7edf2496a44e Mon Sep 17 00:00:00 2001 From: Dillon Date: Mon, 16 Mar 2020 15:01:51 +0800 Subject: [PATCH] feat(button): add 'comment' fixed button (#169) --- assets/css/_core/_base.scss | 2 +- ...dynamic-to-top.scss => _fixed-button.scss} | 13 +++++-- assets/js/theme.min.js | 2 +- assets/js/theme.min.js.map | 2 +- layouts/_default/baseof.html | 10 +++--- layouts/partials/comment.html | 8 ++--- layouts/posts/single.html | 8 ++--- ...s_b8ba9a60a151126bfcde1421dc0b972d.content | 2 +- src/js/theme.js | 36 ++++++++++++------- 9 files changed, 51 insertions(+), 32 deletions(-) rename assets/css/_partial/{_dynamic-to-top.scss => _fixed-button.scss} (86%) diff --git a/assets/css/_core/_base.scss b/assets/css/_core/_base.scss index db3768f4..5f8070d5 100644 --- a/assets/css/_core/_base.scss +++ b/assets/css/_core/_base.scss @@ -76,4 +76,4 @@ a { } } -@import "../_partial/dynamic-to-top"; +@import "../_partial/fixed-button"; diff --git a/assets/css/_partial/_dynamic-to-top.scss b/assets/css/_partial/_fixed-button.scss similarity index 86% rename from assets/css/_partial/_dynamic-to-top.scss rename to assets/css/_partial/_fixed-button.scss index 8e4c913e..61bf372a 100644 --- a/assets/css/_partial/_dynamic-to-top.scss +++ b/assets/css/_partial/_fixed-button.scss @@ -1,13 +1,12 @@ -#dynamic-to-top { +.fixed-button { display: none; overflow: hidden; width: auto; z-index: 100; position: fixed; - bottom: 2rem; - right: 2rem; top: auto; left: auto; + right: 1.5rem; font-size: 1rem; line-height: 1.3rem; padding: .6rem .6rem; @@ -35,3 +34,11 @@ } } } + +#top-button { + bottom: 1.5rem; +} + +#comment-button { + bottom: 4.5rem; +} diff --git a/assets/js/theme.min.js b/assets/js/theme.min.js index 0e6f14ce..588dbc66 100644 --- a/assets/js/theme.min.js +++ b/assets/js/theme.min.js @@ -1,3 +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(".page.single .content > h"+a),function(a){a.classList.add("headerLink"),a.innerHTML="").concat(a.innerHTML)})}},{key:"initToc",value:function initToc(){var a=this,b=document.getElementById("TableOfContents");if(null!==b)if(this.util.isTocStatic()){var k=document.getElementById("toc-content-static");b.parentElement!==k&&(b.parentElement.removeChild(b),k.appendChild(b)),this._tocOnScroll&&this.scrollEventSet.delete(this._tocOnScroll)}else{var l=document.getElementById("toc-content-auto");b.parentElement!==l&&(b.parentElement.removeChild(b),l.appendChild(b));var c=document.getElementById("toc-auto"),d=document.getElementsByClassName("page")[0];c.style.maxWidth="".concat(d.getBoundingClientRect().left-20,"px"),this._tocLinks=this._tocLinks||b.getElementsByTagName("a"),this._tocLis=this._tocLis||b.getElementsByTagName("li"),this._headerLinks=this._headerLinks||document.getElementsByClassName("headerLink")||[];var e="normal"!==window.desktopHeaderMode,f=document.getElementById("header-desktop").offsetHeight,g=20+(e?f:0),h=c.offsetTop,j=h-g+(e?0:f);this._tocOnScroll=this._tocOnScroll||function(){var k=document.getElementById("post-footer").offsetTop,l=k-c.getBoundingClientRect().height,m=l-g+(e?0:f),n=d.getBoundingClientRect();a.newScrollTopm?(c.style.position="absolute",c.style.top="".concat(l,"px"),c.style.left="".concat(n.width+20,"px")):(c.style.position="fixed",c.style.top="".concat(g,"px"),c.style.left="".concat(n.left+n.width+20,"px")),a.util.forEach(a._tocLinks,function(a){a.classList.remove("active")}),a.util.forEach(a._tocLis,function(a){a.classList.remove("has-active")});for(var o=20+(e?f:0),p=a._headerLinks.length-1,q=0;qo||r<=o&&s>o){p=q;break}}if(-1!==p){a._tocLinks[p].classList.add("active");for(var t=a._tocLinks[p].parentElement;t!==b;)t.classList.add("has-active"),t=t.parentElement.parentElement}},this._tocOnScroll(),this.scrollEventSet.add(this._tocOnScroll)}}},{key:"initMermaid",value:function initMermaid(){window.mermaidArr&&(mermaid.initialize({startOnLoad:!1,theme:"null"}),this.util.forEach(window.mermaidArr,function(a){var b=document.getElementById(a);mermaid.mermaidAPI.render("svg-"+a,window.contentMap[a],function(a){b.innerHTML=a},b)}))}},{key:"initEcharts",value:function initEcharts(){var a=this;if(window.echartsArr){this._echartsArr=this._echartsArr||[];for(var b=0;bd?(a.classList.remove("fadeInDown"),a.classList.add("fadeOutUp")):e<-d&&(a.classList.remove("fadeOutUp"),a.classList.add("fadeInDown"))}),200d?(c.classList.remove("fadeIn"),c.classList.add("fadeOut")):e<-d&&(c.style.display="block",c.classList.remove("fadeOut"),c.classList.add("fadeIn")):c.style.display="none",a._scrollTimeout||(a._scrollTimeout=window.setTimeout(function(){a._scrollTimeout=null;var b=!0,c=!1,d=void 0;try{for(var e,f,g=a.scrollEventSet[Symbol.iterator]();!(b=(e=g.next()).done);b=!0)f=e.value,f()}catch(a){c=!0,d=a}finally{try{b||null==g.return||g.return()}finally{if(c)throw d}}},10)),a.oldScrollTop=a.newScrollTop},!1)}},{key:"onResize",value:function onResize(){var a=this;window.addEventListener("resize",function(){a._resizeTimeout||(a._resizeTimeout=window.setTimeout(function(){a._resizeTimeout=null;var b=!0,c=!1,d=void 0;try{for(var e,f,g=a.resizeEventSet[Symbol.iterator]();!(b=(e=g.next()).done);b=!0)f=e.value,f()}catch(a){c=!0,d=a}finally{try{b||null==g.return||g.return()}finally{if(c)throw d}}a.initMenuMobile(),a.initToc(),a.initSmoothScroll(),a.initMermaid()},100))},!1)}},{key:"init",value:function init(){this.initMenuMobile(),this.initSwitchTheme(),this.initHighlight(),this.initTable(),this.initHeaderLink(),this.initMermaid(),this.initEcharts(),this.initTypeit(),this.initToc(),this.initSmoothScroll(),this.onScroll(),this.onResize()}}]),b}(),c=function(){var a=new b;a.init()};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c,!1):c()})(); +"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(".page.single .content > h"+a),function(a){a.classList.add("headerLink"),a.innerHTML="").concat(a.innerHTML)})}},{key:"initToc",value:function initToc(){var a=this,b=document.getElementById("TableOfContents");if(null!==b)if(this.util.isTocStatic()){var k=document.getElementById("toc-content-static");b.parentElement!==k&&(b.parentElement.removeChild(b),k.appendChild(b)),this._tocOnScroll&&this.scrollEventSet.delete(this._tocOnScroll)}else{var l=document.getElementById("toc-content-auto");b.parentElement!==l&&(b.parentElement.removeChild(b),l.appendChild(b));var c=document.getElementById("toc-auto"),d=document.getElementsByClassName("page")[0];c.style.maxWidth="".concat(d.getBoundingClientRect().left-20,"px"),this._tocLinks=this._tocLinks||b.getElementsByTagName("a"),this._tocLis=this._tocLis||b.getElementsByTagName("li"),this._headerLinks=this._headerLinks||document.getElementsByClassName("headerLink")||[];var e="normal"!==window.desktopHeaderMode,f=document.getElementById("header-desktop").offsetHeight,g=20+(e?f:0),h=c.offsetTop,j=h-g+(e?0:f);this._tocOnScroll=this._tocOnScroll||function(){var k=document.getElementById("post-footer").offsetTop,l=k-c.getBoundingClientRect().height,m=l-g+(e?0:f),n=d.getBoundingClientRect();a.newScrollTopm?(c.style.position="absolute",c.style.top="".concat(l,"px"),c.style.left="".concat(n.width+20,"px")):(c.style.position="fixed",c.style.top="".concat(g,"px"),c.style.left="".concat(n.left+n.width+20,"px")),a.util.forEach(a._tocLinks,function(a){a.classList.remove("active")}),a.util.forEach(a._tocLis,function(a){a.classList.remove("has-active")});for(var o=20+(e?f:0),p=a._headerLinks.length-1,q=0;qo||r<=o&&s>o){p=q;break}}if(-1!==p){a._tocLinks[p].classList.add("active");for(var t=a._tocLinks[p].parentElement;t!==b;)t.classList.add("has-active"),t=t.parentElement.parentElement}},this._tocOnScroll(),this.scrollEventSet.add(this._tocOnScroll)}}},{key:"initMermaid",value:function initMermaid(){window.mermaidArr&&(mermaid.initialize({startOnLoad:!1,theme:"null"}),this.util.forEach(window.mermaidArr,function(a){var b=document.getElementById(a);mermaid.mermaidAPI.render("svg-"+a,window.contentMap[a],function(a){b.innerHTML=a},b)}))}},{key:"initEcharts",value:function initEcharts(){var a=this;if(window.echartsArr){this._echartsArr=this._echartsArr||[];for(var b=0;b",d.appendChild(e)}var f=document.getElementsByClassName("fixed-button"),g=10;window.addEventListener("scroll",function(){a.newScrollTop=a.util.getScrollTop();var c=a.newScrollTop-a.oldScrollTop;a.util.forEach(b,function(a){c>g?(a.classList.remove("fadeInDown"),a.classList.add("fadeOutUp")):c<-g&&(a.classList.remove("fadeOutUp"),a.classList.add("fadeInDown"))}),a.util.forEach(f,function(b){20g?(b.classList.remove("fadeIn"),b.classList.add("fadeOut")):c<-g&&(b.style.display="block",b.classList.remove("fadeOut"),b.classList.add("fadeIn")):b.style.display="none"}),a._scrollTimeout||(a._scrollTimeout=window.setTimeout(function(){a._scrollTimeout=null;var b=!0,c=!1,d=void 0;try{for(var e,f,g=a.scrollEventSet[Symbol.iterator]();!(b=(e=g.next()).done);b=!0)f=e.value,f()}catch(a){c=!0,d=a}finally{try{b||null==g.return||g.return()}finally{if(c)throw d}}},10)),a.oldScrollTop=a.newScrollTop},!1)}},{key:"onResize",value:function onResize(){var a=this;window.addEventListener("resize",function(){a._resizeTimeout||(a._resizeTimeout=window.setTimeout(function(){a._resizeTimeout=null;var b=!0,c=!1,d=void 0;try{for(var e,f,g=a.resizeEventSet[Symbol.iterator]();!(b=(e=g.next()).done);b=!0)f=e.value,f()}catch(a){c=!0,d=a}finally{try{b||null==g.return||g.return()}finally{if(c)throw d}}a.initMenuMobile(),a.initToc(),a.initSmoothScroll(),a.initMermaid()},100))},!1)}},{key:"init",value:function init(){this.initMenuMobile(),this.initSwitchTheme(),this.initHighlight(),this.initTable(),this.initHeaderLink(),this.initMermaid(),this.initEcharts(),this.initTypeit(),this.initToc(),this.initSmoothScroll(),this.onScroll(),this.onResize()}}]),b}(),c=function(){var a=new b;a.init()};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c,!1):c()})(); //# sourceMappingURL=theme.min.js.map \ No newline at end of file diff --git a/assets/js/theme.min.js.map b/assets/js/theme.min.js.map index b83a79d4..1ee553fa 100644 --- a/assets/js/theme.min.js.map +++ b/assets/js/theme.min.js.map @@ -1 +1 @@ -{"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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AEhC,CAAI,CAAC,cAAL,CAAsB,MAAM,CAAC,UAAP,CAAkB,UAAM,CAC1C,CAAI,CAAC,cAAL,CAAsB,IADoB,4BAE1C,UAAS,CAAT,GAAkB,CAAI,CAAC,cAAvB,gDAAS,CAAT,SAAuC,CAAK,EAFF,mFAG1C,CAAI,CAAC,cAAL,EAH0C,CAI1C,CAAI,CAAC,OAAL,EAJ0C,CAK1C,CAAI,CAAC,gBAAL,EAL0C,CAM1C,CAAI,CAAC,WAAL,EACH,CAPqB,CAOnB,GAPmB,CAFU,CAWvC,CAXD,IAYH,CA3SF,mCA6SQ,CACH,KAAK,cAAL,EADG,CAEH,KAAK,eAAL,EAFG,CAGH,KAAK,aAAL,EAHG,CAIH,KAAK,SAAL,EAJG,CAKH,KAAK,cAAL,EALG,CAMH,KAAK,WAAL,EANG,CAOH,KAAK,WAAL,EAPG,CAQH,KAAK,UAAL,EARG,CASH,KAAK,OAAL,EATG,CAUH,KAAK,gBAAL,EAVG,CAYH,KAAK,QAAL,EAZG,CAaH,KAAK,QAAL,EACH,CA3TF,SA8TG,CAAS,CAAG,UAAM,CACpB,GAAM,CAAA,CAAK,CAAG,GAAI,CAAA,CAAlB,CACA,CAAK,CAAC,IAAN,EACH,CAjUE,CAmUyB,SAAxB,GAAA,QAAQ,CAAC,UAnUV,CAsUC,QAAQ,CAAC,gBAAT,CAA0B,kBAA1B,CAA8C,CAA9C,IAtUD,CAoUC,CAAS,EAIhB,CAxUD,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 isMobile() {\n return window.matchMedia('only screen and (max-width: 680px)').matches;\n }\n\n isTocStatic() {\n return window.matchMedia('only screen and (max-width: 960px)').matches;\n }\n }\n\n class Theme {\n constructor() {\n this.util = new Util();\n this.newScrollTop = this.util.getScrollTop();\n this.oldScrollTop = this.newScrollTop;\n this.scrollEventSet = new Set();\n this.resizeEventSet = new Set();\n }\n\n initMenuMobile() {\n const menuToggleMobile = document.getElementById('menu-toggle-mobile');\n const menuMobile = document.getElementById('menu-mobile');\n this._menuMobileOnScroll = this._menuMobileOnScroll || (() => {\n menuToggleMobile.classList.remove('active');\n menuMobile.classList.remove('active');\n });\n if (this.util.isMobile()) {\n menuToggleMobile.onclick = () => {\n menuToggleMobile.classList.toggle('active');\n menuMobile.classList.toggle('active');\n };\n this.scrollEventSet.add(this._menuMobileOnScroll);\n } else {\n this.scrollEventSet.delete(this._menuMobileOnScroll);\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('.page.single .content > h' + num), (header) => {\n header.classList.add('headerLink');\n header.innerHTML = `${header.innerHTML}`;\n });\n }\n }\n\n initToc() {\n const tocCore = document.getElementById('TableOfContents');\n if (tocCore === null) return;\n if (this.util.isTocStatic()) {\n const tocContentStatic = document.getElementById('toc-content-static');\n if (tocCore.parentElement !== tocContentStatic) {\n tocCore.parentElement.removeChild(tocCore);\n tocContentStatic.appendChild(tocCore);\n }\n if (this._tocOnScroll) this.scrollEventSet.delete(this._tocOnScroll);\n } else {\n const tocContentAuto = document.getElementById('toc-content-auto');\n if (tocCore.parentElement !== tocContentAuto) {\n tocCore.parentElement.removeChild(tocCore);\n tocContentAuto.appendChild(tocCore);\n }\n const toc = document.getElementById('toc-auto');\n const page = document.getElementsByClassName('page')[0];\n toc.style.maxWidth = `${page.getBoundingClientRect().left - 20}px`;\n this._tocLinks = this._tocLinks || tocCore.getElementsByTagName('a');\n this._tocLis = this._tocLis || tocCore.getElementsByTagName('li');\n this._headerLinks = this._headerLinks || document.getElementsByClassName('headerLink') || [];\n const headerIsFixed = window.desktopHeaderMode !== 'normal';\n const headerHeight = document.getElementById('header-desktop').offsetHeight;\n const TOP_SPACING = 20 + (headerIsFixed ? headerHeight : 0);\n const minTocTop = toc.offsetTop;\n const minScrollTop = minTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight);\n this._tocOnScroll = this._tocOnScroll || (() => {\n const footerTop = document.getElementById('post-footer').offsetTop;\n const maxTocTop = footerTop - toc.getBoundingClientRect().height;\n const maxScrollTop = maxTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight);\n const rect = page.getBoundingClientRect();\n if (this.newScrollTop < minScrollTop) {\n toc.style.position = 'absolute';\n toc.style.top = `${minTocTop}px`;\n toc.style.left = `${rect.width + 20}px`;\n } else if (this.newScrollTop > maxScrollTop) {\n toc.style.position = 'absolute';\n toc.style.top = `${maxTocTop}px`;\n toc.style.left = `${rect.width + 20}px`;\n } else {\n toc.style.position = 'fixed';\n toc.style.top = `${TOP_SPACING}px`;\n toc.style.left = `${rect.left + rect.width + 20}px`;\n }\n\n this.util.forEach(this._tocLinks, (link) => { link.classList.remove('active'); });\n this.util.forEach(this._tocLis, (link) => { link.classList.remove('has-active'); });\n const INDEX_SPACING = 20 + (headerIsFixed ? headerHeight : 0);\n let activeTocIndex = this._headerLinks.length - 1;\n for (let i = 0; i < this._headerLinks.length - 1; i++) {\n const thisTop = this._headerLinks[i].getBoundingClientRect().top;\n const nextTop = this._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 this._tocLinks[activeTocIndex].classList.add('active');\n let parent = this._tocLinks[activeTocIndex].parentElement;\n while (parent !== tocCore) {\n parent.classList.add('has-active');\n parent = parent.parentElement.parentElement;\n }\n }\n });\n this._tocOnScroll();\n this.scrollEventSet.add(this._tocOnScroll);\n }\n }\n\n initMermaid() {\n if (window.mermaidArr) {\n mermaid.initialize({startOnLoad: false, theme: 'null'});\n this.util.forEach(window.mermaidArr, (id) => {\n const element = document.getElementById(id);\n mermaid.mermaidAPI.render('svg-' + id, window.contentMap[id], (svgCode) => {\n element.innerHTML = svgCode;\n }, element);\n });\n }\n }\n\n initEcharts() {\n if (window.echartsArr) {\n this._echartsArr = this._echartsArr || [];\n for (let i = 0; i < this._echartsArr.length; i++) {\n this._echartsArr[i].dispose();\n }\n this._echartsArr = [];\n this.util.forEach(window.echartsArr, (id) => {\n const chart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});\n chart.setOption(JSON.parse(window.contentMap[id]));\n this._echartsArr.push(chart);\n });\n this._echartsOnResize = this._echartsOnResize || (() => {\n for (let i = 0; i < this._echartsArr.length; i++) {\n this._echartsArr[i].resize();\n }\n });\n this.resizeEventSet.add(this._echartsOnResize);\n }\n }\n\n initTypeit() {\n if (window.typeitArr) {\n for (let i = 0; i < window.typeitArr.length; i++) {\n const group = window.typeitArr[i];\n (function typeone(i) {\n const id = group[i];\n if (i === group.length - 1) {\n new TypeIt(`#${id}`, {\n strings: window.contentMap[id],\n }).go();\n return;\n }\n let instance = new TypeIt(`#${id}`, {\n strings: window.contentMap[id],\n afterComplete: () => {\n instance.destroy();\n typeone(i + 1);\n },\n }).go();\n })(0);\n }\n }\n }\n\n initSmoothScroll() {\n if ((!this.util.isMobile() && window.desktopHeaderMode === 'normal')\n || (this.util.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\n onScroll() {\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 const MIN_SCROLL = 10;\n window.addEventListener('scroll', () => {\n this.newScrollTop = this.util.getScrollTop();\n const scroll = this.newScrollTop - this.oldScrollTop;\n this.util.forEach(headers, (header) => {\n if (scroll > MIN_SCROLL) {\n header.classList.remove('fadeInDown');\n header.classList.add('fadeOutUp');\n } else if (scroll < - MIN_SCROLL) {\n header.classList.remove('fadeOutUp');\n header.classList.add('fadeInDown');\n }\n });\n if (this.newScrollTop > 200) {\n if (scroll > MIN_SCROLL) {\n toTopButton.classList.remove('fadeIn');\n toTopButton.classList.add('fadeOut');\n } else if (scroll < - MIN_SCROLL) {\n toTopButton.style.display = 'block';\n toTopButton.classList.remove('fadeOut');\n toTopButton.classList.add('fadeIn');\n }\n } else {\n toTopButton.style.display = 'none';\n }\n if (!this._scrollTimeout) {\n this._scrollTimeout = window.setTimeout(() => {\n this._scrollTimeout = null;\n for (let event of this.scrollEventSet) event();\n }, 10);\n }\n this.oldScrollTop = this.newScrollTop;\n }, false);\n }\n\n onResize() {\n window.addEventListener('resize', () => {\n if (!this._resizeTimeout) {\n this._resizeTimeout = window.setTimeout(() => {\n this._resizeTimeout = null;\n for (let event of this.resizeEventSet) event();\n this.initMenuMobile();\n this.initToc();\n this.initSmoothScroll();\n this.initMermaid()\n }, 100);\n }\n }, false);\n }\n\n init() {\n this.initMenuMobile();\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.initSmoothScroll();\n\n this.onScroll();\n this.onResize();\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,2CAeY,CACP,MAAO,CAAA,MAAM,CAAC,UAAP,CAAkB,oCAAlB,EAAwD,OAClE,CAjBF,iDAmBe,CACV,MAAO,CAAA,MAAM,CAAC,UAAP,CAAkB,oCAAlB,EAAwD,OAClE,CArBF,SAwBG,CAxBH,yBAyBC,YAAc,yBACV,KAAK,IAAL,CAAY,GAAI,CAAA,CADN,CAEV,KAAK,YAAL,CAAoB,KAAK,IA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MAAM,CAAC,gBAAP,CAAwB,QAAxB,CAAkC,UAAM,CAC/B,CAAI,CAAC,cAD0B,GAEhC,CAAI,CAAC,cAAL,CAAsB,MAAM,CAAC,UAAP,CAAkB,UAAM,CAC1C,CAAI,CAAC,cAAL,CAAsB,IADoB,4BAE1C,UAAS,CAAT,GAAkB,CAAI,CAAC,cAAvB,gDAAS,CAAT,SAAuC,CAAK,EAFF,mFAG1C,CAAI,CAAC,cAAL,EAH0C,CAI1C,CAAI,CAAC,OAAL,EAJ0C,CAK1C,CAAI,CAAC,gBAAL,EAL0C,CAM1C,CAAI,CAAC,WAAL,EACH,CAPqB,CAOnB,GAPmB,CAFU,CAWvC,CAXD,IAYH,CAvTF,mCAyTQ,CACH,KAAK,cAAL,EADG,CAEH,KAAK,eAAL,EAFG,CAGH,KAAK,aAAL,EAHG,CAIH,KAAK,SAAL,EAJG,CAKH,KAAK,cAAL,EALG,CAMH,KAAK,WAAL,EANG,CAOH,KAAK,WAAL,EAPG,CAQH,KAAK,UAAL,EARG,CASH,KAAK,OAAL,EATG,CAUH,KAAK,gBAAL,EAVG,CAYH,KAAK,QAAL,EAZG,CAaH,KAAK,QAAL,EACH,CAvUF,SA0UG,CAAS,CAAG,UAAM,CACpB,GAAM,CAAA,CAAK,CAAG,GAAI,CAAA,CAAlB,CACA,CAAK,CAAC,IAAN,EACH,CA7UE,CA+UyB,SAAxB,GAAA,QAAQ,CAAC,UA/UV,CAkVC,QAAQ,CAAC,gBAAT,CAA0B,kBAA1B,CAA8C,CAA9C,IAlVD,CAgVC,CAAS,EAIhB,CApVD,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 isMobile() {\n return window.matchMedia('only screen and (max-width: 680px)').matches;\n }\n\n isTocStatic() {\n return window.matchMedia('only screen and (max-width: 960px)').matches;\n }\n }\n\n class Theme {\n constructor() {\n this.util = new Util();\n this.newScrollTop = this.util.getScrollTop();\n this.oldScrollTop = this.newScrollTop;\n this.scrollEventSet = new Set();\n this.resizeEventSet = new Set();\n }\n\n initMenuMobile() {\n const menuToggleMobile = document.getElementById('menu-toggle-mobile');\n const menuMobile = document.getElementById('menu-mobile');\n this._menuMobileOnScroll = this._menuMobileOnScroll || (() => {\n menuToggleMobile.classList.remove('active');\n menuMobile.classList.remove('active');\n });\n if (this.util.isMobile()) {\n menuToggleMobile.onclick = () => {\n menuToggleMobile.classList.toggle('active');\n menuMobile.classList.toggle('active');\n };\n this.scrollEventSet.add(this._menuMobileOnScroll);\n } else {\n this.scrollEventSet.delete(this._menuMobileOnScroll);\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('.page.single .content > h' + num), (header) => {\n header.classList.add('headerLink');\n header.innerHTML = `${header.innerHTML}`;\n });\n }\n }\n\n initToc() {\n const tocCore = document.getElementById('TableOfContents');\n if (tocCore === null) return;\n if (this.util.isTocStatic()) {\n const tocContentStatic = document.getElementById('toc-content-static');\n if (tocCore.parentElement !== tocContentStatic) {\n tocCore.parentElement.removeChild(tocCore);\n tocContentStatic.appendChild(tocCore);\n }\n if (this._tocOnScroll) this.scrollEventSet.delete(this._tocOnScroll);\n } else {\n const tocContentAuto = document.getElementById('toc-content-auto');\n if (tocCore.parentElement !== tocContentAuto) {\n tocCore.parentElement.removeChild(tocCore);\n tocContentAuto.appendChild(tocCore);\n }\n const toc = document.getElementById('toc-auto');\n const page = document.getElementsByClassName('page')[0];\n toc.style.maxWidth = `${page.getBoundingClientRect().left - 20}px`;\n this._tocLinks = this._tocLinks || tocCore.getElementsByTagName('a');\n this._tocLis = this._tocLis || tocCore.getElementsByTagName('li');\n this._headerLinks = this._headerLinks || document.getElementsByClassName('headerLink') || [];\n const headerIsFixed = window.desktopHeaderMode !== 'normal';\n const headerHeight = document.getElementById('header-desktop').offsetHeight;\n const TOP_SPACING = 20 + (headerIsFixed ? headerHeight : 0);\n const minTocTop = toc.offsetTop;\n const minScrollTop = minTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight);\n this._tocOnScroll = this._tocOnScroll || (() => {\n const footerTop = document.getElementById('post-footer').offsetTop;\n const maxTocTop = footerTop - toc.getBoundingClientRect().height;\n const maxScrollTop = maxTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight);\n const rect = page.getBoundingClientRect();\n if (this.newScrollTop < minScrollTop) {\n toc.style.position = 'absolute';\n toc.style.top = `${minTocTop}px`;\n toc.style.left = `${rect.width + 20}px`;\n } else if (this.newScrollTop > maxScrollTop) {\n toc.style.position = 'absolute';\n toc.style.top = `${maxTocTop}px`;\n toc.style.left = `${rect.width + 20}px`;\n } else {\n toc.style.position = 'fixed';\n toc.style.top = `${TOP_SPACING}px`;\n toc.style.left = `${rect.left + rect.width + 20}px`;\n }\n\n this.util.forEach(this._tocLinks, (link) => { link.classList.remove('active'); });\n this.util.forEach(this._tocLis, (link) => { link.classList.remove('has-active'); });\n const INDEX_SPACING = 20 + (headerIsFixed ? headerHeight : 0);\n let activeTocIndex = this._headerLinks.length - 1;\n for (let i = 0; i < this._headerLinks.length - 1; i++) {\n const thisTop = this._headerLinks[i].getBoundingClientRect().top;\n const nextTop = this._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 this._tocLinks[activeTocIndex].classList.add('active');\n let parent = this._tocLinks[activeTocIndex].parentElement;\n while (parent !== tocCore) {\n parent.classList.add('has-active');\n parent = parent.parentElement.parentElement;\n }\n }\n });\n this._tocOnScroll();\n this.scrollEventSet.add(this._tocOnScroll);\n }\n }\n\n initMermaid() {\n if (window.mermaidArr) {\n mermaid.initialize({startOnLoad: false, theme: 'null'});\n this.util.forEach(window.mermaidArr, (id) => {\n const element = document.getElementById(id);\n mermaid.mermaidAPI.render('svg-' + id, window.contentMap[id], (svgCode) => {\n element.innerHTML = svgCode;\n }, element);\n });\n }\n }\n\n initEcharts() {\n if (window.echartsArr) {\n this._echartsArr = this._echartsArr || [];\n for (let i = 0; i < this._echartsArr.length; i++) {\n this._echartsArr[i].dispose();\n }\n this._echartsArr = [];\n this.util.forEach(window.echartsArr, (id) => {\n const chart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});\n chart.setOption(JSON.parse(window.contentMap[id]));\n this._echartsArr.push(chart);\n });\n this._echartsOnResize = this._echartsOnResize || (() => {\n for (let i = 0; i < this._echartsArr.length; i++) {\n this._echartsArr[i].resize();\n }\n });\n this.resizeEventSet.add(this._echartsOnResize);\n }\n }\n\n initTypeit() {\n if (window.typeitArr) {\n for (let i = 0; i < window.typeitArr.length; i++) {\n const group = window.typeitArr[i];\n (function typeone(i) {\n const id = group[i];\n if (i === group.length - 1) {\n new TypeIt(`#${id}`, {\n strings: window.contentMap[id],\n }).go();\n return;\n }\n let instance = new TypeIt(`#${id}`, {\n strings: window.contentMap[id],\n afterComplete: () => {\n instance.destroy();\n typeone(i + 1);\n },\n }).go();\n })(0);\n }\n }\n }\n\n initSmoothScroll() {\n if ((!this.util.isMobile() && window.desktopHeaderMode === 'normal')\n || (this.util.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\n onScroll() {\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 comments = document.getElementsByClassName('comment') || [];\n if (comments.length) {\n const container = document.getElementById('fixed-btn-container');\n const button = document.createElement('a');\n button.href = `#${comments[0].id}`;\n button.id = 'comment-button';\n button.className = 'fixed-button animated faster';\n button.innerHTML = '';\n container.appendChild(button);\n }\n const buttons = document.getElementsByClassName('fixed-button');\n const MIN_SCROLL = 10;\n window.addEventListener('scroll', () => {\n this.newScrollTop = this.util.getScrollTop();\n const scroll = this.newScrollTop - this.oldScrollTop;\n this.util.forEach(headers, (header) => {\n if (scroll > MIN_SCROLL) {\n header.classList.remove('fadeInDown');\n header.classList.add('fadeOutUp');\n } else if (scroll < - MIN_SCROLL) {\n header.classList.remove('fadeOutUp');\n header.classList.add('fadeInDown');\n }\n });\n this.util.forEach(buttons, (button) => {\n if (this.newScrollTop > 20) {\n if (scroll > MIN_SCROLL) {\n button.classList.remove('fadeIn');\n button.classList.add('fadeOut');\n } else if (scroll < - MIN_SCROLL) {\n button.style.display = 'block';\n button.classList.remove('fadeOut');\n button.classList.add('fadeIn');\n }\n } else {\n button.style.display = 'none';\n }\n });\n if (!this._scrollTimeout) {\n this._scrollTimeout = window.setTimeout(() => {\n this._scrollTimeout = null;\n for (let event of this.scrollEventSet) event();\n }, 10);\n }\n this.oldScrollTop = this.newScrollTop;\n }, false);\n }\n\n onResize() {\n window.addEventListener('resize', () => {\n if (!this._resizeTimeout) {\n this._resizeTimeout = window.setTimeout(() => {\n this._resizeTimeout = null;\n for (let event of this.resizeEventSet) event();\n this.initMenuMobile();\n this.initToc();\n this.initSmoothScroll();\n this.initMermaid()\n }, 100);\n }\n }, false);\n }\n\n init() {\n this.initMenuMobile();\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.initSmoothScroll();\n\n this.onScroll();\n this.onResize();\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 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d32a06c6..d40eaf9f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -54,10 +54,12 @@ {{- partial "footer.html" . -}} - {{- /* Dynamic to top button */ -}} - - - +
+ {{- /* top button */ -}} + + + +
{{- /* Load JavaScript scripts and CSS */ -}} {{- partial "assets.html" . -}} diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index d02aa78c..0c9d64ef 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -5,7 +5,7 @@ {{- /* Disqus Comment System */ -}} {{- if .Site.Params.comment.disqus.enable -}} -
+
{{- $script := printf `` .Site.Params.comment.disqus.shortname -}} {{- slice $script | $scratch.Add "scriptCDN" -}}