Merge branch 'master' of github.com:MayhemYDG/4chan-x into qr
Conflicts: 4chan_x.user.js script.coffee
This commit is contained in:
commit
ee46bafff3
@ -304,6 +304,15 @@
|
||||
};
|
||||
|
||||
$.extend($, {
|
||||
onLoad: function(fc) {
|
||||
var cb;
|
||||
if (/interactive|complete/.test(d.readyState)) return fc();
|
||||
cb = function() {
|
||||
$.off(d, 'DOMContentLoaded', cb);
|
||||
return fc();
|
||||
};
|
||||
return $.on(d, 'DOMContentLoaded', cb);
|
||||
},
|
||||
id: function(id) {
|
||||
return d.getElementById(id);
|
||||
},
|
||||
@ -1604,10 +1613,10 @@
|
||||
time: function() {
|
||||
Time.foo();
|
||||
Time.date = new Date();
|
||||
return $('#timePreview').textContent = Time.funk(Time);
|
||||
return $.id('timePreview').textContent = Time.funk(Time);
|
||||
},
|
||||
backlink: function() {
|
||||
return $('#backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789');
|
||||
return $.id('backlinkPreview').textContent = conf['backlink'].replace(/%id/, '123456789');
|
||||
},
|
||||
favicon: function() {
|
||||
Favicon["switch"]();
|
||||
@ -2879,7 +2888,7 @@
|
||||
|
||||
Main = {
|
||||
init: function() {
|
||||
var cutoff, hiddenThreads, id, now, pathname, temp, timestamp, update, _ref;
|
||||
var cutoff, hiddenThreads, id, now, pathname, temp, timestamp, _ref;
|
||||
pathname = location.pathname.slice(1).split('/');
|
||||
g.BOARD = pathname[0], temp = pathname[1];
|
||||
if (temp === 'res') {
|
||||
@ -2888,20 +2897,27 @@
|
||||
} else {
|
||||
g.PAGENUM = parseInt(temp) || 0;
|
||||
}
|
||||
if (location.hostname === 'sys.4chan.org') {
|
||||
$.onLoad(qr.sys);
|
||||
return;
|
||||
}
|
||||
if (location.hostname === 'images.4chan.org') {
|
||||
if (conf['404 Redirect']) {
|
||||
$.onLoad(function() {
|
||||
if (d.title === '4chan - 404') return redirect.init();
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
$.onLoad(options.init);
|
||||
$.on(window, 'message', Main.message);
|
||||
now = Date.now();
|
||||
if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) {
|
||||
update = function() {
|
||||
$.off(d, 'DOMContentLoaded', update);
|
||||
$.onLoad(function() {
|
||||
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 + "/", {});
|
||||
@ -2935,20 +2951,15 @@
|
||||
if (conf['Quote Backlinks']) quoteBacklink.init();
|
||||
if (conf['Indicate OP quote']) quoteOP.init();
|
||||
if (conf['Indicate Cross-thread Quotes']) quoteDR.init();
|
||||
if (/interactive|complete/.test(d.readyState)) {
|
||||
return Main.onLoad();
|
||||
} else {
|
||||
return $.on(d, 'DOMContentLoaded', Main.onLoad);
|
||||
}
|
||||
return $.onLoad(Main.onLoad);
|
||||
},
|
||||
onLoad: function() {
|
||||
var callback, node, nodes, _i, _j, _len, _len2, _ref;
|
||||
$.off(d, 'DOMContentLoaded', Main.onLoad);
|
||||
if (conf['404 Redirect'] && d.title === '4chan - 404') {
|
||||
redirect.init();
|
||||
return;
|
||||
}
|
||||
if (!$('#navtopr') || location.hostname === 'images.4chan.org') return;
|
||||
if (!$.id('navtopr')) return;
|
||||
$.addClass(d.body, engine);
|
||||
$.addStyle(Main.css);
|
||||
threading.init();
|
||||
@ -2982,8 +2993,7 @@
|
||||
alert(err);
|
||||
}
|
||||
}
|
||||
$.on($('form[name=delform]'), 'DOMNodeInserted', Main.node);
|
||||
return options.init();
|
||||
return $.on($('form[name=delform]'), 'DOMNodeInserted', Main.node);
|
||||
},
|
||||
message: function(e) {
|
||||
var version;
|
||||
|
||||
@ -221,6 +221,13 @@ $.extend = (object, properties) ->
|
||||
object
|
||||
|
||||
$.extend $,
|
||||
onLoad: (fc) ->
|
||||
if /interactive|complete/.test d.readyState
|
||||
return fc()
|
||||
cb = ->
|
||||
$.off d, 'DOMContentLoaded', cb
|
||||
fc()
|
||||
$.on d, 'DOMContentLoaded', cb
|
||||
id: (id) ->
|
||||
d.getElementById id
|
||||
ajax: (url, cb, opts={}) ->
|
||||
@ -1324,9 +1331,9 @@ options =
|
||||
time: ->
|
||||
Time.foo()
|
||||
Time.date = new Date()
|
||||
$('#timePreview').textContent = Time.funk Time
|
||||
$.id('timePreview').textContent = Time.funk Time
|
||||
backlink: ->
|
||||
$('#backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789'
|
||||
$.id('backlinkPreview').textContent = conf['backlink'].replace /%id/, '123456789'
|
||||
favicon: ->
|
||||
Favicon.switch()
|
||||
Favicon.update() if g.REPLY and conf['Unread Count']
|
||||
@ -2282,17 +2289,21 @@ Main =
|
||||
else
|
||||
g.PAGENUM = parseInt(temp) or 0
|
||||
|
||||
if location.hostname is 'sys.4chan.org'
|
||||
$.onLoad qr.sys
|
||||
return
|
||||
if location.hostname is 'images.4chan.org'
|
||||
if conf['404 Redirect']
|
||||
$.onLoad -> redirect.init() if d.title is '4chan - 404'
|
||||
return
|
||||
|
||||
$.onLoad options.init
|
||||
|
||||
$.on window, 'message', Main.message
|
||||
|
||||
now = Date.now()
|
||||
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
|
||||
$.onLoad -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
||||
$.set 'lastUpdate', now
|
||||
|
||||
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
||||
@ -2358,17 +2369,13 @@ Main =
|
||||
quoteDR.init()
|
||||
|
||||
|
||||
if /interactive|complete/.test d.readyState
|
||||
Main.onLoad()
|
||||
else
|
||||
$.on d, 'DOMContentLoaded', Main.onLoad
|
||||
$.onLoad Main.onLoad
|
||||
|
||||
onLoad: ->
|
||||
$.off d, 'DOMContentLoaded', Main.onLoad
|
||||
if conf['404 Redirect'] and d.title is '4chan - 404'
|
||||
redirect.init()
|
||||
return
|
||||
if not $('#navtopr') or location.hostname is 'images.4chan.org'
|
||||
if not $.id 'navtopr'
|
||||
return
|
||||
$.addClass d.body, engine
|
||||
$.addStyle Main.css
|
||||
@ -2426,7 +2433,6 @@ Main =
|
||||
catch err
|
||||
alert err
|
||||
$.on $('form[name=delform]'), 'DOMNodeInserted', Main.node
|
||||
options.init()
|
||||
|
||||
message: (e) ->
|
||||
{version} = e.data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user