From b8dc8041f518204c332e66735b6e7937c71782b1 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 7 Jan 2014 21:26:13 -0700 Subject: [PATCH] More work on ThreadUpdater.disconnect() --- builds/4chan-X.user.js | 7 ++++++- builds/crx/script.js | 7 ++++++- src/Monitoring/ThreadUpdater.coffee | 10 ++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index ec2b9e6ac..e346a9b75 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -8767,7 +8767,7 @@ }); $.on(this.settings, 'click', this.intervalShortcut); subEntries.push({ - el: settings + el: this.settings }); $.event('AddMenuEntry', this.entry = { type: 'header', @@ -8802,7 +8802,12 @@ $.off(input, 'change', this.cb.update); } $.off(this.settings, 'click', this.intervalShortcut); + $.off(window, 'online offline', this.cb.online); + $.off(d, 'QRPostSuccessful', this.cb.checkpost); + $.off(d, 'visibilitychange', this.cb.visibility); $.event('rmMenuEntry', this.entry); + this.set('timer', null); + this.set('status', 'Offline', 'warning'); _ref1 = ['checkPostCount', 'timer', 'status', 'isUpdating', 'entry', 'dialog', 'thread', 'root', 'lastPost', 'outdateCount', 'online']; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { name = _ref1[_j]; diff --git a/builds/crx/script.js b/builds/crx/script.js index 78e2a8a52..f9380b8d3 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -8750,7 +8750,7 @@ }); $.on(this.settings, 'click', this.intervalShortcut); subEntries.push({ - el: settings + el: this.settings }); $.event('AddMenuEntry', this.entry = { type: 'header', @@ -8785,7 +8785,12 @@ $.off(input, 'change', this.cb.update); } $.off(this.settings, 'click', this.intervalShortcut); + $.off(window, 'online offline', this.cb.online); + $.off(d, 'QRPostSuccessful', this.cb.checkpost); + $.off(d, 'visibilitychange', this.cb.visibility); $.event('rmMenuEntry', this.entry); + this.set('timer', null); + this.set('status', 'Offline', 'warning'); _ref1 = ['checkPostCount', 'timer', 'status', 'isUpdating', 'entry', 'dialog', 'thread', 'root', 'lastPost', 'outdateCount', 'online']; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { name = _ref1[_j]; diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index b9409eefe..03f65ee3a 100755 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -48,7 +48,7 @@ ThreadUpdater = $.on @settings, 'click', @intervalShortcut - subEntries.push el: settings + subEntries.push el: @settings $.event 'AddMenuEntry', @entry = type: 'header' @@ -78,10 +78,16 @@ ThreadUpdater = $.off input, 'change', @cb.scrollBG $.off input, 'change', @cb.update - $.off @settings, 'click', @intervalShortcut + $.off @settings, 'click', @intervalShortcut + $.off window, 'online offline', @cb.online + $.off d, 'QRPostSuccessful', @cb.checkpost + $.off d, 'visibilitychange', @cb.visibility $.event 'rmMenuEntry', @entry + @set 'timer', null + @set 'status', 'Offline', 'warning' + delete @[name] for name in ['checkPostCount', 'timer', 'status', 'isUpdating', 'entry', 'dialog', 'thread', 'root', 'lastPost', 'outdateCount', 'online'] Thread.callbacks.rm 'Thread Updater'