Merge pull request #519 from aeosynth/rmClass

rmClass
This commit is contained in:
Mayhem 2012-06-03 05:02:16 -07:00
commit ce256e4003
2 changed files with 34 additions and 34 deletions

View File

@ -386,7 +386,7 @@
addClass: function(el, className) { addClass: function(el, className) {
return el.classList.add(className); return el.classList.add(className);
}, },
removeClass: function(el, className) { rmClass: function(el, className) {
return el.classList.remove(className); return el.classList.remove(className);
}, },
rm: function(el) { rm: function(el) {
@ -996,7 +996,7 @@
ReplyHiding.show(root); ReplyHiding.show(root);
for (_i = 0, _len = quotes.length; _i < _len; _i++) { for (_i = 0, _len = quotes.length; _i < _len; _i++) {
quote = quotes[_i]; quote = quotes[_i];
$.removeClass(quote, 'filtered'); $.rmClass(quote, 'filtered');
} }
delete g.hiddenReplies[id]; delete g.hiddenReplies[id];
} else { } else {
@ -1275,7 +1275,7 @@
hl: function(delta, thread) { hl: function(delta, thread) {
var next, post, rect, replies, reply, _i, _len; var next, post, rect, replies, reply, _i, _len;
if (post = $('.reply.highlight', thread)) { if (post = $('.reply.highlight', thread)) {
$.removeClass(post, 'highlight'); $.rmClass(post, 'highlight');
post.removeAttribute('tabindex'); post.removeAttribute('tabindex');
rect = post.getBoundingClientRect(); rect = post.getBoundingClientRect();
if (rect.bottom >= 0 && rect.top <= d.documentElement.clientHeight) { if (rect.bottom >= 0 && rect.top <= d.documentElement.clientHeight) {
@ -1426,7 +1426,7 @@
QR.el.hidden = true; QR.el.hidden = true;
QR.abort(); QR.abort();
d.activeElement.blur(); d.activeElement.blur();
$.removeClass(QR.el, 'dump'); $.rmClass(QR.el, 'dump');
_ref = QR.replies; _ref = QR.replies;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
i = _ref[_i]; i = _ref[_i];
@ -1446,7 +1446,7 @@
return $.id('autohide').checked = true; return $.id('autohide').checked = true;
}, },
unhide: function() { unhide: function() {
$.removeClass(QR.el, 'autohide'); $.rmClass(QR.el, 'autohide');
return $.id('autohide').checked = false; return $.id('autohide').checked = false;
}, },
toggleHide: function() { toggleHide: function() {
@ -1739,7 +1739,7 @@
}; };
_Class.prototype.dragLeave = function() { _Class.prototype.dragLeave = function() {
return $.removeClass(this, 'over'); return $.rmClass(this, 'over');
}; };
_Class.prototype.dragOver = function(e) { _Class.prototype.dragOver = function(e) {
@ -1766,9 +1766,9 @@
_Class.prototype.dragEnd = function() { _Class.prototype.dragEnd = function() {
var el; var el;
$.removeClass(this, 'drag'); $.rmClass(this, 'drag');
if (el = $('.over', this.parentNode)) { if (el = $('.over', this.parentNode)) {
return $.removeClass(el, 'over'); return $.rmClass(el, 'over');
} }
}; };
@ -3105,9 +3105,9 @@
} }
if (el = $.id("p" + id)) { if (el = $.id("p" + id)) {
if (/\bop\b/.test(el.className)) { if (/\bop\b/.test(el.className)) {
$.removeClass(el.parentNode, 'qphl'); $.rmClass(el.parentNode, 'qphl');
} else { } else {
$.removeClass(el, 'qphl'); $.rmClass(el, 'qphl');
} }
clonePost = QuoteInline.clone(id, el); clonePost = QuoteInline.clone(id, el);
if (isBacklink) { if (isBacklink) {
@ -3148,13 +3148,13 @@
inlined = _ref[_i]; inlined = _ref[_i];
div = $.id(inlined.hash.slice(1)); div = $.id(inlined.hash.slice(1));
if (!--div.dataset.forwarded) { if (!--div.dataset.forwarded) {
$.removeClass(div.parentNode, 'forwarded'); $.rmClass(div.parentNode, 'forwarded');
} }
} }
if (/\bbacklink\b/.test(q.className)) { if (/\bbacklink\b/.test(q.className)) {
div = $.id("p" + id); div = $.id("p" + id);
if (!--div.dataset.forwarded) { if (!--div.dataset.forwarded) {
return $.removeClass(div.parentNode, 'forwarded'); return $.rmClass(div.parentNode, 'forwarded');
} }
} }
}, },
@ -3282,9 +3282,9 @@
UI.hoverend(); UI.hoverend();
if (el = $.id(this.hash.slice(1))) { if (el = $.id(this.hash.slice(1))) {
if (/\bop\b/.test(el.className)) { if (/\bop\b/.test(el.className)) {
$.removeClass(el.parentNode, 'qphl'); $.rmClass(el.parentNode, 'qphl');
} else { } else {
$.removeClass(el, 'qphl'); $.rmClass(el, 'qphl');
} }
} }
$.off(this, 'mousemove', UI.hover); $.off(this, 'mousemove', UI.hover);
@ -3551,12 +3551,12 @@
if (g.dead) { if (g.dead) {
$.addClass(Favicon.el, 'dead'); $.addClass(Favicon.el, 'dead');
} else { } else {
$.removeClass(Favicon.el, 'dead'); $.rmClass(Favicon.el, 'dead');
} }
if (count) { if (count) {
$.addClass(Favicon.el, 'unread'); $.addClass(Favicon.el, 'unread');
} else { } else {
$.removeClass(Favicon.el, 'unread'); $.rmClass(Favicon.el, 'unread');
} }
if ($.engine !== 'webkit') { if ($.engine !== 'webkit') {
return $.add(d.head, Favicon.el); return $.add(d.head, Favicon.el);
@ -3849,7 +3849,7 @@
contract: function(thumb) { contract: function(thumb) {
thumb.hidden = false; thumb.hidden = false;
thumb.nextSibling.hidden = true; thumb.nextSibling.hidden = true;
return $.removeClass(thumb.parentNode.parentNode.parentNode, 'image_expanded'); return $.rmClass(thumb.parentNode.parentNode.parentNode, 'image_expanded');
}, },
expand: function(thumb, url) { expand: function(thumb, url) {
var a, img; var a, img;

View File

@ -305,7 +305,7 @@ $.extend $,
singleNodeValue singleNodeValue
addClass: (el, className) -> addClass: (el, className) ->
el.classList.add className el.classList.add className
removeClass: (el, className) -> rmClass: (el, className) ->
el.classList.remove className el.classList.remove className
rm: (el) -> rm: (el) ->
el.parentNode.removeChild el el.parentNode.removeChild el
@ -754,7 +754,7 @@ ReplyHiding =
if /\bstub\b/.test button.className if /\bstub\b/.test button.className
ReplyHiding.show root ReplyHiding.show root
for quote in quotes for quote in quotes
$.removeClass quote, 'filtered' $.rmClass quote, 'filtered'
delete g.hiddenReplies[id] delete g.hiddenReplies[id]
else else
ReplyHiding.hide root ReplyHiding.hide root
@ -928,7 +928,7 @@ Keybinds =
hl: (delta, thread) -> hl: (delta, thread) ->
if post = $ '.reply.highlight', thread if post = $ '.reply.highlight', thread
$.removeClass post, 'highlight' $.rmClass post, 'highlight'
post.removeAttribute 'tabindex' post.removeAttribute 'tabindex'
rect = post.getBoundingClientRect() rect = post.getBoundingClientRect()
if rect.bottom >= 0 and rect.top <= d.documentElement.clientHeight # We're at least partially visible if rect.bottom >= 0 and rect.top <= d.documentElement.clientHeight # We're at least partially visible
@ -1046,7 +1046,7 @@ QR =
QR.el.hidden = true QR.el.hidden = true
QR.abort() QR.abort()
d.activeElement.blur() d.activeElement.blur()
$.removeClass QR.el, 'dump' $.rmClass QR.el, 'dump'
for i in QR.replies for i in QR.replies
QR.replies[0].rm() QR.replies[0].rm()
QR.cooldown.auto = false QR.cooldown.auto = false
@ -1060,7 +1060,7 @@ QR =
$.addClass QR.el, 'autohide' $.addClass QR.el, 'autohide'
$.id('autohide').checked = true $.id('autohide').checked = true
unhide: -> unhide: ->
$.removeClass QR.el, 'autohide' $.rmClass QR.el, 'autohide'
$.id('autohide').checked = false $.id('autohide').checked = false
toggleHide: -> toggleHide: ->
@checked and QR.hide() or QR.unhide() @checked and QR.hide() or QR.unhide()
@ -1299,7 +1299,7 @@ QR =
dragEnter: -> dragEnter: ->
$.addClass @, 'over' $.addClass @, 'over'
dragLeave: -> dragLeave: ->
$.removeClass @, 'over' $.rmClass @, 'over'
dragOver: (e) -> dragOver: (e) ->
e.preventDefault() e.preventDefault()
e.dataTransfer.dropEffect = 'move' e.dataTransfer.dropEffect = 'move'
@ -1315,9 +1315,9 @@ QR =
reply = QR.replies.splice(oldIndex, 1)[0] reply = QR.replies.splice(oldIndex, 1)[0]
QR.replies.splice newIndex, 0, reply QR.replies.splice newIndex, 0, reply
dragEnd: -> dragEnd: ->
$.removeClass @, 'drag' $.rmClass @, 'drag'
if el = $ '.over', @parentNode if el = $ '.over', @parentNode
$.removeClass el, 'over' $.rmClass el, 'over'
rm: -> rm: ->
QR.resetFileInput() QR.resetFileInput()
$.rm @el $.rm @el
@ -2361,9 +2361,9 @@ QuoteInline =
root = root.parentNode root = root.parentNode
if el = $.id "p#{id}" if el = $.id "p#{id}"
if /\bop\b/.test el.className if /\bop\b/.test el.className
$.removeClass el.parentNode, 'qphl' $.rmClass el.parentNode, 'qphl'
else else
$.removeClass el, 'qphl' $.rmClass el, 'qphl'
clonePost = QuoteInline.clone id, el clonePost = QuoteInline.clone id, el
if isBacklink if isBacklink
$.after q.parentNode, clonePost $.after q.parentNode, clonePost
@ -2393,10 +2393,10 @@ QuoteInline =
return unless Conf['Forward Hiding'] return unless Conf['Forward Hiding']
for inlined in $$ '.backlink.inlined', div for inlined in $$ '.backlink.inlined', div
div = $.id inlined.hash[1..] div = $.id inlined.hash[1..]
$.removeClass div.parentNode, 'forwarded' unless --div.dataset.forwarded $.rmClass div.parentNode, 'forwarded' unless --div.dataset.forwarded
if /\bbacklink\b/.test q.className if /\bbacklink\b/.test q.className
div = $.id "p#{id}" div = $.id "p#{id}"
$.removeClass div.parentNode, 'forwarded' unless --div.dataset.forwarded $.rmClass div.parentNode, 'forwarded' unless --div.dataset.forwarded
parse: (req, pathname, id, inline) -> parse: (req, pathname, id, inline) ->
return unless inline.parentNode return unless inline.parentNode
@ -2485,9 +2485,9 @@ QuotePreview =
UI.hoverend() UI.hoverend()
if el = $.id @hash[1..] if el = $.id @hash[1..]
if /\bop\b/.test el.className if /\bop\b/.test el.className
$.removeClass el.parentNode, 'qphl' $.rmClass el.parentNode, 'qphl'
else else
$.removeClass el, 'qphl' $.rmClass el, 'qphl'
$.off @, 'mousemove', UI.hover $.off @, 'mousemove', UI.hover
$.off @, 'mouseout click', QuotePreview.mouseout $.off @, 'mouseout click', QuotePreview.mouseout
parse: (req, id) -> parse: (req, id) ->
@ -2713,11 +2713,11 @@ Unread =
if g.dead if g.dead
$.addClass Favicon.el, 'dead' $.addClass Favicon.el, 'dead'
else else
$.removeClass Favicon.el, 'dead' $.rmClass Favicon.el, 'dead'
if count if count
$.addClass Favicon.el, 'unread' $.addClass Favicon.el, 'unread'
else else
$.removeClass Favicon.el, 'unread' $.rmClass Favicon.el, 'unread'
#`favicon.href = href` doesn't work on Firefox #`favicon.href = href` doesn't work on Firefox
#`favicon.href = href` isn't enough on Opera #`favicon.href = href` isn't enough on Opera
@ -2908,7 +2908,7 @@ ImageExpand =
contract: (thumb) -> contract: (thumb) ->
thumb.hidden = false thumb.hidden = false
thumb.nextSibling.hidden = true thumb.nextSibling.hidden = true
$.removeClass thumb.parentNode.parentNode.parentNode, 'image_expanded' $.rmClass thumb.parentNode.parentNode.parentNode, 'image_expanded'
expand: (thumb, url) -> expand: (thumb, url) ->
# Do not expand images of hidden/filtered replies, or already expanded pictures. # Do not expand images of hidden/filtered replies, or already expanded pictures.