Navigate rush condition
This commit is contained in:
parent
51d6907c68
commit
d9aa9f7fb8
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* appchan x - Version 2.9.32 - 2014-07-28
|
||||
* appchan x - Version 2.9.32 - 2014-07-29
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* appchan x - Version 2.9.32 - 2014-07-28
|
||||
* appchan x - Version 2.9.32 - 2014-07-29
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||
@ -16615,14 +16615,12 @@
|
||||
if (view === 'thread') {
|
||||
g.THREADID = +window.location.pathname.split('/')[3];
|
||||
}
|
||||
if (view === g.VIEW) {
|
||||
return;
|
||||
}
|
||||
$.rmClass(doc, g.VIEW);
|
||||
$.addClass(doc, view);
|
||||
({
|
||||
index: function() {
|
||||
var _ref;
|
||||
if (g.VIEW === view) {
|
||||
return;
|
||||
}
|
||||
delete g.THREADID;
|
||||
if (Conf['Index Mode'] === 'catalog') {
|
||||
Index.cb.toggleCatalogMode();
|
||||
@ -16630,15 +16628,24 @@
|
||||
return (_ref = QR.posts[0]) != null ? _ref.thread = 'new' : void 0;
|
||||
},
|
||||
thread: function() {
|
||||
var _ref;
|
||||
var _ref, _ref1;
|
||||
if (((_ref = QR.posts[0]) != null ? _ref.thread : void 0) === g.THREADID) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Index Mode'] === 'catalog') {
|
||||
$.rmClass(doc, 'catalog-mode');
|
||||
}
|
||||
return (_ref = QR.posts[0]) != null ? _ref.thread = g.THREADID : void 0;
|
||||
return (_ref1 = QR.posts[0]) != null ? _ref1.thread = g.THREADID : void 0;
|
||||
}
|
||||
})[view]();
|
||||
QR.status();
|
||||
return g.VIEW = view;
|
||||
if (view !== g.VIEW) {
|
||||
$.rmClass(doc, g.VIEW);
|
||||
$.addClass(doc, view);
|
||||
g.VIEW = view;
|
||||
}
|
||||
return $.asap((function() {
|
||||
return g.threads.keys.length;
|
||||
}), QR.status);
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var current, fullBoardList;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript
|
||||
/*
|
||||
* appchan x - Version 2.9.32 - 2014-07-28
|
||||
* appchan x - Version 2.9.32 - 2014-07-29
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||
@ -16631,14 +16631,12 @@
|
||||
if (view === 'thread') {
|
||||
g.THREADID = +window.location.pathname.split('/')[3];
|
||||
}
|
||||
if (view === g.VIEW) {
|
||||
return;
|
||||
}
|
||||
$.rmClass(doc, g.VIEW);
|
||||
$.addClass(doc, view);
|
||||
({
|
||||
index: function() {
|
||||
var _ref;
|
||||
if (g.VIEW === view) {
|
||||
return;
|
||||
}
|
||||
delete g.THREADID;
|
||||
if (Conf['Index Mode'] === 'catalog') {
|
||||
Index.cb.toggleCatalogMode();
|
||||
@ -16646,15 +16644,24 @@
|
||||
return (_ref = QR.posts[0]) != null ? _ref.thread = 'new' : void 0;
|
||||
},
|
||||
thread: function() {
|
||||
var _ref;
|
||||
var _ref, _ref1;
|
||||
if (((_ref = QR.posts[0]) != null ? _ref.thread : void 0) === g.THREADID) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Index Mode'] === 'catalog') {
|
||||
$.rmClass(doc, 'catalog-mode');
|
||||
}
|
||||
return (_ref = QR.posts[0]) != null ? _ref.thread = g.THREADID : void 0;
|
||||
return (_ref1 = QR.posts[0]) != null ? _ref1.thread = g.THREADID : void 0;
|
||||
}
|
||||
})[view]();
|
||||
QR.status();
|
||||
return g.VIEW = view;
|
||||
if (view !== g.VIEW) {
|
||||
$.rmClass(doc, g.VIEW);
|
||||
$.addClass(doc, view);
|
||||
g.VIEW = view;
|
||||
}
|
||||
return $.asap((function() {
|
||||
return g.threads.keys.length;
|
||||
}), QR.status);
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var current, fullBoardList;
|
||||
|
||||
@ -103,28 +103,36 @@ Navigate =
|
||||
return
|
||||
|
||||
updateContext: (view) ->
|
||||
# State tracking
|
||||
g.DEAD = false
|
||||
g.THREADID = +window.location.pathname.split('/')[3] if view is 'thread'
|
||||
|
||||
return if view is g.VIEW
|
||||
|
||||
$.rmClass doc, g.VIEW
|
||||
$.addClass doc, view
|
||||
|
||||
{
|
||||
index: ->
|
||||
# Unlike threads, boards don't need to do much when switching between them that the QR doesn't already handle.
|
||||
return if g.VIEW is view
|
||||
delete g.THREADID
|
||||
Index.cb.toggleCatalogMode() if Conf['Index Mode'] is 'catalog'
|
||||
QR.posts[0]?.thread = 'new'
|
||||
|
||||
thread: ->
|
||||
return if QR.posts[0]?.thread is g.THREADID
|
||||
$.rmClass doc, 'catalog-mode' if Conf['Index Mode'] is 'catalog'
|
||||
# When switching between threads, we need to update the QR state to avoid posting in the wrong thread.
|
||||
# Maybe address this in a loop to update all posts to the current thread?
|
||||
QR.posts[0]?.thread = g.THREADID
|
||||
}[view]()
|
||||
|
||||
QR.status() # Re-enable the QR in the case of a 404'd thread or something.
|
||||
if view isnt g.VIEW # index and thread are really all we care about here.
|
||||
# Update some CSS selectors that depend on thread and index views.
|
||||
$.rmClass doc, g.VIEW
|
||||
$.addClass doc, view
|
||||
# Tell the rest of the script we're no longer in the view we were.
|
||||
g.VIEW = view
|
||||
|
||||
g.VIEW = view
|
||||
# Re-enable the QR in the case of a 404'd thread or something.
|
||||
# Race Condition: g.threads may not have been fully rebuilt by the time we attempt to access it.
|
||||
$.asap (-> g.threads.keys.length), QR.status
|
||||
|
||||
updateBoard: (boardID) ->
|
||||
fullBoardList = $ '#full-board-list', Header.boardList
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user