diff --git a/4chan_x.js b/4chan_x.js index 8d53ad4c2..3b1c18b1f 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, 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, 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, x, 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; @@ -242,6 +242,9 @@ return object; }; $.extend($, { + tn: function(s) { + return d.createTextNode(s); + }, replace: function(root, el) { return root.parentNode.replaceChild(el, root); }, @@ -365,9 +368,6 @@ } return _results; }; - tn = function(s) { - return d.createTextNode(s); - }; x = function(path, root) { if (root == null) { root = d.body; @@ -1516,7 +1516,7 @@ textContent: thread.text, href: "/" + board + "/res/" + thread.id }); - mv(a, tn(' '), link, $.el('br'), div); + mv(a, $.tn(' '), link, $.el('br'), div); } } old = $('#watcher div:last-child'); @@ -1806,7 +1806,7 @@ textContent: names[i], href: prefixes[i] + suffix }); - mv(tn(' '), link, span); + mv($.tn(' '), link, span); _results.push(i++); } return _results; @@ -1860,7 +1860,7 @@ }); $.bind(a, 'click', report); inAfter(el, a); - _results.push(inAfter(el, tn(' '))); + _results.push(inAfter(el, $.tn(' '))); } return _results; }); @@ -1931,7 +1931,7 @@ className: 'pointer' }); $.bind(down, 'click', replyNav); - mv(tn(' '), up, tn(' '), down, span); + mv($.tn(' '), up, $.tn(' '), down, span); _results.push(inAfter(el, span)); } return _results; @@ -2030,7 +2030,7 @@ textContent: textContent, href: href }); - mv(up, tn(' '), down, span); + mv(up, $.tn(' '), down, span); $.before(el, span); } if (location.hash === '#p0') { diff --git a/script.coffee b/script.coffee index f32234233..1ac4c8e6b 100644 --- a/script.coffee +++ b/script.coffee @@ -145,6 +145,8 @@ $.extend = (object, properties) -> object $.extend $, + tn: (s) -> + d.createTextNode s replace: (root, el) -> root.parentNode.replaceChild el, root hide: (el) -> @@ -239,8 +241,6 @@ slice = (arr, id) -> arr.splice i, 1 return arr i++ -tn = (s) -> - d.createTextNode s x = (path, root=d.body) -> d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null). singleNodeValue @@ -1154,7 +1154,7 @@ watcherUpdate = -> link = $.el 'a', textContent: thread.text href: "/#{board}/res/#{thread.id}" - mv a, tn(' '), link, $.el('br'), div + mv a, $.tn(' '), link, $.el('br'), div old = $('#watcher div:last-child') $.replace(old, div) @@ -1409,7 +1409,7 @@ if getConfig 'Sauce' link = $.el 'a', textContent: names[i] href: prefixes[i] + suffix - mv tn(' '), link, span + mv $.tn(' '), link, span i++ if getConfig 'Reply Hiding' @@ -1440,7 +1440,7 @@ if getConfig 'Quick Report' className: 'pointer' $.bind a, 'click', report inAfter el, a - inAfter el, tn(' ') + inAfter el, $.tn(' ') if getConfig 'Thread Watcher' #create watcher @@ -1492,7 +1492,7 @@ if getConfig 'Reply Navigation' textContent: '▼' className: 'pointer' $.bind down, 'click', replyNav - mv tn(' '), up, tn(' '), down, span + mv $.tn(' '), up, $.tn(' '), down, span inAfter el, span if getConfig 'Keybinds' @@ -1566,7 +1566,7 @@ else #not reply className: 'pointer' textContent: textContent href: href - mv up, tn(' '), down, span + mv up, $.tn(' '), down, span $.before el, span if location.hash is '#p0' window.location = window.location