Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page offset for Arabic page numbering, set as 'pageOffset' field in book-config.js. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ paginationConfig = {
+ '</div><div id="copyrightpage">Copyright: You<br>License: CC</div>'
+ '<div class="pagebreak"></div>',
'autoStart': true,
'pageOffset': 0
}

18 changes: 16 additions & 2 deletions book.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ Pagination.config = {
'bulkPagesToAdd': 50,
'pagesToAddIncrementRatio': 1.4,
'frontmatterContents': '',
'autoStart': true
'autoStart': true,
'pageOffset': 0
};

// help functions
Expand Down Expand Up @@ -217,7 +218,10 @@ Pagination.pageCounterCreator.prototype.numberPages = function () {
// If the pages associated with this page counter need to be updated, go
// through all of them from the start of the book and number them, thereby
// potentially removing old page numbers.
this.value = 0;

// Set this externally now, allowing for pageOffset from config for arab numbering.
// this.value = 0;

this.needsUpdate = false;

var pagenumbersToNumber = document.querySelectorAll(
Expand Down Expand Up @@ -506,6 +510,16 @@ Pagination.applyBookLayout = function () {
bodyObjects[i].initiate();
}

// See if we have an offset value set and if so, update page start value
if (Pagination.config.pageOffset != 0) {
Pagination.pageCounters.arab.value = Pagination.config.pageOffset;
}
// Set to 0 otherwise
else {
Pagination.pageCounters.arab.value = 0;
}

// Call the updater
Pagination.pageCounters.arab.numberPages();

if (Pagination.config.enableFrontmatter) {
Expand Down