diff --git a/4chan_x.user.js b/4chan_x.user.js index 37b1ad489..cd78e033d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -61,7 +61,7 @@ */ (function() { - var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, QR, SECOND, Time, anonymize, conf, config, d, expandComment, expandThread, filter, firstRun, flatten, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, pathname, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, temp, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; + var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, QR, SECOND, Time, anonymize, conf, config, d, expandComment, expandThread, filter, firstRun, flatten, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, options, pathname, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, temp, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; var __slice = Array.prototype.slice; config = { main: { @@ -2746,15 +2746,6 @@ } return location.href = url; }; - nodeInserted = function(e) { - var target; - target = e.target; - if (target.nodeName === 'TABLE') { - return g.callbacks.forEach(function(callback) { - return callback(target); - }); - } - }; imgHover = { init: function() { return g.callbacks.push(function(root) { @@ -3106,7 +3097,7 @@ continue; } } - $.bind($('form[name=delform]'), 'DOMNodeInserted', nodeInserted); + $.bind($('form[name=delform]'), 'DOMNodeInserted', Main.node); options.init(); if (!$.get('firstrun')) { return firstRun.init(); @@ -3119,6 +3110,24 @@ return QR.receive(data); } }, + node: function(e) { + var callback, target, _i, _len, _ref, _results; + target = e.target; + if (target.nodeName !== 'TABLE') { + return; + } + _ref = g.callbacks; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + callback = _ref[_i]; + try { + nodes.forEach(callback); + } catch (e) { + continue; + } + } + return _results; + }, css: '\ /* dialog styling */\ div.dialog {\ diff --git a/script.coffee b/script.coffee index e92659557..9fbf136a3 100644 --- a/script.coffee +++ b/script.coffee @@ -2024,11 +2024,6 @@ redirect = -> url = "http://boards.4chan.org/#{g.BOARD}" location.href = url -nodeInserted = (e) -> - {target} = e - if target.nodeName is 'TABLE' - g.callbacks.forEach (callback) -> callback target - imgHover = init: -> g.callbacks.push (root) -> @@ -2368,7 +2363,7 @@ Main = catch e alert e continue - $.bind $('form[name=delform]'), 'DOMNodeInserted', nodeInserted + $.bind $('form[name=delform]'), 'DOMNodeInserted', Main.node options.init() unless $.get 'firstrun' @@ -2379,6 +2374,15 @@ Main = if origin is 'http://sys.4chan.org' QR.receive data + node: (e) -> + {target} = e + return unless target.nodeName is 'TABLE' + for callback in g.callbacks + try + nodes.forEach callback + catch e + continue + css: ' /* dialog styling */ div.dialog {