diff --git a/settings.yaml b/settings.yaml index 0ea41a87..df91833a 100644 --- a/settings.yaml +++ b/settings.yaml @@ -47,7 +47,6 @@ spec: label: 导航栏右侧 value: travelling: true - travellingUrl: https://travellings.cn/go.html article: true darkMode: true children: @@ -61,12 +60,6 @@ spec: value: true - label: 隐藏 value: false - - $formkit: url - if: $get(travelling).value - name: travellingUrl - label: 开往链接 - placeholder: 请输入开往链接 - help: 开往项目:https://github.com/travellings-link/travellings - $formkit: radio name: article label: 随机文章 diff --git a/templates/assets/js/utils.js b/templates/assets/js/utils.js index a05378c7..89d0ae52 100644 --- a/templates/assets/js/utils.js +++ b/templates/assets/js/utils.js @@ -192,23 +192,22 @@ var btf = { } }, - snackbarShow: (text, showAction, duration) => { - const sa = (typeof showAction !== 'undefined') ? showAction : false - const dur = (typeof duration !== 'undefined') ? duration : 5000 - const position = GLOBAL_CONFIG.Snackbar.position - const bg = document.documentElement.getAttribute('data-theme') === 'light' ? GLOBAL_CONFIG.Snackbar.bgLight : GLOBAL_CONFIG.Snackbar.bgDark - const style = document.createElement('style'); - document.head.appendChild(style); - const styleSheet = style.sheet; - styleSheet.insertRule(`:root{--heo-snackbar-time: ${dur}ms!important}`, styleSheet.cssRules.length); + snackbarShow: (text, showActionFunction = false, duration = 2000, actionText = false) => { + const { position, bgLight, bgDark } = GLOBAL_CONFIG.Snackbar; + const bg = document.documentElement.getAttribute("data-theme") === "light" ? bgLight : bgDark; + const root = document.querySelector(":root"); + root.style.setProperty("--heo-snackbar-time", duration + "ms"); + Snackbar.show({ text: text, backgroundColor: bg, - showAction: sa, - duration: dur, - pos: position - }) - + onActionClick: showActionFunction, + actionText: actionText, + showAction: actionText, + duration: duration, + pos: position, + customClass: "snackbar-css", + }); }, initJustifiedGallery: function (selector) { diff --git a/templates/assets/zhheo/blogex.js b/templates/assets/zhheo/blogex.js index 10ab78af..f61e78c8 100644 --- a/templates/assets/zhheo/blogex.js +++ b/templates/assets/zhheo/blogex.js @@ -435,11 +435,14 @@ function toforeverblog() { } //前往开往项目 -function totraveling() { - btf.snackbarShow('即将跳转到「开往」项目的成员博客,不保证跳转网站的安全性和可用性', false, 5000); - setTimeout(function () { - window.open('https://travellings.link/'); - }, "5000"); +function totraveling () { + btf.snackbarShow("即将跳转到「开往」项目的成员博客,不保证跳转网站的安全性和可用性", function(element) { + element.style.opacity = 0, + travellingsTimer && clearTimeout(travellingsTimer) + }, 5000, "取消"), + travellingsTimer = setTimeout(function() { + window.open("https://www.travellings.cn/go.html", "_blank") + }, "5000") } // 移除加载动画 @@ -651,24 +654,24 @@ function listenToPageInputPress() { function initBlog() { // 图片主色 GLOBAL_CONFIG.source.post.dynamicBackground && coverColor(), - percent(), - heo.topCategoriesBarScroll(), - heo.initIndexEssay(), - setBodyDataType(), - listenToPageInputPress(), - heo.topPostScroll(), - heo.sayhi(), - heo.qrcodeCreate(), - //右下角 snackbar 弹窗 + percent(), + heo.topCategoriesBarScroll(), + heo.initIndexEssay(), + setBodyDataType(), + listenToPageInputPress(), + heo.topPostScroll(), + heo.sayhi(), + heo.qrcodeCreate(), + //右下角 snackbar 弹窗 GLOBAL_CONFIG.source.tool.switch && heo.hidecookie(), - heo.stopImgRightDrag(), - heo.onlyHome(), - heo.addNavBackgroundInit(), - heo.darkModeStatus(), - heo.initThemeColor(), - //隐藏加载动画 + heo.stopImgRightDrag(), + heo.onlyHome(), + heo.addNavBackgroundInit(), + heo.darkModeStatus(), + heo.initThemeColor(), + //隐藏加载动画 GLOBAL_CONFIG.loadingBox && heo.hideLoading(), - checkUrlAndAddHideBanner() + checkUrlAndAddHideBanner() } diff --git a/templates/assets/zhheo/zhheoblog.css b/templates/assets/zhheo/zhheoblog.css index 4bd21052..4c709d32 100644 --- a/templates/assets/zhheo/zhheoblog.css +++ b/templates/assets/zhheo/zhheoblog.css @@ -29,6 +29,7 @@ --style-border-hover: 1px solid var(--heo-main); --style-border-hover-always: 1px solid var(--heo-main); --style-border-dashed: 1px dashed var(--heo-theme-op); + --heo-radius-full: 50px; } ::selection { @@ -2644,6 +2645,115 @@ blockquote footer cite::before { text-shadow: none; } +#page-header.not-top-img #travellings_button::after { + background: var(--heo-main)!important; +} + +#body-wrap .nav-fixed #travellings_button::after { + background: var(--heo-main)!important +} + +#body-wrap #travellings_button { + display: -webkit-box; + display: -moz-box; + display: -webkit-flex; + display: -ms-flexbox; + display: box; + display: flex +} + +#body-wrap #travellings_button:hover::after { + opacity: 1; + -ms-filter: none; + filter: none; + -webkit-transform: none; + -moz-transform: none; + -o-transform: none; + -ms-transform: none; + transform: none; + visibility: visible +} + +#body-wrap #travellings_button:hover a { + background: var(--heo-main); + -webkit-box-shadow: var(--heo-shadow-main); + -webkit-box-shadow: var(--heo-shadow-main); + box-shadow: var(--heo-shadow-main) +} + +#body-wrap #travellings_button:hover a i { + color: var(--heo-white) +} + +#body-wrap #travellings_button::after { + --height: 1.8rem; + content: attr(title); + position: fixed; + display: -webkit-box; + display: -moz-box; + display: -webkit-flex; + display: -ms-flexbox; + display: box; + display: flex; + -webkit-box-pack: center; + -moz-box-pack: center; + -o-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -moz-box-align: center; + -o-box-align: center; + -ms-flex-align: center; + -webkit-align-items: center; + align-items: center; + color: var(--heo-white); + background: var(--heo-white-op)!important; + -webkit-box-shadow: var(--heo-shadow-nav); + box-shadow: var(--heo-shadow-nav); + border-radius: var(--heo-radius-full); + width: fit-content; + height: var(--height); + font-size: var(--global-font-size); + white-space: nowrap; + margin: auto; + padding: 0 4em; + top: calc((60px - var(--height))/ 2); + right: 0; + left: 0; + line-height: 0; + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + z-index: 1; + visibility: hidden; + -webkit-transform: scaleX(1.1); + -moz-transform: scaleX(1.1); + -o-transform: scaleX(1.1); + -ms-transform: scaleX(1.1); + transform: scaleX(1.1); + pointer-events: none; + -webkit-transition: .5s; + -moz-transition: .5s; + -o-transition: .5s; + -ms-transition: .5s; + transition: .5s +} + +@media screen and (max-width: 900px) { + #body-wrap #travellings_button::after { + padding:0 2em; + } +} + +#body-wrap:has(#travellings_button:hover) #nav #menus,#body-wrap:has(#travellings_button:hover) #page-name { + display: none +} + +#body-wrap .page #travellings_button:hover::after { + background: var(--heo-main)!important +} + #page-header.nav-fixed #nav { position: fixed; top: -60px; @@ -5587,6 +5697,9 @@ html { #page-header.not-top-img:not(.nav-fixed) #nav { background: var(--heo-background) !important; } + div#travellings_button { + display: none!important + } } diff --git a/templates/modules/widgets/nav-right.html b/templates/modules/widgets/nav-right.html index 1fde2e9c..24f4386e 100644 --- a/templates/modules/widgets/nav-right.html +++ b/templates/modules/widgets/nav-right.html @@ -7,14 +7,14 @@ -
-