} catch (err) {
}
});
- },
- initPage: function (pageNr, doublePage, position) {
+ }, initPage: function (pageNr, doublePage, position) {
if ($("#page_" + pageNr).length > 0) {
return;
}
$(doublePage).find('.' + position).remove();
var page = '<div class="page ' + position + '" id="page_' + pageNr + '" data-page="' + pageNr + '"><div class="background" page="' + pageNr + '"></div><div class="ctlinks" data-blendmode="normal"></div><div class="texts" highlight=""></div><div class="clinks" data-blendmode="normal"></div><div class="shade"></div></div>';
$(doublePage).append(page);
- },
- hidePage: function (position) {
+ }, hidePage: function (position) {
$("#pages ." + position).hide();
- },
- canChangePage: function () {
+ }, canChangePage: function () {
try {
return this.pagetransitions.canChangePage();
} catch (e) {
}
return false;
- },
- initVideos: function () {
+ }, initVideos: function () {
this.video.initVideos();
- },
- getNextOffset: function () {
+ }, getNextOffset: function () {
var offset = 2;
if (this.displayOnePage) {
offset = 1;
}
this.transitionAxis = 'x';
return offset;
- },
- goNextPage: function () {
+ }, goNextPage: function () {
if (!this.canChangePage()) {
return;
}
this.transitionAxis = 'x';
this.setCurrentPage(this.normalizePage(this.currentPage) + this.getNextOffset());
}
- },
- goFirstPage: function () {
+ }, goFirstPage: function () {
if (!this.canChangePage()) {
return;
}
this.transitionAxis = 'x';
this.setCurrentPage(1);
- },
- goPreviousPage: function () {
+ }, goPreviousPage: function () {
if (!this.canChangePage()) {
return;
}
this.transitionAxis = 'x';
this.setCurrentPage(this.normalizePage(this.currentPage) - this.getNextOffset());
}
- },
- goLastPage: function () {
+ }, goLastPage: function () {
if (!this.canChangePage()) {
return;
}
this.transitionAxis = 'x';
this.setCurrentPage(this.contentlock.getMaxPage());
- },
- goNextChapter: function () {
+ }, goNextChapter: function () {
if (!this.canChangePage()) {
return;
}
}
this.transitionAxis = 'x';
this.setCurrentPage(this.normalizePage(next));
- },
- goPreviousChapter: function () {
+ }, goPreviousChapter: function () {
if (!this.canChangePage()) {
return;
}
}
this.transitionAxis = 'x';
this.setCurrentPage(this.normalizePage(prev));
- },
- goNextChapterPage: function () {
+ }, goNextChapterPage: function () {
if (!this.canChangePage()) {
return;
}
}
this.transitionAxis = 'y';
this.setCurrentPage(this.normalizePage(next));
- },
- goPreviousChapterPage: function () {
+ }, goPreviousChapterPage: function () {
if (!this.canChangePage()) {
return;
}
}
this.transitionAxis = 'y';
this.setCurrentPage(this.normalizePage(prev));
- },
- normalizePage: function (page) {
+ }, normalizePage: function (page) {
page = Math.max(1, Math.min(page, this.contentlock.getMaxPage()));
if (!this.displayOnePage && page % 2 === 1) {
page--;
}
return page;
- },
- setCurrentPage: function (page) {
+ }, setCurrentPage: function (page) {
window.location.hash = "#/page/" + this.normalizePage(page);
- },
- changeAddress: function () {
+ }, changeAddress: function () {
var hash = window.location.hash;
if ($('.mview[data-hash="' + hash + '"]').length > 0) {
return;
window.location.hash = "/page/" + page;
}
}
- },
- getButtonsVisibility: function (page) {
+ }, getButtonsVisibility: function (page) {
if (page === undefined) {
page = this.currentPage;
}
var max = this.contentlock.getMaxPage();
- if (this.contentlock.getMaxPage() % 2 === 1 &&
- this.settings.mobileNavigationType !== 'portrait' &&
- this.settings.mobileNavigationType !== 'mobilefirst' &&
- this.resize.orientation !== 'portrait') {
+ if (this.contentlock.getMaxPage() % 2 === 1 && this.settings.mobileNavigationType !== 'portrait' && this.settings.mobileNavigationType !== 'mobilefirst' && this.resize.orientation !== 'portrait') {
max--;
}
var next = page < max;
var previous = (page > 1);
return {previous: previous, next: next};
- },
- hideUnnecessaryButtons: function (page) {
+ }, hideUnnecessaryButtons: function (page) {
var speed = 500;
if (page === undefined) {
page = this.currentPage;
if (s_out.length > 0) {
$(s).children(s_out.join(',')).addClass('hidden');
}
- }
- ,
- showAllButtons: function () {
+ }, showAllButtons: function () {
$("#next-arrows,#prev-arrows").addClass('help').show();
},
$("#pagesnumbers .left").html(this.getPageNumberOfSide('left', true));
$("#pagesnumbers .right").html(this.getPageNumberOfSide('right', true));
$("#pagesnumbers").removeClass('hidden');
- },
- getPhysicalPageNumberOfSide: function (side, strict) { // Side should be 'left' or 'right'
+ }, getPhysicalPageNumberOfSide: function (side, strict) { // Side should be 'left' or 'right'
if (undefined === strict) {
strict = false;
}
pageSide = $("#currentDoublePage").find('.page').eq(0);
}
return $(pageSide).data('page');
- },
- getDisplayedPages: function () {
+ }, getDisplayedPages: function () {
var res = [];
var left = this.getPhysicalPageNumberOfSide('left', true);
var right = this.getPhysicalPageNumberOfSide('right', true);
return '';
}
return this.physicalToVirtual(physical);
- },
- clickLogo: function () {
+ }, clickLogo: function () {
if (this.settings.url_link.indexOf('#') === 0) {
window.location.hash = this.settings.url_link;
} else {
var rand = Math.round(Math.random() * 100000);
this.waiters.push(rand);
return rand;
- },
- waiterActive: function (id) {
+ }, waiterActive: function (id) {
return this.waiters.indexOf(id) > -1;
- },
- resetWaiters: function () {
+ }, resetWaiters: function () {
this.waiters = [];
- },
- physicalToVirtual: function (page) {
+ }, physicalToVirtual: function (page) {
return this.settings.numerotation[page - 1];
- },
- virtualToPhysical: function (page) {
+ }, virtualToPhysical: function (page) {
if (page === undefined) {
return false;
}
},
print: function (button) {
- this.stats.track(3);
return this.openPDF(button, true);
},
downloadPDF: function (button) {
- this.stats.track(7);
return this.openPDF(button, false)
},
var pdf;
var pdfName;
+ var statsEventType = print ? 3 : 7;
+ this.stats.track(statsEventType);
+
if (this.settings.pages != this.contentlock.getMaxPage()) {
pdf = 'https://workshop.fluidbook.com/s/e/' + this.settings.cid + '/1-' + this.contentlock.getMaxPage();
} else if (this.settings.pdfName.substr(0, 4) === 'http') {
print = false;
}
+ var statsEventType = print ? 3 : 7;
+ this.stats.track(statsEventType);
+
var $this = this;
if (this.settings.phonegap != false) {
if (type == undefined) {
if (this.settings.phonegap != false) {
this.displayLoader();
$.ajax({
- url: url,
- type: 'HEAD',
- success: function (data) {
+ url: url, type: 'HEAD', success: function (data) {
f();
$this.hideLoader(1, true);
},
fs = LocalFileSystem.PERSISTENT;
}
- var requestFileSystem = window.requestFileSystem ||
- window.webkitRequestFileSystem;
+ var requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
requestFileSystem(fs, 0, function (fileSystem) {
console.log('fs requested');
var filePath = fileEntry.toURL().replace("dummy.html", "") + localname;
var fileTransfer = new FileTransfer();
var uri = encodeURI(url);
- fileTransfer.download(
- uri,
- filePath,
- function (entry) {
- console.log('file donwloaded');
- if (callback !== undefined) {
- if (callbackArgs === undefined) {
- callbackArgs = [];
- }
- callbackArgs[0] = entry.toURL();
- callback.apply($this, callbackArgs);
+ fileTransfer.download(uri, filePath, function (entry) {
+ console.log('file donwloaded');
+ if (callback !== undefined) {
+ if (callbackArgs === undefined) {
+ callbackArgs = [];
}
- },
- function (error) {
- console.log('file error');
+ callbackArgs[0] = entry.toURL();
+ callback.apply($this, callbackArgs);
}
- );
+ }, function (error) {
+ console.log('file error');
+ });
});
}, function () {
$("#currentDoublePage").css({
translateX: offset
});
- },
- displayLoader: function () {
+ }, displayLoader: function () {
$("#loader").addClass('show');
if (!this.support.isMobile) {
$('body').addClass('loading');
if (window.confirm('An error occured: ' + e.name + '. Do you want to send a report ?')) {
var subject = '[Fluidbook error report] ' + e.message;
var o = {
- name: e.name,
- message: e.message,
- stack: e.stack,
+ name: e.name, message: e.message, stack: e.stack,
}
window.location = 'mailto:tech@fluidbook.com?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(JSON.stringify(o));
}