1
0
Fork 0
mirror of https://github.com/Yetangitu/owncloud-apps.git synced 2025-10-03 14:59:19 +02:00

Add fixes from @manvalls

This commit is contained in:
Alfred Egger 2019-11-25 12:29:02 +01:00
parent 0678c795e2
commit f86c35f890
36 changed files with 181 additions and 135 deletions

View file

@ -65,6 +65,8 @@
$('.directDownload').show();
}
$('iframe').remove();
$('body').off('focus.filesreader');
$(window).off('popstate.filesreader');
},
/**
@ -73,10 +75,10 @@
*/
show: function(downloadUrl, mimeType, isFileList) {
var self = this;
var viewer = OC.generateUrl('/apps/files_reader/?file={file}&type={type}', {file: downloadUrl, type: mimeType});
// launch in new window on mobile and touch devices...
var viewer = OC.generateUrl('/apps/files_reader/?file={file}&type={type}', {file: downloadUrl, type: mimeType});
// launch in new window on all devices
window.open(viewer, downloadUrl);
},
},
/**
* @param fileActions
@ -84,6 +86,16 @@
*/
_extendFileActions: function(fileActions) {
var self = this;
var cbxMime = [
'application/x-cbr',
'application/comicbook+7z',
'application/comicbook+ace',
'application/comicbook+rar',
'application/comicbook+tar',
'application/comicbook+truecrypt',
'application/comicbook+zip'
];
fileActions.registerAction({
name: 'view-epub',
displayName: 'View',
@ -93,15 +105,22 @@
return actionHandler(fileName, 'application/epub+zip', context);
}
});
fileActions.registerAction({
name: 'view-cbr',
displayName: 'View',
mime: 'application/x-cbr',
permissions: OC.PERMISSION_READ,
actionHandler: function(fileName, context) {
return actionHandler(fileName, 'application/x-cbr', context);
}
cbxMime.forEach(function(mime, i){
fileActions.registerAction({
name: 'view-cbr-' + i,
displayName: 'View',
mime: mime,
permissions: OC.PERMISSION_READ,
actionHandler: function (fileName, context) {
return actionHandler(fileName, 'application/x-cbr', context);
}
});
if (oc_appconfig.filesReader.enableCbx === 'true')
fileActions.setDefault(mime, 'view-cbr-' + i);
});
fileActions.registerAction({
name: 'view-pdf',
displayName: 'View',
@ -114,8 +133,6 @@
if (oc_appconfig.filesReader.enableEpub === 'true')
fileActions.setDefault('application/epub+zip', 'view-epub');
if (oc_appconfig.filesReader.enableCbx === 'true')
fileActions.setDefault('application/x-cbr', 'view-cbr');
if (oc_appconfig.filesReader.enablePdf === 'true')
fileActions.setDefault('application/pdf', 'view-pdf');
}