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,63 @@
class Utils {
constructor() {
}
$(className) {
return document.querySelector(className);
}
_(className) {
return document.querySelectorAll(className);
}
query(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
footer() {
var footerList = [
{title: '首页', img: 'home', isActve: true, url: './index.html'},
{title: '视频', img: 'video', isActve: false, url: './video.html'},
{title: '分类', img: 'type', isActve: false, url: './type.html'},
{title: '我的', img: 'like', isActve: true, url: './like.html'},
];
// 当前访问的页面地址
var currentUrl = location.href.match(/page\/([\s\S]*?).html/)[1]
$("body").innerHTML += `
<ul class="footer">
${
footerList.map((v, i) => {
return `<li class="${v.url.includes(currentUrl) ? 'footer_active' : ''}">
<a href="${v.url}">
<img src="${
v.url.includes(currentUrl)
? v.isActve
? `../img/${v.img}_active.png`
: `../img/${v.img}.png`
: `../img/${v.img}.png`
}" alt="">
<p>${v.title}</p>
</a>
</li>`
}).toString().replaceAll(",", "")
}
</ul>
`
}
secondToTimeStr(t) {
if (!t) return;
if (t < 60) return "00:" + ((i = t) < 10 ? "0" + i : i);
if (t < 3600) return "" + ((a = parseInt(t / 60)) < 10 ? "0" + a : a) + ":" + ((i = t % 60) < 10 ? "0" + i : i);
if (3600 <= t) {
var a, i, e = parseInt(t / 3600);
return (e < 10 ? "0" + e : e) + ":" + ((a = parseInt(t % 3600 / 60)) < 10 ? "0" + a : a) + ":" + ((i = t % 60) < 10 ? "0" + i : i);
}
}}
var {$, _, footer,query,secondToTimeStr} = new Utils();