less enterprise

This commit is contained in:
James Campos 2011-07-10 20:27:29 -07:00
parent 6c3dbd6c45
commit 2857f35042
2 changed files with 67 additions and 91 deletions

View File

@ -646,15 +646,7 @@
}; };
replyHiding = { replyHiding = {
init: function() { init: function() {
return g.callbacks.push(replyHiding.cb.node); return g.callbacks.push(function(root) {
},
cb: {
hide: function(e) {
var reply;
reply = this.parentNode.nextSibling;
return replyHiding.hide(reply);
},
node: function(root) {
var a, dd, id, reply; var a, dd, id, reply;
if (!(dd = $('td.doubledash', root))) { if (!(dd = $('td.doubledash', root))) {
return; return;
@ -670,6 +662,13 @@
if (id in g.hiddenReplies) { if (id in g.hiddenReplies) {
return replyHiding.hide(reply); return replyHiding.hide(reply);
} }
});
},
cb: {
hide: function(e) {
var reply;
reply = this.parentNode.nextSibling;
return replyHiding.hide(reply);
}, },
show: function(e) { show: function(e) {
var div, table; var div, table;
@ -1802,10 +1801,7 @@
}; };
anonymize = { anonymize = {
init: function() { init: function() {
return g.callbacks.push(anonymize.cb.node); return g.callbacks.push(function(root) {
},
cb: {
node: function(root) {
var name, trip; var name, trip;
name = $('span.commentpostername, span.postername', root); name = $('span.commentpostername, span.postername', root);
name.textContent = 'Anonymous'; name.textContent = 'Anonymous';
@ -1816,15 +1812,12 @@
return $.rm(trip); return $.rm(trip);
} }
} }
} });
} }
}; };
sauce = { sauce = {
init: function() { init: function() {
return g.callbacks.push(sauce.cb.node); return g.callbacks.push(function(root) {
},
cb: {
node: function(root) {
var i, link, names, prefix, prefixes, s, span, suffix, _len, _results; var i, link, names, prefix, prefixes, s, span, suffix, _len, _results;
if (root.className === 'inline') { if (root.className === 'inline') {
return; return;
@ -1863,15 +1856,12 @@
} }
return _results; return _results;
} }
} });
} }
}; };
revealSpoilers = { revealSpoilers = {
init: function() { init: function() {
return g.callbacks.push(revealSpoilers.cb.node); return g.callbacks.push(function(root) {
},
cb: {
node: function(root) {
var board, img, nb, _, _ref; var board, img, nb, _, _ref;
if (root.className === 'inline' || !(img = $('img[alt^=Spoiler]', root))) { if (root.className === 'inline' || !(img = $('img[alt^=Spoiler]', root))) {
return; return;
@ -1880,7 +1870,7 @@
img.removeAttribute('width'); img.removeAttribute('width');
_ref = img.parentNode.href.match(/(\w+)\/src\/(\d+)/), _ = _ref[0], board = _ref[1], nb = _ref[2]; _ref = img.parentNode.href.match(/(\w+)\/src\/(\d+)/), _ = _ref[0], board = _ref[1], nb = _ref[2];
return img.src = "http://0.thumbs.4chan.org/" + board + "/thumb/" + nb + "s.jpg"; return img.src = "http://0.thumbs.4chan.org/" + board + "/thumb/" + nb + "s.jpg";
} });
} }
}; };
Time = { Time = {
@ -2045,21 +2035,20 @@
}; };
quoteInline = { quoteInline = {
init: function() { init: function() {
return g.callbacks.push(quoteInline.node); return g.callbacks.push(function(root) {
}, var quote, _i, _len, _ref, _results;
node: function(root) { _ref = $$('a.quotelink, a.backlink', root);
var quote, _i, _len, _ref, _results; _results = [];
_ref = $$('a.quotelink, a.backlink', root); for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_results = []; quote = _ref[_i];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { if (!quote.hash) {
quote = _ref[_i]; continue;
if (!quote.hash) { }
continue; quote.removeAttribute('onclick');
_results.push($.bind(quote, 'click', quoteInline.toggle));
} }
quote.removeAttribute('onclick'); return _results;
_results.push($.bind(quote, 'click', quoteInline.toggle)); });
}
return _results;
}, },
toggle: function(e) { toggle: function(e) {
var el, id, inline, inlined, pathname, root, table, threadID, _i, _len, _ref; var el, id, inline, inlined, pathname, root, table, threadID, _i, _len, _ref;
@ -2234,29 +2223,25 @@
}; };
quoteOP = { quoteOP = {
init: function() { init: function() {
return g.callbacks.push(quoteOP.node); return g.callbacks.push(function(root) {
}, var quote, tid, _i, _len, _ref, _results;
node: function(root) { if (root.className === 'inline') {
var quote, tid, _i, _len, _ref, _results; return;
if (root.className === 'inline') { }
return; tid = g.THREAD_ID || $.x('ancestor::div[contains(@class,"thread")]/div', root).id;
} _ref = $$('a.quotelink', root);
tid = g.THREAD_ID || $.x('ancestor::div[contains(@class,"thread")]/div', root).id; _results = [];
_ref = $$('a.quotelink', root); for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_results = []; quote = _ref[_i];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { _results.push(quote.hash.slice(1) === tid ? quote.innerHTML += '&nbsp;(OP)' : void 0);
quote = _ref[_i]; }
_results.push(quote.hash.slice(1) === tid ? quote.innerHTML += '&nbsp;(OP)' : void 0); return _results;
} });
return _results;
} }
}; };
reportButton = { reportButton = {
init: function() { init: function() {
return g.callbacks.push(reportButton.cb.node); return g.callbacks.push(function(root) {
},
cb: {
node: function(root) {
var a, span; var a, span;
if (!(a = $('a.reportbutton', root))) { if (!(a = $('a.reportbutton', root))) {
span = $('span[id^=no]', root); span = $('span[id^=no]', root);
@ -2268,7 +2253,9 @@
$.after(span, $.tn(' ')); $.after(span, $.tn(' '));
} }
return $.bind(a, 'click', reportButton.cb.report); return $.bind(a, 'click', reportButton.cb.report);
}, });
},
cb: {
report: function(e) { report: function(e) {
return reportButton.report(this); return reportButton.report(this);
} }

View File

@ -452,14 +452,7 @@ expandThread =
replyHiding = replyHiding =
init: -> init: ->
g.callbacks.push replyHiding.cb.node g.callbacks.push (root) ->
cb:
hide: (e) ->
reply = @parentNode.nextSibling
replyHiding.hide reply
node: (root) ->
return unless dd = $ 'td.doubledash', root return unless dd = $ 'td.doubledash', root
dd.className = 'replyhider' dd.className = 'replyhider'
a = $.el 'a', a = $.el 'a',
@ -472,6 +465,11 @@ replyHiding =
if id of g.hiddenReplies if id of g.hiddenReplies
replyHiding.hide reply replyHiding.hide reply
cb:
hide: (e) ->
reply = @parentNode.nextSibling
replyHiding.hide reply
show: (e) -> show: (e) ->
div = @parentNode div = @parentNode
table = div.nextSibling table = div.nextSibling
@ -1468,9 +1466,7 @@ watcher =
anonymize = anonymize =
init: -> init: ->
g.callbacks.push anonymize.cb.node g.callbacks.push (root) ->
cb:
node: (root) ->
name = $ 'span.commentpostername, span.postername', root name = $ 'span.commentpostername, span.postername', root
name.textContent = 'Anonymous' name.textContent = 'Anonymous'
if trip = $ 'span.postertrip', root if trip = $ 'span.postertrip', root
@ -1481,9 +1477,7 @@ anonymize =
sauce = sauce =
init: -> init: ->
g.callbacks.push sauce.cb.node g.callbacks.push (root) ->
cb:
node: (root) ->
return if root.className is 'inline' return if root.className is 'inline'
prefixes = (s for s in ($.config('flavors').split '\n') when s[0] != '#') prefixes = (s for s in ($.config('flavors').split '\n') when s[0] != '#')
names = (prefix.match(/(\w+)\./)[1] for prefix in prefixes) names = (prefix.match(/(\w+)\./)[1] for prefix in prefixes)
@ -1497,9 +1491,7 @@ sauce =
revealSpoilers = revealSpoilers =
init: -> init: ->
g.callbacks.push revealSpoilers.cb.node g.callbacks.push (root) ->
cb:
node: (root) ->
return if root.className is 'inline' or not img = $ 'img[alt^=Spoiler]', root return if root.className is 'inline' or not img = $ 'img[alt^=Spoiler]', root
img.removeAttribute 'height' img.removeAttribute 'height'
img.removeAttribute 'width' img.removeAttribute 'width'
@ -1608,12 +1600,11 @@ quoteBacklink =
quoteInline = quoteInline =
init: -> init: ->
g.callbacks.push quoteInline.node g.callbacks.push (root) ->
node: (root) -> for quote in $$ 'a.quotelink, a.backlink', root
for quote in $$ 'a.quotelink, a.backlink', root continue unless quote.hash
continue unless quote.hash quote.removeAttribute 'onclick'
quote.removeAttribute 'onclick' $.bind quote, 'click', quoteInline.toggle
$.bind quote, 'click', quoteInline.toggle
toggle: (e) -> toggle: (e) ->
e.preventDefault() e.preventDefault()
id = @hash[1..] id = @hash[1..]
@ -1725,19 +1716,16 @@ quotePreview =
quoteOP = quoteOP =
init: -> init: ->
g.callbacks.push quoteOP.node g.callbacks.push (root) ->
node: (root) -> return if root.className is 'inline'
return if root.className is 'inline' tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]/div', root).id
tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]/div', root).id for quote in $$ 'a.quotelink', root
for quote in $$ 'a.quotelink', root if quote.hash[1..] is tid
if quote.hash[1..] is tid quote.innerHTML += '&nbsp;(OP)'
quote.innerHTML += '&nbsp;(OP)'
reportButton = reportButton =
init: -> init: ->
g.callbacks.push reportButton.cb.node g.callbacks.push (root) ->
cb:
node: (root) ->
if not a = $ 'a.reportbutton', root if not a = $ 'a.reportbutton', root
span = $ 'span[id^=no]', root span = $ 'span[id^=no]', root
a = $.el 'a', a = $.el 'a',
@ -1746,6 +1734,7 @@ reportButton =
$.after span, a $.after span, a
$.after span, $.tn(' ') $.after span, $.tn(' ')
$.bind a, 'click', reportButton.cb.report $.bind a, 'click', reportButton.cb.report
cb:
report: (e) -> report: (e) ->
reportButton.report @ reportButton.report @
report: (target) -> report: (target) ->