]> _ Git - fluidbook-html5.git/commitdiff
fix #2717 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 10 May 2019 13:18:35 +0000 (15:18 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 10 May 2019 13:18:35 +0000 (15:18 +0200)
js/libs/fluidbook/fluidbook.bookmarks.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.resize.js

index 1fdabe77556a0296584c17782ba3d6a3ab0658eb..7371820fc5d6e6218cadf890e747a0090e07f89f 100644 (file)
@@ -32,13 +32,13 @@ FluidbookBookmarks.prototype = {
 
         $(document).on('click', '.bookmarkssub a.send', function () {
             var subject = '%title%';
-            if ($this.fluidbook.datas.bookmark_email_title != '') {
+            if ($this.fluidbook.datas.bookmark_email_title !== '') {
                 subject = $this.fluidbook.datas.bookmark_email_title;
             }
 
 
             var body = $this.fluidbook.l10n.__('Please see the attached files from "%title%".');
-            if ($this.fluidbook.datas.bookmark_email_body != '') {
+            if ($this.fluidbook.datas.bookmark_email_body !== '') {
                 body = $this.fluidbook.datas.bookmark_email_body;
             }
 
@@ -100,15 +100,15 @@ FluidbookBookmarks.prototype = {
             if (b > this.fluidbook.contentlock.getMaxPage()) {
                 continue;
             }
-            if (rs == 0) {
+            if (rs === 0) {
                 rs = re = b;
                 continue;
             }
-            if (re + 1 == b) {
+            if (re + 1 === b) {
                 re = b;
                 continue;
             }
-            if (rs == re) {
+            if (rs === re) {
                 g.push('' + rs);
             } else {
                 g.push(rs + '-' + re);
@@ -117,8 +117,8 @@ FluidbookBookmarks.prototype = {
             rs = re = b;
         }
 
-        if (rs != 0) {
-            if (rs == re) {
+        if (rs !== 0) {
+            if (rs === re) {
                 g.push('' + rs);
             } else {
                 g.push(rs + '-' + re);
@@ -138,7 +138,7 @@ FluidbookBookmarks.prototype = {
     },
     completeGroups: function () {
         for (var i = 1; i <= this.fluidbook.datas.pages; i++) {
-            if (this._pagesToGroup[i] == undefined || this._pagesToGroup[i] == null) {
+            if (this._pagesToGroup[i] === undefined || this._pagesToGroup[i] === null) {
                 this._pagesToGroup[i] = this._groups;
                 this._groupOrder.push(this._groups);
                 this._groups++;
@@ -147,7 +147,7 @@ FluidbookBookmarks.prototype = {
     },
     getPreviousGroup: function (group) {
         var o = this.getOrderGroup(group);
-        if (o == -1) {
+        if (o === -1) {
             return false;
         }
         o--;
@@ -155,7 +155,7 @@ FluidbookBookmarks.prototype = {
     },
     getNextGroup: function (group) {
         var o = this.getOrderGroup(group);
-        if (o == -1) {
+        if (o === -1) {
             return false;
         }
         o++;
@@ -166,13 +166,13 @@ FluidbookBookmarks.prototype = {
     },
     getGroupName: function (groupId) {
         var res = '';
-        if (this._groupNames[groupId] != undefined) {
+        if (this._groupNames[groupId] !== undefined) {
             res = this._groupNames[groupId];
         }
-        if (res == '') {
+        if (res === '') {
             var pages = this.getPagesOfGroup(groupId);
             res = this.fluidbook.physicalToVirtual(pages[0]);
-            if (pages.length == 1) {
+            if (pages.length === 1) {
                 return res;
             }
             res += " - " + this.fluidbook.physicalToVirtual(pages[pages.length - 1]);
@@ -192,7 +192,7 @@ FluidbookBookmarks.prototype = {
         return this.getPagesOfGroup(groupId).length;
     },
     getBookmarkedGroups: function (onlyBookmarked) {
-        if (onlyBookmarked == undefined) {
+        if (onlyBookmarked === undefined) {
             onlyBookmarked = true;
         }
 
@@ -220,7 +220,7 @@ FluidbookBookmarks.prototype = {
     getNextPageInGroupOfPage: function (page) {
         var group = this.getLinkedPages(page);
         var index = group.indexOf(page);
-        if (index == group.length - 1) {
+        if (index === group.length - 1) {
             return false;
         }
         return group[index + 1];
@@ -228,7 +228,7 @@ FluidbookBookmarks.prototype = {
     getPreviousPageInGroupOfPage: function (page) {
         var group = this.getLinkedPages(page);
         var index = group.indexOf(page);
-        if (index == 0) {
+        if (index === 0) {
             return false;
         }
         return group[index - 1];
@@ -260,7 +260,7 @@ FluidbookBookmarks.prototype = {
         var group = this.getGroupOfPage(page);
         var pages = this.getPagesOfGroup(group);
         var i = pages.indexOf(page);
-        if (i == pages.length - 1) {
+        if (i === pages.length - 1) {
             return false;
         }
         return true;
@@ -273,12 +273,13 @@ FluidbookBookmarks.prototype = {
         return this.getPagesOfGroup(group);
     },
     addBookmark: function (page, cornersOnly) {
-        if (cornersOnly == undefined) {
+        if (cornersOnly === undefined) {
             cornersOnly = false;
         }
         var pages = this.getLinkedPages(page);
+        var page;
         for (i in pages) {
-            var page = pages[i];
+            page = pages[i];
 
             if (!cornersOnly) {
                 this.bookmarks.push(page);
@@ -348,10 +349,10 @@ FluidbookBookmarks.prototype = {
         return this.bookmarks.indexOf(page) > -1;
     },
     getBookmarkForPage: function (pageNr, onlyOne, allwaysAtRight) {
-        if (onlyOne == undefined) {
+        if (onlyOne === undefined) {
             onlyOne = false;
         }
-        if (allwaysAtRight == undefined) {
+        if (allwaysAtRight === undefined) {
             allwaysAtRight = false;
         }
 
@@ -360,6 +361,8 @@ FluidbookBookmarks.prototype = {
             to++;
         }
 
+        console.log('getBookmarkForPage',pageNr);
+
         var bookmarks = "";
         for (var i = pageNr; i <= to; i++) {
             if (i > 0 && i <= this.fluidbook.contentlock.getMaxPage()) {
@@ -367,9 +370,9 @@ FluidbookBookmarks.prototype = {
                 if (allwaysAtRight) {
                     side = 'right';
                 } else {
-                    side = (i % 2 == 0) ? 'left' : 'right';
-                    if (this.fluidbook.l10n.dir == 'rtl') {
-                        side = side == 'left' ? 'right' : 'left';
+                    side = (i % 2 === 0) ? 'left' : 'right';
+                    if (this.fluidbook.l10n.dir === 'rtl') {
+                        side = side === 'left' ? 'right' : 'left';
                     }
                 }
 
@@ -390,7 +393,7 @@ FluidbookBookmarks.prototype = {
         if (c === false) {
             return c;
         }
-        if (title == '') {
+        if (title === '') {
             title = this.fluidbook.l10n.__('bookmarks');
         }
         var index = '<div class="bookmarkssub"><div class="caption">' + this.fluidbook.menu.closeButton() + '<h2>' + title + '</h2>';
@@ -400,44 +403,44 @@ FluidbookBookmarks.prototype = {
         return index;
     },
     hasBookmarkedPages: function (all) {
-        if (all == undefined) {
+        if (all === undefined) {
             all = false;
         }
 
-        if (all == false) {
+        if (all === false) {
             groups = this.getBookmarkedGroups();
         } else {
             groups = this.getOrderedGroups();
         }
 
-        if (groups.length == 0) {
+        if (groups.length === 0) {
             return false;
         }
         return true;
     },
     getIndex: function (all, onlyGroup, downloadLabel) {
-        if (all == undefined) {
+        if (all === undefined) {
             all = false;
         }
         var groups;
 
-        if (all == false) {
+        if (all === false) {
             groups = this.getBookmarkedGroups();
         } else {
             groups = this.getOrderedGroups();
         }
 
-        if (groups.length == 0) {
+        if (groups.length === 0) {
             return false;
         }
 
-        if (downloadLabel == '') {
+        if (downloadLabel === '') {
             downloadLabel = this.fluidbook.l10n.__('download');
         }
 
         var index = '<div class="content"><div id="indexView" class="bookmarkView">';
 
-        if (onlyGroup == undefined || !onlyGroup) {
+        if (onlyGroup === undefined || !onlyGroup) {
             for (var g = 0; g < groups.length; g++) {
                 var group = groups[g];
                 var pages = [];
index cc7a3dbaabbe8dd2b925586016b31cd43c0e25cd..1dfc4fb3ff6b04b60f0a87df36270a8d00dd6f52 100644 (file)
@@ -397,7 +397,7 @@ Fluidbook.prototype = {
     },
     normalizePage: function (page) {
         page = Math.max(1, Math.min(page, this.contentlock.getMaxPage()));
-        if (!this.displayOnePage && page % 2 == 1) {
+        if (!this.displayOnePage && page % 2 === 1) {
             page--;
         }
         return page;
index aa008ae7839ca64c1636be4ccd15f636d760e334..a75ed6866b1a08305dd4417749c3e2b89dcb3138 100644 (file)
@@ -169,16 +169,16 @@ FluidbookLinks.prototype = {
 
     },
     initLinks: function (pageNr) {
-        if (pageNr == undefined) {
+        if (pageNr === undefined) {
             pageNr = this.fluidbook.currentPage;
         }
 
         var lClass = 'left';
-        if (this.fluidbook.displayOnePage && pageNr % 2 == 1) {
+        if (this.fluidbook.displayOnePage && pageNr % 2 === 1) {
             lClass = 'right';
         }
 
-        if (pageNr % 2 == 1) {
+        if (!this.fluidbook.displayOnePage && pageNr % 2 === 1) {
             pageNr--;
         }
 
@@ -186,7 +186,7 @@ FluidbookLinks.prototype = {
 
         links.removeClass('left').removeClass('right').addClass(lClass).html(this.fluidbook.datas.links[pageNr]).show();
         if (this.fluidbook.datas.bookmark) {
-            links.append(this.fluidbook.bookmarks.getBookmarkForPage(pageNr));
+            links.append(this.fluidbook.bookmarks.getBookmarkForPage(pageNr, this.fluidbook.displayOnePage, this.fluidbook.displayOnePage));
         }
 
         links.prepend('<div class="leftContainer"></div><div class="rightContainer"></div>');
index cb6ed12e2a17040f0560a2623da753fb9c9b3798..a9483213fcf0553c1309221a852a23a28bb53f1b 100644 (file)
@@ -419,7 +419,7 @@ FluidbookResize.prototype = {
         this.orientation = newo;
 
         $('body').addClass(this.orientation);
-        this.fluidbook.displayOnePage = (this.orientation == 'portrait');
+        this.fluidbook.displayOnePage = (this.orientation === 'portrait');
 
         if (changeOrientation) {
             $(this.fluidbook).trigger('fluidbook.resize.beforeOrientationChange');