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

View File

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