Set up update checking asap.
This commit is contained in:
parent
4cfa27f38c
commit
167acea2c2
@ -3002,7 +3002,7 @@
|
|||||||
|
|
||||||
Main = {
|
Main = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, _ref;
|
var cutoff, hiddenThreads, id, now, pathname, temp, timestamp, update, _ref;
|
||||||
pathname = location.pathname.substring(1).split('/');
|
pathname = location.pathname.substring(1).split('/');
|
||||||
g.BOARD = pathname[0], temp = pathname[1];
|
g.BOARD = pathname[0], temp = pathname[1];
|
||||||
if (temp === 'res') {
|
if (temp === 'res') {
|
||||||
@ -3020,11 +3020,23 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.on(window, 'message', Main.message);
|
$.on(window, 'message', Main.message);
|
||||||
g.hiddenReplies = $.get("hiddenReplies/" + g.BOARD + "/", {});
|
|
||||||
lastChecked = $.get('lastChecked', 0);
|
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
Main.reqUpdate = lastChecked < now - 1 * DAY;
|
if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) {
|
||||||
if (Main.reqUpdate) {
|
update = function() {
|
||||||
|
$.off(d, 'DOMContentLoaded', update);
|
||||||
|
return $.add(d.head, $.el('script', {
|
||||||
|
src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
if (/interactive|complete/.test(d.readyState)) {
|
||||||
|
update();
|
||||||
|
} else {
|
||||||
|
$.on(d, 'DOMContentLoaded', update);
|
||||||
|
}
|
||||||
|
$.set('lastUpdate', now);
|
||||||
|
}
|
||||||
|
g.hiddenReplies = $.get("hiddenReplies/" + g.BOARD + "/", {});
|
||||||
|
if ($.get('lastChecked', 0) < now - 1 * DAY) {
|
||||||
$.set('lastChecked', now);
|
$.set('lastChecked', now);
|
||||||
cutoff = now - 7 * DAY;
|
cutoff = now - 7 * DAY;
|
||||||
hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {});
|
hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {});
|
||||||
@ -3072,11 +3084,6 @@
|
|||||||
$.addStyle(Main.css);
|
$.addStyle(Main.css);
|
||||||
threading.init();
|
threading.init();
|
||||||
Favicon.init();
|
Favicon.init();
|
||||||
if (Main.reqUpdate && conf['Check for Updates']) {
|
|
||||||
$.add(d.head, $.el('script', {
|
|
||||||
src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if ((form = $('form[name=post]')) && (canPost = !!$('#recaptcha_response_field'))) {
|
if ((form = $('form[name=post]')) && (canPost = !!$('#recaptcha_response_field'))) {
|
||||||
Recaptcha.init();
|
Recaptcha.init();
|
||||||
if (g.REPLY && conf['Auto Watch Reply'] && conf['Thread Watcher']) {
|
if (g.REPLY && conf['Auto Watch Reply'] && conf['Thread Watcher']) {
|
||||||
|
|||||||
@ -1797,7 +1797,7 @@ Time =
|
|||||||
@parse =
|
@parse =
|
||||||
if Date.parse '10/11/11(Tue)18:53' is 1318351980000
|
if Date.parse '10/11/11(Tue)18:53' is 1318351980000
|
||||||
(node) -> new Date Date.parse(node.textContent) + chanOffset*HOUR
|
(node) -> new Date Date.parse(node.textContent) + chanOffset*HOUR
|
||||||
else # Firefox the Archaic cannot parse 4chan's time
|
else # Firefox and Opera do not parse 4chan's time format correctly
|
||||||
(node) ->
|
(node) ->
|
||||||
[_, month, day, year, hour, min] =
|
[_, month, day, year, hour, min] =
|
||||||
node.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/
|
node.textContent.match /(\d+)\/(\d+)\/(\d+)\(\w+\)(\d+):(\d+)/
|
||||||
@ -2336,13 +2336,19 @@ Main =
|
|||||||
|
|
||||||
$.on window, 'message', Main.message
|
$.on window, 'message', Main.message
|
||||||
|
|
||||||
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
|
||||||
|
|
||||||
lastChecked = $.get 'lastChecked', 0
|
|
||||||
now = Date.now()
|
now = Date.now()
|
||||||
Main.reqUpdate = lastChecked < now - 1*DAY
|
if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR
|
||||||
|
update = ->
|
||||||
|
$.off d, 'DOMContentLoaded', update
|
||||||
|
$.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
||||||
|
if /interactive|complete/.test d.readyState
|
||||||
|
update()
|
||||||
|
else
|
||||||
|
$.on d, 'DOMContentLoaded', update
|
||||||
|
$.set 'lastUpdate', now
|
||||||
|
|
||||||
if Main.reqUpdate
|
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
||||||
|
if $.get('lastChecked', 0) < now - 1*DAY
|
||||||
$.set 'lastChecked', now
|
$.set 'lastChecked', now
|
||||||
|
|
||||||
cutoff = now - 7*DAY
|
cutoff = now - 7*DAY
|
||||||
@ -2421,9 +2427,6 @@ Main =
|
|||||||
threading.init()
|
threading.init()
|
||||||
Favicon.init()
|
Favicon.init()
|
||||||
|
|
||||||
if Main.reqUpdate and conf['Check for Updates']
|
|
||||||
$.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
|
||||||
|
|
||||||
#recaptcha may be blocked, eg by noscript
|
#recaptcha may be blocked, eg by noscript
|
||||||
if (form = $ 'form[name=post]') and (canPost = !!$ '#recaptcha_response_field')
|
if (form = $ 'form[name=post]') and (canPost = !!$ '#recaptcha_response_field')
|
||||||
Recaptcha.init()
|
Recaptcha.init()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user