callbacks only take single posts
This commit is contained in:
parent
8af31eb927
commit
170d98709c
169
4chan_x.js
169
4chan_x.js
@ -603,21 +603,20 @@
|
||||
return replyHiding.hide(reply);
|
||||
},
|
||||
node: function(root) {
|
||||
var a, id, reply, td, tds, _i, _len, _results;
|
||||
tds = $$('td.doubledash', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = tds.length; _i < _len; _i++) {
|
||||
td = tds[_i];
|
||||
a = $.el('a', {
|
||||
textContent: '[ - ]'
|
||||
});
|
||||
$.bind(a, 'click', replyHiding.cb.hide);
|
||||
$.replace(td.firstChild, a);
|
||||
reply = td.nextSibling;
|
||||
id = reply.id;
|
||||
_results.push(id in g.hiddenReplies ? replyHiding.hide(reply) : void 0);
|
||||
var a, dd, id, reply;
|
||||
if (!(dd = $('td.doubldash', root))) {
|
||||
return;
|
||||
}
|
||||
a = $.el('a', {
|
||||
textContent: '[ - ]'
|
||||
});
|
||||
$.bind(a, 'click', replyHiding.cb.hide);
|
||||
$.replace(dd, a);
|
||||
reply = dd.nextSibling;
|
||||
id = reply.id;
|
||||
if (id in g.hiddenReplies) {
|
||||
return replyHiding.hide(reply);
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
show: function(e) {
|
||||
var div, table;
|
||||
@ -1028,14 +1027,9 @@
|
||||
return $('iframe[name=iframe]').src = 'about:blank';
|
||||
},
|
||||
node: function(root) {
|
||||
var quote, quotes, _i, _len, _results;
|
||||
quotes = $$('a.quotejs:not(:first-child)', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
|
||||
quote = quotes[_i];
|
||||
_results.push($.bind(quote, 'click', qr.cb.quote));
|
||||
}
|
||||
return _results;
|
||||
var quote;
|
||||
quote = $('a.quotejs:not(:first-child)', root);
|
||||
return $.bind(quote, 'click', qr.cb.quote);
|
||||
},
|
||||
submit: function(e) {
|
||||
var form, id, isQR, op;
|
||||
@ -1588,19 +1582,16 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
var name, names, trip, _i, _j, _len, _len2, _ref, _results;
|
||||
names = $$('span.postername, span.commentpostername', root);
|
||||
for (_i = 0, _len = names.length; _i < _len; _i++) {
|
||||
name = names[_i];
|
||||
name.innerHTML = 'Anonymous';
|
||||
var name, trip;
|
||||
name = $$('span.postername, span.commentpostername', root);
|
||||
name.innerHTML = 'Anonymous';
|
||||
if (trip = $('span.postertrip', root)) {
|
||||
if (trip.parentNode.nodeName === 'A') {
|
||||
return $.remove(trip.parentNode);
|
||||
} else {
|
||||
return $.remove(trip);
|
||||
}
|
||||
}
|
||||
_ref = $$('span.postertrip', root);
|
||||
_results = [];
|
||||
for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) {
|
||||
trip = _ref[_j];
|
||||
_results.push(trip.parentNode.nodeName === 'A' ? $.remove(trip.parentNode) : $.remove(trip));
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1610,7 +1601,7 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
var i, link, names, prefix, prefixes, s, span, suffix, _i, _len, _ref, _results;
|
||||
var i, link, names, prefix, prefixes, s, span, suffix, _len, _results;
|
||||
prefixes = (function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = $.config('flavors').split('\n');
|
||||
@ -1632,26 +1623,19 @@
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
_ref = $$('span.filesize', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
span = _ref[_i];
|
||||
if (span = $('span.filesize', root)) {
|
||||
suffix = $('a', span).href;
|
||||
_results.push((function() {
|
||||
var _len2, _results2;
|
||||
_results2 = [];
|
||||
for (i = 0, _len2 = prefixes.length; i < _len2; i++) {
|
||||
prefix = prefixes[i];
|
||||
link = $.el('a', {
|
||||
textContent: names[i],
|
||||
href: prefix + suffix
|
||||
});
|
||||
_results2.push($.append(span, $.tn(' '), link));
|
||||
}
|
||||
return _results2;
|
||||
})());
|
||||
_results = [];
|
||||
for (i = 0, _len = prefixes.length; i < _len; i++) {
|
||||
prefix = prefixes[i];
|
||||
link = $.el('a', {
|
||||
textContent: names[i],
|
||||
href: prefix + suffix
|
||||
});
|
||||
_results.push($.append(span, $.tn(' '), link));
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1694,7 +1678,7 @@
|
||||
},
|
||||
node: function(root) {
|
||||
var el, id, link, qid, quote, quotes, _i, _len, _ref, _results;
|
||||
id = $('td[id]', root).id;
|
||||
id = root.id || $('td[id]', root).id;
|
||||
quotes = {};
|
||||
_ref = $$('a.quotelink', root);
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
@ -1804,19 +1788,14 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
var a, arr, el, _i, _len, _results;
|
||||
arr = $$('span[id^=no]', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
||||
el = arr[_i];
|
||||
a = $.el('a', {
|
||||
innerHTML: '[ ! ]'
|
||||
});
|
||||
$.bind(a, 'click', quickReport.cb.report);
|
||||
$.after(el, a);
|
||||
_results.push($.after(el, $.tn(' ')));
|
||||
}
|
||||
return _results;
|
||||
var a, span;
|
||||
span = $('span[id^=no]', root);
|
||||
a = $.el('a', {
|
||||
innerHTML: '[ ! ]'
|
||||
});
|
||||
$.bind(a, 'click', quickReport.cb.report);
|
||||
$.after(span, a);
|
||||
return $.after(span, $.tn(' '));
|
||||
},
|
||||
report: function(e) {
|
||||
return quickReport.report(this);
|
||||
@ -1839,7 +1818,7 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
unread.replies = unread.replies.concat($$('td[id]', root));
|
||||
unread.replies.push(root);
|
||||
unread.updateTitle();
|
||||
return Favicon.update();
|
||||
},
|
||||
@ -1989,16 +1968,13 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
var thumb, _i, _len, _ref2, _results;
|
||||
_ref2 = $$('img[md5]', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
thumb = _ref2[_i];
|
||||
$.bind(thumb, 'mouseover', imageHover.cb.mouseover);
|
||||
$.bind(thumb, 'mousemove', ui.hover);
|
||||
_results.push($.bind(thumb, 'mouseout', ui.hoverend));
|
||||
var thumb;
|
||||
if (!(thumb = $('img[md5]', root))) {
|
||||
return;
|
||||
}
|
||||
return _results;
|
||||
$.bind(thumb, 'mouseover', imageHover.cb.mouseover);
|
||||
$.bind(thumb, 'mousemove', ui.hover);
|
||||
return $.bind(thumb, 'mouseout', ui.hoverend);
|
||||
},
|
||||
mouseover: function(e) {
|
||||
var el;
|
||||
@ -2050,16 +2026,15 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
var a, thumb, _i, _len, _ref2, _results;
|
||||
_ref2 = $$('img[md5]', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
thumb = _ref2[_i];
|
||||
a = thumb.parentNode;
|
||||
$.bind(a, 'click', imgExpand.cb.toggle);
|
||||
_results.push(imgExpand.on ? imgExpand.toggle(a) : void 0);
|
||||
var a, thumb;
|
||||
if (!(thumb = $('img[md5]', root))) {
|
||||
return;
|
||||
}
|
||||
a = thumb.parentNode;
|
||||
$.bind(a, 'click', imgExpand.cb.toggle);
|
||||
if (imgExpand.on) {
|
||||
return imgExpand.toggle(a);
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
toggle: function(e) {
|
||||
if (e.shiftKey || e.altKey || e.ctrlKey || e.button !== 0) {
|
||||
@ -2194,7 +2169,7 @@
|
||||
};
|
||||
main = {
|
||||
init: function() {
|
||||
var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref2, _ref3;
|
||||
var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, op, pathname, reply, table, temp, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref2, _ref3, _ref4, _ref5, _ref6;
|
||||
pathname = location.pathname.substring(1).split('/');
|
||||
g.BOARD = pathname[0], temp = pathname[1];
|
||||
if (temp === 'res') {
|
||||
@ -2323,10 +2298,24 @@
|
||||
expandComment.init();
|
||||
}
|
||||
}
|
||||
_ref3 = g.callbacks;
|
||||
_ref3 = $$('div.op');
|
||||
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
|
||||
callback = _ref3[_i];
|
||||
callback();
|
||||
op = _ref3[_i];
|
||||
_ref4 = g.callbacks;
|
||||
for (_j = 0, _len2 = _ref4.length; _j < _len2; _j++) {
|
||||
callback = _ref4[_j];
|
||||
callback(op);
|
||||
}
|
||||
}
|
||||
_ref5 = $$('td[id]');
|
||||
for (_k = 0, _len3 = _ref5.length; _k < _len3; _k++) {
|
||||
reply = _ref5[_k];
|
||||
table = reply.parentNode.parentNode.parentNode;
|
||||
_ref6 = g.callbacks;
|
||||
for (_l = 0, _len4 = _ref6.length; _l < _len4; _l++) {
|
||||
callback = _ref6[_l];
|
||||
callback(table);
|
||||
}
|
||||
}
|
||||
$.bind(d.body, 'DOMNodeInserted', nodeInserted);
|
||||
return options.init();
|
||||
|
||||
@ -429,17 +429,16 @@ replyHiding =
|
||||
replyHiding.hide reply
|
||||
|
||||
node: (root) ->
|
||||
tds = $$('td.doubledash', root)
|
||||
for td in tds
|
||||
a = $.el 'a',
|
||||
textContent: '[ - ]'
|
||||
$.bind a, 'click', replyHiding.cb.hide
|
||||
$.replace td.firstChild, a
|
||||
return unless dd = $ 'td.doubldash', root
|
||||
a = $.el 'a',
|
||||
textContent: '[ - ]'
|
||||
$.bind a, 'click', replyHiding.cb.hide
|
||||
$.replace dd, a
|
||||
|
||||
reply = td.nextSibling
|
||||
id = reply.id
|
||||
if id of g.hiddenReplies
|
||||
replyHiding.hide reply
|
||||
reply = dd.nextSibling
|
||||
id = reply.id
|
||||
if id of g.hiddenReplies
|
||||
replyHiding.hide reply
|
||||
|
||||
show: (e) ->
|
||||
div = @parentNode
|
||||
@ -788,9 +787,8 @@ qr =
|
||||
$('iframe[name=iframe]').src = 'about:blank'
|
||||
|
||||
node: (root) ->
|
||||
quotes = $$ 'a.quotejs:not(:first-child)', root
|
||||
for quote in quotes
|
||||
$.bind quote, 'click', qr.cb.quote
|
||||
quote = $ 'a.quotejs:not(:first-child)', root
|
||||
$.bind quote, 'click', qr.cb.quote
|
||||
|
||||
submit: (e) ->
|
||||
form = this
|
||||
@ -1292,10 +1290,9 @@ anonymize =
|
||||
g.callbacks.push anonymize.cb.node
|
||||
cb:
|
||||
node: (root) ->
|
||||
names = $$ 'span.postername, span.commentpostername', root
|
||||
for name in names
|
||||
name.innerHTML = 'Anonymous'
|
||||
for trip in $$ 'span.postertrip', root
|
||||
name = $$ 'span.postername, span.commentpostername', root
|
||||
name.innerHTML = 'Anonymous'
|
||||
if trip = $ 'span.postertrip', root
|
||||
if trip.parentNode.nodeName is 'A'
|
||||
$.remove trip.parentNode
|
||||
else
|
||||
@ -1308,7 +1305,7 @@ sauce =
|
||||
node: (root) ->
|
||||
prefixes = (s for s in ($.config('flavors').split '\n') when s[0] != '#')
|
||||
names = (prefix.match(/(\w+)\./)[1] for prefix in prefixes)
|
||||
for span in $$ 'span.filesize', root
|
||||
if span = $ 'span.filesize', root
|
||||
suffix = $('a', span).href
|
||||
for prefix, i in prefixes
|
||||
link = $.el 'a',
|
||||
@ -1351,7 +1348,8 @@ quoteBacklink =
|
||||
init: ->
|
||||
g.callbacks.push quoteBacklink.node
|
||||
node: (root) ->
|
||||
{id} = $ 'td[id]', root
|
||||
#better coffee-script way of doing this?
|
||||
id = root.id or $('td[id]', root).id
|
||||
quotes = {}
|
||||
for quote in $$ 'a.quotelink', root
|
||||
qid = quote.textContent[2..] #FIXME cross-board links
|
||||
@ -1423,13 +1421,12 @@ quickReport =
|
||||
g.callbacks.push quickReport.cb.node
|
||||
cb:
|
||||
node: (root) ->
|
||||
arr = $$ 'span[id^=no]', root
|
||||
for el in arr
|
||||
a = $.el 'a',
|
||||
innerHTML: '[ ! ]'
|
||||
$.bind a, 'click', quickReport.cb.report
|
||||
$.after el, a
|
||||
$.after el, $.tn(' ')
|
||||
span = $ 'span[id^=no]', root
|
||||
a = $.el 'a',
|
||||
innerHTML: '[ ! ]'
|
||||
$.bind a, 'click', quickReport.cb.report
|
||||
$.after span, a
|
||||
$.after span, $.tn(' ')
|
||||
report: (e) ->
|
||||
quickReport.report this
|
||||
report: (target) ->
|
||||
@ -1447,7 +1444,7 @@ unread =
|
||||
|
||||
cb:
|
||||
node: (root) ->
|
||||
unread.replies = unread.replies.concat $$ 'td[id]', root
|
||||
unread.replies.push root
|
||||
unread.updateTitle()
|
||||
Favicon.update()
|
||||
|
||||
@ -1538,10 +1535,10 @@ imageHover =
|
||||
g.callbacks.push imageHover.cb.node
|
||||
cb:
|
||||
node: (root) ->
|
||||
for thumb in $$ 'img[md5]', root
|
||||
$.bind thumb, 'mouseover', imageHover.cb.mouseover
|
||||
$.bind thumb, 'mousemove', ui.hover
|
||||
$.bind thumb, 'mouseout', ui.hoverend
|
||||
return unless thumb = $ 'img[md5]', root
|
||||
$.bind thumb, 'mouseover', imageHover.cb.mouseover
|
||||
$.bind thumb, 'mousemove', ui.hover
|
||||
$.bind thumb, 'mouseout', ui.hoverend
|
||||
mouseover: (e) ->
|
||||
el = $ '#iHover'
|
||||
el.src = null
|
||||
@ -1574,10 +1571,10 @@ imgExpand =
|
||||
|
||||
cb:
|
||||
node: (root) ->
|
||||
for thumb in $$ 'img[md5]', root
|
||||
a = thumb.parentNode
|
||||
$.bind a, 'click', imgExpand.cb.toggle
|
||||
if imgExpand.on then imgExpand.toggle a
|
||||
return unless thumb = $ 'img[md5]', root
|
||||
a = thumb.parentNode
|
||||
$.bind a, 'click', imgExpand.cb.toggle
|
||||
if imgExpand.on then imgExpand.toggle a
|
||||
toggle: (e) ->
|
||||
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
|
||||
e.preventDefault()
|
||||
@ -1810,7 +1807,13 @@ main =
|
||||
if $.config 'Comment Expansion'
|
||||
expandComment.init()
|
||||
|
||||
callback() for callback in g.callbacks
|
||||
for op in $$ 'div.op'
|
||||
for callback in g.callbacks
|
||||
callback op
|
||||
for reply in $$ 'td[id]'
|
||||
table = reply.parentNode.parentNode.parentNode
|
||||
for callback in g.callbacks
|
||||
callback table
|
||||
$.bind d.body, 'DOMNodeInserted', nodeInserted
|
||||
options.init()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user