put op into its own div

This commit is contained in:
James Campos 2011-04-09 21:10:46 -07:00
parent af8c366175
commit f78585381e
2 changed files with 30 additions and 8 deletions

View File

@ -1411,7 +1411,7 @@
}; };
threadHiding = { threadHiding = {
init: function() { init: function() {
var a, hiddenThreads, id, node, thread, _i, _len, _ref, _results; var a, hiddenThreads, node, op, thread, _i, _len, _ref, _results;
node = $('form[name=delform] > *'); node = $('form[name=delform] > *');
threadHiding.thread(node); threadHiding.thread(node);
hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {}); hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {});
@ -1419,13 +1419,13 @@
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
thread = _ref[_i]; thread = _ref[_i];
op = thread.firstChild;
a = $.el('a', { a = $.el('a', {
textContent: '[ - ]' textContent: '[ - ]'
}); });
$.bind(a, 'click', threadHiding.cb.hide); $.bind(a, 'click', threadHiding.cb.hide);
$.prepend(thread, a); $.prepend(op, a);
id = $('input[value=delete]', thread).name; _results.push(op.id in hiddenThreads ? threadHiding.hideHide(thread) : void 0);
_results.push(id in hiddenThreads ? threadHiding.hideHide(thread) : void 0);
} }
return _results; return _results;
}, },
@ -1485,7 +1485,18 @@
return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads); return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads);
}, },
thread: function(node) { thread: function(node) {
var div; var div, op;
op = $.el('div', {
className: 'op'
});
$.before(node, op);
while (node.nodeName !== 'BLOCKQUOTE') {
$.append(op, node);
node = op.nextSibling;
}
$.append(op, node);
op.id = $('input[name]', op).name;
node = op;
div = $.el('div', { div = $.el('div', {
className: 'thread' className: 'thread'
}); });

View File

@ -1083,13 +1083,13 @@ threadHiding =
hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {} hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {}
for thread in $$ 'div.thread' for thread in $$ 'div.thread'
op = thread.firstChild
a = $.el 'a', a = $.el 'a',
textContent: '[ - ]' textContent: '[ - ]'
$.bind a, 'click', threadHiding.cb.hide $.bind a, 'click', threadHiding.cb.hide
$.prepend thread, a $.prepend op, a
id = $('input[value=delete]', thread).name if op.id of hiddenThreads
if id of hiddenThreads
threadHiding.hideHide thread threadHiding.hideHide thread
cb: cb:
@ -1147,6 +1147,17 @@ threadHiding =
$.setValue "hiddenThread/#{g.BOARD}/", hiddenThreads $.setValue "hiddenThread/#{g.BOARD}/", hiddenThreads
thread: (node) -> thread: (node) ->
op = $.el 'div',
className: 'op'
$.before node, op
while node.nodeName isnt 'BLOCKQUOTE'
$.append op, node
node = op.nextSibling
$.append op, node #add the blockquote
op.id = $('input[name]', op).name
node = op
div = $.el 'div', div = $.el 'div',
className: 'thread' className: 'thread'
$.before node, div $.before node, div