return g.join(',');
},
addGroup: function (from, nb, name) {
- var to = Math.min(from + (nb - 1), this.fluidbook.getMaxPage());
+ var to = Math.min(from + (nb - 1), this.fluidbook.pages);
for (var i = from; i <= to; i++) {
this._pagesToGroup[i] = this._groups;
}
this._groups++;
},
completeGroups: function () {
- for (var i = 1; i <= this.fluidbook.getMaxPage(); i++) {
+ for (var i = 1; i <= this.fluidbook.pages; i++) {
if (this._pagesToGroup[i] == undefined || this._pagesToGroup[i] == null) {
this._pagesToGroup[i] = this._groups;
this._groupOrder.push(this._groups);
this._groups++;
}
}
+
+ console.log(this._pagesToGroup);
},
getPreviousGroup: function (group) {
var o = this.getOrderGroup(group);
},
getPagesOfGroup: function (groupId) {
var res = [];
- for (var i = 1; i <= this.fluidbook.getMaxPage(); i++) {
+ for (var i = 1; i <= this.fluidbook.pages; i++) {
if (this._pagesToGroup[i] == groupId) {
res.push(i);
}
cornersOnly = false;
}
var pages = this.getLinkedPages(page);
+ console.log(pages);
for (i in pages) {
var page = pages[i];
if (!cornersOnly) {
}
$('html').addClass(this.datas.mobileLVersion);
this.currentPage = -1;
- this.maxPage = this.getMaxPage();
+ this.maxPage = this.datas.pages;
+ if (this.datas.maxPages > 0) {
+ this.maxPage = Math.min(this.datas.maxPages, this.datas.pages);
+ }
this.resize = new FluidbookResize(this);
this.stats = new FluidbookStats(this);
},
setMaxPage: function (p) {
- this.maxPage = p;
+ if (p === undefined) {
+ p = this.datas.pages;
+ }
+
+ this.maxPage = Math.min(p, this.datas.pages);
this.updateMaxPage();
},
return this.maxPage;
},
- updateMaxPage() {
-
+ updateMaxPage: function () {
+ if (this.currentPage > this.maxPage) {
+ this.setCurrentPage(this.maxPage);
+ } else {
+ this.reloadCurrentPage();
+ }
+ this.hideUnnecessaryButtons();
+ resize();
},
initTheme: function () {
this.transitionAxis = 'x';
}
if (page != $this.currentPage) {
- $($this).trigger('changePage', [page]);
+ $($this).trigger('fluidbook.page.navigation', [page]);
}
if (this.landingpage !== undefined) {
this.landingpage.hide();
return;
},
pageTransition: function (pageNr) {
-
$(this).trigger('fluidbook.beforePageTransition');
this.tooltip.hideTooltip();
if (pageNr == this.normalizePage(this.currentPage) || this.currentPage == -1 || !this.support.transitions2d || this.datas.mobileTransitions == 'none') {
return this.pageTransition1D(pageNr);
}
-
if (this.displayOnePage) {
return this.pageTransition2DPortrait(pageNr);
}
-
if (!this.support.transitions3d || this.datas.mobileTransitions == 'slide') {
return this.pageTransition2D(pageNr);
}
-
return this.pageTransition3D(pageNr);
},
pageTransition3D: function (pageNr) {
var $this = this;
var pdf;
var pdfName;
- if (this.datas.pdfName.substr(0, 4) == 'http') {
+
+ console.log('open PDF : ' + this.datas.pages + " || " + this.getMaxPage());
+
+ if (this.datas.pages != this.getMaxPage()) {
+ pdf = 'https://workshop.fluidbook.com/s/e/' + this.datas.cid + '/1-' + this.getMaxPage();
+ } else if (this.datas.pdfName.substr(0, 4) == 'http') {
pdf = this.datas.pdfName;
} else {
pdf = this.relativeToAbsolute('data/' + this.datas.pdfName);
}
$("#view").append('<div id="' + menuId + '" class="mview' + color + '" data-menu="chapters">' + view + '</div>');
+ this.fluidbook.chapters.removeItemsAfterMaxPage();
if (callback != undefined) {
callback();
}
this.resultPages = [];
var q, v, k, kk, word, wordata, page, occurences, p;
-
+ var maxPage = this.fluidbook.getMaxPage();
for (kk in words) {
q = words[kk];
for (page in v.p) {
var occurences = v.p[page];
page = parseInt(page);
+ if (page > maxPage) {
+ continue;
+ }
if ((page % 2) == 1) {
page--;
}
var terms = [];
var total = 0;
var doublesPages = [];
+ var maxPage = this.fluidbook.getMaxPage();
for (var p in TEXTS) {
var t = TEXTS[p];
continue;
}
page = parseInt(p);
+ if (page > maxPage) {
+ continue;
+ }
if ((page % 2) == 1) {
page--;
}
});
},
displaySearchHints: function (hints) {
-
var $this = this;
- //this.hideSearchHints();
if (hints.length == 0) {
return;
}
this.kill();
},
hideSearchHints: function () {
- // this.killLastSearchHint();
- // $("#searchHints").html('');
- // $("#searchHints").hide();
this.menuSearchHints.html('').hide(); // Clear and hide all hints
},
}
return Math.min(this.fluidbook.getMaxPage(), Math.max(pageMin, page));
-
},
resize: function (ww, hh, single) {
-
if (single) {
this.sliderWidth = ww / 2;
} else {
this.sliderWidth = this.fluidbook.resize.getScreenFluidbookWidth() * 0.4;
}
+
this.sliderWidth = Math.round(this.sliderWidth);
var bottom = 26;
if (single) {
if (this.html[sub] == null) {
this.makeView(sub);
}
+
return {sub: sub, view: this.html[sub], title: this.titles[sub], color: this.colors[sub]};
},
makeView: function (sub) {
var href;
var level = chapter.level - baseLevel;
+ var p = '';
if (chapter.page != '') {
- var p = this.fluidbook.virtualToPhysical(chapter.page);
+ p = this.fluidbook.virtualToPhysical(chapter.page);
if (p === false) {
+ p='';
href = this.cascade ? 'href="#"' : "nohref";
} else {
href = 'href="#/page/' + p + '"';
href = this.cascade ? 'href="#"' : "nohref";
}
if (this.style == 'classic') {
- res += '<li data-level="' + level + '"><a ' + href + ' class="level' + level + '">';
+ res += '<li data-level="' + level + '" data-page="' + p + '"><a ' + href + ' class="level' + level + '">';
} else if (this.style == 'ina') {
- res += '<li style="background-color:#' + color + ';" data-level="' + level + '"><a ' + href + ' class="nodark level' + level + '">';
+ res += '<li style="background-color:#' + color + ';" data-level="' + level + '" data-page="' + p + '"><a ' + href + ' class="nodark level' + level + '">';
}
res += '<span>' + chapter.label + '</span>';
if (href != 'nohref') {
res += '</a></li>';
return res;
- }
+ },
+
+ removeItemsAfterMaxPage: function () {
+
+ var max = this.fluidbook.getMaxPage();
+ $('.mview[data-menu="chapters"] ul.chapters li[data-page]').each(function () {
+ var p = parseInt($(this).data('page'));
+ if (isNaN(p)) {
+ return;
+ }
+ if (p > max) {
+ $(this).remove();
+ }
+ });
+
+ for(var i=0;i<=10;i++) {
+ $('.mview[data-menu="chapters"] ul.chapters li[data-page=""]').each(function () {
+ if ($(this).find('ul li').length == 0) {
+ $(this).remove();
+ }
+ });
+ }
+ },
};
this.normalHTML = '';
this.padHTML = '';
},
+
getView: function (group) {
if (this.fluidbook.pad.enabled) {
return this.getPadView(group);
return this.getNormalView();
}
},
+
getPadView: function (group) {
return this.fluidbook.bookmarks.getIndex(true, group);
},
- getNormalView: function () {
+ getNormalView: function () {
if (this.normalHTML == '') {
this.normalHTML += '<div class="content"><div id="indexView">';
var j = 0;
console.log(err);
}
- $(fluidbook).on('changePage', function (e, page) {
+ $(fluidbook).on('fluidbook.page.navigation', function (e, page) {
setScormValue('location', 'page_' + page);
});