From 29da4807e43a57ff0977f0d2273923ac79cce544 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 9 Dec 2014 21:29:03 -0700 Subject: [PATCH] I installed Pale Moon. --- builds/appchan-x.user.js | 22 ++++++++++++++-------- builds/crx/script.js | 20 +++++++++++++------- src/General/Main.coffee | 2 +- src/General/lib/$.coffee | 10 ++++++---- src/Quotelinks/QuoteBacklink.coffee | 2 +- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index d54391b0b..90a474e3c 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -2750,15 +2750,21 @@ }; $.addClass = function() { - var className, el, _ref; - el = arguments[0], className = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - return (_ref = el.classList).add.apply(_ref, className); + var className, classNames, el, _i, _len; + el = arguments[0], classNames = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + for (_i = 0, _len = classNames.length; _i < _len; _i++) { + className = classNames[_i]; + el.classList.add(className); + } }; $.rmClass = function() { - var className, el, _ref; - el = arguments[0], className = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - return (_ref = el.classList).remove.apply(_ref, className); + var className, classNames, el, _i, _len; + el = arguments[0], classNames = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + for (_i = 0, _len = classNames.length; _i < _len; _i++) { + className = classNames[_i]; + el.classList.remove(className); + } }; $.toggleClass = function(el, className) { @@ -7497,7 +7503,7 @@ var a, frag, hash, text; $.addClass(quoted.nodes.post, 'quoted'); frag = QuoteBacklink.frag.cloneNode(true); - a = frag.lastElementChild; + a = frag.querySelector("a:last-of-type"); a.href = Build.path(quoter.board.ID, quoter.thread.ID, quoter.ID); a.textContent = text = Conf['backlink'].replace(/%id/g, quoter.ID); if (quoter.isDead) { @@ -18160,7 +18166,7 @@ })); $.event('4chanXInitFinished'); test = $.el('span'); - test.classList.add('a', 'b'); + $.addClass(test, 'a', 'b'); if (test.className !== 'a b' && Conf['Show Support Message']) { new Notice('warning', "Your version of Firefox is outdated (v26 minimum) and appchan x may not operate correctly.", 30); } diff --git a/builds/crx/script.js b/builds/crx/script.js index 9b5628c7e..7be3032fa 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -2721,15 +2721,21 @@ }; $.addClass = function() { - var className, el, _ref; - el = arguments[0], className = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - return (_ref = el.classList).add.apply(_ref, className); + var className, classNames, el, _i, _len; + el = arguments[0], classNames = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + for (_i = 0, _len = classNames.length; _i < _len; _i++) { + className = classNames[_i]; + el.classList.add(className); + } }; $.rmClass = function() { - var className, el, _ref; - el = arguments[0], className = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - return (_ref = el.classList).remove.apply(_ref, className); + var className, classNames, el, _i, _len; + el = arguments[0], classNames = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + for (_i = 0, _len = classNames.length; _i < _len; _i++) { + className = classNames[_i]; + el.classList.remove(className); + } }; $.toggleClass = function(el, className) { @@ -7518,7 +7524,7 @@ var a, frag, hash, text; $.addClass(quoted.nodes.post, 'quoted'); frag = QuoteBacklink.frag.cloneNode(true); - a = frag.lastElementChild; + a = frag.querySelector("a:last-of-type"); a.href = Build.path(quoter.board.ID, quoter.thread.ID, quoter.ID); a.textContent = text = Conf['backlink'].replace(/%id/g, quoter.ID); if (quoter.isDead) { diff --git a/src/General/Main.coffee b/src/General/Main.coffee index dd97750aa..56be2a75f 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -215,7 +215,7 @@ Main = <% if (type === 'userscript') { %> test = $.el 'span' - test.classList.add 'a', 'b' + $.addClass test, 'a', 'b' if test.className isnt 'a b' and Conf['Show Support Message'] new Notice 'warning', "Your version of Firefox is outdated (v<%= meta.min.firefox %> minimum) and <%= meta.name %> may not operate correctly.", 30 diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index e2454f6d9..18bc3070f 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -116,11 +116,13 @@ $.X = (path, root) -> # XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7 d.evaluate path, root, null, 7, null -$.addClass = (el, className...) -> - el.classList.add className... +$.addClass = (el, classNames...) -> + el.classList.add className for className in classNames + return -$.rmClass = (el, className...) -> - el.classList.remove className... +$.rmClass = (el, classNames...) -> + el.classList.remove className for className in classNames + return $.toggleClass = (el, className) -> el.classList.toggle className diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index dfb1e3156..608f17b55 100755 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -53,7 +53,7 @@ QuoteBacklink = buildBacklink: (quoted, quoter) -> $.addClass quoted.nodes.post, 'quoted' frag = QuoteBacklink.frag.cloneNode true - a = frag.lastElementChild + a = frag.querySelector "a:last-of-type" a.href = Build.path quoter.board.ID, quoter.thread.ID, quoter.ID a.textContent = text = Conf['backlink'].replace /%id/g, quoter.ID if quoter.isDead