Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_pdfviewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-09-10 17:33:54 +0300
committerGitHub <noreply@github.com>2019-09-10 17:33:54 +0300
commita60beefa878dd0f971b9776eef3686ab565a6304 (patch)
treecd0488eabc9a7526b7964b6a7241a48b1f7f9ae7
parentd93977d98dade0d846c63fc6ad4f1fbabb5db663 (diff)
parent2cea2d5ea392279e5838416bde31c7fac97bd296 (diff)
Disable pdf viewer if collabora is available on hide download sh… (#154)v18.0.0beta4v18.0.0beta3v18.0.0beta2v18.0.0beta1v18.0.0RC2v18.0.0RC1v18.0.0
Disable pdf viewer if collabora is available on hide download shares
-rw-r--r--js/previewplugin.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/js/previewplugin.js b/js/previewplugin.js
index ad3b338..eb82a16 100644
--- a/js/previewplugin.js
+++ b/js/previewplugin.js
@@ -8,6 +8,10 @@
*
*/
+var isSecureViewerAvailable = function () {
+ return $('#hideDownload').val() === 'true' && typeof OCA.RichDocuments !== 'undefined';
+};
+
(function(OCA) {
OCA.FilesPdfViewer = OCA.FilesPdfViewer || {};
@@ -77,6 +81,10 @@
// if a filelist is present, the PDF viewer can be closed to go back there
$('#pdframe').load(function(){
var iframe = $('#pdframe').contents();
+ if ($('#hideDownload').val() === 'true') {
+ iframe.find('.toolbarButton.download').hide()
+ iframe.find('.toolbarButton.print').hide()
+ }
if ($('#fileList').length)
{
iframe.find('#secondaryToolbarClose').click(function() {
@@ -117,6 +125,9 @@
*/
_extendFileActions: function(fileActions) {
var self = this;
+ if (isSecureViewerAvailable()) {
+ return;
+ }
fileActions.registerAction({
name: 'view',
displayName: 'Favorite',
@@ -139,7 +150,7 @@ OC.Plugins.register('OCA.Files.FileList', OCA.FilesPdfViewer.PreviewPlugin);
// FIXME: Hack for single public file view since it is not attached to the fileslist
$(document).ready(function(){
- if ($('#isPublic').val() && $('#mimetype').val() === 'application/pdf') {
+ if ($('#isPublic').val() && $('#mimetype').val() === 'application/pdf' && !isSecureViewerAvailable()) {
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {