]> _ Git - fluidbook-html5.git/commitdiff
wip #2277 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 23 Oct 2018 16:07:26 +0000 (18:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 23 Oct 2018 16:07:26 +0000 (18:07 +0200)
13 files changed:
js/libs/fluidbook/fluidbook.bookmarks.js
js/libs/fluidbook/fluidbook.contentlock.js [new file with mode: 0644]
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.loader.js
js/libs/fluidbook/fluidbook.search.js
js/libs/fluidbook/fluidbook.slider.js
js/libs/fluidbook/fluidbook.sound.js
js/libs/fluidbook/fluidbook.video.js
js/libs/fluidbook/forms/fluidbook.form.bourbon.js
js/libs/fluidbook/menu/fluidbook.chapters.js
js/libs/fluidbook/menu/fluidbook.index.js
js/libs/scorm/scorm.js

index 7d65ddd24b6291280a9e6eec015761779ba3e49f..1a5bdeac0eb412531b2a5ded3eafa6f67cc580ba 100644 (file)
@@ -93,7 +93,7 @@ FluidbookBookmarks.prototype = {
         var re = 0;
         for (var i = 0; i < this.bookmarks.length; i++) {
             var b = this.bookmarks[i];
-            if (b > this.fluidbook.getMaxPage()) {
+            if (b > this.fluidbook.contentlock.getMaxPage()) {
                 continue;
             }
             if (rs == 0) {
@@ -195,7 +195,7 @@ FluidbookBookmarks.prototype = {
         var res = [];
         var nb;
         var groupId;
-        for (var i = 1; i <= this.fluidbook.getMaxPage();) {
+        for (var i = 1; i <= this.fluidbook.contentlock.getMaxPage();) {
             if (this.isBookmarked(i) || !onlyBookmarked) {
                 groupId = this.getGroupOfPage(i);
                 nb = this.getPagesNumberInGroup(groupId);
@@ -360,7 +360,7 @@ FluidbookBookmarks.prototype = {
 
         var bookmarks = "";
         for (var i = pageNr; i <= to; i++) {
-            if (i > 0 && i <= this.fluidbook.getMaxPage()) {
+            if (i > 0 && i <= this.fluidbook.contentlock.getMaxPage()) {
                 var side;
                 if (allwaysAtRight) {
                     side = 'right';
diff --git a/js/libs/fluidbook/fluidbook.contentlock.js b/js/libs/fluidbook/fluidbook.contentlock.js
new file mode 100644 (file)
index 0000000..489a4ce
--- /dev/null
@@ -0,0 +1,130 @@
+function FluidbookContentLock(fluidbook) {
+    this.fluidbook = fluidbook;
+    this.maxPage;
+    this.linksActions = {};
+    this.locks = this.fluidbook.datas.content_lock;
+}
+
+FluidbookContentLock.prototype = {
+    init: function () {
+        var $this = this;
+
+        key('⌘+alt+u, ctrl+alt+u', function () {
+            $this.setMaxPage();
+        });
+
+        this.maxPage = this.getNextLockPage();
+        if (this.maxPage <= 0) {
+            this.maxPage = this.fluidbook.datas.pages;
+        }
+    },
+
+    getNextLockPage: function () {
+        var res = 0;
+
+        $.each(this.locks, function (k, v) {
+            if (v.unlocked === 1) {
+                return;
+            }
+            res = k;
+            return true;
+        });
+        return res;
+    },
+
+    setMaxPage: function (p, allowbackwards) {
+        var currentMaxPage = this.maxPage;
+        if (allowbackwards === undefined) {
+            allowbackwards = false;
+        }
+        if (p === undefined || p <= 0) {
+            p = this.fluidbook.datas.pages;
+        }
+
+        if (!allowbackwards && p < this.maxPage) {
+            return;
+        }
+
+        this.maxPage = Math.min(p, this.fluidbook.datas.pages);
+        if (currentMaxPage === this.maxPage) {
+            return;
+        }
+        $(this.fluidbook).trigger('fluidbook.maxpage.set', [this.maxPage]);
+        this.updateMaxPage();
+    },
+
+    getMaxPage: function () {
+        return this.maxPage;
+    },
+
+    updateMaxPage: function () {
+        if (this.fluidbook.currentPage > this.maxPage) {
+            this.fluidbook.setCurrentPage(this.maxPage);
+        }
+
+        var $this = this;
+        $.each(this.locks, function (k, v) {
+                if ($this.maxPage > k) {
+                    $this.locks.unlocked = 1;
+                }
+            }
+        );
+
+        this.fluidbook.hideUnnecessaryButtons();
+        resize();
+    },
+
+    addAction: function (linkId, action) {
+
+        if (this.linksActions[linkId] === undefined) {
+            this.linksActions[linkId] = [];
+        }
+        if (this.linksActions[linkId].indexOf(action) === -1) {
+            this.linksActions[linkId].push(action);
+        }
+
+        console.log(this.linksActions);
+
+        this.testConditions();
+    },
+
+    testConditions: function () {
+        var $this=this;
+        var change = false;
+        $.each(this.locks, function (k, v) {
+            if (v.unlocked === 1) {
+                return;
+            }
+            if (v.conditions.length === 0) {
+                return;
+            }
+
+            var conditionsToObserve = v.conditions.length;
+            $.each(v.conditions, function (i, c) {
+                if ($this.testCondition(c)) {
+                    conditionsToObserve--;
+                }
+            });
+
+            if (conditionsToObserve === 0) {
+                $this.locks[k].unlocked = 1;
+                change = true;
+            }
+        });
+
+        if (change) {
+            this.setMaxPage(this.getNextLockPage(), false)
+        }
+    },
+
+    testCondition: function (condition) {
+        var linkId = condition[0];
+        var action = condition[1];
+
+        if (this.linksActions[linkId] === undefined) {
+            return false;
+        }
+
+        return this.linksActions[linkId].indexOf(action) >= 0;
+    },
+}
\ No newline at end of file
index 1dbac033786ffb584089610112cd525cb68ff647..71154645406548d04d9d1ae4edbc267505112bb5 100644 (file)
@@ -24,6 +24,7 @@ Fluidbook.prototype = {
         if (this.datas.landingPage != undefined && this.datas.landingPage != '') {
             this.landingpage = new FluidbookLandingPage(this);
         }
+        this.contentlock = new FluidbookContentLock(this);
         this.menu = new FluidbookMenu(this);
         this.zoom = new FluidbookZoom(this);
         this.zoom.resetZoom();
@@ -88,7 +89,7 @@ Fluidbook.prototype = {
         $('html').addClass(this.datas.mobileLVersion);
         this.currentPage = -1;
 
-        this.initMaxPage();
+        this.contentlock.init();
 
         this.resize = new FluidbookResize(this);
         this.stats = new FluidbookStats(this);
@@ -104,51 +105,8 @@ Fluidbook.prototype = {
         }, 10);
     },
 
-    initMaxPage: function () {
-        var $this = this;
-        key('⌘+alt+r, ctrl+alt+u', function () {
-            $this.setMaxPage(0);
-        });
-
-        this.maxPage = this.datas.pages;
-        if (this.datas.maxPages > 0) {
-            this.maxPage = Math.min(this.datas.maxPages, this.datas.pages);
-        }
-    },
-
     setMaxPage: function (p, allowbackwards) {
-        var currentMaxPage = this.maxPage;
-        if (allowbackwards === undefined) {
-            allowbackwards = false;
-        }
-        if (p === undefined || p <= 0) {
-            p = this.datas.pages;
-        }
-
-        if (!allowbackwards && p < this.maxPage) {
-            return;
-        }
-
-        this.maxPage = Math.min(p, this.datas.pages);
-        if (currentMaxPage === this.maxPage) {
-            return;
-        }
-        $(this).trigger('fluidbook.maxpage.set', [this.maxPage]);
-        this.updateMaxPage();
-    },
-
-    getMaxPage: function () {
-        return this.maxPage;
-    },
-
-    updateMaxPage: function () {
-        if (this.currentPage > this.maxPage) {
-            this.setCurrentPage(this.maxPage);
-        } else {
-            //this.reloadCurrentPage();
-        }
-        this.hideUnnecessaryButtons();
-        resize();
+        return this.contentlock.setMaxPage(p, allowbackwards);
     },
 
     initTheme: function () {
@@ -174,7 +132,6 @@ Fluidbook.prototype = {
         });
     },
     initKeyboardShortcuts: function () {
-
         // General keyboard shortcuts
         key('home', this.goFirstPage.bind(this));
         key('end', this.goLastPage.bind(this));
@@ -311,7 +268,7 @@ Fluidbook.prototype = {
             return;
         }
         this.transitionAxis = 'x';
-        this.setCurrentPage(this.getMaxPage());
+        this.setCurrentPage(this.contentlock.getMaxPage());
     },
     goNextChapter: function () {
         if (this.transitionning) {
@@ -360,7 +317,7 @@ Fluidbook.prototype = {
         this.setCurrentPage(this.normalizePage(prev));
     },
     normalizePage: function (page) {
-        page = Math.max(1, Math.min(page, this.getMaxPage()));
+        page = Math.max(1, Math.min(page, this.contentlock.getMaxPage()));
         if (!this.displayOnePage && page % 2 == 1) {
             page--;
         }
@@ -602,7 +559,7 @@ Fluidbook.prototype = {
         if (center) {
             if (newPage <= 1) {
                 res.center = -1;
-            } else if (this.getMaxPage() % 2 == 0 && newPage == this.getMaxPage()) {
+            } else if (this.contentlock.getMaxPage() % 2 == 0 && newPage == this.contentlock.getMaxPage()) {
                 res.center = 1;
             }
         }
@@ -642,7 +599,7 @@ Fluidbook.prototype = {
             speed = 0;
         }
 
-        var max = this.getMaxPage() % 2 == 1 ? this.getMaxPage() - 1 : this.getMaxPage();
+        var max = this.contentlock.getMaxPage() % 2 == 1 ? this.contentlock.getMaxPage() - 1 : this.contentlock.getMaxPage();
         var next = page < max;
         var previous = (page > 1);
 
@@ -692,9 +649,9 @@ Fluidbook.prototype = {
         if (this.displayOnePage) {
             right = true;
         } else {
-            if ((page <= 1 && this.l10n.dir == 'ltr') || (page >= this.getMaxPage() && this.l10n.dir == 'rtl')) {
+            if ((page <= 1 && this.l10n.dir == 'ltr') || (page >= this.contentlock.getMaxPage() && this.l10n.dir == 'rtl')) {
                 left = false;
-            } else if ((page <= 1 && this.l10n.dir == 'rtl') || (page >= this.getMaxPage() && this.l10n.dir == 'ltr')) {
+            } else if ((page <= 1 && this.l10n.dir == 'rtl') || (page >= this.contentlock.getMaxPage() && this.l10n.dir == 'ltr')) {
                 right = false;
             }
         }
@@ -790,6 +747,7 @@ Fluidbook.prototype = {
         $(".axis_y").removeClass('axis_y');
         $(".axis_x").removeClass('axis_x');
         $("#links").hide();
+        this.scorm.hideScormLinks();
         this.hideLoader();
         this.hideUnnecessaryButtons(page);
         var animationDuration = d <= 1 ? 0 : parseFloat(this.datas.mobileTransitionDuration);
@@ -827,7 +785,7 @@ Fluidbook.prototype = {
         }
         this.transitionning = false;
         if (this.pad.enabled) {
-            if (this.currentPage == this.getMaxPage()) {
+            if (this.currentPage == this.contentlock.getMaxPage()) {
                 $("#down").css('opacity', 0);
             } else {
                 $("#down").css('opacity', 1);
@@ -925,10 +883,10 @@ Fluidbook.prototype = {
         var pdf;
         var pdfName;
 
-        console.log('open PDF : ' + this.datas.pages + " || " + this.getMaxPage());
+        console.log('open PDF : ' + this.datas.pages + " || " + this.contentlock.getMaxPage());
 
-        if (this.datas.pages != this.getMaxPage()) {
-            pdf = 'https://workshop.fluidbook.com/s/e/' + this.datas.cid + '/1-' + this.getMaxPage();
+        if (this.datas.pages != this.contentlock.getMaxPage()) {
+            pdf = 'https://workshop.fluidbook.com/s/e/' + this.datas.cid + '/1-' + this.contentlock.getMaxPage();
         } else if (this.datas.pdfName.substr(0, 4) == 'http') {
             pdf = this.datas.pdfName;
         } else {
index 081f30a715ce6f2eea3bbd36d88dc464a26b8148..1088b162f5d4ecd2c564c202764501194a9ad97f 100644 (file)
@@ -17,6 +17,11 @@ FluidbookLinks.prototype = {
 
         this.lowdef = this.fluidbook.support.android || this.fluidbook.support.iOS;
 
+        $(document).on('click', '[data-id] a', function () {
+            $this.fluidbook.contentlock.addAction($(this).closest('[data-id]').attr('data-id'), 'click');
+            return true;
+        });
+
         $(document).on('click', '[href^="#"]:not([href="#"])', function () {
             location.hash = $(this).attr('href');
             return false;
index 724df37df84680652f650c40abc4289df9743ef1..6fa2d920ccde9a55fab75118b6a7b5210a144ddf 100644 (file)
@@ -30,7 +30,7 @@ FluidbookLoader.prototype = {
 
         var $callback = callback;
         var $page = $pages.shift();
-        if ($page > this.fluidbook.getMaxPage() || $page < 1) {
+        if ($page > this.fluidbook.contentlock.getMaxPage() || $page < 1) {
             $this.preloadPagesBeforeTransition($pages, $callback);
             return;
         }
@@ -91,7 +91,7 @@ FluidbookLoader.prototype = {
             numPreloadAfter = 3;
             numPreloadBefore = 1;
         }
-        var max = Math.min(page + numPreloadAfter, this.fluidbook.getMaxPage());
+        var max = Math.min(page + numPreloadAfter, this.fluidbook.contentlock.getMaxPage());
         var min = Math.max(1, page - numPreloadBefore);
         this.toPreload = [];
         for (var i = min; i <= max; i++) {
@@ -102,7 +102,7 @@ FluidbookLoader.prototype = {
         this.preloadPages();
     },
     cleanPreloaded: function () {
-        for (var i = 1; i <= this.fluidbook.getMaxPage(); i++) {
+        for (var i = 1; i <= this.fluidbook.contentlock.getMaxPage(); i++) {
             if (this.backgrounds[i] != undefined && this.toPreload.indexOf(i) == -1) {
                 this.deletePage(i);
             }
@@ -188,7 +188,7 @@ FluidbookLoader.prototype = {
         return this.loadImage('images/shadows/pages/' + position + '.png', this.fluidbook.datas.width / 4, this.fluidbook.datas.height);
     },
     loadLeftPage: function (page, doublePage, callback) {
-        if (page > 0 && page <= this.fluidbook.getMaxPage()) {
+        if (page > 0 && page <= this.fluidbook.contentlock.getMaxPage()) {
             this.loadPage(page, doublePage, 'left', callback);
         } else {
             $(doublePage).find('.left').remove();
@@ -196,7 +196,7 @@ FluidbookLoader.prototype = {
         }
     },
     loadRightPage: function (page, doublePage, callback) {
-        if (!this.fluidbook.displayOnePage && page <= this.fluidbook.getMaxPage() && page > 0) {
+        if (!this.fluidbook.displayOnePage && page <= this.fluidbook.contentlock.getMaxPage() && page > 0) {
             this.loadPage(page, doublePage, 'right', callback);
         } else {
             $(doublePage).find('.right').remove();
index f76cb1e88ac4bb15dd5bd9bcb45a39b64e6a4aec..2653f206f4d6a224c8b19b7bbd036b51f1227bbe 100644 (file)
@@ -119,7 +119,7 @@ FluidbookSearch.prototype = {
         this.resultPages = [];
 
         var q, v, k, kk, word, wordata, page, occurences, p;
-        var maxPage = this.fluidbook.getMaxPage();
+        var maxPage = this.fluidbook.contentlock.getMaxPage();
 
         for (kk in words) {
             q = words[kk];
@@ -192,7 +192,7 @@ FluidbookSearch.prototype = {
         var terms = [];
         var total = 0;
         var doublesPages = [];
-        var maxPage = this.fluidbook.getMaxPage();
+        var maxPage = this.fluidbook.contentlock.getMaxPage();
 
         for (var p in TEXTS) {
             var t = TEXTS[p];
@@ -356,7 +356,7 @@ FluidbookSearch.prototype = {
             }
             pageNrs.push(pageNr);
             pageNr++;
-            if (pageNr < this.fluidbook.getMaxPage()) {
+            if (pageNr < this.fluidbook.contentlock.getMaxPage()) {
                 pageNrs.push(pageNr);
             }
         }
@@ -556,7 +556,7 @@ FluidbookSearch.prototype = {
         var hits = [];
 
         // Create a list of all pages so we can record which ones have a hit on the search term
-        for (var i = 0; i <= this.fluidbook.getMaxPage(); i++) {
+        for (var i = 0; i <= this.fluidbook.contentlock.getMaxPage(); i++) {
             hits[i] = 0;
         }
         // Map result hits to pages
index 80a40603f037888be71415d66506a712d1bb20c1..852f1f99d6f16f5ce068e39ebb79bf390f35a41f 100644 (file)
@@ -108,7 +108,7 @@ FluidbookSlider.prototype = {
             pageMin = 0;
         }
 
-        return Math.min(this.fluidbook.getMaxPage(), Math.max(pageMin, page));
+        return Math.min(this.fluidbook.contentlock.getMaxPage(), Math.max(pageMin, page));
     },
 
     resize: function (ww, hh, single) {
@@ -137,9 +137,9 @@ FluidbookSlider.prototype = {
 
     updateSnaps: function (single) {
         if (single) {
-            this.snapsCount = this.fluidbook.getMaxPage();
+            this.snapsCount = this.fluidbook.contentlock.getMaxPage();
         } else {
-            this.snapsCount = Math.floor(this.fluidbook.getMaxPage() / 2) + 1;
+            this.snapsCount = Math.floor(this.fluidbook.contentlock.getMaxPage() / 2) + 1;
         }
         this.cursorWidth = Math.max(30, this.sliderWidth / this.snapsCount);
         this.snapsWidth = (this.sliderWidth - this.cursorWidth) / (this.snapsCount - 1);
@@ -164,7 +164,7 @@ FluidbookSlider.prototype = {
     getCursorXByPage: function (page) {
         var left;
         if (this.fluidbook.l10n.rtl) {
-            page = this.fluidbook.getMaxPage() - page;
+            page = this.fluidbook.contentlock.getMaxPage() - page;
         }
         if (this.fluidbook.resize.orientation == 'portrait') {
             left = this.snapsWidth * (page - 1);
@@ -189,7 +189,7 @@ FluidbookSlider.prototype = {
             if (page > 0) {
                 left = page;
             }
-            if (page <= this.fluidbook.getMaxPage()) {
+            if (page <= this.fluidbook.contentlock.getMaxPage()) {
                 right = page + 1;
             }
         }
@@ -229,7 +229,7 @@ FluidbookSlider.prototype = {
 
     setThumb: function (thumb, page, shade) {
         thumb.find('.bookmark').attr('data-page', page);
-        if (page > 0 && page <= this.fluidbook.getMaxPage()) {
+        if (page > 0 && page <= this.fluidbook.contentlock.getMaxPage()) {
             thumb.css('visibility', 'visible');
             this.fluidbook.loader.getThumbImage(page, thumb.find('.img'), shade);
             thumb.find('a').attr('href', '#/page/' + page);
index 63a4d50ab55a2f12d89f830505f02aebef4d5965..011e542b68c6fc0805ab34123b6c08ea8f5c624f 100644 (file)
@@ -80,7 +80,7 @@ FluidbookSound.prototype = {
             page--;
         }
 
-        var last = this.fluidbook.getMaxPage();
+        var last = this.fluidbook.contentlock.getMaxPage();
         if (last % 2 == 1) {
             last++;
         }
index 9cd918e3916a3dec0fe60e65c5cb09906a07b4ed..806df50ed0378b537cb97137fd2625cf4e205c87 100644 (file)
@@ -16,27 +16,26 @@ function FluidbookVideo(fluidbook) {
         $this.resizeControls();
     });
 
-    $(window).on('videoFullscreenEntered', function() {
+    $(window).on('videoFullscreenEntered', function () {
         //console.log('>>> Video player entered full screen mode...');
         $this.fullscreenActive = true;
     });
 
-    $(window).on('videoFullscreenExited', function() {
+    $(window).on('videoFullscreenExited', function () {
         //console.log('<<< Video player exited full screen mode.');
 
         // Try resizing after a short delay. Depending on the system and the speed of the
-        setTimeout(function() {
+        setTimeout(function () {
             $this.fluidbook.resize.resize();
         }, 250);
 
-        setTimeout(function() {
+        setTimeout(function () {
             $this.fullscreenActive = false; // Stop blocking orientation change / page updates
             $this.fluidbook.resize.resize();
         }, 1000);
     });
 
 
-
     this.fluidbook = fluidbook;
     this.video = (Modernizr.video && (Modernizr.video.h264 || Modernizr.video.webm || Modernizr.video.ogg)) != false;
 
@@ -99,6 +98,7 @@ FluidbookVideo.prototype = {
             sound = $(e).data('sound'),
             autoplay = $(e).data('autoplay'),
             setup = $(e).data('setup'),
+            linkid = $(e).data('link-id'),
             path,
             poster,
             html,
@@ -218,15 +218,17 @@ FluidbookVideo.prototype = {
                             player.pause();
                         }, 100);
                     }
-
                 });
 
-
                 player.play(); // Start player to go to current position - necessary even if it will be paused immediately
                 if (settings.paused) {
                     player.pause();
                 }
 
+                setTimeout(function () {
+                    $this.fluidbook.contentlock.addAction(linkid, 'complete');
+                }, (player.duration() - 5) * 1000);
+
                 // var playPromise = player.play();
                 // if (settings.paused) {
                 //     if (playPromise && (typeof Promise !== 'undefined') && (playPromise instanceof Promise)) {
@@ -260,7 +262,7 @@ FluidbookVideo.prototype = {
         //     $('#' + player.id()).attr('style', ''); // Reset inline styles
         // });
 
-        player.on('fullscreenchange', function() {
+        player.on('fullscreenchange', function () {
             if (player.isFullscreen()) {
                 $(window).trigger('videoFullscreenEntered');
             } else {
@@ -268,6 +270,9 @@ FluidbookVideo.prototype = {
             }
         });
 
+        player.on('ended', function () {
+            $this.fluidbook.contentlock.addAction(linkid, 'complete');
+        });
     },
     openVideo: function (link) {
         if (link === undefined) return false;
@@ -370,7 +375,7 @@ FluidbookVideo.prototype = {
         if (skipPopupVideos) {
             // Filter out any videos that exist inside the #view element
             playersToBeRemoved = playersToBeRemoved.filter(function (player) {
-                return ! $.contains(document.getElementById('view'), document.getElementById(player.id()));
+                return !$.contains(document.getElementById('view'), document.getElementById(player.id()));
             });
         }
 
index b2292a486e26c96545043464e3f2bfcab67e6f52..ad81b72024b24dab4ec83fc7b22672105a9028f9 100644 (file)
@@ -26,7 +26,7 @@ FluidbookBourbonForm.prototype = {
         view += '<form class="cart-bourbon-suggest" action="" method="post">';
         view += '<div>';
         view += '<label>Page number';
-        view += '<input type="text" id="bourbon-suggestion-page" data-parsley-type="integer" name="page" value="' + this.fluidbook.currentPage + '" min="0" max="' + this.fluidbook.getMaxPage() + '" tabindex="100" required>';
+        view += '<input type="text" id="bourbon-suggestion-page" data-parsley-type="integer" name="page" value="' + this.fluidbook.currentPage + '" min="0" max="' + this.fluidbook.contentlock.getMaxPage() + '" tabindex="100" required>';
         view += '</label>';
         view += '<label>Suggestion type';
         view += '<select id="bourbon-suggestion-type"><option>TYPO / WORDING</option><option>CLARIFICATION REQUEST</option><option>IMPROVEMENT SUGGESTION (Gaps, Ideas, etc)</option></select>';
index 4c9a939dfe8baa799f468de8369a4cb7da2e7842..23c5dcf8ff6814a2de48c22240f994b8368da8cf 100644 (file)
@@ -198,7 +198,7 @@ FluidbookChapters.prototype = {
 
     removeItemsAfterMaxPage: function () {
 
-        var max = this.fluidbook.getMaxPage();
+        var max = this.fluidbook.contentlock.getMaxPage();
         $('.mview[data-menu="chapters"] ul.chapters li[data-page]').each(function () {
             var p = parseInt($(this).data('page'));
             if (isNaN(p)) {
index b2b6f7ac7d70475bb9ac240f8981a796ca71b06b..2b68dfac7f5f4aef68b77887c2ab7a8112302132 100644 (file)
@@ -29,7 +29,7 @@ FluidbookIndex.prototype = {
             var c = '';
             var s1, s2;
 
-            for (var i = 0; i <= this.fluidbook.getMaxPage(); i += 2) {
+            for (var i = 0; i <= this.fluidbook.contentlock.getMaxPage(); i += 2) {
                 var pages = [];
                 j = i + 1;
                 ix1 = '';
@@ -64,7 +64,7 @@ FluidbookIndex.prototype = {
                     s2 = 'left'
                 }
 
-                if (j <= this.fluidbook.getMaxPage()) {
+                if (j <= this.fluidbook.contentlock.getMaxPage()) {
                     ix2 += '<div class="thumb ' + s1 + '"><a href="#/page/' + j + '">' + this.fluidbook.loader.getThumbImage(j, null, true) + '</a><span class="number">' + this.fluidbook.physicalToVirtual(j) + '</span>';
                     if (this.fluidbook.bookmarks.enabled) {
                         ix2 += this.fluidbook.bookmarks.getBookmarkForPage(j, true);
index 6076d1da99a47bb87fe96e895ad80b9aa8a3ded2..6d2a4dae452648288f579920e92cf27d49ce29b5 100644 (file)
@@ -80,7 +80,7 @@ function initScormEvents() {
             } else if (currentLocation.indexOf('{') === 0) {
                 var location = JSON.parse(currentLocation);
                 if (location.maxPage) {
-                    fluidbook.setMaxPage(location.maxPage, true);
+                    fluidbook.contentlock.setMaxPage(location.maxPage, true);
                 }
                 if (location.page) {
                     fluidbook.setCurrentPage(location.page);
@@ -111,7 +111,7 @@ function scormSaveCurrentPosition(page, maxPage) {
         page = fluidbook.currentPage;
     }
     if (maxPage === undefined) {
-        maxPage = fluidbook.getMaxPage();
+        maxPage = fluidbook.contentlock.getMaxPage();
     }
     setScormValue('location', JSON.stringify({page: page, maxPage: maxPage}));
 }