]> _ Git - fluidbook-html5.git/commitdiff
wip #2183 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 16 Aug 2018 17:41:10 +0000 (19:41 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 16 Aug 2018 17:41:10 +0000 (19:41 +0200)
js/libs/fluidbook/fluidbook.js

index 6aa245ec64aa53892b5df12e81c5c65ab6e0de5d..b744a6e40a4a303b4101d379f439e46fbfab9dfe 100644 (file)
@@ -98,13 +98,14 @@ Fluidbook.prototype = {
         this.resize = new FluidbookResize(this);
         this.stats = new FluidbookStats(this);
         this.stats.track(10);
+        this.flags = {};
 
         this.initTheme();
         this.initKeyboardShortcuts();
     },
 
     setMaxPage: function (p) {
-        if (p === undefined) {
+        if (p === undefined || p <= 0) {
             p = this.datas.pages;
         }
 
@@ -120,7 +121,7 @@ Fluidbook.prototype = {
         if (this.currentPage > this.maxPage) {
             this.setCurrentPage(this.maxPage);
         } else {
-            this.reloadCurrentPage();
+            //this.reloadCurrentPage();
         }
         this.hideUnnecessaryButtons();
         resize();
@@ -1188,5 +1189,29 @@ Fluidbook.prototype = {
 
         }
         return w;
-    }
+    },
+
+    setFlag: function (name, value) {
+        if (value === undefined) {
+            value = true;
+        }
+        this.flags[name] = value;
+    },
+
+    hasFlag: function (name) {
+        return this.flags[name] === true;
+    },
+
+    hasFlags: function (names) {
+        var res = true;
+        var $this = this;
+        $.each(names, function (k, v) {
+            if ($this.hasFlag(v)) {
+                return;
+            }
+            res = false;
+            return true;
+        });
+        return res;
+    },
 }