From 6889048f35f9ee3fbc2b6317100b4e121f8b3fef Mon Sep 17 00:00:00 2001 From: liuzhihang Date: Sat, 15 Oct 2022 19:00:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=20css=20=E5=92=8C=20js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/assets/js/main.js | 80 +++---- templates/assets/zhheo/zhheoblog.css | 306 +++++++++++++------------- templates/modules/layouts/layout.html | 3 - 3 files changed, 193 insertions(+), 196 deletions(-) diff --git a/templates/assets/js/main.js b/templates/assets/js/main.js index 2271ceb3..443d0b6a 100644 --- a/templates/assets/js/main.js +++ b/templates/assets/js/main.js @@ -45,46 +45,46 @@ document.addEventListener("DOMContentLoaded", function () { 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") - }))) - } + // 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) + // } + // // todo 这块是不是要移除掉 + // 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, diff --git a/templates/assets/zhheo/zhheoblog.css b/templates/assets/zhheo/zhheoblog.css index a10917d2..7c7b8dad 100644 --- a/templates/assets/zhheo/zhheoblog.css +++ b/templates/assets/zhheo/zhheoblog.css @@ -902,20 +902,20 @@ figure.highlight pre .javascript .function, figure.highlight pre .tag .attr { text-align: right } -#article-container figure.highlight .code pre { - padding-right: .5rem; - padding-left: .5rem; - width: 100% -} +/*#article-container figure.highlight .code pre {*/ +/* padding-right: .5rem;*/ +/* padding-left: .5rem;*/ +/* width: 100%*/ +/*}*/ -#article-container figure.highlight, #article-container pre { - overflow: auto; - margin: 0 0 1rem; - padding: 0; - background: var(--hl-bg); - color: var(--hl-color); - line-height: 1.6 -} +/*#article-container figure.highlight, #article-container pre {*/ +/* overflow: auto;*/ +/* margin: 0 0 1rem;*/ +/* padding: 0;*/ +/* background: var(--hl-bg);*/ +/* color: var(--hl-color);*/ +/* line-height: 1.6*/ +/*}*/ blockquote { margin: 0 0 1rem; @@ -943,113 +943,113 @@ blockquote footer cite::before { content: "—" } -#article-container code, #article-container pre { - font-size: var(--global-font-size); - font-family: consolas, Menlo, "PingFang SC", "Microsoft YaHei", sans-serif !important -} +/*#article-container code, #article-container pre {*/ +/* font-size: var(--global-font-size);*/ +/* font-family: consolas, Menlo, "PingFang SC", "Microsoft YaHei", sans-serif !important*/ +/*}*/ -#article-container code { - padding: .1rem .2rem; - background: rgba(27, 31, 35, .05); - color: #f47466 -} +/*#article-container code {*/ +/* padding: .1rem .2rem;*/ +/* background: rgba(27, 31, 35, .05);*/ +/* color: #f47466*/ +/*}*/ -#article-container pre { - padding: 10px 20px -} +/*#article-container pre {*/ +/* padding: 10px 20px*/ +/*!*}*!*/ -#article-container pre code { - padding: 0; - background: 0 0; - color: var(--hl-color); - text-shadow: none -} +/*!*#article-container pre code {*!*/ +/*!* padding: 0;*!*/ +/*!* background: 0 0;*!*/ +/*!* color: var(--hl-color);*!*/ +/*!* text-shadow: none*!*/ +/*!*}*!*/ -#article-container figure.highlight { - position: relative -} +/*#article-container figure.highlight {*/ +/* position: relative*/ +/*}*/ -#article-container figure.highlight pre { - margin: 0; - padding: 8px 0; - border: none -} +/*#article-container figure.highlight pre {*/ +/* margin: 0;*/ +/* padding: 8px 0;*/ +/* border: none*/ +/*}*/ -#article-container figure.highlight .caption, #article-container figure.highlight figcaption { - padding: .3rem 0 .1rem .7rem; - font-size: var(--global-font-size); - line-height: 1em -} +/*#article-container figure.highlight .caption, #article-container figure.highlight figcaption {*/ +/* padding: .3rem 0 .1rem .7rem;*/ +/* font-size: var(--global-font-size);*/ +/* line-height: 1em*/ +/*}*/ -#article-container figure.highlight .caption a, #article-container figure.highlight figcaption a { - float: right; - padding-right: 10px; - color: var(--hl-color) -} +/*#article-container figure.highlight .caption a, #article-container figure.highlight figcaption a {*/ +/* float: right;*/ +/* padding-right: 10px;*/ +/* color: var(--hl-color)*/ +/*}*/ -#article-container figure.highlight .caption a:hover, #article-container figure.highlight figcaption a:hover { - border-bottom-color: var(--hl-color) -} +/*#article-container figure.highlight .caption a:hover, #article-container figure.highlight figcaption a:hover {*/ +/* border-bottom-color: var(--hl-color)*/ +/*}*/ -#article-container .highlight-tools { - position: relative; - display: flex; - -webkit-box-align: center; - align-items: center; - overflow: hidden; - min-height: 1.2rem; - height: 2.15em; - background: var(--hltools-bg); - color: var(--hltools-color); - font-size: var(--global-font-size) -} +/*#article-container .highlight-tools {*/ +/* position: relative;*/ +/* display: flex;*/ +/* -webkit-box-align: center;*/ +/* align-items: center;*/ +/* overflow: hidden;*/ +/* min-height: 1.2rem;*/ +/* height: 2.15em;*/ +/* background: var(--hltools-bg);*/ +/* color: var(--hltools-color);*/ +/* font-size: var(--global-font-size)*/ +/*}*/ -#article-container .highlight-tools.closed + table { - display: none -} +/*#article-container .highlight-tools.closed + table {*/ +/* display: none*/ +/*}*/ -#article-container .highlight-tools .expand { - position: absolute; - padding: .4rem .7rem; - cursor: pointer; - transition: transform .3s ease 0s -} +/*#article-container .highlight-tools .expand {*/ +/* position: absolute;*/ +/* padding: .4rem .7rem;*/ +/* cursor: pointer;*/ +/* transition: transform .3s ease 0s*/ +/*}*/ -#article-container .highlight-tools .expand + .code-lang { - left: 1.7rem -} +/*#article-container .highlight-tools .expand + .code-lang {*/ +/* left: 1.7rem*/ +/*}*/ -#article-container .highlight-tools .expand.closed { - transition: all .3s ease 0s; - transform: rotate(-90deg) !important -} +/*#article-container .highlight-tools .expand.closed {*/ +/* transition: all .3s ease 0s;*/ +/* transform: rotate(-90deg) !important*/ +/*}*/ -#article-container .highlight-tools .code-lang { - position: absolute; - left: .7rem; - text-transform: uppercase; - font-weight: 700; - font-size: 1.15em; - user-select: none -} +/*#article-container .highlight-tools .code-lang {*/ +/* position: absolute;*/ +/* left: .7rem;*/ +/* text-transform: uppercase;*/ +/* font-weight: 700;*/ +/* font-size: 1.15em;*/ +/* user-select: none*/ +/*}*/ -#article-container .highlight-tools .copy-notice { - position: absolute; - right: 1.7rem; - opacity: 0; - transition: opacity .4s ease 0s -} +/*#article-container .highlight-tools .copy-notice {*/ +/* position: absolute;*/ +/* right: 1.7rem;*/ +/* opacity: 0;*/ +/* transition: opacity .4s ease 0s*/ +/*}*/ -#article-container .highlight-tools .copy-button { - position: absolute; - right: .7rem; - cursor: pointer; - transition: color .2s ease 0s -} +/*#article-container .highlight-tools .copy-button {*/ +/* position: absolute;*/ +/* right: .7rem;*/ +/* cursor: pointer;*/ +/* transition: color .2s ease 0s*/ +/*}*/ -#article-container .highlight-tools .copy-button:hover { - color: #307af6 -} +/*#article-container .highlight-tools .copy-button:hover {*/ +/* color: #307af6*/ +/*}*/ #article-container .gutter { user-select: none @@ -4826,17 +4826,17 @@ blockquote.pullquote.right { content: "" } -[data-theme=dark] #article-container code { - background: #2c2c2c -} +/*[data-theme=dark] #article-container code {*/ +/* background: #2c2c2c*/ +/*}*/ -[data-theme=dark] #article-container pre > code { - background: #171717 -} +/*[data-theme=dark] #article-container pre > code {*/ +/* background: #171717*/ +/*}*/ -[data-theme=dark] #article-container figure.highlight { - box-shadow: none -} +/*[data-theme=dark] #article-container figure.highlight {*/ +/* box-shadow: none*/ +/*}*/ [data-theme=dark] #article-container .note code { background: rgba(27, 31, 35, .05) @@ -10354,19 +10354,19 @@ details[open] summary { letter-spacing: .6px } -#article-container code { - color: var(--heo-pink); - padding: .2rem .4rem; - border-radius: 4px; - margin: 0 4px; - background: var(--heo-secondbg) !important; - line-height: 2; - box-shadow: var(--heo-shadow-border) -} +/*#article-container code {*/ +/* color: var(--heo-pink);*/ +/* padding: .2rem .4rem;*/ +/* border-radius: 4px;*/ +/* margin: 0 4px;*/ +/* background: var(--heo-secondbg) !important;*/ +/* line-height: 2;*/ +/* box-shadow: var(--heo-shadow-border)*/ +/*}*/ -#article-container code::selection { - background: var(--heo-main) !important -} +/*#article-container code::selection {*/ +/* background: var(--heo-main) !important*/ +/*}*/ .table-wrap { margin: 1rem 0; @@ -12280,41 +12280,41 @@ button.el-button.tk-cancel.el-button--default.el-button--small { } } -#article-container figure.highlight { - border-radius: 8px 8px 4px 4px -} +/*#article-container figure.highlight {*/ +/* border-radius: 8px 8px 4px 4px*/ +/*}*/ -#article-container figure.highlight, #article-container pre { - color: #f8f8f2; - background: #696969 -} +/*#article-container figure.highlight, #article-container pre {*/ +/* color: #f8f8f2;*/ +/* background: #696969*/ +/*}*/ -#article-container figure.highlight .highlight-tools { - background: #3f3f3f; - color: var(--heo-fontcolor) -} +/*#article-container figure.highlight .highlight-tools {*/ +/* background: #3f3f3f;*/ +/* color: var(--heo-fontcolor)*/ +/*}*/ -#article-container figure.highlight .gutter pre { - color: #d3d3d3 !important; - background: grey; - border-right: var(--style-border-always) -} +/*#article-container figure.highlight .gutter pre {*/ +/* color: #d3d3d3 !important;*/ +/* background: grey;*/ +/* border-right: var(--style-border-always)*/ +/*}*/ -#article-container figure.highlight figcaption a { - color: #a9a9a9 !important -} +/*#article-container figure.highlight figcaption a {*/ +/* color: #a9a9a9 !important*/ +/*}*/ -#article-container .highlight:not(.js-file-line-container), #article-container pre { - background-color: var(--heo-card-bg) !important; - color: var(--heo-fontcolor); - box-shadow: var(--heo-shadow-border); - border: var(--style-border-always) -} +/*#article-container .highlight:not(.js-file-line-container), #article-container pre {*/ +/* background-color: var(--heo-card-bg) !important;*/ +/* color: var(--heo-fontcolor);*/ +/* box-shadow: var(--heo-shadow-border);*/ +/* border: var(--style-border-always)*/ +/*}*/ -#article-container figure.highlight pre span::selection { - background: var(--heo-main) !important; - color: var(--heo-white) !important -} +/*#article-container figure.highlight pre span::selection {*/ +/* background: var(--heo-main) !important;*/ +/* color: var(--heo-white) !important*/ +/*}*/ .OwO .OwO-body { border: var(--style-border-always) !important; diff --git a/templates/modules/layouts/layout.html b/templates/modules/layouts/layout.html index 0c2c188f..e89041ef 100644 --- a/templates/modules/layouts/layout.html +++ b/templates/modules/layouts/layout.html @@ -222,9 +222,6 @@ typeof chatBtnFn === 'function' && chatBtnFn() typeof panguInit === 'function' && panguInit() - // prismjs - typeof Prism === 'object' && Prism.highlightAll() - typeof preloader === 'object' && preloader.endLoading() })