mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Trigger "start" before "page.change"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ function start(config) {
|
||||
});
|
||||
|
||||
events.trigger('start', config);
|
||||
navigation.notify();
|
||||
}
|
||||
|
||||
// Export APIs for plugins
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user