var $this = this;
// Handle click on Print/Download button inside dialogue
- $(document).on('click', '#confirmChoice', function(event) {
+ $(document).on('click', '#confirmChoice', function (event) {
event.preventDefault();
// ToDo: Consider what happens if Fluidbook is self-hosted or offline (maybe here is not the best place to handle that)
choice = $('input[name="pageChoice"]:checked').val();
switch (choice) {
- case 'left':
- $this.fluidbook._openFile(dynamicPDF + leftPageNumber, element, 'pdf', leftPageNumber + '.pdf', print);
- break;
- case 'right':
- $this.fluidbook._openFile(dynamicPDF + rightPageNumber, element, 'pdf', rightPageNumber + '.pdf', print);
- break;
- case 'double':
- var pageRange = leftPageNumber + '-' + rightPageNumber;
- $this.fluidbook._openFile(dynamicPDF + pageRange, element, 'pdf', pageRange + '.pdf', print);
- break;
- case 'all':
- $this.fluidbook.openPDF(element, print);
- break;
- case 'bookmarks':
- $this.fluidbook.bookmarks.openPDF(element, print);
- break;
- default:
- return false;
+ case 'left':
+ $this.fluidbook._openFile(dynamicPDF + leftPageNumber, element, 'pdf', leftPageNumber + '.pdf', print);
+ break;
+ case 'right':
+ $this.fluidbook._openFile(dynamicPDF + rightPageNumber, element, 'pdf', rightPageNumber + '.pdf', print);
+ break;
+ case 'double':
+ var pageRange = leftPageNumber + '-' + rightPageNumber;
+ $this.fluidbook._openFile(dynamicPDF + pageRange, element, 'pdf', pageRange + '.pdf', print);
+ break;
+ case 'all':
+ $this.fluidbook.openPDF(element, print);
+ break;
+ case 'bookmarks':
+ $this.fluidbook.bookmarks.openPDF(element, print);
+ break;
+ default:
+ return false;
}
});
// When there are no bookmarks a click on the bookmarks option will open the bookmarks help modal
- $(document).on('click', '.bookmarks-option.disabled', function(event) {
+ $(document).on('click', '.bookmarks-option.disabled', function (event) {
event.preventDefault();
$this.fluidbook.menu.quickCloseView();
isLastPage = (this.fluidbook.currentPage == this.fluidbook.datas.pages),
isSinglePageMode = (this.fluidbook.resize.orientation == 'portrait'),
buttonLabels = {
- 'print' : __('print'),
- 'download' : __('download')
+ 'print': __('print'),
+ 'download': __('download')
},
view = '';
if (!isFirstPage) {
view += '<div class="thumb left blank"><div class="blank-mask"></div></div>';
}
- view += '<div class="thumb '+ (isFirstPage ? 'left' : 'right') +'">'; // Only shows 1 page when on first page
+ view += '<div class="thumb ' + (isFirstPage ? 'left' : 'right') + '">'; // Only shows 1 page when on first page
view += this.fluidbook.loader.getThumbImage(rightPageNumber, null, true);
view += '</div>'; // .thumb
view += '</div>'; // .doubleThumb
// Bookmarks
if (this.fluidbook.datas.bookmark) {
- var hasBookmarks = this.fluidbook.bookmarks.hasBookmarkedPages(),
- bookmarksDisabled = hasBookmarks ? '' : 'disabled';
-
- view += '<div class="print-option bookmarks-option '+ bookmarksDisabled +'">';
- view += '<label for="bookmarkedPages">';
- view += '<div class="doubleThumb bookmarks">';
- view += this.fluidbook.bookmarks.getPrintPreview();
- view += '</div>'; // .doubleThumb
- view += '</label>';
- view += '<input type="radio" name="pageChoice" value="bookmarks" id="bookmarkedPages" '+ bookmarksDisabled +'>'
- view += '<label for="bookmarkedPages" class="print-label-text">' + __('bookmarks') + '</label>';
- view += '</div>'; // .print-option
+ var hasBookmarks = this.fluidbook.bookmarks.hasBookmarkedPages(),
+ bookmarksDisabled = hasBookmarks ? '' : 'disabled';
+
+ view += '<div class="print-option bookmarks-option ' + bookmarksDisabled + '">';
+ view += '<label for="bookmarkedPages">';
+ view += '<div class="doubleThumb bookmarks">';
+ view += this.fluidbook.bookmarks.getPrintPreview();
+ view += '</div>'; // .doubleThumb
+ view += '</label>';
+ view += '<input type="radio" name="pageChoice" value="bookmarks" id="bookmarkedPages" ' + bookmarksDisabled + '>'
+ view += '<label for="bookmarkedPages" class="print-label-text">' + __('bookmarks') + '</label>';
+ view += '</div>'; // .print-option
}
view += '<div class="print-option"></div>'; // Extra empty div to ensure flexbox space-between works as expected
// Action buttons
view += '<div class="fonctions">';
- view += '<a id="confirmChoice" href="#" data-mode="'+ mode +'">'+ buttonLabels[mode] +'</a>';
+ view += '<a id="confirmChoice" href="#" data-mode="' + mode + '">' + buttonLabels[mode] + '</a>';
view += '</div>'; // .fonctions
view += '</div>'; // .content
return view;
+ },
+
+ advancedPrint: function () {
+ if (this.fluidbook.datas.phonegap !== false) {
+ return false;
+ }
+ if (this.fluidbook.support.offline && !this.fluidbook.datas.offlineEnableAdvancedPrinting) {
+ return false;
+ }
+
+ return true;
}
};