diff options
-rw-r--r-- | .drone.yml | 2 | ||||
-rw-r--r-- | .travis.yml | 9 | ||||
-rw-r--r-- | js/previewplugin.js | 14 |
3 files changed, 15 insertions, 10 deletions
@@ -5,7 +5,7 @@ clone: pipeline: signed-off-check: - image: nextcloudci/php7.0:php7.0-2 + image: nextcloudci/php7.1:php7.1-16 environment: - APP_NAME=files_pdfviewer - CORE_BRANCH=master diff --git a/.travis.yml b/.travis.yml index 897b64b..57b2232 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: - - 7.0 - 7.1 - 7.2 - 7.3 @@ -52,13 +51,13 @@ script: matrix: include: - - php: 7.0 + - php: 7.1 env: DB=mysql - - php: 7.0 + - php: 7.1 env: DB=pgsql - - php: 7.0 + - php: 7.1 env: DB=mysql;CODECHECK=1 - - php: 7.0 + - php: 7.1 env: DB=mysql;CODECHECK=2 fast_finish: true diff --git a/js/previewplugin.js b/js/previewplugin.js index 7d740f8..66a1882 100644 --- a/js/previewplugin.js +++ b/js/previewplugin.js @@ -40,14 +40,15 @@ /** * @param downloadUrl + * @param param * @param isFileList */ - show: function(downloadUrl, isFileList) { + show: function(downloadUrl, param, isFileList) { var self = this; var shown = true; var $iframe; var viewer = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: downloadUrl}); - $iframe = $('<iframe id="pdframe" style="width:100%;height:100%;display:block;position:absolute;top:0;z-index:1041;left:0;" src="'+viewer+'" sandbox="allow-scripts allow-same-origin allow-popups allow-modals allow-top-navigation" allowfullscreen="true"/>'); + $iframe = $('<iframe id="pdframe" style="width:100%;height:100%;display:block;position:absolute;top:0;z-index:1041;left:0;" src="'+viewer+param+'" sandbox="allow-scripts allow-same-origin allow-popups allow-modals allow-top-navigation" allowfullscreen="true"/>'); if(isFileList === true) { FileList.setViewerMode(true); @@ -117,7 +118,7 @@ actionHandler: function(fileName, context) { var downloadUrl = context.fileList.getDownloadUrl(fileName, context.dir); if (downloadUrl && downloadUrl !== '#') { - self.show(downloadUrl, true); + self.show(downloadUrl, param, true); } } }); @@ -132,10 +133,15 @@ 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') { + $.urlParam = function(name){ + var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); + return results[1] || 0; + }; var sharingToken = $('#sharingToken').val(); + var page = '#page='+$.urlParam('page'); var downloadUrl = OC.generateUrl('/s/{token}/download', {token: sharingToken}); var viewer = OCA.FilesPdfViewer.PreviewPlugin; - viewer.show(downloadUrl, false); + viewer.show(downloadUrl, page, false); } }); |