Few small optimizations.

This commit is contained in:
Nicolas Stepien 2012-02-18 01:58:11 +01:00
parent 06e450160f
commit b1f257fbd9
2 changed files with 16 additions and 23 deletions

View File

@ -634,7 +634,7 @@
expandComment = {
init: function() {
var a, _i, _len, _ref, _results;
_ref = $$('.abbr a');
_ref = $$('.abbr > a');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
@ -837,22 +837,18 @@
return $.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies);
},
hideHide: function(reply) {
var a, div, name, table, trip, _ref;
var div, name, table, trip, _ref;
table = reply.parentNode.parentNode.parentNode;
if (table.hidden) return;
table.hidden = true;
if (conf['Show Stubs']) {
name = $('.commentpostername', reply).textContent;
trip = ((_ref = $('.postertrip', reply)) != null ? _ref.textContent : void 0) || '';
a = $.el('a', {
innerHTML: "<span>[ + ]</span> " + name + " " + trip,
href: 'javascript:;'
});
$.on(a, 'click', replyHiding.cb.show);
div = $.el('div', {
className: 'stub'
className: 'stub',
innerHTML: "<a href=javascript:;><span>[ + ]</span> " + name + " " + trip + "</a>"
});
$.add(div, a);
$.on($('a', div), 'click', replyHiding.cb.show);
return $.before(table, div);
}
},
@ -2542,7 +2538,7 @@
html = '<div class=move>Thread Watcher</div>';
watcher.dialog = ui.dialog('watcher', 'top: 50px; left: 0px;', html);
$.add(d.body, watcher.dialog);
inputs = $$('.op input');
inputs = $$('.op > input');
for (_i = 0, _len = inputs.length; _i < _len; _i++) {
input = inputs[_i];
favicon = $.el('img', {
@ -2586,7 +2582,7 @@
}
$.add(watcher.dialog, nodes);
watchedBoard = watched[g.BOARD] || {};
_ref3 = $$('img.favicon');
_ref3 = $$('.favicon');
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
favicon = _ref3[_j];
id = favicon.nextSibling.name;
@ -2973,7 +2969,7 @@
op = threading.op($('body > form', body).firstChild);
html = op.innerHTML;
} else {
_ref = $$('td.reply', body);
_ref = $$('.reply', body);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
reply = _ref[_i];
if (reply.id === id) {
@ -3073,7 +3069,7 @@
op = threading.op($('body > form', body).firstChild);
html = op.innerHTML;
} else {
_ref = $$('td.reply', body);
_ref = $$('.reply', body);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
reply = _ref[_i];
if (reply.id === id) {

View File

@ -473,7 +473,7 @@ strikethroughQuotes =
expandComment =
init: ->
for a in $$ '.abbr a'
for a in $$ '.abbr > a'
$.on a, 'click', expandComment.expand
expand: (e) ->
e.preventDefault()
@ -630,14 +630,11 @@ replyHiding =
if conf['Show Stubs']
name = $('.commentpostername', reply).textContent
trip = $('.postertrip', reply)?.textContent or ''
a = $.el 'a',
innerHTML: "<span>[ + ]</span> #{name} #{trip}"
href: 'javascript:;'
$.on a, 'click', replyHiding.cb.show
div = $.el 'div',
className: 'stub'
$.add div, a
innerHTML: "<a href=javascript:;><span>[ + ]</span> #{name} #{trip}</a>"
$.on $('a', div), 'click', replyHiding.cb.show
$.before table, div
show: (table) ->
@ -2028,7 +2025,7 @@ watcher =
$.add d.body, watcher.dialog
#add watch buttons
inputs = $$ '.op input'
inputs = $$ '.op > input'
for input in inputs
favicon = $.el 'img',
className: 'favicon'
@ -2065,7 +2062,7 @@ watcher =
$.add watcher.dialog, nodes
watchedBoard = watched[g.BOARD] or {}
for favicon in $$ 'img.favicon'
for favicon in $$ '.favicon'
id = favicon.nextSibling.name
if id of watchedBoard
favicon.src = Favicon.default
@ -2352,7 +2349,7 @@ quoteInline =
op = threading.op $('body > form', body).firstChild
html = op.innerHTML
else
for reply in $$ 'td.reply', body
for reply in $$ '.reply', body
if reply.id == id
html = reply.innerHTML
break
@ -2424,7 +2421,7 @@ quotePreview =
op = threading.op $('body > form', body).firstChild
html = op.innerHTML
else
for reply in $$ 'td.reply', body
for reply in $$ '.reply', body
if reply.id == id
html = reply.innerHTML
break