forked from Zakelly/PKUGetClassHelper
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlimit.js
More file actions
56 lines (51 loc) · 1.07 KB
/
Copy pathlimit.js
File metadata and controls
56 lines (51 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* 内部频率限制
* @author Zakelly
* @modified by thrfirs
*/
nowTimes = 0;
function getLocalStorage(){
checkDate();
var v=localStorage["gchv"];
if (v==null){
localStorage["gchv"]=VERSION;
}
else{
var vn=parseInt(localStorage["gchv"]);
if (isNaN(vn)||(vn < VERSION)){
localStorage["gchv"]=VERSION;
localStorage["gcht"]=0;
}
}
var t=localStorage["gcht"];
if (t==null){
localStorage["gcht"]=0;
t = 0;
}
return parseInt(t);
}
function checkDate(){
var d=new Date();
var dl=localStorage["gchd"];
d=parseInt(d.getDate());
if (isNaN(d)){
d=0;
}
if (dl==null){
localStorage["gchd"]=d;
localStorage["gcht"]=0;
}
else{
var dl=parseInt(localStorage["gchd"]);
if (isNaN(dl)||(dl != d)){
localStorage["gchd"]=d;
localStorage["gcht"]=0;
}
}
}
function incNowTimes(){
nowTimes++;
localStorage["gcht"] = nowTimes;
return nowTimes;
}
nowTimes = getLocalStorage();