From 31c57ef67c1ade1c0e6b6697125a5071255ace46 Mon Sep 17 00:00:00 2001 From: liuzhihang Date: Sat, 15 Oct 2022 13:21:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E7=A6=BB=E5=85=AC=E5=85=B1=E9=83=A8?= =?UTF-8?q?=E5=88=86=20head=E3=80=81loading-box=E3=80=81right-menu?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=BA=20layout=20=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.yaml | 29 + templates/assets/js/main.js | 328 +++++++++- templates/category.html | 707 +++----------------- templates/index.html | 536 +-------------- templates/modules/head.html | 194 ++++++ templates/modules/layouts/layout.html | 222 ++++++- templates/modules/loading-box.html | 13 + templates/modules/right-menu.html | 66 ++ templates/page.html | 531 +-------------- templates/post.html | 896 ++++++-------------------- templates/tag.html | 687 ++------------------ 11 files changed, 1227 insertions(+), 2982 deletions(-) create mode 100644 templates/modules/head.html create mode 100644 templates/modules/loading-box.html create mode 100644 templates/modules/right-menu.html diff --git a/settings.yaml b/settings.yaml index 882f87a9..49dfa9fa 100644 --- a/settings.yaml +++ b/settings.yaml @@ -136,3 +136,32 @@ spec: label: 底部相关链接 placeholder: 请填写 metadata name help: "需要通过开发者模式获取菜单对应的 metadata name" + - group: loading + label: 加载页 + formSchema: + - $formkit: radio + name: switch + label: 开关 + value: true + options: + - label: 打开 + value: true + - label: 关闭 + value: false + - $formkit: url + name: img + validation: "url" + label: 加载页图片 URL + placeholder: 请输入图片 url + - group: right_menu + label: 右键菜单 + formSchema: + - $formkit: radio + name: switch + label: 开关 + value: true + options: + - label: 打开 + value: true + - label: 关闭 + value: false \ No newline at end of file diff --git a/templates/assets/js/main.js b/templates/assets/js/main.js index 194d2a9d..2271ceb3 100644 --- a/templates/assets/js/main.js +++ b/templates/assets/js/main.js @@ -1 +1,327 @@ -"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);ne.offsetWidth-120;n?e.classList.add("hide-menu"):e.classList.remove("hide-menu")}function E(){var t,e,n,c,r,o,s,l,d,u,i,f,m,a=GLOBAL_CONFIG.highlight;function h(t,e,n){var o,i,a=document.createDocumentFragment();r&&((o=document.createElement("div")).className="highlight-tools ".concat(u),o.innerHTML=l+t+d,o.addEventListener("click",f),a.appendChild(o)),c&&e.offsetHeight>c+30&&((i=document.createElement("div")).className="code-expand-btn",i.innerHTML='',i.addEventListener("click",m),a.appendChild(i)),"hl"===n?e.insertBefore(a,e.firstChild):e.parentNode.insertBefore(a,e)}a&&(t=a.highlightCopy,e=a.highlightLang,n=GLOBAL_CONFIG_SITE.isHighlightShrink,c=a.highlightHeightLimit,r=t||e||void 0!==n,o="highlighjs"===a.plugin?document.querySelectorAll("figure.highlight"):document.querySelectorAll('pre[class*="language-"]'),(r||c)&&o.length&&(s="prismjs"===a.plugin,u=!(d=l="")===n?"closed":"",void 0!==n&&(l='')),t&&(d='
'),i=function(t){var e=t.parentNode;e.classList.add("copy-true");var n=window.getSelection(),o=document.createRange();s?o.selectNodeContents(e.querySelectorAll("pre code")[0]):o.selectNodeContents(e.querySelectorAll("table .code pre")[0]),n.removeAllRanges(),n.addRange(o);var i,a;n.toString();i=t.lastChild,document.queryCommandSupported&&document.queryCommandSupported("copy")?(document.execCommand("copy"),void 0!==GLOBAL_CONFIG.Snackbar?btf.snackbarShow(GLOBAL_CONFIG.copy.success):((a=i.previousElementSibling).innerText=GLOBAL_CONFIG.copy.success,a.style.opacity=1,setTimeout(function(){a.style.opacity=0},700))):void 0!==GLOBAL_CONFIG.Snackbar?btf.snackbarShow(GLOBAL_CONFIG.copy.noSupport):i.previousElementSibling.innerText=GLOBAL_CONFIG.copy.noSupport,n.removeAllRanges(),e.classList.remove("copy-true")},f=function(t){var e,n,o=t.target.classList;o.contains("expand")?(n=_toConsumableArray((e=this).parentNode.children).slice(1),e.firstChild.classList.toggle("closed"),btf.isHidden(n[n.length-1])?n.forEach(function(t){t.style.display="block"}):n.forEach(function(t){t.style.display="none"})):o.contains("copy-button")&&i(this)},m=function(){this.classList.toggle("expand-done")},e?s?o.forEach(function(t){var e=t.getAttribute("data-language")?t.getAttribute("data-language"):"Code",n='
'.concat(e,"
");btf.wrap(t,"figure","","highlight"),h(n,t)}):o.forEach(function(t){var e=t.getAttribute("class").split(" ")[1];"plain"!==e&&void 0!==e||(e="Code"),h('
'.concat(e,"
"),t,"hl")}):s?o.forEach(function(t){btf.wrap(t,"figure","","highlight"),h("",t)}):o.forEach(function(t){h("",t,"hl")})))}var o=document.getElementById("site-name"),i=o&&o.offsetWidth,a=document.querySelector("#menus .menus_items"),c=a&&a.offsetWidth,r=document.querySelector("#search-button"),s=r&&r.offsetWidth;function l(t){function e(t){t.each(function(t,e){var n=$(e),o=n.attr("data-lazy-src")||n.attr("src"),i=o+"_1600w",a=n.attr("alt")||"";-1!=o.indexOf("!blogimg")?n.wrap('')):n.wrap(''))}),$().fancybox({selector:"[data-fancybox]",loop:!0,transitionEffect:"slide",protect:!0,buttons:["slideShow","fullScreen","thumbs","close"],hash:!1})}void 0===$.fancybox?($("head").append('')),$.getScript("".concat(GLOBAL_CONFIG.source.fancybox.js),function(){e($(t))})):e($(t))}function w(){var n="fancybox"===GLOBAL_CONFIG.lightbox?document.querySelectorAll("#article-container :not(a):not(.gallery-group) > img, #article-container > img,.bber-content-img > img"):[],o=0")}),d?btf.initJustifiedGallery(t):($("head").append('')),$.getScript("".concat(GLOBAL_CONFIG.source.justifiedGallery.js),function(){btf.initJustifiedGallery(t)}),d=!0)),o&&l(n)})}function A(){var a,c,r,s,l,d,u=document.getElementById("rightside"),f=window.innerHeight+56;document.body.scrollHeight<=f?u.style.cssText="opacity: 1; transform: translateX(-38px)":(c=!(a=0),r=document.getElementById("page-header"),document.getElementById("guli_top"),s=document.getElementById("cookies-window"),l="function"==typeof chatBtnHide,d="function"==typeof chatBtnShow,window.addEventListener("scroll",btf.throttle(function(t){var e,n,o=window.scrollY||document.documentElement.scrollTop,i=(n=a<(e=o),a=e,n);56btf.getEleTop(t)-80&&(o="#"+encodeURI(t.getAttribute("id")),i=e)}),u!==i){if(l&&(t=o,window.history.replaceState&&t!==window.location.hash&&(t=t||location.pathname,e=GLOBAL_CONFIG_SITE.title,window.history.replaceState({url:location.href,title:e},e,t))),""===o)return r.querySelectorAll(".active").forEach(function(t){t.classList.remove("active")}),void(u=i);u=i,r.querySelectorAll(".active").forEach(function(t){t.classList.remove("active")});var a=s[i];a.classList.add("active"),setTimeout(function(){var t,e;t=a.getBoundingClientRect().top,e=r.scrollTop,t>document.documentElement.clientHeight-100&&(r.scrollTop=e+150),t<100&&(r.scrollTop=e-150)},0);for(var c=a.parentNode;!c.matches(".toc");c=c.parentNode)c.matches("li")&&c.classList.add("active")}}}var d=!1,e=function(){var e=document.body;e.classList.add("read-mode");var n=document.createElement("button");n.type="button",n.className="fas fa-sign-out-alt exit-readmode",e.appendChild(n),n.addEventListener("click",function t(){e.classList.remove("read-mode"),n.remove(),n.removeEventListener("click",t)})},n=function(){"light"==("dark"===document.documentElement.getAttribute("data-theme")?"dark":"light")?(activateDarkMode(),saveToLocal.set("theme","dark",2),void 0!==GLOBAL_CONFIG.Snackbar&&btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night,!1,2e3)):(activateLightMode(),saveToLocal.set("theme","light",2),void 0!==GLOBAL_CONFIG.Snackbar&&btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day,!1,2e3)),"function"==typeof utterancesTheme&&utterancesTheme(),"object"===("undefined"==typeof FB?"undefined":_typeof(FB))&&window.loadFBComment(),window.DISQUS&&document.getElementById("disqus_thread").children.length&&setTimeout(function(){return window.disqusReset()},200)},u=function(){document.getElementById("rightside-config-hide").classList.toggle("show")},f=function(){btf.scrollToDest(0,500)},m=function(){var t=document.documentElement.classList;t.contains("hide-aside")?saveToLocal.set("aside-status","show",2):saveToLocal.set("aside-status","hide",2),t.toggle("hide-aside")},h=function(t){var e=parseInt(window.getComputedStyle(document.documentElement).getPropertyValue("--global-font-size")),n="";if(t){if(20<=e)return;n=e+1,document.documentElement.style.setProperty("--global-font-size",n+"px"),document.getElementById("nav").classList.contains("hide-menu")||L(!0)}else{if(e<=10)return;n=e-1,document.documentElement.style.setProperty("--global-font-size",n+"px"),document.getElementById("nav").classList.contains("hide-menu")&&L(!0)}saveToLocal.set("global-font-size",n,2)};document.getElementById("rightside").addEventListener("click",function(t){switch(t.target.id||t.target.parentNode.id){case"go-up":f();break;case"rightside_config":u();break;case"readmode":e();break;case"darkmode":n();break;case"hide-aside-btn":m();break;case"font-plus":h(!0);break;case"font-minus":h()}});function I(t){t.forEach(function(t){var e=t,n=e.getAttribute("datetime");e.innerText=btf.diffDate(n,!0),e.style.display="inline"})}var g,O=function(){document.querySelectorAll("#article-container .tab > button").forEach(function(t){t.addEventListener("click",function(t){var e,n,o,i,a=this.parentNode;a.classList.contains("active")||(e=a.parentNode.nextElementSibling,(n=btf.siblings(a,".active")[0])&&n.classList.remove("active"),a.classList.add("active"),o=this.getAttribute("data-href").replace("#",""),_toConsumableArray(e.children).forEach(function(t){t.id===o?t.classList.add("active"):t.classList.remove("active")}),0<(i=e.querySelectorAll("#".concat(o," .justified-gallery"))).length&&btf.initJustifiedGallery(i))})})},G=function(){document.querySelectorAll("#article-container .tabs .tab-to-top").forEach(function(t){t.addEventListener("click",function(){btf.scrollToDest(btf.getEleTop(btf.getParents(this,".tabs")),300)})})};window.refreshFn=function(){var t,e,n,o,i,a,c,r,s,l,d,u,f,m,h,g,y,p,b;function v(){f.style.overflow="",f.style.paddingRight="",btf.fadeOut(u,.5),d.classList.remove("open")}L(),document.getElementById("nav").classList.add("show"),GLOBAL_CONFIG_SITE.isPost?(GLOBAL_CONFIG_SITE.isToc&&S(),void 0!==GLOBAL_CONFIG.noticeOutdate&&(r=GLOBAL_CONFIG.noticeOutdate,(s=btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate))>=r.limitDay&&((a=document.createElement("div")).className="post-outdate-notice",a.textContent=r.messagePrev+" "+s+" "+r.messageNext,c=document.getElementById("article-container"),"top"===r.position?c.insertBefore(a,c.firstChild):c.appendChild(a))),GLOBAL_CONFIG.relativeDate.post&&I(document.querySelectorAll("#post-meta time"))):(GLOBAL_CONFIG.relativeDate.homepage&&I(document.querySelectorAll("#recent-posts time")),!GLOBAL_CONFIG.runtime||(i=document.getElementById("runtimeshow"))&&(o=i.getAttribute("data-publishDate"),i.innerText=btf.diffDate(o)+" "+GLOBAL_CONFIG.runtime),(n=document.getElementById("last-push-date"))&&(e=n.getAttribute("data-lastPushDate"),n.innerText=btf.diffDate(e,!0)),(t=document.querySelectorAll("#aside-cat-list .card-category-list-item.parent i")).length&&t.forEach(function(t){t.addEventListener("click",function(t){t.preventDefault();this.classList.toggle("expand");var e=this.parentNode.nextElementSibling;btf.isHidden(e)?e.style.display="block":e.style.display="none"})})),l=document.getElementById("toggle-menu"),d=document.getElementById("sidebar-menus"),u=document.getElementById("menu-mask"),f=document.body,l.addEventListener("click",function(){btf.sidebarPaddingR(),f.style.overflow="hidden",btf.fadeIn(u,.5),d.classList.add("open")}),u.addEventListener("click",function(t){d.classList.contains("open")&&v()}),window.addEventListener("resize",function(t){btf.isHidden(l)&&d.classList.contains("open")&&v()}),!GLOBAL_CONFIG_SITE.isHome||(m=document.getElementById("scroll-down"))&&m.addEventListener("click",function(){btf.scrollToDest(document.getElementById("content-inner").offsetTop,300)}),E(),GLOBAL_CONFIG.isPhotoFigcaption&&document.querySelectorAll("#article-container img").forEach(function(t){var e,n=t.parentNode;n.parentNode.classList.contains("justified-gallery")||((e=document.createElement("div")).className="img-alt is-center",e.textContent=t.getAttribute("alt"),n.insertBefore(e,t.nextSibling))}),w(),"mediumZoom"===GLOBAL_CONFIG.lightbox&&(h=mediumZoom(document.querySelectorAll("#article-container :not(a)>img"))).on("open",function(t){var e="dark"===document.documentElement.getAttribute("data-theme")?"#121212":"#fff";h.update({background:e})}),A(),(g=document.querySelectorAll("#article-container :not(.highlight) > table, #article-container > table")).length&&g.forEach(function(t){btf.wrap(t,"div","","table-wrap")}),(y=document.querySelectorAll("#article-container .hide-button")).length&&y.forEach(function(t){t.addEventListener("click",function(t){var e=this.nextElementSibling;this.classList.toggle("open"),this.classList.contains("open")&&0 .switch-btn"))&&b.addEventListener("click",function(){this.classList.toggle("move"),document.querySelectorAll("#post-comment > .comment-wrap > div").forEach(function(t){btf.isHidden(t)?t.style.cssText="display: block;animation: tabshow .5s":t.style.cssText="display: none;animation: ''"}),p||"function"!=typeof loadOtherComment||(p=!0,loadOtherComment())})},refreshFn(),window.addEventListener("resize",L),window.addEventListener("orientationchange",function(){setTimeout(L(!0),100)}),document.querySelectorAll("#sidebar-menus .expand").forEach(function(t){t.addEventListener("click",function(){this.classList.toggle("hide");var t=this.parentNode.nextElementSibling;btf.isHidden(t)?t.style.display="block":t.style.display="none"})}),window.addEventListener("touchmove",function(t){document.querySelectorAll("#nav .menus_item_child").forEach(function(t){btf.isHidden(t)||(t.style.display="none")})}),GLOBAL_CONFIG.islazyload&&(window.lazyLoadInstance=new LazyLoad({elements_selector:"img",threshold:0,data_src:"lazy-src"})),void 0!==GLOBAL_CONFIG.copyright&&(g=GLOBAL_CONFIG.copyright,document.body.oncopy=function(t){t.preventDefault();var e=window.getSelection(0).toString(),n=e.length>g.limitCount?e+"\n\n\n"+g.languages.author+"\n"+g.languages.link+window.location.href+"\n"+g.languages.source+"\n"+g.languages.info:e;return t.clipboardData?t.clipboardData.setData("text",n):window.clipboardData.setData("text",n)})}); \ No newline at end of file +"use strict"; + +function _typeof(t) { + return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { + return typeof t + } : function (t) { + return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t + })(t) +} + +function _toConsumableArray(t) { + return _arrayWithoutHoles(t) || _iterableToArray(t) || _unsupportedIterableToArray(t) || _nonIterableSpread() +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") +} + +function _unsupportedIterableToArray(t, e) { + if (t) { + if ("string" == typeof t) return _arrayLikeToArray(t, e); + var n = Object.prototype.toString.call(t).slice(8, -1); + return "Object" === n && t.constructor && (n = t.constructor.name), "Map" === n || "Set" === n ? Array.from(t) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? _arrayLikeToArray(t, e) : void 0 + } +} + +function _iterableToArray(t) { + if ("undefined" != typeof Symbol && null != t[Symbol.iterator] || null != t["@@iterator"]) return Array.from(t) +} + +function _arrayWithoutHoles(t) { + if (Array.isArray(t)) return _arrayLikeToArray(t) +} + +function _arrayLikeToArray(t, e) { + (null == e || e > t.length) && (e = t.length); + for (var n = 0, o = new Array(e); n < e; n++) o[n] = t[n]; + return o +} + +document.addEventListener("DOMContentLoaded", function () { + function L(t) { + 0 < arguments.length && void 0 !== t && t && (i = o && o.offsetWidth, c = a && a.offsetWidth, s = r && r.offsetWidth); + var e = document.getElementById("nav"), n = window.innerWidth < 768 || i + c + s > e.offsetWidth - 120; + n ? e.classList.add("hide-menu") : e.classList.remove("hide-menu") + } + + function E() { + var t, e, n, c, r, o, s, l, d, u, i, f, m, a = GLOBAL_CONFIG.highlight; + + function h(t, e, n) { + var o, i, a = document.createDocumentFragment(); + r && ((o = document.createElement("div")).className = "highlight-tools ".concat(u), o.innerHTML = l + t + d, o.addEventListener("click", f), a.appendChild(o)), c && e.offsetHeight > c + 30 && ((i = document.createElement("div")).className = "code-expand-btn", i.innerHTML = '', i.addEventListener("click", m), a.appendChild(i)), "hl" === n ? e.insertBefore(a, e.firstChild) : e.parentNode.insertBefore(a, e) + } + + a && (t = a.highlightCopy, e = a.highlightLang, n = GLOBAL_CONFIG_SITE.isHighlightShrink, c = a.highlightHeightLimit, r = t || e || void 0 !== n, o = "highlighjs" === a.plugin ? document.querySelectorAll("figure.highlight") : document.querySelectorAll('pre[class*="language-"]'), (r || c) && o.length && (s = "prismjs" === a.plugin, u = !(d = l = "") === n ? "closed" : "", void 0 !== n && (l = '')), t && (d = '
'), i = function (t) { + var e = t.parentNode; + e.classList.add("copy-true"); + var n = window.getSelection(), o = document.createRange(); + s ? o.selectNodeContents(e.querySelectorAll("pre code")[0]) : o.selectNodeContents(e.querySelectorAll("table .code pre")[0]), n.removeAllRanges(), n.addRange(o); + var i, a; + n.toString(); + i = t.lastChild, document.queryCommandSupported && document.queryCommandSupported("copy") ? (document.execCommand("copy"), void 0 !== GLOBAL_CONFIG.Snackbar ? btf.snackbarShow(GLOBAL_CONFIG.copy.success) : ((a = i.previousElementSibling).innerText = GLOBAL_CONFIG.copy.success, a.style.opacity = 1, setTimeout(function () { + a.style.opacity = 0 + }, 700))) : void 0 !== GLOBAL_CONFIG.Snackbar ? btf.snackbarShow(GLOBAL_CONFIG.copy.noSupport) : i.previousElementSibling.innerText = GLOBAL_CONFIG.copy.noSupport, n.removeAllRanges(), e.classList.remove("copy-true") + }, f = function (t) { + var e, n, o = t.target.classList; + o.contains("expand") ? (n = _toConsumableArray((e = this).parentNode.children).slice(1), e.firstChild.classList.toggle("closed"), btf.isHidden(n[n.length - 1]) ? n.forEach(function (t) { + t.style.display = "block" + }) : n.forEach(function (t) { + t.style.display = "none" + })) : o.contains("copy-button") && i(this) + }, m = function () { + this.classList.toggle("expand-done") + }, e ? s ? o.forEach(function (t) { + var e = t.getAttribute("data-language") ? t.getAttribute("data-language") : "Code", + n = '
'.concat(e, "
"); + btf.wrap(t, "figure", "", "highlight"), h(n, t) + }) : o.forEach(function (t) { + var e = t.getAttribute("class").split(" ")[1]; + "plain" !== e && void 0 !== e || (e = "Code"), h('
'.concat(e, "
"), t, "hl") + }) : s ? o.forEach(function (t) { + btf.wrap(t, "figure", "", "highlight"), h("", t) + }) : o.forEach(function (t) { + h("", t, "hl") + }))) + } + + var o = document.getElementById("site-name"), i = o && o.offsetWidth, + a = document.querySelector("#menus .menus_items"), c = a && a.offsetWidth, + r = document.querySelector("#search-button"), s = r && r.offsetWidth; + + function l(t) { + function e(t) { + t.each(function (t, e) { + var n = $(e), o = n.attr("data-lazy-src") || n.attr("src"), i = o + "_1600w", a = n.attr("alt") || ""; + -1 != o.indexOf("!blogimg") ? n.wrap('')) : n.wrap('')) + }), $().fancybox({ + selector: "[data-fancybox]", + loop: !0, + transitionEffect: "slide", + protect: !0, + buttons: ["slideShow", "fullScreen", "thumbs", "close"], + hash: !1 + }) + } + + void 0 === $.fancybox ? ($("head").append('')), $.getScript("".concat(GLOBAL_CONFIG.source.fancybox.js), function () { + e($(t)) + })) : e($(t)) + } + + function w() { + var n = "fancybox" === GLOBAL_CONFIG.lightbox ? document.querySelectorAll("#article-container :not(a):not(.gallery-group) > img, #article-container > img,.bber-content-img > img") : [], + o = 0 < n.length, i = document.querySelectorAll("#article-container .justified-gallery"), a = 0 < i.length; + (a || o) && btf.isJqueryLoad(function () { + var t, e; + a && (t = $(i), (e = t.find("img")).unwrap(), e.length && e.each(function (t, e) { + $(e).attr("data-lazy-src") && $(e).attr("src", $(e).attr("data-lazy-src")), $(e).wrap("
") + }), d ? btf.initJustifiedGallery(t) : ($("head").append('')), $.getScript("".concat(GLOBAL_CONFIG.source.justifiedGallery.js), function () { + btf.initJustifiedGallery(t) + }), d = !0)), o && l(n) + }) + } + + function A() { + var a, c, r, s, l, d, u = document.getElementById("rightside"), f = window.innerHeight + 56; + document.body.scrollHeight <= f ? u.style.cssText = "opacity: 1; transform: translateX(-38px)" : (c = !(a = 0), r = document.getElementById("page-header"), document.getElementById("guli_top"), s = document.getElementById("cookies-window"), l = "function" == typeof chatBtnHide, d = "function" == typeof chatBtnShow, window.addEventListener("scroll", btf.throttle(function (t) { + var e, n, o = window.scrollY || document.documentElement.scrollTop, i = (n = a < (e = o), a = e, n); + 56 < o ? (i ? (r.classList.contains("nav-visible") && r.classList.remove("nav-visible"), d && !0 === c && (chatBtnHide(), c = !1)) : (r.classList.contains("nav-visible") || r.classList.add("nav-visible"), l && !1 === c && (chatBtnShow(), c = !0)), r.classList.add("nav-fixed"), s.classList.add("cw-hide"), "0" === window.getComputedStyle(u).getPropertyValue("opacity") && (u.style.cssText = "opacity: 1; transform: translateX(-38px)")) : (0 === o && r.classList.remove("nav-fixed", "nav-visible"), u.style.cssText = "opacity: ''; transform: ''"), document.body.scrollHeight <= f && (u.style.cssText = "opacity: 1; transform: translateX(-38px)") + }, 200))) + } + + function S() { + var t = document.getElementById("card-toc"), r = t.getElementsByClassName("toc-content")[0], + s = r.querySelectorAll(".toc-link"), c = document.getElementById("article-container"); + window.tocScrollFn = function () { + return btf.throttle(function () { + var t = window.scrollY || document.documentElement.scrollTop; + e(t), i(t) + }, 100)() + }, window.addEventListener("scroll", tocScrollFn); + var e = function (t) { + var e = c.clientHeight, n = document.documentElement.clientHeight, + o = (t - c.offsetTop) / (n < e ? e - n : document.documentElement.scrollHeight - n), + i = Math.round(100 * o), a = 100 < i ? 100 : i <= 0 ? 0 : i; + r.setAttribute("progress-percentage", a) + }, l = GLOBAL_CONFIG.isanchor, n = function () { + t.style.cssText = "animation: toc-open .3s; opacity: 1; right: 45px" + }, o = function () { + t.style.animation = "toc-close .2s", setTimeout(function () { + t.style.cssText = "opacity:''; animation: ''; right: ''" + }, 100) + }; + document.getElementById("mobile-toc-button").addEventListener("click", function () { + ("0" === window.getComputedStyle(t).getPropertyValue("opacity") ? n : o)() + }), r.addEventListener("click", function (t) { + t.preventDefault(); + var e = t.target.classList.contains("toc-link") ? t.target : t.target.parentElement; + btf.scrollToDest(btf.getEleTop(document.getElementById(decodeURI(e.getAttribute("href")).replace("#", ""))), 300), window.innerWidth < 900 && o() + }); + var d = c.querySelectorAll("h1,h2,h3,h4,h5,h6"), u = "", i = function (n) { + if (0 === s.length || 0 === n) return !1; + var t, e, o = "", i = ""; + if (d.forEach(function (t, e) { + n > btf.getEleTop(t) - 80 && (o = "#" + encodeURI(t.getAttribute("id")), i = e) + }), u !== i) { + if (l && (t = o, window.history.replaceState && t !== window.location.hash && (t = t || location.pathname, e = GLOBAL_CONFIG_SITE.title, window.history.replaceState({ + url: location.href, + title: e + }, e, t))), "" === o) return r.querySelectorAll(".active").forEach(function (t) { + t.classList.remove("active") + }), void (u = i); + u = i, r.querySelectorAll(".active").forEach(function (t) { + t.classList.remove("active") + }); + var a = s[i]; + a.classList.add("active"), setTimeout(function () { + var t, e; + t = a.getBoundingClientRect().top, e = r.scrollTop, t > document.documentElement.clientHeight - 100 && (r.scrollTop = e + 150), t < 100 && (r.scrollTop = e - 150) + }, 0); + for (var c = a.parentNode; !c.matches(".toc"); c = c.parentNode) c.matches("li") && c.classList.add("active") + } + } + } + + var d = !1, e = function () { + var e = document.body; + e.classList.add("read-mode"); + var n = document.createElement("button"); + n.type = "button", n.className = "fas fa-sign-out-alt exit-readmode", e.appendChild(n), n.addEventListener("click", function t() { + e.classList.remove("read-mode"), n.remove(), n.removeEventListener("click", t) + }) + }, n = function () { + "light" == ("dark" === document.documentElement.getAttribute("data-theme") ? "dark" : "light") ? (activateDarkMode(), saveToLocal.set("theme", "dark", 2), void 0 !== GLOBAL_CONFIG.Snackbar && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night, !1, 2e3)) : (activateLightMode(), saveToLocal.set("theme", "light", 2), void 0 !== GLOBAL_CONFIG.Snackbar && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day, !1, 2e3)), "function" == typeof utterancesTheme && utterancesTheme(), "object" === ("undefined" == typeof FB ? "undefined" : _typeof(FB)) && window.loadFBComment(), window.DISQUS && document.getElementById("disqus_thread").children.length && setTimeout(function () { + return window.disqusReset() + }, 200) + }, u = function () { + document.getElementById("rightside-config-hide").classList.toggle("show") + }, f = function () { + btf.scrollToDest(0, 500) + }, m = function () { + var t = document.documentElement.classList; + t.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 2) : saveToLocal.set("aside-status", "hide", 2), t.toggle("hide-aside") + }, h = function (t) { + var e = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue("--global-font-size")), + n = ""; + if (t) { + if (20 <= e) return; + n = e + 1, document.documentElement.style.setProperty("--global-font-size", n + "px"), document.getElementById("nav").classList.contains("hide-menu") || L(!0) + } else { + if (e <= 10) return; + n = e - 1, document.documentElement.style.setProperty("--global-font-size", n + "px"), document.getElementById("nav").classList.contains("hide-menu") && L(!0) + } + saveToLocal.set("global-font-size", n, 2) + }; + document.getElementById("rightside").addEventListener("click", function (t) { + switch (t.target.id || t.target.parentNode.id) { + case"go-up": + f(); + break; + case"rightside_config": + u(); + break; + case"readmode": + e(); + break; + case"darkmode": + n(); + break; + case"hide-aside-btn": + m(); + break; + case"font-plus": + h(!0); + break; + case"font-minus": + h() + } + }); + + function I(t) { + t.forEach(function (t) { + var e = t, n = e.getAttribute("datetime"); + e.innerText = btf.diffDate(n, !0), e.style.display = "inline" + }) + } + + var g, O = function () { + document.querySelectorAll("#article-container .tab > button").forEach(function (t) { + t.addEventListener("click", function (t) { + var e, n, o, i, a = this.parentNode; + a.classList.contains("active") || (e = a.parentNode.nextElementSibling, (n = btf.siblings(a, ".active")[0]) && n.classList.remove("active"), a.classList.add("active"), o = this.getAttribute("data-href").replace("#", ""), _toConsumableArray(e.children).forEach(function (t) { + t.id === o ? t.classList.add("active") : t.classList.remove("active") + }), 0 < (i = e.querySelectorAll("#".concat(o, " .justified-gallery"))).length && btf.initJustifiedGallery(i)) + }) + }) + }, G = function () { + document.querySelectorAll("#article-container .tabs .tab-to-top").forEach(function (t) { + t.addEventListener("click", function () { + btf.scrollToDest(btf.getEleTop(btf.getParents(this, ".tabs")), 300) + }) + }) + }; + window.refreshFn = function () { + var t, e, n, o, i, a, c, r, s, l, d, u, f, m, h, g, y, p, b; + + function v() { + f.style.overflow = "", f.style.paddingRight = "", btf.fadeOut(u, .5), d.classList.remove("open") + } + + L(), document.getElementById("nav").classList.add("show"), GLOBAL_CONFIG_SITE.isPost ? (GLOBAL_CONFIG_SITE.isToc && S(), void 0 !== GLOBAL_CONFIG.noticeOutdate && (r = GLOBAL_CONFIG.noticeOutdate, (s = btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate)) >= r.limitDay && ((a = document.createElement("div")).className = "post-outdate-notice", a.textContent = r.messagePrev + " " + s + " " + r.messageNext, c = document.getElementById("article-container"), "top" === r.position ? c.insertBefore(a, c.firstChild) : c.appendChild(a))), GLOBAL_CONFIG.relativeDate.post && I(document.querySelectorAll("#post-meta time"))) : (GLOBAL_CONFIG.relativeDate.homepage && I(document.querySelectorAll("#recent-posts time")), !GLOBAL_CONFIG.runtime || (i = document.getElementById("runtimeshow")) && (o = i.getAttribute("data-publishDate"), i.innerText = btf.diffDate(o) + " " + GLOBAL_CONFIG.runtime), (n = document.getElementById("last-push-date")) && (e = n.getAttribute("data-lastPushDate"), n.innerText = btf.diffDate(e, !0)), (t = document.querySelectorAll("#aside-cat-list .card-category-list-item.parent i")).length && t.forEach(function (t) { + t.addEventListener("click", function (t) { + t.preventDefault(); + this.classList.toggle("expand"); + var e = this.parentNode.nextElementSibling; + btf.isHidden(e) ? e.style.display = "block" : e.style.display = "none" + }) + })), l = document.getElementById("toggle-menu"), d = document.getElementById("sidebar-menus"), u = document.getElementById("menu-mask"), f = document.body, l.addEventListener("click", function () { + btf.sidebarPaddingR(), f.style.overflow = "hidden", btf.fadeIn(u, .5), d.classList.add("open") + }), u.addEventListener("click", function (t) { + d.classList.contains("open") && v() + }), window.addEventListener("resize", function (t) { + btf.isHidden(l) && d.classList.contains("open") && v() + }), !GLOBAL_CONFIG_SITE.isHome || (m = document.getElementById("scroll-down")) && m.addEventListener("click", function () { + btf.scrollToDest(document.getElementById("content-inner").offsetTop, 300) + }), E(), GLOBAL_CONFIG.isPhotoFigcaption && document.querySelectorAll("#article-container img").forEach(function (t) { + var e, n = t.parentNode; + n.parentNode.classList.contains("justified-gallery") || ((e = document.createElement("div")).className = "img-alt is-center", e.textContent = t.getAttribute("alt"), n.insertBefore(e, t.nextSibling)) + }), w(), "mediumZoom" === GLOBAL_CONFIG.lightbox && (h = mediumZoom(document.querySelectorAll("#article-container :not(a)>img"))).on("open", function (t) { + var e = "dark" === document.documentElement.getAttribute("data-theme") ? "#121212" : "#fff"; + h.update({background: e}) + }), A(), (g = document.querySelectorAll("#article-container :not(.highlight) > table, #article-container > table")).length && g.forEach(function (t) { + btf.wrap(t, "div", "", "table-wrap") + }), (y = document.querySelectorAll("#article-container .hide-button")).length && y.forEach(function (t) { + t.addEventListener("click", function (t) { + var e = this.nextElementSibling; + this.classList.toggle("open"), this.classList.contains("open") && 0 < e.querySelectorAll(".justified-gallery").length && btf.initJustifiedGallery(e.querySelectorAll(".justified-gallery")) + }) + }), O(), G(), p = !1, (b = document.querySelector("#comment-switch > .switch-btn")) && b.addEventListener("click", function () { + this.classList.toggle("move"), document.querySelectorAll("#post-comment > .comment-wrap > div").forEach(function (t) { + btf.isHidden(t) ? t.style.cssText = "display: block;animation: tabshow .5s" : t.style.cssText = "display: none;animation: ''" + }), p || "function" != typeof loadOtherComment || (p = !0, loadOtherComment()) + }) + }, refreshFn(), window.addEventListener("resize", L), window.addEventListener("orientationchange", function () { + setTimeout(L(!0), 100) + }), document.querySelectorAll("#sidebar-menus .expand").forEach(function (t) { + t.addEventListener("click", function () { + this.classList.toggle("hide"); + var t = this.parentNode.nextElementSibling; + btf.isHidden(t) ? t.style.display = "block" : t.style.display = "none" + }) + }), window.addEventListener("touchmove", function (t) { + document.querySelectorAll("#nav .menus_item_child").forEach(function (t) { + btf.isHidden(t) || (t.style.display = "none") + }) + }), GLOBAL_CONFIG.islazyload && (window.lazyLoadInstance = new LazyLoad({ + elements_selector: "img", + threshold: 0, + data_src: "lazy-src" + })), void 0 !== GLOBAL_CONFIG.copyright && (g = GLOBAL_CONFIG.copyright, document.body.oncopy = function (t) { + t.preventDefault(); + var e = window.getSelection(0).toString(), + n = e.length > g.limitCount ? e + "\n\n\n" + g.languages.author + "\n" + g.languages.link + window.location.href + "\n" + g.languages.source + "\n" + g.languages.info : e; + return t.clipboardData ? t.clipboardData.setData("text", n) : window.clipboardData.setData("text", n) + }) +}); \ No newline at end of file diff --git a/templates/category.html b/templates/category.html index 5c3f6974..ecbf321d 100644 --- a/templates/category.html +++ b/templates/category.html @@ -1,649 +1,96 @@ - - - - - - - - - - - + - - - - - - - - - - - - - - -
-
-
-
- - -
- - -
- -
-
-
-
分类
-
-
-
- 首页
-
- -
- -
- - 更多
-
-
-
- -
等待halo提供数据
-
- - - -
-
- -
- -
- - + + 更多
+
+
+
+ +
等待halo提供数据
+
+ + + +
+
+ +
+ +
+ + +
+ +
- - -
-
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ + +
+ +
-
-
- +
-
- - -
- - - - - -
- -
-
- - - + +
-
- - -
-
-
-
-
- - - - -
-
- - - 引用到评论 - - - - - - - - - - - -
- - -
- - - - -
-
-
-
-
- - - - - - - - -
- - - - - - - - - - - - - -
-
- -
- \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index d04fc897..989c5239 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,521 +1,35 @@ - - - - - - - - - + - - - + - - - - - - - - - - - - - - - - - -
-
-
-
- - -
- -
- - - -
- -
- -
-
-
-
- - -
- - +
+ + +
+ +
+ +
-
-
- -
-
+
+
- -
-
- - - + +
+ + + +
+
+
+ +
-
- - -
- -
-
-
- - - - -
-
- - - 引用到评论 - - - - - - - - - - - -
- - -
- - - - -
-
-
-
-
- - - - - - - - - -
- - - - - - - - - - - -
-
- -
- +
diff --git a/templates/modules/head.html b/templates/modules/head.html new file mode 100644 index 00000000..9261d85e --- /dev/null +++ b/templates/modules/head.html @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/modules/layouts/layout.html b/templates/modules/layouts/layout.html index d578010f..ae2042e7 100644 --- a/templates/modules/layouts/layout.html +++ b/templates/modules/layouts/layout.html @@ -1,6 +1,224 @@ - - + + + + + + + +
+ + +
+ + +
+ + + + +
+
+ + + +
+
+ + +
+
+ +
+ +
+ + + + + + + + + +
+ + + + + + + + + + + +
+
+ +
+ diff --git a/templates/modules/loading-box.html b/templates/modules/loading-box.html new file mode 100644 index 00000000..28b3b210 --- /dev/null +++ b/templates/modules/loading-box.html @@ -0,0 +1,13 @@ + + + + +
+
+ +
+
+ + \ No newline at end of file diff --git a/templates/modules/right-menu.html b/templates/modules/right-menu.html new file mode 100644 index 00000000..6be03df8 --- /dev/null +++ b/templates/modules/right-menu.html @@ -0,0 +1,66 @@ + + + +
+
+
+ + + + +
+
+ + + 引用到评论 + + + + + + + + + + + +
+ + +
+ + + + +
+
+
+
+ \ No newline at end of file diff --git a/templates/page.html b/templates/page.html index a14b8055..afad2a87 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,523 +1,24 @@ - - - - - - - - - + - - - + - - - - - - - - - - - - - - - -
-
-
-
- -
- -
- -
-
-
-
-
- -
-
-
-
- - + + +
+
+
+
+
+ +
-
- - -
-
- -
-
-
- - - - -
-
- - - 引用到评论 - - - - - - - - - - - -
- - -
- - - - -
-
-
-
-
- - - - - - - - - -
- - - - - - - - - - - - - - - -
-
- -
- - \ No newline at end of file diff --git a/templates/post.html b/templates/post.html index d4727257..0b2fad46 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,215 +1,20 @@ - - - - - - - - - - - - + - - - + +
+
+ +
+ cover +
- - - - - - - - - - - - - - - -
-
-
-
- - -
-
-
- -
- cover -
- -
-
-
- - -
-
-
- -
+
+
+
+ +
-
-
+
+
- - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - -
- -
+ -
+
+ + +
+ +
+ +
+ + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+
+
+ + + +
- -
-
- - -
-
- - - - -
-
-
-
-
- - - - -
-
- - - 引用到评论 - - - - - - - - - - - -
- - -
- - - - -
-
-
-
-
- - - - - - - - - -
- -
- - - - - - - - - - - - - -
-
- -
- - - - \ No newline at end of file diff --git a/templates/tag.html b/templates/tag.html index 3a89bace..94b1c49b 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -1,644 +1,85 @@ - - - - - - - - - - - + - - - - - - - - - - - - - - -
-
-
-
- - -
- - -
- -
-
- -
-
- -
- - +
+ +
+
+ -
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ + +
+ +
-
-
- +
-
- - -
-
-
-
- - -
-
-
-
- - - + +
-
- - -
-
-
-
-
- - - - -
-
- - - 引用到评论 - - - - - - - - - - - -
- - -
- - - - -
-
-
-
-
- - - - - - - - -
- - - - - - - - - - - - - - - -
-
- -
- \ No newline at end of file