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,57 @@
class Util{
$(className) {
if (document.querySelectorAll(className).length > 1) {
return document.querySelectorAll(className)
} else {
return document.querySelector(className)
}
}
click(className,callback) {
$(className).onclick = () => {
callback()
}
}
inject() {
Element.prototype.remove = function (removeClassName) {
this.classList.remove(removeClassName);
}
Element.prototype.add = function (addClassName) {
this.classList.add(addClassName);
}
}
}
var { $, click, inject } = new Util()
inject()
//定义两个变量存放创建的上水管和下水管
// var TopWaterPipe = cretedImg("top")
// var BottomWaterPipe = cretedImg("bottom")
//添加上水管以及下水管
// $("body").appendChild(TopWaterPipe)
// $("body").appendChild(BottomWaterPipe)
// this.WaterPipeMove(TopWaterPipe)
// this.WaterPipeMove(BottomWaterPipe)
//水管运动
// WaterPipeMove(img) {
// img.time = setInterval(() => {
// img.style.left = `${parseInt(img.style.left) - this.groundSpeed}px`
// // 让水管每次移动距离为当前的x轴距离减去地板移动的速度(保证水管和地板是同时运动的)
// if (parseInt(img.style.left) <= -55) {
// clearInterval(img.time)
// $("body").removeChild(img)
// // 如果水管的x轴距离小于他本身时 也就是全部移除屏幕时 删除定时器以及元素
// }
// }, 1000 / 16)
// }