feature: display pdf attachments inline
This commit is contained in:
@@ -56,7 +56,19 @@
|
||||
<script type="text/javascript">
|
||||
Shadowbox.init({
|
||||
skipSetup: true,
|
||||
modal: true
|
||||
modal: true,
|
||||
onOpen: function (obj) {
|
||||
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
|
||||
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
onChange: function (obj) {
|
||||
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
|
||||
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
const $Attachments = $('#Attachments');
|
||||
@@ -117,6 +129,8 @@
|
||||
e.show('slow');
|
||||
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
|
||||
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
|
||||
else if (a.MimeType.toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
|
||||
e.shadowbox({ gallery: 'attachments', player: 'iframe', title: a.Description });
|
||||
else
|
||||
e.click(onDownload);
|
||||
|
||||
@@ -171,7 +185,7 @@
|
||||
|
||||
a.hide(300).delay(300).queue(function () {
|
||||
var $this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
if (this['shadowboxCacheKey'])
|
||||
Shadowbox.removeCache(this);
|
||||
$this.find('.timestamp').livestamp('destroy');
|
||||
$this.remove();
|
||||
@@ -337,6 +351,8 @@
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
|
||||
else if ($this.attr('data-mimetype').toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'iframe', title: $this.find('.comments').text() });
|
||||
else
|
||||
$this.click(onDownload);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user