|
103 | 103 | * to set this to 'webkitRegionLayoutUpdate'. A bug in early development
|
104 | 104 | * versions of Chrome 25 did that the event anme was 'regionlayoutupdate'.
|
105 | 105 | *
|
| 106 | + * maxPageNumber: 10000 -- This controls the maximum amount of pages. If more |
| 107 | + * pages than this are added, BookJS will die. Notice that pages are added |
| 108 | + * incrementally, so you won't be able to control the exact number of pages. |
| 109 | + * You should always set this to something much larger than what you will ever |
| 110 | + * expect that you book will need. |
| 111 | + * |
106 | 112 | * Page style options
|
107 | 113 | *
|
108 | 114 | * These settings provide a way to do simple styling of the page. These
|
@@ -181,6 +187,7 @@ Pagination.config = {
|
181 | 187 | 'autoStart': true,
|
182 | 188 | 'numberPages': true,
|
183 | 189 | 'divideContents': true,
|
| 190 | + 'maxPageNumber': 10000, |
184 | 191 | 'outerMargin': .5,
|
185 | 192 | 'innerMargin': .8,
|
186 | 193 | 'contentsTopMargin': .8,
|
@@ -435,11 +442,11 @@ Pagination.createPages = function (num, flowName, pageCounterClass, columns) {
|
435 | 442 | header.classList.add('pagination-header');
|
436 | 443 |
|
437 | 444 | chapterheader = document.createElement('span');
|
438 |
| - chapterheader.classList.add('pagination-chapter'); |
| 445 | + chapterheader.classList.add('pagination-header-chapter'); |
439 | 446 | header.appendChild(chapterheader);
|
440 | 447 |
|
441 | 448 | sectionheader = document.createElement('span');
|
442 |
| - sectionheader.classList.add('pagination-section'); |
| 449 | + sectionheader.classList.add('pagination-header-section'); |
443 | 450 | header.appendChild(sectionheader);
|
444 | 451 |
|
445 | 452 | page.appendChild(header);
|
@@ -575,12 +582,12 @@ Pagination.headersAndToc = function (bodyObjects) {
|
575 | 582 |
|
576 | 583 | for (var j = 0; j < pages.length; j++) {
|
577 | 584 | var chapterHeader = pages[j].querySelector(
|
578 |
| - '.pagination-header .pagination-chapter' |
| 585 | + '.pagination-header .pagination-header-chapter' |
579 | 586 | );
|
580 | 587 | chapterHeader.innerHTML = currentChapterTitle;
|
581 | 588 |
|
582 | 589 | var sectionHeader = pages[j].querySelector(
|
583 |
| - '.pagination-header .pagination-section' |
| 590 | + '.pagination-header .pagination-header-section' |
584 | 591 | );
|
585 | 592 | sectionHeader.innerHTML = currentSectionTitle;
|
586 | 593 | }
|
@@ -1284,6 +1291,7 @@ Pagination.flowObject.prototype.addPagesLoop = function (numberOfPages) {
|
1284 | 1291 | * It is a point to overshoot the target, as it is more costly to add than
|
1285 | 1292 | * to remove pages.
|
1286 | 1293 | */
|
| 1294 | + if (this.bulkPagesToAdd > Pagination.config['maxPageNumber']) return; |
1287 | 1295 | if ('undefined' === typeof (numberOfPages)) {
|
1288 | 1296 | this.div.appendChild(
|
1289 | 1297 | Pagination.createPages(
|
|
0 commit comments