1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-01 22:53:29 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
bookshelfplus/bookshelfplus-frontend/views/component/footer.html

76 lines
3.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="footer" style="margin-top: 10vh;">
<hr>
<p>
书栖网 • 2021-2022
<br>
<small>
<br>
本项目是开源项目项目的发展离不开大家的支持欢迎前往项目仓库点亮Star支持我们❤
<br>
<a target="_blank" href="https://gitee.com/bookshelfplus/bookshelfplus"><img src="/assets/image/svg/gitee.svg" style="height: 1.05em; vertical-align: middle;"/><span style="vertical-align: middle; margin-left: 3px;">码云</span></a>
·
<a target="_blank" href="https://github.com/bookshelfplus/bookshelfplus"><img src="/assets/image/svg/github.svg" style="height: 1.08em; vertical-align: middle;"/><span style="vertical-align: middle; margin-left: 3px;">GitHub</span></a>
<br>
<a href="/status">网站状态检测</a>
·
<a href="/about">关于</a>
·
<a href="/feedback">反馈</a>
</small>
</p>
</div>
<!-- https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a -->
<script>
// 获取网页上的所有文字
// refer: https://www.cnblogs.com/yzeng/p/8268731.html
function getPageText() {
var str = document.documentElement.innerText;
str += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 数字和英文全部包含进去,避免因为部分数字或字母造成大量生成字体
var res = [].filter.call(str, (s, i, o) => o.indexOf(s) == i).sort().join('').trim();
return res;
}
function fontmin(text) {
axios.post('../fontmin/getfont', { text: text, font: "" }, { timeout: 1000 })
.then(function (response) {
// 当接口成功返回时动态设置css
loadFont(response.data.url);
$("html,body").css("transition", ".05s");
setTimeout(() => {
$("html,body").css("opacity", "1");
}, 100)
})
.catch(function (error) {
console.log("字体加载失败", error);
$("html,body").css("transition", ".05s");
setTimeout(() => {
$("html,body").css("opacity", "1");
}, 100)
});
}
function loadFont(fontUrl) {
let styleDom = document.createElement('style');
styleDom.type = 'text/css';
const cssText = `
@font-face {
font-family: bookshelfplusFont;
src: url("${fontUrl}") format("truetype");
}
`
styleDom.appendChild(document.createTextNode(cssText));
document.getElementsByTagName('head')[0].appendChild(styleDom)
console.log("字体加载成功");
}
$(document).ready(function () {
var allText = getPageText();
// console.log(allText);
if ('<%= typeof(minfontOnLoad) === "undefined" ? "true" : minfontOnLoad %>' != "false") {
fontmin(allText);
} else {
// $("html,body").css("opacity", "1");
}
});
</script>