Features can *and should* handle under what context they disconnect
This commit is contained in:
parent
1e24021c07
commit
a20e85d30f
@ -5095,6 +5095,9 @@
|
|||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
var input;
|
var input;
|
||||||
|
if (!(Conf['Quote Threading'] && g.VIEW === 'thread')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
input = $('input', this.controls);
|
input = $('input', this.controls);
|
||||||
$.off(input, 'change', this.toggle);
|
$.off(input, 'change', this.toggle);
|
||||||
$.event('rmMenuEntry', this.entry);
|
$.event('rmMenuEntry', this.entry);
|
||||||
@ -8681,6 +8684,9 @@
|
|||||||
return d.title = Get.threadExcerpt(this);
|
return d.title = Get.threadExcerpt(this);
|
||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
|
if (g.VIEW !== 'thread' || !Conf['Thread Excerpt']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return Thread.callbacks.disconnect('Thread Excerpt');
|
return Thread.callbacks.disconnect('Thread Excerpt');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -8733,7 +8739,7 @@
|
|||||||
return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate);
|
return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate);
|
||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
if (!Conf['Thread Stats']) {
|
if (g.VIEW !== 'thread' || !Conf['Thread Stats']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Conf['Updater and Stats in Header']) {
|
if (Conf['Updater and Stats in Header']) {
|
||||||
@ -8876,6 +8882,9 @@
|
|||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
var el, entry, input, name, _i, _j, _len, _len1, _ref, _ref1;
|
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.timer, 'click', this.update);
|
||||||
$.off(this.status, 'click', this.update);
|
$.off(this.status, 'click', this.update);
|
||||||
if (this.timeoutID) {
|
if (this.timeoutID) {
|
||||||
@ -9719,7 +9728,7 @@
|
|||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
var hr, name, _i, _len, _ref;
|
var hr, name, _i, _len, _ref;
|
||||||
if (!Unread.db) {
|
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Desktop Notifications']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.db.disconnect();
|
Unread.db.disconnect();
|
||||||
@ -10680,6 +10689,9 @@
|
|||||||
},
|
},
|
||||||
disconnect: function(refresh) {
|
disconnect: function(refresh) {
|
||||||
var status, threadID, _ref, _ref1;
|
var status, threadID, _ref, _ref1;
|
||||||
|
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_ref = ExpandThread.statuses;
|
_ref = ExpandThread.statuses;
|
||||||
for (threadID in _ref) {
|
for (threadID in _ref) {
|
||||||
status = _ref[threadID];
|
status = _ref[threadID];
|
||||||
@ -11918,12 +11930,12 @@
|
|||||||
g.BOARD.threads = {};
|
g.BOARD.threads = {};
|
||||||
return $.rmAll($('.board'));
|
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() {
|
disconnect: function() {
|
||||||
var err, errors, feature, features, name, _i, _len, _ref;
|
var err, errors, feature, name, _i, _len, _ref, _ref1;
|
||||||
features = g.VIEW === 'thread' ? Navigate.threadFeatures : [];
|
_ref = Navigate.features;
|
||||||
for (_i = 0, _len = features.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
_ref = features[_i], name = _ref[0], feature = _ref[1];
|
_ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1];
|
||||||
try {
|
try {
|
||||||
feature.disconnect();
|
feature.disconnect();
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
@ -11942,10 +11954,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
reconnect: function() {
|
reconnect: function() {
|
||||||
var err, errors, feature, features, name, _i, _len, _ref;
|
var err, errors, feature, name, _i, _len, _ref, _ref1;
|
||||||
features = g.VIEW === 'thread' ? Navigate.threadFeatures : [];
|
_ref = Navigate.features;
|
||||||
for (_i = 0, _len = features.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
_ref = features[_i], name = _ref[0], feature = _ref[1];
|
_ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1];
|
||||||
try {
|
try {
|
||||||
feature.init();
|
feature.init();
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@ -5098,6 +5098,9 @@
|
|||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
var input;
|
var input;
|
||||||
|
if (!(Conf['Quote Threading'] && g.VIEW === 'thread')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
input = $('input', this.controls);
|
input = $('input', this.controls);
|
||||||
$.off(input, 'change', this.toggle);
|
$.off(input, 'change', this.toggle);
|
||||||
$.event('rmMenuEntry', this.entry);
|
$.event('rmMenuEntry', this.entry);
|
||||||
@ -8664,6 +8667,9 @@
|
|||||||
return d.title = Get.threadExcerpt(this);
|
return d.title = Get.threadExcerpt(this);
|
||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
|
if (g.VIEW !== 'thread' || !Conf['Thread Excerpt']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return Thread.callbacks.disconnect('Thread Excerpt');
|
return Thread.callbacks.disconnect('Thread Excerpt');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -8716,7 +8722,7 @@
|
|||||||
return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate);
|
return $.on(d, 'ThreadUpdate', ThreadStats.onUpdate);
|
||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
if (!Conf['Thread Stats']) {
|
if (g.VIEW !== 'thread' || !Conf['Thread Stats']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Conf['Updater and Stats in Header']) {
|
if (Conf['Updater and Stats in Header']) {
|
||||||
@ -8859,6 +8865,9 @@
|
|||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
var el, entry, input, name, _i, _j, _len, _len1, _ref, _ref1;
|
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.timer, 'click', this.update);
|
||||||
$.off(this.status, 'click', this.update);
|
$.off(this.status, 'click', this.update);
|
||||||
if (this.timeoutID) {
|
if (this.timeoutID) {
|
||||||
@ -9702,7 +9711,7 @@
|
|||||||
},
|
},
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
var hr, name, _i, _len, _ref;
|
var hr, name, _i, _len, _ref;
|
||||||
if (!Unread.db) {
|
if (g.VIEW !== 'thread' || !Conf['Unread Count'] && !Conf['Unread Favicon'] && !Conf['Desktop Notifications']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.db.disconnect();
|
Unread.db.disconnect();
|
||||||
@ -10669,6 +10678,9 @@
|
|||||||
},
|
},
|
||||||
disconnect: function(refresh) {
|
disconnect: function(refresh) {
|
||||||
var status, threadID, _ref, _ref1;
|
var status, threadID, _ref, _ref1;
|
||||||
|
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_ref = ExpandThread.statuses;
|
_ref = ExpandThread.statuses;
|
||||||
for (threadID in _ref) {
|
for (threadID in _ref) {
|
||||||
status = _ref[threadID];
|
status = _ref[threadID];
|
||||||
@ -11907,12 +11919,12 @@
|
|||||||
g.BOARD.threads = {};
|
g.BOARD.threads = {};
|
||||||
return $.rmAll($('.board'));
|
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() {
|
disconnect: function() {
|
||||||
var err, errors, feature, features, name, _i, _len, _ref;
|
var err, errors, feature, name, _i, _len, _ref, _ref1;
|
||||||
features = g.VIEW === 'thread' ? Navigate.threadFeatures : [];
|
_ref = Navigate.features;
|
||||||
for (_i = 0, _len = features.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
_ref = features[_i], name = _ref[0], feature = _ref[1];
|
_ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1];
|
||||||
try {
|
try {
|
||||||
feature.disconnect();
|
feature.disconnect();
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
@ -11931,10 +11943,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
reconnect: function() {
|
reconnect: function() {
|
||||||
var err, errors, feature, features, name, _i, _len, _ref;
|
var err, errors, feature, name, _i, _len, _ref, _ref1;
|
||||||
features = g.VIEW === 'thread' ? Navigate.threadFeatures : [];
|
_ref = Navigate.features;
|
||||||
for (_i = 0, _len = features.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
_ref = features[_i], name = _ref[0], feature = _ref[1];
|
_ref1 = _ref[_i], name = _ref1[0], feature = _ref1[1];
|
||||||
try {
|
try {
|
||||||
feature.init();
|
feature.init();
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Navigate =
|
|||||||
# Delete nodes
|
# Delete nodes
|
||||||
$.rmAll $ '.board'
|
$.rmAll $ '.board'
|
||||||
|
|
||||||
threadFeatures: [
|
features: [
|
||||||
['Thread Excerpt', ThreadExcerpt]
|
['Thread Excerpt', ThreadExcerpt]
|
||||||
['Unread Count', Unread]
|
['Unread Count', Unread]
|
||||||
['Quote Threading', QuoteThreading]
|
['Quote Threading', QuoteThreading]
|
||||||
@ -47,12 +47,7 @@ Navigate =
|
|||||||
]
|
]
|
||||||
|
|
||||||
disconnect: ->
|
disconnect: ->
|
||||||
features = if g.VIEW is 'thread'
|
for [name, feature] in Navigate.features
|
||||||
Navigate.threadFeatures
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
|
|
||||||
for [name, feature] in features
|
|
||||||
try
|
try
|
||||||
feature.disconnect()
|
feature.disconnect()
|
||||||
catch err
|
catch err
|
||||||
@ -66,12 +61,7 @@ Navigate =
|
|||||||
return
|
return
|
||||||
|
|
||||||
reconnect: ->
|
reconnect: ->
|
||||||
features = if g.VIEW is 'thread'
|
for [name, feature] in Navigate.features
|
||||||
Navigate.threadFeatures
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
|
|
||||||
for [name, feature] in features
|
|
||||||
try
|
try
|
||||||
feature.init()
|
feature.init()
|
||||||
catch err
|
catch err
|
||||||
|
|||||||
@ -10,6 +10,7 @@ ExpandThread =
|
|||||||
$.on a, 'click', ExpandThread.cbToggle
|
$.on a, 'click', ExpandThread.cbToggle
|
||||||
|
|
||||||
disconnect: (refresh) ->
|
disconnect: (refresh) ->
|
||||||
|
return if g.VIEW is 'thread' or !Conf['Thread Expansion']
|
||||||
for threadID, status of ExpandThread.statuses
|
for threadID, status of ExpandThread.statuses
|
||||||
status.req?.abort()
|
status.req?.abort()
|
||||||
delete ExpandThread.statuses[threadID]
|
delete ExpandThread.statuses[threadID]
|
||||||
|
|||||||
@ -6,4 +6,6 @@ ThreadExcerpt =
|
|||||||
name: 'Thread Excerpt'
|
name: 'Thread Excerpt'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: -> d.title = Get.threadExcerpt @
|
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'
|
||||||
|
|||||||
@ -35,7 +35,7 @@ ThreadStats =
|
|||||||
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
||||||
|
|
||||||
disconnect: ->
|
disconnect: ->
|
||||||
return unless Conf['Thread Stats']
|
return if g.VIEW isnt 'thread' or !Conf['Thread Stats']
|
||||||
|
|
||||||
if Conf['Updater and Stats in Header']
|
if Conf['Updater and Stats in Header']
|
||||||
Header.rmShortcut @dialog
|
Header.rmShortcut @dialog
|
||||||
|
|||||||
@ -59,6 +59,7 @@ ThreadUpdater =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
disconnect: ->
|
||||||
|
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
||||||
$.off @timer, 'click', @update
|
$.off @timer, 'click', @update
|
||||||
$.off @status, 'click', @update
|
$.off @status, 'click', @update
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Unread =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
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()
|
Unread.db.disconnect()
|
||||||
$.rm hr if {hr} = Unread
|
$.rm hr if {hr} = Unread
|
||||||
|
|||||||
@ -25,6 +25,7 @@ QuoteThreading =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
disconnect: ->
|
||||||
|
return unless Conf['Quote Threading'] and g.VIEW is 'thread'
|
||||||
input = $ 'input', @controls
|
input = $ 'input', @controls
|
||||||
$.off input, 'change', @toggle
|
$.off input, 'change', @toggle
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user