rm -> $.remove

This commit is contained in:
James Campos 2011-03-26 23:02:25 -07:00
parent 68c2a38f3a
commit 1751525e58
2 changed files with 26 additions and 31 deletions

View File

@ -56,7 +56,7 @@
*/ */
(function() { (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, getTime, hide, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, inBefore, 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, replace, replyNav, report, request, rm, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tn, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, x, 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, getTime, hide, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, inBefore, 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, replace, replyNav, report, request, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tn, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
var __slice = Array.prototype.slice; var __slice = Array.prototype.slice;
if (typeof console != "undefined" && console !== null) { if (typeof console != "undefined" && console !== null) {
log = console.log; log = console.log;
@ -248,7 +248,7 @@
removeClass: function(el, className) { removeClass: function(el, className) {
return el.className = el.className.replace(' ' + className, ''); return el.className = el.className.replace(' ' + className, '');
}, },
rm: function(el) { remove: function(el) {
return el.parentNode.removeChild(el); return el.parentNode.removeChild(el);
}, },
append: function(parent, child) { append: function(parent, child) {
@ -351,9 +351,6 @@
inBefore = function(root, el) { inBefore = function(root, el) {
return root.parentNode.insertBefore(el, root); return root.parentNode.insertBefore(el, root);
}; };
rm = function(el) {
return el.parentNode.removeChild(el);
};
replace = function(root, el) { replace = function(root, el) {
return root.parentNode.replaceChild(el, root); return root.parentNode.replaceChild(el, root);
}; };
@ -398,7 +395,7 @@
closeQR = function() { closeQR = function() {
var div; var div;
div = this.parentNode.parentNode; div = this.parentNode.parentNode;
return rm(div); return $.remove(div);
}; };
clearHidden = function() { clearHidden = function() {
GM_deleteValue("hiddenReplies/" + g.BOARD + "/"); GM_deleteValue("hiddenReplies/" + g.BOARD + "/");
@ -456,7 +453,7 @@
num = board === 'b' ? 3 : 5; num = board === 'b' ? 3 : 5;
table = x("following::br[@clear][1]/preceding::table[" + num + "]", span); table = x("following::br[@clear][1]/preceding::table[" + num + "]", span);
while ((prev = table.previousSibling) && (prev.nodeName === 'TABLE')) { while ((prev = table.previousSibling) && (prev.nodeName === 'TABLE')) {
rm(prev); $.remove(prev);
} }
span.textContent = span.textContent.replace('-', '+'); span.textContent = span.textContent.replace('-', '+');
return; return;
@ -694,7 +691,7 @@
}; };
imageThumb = function(thumb) { imageThumb = function(thumb) {
thumb.className = ''; thumb.className = '';
return rm(thumb.nextSibling); return $.remove(thumb.nextSibling);
}; };
keydown = function(e) { keydown = function(e) {
var kc; var kc;
@ -715,7 +712,7 @@
kc = g.keyCode; kc = g.keyCode;
char = g.char; char = g.char;
if (kc === 27) { if (kc === 27) {
rm($('#qr')); $.remove($('#qr'));
return e.preventDefault(); return e.preventDefault();
} else if (e.ctrlKey && char === "S") { } else if (e.ctrlKey && char === "S") {
ta = d.activeElement; ta = d.activeElement;
@ -903,7 +900,7 @@
span.textContent = span.textContent.replace('X Loading...', '- '); span.textContent = span.textContent.replace('X Loading...', '- ');
span.previousSibling.innerHTML = opbq.innerHTML; span.previousSibling.innerHTML = opbq.innerHTML;
while ((next = span.nextSibling) && !next.clear) { while ((next = span.nextSibling) && !next.clear) {
rm(next); $.remove(next);
} }
if (next) { if (next) {
_results = []; _results = [];
@ -931,7 +928,7 @@
options = function() { options = function() {
var checked, description, div, hiddenNum, html, input, option, value, _i, _len, _ref; var checked, description, div, hiddenNum, html, input, option, value, _i, _len, _ref;
if (div = $('#options')) { if (div = $('#options')) {
rm(div); $.remove(div);
return; return;
} }
hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length; hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length;
@ -1018,7 +1015,7 @@
if (getConfig('Persistent QR')) { if (getConfig('Persistent QR')) {
qr.refresh(dialog); qr.refresh(dialog);
} else { } else {
$.rm(dialog); $.remove(dialog);
} }
} }
} else { } else {
@ -1044,7 +1041,7 @@
submit: function(e) { submit: function(e) {
var recaptcha, span; var recaptcha, span;
if (span = this.nextSibling) { if (span = this.nextSibling) {
$.rm(span); $.remove(span);
} }
recaptcha = $('input[name=recaptcha_response_field]', this); recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) { if (recaptcha.value) {
@ -1110,7 +1107,7 @@
_ref = $$('script', clone); _ref = $$('script', clone);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
script = _ref[_i]; script = _ref[_i];
$.rm(script); $.remove(script);
} }
clone.target = 'iframe'; clone.target = 'iframe';
$.bind(clone, 'submit', qr.cb.submit); $.bind(clone, 'submit', qr.cb.submit);
@ -1259,7 +1256,7 @@
div = this.parentNode; div = this.parentNode;
table = div.nextSibling; table = div.nextSibling;
show(table); show(table);
rm(div); $.remove(div);
id = $('td.reply, td.replyhl', table).id; id = $('td.reply, td.replyhl', table).id;
slice(g.hiddenReplies, id); slice(g.hiddenReplies, id);
return GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies)); return GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies));
@ -1917,7 +1914,7 @@
_results = []; _results = [];
for (_j = 0, _len2 = trips.length; _j < _len2; _j++) { for (_j = 0, _len2 = trips.length; _j < _len2; _j++) {
trip = trips[_j]; trip = trips[_j];
_results.push(trip.parentNode.nodeName === 'A' ? rm(trip.parentNode) : rm(trip)); _results.push(trip.parentNode.nodeName === 'A' ? $.remove(trip.parentNode) : $.remove(trip));
} }
return _results; return _results;
}); });

View File

@ -149,7 +149,7 @@ $.extend $,
el.className += ' ' + className el.className += ' ' + className
removeClass: (el, className) -> removeClass: (el, className) ->
el.className = el.className.replace ' ' + className, '' el.className = el.className.replace ' ' + className, ''
rm: (el) -> remove: (el) ->
el.parentNode.removeChild el el.parentNode.removeChild el
append: (parent, child) -> append: (parent, child) ->
parent.appendChild child parent.appendChild child
@ -228,8 +228,6 @@ inAfter = (root, el) ->
root.parentNode.insertBefore el, root.nextSibling root.parentNode.insertBefore el, root.nextSibling
inBefore = (root, el) -> inBefore = (root, el) ->
root.parentNode.insertBefore el, root root.parentNode.insertBefore el, root
rm = (el) ->
el.parentNode.removeChild el
replace = (root, el) -> replace = (root, el) ->
root.parentNode.replaceChild el, root root.parentNode.replaceChild el, root
show = (el) -> show = (el) ->
@ -261,7 +259,7 @@ autoWatch = ->
closeQR = -> closeQR = ->
div = @parentNode.parentNode div = @parentNode.parentNode
rm div $.remove div
clearHidden = -> clearHidden = ->
#'hidden' might be misleading; it's the number of IDs we're *looking* for, #'hidden' might be misleading; it's the number of IDs we're *looking* for,
@ -313,7 +311,7 @@ expandThread = ->
num = if board is 'b' then 3 else 5 num = if board is 'b' then 3 else 5
table = x "following::br[@clear][1]/preceding::table[#{num}]", span table = x "following::br[@clear][1]/preceding::table[#{num}]", span
while (prev = table.previousSibling) and (prev.nodeName is 'TABLE') while (prev = table.previousSibling) and (prev.nodeName is 'TABLE')
rm prev $.remove prev
span.textContent = span.textContent.replace '-', '+' span.textContent = span.textContent.replace '-', '+'
return return
span.textContent = span.textContent.replace '+', 'X Loading...' span.textContent = span.textContent.replace '+', 'X Loading...'
@ -508,7 +506,7 @@ imageResize = (cw, ch, imageType, image) ->
imageThumb = (thumb) -> imageThumb = (thumb) ->
thumb.className = '' thumb.className = ''
rm thumb.nextSibling $.remove thumb.nextSibling
keydown = (e) -> keydown = (e) ->
kc = e.keyCode kc = e.keyCode
@ -525,7 +523,7 @@ keyModeInsert = (e) ->
kc = g.keyCode kc = g.keyCode
char = g.char char = g.char
if kc is 27 #escape if kc is 27 #escape
rm $ '#qr' $.remove $ '#qr'
e.preventDefault() e.preventDefault()
else if e.ctrlKey and char is "S" else if e.ctrlKey and char is "S"
ta = d.activeElement ta = d.activeElement
@ -667,7 +665,7 @@ onloadThread = (responseText, span) ->
#make sure all comments are fully expanded #make sure all comments are fully expanded
span.previousSibling.innerHTML = opbq.innerHTML span.previousSibling.innerHTML = opbq.innerHTML
while (next = span.nextSibling) and not next.clear#<br clear> while (next = span.nextSibling) and not next.clear#<br clear>
rm next $.remove next
if next if next
for reply in replies for reply in replies
inBefore next, x('ancestor::table', reply) inBefore next, x('ancestor::table', reply)
@ -684,7 +682,7 @@ changeValue = ->
options = -> options = ->
if div = $ '#options' if div = $ '#options'
rm div $.remove div
return return
hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length
@ -758,7 +756,7 @@ qr =
if getConfig 'Persistent QR' if getConfig 'Persistent QR'
qr.refresh dialog qr.refresh dialog
else else
$.rm dialog $.remove dialog
else else
error = $.el 'span', error = $.el 'span',
className: 'error' className: 'error'
@ -775,7 +773,7 @@ qr =
submit: (e) -> submit: (e) ->
if span = @nextSibling if span = @nextSibling
$.rm span $.remove span
recaptcha = $('input[name=recaptcha_response_field]', this) recaptcha = $('input[name=recaptcha_response_field]', this)
if recaptcha.value if recaptcha.value
qr.autohide.set() qr.autohide.set()
@ -831,7 +829,7 @@ qr =
clone = $('form[name=post]').cloneNode(true) clone = $('form[name=post]').cloneNode(true)
for script in $$ 'script', clone for script in $$ 'script', clone
$.rm script $.remove script
clone.target = 'iframe' clone.target = 'iframe'
$.bind clone, 'submit', qr.cb.submit $.bind clone, 'submit', qr.cb.submit
$.bind $('input[name=recaptcha_response_field]', clone), 'keydown', recaptchaListener $.bind $('input[name=recaptcha_response_field]', clone), 'keydown', recaptchaListener
@ -936,7 +934,7 @@ showReply = ->
div = @parentNode div = @parentNode
table = div.nextSibling table = div.nextSibling
show table show table
rm div $.remove div
id = $('td.reply, td.replyhl', table).id id = $('td.reply, td.replyhl', table).id
slice g.hiddenReplies, id slice g.hiddenReplies, id
GM_setValue "hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies) GM_setValue "hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)
@ -1481,9 +1479,9 @@ if getConfig 'Anonymize'
trips = $$('span.postertrip', root) trips = $$('span.postertrip', root)
for trip in trips for trip in trips
if trip.parentNode.nodeName is 'A' if trip.parentNode.nodeName is 'A'
rm trip.parentNode $.remove trip.parentNode
else else
rm trip $.remove trip
if getConfig 'Reply Navigation' if getConfig 'Reply Navigation'
g.callbacks.push (root) -> g.callbacks.push (root) ->