diff --git a/README.md b/README.md index af56862..82f757b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -files_reader +Epubreader for Nextcloud ------------ -Reader is an ebook reader based on pure javascript renderers. It works for publications formatted according to the following standards: +Epubreader is an ebook reader based on pure javascript renderers. It works for publications formatted according to the following standards: - [Epub] - [PDF] @@ -110,8 +110,8 @@ The same Android device showing a zoomed-in part of a page|![The same Android de [balaclark]: https://github.com/balaclark/HTML5-Comic-Book-Reader [PDF]: https://en.wikipedia.org/wiki/Portable_Document_Format [pdf.js]: https://github.com/mozilla/pdf.js - [SS01]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/files_reader-1.png "Reader showing day/nighyt mode" - [SS02]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/files_reader-3.png "Single page full screen on a small-screen device" + [SS01]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/epubreader-1.png "Reader showing day/nighyt mode" + [SS02]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/epubreader-3.png "Single page full screen on a small-screen device" [SS03]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/photo_2017-03-15_17-21-39.jpg "Day mode color selector" [SS04]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/photo_2017-03-15_17-21-41.jpg?raw=true "Longing For that olde-time terminal feeling..." [SS05]: https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/photo_2017-03-15_17-21-53.jpg "Full-text search" @@ -128,7 +128,7 @@ The same Android device showing a zoomed-in part of a page|![The same Android de [SS16]: https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_17-22-10.jpg?raw=true "Same page, zoomed in" [SS17]: https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_18-28-54.jpg?raw=true "Small-screen, low memory (Android) device showing full-page book cover" [SS18]: https://github.com/e-alfred/epubreader/blob/master/screenshots/photo_2017-03-15_18-28-56.jpg?raw=true "The same Android device showing a zoomed-in part of a page" - [SS19]: https://github.com/e-alfred/epubreader/blob/master/screenshots/files_reader_PDF_001.png?raw=true "Search through a document, showing all results in the sidebar" - [SS20]: https://github.com/e-alfred/epubreader/blob/master/screenshots/files_reader_PDF_002.png?raw=true "Reader showing PDF Reference document in spread mode (pages side by side)" - [SS21]: https://github.com/e-alfred/epubreader/blob/master/screenshots/files_reader_PDF_005.png?raw=true "Dropdown showing page format options - spread, single page, page width and zoom options" - [SS22]: https://github.com/e-alfred/epubreader/blob/master/screenshots/files_reader_PDF_006.png?raw=true "Reader showing PDF in spread mode, thumbnails in the sidebar" + [SS19]: https://github.com/e-alfred/epubreader/blob/master/screenshots/epubreader_PDF_001.png?raw=true "Search through a document, showing all results in the sidebar" + [SS20]: https://github.com/e-alfred/epubreader/blob/master/screenshots/epubreader_PDF_002.png?raw=true "Reader showing PDF Reference document in spread mode (pages side by side)" + [SS21]: https://github.com/e-alfred/epubreader/blob/master/screenshots/epubreader_PDF_005.png?raw=true "Dropdown showing page format options - spread, single page, page width and zoom options" + [SS22]: https://github.com/e-alfred/epubreader/blob/master/screenshots/epubreader_PDF_006.png?raw=true "Reader showing PDF in spread mode, thumbnails in the sidebar" diff --git a/ajax/personal.php b/ajax/personal.php index c3a3602..801090b 100644 --- a/ajax/personal.php +++ b/ajax/personal.php @@ -1,7 +1,7 @@ getL10N('files_reader'); +$l = \OC::$server->getL10N('epubreader'); $EpubEnable = isset($_POST['EpubEnable']) ? $_POST['EpubEnable'] : 'false'; $PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false'; diff --git a/appinfo/app.php b/appinfo/app.php index 1183d77..5d2e294 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,7 +1,7 @@ getL10N('files_reader'); +$l = \OC::$server->getL10N('epubreader'); -\OCA\Files_Reader\Hooks::register(); -Util::addscript('files_reader', 'plugin'); -\OCP\App::registerPersonal('files_reader', 'personal'); +\OCA\Epubreader\Hooks::register(); +Util::addscript('epubreader', 'plugin'); +\OCP\App::registerPersonal('epubreader', 'personal'); diff --git a/appinfo/info.xml b/appinfo/info.xml index 94249ef..2e5f5e8 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -26,7 +26,7 @@ See [README] for more exhaustive information on features and potential misfeatur [balaclark]: https://github.com/balaclark/HTML5-Comic-Book-Reader [PDF]: https://en.wikipedia.org/wiki/Portable_Document_Format [pdf.js]: https://github.com/mozilla/pdf.js - [README]: https://github.com/e-alfred/epubreader/blob/master/files_reader/README.md + [README]: https://github.com/e-alfred/epubreader/blob/master/epubreader/README.md ]]> 1.4.0 @@ -36,10 +36,10 @@ See [README] for more exhaustive information on features and potential misfeatur https://github.com/e-alfred/epubreader https://github.com/e-alfred/epubreader https://github.com/e-alfred/epubreader - https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/files_reader-1.png - https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/files_reader-3.png - https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/files_reader_PDF_005.png - https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/files_reader_PDF_006.png + https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/epubreader-1.png + https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/epubreader-3.png + https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/epubreader_PDF_005.png + https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/epubreader_PDF_006.png https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/photo_2017-03-15_17-22-00.jpg https://raw.githubusercontent.com/e-alfred/epubreader/master/screenshots/photo_2017-03-15_17-22-02.jpg files diff --git a/appinfo/routes.php b/appinfo/routes.php index 4be67bc..b3fde19 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,7 +1,7 @@ create('reader_personal_settings', 'ajax/personal.php')->actionInclude('files_reader/ajax/personal.php'); +$this->create('reader_personal_settings', 'ajax/personal.php')->actionInclude('epubreader/ajax/personal.php'); return ['routes' => [ // Page diff --git a/js/personal.js b/js/personal.js index bf39caf..f1ec245 100644 --- a/js/personal.js +++ b/js/personal.js @@ -9,7 +9,7 @@ $(document).ready(function(){ }; OC.msg.startSaving('#reader-personal .msg'); - $.post(OC.filePath('files_reader', 'lib', 'personal-back.php'), data, readerSettings.afterSave); + $.post(OC.filePath('epubreader', 'lib', 'personal-back.php'), data, readerSettings.afterSave); }, afterSave : function(data){ OC.msg.finishedSaving('#reader-personal .msg', data); diff --git a/js/plugin.js b/js/plugin.js index 2df289e..2334d20 100644 --- a/js/plugin.js +++ b/js/plugin.js @@ -12,7 +12,7 @@ (function(OCA) { - OCA.Files_Reader = OCA.Files_Reader || {}; + OCA.Epubreader = OCA.Epubreader || {}; var isMobile = navigator.userAgent.match(/Mobi/i); var hasTouch = 'ontouchstart' in document.documentElement; @@ -29,13 +29,13 @@ } else { downloadUrl = Files.getDownloadUrl(fileName, context.dir); } - OCA.Files_Reader.Plugin.show(downloadUrl, mime, true); + OCA.Epubreader.Plugin.show(downloadUrl, mime, true); } /** - * @namespace OCA.Files_Reader.Plugin + * @namespace OCA.Epubreader.Plugin */ - OCA.Files_Reader.Plugin = { + OCA.Epubreader.Plugin = { /** * @param fileList @@ -75,7 +75,7 @@ */ show: function(downloadUrl, mimeType, isFileList) { var self = this; - var viewer = OC.generateUrl('/apps/files_reader/?file={file}&type={type}', {file: downloadUrl, type: mimeType}); + var viewer = OC.generateUrl('/apps/epubreader/?file={file}&type={type}', {file: downloadUrl, type: mimeType}); // launch in new window on all devices window.open(viewer, downloadUrl); }, @@ -140,7 +140,7 @@ })(OCA); -OC.Plugins.register('OCA.Files.FileList', OCA.Files_Reader.Plugin); +OC.Plugins.register('OCA.Files.FileList', OCA.Epubreader.Plugin); // FIXME: Hack for single public file view since it is not attached to the fileslist $(document).ready(function(){ @@ -151,7 +151,7 @@ $(document).ready(function(){ ) { var sharingToken = $('#sharingToken').val(); var downloadUrl = OC.generateUrl('/s/{token}/download', {token: sharingToken}); - var viewer = OCA.Files_Reader.Plugin; + var viewer = OCA.Epubreader.Plugin; var mime = $('#mimetype').val(); viewer.show(downloadUrl, mime, false); } diff --git a/js/settings.js b/js/settings.js index 156ec03..6f77393 100644 --- a/js/settings.js +++ b/js/settings.js @@ -9,7 +9,7 @@ $(document).ready(function(){ }; OC.msg.startSaving('#reader-personal .msg'); - $.post(OC.filePath('files_reader', 'ajax', 'personal.php'), data, readerSettings.afterSave); + $.post(OC.filePath('epubreader', 'ajax', 'personal.php'), data, readerSettings.afterSave); }, afterSave : function(data){ OC.msg.finishedSaving('#reader-personal .msg', data); @@ -19,4 +19,3 @@ $(document).ready(function(){ $('#PdfEnable').on("change", readerSettings.save); $('#CbxEnable').on("change", readerSettings.save); }); - diff --git a/lib/Controller/BookmarkController.php b/lib/Controller/BookmarkController.php index 1c6851c..7d0a80e 100644 --- a/lib/Controller/BookmarkController.php +++ b/lib/Controller/BookmarkController.php @@ -8,14 +8,14 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Controller; +namespace OCA\Epubreader\Controller; use OCP\IRequest; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; -use OCA\Files_Reader\Service\BookmarkService; +use OCA\Epubreader\Service\BookmarkService; class BookmarkController extends Controller { diff --git a/lib/Controller/MetadataController.php b/lib/Controller/MetadataController.php index 15eafad..d021ffb 100644 --- a/lib/Controller/MetadataController.php +++ b/lib/Controller/MetadataController.php @@ -8,12 +8,12 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Controller; +namespace OCA\Epubreader\Controller; use OCP\IRequest; use OCP\AppFramework\Controller; -use OCA\Files_Reader\Service\MetadataService; +use OCA\Epubreader\Service\MetadataService; class MetadataController extends Controller { diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 8a500d1..126fe68 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Controller; +namespace OCA\Epubreader\Controller; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; @@ -20,9 +20,9 @@ use OCP\Share\IManager; use OCP\Files\FileInfo; use OCP\Files\NotFoundException; -use OCA\Files_Reader\Service\BookmarkService; -use OCA\Files_Reader\Service\MetadataService; -use OCA\Files_Reader\Service\PreferenceService; +use OCA\Epubreader\Service\BookmarkService; +use OCA\Epubreader\Service\MetadataService; +use OCA\Epubreader\Service\PreferenceService; class PageController extends Controller { diff --git a/lib/Controller/PreferenceController.php b/lib/Controller/PreferenceController.php index e7d6d14..d408247 100644 --- a/lib/Controller/PreferenceController.php +++ b/lib/Controller/PreferenceController.php @@ -8,14 +8,14 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Controller; +namespace OCA\Epubreader\Controller; use OCP\IRequest; use OCP\IURLGenerator; use OCP\AppFramework\Http; use OCP\AppFramework\Controller; -use OCA\Files_Reader\Service\PreferenceService; +use OCA\Epubreader\Service\PreferenceService; class PreferenceController extends Controller { diff --git a/lib/Db/Bookmark.php b/lib/Db/Bookmark.php index 0390ab8..e3748e9 100644 --- a/lib/Db/Bookmark.php +++ b/lib/Db/Bookmark.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Db; +namespace OCA\Epubreader\Db; use OCP\AppFramework\Db\Entity; diff --git a/lib/Db/BookmarkMapper.php b/lib/Db/BookmarkMapper.php index 292db93..c7f5c7a 100644 --- a/lib/Db/BookmarkMapper.php +++ b/lib/Db/BookmarkMapper.php @@ -8,12 +8,12 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Db; +namespace OCA\Epubreader\Db; use OCP\IDBConnection; -use OCA\Files_Reader\Utility\Time; +use OCA\Epubreader\Utility\Time; class BookmarkMapper extends ReaderMapper { diff --git a/lib/Db/Preference.php b/lib/Db/Preference.php index 1baf1f6..3e12fa0 100644 --- a/lib/Db/Preference.php +++ b/lib/Db/Preference.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Db; +namespace OCA\Epubreader\Db; use OCP\AppFramework\Db\Entity; diff --git a/lib/Db/PreferenceMapper.php b/lib/Db/PreferenceMapper.php index 350ea00..1d4ff2e 100644 --- a/lib/Db/PreferenceMapper.php +++ b/lib/Db/PreferenceMapper.php @@ -8,9 +8,9 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Db; +namespace OCA\Epubreader\Db; -use OCA\Files_Reader\Utility\Time; +use OCA\Epubreader\Utility\Time; use OCP\IDBConnection; class PreferenceMapper extends ReaderMapper { diff --git a/lib/Db/ReaderEntity.php b/lib/Db/ReaderEntity.php index c6f3a58..58cb907 100644 --- a/lib/Db/ReaderEntity.php +++ b/lib/Db/ReaderEntity.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Db; +namespace OCA\Epubreader\Db; use OCP\AppFramework\Db\Entity; diff --git a/lib/Db/ReaderMapper.php b/lib/Db/ReaderMapper.php index efe7bf1..516783a 100644 --- a/lib/Db/ReaderMapper.php +++ b/lib/Db/ReaderMapper.php @@ -8,13 +8,13 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Db; +namespace OCA\Epubreader\Db; use OCP\IDBConnection; use OCP\AppFramework\Db\Mapper; use OCP\AppFramework\Db\Entity; -use OCA\Files_Reader\Utility\Time; +use OCA\Epubreader\Utility\Time; abstract class ReaderMapper extends Mapper { diff --git a/lib/Hooks.php b/lib/Hooks.php index 15025e2..22f66e9 100644 --- a/lib/Hooks.php +++ b/lib/Hooks.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader; +namespace OCA\Epubreader; use OCP\IDBConnection; use OCP\Files\Node; @@ -19,7 +19,7 @@ use \OC\User\User as User; class Hooks { public static function register() { - Util::connectHook('\OCP\Config', 'js', 'OCA\Files_Reader\Hooks', 'announce_settings'); + Util::connectHook('\OCP\Config', 'js', 'OCA\Epubreader\Hooks', 'announce_settings'); \OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) { $fileId = $node->getId(); diff --git a/lib/Service/BookmarkService.php b/lib/Service/BookmarkService.php index 9f147b3..92fb79c 100644 --- a/lib/Service/BookmarkService.php +++ b/lib/Service/BookmarkService.php @@ -8,10 +8,10 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Service; +namespace OCA\Epubreader\Service; -use OCA\Files_Reader\Db\BookmarkMapper; +use OCA\Epubreader\Db\BookmarkMapper; class BookmarkService extends Service { diff --git a/lib/Service/MetadataService.php b/lib/Service/MetadataService.php index 934682e..bbf85e3 100644 --- a/lib/Service/MetadataService.php +++ b/lib/Service/MetadataService.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Service; +namespace OCA\Epubreader\Service; use OCP\App\IAppManager; diff --git a/lib/Service/PreferenceService.php b/lib/Service/PreferenceService.php index 8a86fb2..d26eb63 100644 --- a/lib/Service/PreferenceService.php +++ b/lib/Service/PreferenceService.php @@ -8,9 +8,9 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Service; +namespace OCA\Epubreader\Service; -use OCA\Files_Reader\Db\PreferenceMapper; +use OCA\Epubreader\Db\PreferenceMapper; class PreferenceService extends Service { diff --git a/lib/Service/Service.php b/lib/Service/Service.php index 42c6caf..fafdc6a 100644 --- a/lib/Service/Service.php +++ b/lib/Service/Service.php @@ -8,9 +8,9 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Service; +namespace OCA\Epubreader\Service; -use OCA\Files_Reader\Db\ReaderMapper; +use OCA\Epubreader\Db\ReaderMapper; abstract class Service { diff --git a/lib/Utility/Time.php b/lib/Utility/Time.php index 71fe633..8ed5243 100644 --- a/lib/Utility/Time.php +++ b/lib/Utility/Time.php @@ -8,7 +8,7 @@ * See the COPYING-README file. */ -namespace OCA\Files_Reader\Utility; +namespace OCA\Epubreader\Utility; class Time { public function getTime() { diff --git a/lib/config.php b/lib/config.php index 210bed5..086b8fe 100644 --- a/lib/config.php +++ b/lib/config.php @@ -1,7 +1,7 @@ getConfig()->getUserValue(\OCP\User::getUser(), 'files_reader', $key, $default); + return \OC::$server->getConfig()->getUserValue(\OCP\User::getUser(), 'epubreader', $key, $default); } /** @@ -36,7 +36,7 @@ class Config * @return bool success */ public static function set($key, $value) { - return \OC::$server->getConfig()->setUserValue(\OCP\User::getUser(), 'files_reader', $key, $value); + return \OC::$server->getConfig()->setUserValue(\OCP\User::getUser(), 'epubreader', $key, $value); } /** @@ -47,7 +47,7 @@ class Config * @return string retrieved value or default */ public static function getApp($key, $default) { - return \OC::$server->getConfig()->getAppValue('files_reader', $key, $default); + return \OC::$server->getConfig()->getAppValue('epubreader', $key, $default); } /** @@ -58,6 +58,6 @@ class Config * @return bool success */ public static function setApp($key, $value) { - return \OC::$server->getConfig()->setAppValue('files_reader', $key, $value); + return \OC::$server->getConfig()->setAppValue('epubreader', $key, $value); } } diff --git a/personal.php b/personal.php index 2b0dd18..262b8e6 100644 --- a/personal.php +++ b/personal.php @@ -1,6 +1,6 @@ getL10N('files_reader'); +#$l = \OC::$server->getL10N('epubreader'); -$tmpl = new \OCP\Template('files_reader', 'settings-personal'); +$tmpl = new \OCP\Template('epubreader', 'settings-personal'); $EpubEnable = Config::get('epub_enable', 'true'); $PdfEnable = Config::get('pdf_enable', 'true'); $CbxEnable = Config::get('cbx_enable', 'true'); diff --git a/templates/cbreader.php b/templates/cbreader.php index 6e47a48..7fa8827 100644 --- a/templates/cbreader.php +++ b/templates/cbreader.php @@ -14,7 +14,7 @@ $annotations = $_['annotations']; $title = htmlentities(basename($downloadLink)); $revision = '0048'; - $version = \OCP\App::getAppVersion('files_reader') . '.' . $revision; + $version = \OCP\App::getAppVersion('epubreader') . '.' . $revision; /* Mobile safari, the new IE6 */ $idevice = (strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') @@ -28,29 +28,29 @@ ?> - + - + <?php p($title);?> - - - - - - - - - + + + + + + + + + - + - + @@ -110,7 +110,7 @@ diff --git a/templates/epubreader.php b/templates/epubreader.php index da6ca87..0c03267 100644 --- a/templates/epubreader.php +++ b/templates/epubreader.php @@ -14,7 +14,7 @@ $annotations = $_['annotations']; $title = htmlentities(basename($downloadLink)); $revision = '0072'; - $version = \OCP\App::getAppVersion('files_reader') . '.' . $revision; + $version = \OCP\App::getAppVersion('epubreader') . '.' . $revision; /* Mobile safari, the new IE6 */ $idevice = (strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') @@ -28,39 +28,39 @@ ?> - + - + <?php p($title);?> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - + + + - +
@@ -283,7 +283,7 @@
- +
diff --git a/templates/pdfreader.php b/templates/pdfreader.php index a47410e..ea8f904 100644 --- a/templates/pdfreader.php +++ b/templates/pdfreader.php @@ -14,7 +14,7 @@ $annotations = $_['annotations']; $title = htmlentities(basename($downloadLink)); $revision = '0130'; - $version = \OCP\App::getAppVersion('files_reader') . '.' . $revision; + $version = \OCP\App::getAppVersion('epubreader') . '.' . $revision; /* Mobile safari, the new IE6 */ $idevice = (strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') @@ -28,49 +28,49 @@ ?> - + - + <?php p($title);?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - +
@@ -310,7 +310,7 @@
- +
diff --git a/templates/settings-personal.php b/templates/settings-personal.php index f6c5880..36e8a7a 100644 --- a/templates/settings-personal.php +++ b/templates/settings-personal.php @@ -8,8 +8,8 @@ * See the COPYING-README file. */ -script('files_reader', 'settings'); -style('files_reader', 'settings'); +script('epubreader', 'settings'); +style('epubreader', 'settings'); ?> diff --git a/vendor/cbrjs/cbr.js b/vendor/cbrjs/cbr.js index 077369c..082389a 100644 --- a/vendor/cbrjs/cbr.js +++ b/vendor/cbrjs/cbr.js @@ -490,7 +490,7 @@ ComicBook = (function ($) { if (parent !== window) { $('.close').removeClass('hide'); - $('.close').on('click', function() { parent.OCA.Files_Reader.Plugin.hide(); }); + $('.close').on('click', function() { parent.OCA.Epubreader.Plugin.hide(); }); } }; diff --git a/vendor/epubjs/reader.min.js b/vendor/epubjs/reader.min.js index 634ba5b..e546cfb 100644 --- a/vendor/epubjs/reader.min.js +++ b/vendor/epubjs/reader.min.js @@ -1 +1 @@ -EPUBJS.reader={},EPUBJS.reader.plugins={},function(a,b){var c=(a.ePubReader||{},a.ePubReader=function(a,b){return new EPUBJS.Reader(a,b)});"function"==typeof define&&define.amd?define(function(){return Reader}):"undefined"!=typeof module&&module.exports&&(module.exports=c)}(window,jQuery),EPUBJS.Reader=function(a,b){var c,d,e,f,g=this,h=$("#viewer"),i=window.location.search;this.settings=EPUBJS.core.defaults(b||{},{bookPath:a,contained:void 0,sidebarReflow:!1,generatePagination:!1,history:!0,keyboard:{32:"next",34:"next",39:"next",33:"previous",37:"previous",36:"first",35:"last",65:"annotate",66:"bookmark",82:"reflow",83:"toggleSidebar",84:"toolbar",68:"toggleDay",78:"toggleNight",70:"toggleFullscreen",27:"closeSidebar"},nightMode:!1,dayMode:!1,maxWidth:72,pageArrows:!1,annotations:{},customStyles:{},activeStyles:{},session:{}}),this.Annotation=function(a,b,c,d){this.id=d||EPUBJS.core.uuid(),this.type=a,this.date=Date.now(),this.edited=this.date,this.anchor=b,this.body=c},this.Style=function(a,b,c,d){this.name=a,this.selector=b,this.rules=c,this.extra=d||null},i&&(f=i.slice(1).split("&"),f.forEach(function(a){var b=a.split("="),c=b[0],d=b[1]||"";g.settings[c]=decodeURIComponent(d)})),this.restoreDefaults(this.settings.session.defaults),this.restorePreferences(this.settings.session.preferences),this.restoreAnnotations(this.settings.session.annotations),this.book=c=new EPUBJS.Book(this.settings),this.offline=!1,this.sidebarOpen=!1,this.viewerResized=!1,this.settings.generatePagination&&c.generatePagination(h.width(),h.height()),c.renderTo("viewer").then(function(a){this.renderer=d=a,g.StyleController=EPUBJS.reader.StylesController.call(g,d)}),g.ReaderController=EPUBJS.reader.ReaderController.call(g,c),g.SettingsController=EPUBJS.reader.SettingsController.call(g,c),g.ControlsController=EPUBJS.reader.ControlsController.call(g,c),g.SidebarController=EPUBJS.reader.SidebarController.call(g,c),g.NotesController=EPUBJS.reader.NotesController.call(g,c),g.BookmarksController=EPUBJS.reader.BookmarksController.call(g,c),g.SearchController=EPUBJS.reader.SearchController.call(g,c);for(e in EPUBJS.reader.plugins)EPUBJS.reader.plugins.hasOwnProperty(e)&&(g[e]=EPUBJS.reader.plugins[e].call(g,c));return c.ready.all.then(function(){g.ReaderController.hideLoader(),g.settings.session.cursor!=={}&&g.trigger("reader:gotobookmark",g.settings.session.cursor)}),c.getMetadata().then(function(a){g.MetaController=EPUBJS.reader.MetaController.call(g,a)}),c.getToc().then(function(a){g.TocController=EPUBJS.reader.TocController.call(g,a)}),window.addEventListener("beforeunload",this.unload.bind(this),!1),window.addEventListener("hashchange",this.hashChanged.bind(this),!1),c.on("renderer:keydown",g.ReaderController.keyCommands.bind(this)),c.on("renderer:selected",this.selectedRange.bind(this)),this},EPUBJS.Reader.prototype.cfiToId=function(a){return a.replace(/\W/g,"")},EPUBJS.Reader.prototype.getBookmark=function(a){var b=this.cfiToId(a);return this.settings.annotations[b]},EPUBJS.Reader.prototype.addBookmark=function(a){var b,c,d,e,f=this.cfiToId(a),g=new EPUBJS.EpubCFI,h="";return d=g.generateRangeFromCfi(a,this.book.renderer.doc),b=d.startOffset,h=d.startContainer.wholeText,c=/\S/.test(h)?b>0&&" "!=h.charAt(b-1)?EPUBJS.core.ellipsize(h.substr(h.indexOf(" ",b))):EPUBJS.core.ellipsize(h.substr(b)):a,this.isBookmarked(f)?(e=this.getAnnotation(f),this.updateAnnotation(e)):(e=new this.Annotation("bookmark",a,c,this.cfiToId(a)),this.addAnnotation(e)),this.trigger("reader:bookmarkcreated",e),e},EPUBJS.Reader.prototype.updateBookmark=function(a){this.updateAnnotation(a)},EPUBJS.Reader.prototype.removeBookmark=function(a){var b=this.cfiToId(a);this.removeAnnotation(b)},EPUBJS.Reader.prototype.isBookmarked=function(a){var b=this.cfiToId(a);return void 0!==this.settings.annotations[b]},EPUBJS.Reader.prototype.clearBookmarks=function(){this.clearAnnotations("bookmark")},EPUBJS.Reader.prototype.getAnnotation=function(a){return this.settings.annotations[a]},EPUBJS.Reader.prototype.addAnnotation=function(a){this.settings.annotations[a.id]=a,this.settings.session.setBookmark(a.id,a.anchor,a.type,a)},EPUBJS.Reader.prototype.removeAnnotation=function(a){if(void 0!==this.settings.annotations[a]){var b=this.settings.annotations[a].type;this.trigger("reader:"+b+"removed",a),this.settings.session.deleteBookmark(a),delete this.settings.annotations[a]}},EPUBJS.Reader.prototype.updateAnnotation=function(a){a.edited=Date.now(),this.settings.annotations[a.id]=a,this.settings.session.setBookmark(a.id,a.anchor,a.type,a)},EPUBJS.Reader.prototype.clearAnnotations=function(a){if(a)for(var b in this.settings.annotations)this.settings.annotations.hasOwnProperty(b)&&this.settings.annotations[b].type===a&&(this.trigger("reader:"+a+"removed",b),this.settings.session.deleteBookmark(b),delete this.settings.annotations[b])},EPUBJS.Reader.prototype.addStyleSheet=function(a,b){var c=a,d=b||document.head,e=document.createElement("style");return e.appendChild(document.createTextNode("")),e.setAttribute("id",c),d.appendChild(e),e.sheet},EPUBJS.Reader.prototype.getStyleSheet=function(a,b){if(void 0!==a){var c=b||document.head,d=$(c).find("style#"+a);if(d.length)return d[0]}},EPUBJS.Reader.prototype.addCSSRule=function(a,b,c,d){void 0===d&&(d=0),"insertRule"in a?a.insertRule(b+"{"+c+"}",d):"addRule"in a&&a.addRule(b,c,d)},EPUBJS.Reader.prototype.addStyle=function(a,b,c,d){void 0===this.settings.customStyles[a]&&(this.settings.customStyles[a]=new this.Style(a,b,c,d),this.settings.session.setDefault("customStyles",this.settings.customStyles))},EPUBJS.Reader.prototype.enableStyle=function(a){var b=this.getStyleSheet(a.name,document.head),c=this.getStyleSheet(a.name,renderer.doc.head);c&&$(c).remove(),b&&$(b).remove();var d="",e=this.addStyleSheet(a.name,renderer.doc.head),f=this.addStyleSheet(a.name,document.head);for(var g in a.rules)d+=g+":"+a.rules[g]+"!important;";this.addCSSRule(e,a.selector,d,0),this.addCSSRule(f,"*"===a.selector?"#main":a.selector,d,0),this.settings.activeStyles[a.name]=!0,this.settings.session.setDefault("activeStyles",this.settings.activeStyles)},EPUBJS.Reader.prototype.disableStyle=function(a){var b=this.getStyleSheet(a.name,document.head),c=this.getStyleSheet(a.name,renderer.doc.head);c&&$(c).remove(),b&&$(b).remove(),this.settings.activeStyles[a.name]&&(delete this.settings.activeStyles[a.name],this.settings.session.setDefault("activeStyles",this.settings.activeStyles))},EPUBJS.Reader.prototype.updateStyle=function(a){var b=this.getStyleSheet(a.name,renderer.doc.head);this.settings.session.setDefault("customStyles",this.settings.customStyles),b&&this.enableStyle(a)},EPUBJS.Reader.prototype.deleteStyle=function(a){this.disableStyle(a),delete this.customStyles[a.name],this.settings.session.setDefault("customStyles",this.settings.customStyles)},EPUBJS.Reader.prototype.refreshStyles=function(a,b){var c=this.settings.activeStyles,d=this.settings.customStyles;for(var e in c)if(c.hasOwnProperty(e)){var f="",g=this.addStyleSheet(e,b.doc.head);for(var h in d[e].rules)d[e].rules.hasOwnProperty(h)&&(f+=h+":"+d[e].rules[h]+"!important;");this.addCSSRule(g,d[e].selector,f,0)}a&&a()},EPUBJS.Reader.prototype.restoreDefaults=function(a){for(var b=0;bm/2.5&&(o=m/2.5,pop_content.style.maxHeight=o+"px"),popRect.height+l>=m-25?(b.style.top=l-popRect.height+"px",b.classList.add("above")):b.classList.remove("above"),i-popRect.width<=0?(b.style.left=i+"px",b.classList.add("left")):b.classList.remove("left"),i+popRect.width/2>=n?(b.style.left=i-300+"px",popRect=b.getBoundingClientRect(),b.style.left=i-popRect.width+"px",popRect.height+l>=m-25?(b.style.top=l-popRect.height+"px",b.classList.add("above")):b.classList.remove("above"),b.classList.add("right")):b.classList.remove("right")},f=function(){k[d].classList.add("on")},g=function(){k[d].classList.remove("on")},h=function(){setTimeout(function(){k[d].classList.remove("show")},100)},i=function(){b.SidebarController.changePanelTo("Notes"),b.SidebarController.show()};a.addEventListener("mouseover",e,!1),a.addEventListener("mouseout",h,!1),a.addEventListener("click",i,!1)};f.on("click",function(b){f[0].classList.contains("icon-room")?(f.removeClass("icon-room"),f.addClass("icon-location_off"),e.prop("disabled",!0),h.hasClass("touch_nav")&&(h.removeClass("touch_nav"),g.removeClass("touch_nav"),h.addClass("restore_touch_nav")),a.on("renderer:click",o)):(e.prop("disabled",!1),f.removeClass("icon-location_off"),f.addClass("icon-room"),h.hasClass("restore_touch_nav")&&(h.removeClass("restore_touch_nav"),h.addClass("touch_nav"),g.addClass("touch_nav")),a.off("renderer:click",o))});for(var z in i)i.hasOwnProperty(z)&&"annotation"===i[z].type&&p(i[z]);return this.on("reader:annotationcreated",function(a){p(a)}),this.on("reader:annotationremoved",function(a){q(a)}),j.registerHook("beforeChapterDisplay",function(a,b){var c=b.currentChapter;for(var d in i)if(i.hasOwnProperty(d)&&"annotation"===i[d].type){var e=l.parse(i[d].anchor);if(e.spinePos===c.spinePos)try{w(i[d])}catch(a){console.log("anchoring failed",i[d].anchor)}}a()},!0),{show:m,hide:n,createItem:r}},EPUBJS.reader.ReaderController=function(a){var b=$("#main"),c=$("#divider"),d=$("#loader"),e=$("#next"),f=$("#prev"),g=$("#sidebarReflow"),h=$("#metainfo"),i=$("#use_custom_colors"),j=($("#container"),$("#fullscreen")),k=$("#bookmark"),l=$("#note"),m=this,a=this.book,n=m.settings,o=function(){if(m.viewerResized){var c=a.getCurrentLocationCfi();m.viewerResized=!1,b.removeClass("single"),b.one("transitionend",function(){a.gotoCfi(c)})}},p=function(){var c=a.getCurrentLocationCfi();m.viewerResized=!0,b.addClass("single"),b.one("transitionend",function(){a.gotoCfi(c)})},q=function(){d.show(),t()},r=function(){d.hide()},s=function(){c.addClass("show")},t=function(){c.removeClass("show")},u=!1,v=function(a){u=!0,a.addClass("active"),setTimeout(function(){u=!1,a.removeClass("active")},100)},w=function(a){var b=!1;switch(n.keyboard[a.keyCode]){case"previous":f.click();break;case"next":e.click();break;case"first":b=1;break;case"last":break;case"annotate":l.click();break;case"bookmark":k.click();break;case"reflow":g.click();break;case"toggleSidebar":m.SidebarController.toggle();break;case"closeSidebar":m.SidebarController.hide();break;case"toggleFullscreen":j.click();break;case"toggleNight":h.click();break;case"toggleDay":i.click();break;default:console.log("unsupported keyCode: "+a.keyCode)}};return document.addEventListener("keydown",w,!1),e.on("click",function(b){"rtl"===a.metadata.direction?a.prevPage():a.nextPage(),v(e),b.preventDefault()}),f.on("click",function(b){"rtl"===a.metadata.direction?a.nextPage():a.prevPage(),v(f),b.preventDefault()}),a.on("renderer:spreads",function(a){a?s():t()}),{slideOut:p,slideIn:o,showLoader:q,hideLoader:r,showDivider:s,hideDivider:t,keyCommands:w}},EPUBJS.reader.SearchController=function(){var a=this,b=this.book,c="",d=$("#searchBox"),e=$("#searchBox").next(),f=$("#clear_search"),g=$("#searchResults"),h=$("#searchView"),i=$("#viewer iframe").contents().find("body"),j=($("#sidebar"),function(){h.addClass("open"),d.focus()}),k=function(){o(),h.removeClass("open")},l=function(b){return void 0===b&&(b=d.val()),""==b?void m():(a.SidebarController.changePanelTo("Search"),g.empty(),g.append("
  • Searching...

  • "),a.SearchController.query=b,void p(b,g[0]))};d.on("keydown",function(a){e.css("visibility",this.value.length?"visible":"hidden"),13===a.keyCode&&l(),a.stopPropagation()}),e.on("click",function(){$(this).css("visibility","hidden"),d.val("")}),f.on("click",function(){o(),g.empty()});var m=function(){o(),g.empty(),"Search"==a.SidebarController.getActivePanel()&&a.SidebarController.changePanelTo("Toc")},n=function(b){$("#viewer iframe").contents().find("body").highlight(a.SearchController.query,{element:"span"})},o=function(a){i=$("#viewer iframe").contents().find("body"),i.unhighlight(),b.off("renderer:chapterDisplayed",n)},p=function(a,c){return new Promise(function(d,e){for(var f=[],h=0;h0&&(b++,g=f(a.subitems,b),toggle.classList.add("toc_toggle"),d.insertBefore(toggle,e),d.appendChild(g)),c.appendChild(d)}),c},g=function(){c.addClass("open")},h=function(){c.removeClass("open")},i=function(a){var b=a.id,d=c.find("#toc-"+b),f=c.find(".currentChapter");c.find(".openChapter");d.length&&(d!=f&&d.has(e).length>0&&f.removeClass("currentChapter"),d.addClass("currentChapter"),d.parents("li").addClass("openChapter"))};b.on("renderer:chapterDisplayed",i);var j=f(a);return d.appendChild(j),c.append(d),c.find(".toc_link").on("click",function(a){var d=this.getAttribute("href");a.preventDefault(),b.goto(d),c.find(".currentChapter").addClass("openChapter").removeClass("currentChapter"),$(this).parent("li").addClass("currentChapter")}),c.find(".toc_toggle").on("click",function(a){var b=$(this).parent("li"),c=b.hasClass("openChapter");a.preventDefault(),c?b.removeClass("openChapter"):b.addClass("openChapter")}),{show:g,hide:h}}; \ No newline at end of file +EPUBJS.reader={},EPUBJS.reader.plugins={},function(a,b){var c=(a.ePubReader||{},a.ePubReader=function(a,b){return new EPUBJS.Reader(a,b)});"function"==typeof define&&define.amd?define(function(){return Reader}):"undefined"!=typeof module&&module.exports&&(module.exports=c)}(window,jQuery),EPUBJS.Reader=function(a,b){var c,d,e,f,g=this,h=$("#viewer"),i=window.location.search;this.settings=EPUBJS.core.defaults(b||{},{bookPath:a,contained:void 0,sidebarReflow:!1,generatePagination:!1,history:!0,keyboard:{32:"next",34:"next",39:"next",33:"previous",37:"previous",36:"first",35:"last",65:"annotate",66:"bookmark",82:"reflow",83:"toggleSidebar",84:"toolbar",68:"toggleDay",78:"toggleNight",70:"toggleFullscreen",27:"closeSidebar"},nightMode:!1,dayMode:!1,maxWidth:72,pageArrows:!1,annotations:{},customStyles:{},activeStyles:{},session:{}}),this.Annotation=function(a,b,c,d){this.id=d||EPUBJS.core.uuid(),this.type=a,this.date=Date.now(),this.edited=this.date,this.anchor=b,this.body=c},this.Style=function(a,b,c,d){this.name=a,this.selector=b,this.rules=c,this.extra=d||null},i&&(f=i.slice(1).split("&"),f.forEach(function(a){var b=a.split("="),c=b[0],d=b[1]||"";g.settings[c]=decodeURIComponent(d)})),this.restoreDefaults(this.settings.session.defaults),this.restorePreferences(this.settings.session.preferences),this.restoreAnnotations(this.settings.session.annotations),this.book=c=new EPUBJS.Book(this.settings),this.offline=!1,this.sidebarOpen=!1,this.viewerResized=!1,this.settings.generatePagination&&c.generatePagination(h.width(),h.height()),c.renderTo("viewer").then(function(a){this.renderer=d=a,g.StyleController=EPUBJS.reader.StylesController.call(g,d)}),g.ReaderController=EPUBJS.reader.ReaderController.call(g,c),g.SettingsController=EPUBJS.reader.SettingsController.call(g,c),g.ControlsController=EPUBJS.reader.ControlsController.call(g,c),g.SidebarController=EPUBJS.reader.SidebarController.call(g,c),g.NotesController=EPUBJS.reader.NotesController.call(g,c),g.BookmarksController=EPUBJS.reader.BookmarksController.call(g,c),g.SearchController=EPUBJS.reader.SearchController.call(g,c);for(e in EPUBJS.reader.plugins)EPUBJS.reader.plugins.hasOwnProperty(e)&&(g[e]=EPUBJS.reader.plugins[e].call(g,c));return c.ready.all.then(function(){g.ReaderController.hideLoader(),g.settings.session.cursor!=={}&&g.trigger("reader:gotobookmark",g.settings.session.cursor)}),c.getMetadata().then(function(a){g.MetaController=EPUBJS.reader.MetaController.call(g,a)}),c.getToc().then(function(a){g.TocController=EPUBJS.reader.TocController.call(g,a)}),window.addEventListener("beforeunload",this.unload.bind(this),!1),window.addEventListener("hashchange",this.hashChanged.bind(this),!1),c.on("renderer:keydown",g.ReaderController.keyCommands.bind(this)),c.on("renderer:selected",this.selectedRange.bind(this)),this},EPUBJS.Reader.prototype.cfiToId=function(a){return a.replace(/\W/g,"")},EPUBJS.Reader.prototype.getBookmark=function(a){var b=this.cfiToId(a);return this.settings.annotations[b]},EPUBJS.Reader.prototype.addBookmark=function(a){var b,c,d,e,f=this.cfiToId(a),g=new EPUBJS.EpubCFI,h="";return d=g.generateRangeFromCfi(a,this.book.renderer.doc),b=d.startOffset,h=d.startContainer.wholeText,c=/\S/.test(h)?b>0&&" "!=h.charAt(b-1)?EPUBJS.core.ellipsize(h.substr(h.indexOf(" ",b))):EPUBJS.core.ellipsize(h.substr(b)):a,this.isBookmarked(f)?(e=this.getAnnotation(f),this.updateAnnotation(e)):(e=new this.Annotation("bookmark",a,c,this.cfiToId(a)),this.addAnnotation(e)),this.trigger("reader:bookmarkcreated",e),e},EPUBJS.Reader.prototype.updateBookmark=function(a){this.updateAnnotation(a)},EPUBJS.Reader.prototype.removeBookmark=function(a){var b=this.cfiToId(a);this.removeAnnotation(b)},EPUBJS.Reader.prototype.isBookmarked=function(a){var b=this.cfiToId(a);return void 0!==this.settings.annotations[b]},EPUBJS.Reader.prototype.clearBookmarks=function(){this.clearAnnotations("bookmark")},EPUBJS.Reader.prototype.getAnnotation=function(a){return this.settings.annotations[a]},EPUBJS.Reader.prototype.addAnnotation=function(a){this.settings.annotations[a.id]=a,this.settings.session.setBookmark(a.id,a.anchor,a.type,a)},EPUBJS.Reader.prototype.removeAnnotation=function(a){if(void 0!==this.settings.annotations[a]){var b=this.settings.annotations[a].type;this.trigger("reader:"+b+"removed",a),this.settings.session.deleteBookmark(a),delete this.settings.annotations[a]}},EPUBJS.Reader.prototype.updateAnnotation=function(a){a.edited=Date.now(),this.settings.annotations[a.id]=a,this.settings.session.setBookmark(a.id,a.anchor,a.type,a)},EPUBJS.Reader.prototype.clearAnnotations=function(a){if(a)for(var b in this.settings.annotations)this.settings.annotations.hasOwnProperty(b)&&this.settings.annotations[b].type===a&&(this.trigger("reader:"+a+"removed",b),this.settings.session.deleteBookmark(b),delete this.settings.annotations[b])},EPUBJS.Reader.prototype.addStyleSheet=function(a,b){var c=a,d=b||document.head,e=document.createElement("style");return e.appendChild(document.createTextNode("")),e.setAttribute("id",c),d.appendChild(e),e.sheet},EPUBJS.Reader.prototype.getStyleSheet=function(a,b){if(void 0!==a){var c=b||document.head,d=$(c).find("style#"+a);if(d.length)return d[0]}},EPUBJS.Reader.prototype.addCSSRule=function(a,b,c,d){void 0===d&&(d=0),"insertRule"in a?a.insertRule(b+"{"+c+"}",d):"addRule"in a&&a.addRule(b,c,d)},EPUBJS.Reader.prototype.addStyle=function(a,b,c,d){void 0===this.settings.customStyles[a]&&(this.settings.customStyles[a]=new this.Style(a,b,c,d),this.settings.session.setDefault("customStyles",this.settings.customStyles))},EPUBJS.Reader.prototype.enableStyle=function(a){var b=this.getStyleSheet(a.name,document.head),c=this.getStyleSheet(a.name,renderer.doc.head);c&&$(c).remove(),b&&$(b).remove();var d="",e=this.addStyleSheet(a.name,renderer.doc.head),f=this.addStyleSheet(a.name,document.head);for(var g in a.rules)d+=g+":"+a.rules[g]+"!important;";this.addCSSRule(e,a.selector,d,0),this.addCSSRule(f,"*"===a.selector?"#main":a.selector,d,0),this.settings.activeStyles[a.name]=!0,this.settings.session.setDefault("activeStyles",this.settings.activeStyles)},EPUBJS.Reader.prototype.disableStyle=function(a){var b=this.getStyleSheet(a.name,document.head),c=this.getStyleSheet(a.name,renderer.doc.head);c&&$(c).remove(),b&&$(b).remove(),this.settings.activeStyles[a.name]&&(delete this.settings.activeStyles[a.name],this.settings.session.setDefault("activeStyles",this.settings.activeStyles))},EPUBJS.Reader.prototype.updateStyle=function(a){var b=this.getStyleSheet(a.name,renderer.doc.head);this.settings.session.setDefault("customStyles",this.settings.customStyles),b&&this.enableStyle(a)},EPUBJS.Reader.prototype.deleteStyle=function(a){this.disableStyle(a),delete this.customStyles[a.name],this.settings.session.setDefault("customStyles",this.settings.customStyles)},EPUBJS.Reader.prototype.refreshStyles=function(a,b){var c=this.settings.activeStyles,d=this.settings.customStyles;for(var e in c)if(c.hasOwnProperty(e)){var f="",g=this.addStyleSheet(e,b.doc.head);for(var h in d[e].rules)d[e].rules.hasOwnProperty(h)&&(f+=h+":"+d[e].rules[h]+"!important;");this.addCSSRule(g,d[e].selector,f,0)}a&&a()},EPUBJS.Reader.prototype.restoreDefaults=function(a){for(var b=0;bm/2.5&&(o=m/2.5,pop_content.style.maxHeight=o+"px"),popRect.height+l>=m-25?(b.style.top=l-popRect.height+"px",b.classList.add("above")):b.classList.remove("above"),i-popRect.width<=0?(b.style.left=i+"px",b.classList.add("left")):b.classList.remove("left"),i+popRect.width/2>=n?(b.style.left=i-300+"px",popRect=b.getBoundingClientRect(),b.style.left=i-popRect.width+"px",popRect.height+l>=m-25?(b.style.top=l-popRect.height+"px",b.classList.add("above")):b.classList.remove("above"),b.classList.add("right")):b.classList.remove("right")},f=function(){k[d].classList.add("on")},g=function(){k[d].classList.remove("on")},h=function(){setTimeout(function(){k[d].classList.remove("show")},100)},i=function(){b.SidebarController.changePanelTo("Notes"),b.SidebarController.show()};a.addEventListener("mouseover",e,!1),a.addEventListener("mouseout",h,!1),a.addEventListener("click",i,!1)};f.on("click",function(b){f[0].classList.contains("icon-room")?(f.removeClass("icon-room"),f.addClass("icon-location_off"),e.prop("disabled",!0),h.hasClass("touch_nav")&&(h.removeClass("touch_nav"),g.removeClass("touch_nav"),h.addClass("restore_touch_nav")),a.on("renderer:click",o)):(e.prop("disabled",!1),f.removeClass("icon-location_off"),f.addClass("icon-room"),h.hasClass("restore_touch_nav")&&(h.removeClass("restore_touch_nav"),h.addClass("touch_nav"),g.addClass("touch_nav")),a.off("renderer:click",o))});for(var z in i)i.hasOwnProperty(z)&&"annotation"===i[z].type&&p(i[z]);return this.on("reader:annotationcreated",function(a){p(a)}),this.on("reader:annotationremoved",function(a){q(a)}),j.registerHook("beforeChapterDisplay",function(a,b){var c=b.currentChapter;for(var d in i)if(i.hasOwnProperty(d)&&"annotation"===i[d].type){var e=l.parse(i[d].anchor);if(e.spinePos===c.spinePos)try{w(i[d])}catch(a){console.log("anchoring failed",i[d].anchor)}}a()},!0),{show:m,hide:n,createItem:r}},EPUBJS.reader.ReaderController=function(a){var b=$("#main"),c=$("#divider"),d=$("#loader"),e=$("#next"),f=$("#prev"),g=$("#sidebarReflow"),h=$("#metainfo"),i=$("#use_custom_colors"),j=($("#container"),$("#fullscreen")),k=$("#bookmark"),l=$("#note"),m=this,a=this.book,n=m.settings,o=function(){if(m.viewerResized){var c=a.getCurrentLocationCfi();m.viewerResized=!1,b.removeClass("single"),b.one("transitionend",function(){a.gotoCfi(c)})}},p=function(){var c=a.getCurrentLocationCfi();m.viewerResized=!0,b.addClass("single"),b.one("transitionend",function(){a.gotoCfi(c)})},q=function(){d.show(),t()},r=function(){d.hide()},s=function(){c.addClass("show")},t=function(){c.removeClass("show")},u=!1,v=function(a){u=!0,a.addClass("active"),setTimeout(function(){u=!1,a.removeClass("active")},100)},w=function(a){var b=!1;switch(n.keyboard[a.keyCode]){case"previous":f.click();break;case"next":e.click();break;case"first":b=1;break;case"last":break;case"annotate":l.click();break;case"bookmark":k.click();break;case"reflow":g.click();break;case"toggleSidebar":m.SidebarController.toggle();break;case"closeSidebar":m.SidebarController.hide();break;case"toggleFullscreen":j.click();break;case"toggleNight":h.click();break;case"toggleDay":i.click();break;default:console.log("unsupported keyCode: "+a.keyCode)}};return document.addEventListener("keydown",w,!1),e.on("click",function(b){"rtl"===a.metadata.direction?a.prevPage():a.nextPage(),v(e),b.preventDefault()}),f.on("click",function(b){"rtl"===a.metadata.direction?a.nextPage():a.prevPage(),v(f),b.preventDefault()}),a.on("renderer:spreads",function(a){a?s():t()}),{slideOut:p,slideIn:o,showLoader:q,hideLoader:r,showDivider:s,hideDivider:t,keyCommands:w}},EPUBJS.reader.SearchController=function(){var a=this,b=this.book,c="",d=$("#searchBox"),e=$("#searchBox").next(),f=$("#clear_search"),g=$("#searchResults"),h=$("#searchView"),i=$("#viewer iframe").contents().find("body"),j=($("#sidebar"),function(){h.addClass("open"),d.focus()}),k=function(){o(),h.removeClass("open")},l=function(b){return void 0===b&&(b=d.val()),""==b?void m():(a.SidebarController.changePanelTo("Search"),g.empty(),g.append("
  • Searching...

  • "),a.SearchController.query=b,void p(b,g[0]))};d.on("keydown",function(a){e.css("visibility",this.value.length?"visible":"hidden"),13===a.keyCode&&l(),a.stopPropagation()}),e.on("click",function(){$(this).css("visibility","hidden"),d.val("")}),f.on("click",function(){o(),g.empty()});var m=function(){o(),g.empty(),"Search"==a.SidebarController.getActivePanel()&&a.SidebarController.changePanelTo("Toc")},n=function(b){$("#viewer iframe").contents().find("body").highlight(a.SearchController.query,{element:"span"})},o=function(a){i=$("#viewer iframe").contents().find("body"),i.unhighlight(),b.off("renderer:chapterDisplayed",n)},p=function(a,c){return new Promise(function(d,e){for(var f=[],h=0;h0&&(b++,g=f(a.subitems,b),toggle.classList.add("toc_toggle"),d.insertBefore(toggle,e),d.appendChild(g)),c.appendChild(d)}),c},g=function(){c.addClass("open")},h=function(){c.removeClass("open")},i=function(a){var b=a.id,d=c.find("#toc-"+b),f=c.find(".currentChapter");c.find(".openChapter");d.length&&(d!=f&&d.has(e).length>0&&f.removeClass("currentChapter"),d.addClass("currentChapter"),d.parents("li").addClass("openChapter"))};b.on("renderer:chapterDisplayed",i);var j=f(a);return d.appendChild(j),c.append(d),c.find(".toc_link").on("click",function(a){var d=this.getAttribute("href");a.preventDefault(),b.goto(d),c.find(".currentChapter").addClass("openChapter").removeClass("currentChapter"),$(this).parent("li").addClass("currentChapter")}),c.find(".toc_toggle").on("click",function(a){var b=$(this).parent("li"),c=b.hasClass("openChapter");a.preventDefault(),c?b.removeClass("openChapter"):b.addClass("openChapter")}),{show:g,hide:h}}; \ No newline at end of file diff --git a/vendor/pdfjs/controllers/settings_controller.js b/vendor/pdfjs/controllers/settings_controller.js index 8d9c6f9..11b2efd 100644 --- a/vendor/pdfjs/controllers/settings_controller.js +++ b/vendor/pdfjs/controllers/settings_controller.js @@ -62,7 +62,7 @@ PDFJS.reader.SettingsController = function() { $close.show(); $close.on("click", function () { reader.book.destroy(); - parent.OCA.Files_Reader.Plugin.hide(); + parent.OCA.Epubreader.Plugin.hide(); }); }