Rename onLoad to ready.

This commit is contained in:
Nicolas Stepien 2012-01-07 18:12:03 +01:00
parent 91772a4110
commit cb6b786202
2 changed files with 14 additions and 14 deletions

View File

@ -307,7 +307,7 @@
}; };
$.extend($, { $.extend($, {
onLoad: function(fc) { ready: function(fc) {
var cb; var cb;
if (/interactive|complete/.test(d.readyState)) return fc(); if (/interactive|complete/.test(d.readyState)) return fc();
cb = function() { cb = function() {
@ -3084,20 +3084,20 @@
g.PAGENUM = parseInt(temp) || 0; g.PAGENUM = parseInt(temp) || 0;
} }
if (location.hostname === 'sys.4chan.org') { if (location.hostname === 'sys.4chan.org') {
$.onLoad(qr.sys); $.ready(qr.sys);
return; return;
} }
if (location.hostname === 'images.4chan.org') { if (location.hostname === 'images.4chan.org') {
$.onLoad(function() { $.ready(function() {
if (d.title === '4chan - 404') return redirect.init(); if (d.title === '4chan - 404') return redirect.init();
}); });
return; return;
} }
$.onLoad(options.init); $.ready(options.init);
$.on(window, 'message', Main.message); $.on(window, 'message', Main.message);
now = Date.now(); now = Date.now();
if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) { if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) {
$.onLoad(function() { $.ready(function() {
return $.add(d.head, $.el('script', { return $.add(d.head, $.el('script', {
src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js' src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
})); }));
@ -3135,9 +3135,9 @@
if (conf['Quote Backlinks']) quoteBacklink.init(); if (conf['Quote Backlinks']) quoteBacklink.init();
if (conf['Indicate OP quote']) quoteOP.init(); if (conf['Indicate OP quote']) quoteOP.init();
if (conf['Indicate Cross-thread Quotes']) quoteDR.init(); if (conf['Indicate Cross-thread Quotes']) quoteDR.init();
return $.onLoad(Main.onLoad); return $.ready(Main.ready);
}, },
onLoad: function() { ready: function() {
var callback, canPost, form, node, nodes, _i, _j, _len, _len2, _ref; var callback, canPost, form, node, nodes, _i, _j, _len, _len2, _ref;
if (conf['404 Redirect'] && d.title === '4chan - 404') { if (conf['404 Redirect'] && d.title === '4chan - 404') {
redirect.init(); redirect.init();

View File

@ -221,7 +221,7 @@ $.extend = (object, properties) ->
object object
$.extend $, $.extend $,
onLoad: (fc) -> ready: (fc) ->
if /interactive|complete/.test d.readyState if /interactive|complete/.test d.readyState
return fc() return fc()
cb = -> cb = ->
@ -2390,19 +2390,19 @@ Main =
g.PAGENUM = parseInt(temp) or 0 g.PAGENUM = parseInt(temp) or 0
if location.hostname is 'sys.4chan.org' if location.hostname is 'sys.4chan.org'
$.onLoad qr.sys $.ready qr.sys
return return
if location.hostname is 'images.4chan.org' if location.hostname is 'images.4chan.org'
$.onLoad -> redirect.init() if d.title is '4chan - 404' $.ready -> redirect.init() if d.title is '4chan - 404'
return return
$.onLoad options.init $.ready options.init
$.on window, 'message', Main.message $.on window, 'message', Main.message
now = Date.now() now = Date.now()
if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR
$.onLoad -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js' $.ready -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
$.set 'lastUpdate', now $.set 'lastUpdate', now
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {} g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
@ -2468,9 +2468,9 @@ Main =
quoteDR.init() quoteDR.init()
$.onLoad Main.onLoad $.ready Main.ready
onLoad: -> ready: ->
if conf['404 Redirect'] and d.title is '4chan - 404' if conf['404 Redirect'] and d.title is '4chan - 404'
redirect.init() redirect.init()
return return