From 2f2104a672bd27fece8d4e542e3f6a0a98edd1df Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 11 Oct 2011 13:15:57 -0700 Subject: [PATCH] try / catch --- 4chan_x.user.js | 15 +++++++++++---- script.coffee | 7 ++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 368b15673..37b1ad489 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2966,7 +2966,7 @@ }; Main = { init: function() { - var cutoff, hiddenThreads, id, lastChecked, nodes, now, timestamp, tzOffset, _ref; + var callback, cutoff, hiddenThreads, id, lastChecked, nodes, now, timestamp, tzOffset, _i, _len, _ref, _ref2; $.unbind(document, 'DOMContentLoaded', Main.init); if (location.hostname === 'sys.4chan.org') { QR.sys(); @@ -3096,9 +3096,16 @@ } } nodes = $$('.op, a + table'); - g.callbacks.forEach(function(callback) { - return nodes.forEach(callback); - }); + _ref2 = g.callbacks; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + callback = _ref2[_i]; + try { + nodes.forEach(callback); + } catch (e) { + alert(e); + continue; + } + } $.bind($('form[name=delform]'), 'DOMNodeInserted', nodeInserted); options.init(); if (!$.get('firstrun')) { diff --git a/script.coffee b/script.coffee index a7f225412..e92659557 100644 --- a/script.coffee +++ b/script.coffee @@ -2362,7 +2362,12 @@ Main = expandComment.init() nodes = $$ '.op, a + table' - g.callbacks.forEach (callback) -> nodes.forEach callback + for callback in g.callbacks + try + nodes.forEach callback + catch e + alert e + continue $.bind $('form[name=delform]'), 'DOMNodeInserted', nodeInserted options.init()