make new request after 10s
This commit is contained in:
parent
1cc4c2d7a5
commit
bf6639da25
@ -808,6 +808,7 @@ request = (url, callback) ->
|
||||
r.onload = -> callback this
|
||||
r.open 'get', url, true
|
||||
r.send()
|
||||
r
|
||||
|
||||
updateCallback = (res) ->
|
||||
body = n 'body', innerHTML: res.responseText
|
||||
@ -835,7 +836,12 @@ updateCallback = (res) ->
|
||||
updateTime = ->
|
||||
span = $ '#updater #timer'
|
||||
time = Number span.textContent
|
||||
if ++time is 0 then updateNow()
|
||||
if ++time is 0
|
||||
updateNow()
|
||||
else if time > 10
|
||||
time = 0
|
||||
g.r.abort()
|
||||
updateNow()
|
||||
span.textContent = time
|
||||
|
||||
updateAuto = ->
|
||||
@ -858,7 +864,7 @@ updateInterval = ->
|
||||
span.textContent = -1 * n
|
||||
|
||||
updateNow = ->
|
||||
request location.href, updateCallback
|
||||
g.r = request location.href, updateCallback
|
||||
|
||||
updaterMake = ->
|
||||
div = AEOS.makeDialog 'updater', 'topright'
|
||||
@ -994,6 +1000,9 @@ GM_addStyle '
|
||||
position: fixed;
|
||||
text-align: right;
|
||||
}
|
||||
#updater input[type=text] {
|
||||
width: 50px;
|
||||
}
|
||||
#watcher {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
12
4chan_x.js
12
4chan_x.js
@ -1067,7 +1067,8 @@
|
||||
return callback(this);
|
||||
};
|
||||
r.open('get', url, true);
|
||||
return r.send();
|
||||
r.send();
|
||||
return r;
|
||||
};
|
||||
updateCallback = function(res) {
|
||||
var body, count, i, id, replies, reply, root, span, table;
|
||||
@ -1099,6 +1100,10 @@
|
||||
time = Number(span.textContent);
|
||||
if (++time === 0) {
|
||||
updateNow();
|
||||
} else if (time > 10) {
|
||||
time = 0;
|
||||
g.r.abort();
|
||||
updateNow();
|
||||
}
|
||||
return span.textContent = time;
|
||||
};
|
||||
@ -1126,7 +1131,7 @@
|
||||
}
|
||||
};
|
||||
updateNow = function() {
|
||||
return request(location.href, updateCallback);
|
||||
return g.r = request(location.href, updateCallback);
|
||||
};
|
||||
updaterMake = function() {
|
||||
var auto, div, html, interval;
|
||||
@ -1274,6 +1279,9 @@
|
||||
position: fixed;\
|
||||
text-align: right;\
|
||||
}\
|
||||
#updater input[type=text] {\
|
||||
width: 50px;\
|
||||
}\
|
||||
#watcher {\
|
||||
position: absolute;\
|
||||
}\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user