Remove update checking for Chrome/Opera Next users

This commit is contained in:
Jordan Bates 2013-05-29 11:54:31 -07:00
parent 9685885b01
commit ecdd13f9b0
6 changed files with 14 additions and 43 deletions

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.2.13 - 2013-05-28 * 4chan X - Version 1.2.13 - 2013-05-29
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.2.13 - 2013-05-28 * 4chan X - Version 1.2.13 - 2013-05-29
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.2.13 - 2013-05-28 * 4chan X - Version 1.2.13 - 2013-05-29
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* 4chan X - Version 1.2.13 - 2013-05-28 * 4chan X - Version 1.2.13 - 2013-05-29
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -113,7 +113,6 @@
'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Thread Expansion': [true, 'Add buttons to expand threads.'],
'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'],
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'], 'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
'Emoji': [false, 'Adds icons next to names for different emails'], 'Emoji': [false, 'Adds icons next to names for different emails'],
'Color User IDs': [false, 'Assign unique colors to user IDs on boards that use them'], 'Color User IDs': [false, 'Assign unique colors to user IDs on boards that use them'],
'Remove Spoilers': [false, 'Remove all spoilers in text.'], 'Remove Spoilers': [false, 'Remove all spoilers in text.'],
@ -10388,8 +10387,7 @@
} }
Main.callbackNodes(Thread, threads); Main.callbackNodes(Thread, threads);
Main.callbackNodesDB(Post, posts, function() { Main.callbackNodesDB(Post, posts, function() {
$.event('4chanXInitFinished'); return $.event('4chanXInitFinished');
return Main.checkUpdate();
}); });
if (styleSelector = $.id('styleSelector')) { if (styleSelector = $.id('styleSelector')) {
passLink = $.el('a', { passLink = $.el('a', {
@ -10409,8 +10407,7 @@
err = _error; err = _error;
new Notification('warning', 'Cookies need to be enabled on 4chan for 4chan X to properly function.', 30); new Notification('warning', 'Cookies need to be enabled on 4chan for 4chan X to properly function.', 30);
} }
$.event('4chanXInitFinished'); return $.event('4chanXInitFinished');
return Main.checkUpdate();
}, },
callbackNodes: function(klass, nodes) { callbackNodes: function(klass, nodes) {
var callback, err, errors, i, len, node, _i, _len, _ref; var callback, err, errors, i, len, node, _i, _len, _ref;
@ -10517,40 +10514,6 @@
obj.callback.isAddon = true; obj.callback.isAddon = true;
return Klass.prototype.callbacks.push(obj.callback); return Klass.prototype.callbacks.push(obj.callback);
}, },
message: function(e) {
var el, version;
version = e.data.version;
if (version && version !== g.VERSION) {
el = $.el('span', {
innerHTML: "Update: 4chan X v" + version + " is out, get it <a href=http://seaweedchan.github.io/4chan-x/ target=_blank>here</a>."
});
return new Notification('info', el, 120);
}
},
checkUpdate: function() {
var now;
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
return;
}
now = Date.now();
return $.get('lastchecked', 0, function(_arg) {
var lastchecked;
lastchecked = _arg.lastchecked;
if (lastchecked > now - $.DAY) {
return;
}
return $.ready(function() {
$.on(window, 'message', Main.message);
$.set('lastchecked', now);
return $.add(d.head, $.el('script', {
src: 'https://github.com/seaweedchan/4chan-x/raw/master/latest.js'
}));
});
});
},
handleErrors: function(errors) { handleErrors: function(errors) {
var div, error, logs, _i, _len; var div, error, logs, _i, _len;

View File

@ -53,10 +53,12 @@ Config =
false false
'Add buttons to navigate to top / bottom of thread.' 'Add buttons to navigate to top / bottom of thread.'
] ]
<% if (type !== 'crx') { %>
'Check for Updates': [ 'Check for Updates': [
true true
'Check for updated versions of <%= meta.name %>.' 'Check for updated versions of <%= meta.name %>.'
] ]
<% } %>
'Emoji': [ 'Emoji': [
false false
'Adds icons next to names for different emails' 'Adds icons next to names for different emails'

View File

@ -212,7 +212,9 @@ Main =
Main.callbackNodes Thread, threads Main.callbackNodes Thread, threads
Main.callbackNodesDB Post, posts, -> Main.callbackNodesDB Post, posts, ->
$.event '4chanXInitFinished' $.event '4chanXInitFinished'
<% if (type !== 'crx') { %>
Main.checkUpdate() Main.checkUpdate()
<% } %>
if styleSelector = $.id 'styleSelector' if styleSelector = $.id 'styleSelector'
passLink = $.el 'a', passLink = $.el 'a',
@ -232,7 +234,9 @@ Main =
new Notification 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30 new Notification 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30
$.event '4chanXInitFinished' $.event '4chanXInitFinished'
<% if (type !== 'crx') { %>
Main.checkUpdate() Main.checkUpdate()
<% } %>
callbackNodes: (klass, nodes) -> callbackNodes: (klass, nodes) ->
# get the nodes' length only once # get the nodes' length only once
@ -306,6 +310,7 @@ Main =
obj.callback.isAddon = true obj.callback.isAddon = true
Klass::callbacks.push obj.callback Klass::callbacks.push obj.callback
<% if (type !== 'crx') { %>
message: (e) -> message: (e) ->
{version} = e.data {version} = e.data
if version and version isnt g.VERSION if version and version isnt g.VERSION
@ -324,6 +329,7 @@ Main =
$.set 'lastchecked', now $.set 'lastchecked', now
$.add d.head, $.el 'script', $.add d.head, $.el 'script',
src: '<%= meta.repo %>raw/<%= meta.mainBranch %>/latest.js' src: '<%= meta.repo %>raw/<%= meta.mainBranch %>/latest.js'
<% } %>
handleErrors: (errors) -> handleErrors: (errors) ->
unless errors instanceof Array unless errors instanceof Array