页脚友联优化,随机访问地址优化
This commit is contained in:
parent
3b607dcb61
commit
3128e4c35c
|
@ -913,12 +913,6 @@ spec:
|
|||
value: true
|
||||
- label: 禁用
|
||||
value: false
|
||||
- $formkit: url
|
||||
name: fetchUrl
|
||||
if: $get(enable_footer_group).value
|
||||
value: "https://moments.0206.ink/randomfriend?num=3"
|
||||
label: 页脚友链地址
|
||||
placeholder: 请输入页脚友链地址
|
||||
- $formkit: group
|
||||
name: footerContent
|
||||
label: 页脚内容
|
||||
|
@ -1276,11 +1270,6 @@ spec:
|
|||
name: bigTitle
|
||||
label: 大标题
|
||||
value: 我和我的小伙伴们
|
||||
- $formkit: url
|
||||
name: randomfriendurl
|
||||
value: "https://moments.0206.ink/randomfriend"
|
||||
label: 随机访问地址
|
||||
help: 注意格式 (你的鱼塘token地址 + randomfriend)
|
||||
- $formkit: url
|
||||
name: fcircleUrl
|
||||
value: "/fcircle"
|
||||
|
|
|
@ -137,20 +137,16 @@ var heo = {
|
|||
|
||||
// 页脚友链
|
||||
addFriendLinksInFooter: function () {
|
||||
var fetchUrl = "https://moments.0206.ink/randomfriend?num=3"
|
||||
fetch(fetchUrl)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
var randomFriendLinks = getArrayItems(json, 3);
|
||||
|
||||
var htmlText = '';
|
||||
for (let i = 0; i < randomFriendLinks.length; ++i) {
|
||||
var item = randomFriendLinks[i]
|
||||
htmlText += `<a class='footer-item' href='${item.link}' target="_blank" rel="noopener nofollow">${item.name}</a>`;
|
||||
}
|
||||
htmlText += `<a class='footer-item' href='/links'>更多</a>`
|
||||
document.getElementById("friend-links-in-footer").innerHTML = htmlText;
|
||||
})
|
||||
const linksUrl = GLOBAL_CONFIG.source.links.linksUrl
|
||||
const links = GLOBAL_CONFIG.source.links.linksData
|
||||
var randomFriendLinks = getArrayItems(links, 3);
|
||||
var htmlText = '';
|
||||
for (let i = 0; i < randomFriendLinks.length; ++i) {
|
||||
var item = randomFriendLinks[i]
|
||||
htmlText += `<a class='footer-item' href='${item.spec.url}' target="_blank" rel="noopener nofollow">${item.spec.displayName}</a>`;
|
||||
}
|
||||
htmlText += `<a class='footer-item' href='${linksUrl}'>更多</a>`
|
||||
document.getElementById("friend-links-in-footer").innerHTML = htmlText;
|
||||
},
|
||||
|
||||
//禁止图片右键单击
|
||||
|
|
|
@ -370,29 +370,30 @@ document.addEventListener('scroll', btf.throttle(function () {
|
|||
|
||||
//友链随机传送
|
||||
function travelling() {
|
||||
var fetchUrl = GLOBAL_CONFIG.source.links.randomfriendurl
|
||||
fetch(fetchUrl)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
var name = json.name;
|
||||
var link = json.link;
|
||||
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 = 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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//前往黑洞
|
||||
|
@ -804,7 +805,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
heo.stopImgRightDrag()
|
||||
//页脚友联
|
||||
if(GLOBAL_CONFIG.isFriendLinksInFooter){
|
||||
link.addFriendLinksInFooter()
|
||||
heo.addFriendLinksInFooter()
|
||||
}
|
||||
heo.qrcodeCreate()
|
||||
heo.onlyHome()
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<!-- 公共js -->
|
||||
<script th:fragment="common-script">
|
||||
if(GLOBAL_CONFIG.isFriendLinksInFooter){
|
||||
var link = {
|
||||
// 页脚友链
|
||||
addFriendLinksInFooter: function () {
|
||||
|
||||
var linksUrl = '[[${theme.config.link.linksUrl}]]'
|
||||
var fetchUrl = "[(${theme.config.footer.footer_group.fetchUrl})]"
|
||||
fetch(fetchUrl)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
var randomFriendLinks = getArrayItems(json, 3);
|
||||
|
||||
var htmlText = '';
|
||||
for (let i = 0; i < randomFriendLinks.length; ++i) {
|
||||
var item = randomFriendLinks[i]
|
||||
htmlText += `<a class='footer-item' href='${item.link}' target="_blank" rel="noopener nofollow">${item.name}</a>`;
|
||||
}
|
||||
htmlText += `<a class='footer-item' href='${linksUrl}'>更多</a>`
|
||||
document.getElementById("friend-links-in-footer").innerHTML = htmlText;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</html>
|
|
@ -39,7 +39,7 @@
|
|||
<div th:if="${theme.config.footer.footer_group.enable_footer_group}" class="footer-group">
|
||||
<div class="footer-title-group">
|
||||
<h3 class="footer-title">友链</h3><a class="random-friends-btn"
|
||||
href="javascript:link.addFriendLinksInFooter();"
|
||||
href="javascript:heo.addFriendLinksInFooter();"
|
||||
rel="external nofollow" title="换一批友情链接"
|
||||
data-pjax-state="external"><i
|
||||
class="haofont hao-icon-arrow-rotate-right"></i></a>
|
||||
|
|
|
@ -204,8 +204,9 @@
|
|||
assetsLink: [[${assets_link}]],
|
||||
profileStyle: [[${theme.config.sidebar.profile.profileStyle}]],
|
||||
source: {
|
||||
links:{
|
||||
randomfriendurl: [[${theme.config.link.randomfriendurl}]],
|
||||
links: {
|
||||
linksUrl: [[${ theme.config.link.linksUrl }]],
|
||||
linksData: []
|
||||
},
|
||||
jQuery: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js',
|
||||
justifiedGallery: {
|
||||
|
@ -328,6 +329,16 @@
|
|||
</script>
|
||||
|
||||
|
||||
<script data-pjax th:inline="javascript" th:if="${pluginFinder.available('PluginLinks')}">
|
||||
var groupData = [[${ linkFinder.groupBy() }]]
|
||||
if (groupData.length > 0) {
|
||||
GLOBAL_CONFIG.source.links.linksData = groupData.flatMap((item) => {
|
||||
return item.links
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -109,9 +109,6 @@
|
|||
<!-- 动态标题 -->
|
||||
<script th:replace="~{modules/common/diytitle :: diytitle}"></script>
|
||||
|
||||
<!-- 公共js -->
|
||||
<script th:replace="~{modules/common/common-script :: common-script}"></script>
|
||||
|
||||
<div id="js-pjax"></div>
|
||||
|
||||
<script th:if="${theme.config.envelope_comment.enable_danmu}" th:src="${assets_link + '/libs/twikoo/easy-Danmaku.js'}" id="Danmaku"></script>
|
||||
|
@ -230,7 +227,7 @@
|
|||
heo.initThemeColor();
|
||||
//页脚友联
|
||||
if(GLOBAL_CONFIG.isFriendLinksInFooter){
|
||||
link.addFriendLinksInFooter()
|
||||
heo.addFriendLinksInFooter()
|
||||
}
|
||||
|
||||
//右下角 snackbar 弹窗
|
||||
|
|
Loading…
Reference in New Issue