From f78585381eebf4d586c59844b0e454d1a62a9e26 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 9 Apr 2011 21:10:46 -0700 Subject: [PATCH] put op into its own div --- 4chan_x.js | 21 ++++++++++++++++----- script.coffee | 17 ++++++++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index fb61f5d76..d63381234 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1411,7 +1411,7 @@ }; threadHiding = { 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] > *'); threadHiding.thread(node); hiddenThreads = $.getValue("hiddenThread/" + g.BOARD + "/", {}); @@ -1419,13 +1419,13 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { thread = _ref[_i]; + op = thread.firstChild; a = $.el('a', { textContent: '[ - ]' }); $.bind(a, 'click', threadHiding.cb.hide); - $.prepend(thread, a); - id = $('input[value=delete]', thread).name; - _results.push(id in hiddenThreads ? threadHiding.hideHide(thread) : void 0); + $.prepend(op, a); + _results.push(op.id in hiddenThreads ? threadHiding.hideHide(thread) : void 0); } return _results; }, @@ -1485,7 +1485,18 @@ return $.setValue("hiddenThread/" + g.BOARD + "/", hiddenThreads); }, 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', { className: 'thread' }); diff --git a/script.coffee b/script.coffee index 222c40d66..0ec706edc 100644 --- a/script.coffee +++ b/script.coffee @@ -1083,13 +1083,13 @@ threadHiding = hiddenThreads = $.getValue "hiddenThread/#{g.BOARD}/", {} for thread in $$ 'div.thread' + op = thread.firstChild a = $.el 'a', textContent: '[ - ]' $.bind a, 'click', threadHiding.cb.hide - $.prepend thread, a + $.prepend op, a - id = $('input[value=delete]', thread).name - if id of hiddenThreads + if op.id of hiddenThreads threadHiding.hideHide thread cb: @@ -1147,6 +1147,17 @@ threadHiding = $.setValue "hiddenThread/#{g.BOARD}/", hiddenThreads 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', className: 'thread' $.before node, div