diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 8da2e80c7..55bc2f9d6 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5095,6 +5095,9 @@ }, disconnect: function() { var input; + if (!(Conf['Quote Threading'] && g.VIEW === 'thread')) { + return; + } input = $('input', this.controls); $.off(input, 'change', this.toggle); $.event('rmMenuEntry', this.entry); @@ -8681,6 +8684,9 @@ return d.title = Get.threadExcerpt(this); }, disconnect: function() { + if (g.VIEW !== 'thread' || !Conf['Thread Excerpt']) { + return; + } return Thread.callbacks.disconnect('Thread Excerpt'); } }; @@ -8733,7 +8739,7 @@ return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate); }, disconnect: function() { - if (!Conf['Thread Stats']) { + if (g.VIEW !== 'thread' || !Conf['Thread Stats']) { return; } if (Conf['Updater and Stats in Header']) { @@ -8876,6 +8882,9 @@ }, disconnect: function() { var el, entry, input, name, _i, _j, _len, _len1, _ref, _ref1; + if (g.VIEW !== 'thread' || !Conf['Thread Updater']) { + return; + } $.off(this.timer, 'click', this.update); $.off(this.status, 'click', this.update); if (this.timeoutID) { @@ -9719,7 +9728,7 @@ }, disconnect: function() { var hr, name, _i, _len, _ref; - if (!Unread.db) { + if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Desktop Notifications']) { return; } Unread.db.disconnect(); @@ -10680,6 +10689,9 @@ }, disconnect: function(refresh) { var status, threadID, _ref, _ref1; + if (g.VIEW === 'thread' || !Conf['Thread Expansion']) { + return; + } _ref = ExpandThread.statuses; for (threadID in _ref) { status = _ref[threadID]; @@ -11918,12 +11930,12 @@ g.BOARD.threads = {}; return $.rmAll($('.board')); }, - threadFeatures: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], + features: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], disconnect: function() { - var err, errors, feature, features, name, _i, _len, _ref; - features = g.VIEW === 'thread' ? Navigate.threadFeatures : []; - for (_i = 0, _len = features.length; _i < _len; _i++) { - _ref = features[_i], name = _ref[0], feature = _ref[1]; + var err, errors, feature, name, _i, _len, _ref, _ref1; + _ref = Navigate.features; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + _ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1]; try { feature.disconnect(); } catch (_error) { @@ -11942,10 +11954,10 @@ } }, reconnect: function() { - var err, errors, feature, features, name, _i, _len, _ref; - features = g.VIEW === 'thread' ? Navigate.threadFeatures : []; - for (_i = 0, _len = features.length; _i < _len; _i++) { - _ref = features[_i], name = _ref[0], feature = _ref[1]; + var err, errors, feature, name, _i, _len, _ref, _ref1; + _ref = Navigate.features; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + _ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1]; try { feature.init(); } catch (_error) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 4c57c4a22..e9b844f44 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5098,6 +5098,9 @@ }, disconnect: function() { var input; + if (!(Conf['Quote Threading'] && g.VIEW === 'thread')) { + return; + } input = $('input', this.controls); $.off(input, 'change', this.toggle); $.event('rmMenuEntry', this.entry); @@ -8664,6 +8667,9 @@ return d.title = Get.threadExcerpt(this); }, disconnect: function() { + if (g.VIEW !== 'thread' || !Conf['Thread Excerpt']) { + return; + } return Thread.callbacks.disconnect('Thread Excerpt'); } }; @@ -8716,7 +8722,7 @@ return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate); }, disconnect: function() { - if (!Conf['Thread Stats']) { + if (g.VIEW !== 'thread' || !Conf['Thread Stats']) { return; } if (Conf['Updater and Stats in Header']) { @@ -8859,6 +8865,9 @@ }, disconnect: function() { var el, entry, input, name, _i, _j, _len, _len1, _ref, _ref1; + if (g.VIEW !== 'thread' || !Conf['Thread Updater']) { + return; + } $.off(this.timer, 'click', this.update); $.off(this.status, 'click', this.update); if (this.timeoutID) { @@ -9702,7 +9711,7 @@ }, disconnect: function() { var hr, name, _i, _len, _ref; - if (!Unread.db) { + if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Desktop Notifications']) { return; } Unread.db.disconnect(); @@ -10669,6 +10678,9 @@ }, disconnect: function(refresh) { var status, threadID, _ref, _ref1; + if (g.VIEW === 'thread' || !Conf['Thread Expansion']) { + return; + } _ref = ExpandThread.statuses; for (threadID in _ref) { status = _ref[threadID]; @@ -11907,12 +11919,12 @@ g.BOARD.threads = {}; return $.rmAll($('.board')); }, - threadFeatures: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], + features: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], disconnect: function() { - var err, errors, feature, features, name, _i, _len, _ref; - features = g.VIEW === 'thread' ? Navigate.threadFeatures : []; - for (_i = 0, _len = features.length; _i < _len; _i++) { - _ref = features[_i], name = _ref[0], feature = _ref[1]; + var err, errors, feature, name, _i, _len, _ref, _ref1; + _ref = Navigate.features; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + _ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1]; try { feature.disconnect(); } catch (_error) { @@ -11931,10 +11943,10 @@ } }, reconnect: function() { - var err, errors, feature, features, name, _i, _len, _ref; - features = g.VIEW === 'thread' ? Navigate.threadFeatures : []; - for (_i = 0, _len = features.length; _i < _len; _i++) { - _ref = features[_i], name = _ref[0], feature = _ref[1]; + var err, errors, feature, name, _i, _len, _ref, _ref1; + _ref = Navigate.features; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + _ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1]; try { feature.init(); } catch (_error) { diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index abb9a3ec6..dd722c4e7 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -37,7 +37,7 @@ Navigate = # Delete nodes $.rmAll $ '.board' - threadFeatures: [ + features: [ ['Thread Excerpt', ThreadExcerpt] ['Unread Count', Unread] ['Quote Threading', QuoteThreading] @@ -47,12 +47,7 @@ Navigate = ] disconnect: -> - features = if g.VIEW is 'thread' - Navigate.threadFeatures - else - [] - - for [name, feature] in features + for [name, feature] in Navigate.features try feature.disconnect() catch err @@ -66,12 +61,7 @@ Navigate = return reconnect: -> - features = if g.VIEW is 'thread' - Navigate.threadFeatures - else - [] - - for [name, feature] in features + for [name, feature] in Navigate.features try feature.init() catch err diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 24ac7d7ef..bed91a082 100755 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -10,6 +10,7 @@ ExpandThread = $.on a, 'click', ExpandThread.cbToggle disconnect: (refresh) -> + return if g.VIEW is 'thread' or !Conf['Thread Expansion'] for threadID, status of ExpandThread.statuses status.req?.abort() delete ExpandThread.statuses[threadID] diff --git a/src/Monitoring/ThreadExcerpt.coffee b/src/Monitoring/ThreadExcerpt.coffee index 7398c5423..265ea202c 100755 --- a/src/Monitoring/ThreadExcerpt.coffee +++ b/src/Monitoring/ThreadExcerpt.coffee @@ -6,4 +6,6 @@ ThreadExcerpt = name: 'Thread Excerpt' cb: @node node: -> d.title = Get.threadExcerpt @ - disconnect: -> Thread.callbacks.disconnect 'Thread Excerpt' + disconnect: -> + return if g.VIEW isnt 'thread' or !Conf['Thread Excerpt'] + Thread.callbacks.disconnect 'Thread Excerpt' diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index d5507aa90..6d9e46fd4 100755 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -35,7 +35,7 @@ ThreadStats = $.on d, 'ThreadUpdate', ThreadStats.onUpdate disconnect: -> - return unless Conf['Thread Stats'] + return if g.VIEW isnt 'thread' or !Conf['Thread Stats'] if Conf['Updater and Stats in Header'] Header.rmShortcut @dialog diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 5e38a7b2e..59ae4d6c3 100755 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -59,6 +59,7 @@ ThreadUpdater = cb: @node disconnect: -> + return if g.VIEW isnt 'thread' or !Conf['Thread Updater'] $.off @timer, 'click', @update $.off @status, 'click', @update diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 50ec64859..3c23e6de3 100755 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -13,7 +13,7 @@ Unread = cb: @node disconnect: -> - return unless Unread.db + return if g.VIEW isnt 'thread' or !Conf['Unread Count'] and !Conf['Unread Favicon'] and !Conf['Desktop Notifications'] Unread.db.disconnect() $.rm hr if {hr} = Unread diff --git a/src/Quotelinks/QuoteThreading.coffee b/src/Quotelinks/QuoteThreading.coffee index c1082674f..85a15cfd2 100755 --- a/src/Quotelinks/QuoteThreading.coffee +++ b/src/Quotelinks/QuoteThreading.coffee @@ -25,6 +25,7 @@ QuoteThreading = cb: @node disconnect: -> + return unless Conf['Quote Threading'] and g.VIEW is 'thread' input = $ 'input', @controls $.off input, 'change', @toggle