From: Vincent Vanwaelscappel Date: Thu, 16 Aug 2018 17:41:10 +0000 (+0200) Subject: wip #2183 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ad33acd51433f888e113d6d98ece3ff6a9db00ec;p=fluidbook-html5.git wip #2183 @1.5 --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 6aa245ec..b744a6e4 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -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; + }, }