diff --git a/4chan_x.js b/4chan_x.js
index c076165ad..4007b65b1 100644
--- a/4chan_x.js
+++ b/4chan_x.js
@@ -56,7 +56,7 @@
*/
(function() {
- var $, $$, DAY, a, arr, as, autoWatch, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, g, getConfig, getThread, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, log, mv, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replyNav, report, request, scroll, scrollThread, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, zeroPad, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
+ var $, $$, DAY, a, arr, as, autoWatch, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, g, getConfig, getThread, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, log, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replyNav, report, request, scroll, scrollThread, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, zeroPad, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
var __slice = Array.prototype.slice;
if (typeof console != "undefined" && console !== null) {
log = console.log;
@@ -269,8 +269,15 @@
remove: function(el) {
return el.parentNode.removeChild(el);
},
- append: function(parent, child) {
- return parent.appendChild(child);
+ append: function() {
+ var child, children, parent, _i, _len, _results;
+ parent = arguments[0], children = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ _results = [];
+ for (_i = 0, _len = children.length; _i < _len; _i++) {
+ child = children[_i];
+ _results.push(parent.appendChild(child));
+ }
+ return _results;
},
before: function(root, el) {
return root.parentNode.insertBefore(el, root);
@@ -344,16 +351,6 @@
}
return _results;
};
- mv = function() {
- var child, children, parent, _i, _j, _len, _results;
- children = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), parent = arguments[_i++];
- _results = [];
- for (_j = 0, _len = children.length; _j < _len; _j++) {
- child = children[_j];
- _results.push(parent.appendChild(child));
- }
- return _results;
- };
getConfig = function(name) {
return GM_getValue(name, config[name][0]);
};
@@ -504,7 +501,7 @@
});
$.bind(a, 'click', showReply);
div = $.el('div');
- mv(a, div);
+ $.append(div, a);
return $.before(table, div);
}
};
@@ -908,7 +905,7 @@
_results2 = [];
for (_j = 0, _len2 = replies.length; _j < _len2; _j++) {
reply = replies[_j];
- _results2.push(mv($.x('ancestor::table', reply), div));
+ _results2.push($.append(div, $.x('ancestor::table', reply)));
}
return _results2;
}
@@ -948,7 +945,7 @@
$('a.sauce', div).addEventListener('click', editSauce, true);
$('textarea', div).addEventListener('change', changeValue, true);
$('input[type="button"]', div).addEventListener('click', clearHidden, true);
- return mv(div, d.body);
+ return $.append(d.body, div);
};
parseResponse = function(responseText) {
var body, opbq, replies;
@@ -1277,13 +1274,13 @@
className: 'pointer'
});
$.bind(a, 'click', hideThread);
- mv(a, div);
+ $.append(div, a);
$.before(current, div);
while (!current.clear) {
- mv(current, div);
+ $.append(div, current);
current = div.nextSibling;
}
- mv(current, div);
+ $.append(div, current);
current = div.nextSibling;
id = $('input[value="delete"]', div).name;
div.id = id;
@@ -1516,7 +1513,7 @@
textContent: thread.text,
href: "/" + board + "/res/" + thread.id
});
- mv(a, $.tn(' '), link, $.el('br'), div);
+ $.append(div, a, $.tn(' '), link, $.el('br'));
}
}
old = $('#watcher div:last-child');
@@ -1806,7 +1803,7 @@
textContent: names[i],
href: prefixes[i] + suffix
});
- mv($.tn(' '), link, span);
+ $.append(span, $.tn(' '), link);
_results.push(i++);
}
return _results;
@@ -1871,7 +1868,7 @@
top: '50px',
left: '0px'
}, html);
- mv(watcher, d.body);
+ $.append(d.body, watcher);
watcherUpdate();
threads = g.watched[g.BOARD] || [];
inputs = $$('form > input[value="delete"], div > input[value="delete"]');
@@ -1931,7 +1928,7 @@
className: 'pointer'
});
$.bind(down, 'click', replyNav);
- mv($.tn(' '), up, $.tn(' '), down, span);
+ $.append(span, $.tn(' '), up, $.tn(' '), down);
_results.push(inAfter(el, span));
}
return _results;
@@ -2030,7 +2027,7 @@
textContent: textContent,
href: href
});
- mv(up, $.tn(' '), down, span);
+ $.append(span, up, $.tn(' '), down);
$.before(el, span);
}
if (location.hash === '#p0') {
diff --git a/script.coffee b/script.coffee
index 2e8edb99a..ce3977f85 100644
--- a/script.coffee
+++ b/script.coffee
@@ -162,8 +162,9 @@ $.extend $,
el.className = el.className.replace ' ' + className, ''
remove: (el) ->
el.parentNode.removeChild el
- append: (parent, child) ->
- parent.appendChild child
+ append: (parent, children...) ->
+ for child in children
+ parent.appendChild child
before: (root, el) ->
root.parentNode.insertBefore el, root
el: (tag, properties) ->
@@ -227,8 +228,6 @@ $.extend $,
$$ = (selector, root=d.body) ->
result = root.querySelectorAll selector
node for node in result
-mv = (children..., parent) ->
- (parent.appendChild child) for child in children
getConfig = (name) ->
GM_getValue name, config[name][0]
inAfter = (root, el) ->
@@ -353,7 +352,7 @@ hideReply = (reply) ->
className: 'pointer'
$.bind a, 'click', showReply
div = $.el 'div'
- mv a, div
+ $.append div, a
$.before table, div
hideThread = (div) ->
@@ -668,7 +667,7 @@ onloadThread = (responseText, span) ->
else#threading
div = span.parentNode
for reply in replies
- mv $.x('ancestor::table', reply), div
+ $.append div, $.x('ancestor::table', reply)
changeCheckbox = ->
GM_setValue @name, @checked
@@ -701,7 +700,7 @@ options = ->
$('a.sauce', div).addEventListener 'click', editSauce, true
$('textarea', div).addEventListener 'change', changeValue, true
$('input[type="button"]', div).addEventListener 'click', clearHidden, true
- mv div, d.body
+ $.append d.body, div
parseResponse = (responseText) ->
body = $.el 'body',
@@ -953,12 +952,12 @@ threadF = (current) ->
textContent: '[ - ]'
className: 'pointer'
$.bind a, 'click', hideThread
- mv a, div
+ $.append div, a
$.before current, div
while (!current.clear)#
- mv current, div
+ $.append div, current
current = div.nextSibling
- mv current, div
+ $.append div, current
current = div.nextSibling
id = $('input[value="delete"]', div).name
div.id = id
@@ -1154,7 +1153,7 @@ watcherUpdate = ->
link = $.el 'a',
textContent: thread.text
href: "/#{board}/res/#{thread.id}"
- mv a, $.tn(' '), link, $.el('br'), div
+ $.append div, a, $.tn(' '), link, $.el('br')
old = $('#watcher div:last-child')
$.replace(old, div)
@@ -1409,7 +1408,7 @@ if getConfig 'Sauce'
link = $.el 'a',
textContent: names[i]
href: prefixes[i] + suffix
- mv $.tn(' '), link, span
+ $.append span, $.tn(' '), link
i++
if getConfig 'Reply Hiding'
@@ -1446,7 +1445,7 @@ if getConfig 'Thread Watcher'
#create watcher
html = '