diff --git a/settings.yaml b/settings.yaml index 38a8331a..c4463823 100644 --- a/settings.yaml +++ b/settings.yaml @@ -1079,36 +1079,43 @@ spec: name: footerContent label: 页脚内容 value: - footerStyle: default + style_one: + owner_enable: false + runtime_enable: true + work_img: "https://0206.ink/upload/%E5%9B%B0%E5%9B%B0%E9%B1%BC-%E4%B8%8B%E7%8F%AD%E5%95%A6-yellowgreen.svg" + work_description: "距离月入25k也就还差一个大佬带我~" + offduty_img: "https://0206.ink/upload/%E5%9B%B0%E5%9B%B0%E9%B1%BC-%E4%B8%8B%E7%8F%AD%E5%95%A6-yellowgreen.svg" + offduty_description: "下班了就该开开心心的玩耍,嘿嘿~" + bdageitem: + - link: "https://halo.run/" + shields: "https://npm.elemecdn.com/hao-theme-static@1.2.0/templates/images/Frame-Halo-blue.svg" + message: "博客框架为halo2.x" + default_enable: true children: - - $formkit: select - name: footerStyle - id: footeStyle - key: footeStyle - label: 样式 - value: default + - $formkit: radio + name: default_enable + label: 底部 options: - - value: default - label: 默认 - - value: one - label: 样式一 + - label: 显示 + value: true + - label: 隐藏 + value: false - $formkit: group - if: $get(footeStyle).value == 'one' name: style_one - label: 样式一 + label: 中间 value: - runtime_enable: - work_img: - work_description: - offduty_img: - offduty_description: - bdageitem: children: + - $formkit: radio + name: owner_enable + label: 网站所有者 + options: + - label: 显示 + value: true + - label: 隐藏 + value: false - $formkit: radio name: runtime_enable id: runtime_enable - key: runtime_enable - value: true label: 运行时间 options: - label: 显示 @@ -1120,32 +1127,25 @@ spec: name: work_img label: 上班时间的徽标 placeholder: 请输入内容 - value: "https://0206.ink/upload/%E5%9B%B0%E5%9B%B0%E9%B1%BC-%E4%B8%8B%E7%8F%AD%E5%95%A6-yellowgreen.svg" - $formkit: text if: $get(runtime_enable).value name: work_description label: 上班时间的 title 描述 placeholder: 请输入内容 - value: "距离月入25k也就还差一个大佬带我~" - $formkit: attachment if: $get(runtime_enable).value name: offduty_img label: 下班时间的徽标 placeholder: 请输入内容 - value: "https://0206.ink/upload/%E5%9B%B0%E5%9B%B0%E9%B1%BC-%E4%B8%8B%E7%8F%AD%E5%95%A6-yellowgreen.svg" - $formkit: text if: $get(runtime_enable).value name: offduty_description label: 下班时间的 title 描述 placeholder: 请输入内容 - value: "下班了就该开开心心的玩耍,嘿嘿~" - $formkit: repeater name: bdageitem label: 徽标配置项 value: - - link: "https://halo.run/" - shields: "https://npm.elemecdn.com/hao-theme-static@1.2.0/templates/images/Frame-Halo-blue.svg" - message: "博客框架为halo2.x" children: - $formkit: url name: link diff --git a/templates/assets/js/heo.js b/templates/assets/js/heo.js index 47711224..813fd679 100644 --- a/templates/assets/js/heo.js +++ b/templates/assets/js/heo.js @@ -67,19 +67,23 @@ var heo = { // 页脚友链 addFriendLinksInFooter: function () { + const fetchUrl = "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc" const linksUrl = GLOBAL_CONFIG.source.links.linksUrl - const links = GLOBAL_CONFIG.source.links.linksData const num = GLOBAL_CONFIG.source.links.linksNum - var randomFriendLinks = getArrayItems(links, num); - var htmlText = ''; - for (let i = 0; i < randomFriendLinks.length; ++i) { - var item = randomFriendLinks[i] - htmlText += `${item.spec.displayName}`; - } - htmlText += `更多` - if(document.getElementById("friend-links-in-footer")){ - document.getElementById("friend-links-in-footer").innerHTML = htmlText; - } + fetch(fetchUrl) + .then(res => res.json()) + .then(json => { + var randomFriendLinks = getArrayItems(json.items, num); + var htmlText = ''; + for (let i = 0; i < randomFriendLinks.length; ++i) { + var item = randomFriendLinks[i] + htmlText += `${item.spec.displayName}`; + } + htmlText += `更多` + if(document.getElementById("friend-links-in-footer")){ + document.getElementById("friend-links-in-footer").innerHTML = htmlText; + } + }) }, //禁止图片右键单击 diff --git a/templates/assets/zhheo/blogex.js b/templates/assets/zhheo/blogex.js index 84b67314..78aea839 100644 --- a/templates/assets/zhheo/blogex.js +++ b/templates/assets/zhheo/blogex.js @@ -390,32 +390,38 @@ document.addEventListener('scroll', btf.throttle(function () { heo.initThemeColor() }, 200)) +//友链随机传送 //友链随机传送 function travelling() { - const links = GLOBAL_CONFIG.source.links.linksData - var name = '' - var link = '' - if(links.length>0){ - var randomFriendLinks = getArrayItems(links, 1); - name = randomFriendLinks[0].spec.displayName; - link = randomFriendLinks[0].spec.url; - } - var msg = "点击前往按钮进入随机一个友链,不保证跳转网站的安全性和可用性。本次随机到的是本站友链:「" + name + "」"; - const style = document.createElement('style'); - document.head.appendChild(style); - const styleSheet = style.sheet; - styleSheet.insertRule(`:root{--heo-snackbar-time: 8000ms!important}`, styleSheet.cssRules.length); - Snackbar.show({ - text: msg, - duration: 8000, - pos: 'top-center', - actionText: '前往', - onActionClick: function (element) { - //Set opacity of element to 0 to close Snackbar - $(element).css('opacity', 0); - window.open(link, '_blank'); - } - }); + const links = "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc" + fetch(links) + .then(res => res.json()) + .then(json => { + var linksData = json.items + var name = '' + var link = '' + if(linksData.length>0){ + var randomFriendLinks = getArrayItems(linksData, 1); + name = randomFriendLinks[0].spec.displayName; + link = randomFriendLinks[0].spec.url; + } + var msg = "点击前往按钮进入随机一个友链,不保证跳转网站的安全性和可用性。本次随机到的是本站友链:「" + name + "」"; + const style = document.createElement('style'); + document.head.appendChild(style); + const styleSheet = style.sheet; + styleSheet.insertRule(`:root{--heo-snackbar-time: 8000ms!important}`, styleSheet.cssRules.length); + Snackbar.show({ + text: msg, + duration: 8000, + pos: 'top-center', + actionText: '前往', + onActionClick: function (element) { + //Set opacity of element to 0 to close Snackbar + $(element).css('opacity', 0); + window.open(link, '_blank'); + } + }); + }) } //前往黑洞 diff --git a/templates/assets/zhheo/rightmenu.js b/templates/assets/zhheo/rightmenu.js index 6db6121d..a04a6784 100644 --- a/templates/assets/zhheo/rightmenu.js +++ b/templates/assets/zhheo/rightmenu.js @@ -406,7 +406,7 @@ function addRightMenuClickEvent() { }); $('#menu-copylink').on('click', rm.copyLink); $('#menu-downloadimg').on('click', function () { - heo.downloadImage(domImgSrc, 'kunkunyu'); + heo.downloadImage(domImgSrc, 'hao'); }); $('#menu-newwindowimg').on('click', function () { window.open(domImgSrc, "_blank"); diff --git a/templates/modules/common/footer-style-one.html b/templates/modules/common/footer-style-one.html index 85cc92f6..1f11144b 100644 --- a/templates/modules/common/footer-style-one.html +++ b/templates/modules/common/footer-style-one.html @@ -3,7 +3,7 @@ - - - - -