first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
class Util {
//节流throttle代码:
throttle(fn,delay) {
let canRun = true; // 通过闭包保存一个标记
return function () {
if (!canRun) return;
canRun = false;
setTimeout(() => {
fn.apply(this, arguments);
canRun = true;
}, delay);
};
}
footer () {
var body = $("body")
var currentPath = location.href.split("page/")[1];
var html = `
<ul class="footer clear">
${
config.footer.map((v,i) => {
var isCurrent = v.path.includes(currentPath);
return `
<li class="${ isCurrent ? 'footer_active' : '' }">
<a href="${v.path}">
<img src="${isCurrent ? `../img/${v.icon}1.png` : `../img/${v.icon}.png`}">
<span>${v.title}</span>
</a>
</li>
`
}).toString().replaceAll(",","")
}
</ul>
`
body.append(html)
}
query(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
}
var {footer, query, throttle} = new Util();