Close #59
This commit is contained in:
parent
015bc15641
commit
e314c00b53
@ -10161,27 +10161,22 @@
|
||||
}
|
||||
},
|
||||
checkUpdate: function() {
|
||||
var freq, items, now;
|
||||
var now;
|
||||
|
||||
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
|
||||
return;
|
||||
}
|
||||
now = Date.now();
|
||||
freq = 6 * $.HOUR;
|
||||
items = {
|
||||
lastupdate: 0,
|
||||
lastchecked: 0
|
||||
};
|
||||
return $.get(items, function(_arg) {
|
||||
var lastchecked, lastupdate;
|
||||
return $.get('lastchecked', 0, function(_arg) {
|
||||
var lastchecked;
|
||||
|
||||
lastupdate = _arg.lastupdate, lastchecked = _arg.lastchecked;
|
||||
if ((lastupdate > now - freq) || (lastchecked > now - $.DAY)) {
|
||||
lastchecked = _arg.lastchecked;
|
||||
if (lastchecked > now - $.DAY) {
|
||||
return;
|
||||
}
|
||||
return $.ready(function() {
|
||||
$.on(window, 'message', Main.message);
|
||||
$.set('lastUpdate', now);
|
||||
$.set('lastchecked', now);
|
||||
return $.add(d.head, $.el('script', {
|
||||
src: 'https://github.com/seaweedchan/4chan-x/raw/master/latest.js'
|
||||
}));
|
||||
|
||||
@ -10184,27 +10184,22 @@
|
||||
}
|
||||
},
|
||||
checkUpdate: function() {
|
||||
var freq, items, now;
|
||||
var now;
|
||||
|
||||
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
|
||||
return;
|
||||
}
|
||||
now = Date.now();
|
||||
freq = 7 * $.DAY;
|
||||
items = {
|
||||
lastupdate: 0,
|
||||
lastchecked: 0
|
||||
};
|
||||
return $.get(items, function(_arg) {
|
||||
var lastchecked, lastupdate;
|
||||
return $.get('lastchecked', 0, function(_arg) {
|
||||
var lastchecked;
|
||||
|
||||
lastupdate = _arg.lastupdate, lastchecked = _arg.lastchecked;
|
||||
if ((lastupdate > now - freq) || (lastchecked > now - $.DAY)) {
|
||||
lastchecked = _arg.lastchecked;
|
||||
if (lastchecked > now - $.DAY) {
|
||||
return;
|
||||
}
|
||||
return $.ready(function() {
|
||||
$.on(window, 'message', Main.message);
|
||||
$.set('lastUpdate', now);
|
||||
$.set('lastchecked', now);
|
||||
return $.add(d.head, $.el('script', {
|
||||
src: 'https://github.com/seaweedchan/4chan-x/raw/master/latest.js'
|
||||
}));
|
||||
|
||||
@ -10166,27 +10166,22 @@
|
||||
}
|
||||
},
|
||||
checkUpdate: function() {
|
||||
var freq, items, now;
|
||||
var now;
|
||||
|
||||
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
|
||||
return;
|
||||
}
|
||||
now = Date.now();
|
||||
freq = 7 * $.DAY;
|
||||
items = {
|
||||
lastupdate: 0,
|
||||
lastchecked: 0
|
||||
};
|
||||
return $.get(items, function(_arg) {
|
||||
var lastchecked, lastupdate;
|
||||
return $.get('lastchecked', 0, function(_arg) {
|
||||
var lastchecked;
|
||||
|
||||
lastupdate = _arg.lastupdate, lastchecked = _arg.lastchecked;
|
||||
if ((lastupdate > now - freq) || (lastchecked > now - $.DAY)) {
|
||||
lastchecked = _arg.lastchecked;
|
||||
if (lastchecked > now - $.DAY) {
|
||||
return;
|
||||
}
|
||||
return $.ready(function() {
|
||||
$.on(window, 'message', Main.message);
|
||||
$.set('lastUpdate', now);
|
||||
$.set('lastchecked', now);
|
||||
return $.add(d.head, $.el('script', {
|
||||
src: 'https://github.com/seaweedchan/4chan-x/raw/master/latest.js'
|
||||
}));
|
||||
|
||||
@ -297,21 +297,13 @@ Main =
|
||||
|
||||
checkUpdate: ->
|
||||
return unless Conf['Check for Updates'] and Main.isThisPageLegit()
|
||||
# Check for updates after:
|
||||
# - 6 hours since the last update on Opera because it lacks auto-updating.
|
||||
# - 7 days since the last update on Chrome/Firefox.
|
||||
# After that, check for updates every day if we still haven't updated.
|
||||
now = Date.now()
|
||||
freq = <% if (type === 'userjs') { %>6 * $.HOUR<% } else { %>7 * $.DAY<% } %>
|
||||
items =
|
||||
lastupdate: 0
|
||||
lastchecked: 0
|
||||
$.get items, ({lastupdate, lastchecked}) ->
|
||||
if (lastupdate > now - freq) or (lastchecked > now - $.DAY)
|
||||
$.get 'lastchecked', 0, ({lastchecked}) ->
|
||||
if (lastchecked > now - $.DAY)
|
||||
return
|
||||
$.ready ->
|
||||
$.on window, 'message', Main.message
|
||||
$.set 'lastUpdate', now
|
||||
$.set 'lastchecked', now
|
||||
$.add d.head, $.el 'script',
|
||||
src: '<%= meta.repo %>raw/<%= meta.mainBranch %>/latest.js'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user