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,53 @@
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>
`
}
}
var { $, _, footer, query } = new Utils();