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

49 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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>
<a href="/status">网站状态检测</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: "" })
.then(function (response) {
// 当接口成功返回时动态设置css
let styleDom = document.createElement('style');
styleDom.type = 'text/css';
const cssText = `
@font-face {
font-family: bookshelfplusFont;
src: url("${response.data.url}") format("truetype");
}
`
styleDom.appendChild(document.createTextNode(cssText));
document.getElementsByTagName('head')[0].appendChild(styleDom)
console.log("字体加载成功");
})
.catch(function (error) {
console.log("字体加载失败", error);
});
}
$(document).ready(function () {
var allText = getPageText();
console.log(allText);
fontmin(allText);
});
</script>