29 lines
1.2 KiB
HTML
29 lines
1.2 KiB
HTML
<!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> |