From ce0bbf52971482243f11055f441aab4438b9895b Mon Sep 17 00:00:00 2001 From: frankdelange Date: Thu, 6 Aug 2015 11:05:09 +0200 Subject: [PATCH] files_opds: more preview provider mangling to align with OC8.1 practices files_opds: more preview provider mangling to align with OC8.1 practices --- files_opds/appinfo/app.php | 2 +- files_reader/js/plugin.js | 10 +++++----- files_reader/js/ready.js | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/files_opds/appinfo/app.php b/files_opds/appinfo/app.php index fd6606c..687488d 100644 --- a/files_opds/appinfo/app.php +++ b/files_opds/appinfo/app.php @@ -8,4 +8,4 @@ require 'files_opds/lib/epub-preview.php'; \OCP\App::registerAdmin('files_opds', 'admin'); /* register preview provider */ -\OC::$server->getPreviewManager()->registerProvider('OC\Preview\Epub'); +\OC::$server->getPreviewManager()->registerProvider('OC\Preview\Epub', array('apps' => array('files_opds'))); diff --git a/files_reader/js/plugin.js b/files_reader/js/plugin.js index cc3f721..c92e835 100644 --- a/files_reader/js/plugin.js +++ b/files_reader/js/plugin.js @@ -54,7 +54,7 @@ show: function(downloadUrl, isFileList) { var self = this; var $iframe; - var viewer = OC.generateUrl('/apps/files_reader/?file={file}', {file: encodeURIComponent(downloadUrl)}); + var viewer = OC.generateUrl('/apps/files_reader/?file={file}', {file: downloadUrl}); // launch in new window on mobile and touch devices... if (isMobile || hasTouch) { window.open(viewer, downloadUrl); @@ -95,9 +95,9 @@ if($('#isPublic').val()) { var sharingToken = $('#sharingToken').val(); downloadUrl = OC.generateUrl('/s/{token}/download?files={files}&path={path}', { - token: encodeURIComponent(sharingToken), - files: encodeURIComponent(fileName), - path: encodeURIComponent(context.dir) + token: sharingToken, + files: fileName, + path: context.dir }); } else { downloadUrl = Files.getDownloadUrl(fileName, context.dir); @@ -117,7 +117,7 @@ OC.Plugins.register('OCA.Files.FileList', OCA.FilesReader.Plugin); $(document).ready(function(){ if ($('#isPublic').val() && $('#mimetype').val() === 'application/epub+zip') { var sharingToken = $('#sharingToken').val(); - var downloadUrl = OC.generateUrl('/s/{token}/download', {token: encodeURIComponent(sharingToken)}); + var downloadUrl = OC.generateUrl('/s/{token}/download', {token: sharingToken}); var viewer = OCA.FilesReader.Plugin; viewer.show(downloadUrl, false); } diff --git a/files_reader/js/ready.js b/files_reader/js/ready.js index d7da44d..7759e48 100644 --- a/files_reader/js/ready.js +++ b/files_reader/js/ready.js @@ -88,6 +88,7 @@ document.onreadystatechange = function () { nightModeConfig(); }); + console.log(document.getElementById("dllink").value); var reader = ePubReader(document.getElementById("dllink").value, { contained: true }); // enable night/day mode switch by clicking on the book title/author