Trigger "start" before "page.change"

This commit is contained in:
Samy Pessé
2015-11-02 16:57:08 +01:00
parent 3388be9db6
commit 2814fea67e
4 changed files with 26 additions and 8 deletions
+13 -4
View File
@@ -24403,6 +24403,7 @@ function start(config) {
});
events.trigger('start', config);
navigation.notify();
}
// Export APIs for plugins
@@ -24581,7 +24582,11 @@ function updateNavigationPosition() {
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
}
function preparePage() {
function notifyPageChange() {
events.trigger('page.change');
}
function preparePage(notify) {
var $bookBody = $('.book-body');
var $bookInner = $bookBody.find('.body-inner');
var $pageWrapper = $bookInner.find('.page-wrapper');
@@ -24597,7 +24602,7 @@ function preparePage() {
$bookBody.scrollTop(0);
// Notify
events.trigger('page.change');
if (notify !== false) notifyPageChange();
}
function isLeftClickEvent(e) {
@@ -24656,13 +24661,14 @@ function init() {
$(window).resize(updateNavigationPosition);
// Prepare current page
preparePage();
preparePage(false);
}
module.exports = {
init: init,
goNext: goNext,
goPrev: goPrev
goPrev: goPrev,
notify: notifyPageChange
};
},{"./events":12,"./loading":15,"./state":19,"jquery":8,"url":7}],17:[function(require,module,exports){
@@ -24955,6 +24961,8 @@ function updateButton(opts) {
$result = $btn;
}
$result.addClass('js-toolbar-action');
if (_.isNumber(opts.index) && opts.index >= 0) {
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
} else {
@@ -24964,6 +24972,7 @@ function updateButton(opts) {
// Update all buttons
function updateAllButtons() {
$('.js-toolbar-action').remove();
_.each(buttons, updateButton);
}
+1
View File
@@ -36,6 +36,7 @@ function start(config) {
});
events.trigger('start', config);
navigation.notify();
}
// Export APIs for plugins
+9 -4
View File
@@ -75,7 +75,11 @@ function updateNavigationPosition() {
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
}
function preparePage() {
function notifyPageChange() {
events.trigger('page.change');
}
function preparePage(notify) {
var $bookBody = $('.book-body');
var $bookInner = $bookBody.find('.body-inner');
var $pageWrapper = $bookInner.find('.page-wrapper');
@@ -91,7 +95,7 @@ function preparePage() {
$bookBody.scrollTop(0);
// Notify
events.trigger('page.change');
if (notify !== false) notifyPageChange();
}
function isLeftClickEvent(e) {
@@ -150,11 +154,12 @@ function init() {
$(window).resize(updateNavigationPosition);
// Prepare current page
preparePage();
preparePage(false);
}
module.exports = {
init: init,
goNext: goNext,
goPrev: goPrev
goPrev: goPrev,
notify: notifyPageChange
};
+3
View File
@@ -156,6 +156,8 @@ function updateButton(opts) {
$result = $btn;
}
$result.addClass('js-toolbar-action');
if (_.isNumber(opts.index) && opts.index >= 0) {
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
} else {
@@ -165,6 +167,7 @@ function updateButton(opts) {
// Update all buttons
function updateAllButtons() {
$('.js-toolbar-action').remove();
_.each(buttons, updateButton);
}