From cddbd4a2f363c8a8505a502f8567447413ec7721 Mon Sep 17 00:00:00 2001 From: Julian Oliver Date: Thu, 6 Dec 2012 18:18:21 +0100 Subject: [PATCH] Added page offset for Arabic page numbering. Set with 'pageOffset' int in book-config.js. modified: book-config.js modified: book.js Author: Julian Oliver Committer: Julian Oliver --- book-config.js | 1 + book.js | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/book-config.js b/book-config.js index de397ca..87fa26b 100644 --- a/book-config.js +++ b/book-config.js @@ -15,5 +15,6 @@ paginationConfig = { + '
Copyright: You
License: CC
' + '
', 'autoStart': true, + 'pageOffset': 0 } diff --git a/book.js b/book.js index 6209865..9328916 100644 --- a/book.js +++ b/book.js @@ -98,7 +98,8 @@ Pagination.config = { 'bulkPagesToAdd': 50, 'pagesToAddIncrementRatio': 1.4, 'frontmatterContents': '', - 'autoStart': true + 'autoStart': true, + 'pageOffset': 0 }; // help functions @@ -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( @@ -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) {