45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
/**
|
|
* 工具函数
|
|
*/
|
|
class Utils {
|
|
|
|
constructor () {
|
|
setTimeout(()=> this.AppBack(),100)
|
|
}
|
|
|
|
AppBack() {
|
|
document.querySelector(".icon-back1") && document.querySelector(".icon-back1").addEventListener('click',function () {
|
|
history.back()
|
|
})
|
|
}
|
|
|
|
GetQueryString(name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (r != null) return decodeURIComponent(r[2]); return null;
|
|
}
|
|
|
|
SetHeaderTitle(title) {
|
|
document.querySelector(".header_theme1 span").innerText = title
|
|
}
|
|
|
|
longPress(Dom, func, timeout = 500) {
|
|
var timeOutEvent;
|
|
Dom.addEventListener('touchstart', function (e) {
|
|
clearTimeout(timeOutEvent);
|
|
timeOutEvent = setTimeout(function () {
|
|
func();
|
|
}, timeout);
|
|
});
|
|
|
|
Dom.addEventListener('touchmove', function (e) {
|
|
clearTimeout(timeOutEvent);
|
|
});
|
|
|
|
Dom.addEventListener('touchend', function (e) {
|
|
clearTimeout(timeOutEvent);
|
|
});
|
|
}
|
|
}
|
|
|
|
var utils = new Utils(); |