Throw 4chanXInitFinished on navigate

Also add "none" flag to Settings.open
$.event("openSettings", "none");
This commit is contained in:
Zixaphir 2014-07-30 10:00:10 -07:00
parent 715cfc7de7
commit 9d087ef5d6
6 changed files with 33 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* appchan x - Version 2.9.32 - 2014-07-29
* appchan x - Version 2.9.32 - 2014-07-30
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -28,7 +28,7 @@
// ==/UserScript==
/*
* appchan x - Version 2.9.32 - 2014-07-29
* appchan x - Version 2.9.32 - 2014-07-30
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -5322,7 +5322,7 @@
}
if (g.VIEW === 'thread') {
if (Conf['Thread Updater']) {
return ThreadUpdater.update();
ThreadUpdater.update();
}
return;
}
@ -16800,6 +16800,9 @@
Navigate.updateContext(view);
Navigate.clean();
Navigate.reconnect();
if (view === 'index') {
$.event('4chanXInitFinished');
}
}
if (boardID === g.BOARD.ID) {
Navigate.title = function() {
@ -16914,8 +16917,9 @@
QR.generatePostableThreadsList();
Header.hashScroll.call(window);
if (errors) {
return Main.handleErrors(errors);
Main.handleErrors(errors);
}
return $.event('4chanXInitFinished');
},
pushState: function(path) {
history.pushState(null, '', path);
@ -17013,7 +17017,9 @@
}
}
$.add($('.sections-list', dialog), links);
(sectionToOpen ? sectionToOpen : links[0]).click();
if (openSection !== 'none') {
(sectionToOpen ? sectionToOpen : links[0]).click();
}
$.on($('.close', dialog), 'click', Settings.close);
$.on(overlay, 'click', Settings.close);
$.add(d.body, [overlay, dialog]);

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* appchan x - Version 2.9.32 - 2014-07-29
* appchan x - Version 2.9.32 - 2014-07-30
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -5373,7 +5373,7 @@
}
if (g.VIEW === 'thread') {
if (Conf['Thread Updater']) {
return ThreadUpdater.update();
ThreadUpdater.update();
}
return;
}
@ -16816,6 +16816,9 @@
Navigate.updateContext(view);
Navigate.clean();
Navigate.reconnect();
if (view === 'index') {
$.event('4chanXInitFinished');
}
}
if (boardID === g.BOARD.ID) {
Navigate.title = function() {
@ -16930,8 +16933,9 @@
QR.generatePostableThreadsList();
Header.hashScroll.call(window);
if (errors) {
return Main.handleErrors(errors);
Main.handleErrors(errors);
}
return $.event('4chanXInitFinished');
},
pushState: function(path) {
history.pushState(null, '', path);
@ -17029,7 +17033,9 @@
}
}
$.add($('.sections-list', dialog), links);
(sectionToOpen ? sectionToOpen : links[0]).click();
if (openSection !== 'none') {
(sectionToOpen ? sectionToOpen : links[0]).click();
}
$.on($('.close', dialog), 'click', Settings.close);
$.on(overlay, 'click', Settings.close);
$.add(d.body, [overlay, dialog]);

View File

@ -514,9 +514,9 @@ Index =
{timeEl} = Index
needed =
# we're on the index,
g.VIEW is 'index' and
g.VIEW is 'index' and
# not currently refreshing
!Index.req and
!Index.req and
timeEl.dataset.utc and
# more than 10 minutes have elapsed since the last refresh.
timeEl.dataset.utc < Date.now() - (10 * $.MINUTE)
@ -525,7 +525,7 @@ Index =
update: (pageNum) ->
return unless navigator.onLine
if g.VIEW is 'thread'
return ThreadUpdater.update() if Conf['Thread Updater']
ThreadUpdater.update() if Conf['Thread Updater']
return
unless d.readyState is 'loading' or Index.root.parentElement
$.replace $('.board'), Index.root
@ -817,7 +817,7 @@ Index =
else
unless Conf['Index Mode'] is 'infinite'
pageNum = Index.getCurrentPage()
else
return unless Index.searchInput.dataset.searching
pageNum = Index.pageBeforeSearch

View File

@ -255,6 +255,10 @@ Navigate =
Navigate.clean()
Navigate.reconnect()
# Thrown on index before index is generated. At this point, the page is blank.
# An IndexRefresh event will also be thrown after the index has been generated.
$.event '4chanXInitFinished' if view is 'index'
if boardID is g.BOARD.ID
Navigate.title = -> d.title = $('.boardTitle').textContent if view is 'index'
else
@ -357,6 +361,9 @@ Navigate =
Main.handleErrors errors if errors
# Thrown after thread has been generated and features have been parsed, like 4chan X
$.event '4chanXInitFinished'
pushState: (path) ->
history.pushState null, '', path
Navigate.path = window.location.pathname

View File

@ -74,7 +74,7 @@ Settings =
links.push link
sectionToOpen = link if section.title is openSection
$.add $('.sections-list', dialog), links
(if sectionToOpen then sectionToOpen else links[0]).click()
(if sectionToOpen then sectionToOpen else links[0]).click() unless openSection is 'none'
$.on $('.close', dialog), 'click', Settings.close
$.on overlay, 'click', Settings.close