mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
- files_reader: v1.2.0, implemented night mode, scroll to top on page
change (#73), default viewer selection in personal preferences section (#74), fixed undefined $title in template (#72)
This commit is contained in:
parent
d7df75fbc3
commit
6b0ab64fe4
33 changed files with 810 additions and 622 deletions
BIN
dist/files_reader-1.2.0-NC.tar.gz
vendored
Normal file
BIN
dist/files_reader-1.2.0-NC.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/files_reader-1.2.0-OC.tar.gz
vendored
Normal file
BIN
dist/files_reader-1.2.0-OC.tar.gz
vendored
Normal file
Binary file not shown.
|
@ -1,3 +1,18 @@
|
|||
## UNRELEASED
|
||||
### Added
|
||||
- PDF: (#73) new preference 'scroll to top of page on page turn'
|
||||
- PDF: defaults and per-document settings are now saved and restored
|
||||
- PDF: nightmode (using CSS3 filters, only works in recent browsers), toggle with 'd', by clicking nightmode button or clicking in empty area on button bar, adjust in settings
|
||||
|
||||
### Changed
|
||||
- remove <base> from templates to avoid warning in console, <base> statement was ineffective anyway de to (overly restrictive) hardcoded policy in NC/OC.
|
||||
- removed (or rather disabled) merging of PDF annotations into user bookmarks as it only served to mess up the bookmark list and slowed things down. This feature can be re-enabled once Reader gains a functional PDF annotation editor.
|
||||
|
||||
### Fixed
|
||||
- PDF: (#72) $title not ['title'] in pdfreader template, hopefully the last remaining bug related to template refactoring
|
||||
- PDF: browsing the thumbnail list in single-page mode did not work as intended due to datatype mismatch in page calculation routine, fixed with explicit toString()
|
||||
- PDF: page 0 does not exist so don't try to go there
|
||||
|
||||
## 1.1.1 - 2018-01-19
|
||||
### Added
|
||||
- signed package for publication in Owncloud marketplace
|
||||
|
|
|
@ -21,7 +21,7 @@ Reader remembers the last-visited page in a book and returns to that page when t
|
|||
- seamless full-screen mode supported on browsers which allow full user-control, ie. not on Apple)
|
||||
- single- and double-page viewing mode
|
||||
- user-configurable font and colour settings
|
||||
- night mode, toggled by clicking the book title/author on top of the viewer (not yet implemented for PDF)
|
||||
- night mode, toggled by clicking the book title/author on top of the viewer or the night mode button (PDF)
|
||||
- full-text search with keyword highlighting
|
||||
- bookmarks (with automatic snippet generation)
|
||||
- annotations (not yet implemented for PDF)
|
||||
|
@ -89,7 +89,6 @@ Search through a document, showing all results in the sidebar|![Search through a
|
|||
Dropdown showing page format options - spread, single page, page width and zoom options|![Dropdown showing page format options - spread, single page, page width and zoom options][SS21]
|
||||
Reader showing PDF in spread mode, thumbnails in the sidebar|![Reader showing PDF in spread mode, thumbnails in the sidebar][SS22]
|
||||
|
||||
|
||||
### CBR/CBZ
|
||||
| | |
|
||||
---|---
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
- bookmarks
|
||||
- annotations
|
||||
- settings
|
||||
- rtl and ltr
|
||||
- test canvas size restriction
|
||||
- add IDs to highlights so they can be marked when hovered - or when related list item is hovered
|
||||
|
|
35
files_reader/ajax/personal.php
Normal file
35
files_reader/ajax/personal.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Files_Reader App
|
||||
*
|
||||
* @author Frank de Lange
|
||||
* @copyright 2014,2018 Frank de Lange
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Files_Reader;
|
||||
|
||||
\OCP\JSON::callCheck();
|
||||
\OCP\JSON::checkLoggedIn();
|
||||
|
||||
$l = \OC::$server->getL10N('files_reader');
|
||||
|
||||
$EpubEnable = isset($_POST['EpubEnable']) ? $_POST['EpubEnable'] : 'false';
|
||||
$PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false';
|
||||
$CbxEnable = isset($_POST['CbxEnable']) ? $_POST['CbxEnable'] : 'false';
|
||||
|
||||
Config::set('epub_enable', $EpubEnable);
|
||||
Config::set('pdf_enable', $PdfEnable);
|
||||
Config::set('cbx_enable', $CbxEnable);
|
||||
|
||||
\OCP\JSON::success(
|
||||
array(
|
||||
'data' => array('message'=> $l->t('Settings updated successfully.'))
|
||||
)
|
||||
);
|
||||
|
||||
exit();
|
||||
|
|
@ -15,6 +15,8 @@ namespace OCA\Files_Reader\AppInfo;
|
|||
use OCP\AppFramework\App;
|
||||
use OCP\Util;
|
||||
|
||||
$l = \OC::$server->getL10N('files_reader');
|
||||
|
||||
\OCA\Files_Reader\Hooks::register();
|
||||
Util::addscript('files_reader', 'plugin');
|
||||
|
||||
\OCP\App::registerPersonal('files_reader', 'personal');
|
||||
|
|
|
@ -30,7 +30,7 @@ See [README] for more exhaustive information on features and potential misfeatur
|
|||
[README]: https://github.com/Yetangitu/owncloud-apps/blob/master/files_reader/README.md
|
||||
]]>
|
||||
</description>
|
||||
<version>1.1.5</version>
|
||||
<version>1.2.0</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Frank de Lange</author>
|
||||
<documentation>
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* later.
|
||||
*/
|
||||
|
||||
$this->create('reader_personal_settings', 'ajax/personal.php')->actionInclude('files_reader/ajax/personal.php');
|
||||
|
||||
return ['routes' => [
|
||||
// Page
|
||||
['name' => 'page#showReader', 'url' => '/', 'verb' => 'GET'],
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
{
|
||||
"hashes": {
|
||||
"CHANGELOG.md": "be42550cf1ba12cb2e4c284a12d787c1248006bb67bfd8310701970f31df4d78cc7f7b27fb1ff936c2bd34551a55f15a4c52821937f2f22e55ff9842c75e2347",
|
||||
"README.md": "a64e6b4b4eacc77006c0b406308f56ead93c893bc5588f734cc5196aa4bd2c7e90e9861a022a3c6545c614b7fd915d527de11ca2d4c3ae2ff759d44f77c7eca3",
|
||||
"TODO": "abec9035615be381c012c12229835c14f27a19ce92a82e6286f068376a6bbad0fa1dff4d091810fed694b51702359f147bf63c54ac755d0433df36fcaa415e3c",
|
||||
"appinfo\/app.php": "c1289bdfe9cfd5c83a1f2768bf052cc36a222e99c96740f528b8a537c70a55c42751662f8fc1b027c610a59ad4f6aa21237dde827d1e41f4ba3538d857716c25",
|
||||
"CHANGELOG.md": "efb4c743edfa61cea65a02dddd312b2c1618cb1f5c62ae6e68d390a24b26e525194fad84761c1ca18735e0bcf3e6ed9f03496f41d11ac2bb1d05240e0dd0c3bf",
|
||||
"README.md": "27742b78bac23d2dd5fde269b9e3070c2042c44d6b120017a7d701c59cfa10433e79bea47cbf2af1edee0ac311d8fbfec4d27849c46ba79e2427090013e9a224",
|
||||
"TODO": "2e96d92edf624625cb0fa84032e772aa674cd0b5b8270389acb64e5d8071d958a23489b90eaa3d4243cacd1f2a5934af7064dec66ffa5146f59945a9d797ab9a",
|
||||
"ajax\/personal.php": "fbd21da9f8c4ea90dd549e82479aea877214b3b0ac102e4c4abc8c4e5914d77253bd1b82c36093ad7e21e7b85c78433006927a607a853b37c664f4f28236cbdf",
|
||||
"appinfo\/app.php": "347e7c861afcd5c4ad54af36a0d393c6108abd1cbc50524bede213c3cddcd7701a484ed14d9fe64ed9c6cf9e7fc37618b7ba4e8fc74b775c9c43112860ca6543",
|
||||
"appinfo\/database.xml": "111a18a81749237ad4e23c94f0b0986e08964c8b1ae5495b0dfe082f4801dc8951eb7c862f96edc8493eba1c4808c2227cde1ab48572d806b026c37abab07a85",
|
||||
"appinfo\/info.xml": "2fa349c546e9bd4d69c061f6918f545df11437ea5a108d1cf42217d2252423e56844a009c280e221a6075871cd3bfd0c91c57b201f8c334a8f26c1f3f732a589",
|
||||
"appinfo\/routes.php": "57153da351163ca15b81e023a548257e7d31baeb32785fbf5132418b0393949d3590a8ee119b2f6ae8c0b65b05ac4b5ae97cd9e9b2889576efc2bfb890684c85",
|
||||
"img\/app.svg": "e4232de28db93900ea90cc91e60e26daccd137b5ffed7243edf9bc45b51edba39e917ca2875fcfcbf0a3b741173e99b8c2eff7ad371c40d5617aec74b56e6a68",
|
||||
"appinfo\/info.xml": "6fcb804cb1665854092a697a746a5dd3be352e03491f5a9a224e785bcb805c1593121448e0d594d4f145736f80ee2a7c69a566a89091fb8ffc0a224840ffe73c",
|
||||
"appinfo\/routes.php": "64eaeaba5915721487dddef721dd4d747b070a658653e3c74287607faa7f3553bba907761779227a0c08870cc86420bdd97a4764887e4137f960d5bcb1e8006c",
|
||||
"css\/settings.css": "4c6d3bd224ad754e5396eeea719fb16ad975a2bd7f9dc363b4c7faf3a1e8c16c317b2b4092845280456e922048afb2155e43dcca108ac1ba535c83755ac27e59",
|
||||
"img\/app.svg": "88bc2059bd09013de866eaf61be0207bb96f4b84cfa3df0164e5b65aaa99db5f616e340a6da8e3c01fd5a07c8e4c727019f74760ca581552074e9f1a0237d35e",
|
||||
"img\/book.png": "9804b463779b32d1b8d9ced85a11f7e3201d9aef9a48b55b1381ae6addf19a78f5a3990c7201ce5702e798fd6bfad36c7a8e11e699f851351adf9b5b85cb3e68",
|
||||
"img\/loading.gif": "4ce13c9402690a9beee76c8f6aa21ab48211377ef679e1b5d0ceca26f231a7ceecb2f00c0ad4facafa922e292e4afbde64cd85360e3a06d45ee1a71ca0e1a4c8",
|
||||
"js\/lib\/Blob.js": "b0c7760f8b8365d39baf3a6320c2259660cadc5a4a877f35ef212ccfaee645a48ac6b754536d716539841c62a96f2b5036fe1087a0cb3c4b4c6b6fa34d406021",
|
||||
|
@ -15,8 +17,10 @@
|
|||
"js\/lib\/typedarray.js": "e8fee5f0cbd4e5282083182ee7ec2cc6c6f86d6d1f0c259853612983b1ef5cd1187061546baadb1eb0f8629dbaaa3bb4520a4d161f5acf932503ce7e52a3a6c0",
|
||||
"js\/lib\/typedarray.min.js": "c78aa9dc295212548ac927783c62f1a5a5ff56c05164999f09d0ac5ea6a98afbe71aaa4e45eca469e379d920cc73beccbdebdd25f9797335f5b361fc4d87d09c",
|
||||
"js\/lib\/wgxpath.install.js": "afbb4af1de778f5d135ef4be4d4eea98d27a323a139463d06b3f0b2c4cea00730e45d8414a0e74eace952c634f87e383a925c132bae043216312f9425a1b246d",
|
||||
"js\/plugin.js": "8816cfee3553eb86c83f6b183ec5e667136619cb83654fec0372ff6846099557b793a7fdbbef228d76433de3f5b06fd93479902ac3f57135b5b645bbc632b6d4",
|
||||
"js\/personal.js": "60e099c1e1136ad21216709562f3227031a46e359a8a86841dbd23770de3e1b039f36b19ccfb710b5d22bb1316113f5fd59f7861c37aade0f644839f0c6bf2b3",
|
||||
"js\/plugin.js": "e7f1993c663e2bcf2bc51b42bccf6c873d6e2387fa02121e8ad5b64274198d52d54eb7d1b574dd68c762e8129abdc5a43ce210506f08b83a8e98c48166086d25",
|
||||
"js\/ready.js": "a3fd42592fa94fa2d573b867238f5e35780681e218dc1aa23ce8a8afe66614ea0d8fa94abda4c7b7ab595727cd724c75d452a97bb0819b2d35fe2e145c985f00",
|
||||
"js\/settings.js": "a627c42dd7ed708b0e3cf25494d402afa546b489cb0d53c7d15786ee3e333211c4a283c1eec6b6964d30a4b7c018f51f780aac6ad1b574d380b1c8514c48fabb",
|
||||
"lib\/Controller\/BookmarkController.php": "1e1d680f5bcbf5edc49df09a696d011920d8695e305bebcc1c87cc9283a73a5ec8770a264312b8ec80c72f45855ea0baeb2753a7d7df05befb0c29db50ed692a",
|
||||
"lib\/Controller\/MetadataController.php": "23e23b95c8c15d0ba5be797b26babb315703430251967fb536e267f3cd64af7047d1953e3299940db8acfecc2a87f5339220d37c0241b254fbf524c938a55053",
|
||||
"lib\/Controller\/PageController.php": "0b6520136983eee131d0369fd6958dd19bb7cb0486f5a8ca0147eacfda120cf339f4dd2c61f3ff74eb87795063325a465d1036c002fb5d307315066160ee10f5",
|
||||
|
@ -27,15 +31,18 @@
|
|||
"lib\/Db\/PreferenceMapper.php": "4697ffe43030475d9091c3ce56936a7435533186f1ced6bebe3f07bbb47e8a59fa00758f77d2d27b8c13ed766d647450d7709e7b174c4da6e7bb0115e5c44988",
|
||||
"lib\/Db\/ReaderEntity.php": "cb76626c5c4f2d177756093ef7f836c5365724c4ff8906a57056bbc85563ddc91118faf5efa0cb295a9e533680d38bf51cdf78ec2dc25bd7a4f0737457e0cfdd",
|
||||
"lib\/Db\/ReaderMapper.php": "c8d44cefe4c1b3de1e55e71367c7d7e07630adbfd29027d29e06a4f04559c7ea869ccc28c862af439dd35042f8bbf7019cb5cab9bbd47c616ea99e28d222326d",
|
||||
"lib\/Hooks.php": "a6e3c2a8b662d947954ea3326b3496a7f4e68af7eb4a8a25f28b6064d8c4fe2fb9a572e6ab2f0e39cc7c1e271c4a2f9ca50bdf2f6382bcec6a3b6a81e21647ac",
|
||||
"lib\/Hooks.php": "6453a03537bdfe0cd9052acb1e9a600f27be145cf2c9a58de437c520da55c56289eee228c84e038cad86f59d689edcf3f70280ede2bef7cb9b7e66a5d1f24b0a",
|
||||
"lib\/Service\/BookmarkService.php": "7df012686e8d1e9a4668738d82edc51ca0da8e584767737091053bb48bcb896f11b03262f5e20dcd030a65af9c524d24003b3405679fbc23f60d0bb5d84eba15",
|
||||
"lib\/Service\/MetadataService.php": "7bc4ab9cdd16ced31f46ba137fa1efb4d6ef4784f947886e8affe667bf7b51c532bdc079e9033e774db4ea30a8da1000df958fc6e15e518bd920995dccc729cf",
|
||||
"lib\/Service\/PreferenceService.php": "2b52a28a074eba355154cbdad80358aaac394635ca91698ec3d7876eee0dc7e154064d8fbbe5465e7bbc783e618fbbf9ea1f07acd3cc4ce5b84116f7d8aed81c",
|
||||
"lib\/Service\/Service.php": "cdf97b612fde0bec7846c0005280f1492d63e705b753c4aeb1df2c2ad2612a122d49eb15b6e7dfbe7fd7320762171a6ac6324181511dc28ec0e1e27092872eae",
|
||||
"lib\/Utility\/Time.php": "58f760099eaf647718b491a7c21012398906bbe3ac7363aeceffff1a98d952f9a76697ddff2c00abe25e6c8db1cdf4d5994c1ab7d9474a05afb76b444ab9fed6",
|
||||
"templates\/cbreader.php": "0e825cda7619556a3faf7e87bc53d7d9eebe271f39cc4188c4e24ee61e5a48d58cd6b3672bacf39f3316203370d9792092d3bbc08cb39b2f7cccc67bf088f0e0",
|
||||
"templates\/epubreader.php": "ce889687d8ef5f66a617fc329f3bf1ad69cc46362e90ebeab7b437500de05d9742fda2e4e3adf4aaadc004255bf48988b38c6c43c6072ab6a9f1f38e05a39d13",
|
||||
"templates\/pdfreader.php": "c53cfcc0edb8b269dbf8d2cf5d9291ac5fa00cbed52a3ce5413464ba8d72bd43c75b0753cd03cb8c4f685fe72399aa0f4146b43256895ccfc4731a38d7b34d1e",
|
||||
"lib\/config.php": "f9f15e0cddfea124ce2f094034dba422b4a6c45395ea23512dfa0949d4fac94c2adff6e7fbeacab15fa978522f2f2c903b0c80fd3fa5d0301f130908290c1574",
|
||||
"personal.php": "915e052965637473534087919049f7d7c57d33142aac102dd93d78efde546aad4208f781bc879088f7896f3c6457b1e63f919c7348920c237adba1fa0553d3f5",
|
||||
"templates\/cbreader.php": "7ab62f3620c7e389aba6912b0729bbd0cb630aba1e5cbff4887497be3d51f9d8f35eeb748bb69684b65a8658a608a3f72353aa2212a92ad09664e9a87e2369ea",
|
||||
"templates\/epubreader.php": "dea28a9329414876f2660bff99d8f694c78967498991600e88054c1f11b285e8c1235cc472b5fbe1ea95c80a142cbc2373a10102776124d19361beff1ed4431b",
|
||||
"templates\/pdfreader.php": "16726d4eba75d85839e1c09a8842fba07869d1666a33d95511ed718727aed38de11004b017b878b0bbc5a9481e01454121bb24ddf4b1497022939fc575aa1af4",
|
||||
"templates\/settings-personal.php": "f51394ed8fb4fda3bc75d10381f7ed7d04aa05a0555a82a80fd10a7d3b8264290e5a678a4d689fafc09e5aeacc29ebd19aec46544d3912bfa0680fa8c1b02152",
|
||||
"vendor\/bartaz\/jquery.highlight.js": "2071d929cf62d8ef6cb85df2bef1d556d21c06fd23233e4938e8ba43df794ebb167b7ef75a50c10f01c9c59af76ae4278f5d254d1b0dcfca1a7201c35cfe2e33",
|
||||
"vendor\/bgrins\/spectrum.css": "0d51df46221e84245609bf96f64fcf3aafdb9d2588a14e94382e78e605763bca1fd652adbfdacfce2324ea2d264baa3f1922a628e8c6ff55d4cc221ddbe05c15",
|
||||
"vendor\/bgrins\/spectrum.js": "a7e0d8302e03348effecea4cad9cb59ed861d5268552d4829af68b4d77f2022ddb46817b5a419e57f17c19e8eae48d43ae6ba858258c71f9bd658930b4484b21",
|
||||
|
@ -79,23 +86,21 @@
|
|||
"vendor\/icomoon\/fonts\/icomoon.woff": "44a9098f464bf9e80000b2cf89096f2b07ee046127ce5c11005a31ebbfafd7475e56de7eebe96ad9cee7cba4da96df0a7fa6c816b17310bbde38f07fd40034d6",
|
||||
"vendor\/icomoon\/style.css": "e949b8af266b96651ff40bed393a8f61f4d037b56ab9751a40845dc05f59103d58cffbe444038e8dcdf726e7da007e55c28b196fcab36148388e756174b71bad",
|
||||
"vendor\/jquery\/put-delete.js": "2447c4937da33d0d8d567405db3e3bb43faca00576622edb65ddb592c4545a4bbc3259ea2e0f5f71ff425db4a33e0359250ee13718a6e80f3da97bdae7960afb",
|
||||
"vendor\/pdfjs\/controllers\/.bookmarks_controller.js.swp": "e78a4b3db303865181e839f0999b1df715d786ba4f9678599e6c37c4754ae1dae22433f1fb1a8bad3e9f618fe0351249a9509d197e8413aa4695b24a342dd11e",
|
||||
"vendor\/pdfjs\/controllers\/.progress_controller.js.swp": "68ef1ef094fc94d91d027a9fb86d1424141b576e11b26309b4dabf466a5a1dc3206e8551b29d7cd96dc2d01e2f90266d44c121c8762352a41a22fb2cb3484d0f",
|
||||
"vendor\/pdfjs\/controllers\/annotationlayer_controller.js": "8cecf74b113e7738e1168000bc27dc30ad707b7768bb668b4dd3a0ff754e823681472894ba79a6438135e2ff49e31aca35e86a848065023313622df6ac7f1fbb",
|
||||
"vendor\/pdfjs\/controllers\/bookmarks_controller.js": "032e088c4f11cf053053845f6ed6fc72fc20a851d0aa52e202e64635b257c59f7e5225a523178779ad03c7ba04cfdf0a201e23b2a577f1c0cfae8b97d2695256",
|
||||
"vendor\/pdfjs\/controllers\/controls_controller.js": "d71fc989eb49ba6ebe6a61c562c42845d3a2d325770e09d66be4353945871fbbe9163df7dd3e47c713657c79918cb51518fc8131d4eae2a99b2d4ada24be7fb5",
|
||||
"vendor\/pdfjs\/controllers\/bookmarks_controller.js": "cfb16b41285c6346eb5d76995060e505b035f5b8d50412f0dc7feb6f2f1c598144e98a5c14e451ed1515a45880ac8a75c5faf5437d8f4bd6699234e56b392d8a",
|
||||
"vendor\/pdfjs\/controllers\/controls_controller.js": "b4925b842f4ab451cba7e43fb823aa1caa294913dfa6edd4a480753929d61d7165102978ef47fd6f05b4d8a011858b354f0c0a993b982a396824904145124905",
|
||||
"vendor\/pdfjs\/controllers\/meta_controller.js": "fdf4620f401e0ad27da9e3d91aa18e91d7666623cbe598bc1c92127e2fff0c25f9c089767e0ad5ca1ece5a621b8916a61a60b10e0a2bef76a4bf013343bc0dc6",
|
||||
"vendor\/pdfjs\/controllers\/notes_controller.js": "19ddefe3dda1774931209bd2ff7080912fee9015eaaa25cc786a9c02de85692a4190fc68a2840c3da836d31ff20e377e4dbbd0a699f73cd366aaae1973294985",
|
||||
"vendor\/pdfjs\/controllers\/notes_controller.js": "ba7793f50953857ecc4fb10a7848134c0e23922cc3783360c9af87834dc34729ba04c6c6af4a69417261d31c345ab1add2c99afb6d4fbd61e6e8c91427404d46",
|
||||
"vendor\/pdfjs\/controllers\/outline_controller.js": "c69fe71b155920cbf4825834cc7c7f6c91fbcbcabae4c892cf0b2d4a636db8faf9c25e54d58029544a12bfb631d1f4c74d9d7e1ed35cf10cd862a495efc1d891",
|
||||
"vendor\/pdfjs\/controllers\/progress_controller.js": "9894b73c39a3b500fc057472a7ec01e876bdd6e6d8d87dce12a46698a9847aaad576294e05fb9a33d649659a00549b67921d66c04216101c61d1c75db0f8e828",
|
||||
"vendor\/pdfjs\/controllers\/reader_controller.js": "2e95d778a13b3dc950762d57bc5cb0c503f1c4971ce0c332678b8283527f3fb075be099e0e7bd5471e52a3b868fd7d74af8b5c3160e9a2283f48b5d19fa64fda",
|
||||
"vendor\/pdfjs\/controllers\/reader_controller.js": "d485fa07171bf2d84771008d5cd8c6284d3d870e7e3d72bb7a01e817db31bd6a96b5223bc314416cfd78d62b92039f92d22e03073c12ee7a8f0ba442df6f03c3",
|
||||
"vendor\/pdfjs\/controllers\/search_controller.js": "d44a327561e9fb67e535be4fcc307d309f4aea0ee16be23057ed0f41692de01a1cf69d3f7bc2b30b26a7bdf776df5d56ff9ee26cce94f37b5cd27d4e14d5a93d",
|
||||
"vendor\/pdfjs\/controllers\/settings_controller.js": "e3cb86fe990bb69f4c1f553ccb30b619afb34123b3062882e66a0b9aafce15e88cc803d3a15852e2e2fa7ba6f0f4ab866044d09834f5e4365e71443a23c6dbc0",
|
||||
"vendor\/pdfjs\/controllers\/settings_controller.js": "07f8288df9071afbb2f8ff6f4f505a254bd9383d6f9a57f1e06d00da98aadd321cf4563f421c0b7e214a4dda26865f0376ace14b3ad88d34aa8aaef93eceb735",
|
||||
"vendor\/pdfjs\/controllers\/sidebar_controller.js": "3071f59c01d6088c21f92ef36f7c6b15024ba3dea7bc005dc1921b14c9c1c6320f7eecd158e974f9b8592dacc488ef79fc38d4925978557b09fc12815a5b86b0",
|
||||
"vendor\/pdfjs\/controllers\/styles_controller.js": "3a8817046dfae4dd166ffb337a6f06ab6ee9df2e60b45091f6b15176df03479a66379739ebabf5e61e2a0e7ac1dce4e107324e15216adef0e33329bf3747f241",
|
||||
"vendor\/pdfjs\/controllers\/styles_controller.js": "9abaec5302ca07fe45eb99f8cf23a4b6e820f9153a66763e49a1d83a092ddb719e2899c888c38d9152ecc50eeade045041ec16d9d9ee991a37eba8a2f23c4303",
|
||||
"vendor\/pdfjs\/controllers\/textlayer_controller.js": "ca23b356a61328cc1400fdad6b8fd52c04347187c385737f650680b326326d60816d921dd191a04e09abdf00669bd6ac2ca2140ab803986079c4e8d74df51c0f",
|
||||
"vendor\/pdfjs\/controllers\/textlayer_controller.js.simple": "05f346ebf5ba57f8de6f47a5e13da6defdd0774b4e546101f4b5be1ee7b2e7848bd5b8d6c08e4ed1c7e5d3f4dfa36ec4682b7e9062adfba3ca4cfe9ded51643c",
|
||||
"vendor\/pdfjs\/controllers\/toc_controller.js": "5fa9d62693e9f285450571c248084f236ed9bb75f5ed972864e35448c9bd1fcc51956e76be62349630365d915064c8de95f55e30ac6866114285f8b3313113e4",
|
||||
"vendor\/pdfjs\/controllers\/toc_controller.js": "acabaf107bd8058089225b9b3f53907d96666f726cde73bd912790ef6997b13dc35f7fa2695f67923ce2279fa9e931f23eb5f684573131a3d4da4a2ca137db5f",
|
||||
"vendor\/pdfjs\/css\/annotation_layer_builder.css": "b01d778e71769bfbd9f494e3e992f9b4d1762851e10b0977b5f50285dfda011ac27ace43b10c32431997432859f8458dc04aeda1cb08429fd16141157681708c",
|
||||
"vendor\/pdfjs\/css\/annotations.css": "9600da17ca67c7372bae1bd951cc933de1d8ccf8c4c43f2a7b6bea71117141dc355935f693f8e3be9d3f87c027b3221d54085c6125a24d0edc65ffe985855780",
|
||||
"vendor\/pdfjs\/css\/idevice.css": "57f16116dac978222fc6ecc989b1bd97e5b21b783824d8b5108761a8e2ed3e7cd31fdb587f947bb86037af0a7b258b74458eae04f13508cf61b59bddc40e4c83",
|
||||
|
@ -108,7 +113,7 @@
|
|||
"vendor\/pdfjs\/css\/images\/annotation-noicon.svg": "b74f7a79dc719acab1f351ac70f00455654dda140d2bc24eac6d48c804bf24ef5938c7d85073004e20b0b3c52f1c38f598f811e068e5b9092e11085d468af0ed",
|
||||
"vendor\/pdfjs\/css\/images\/annotation-note.svg": "566be95c1dda2d5a52ffe0a6899f5058c547f91fcdc60dbe26a79b39fe427a79802d6d52eacb711acfee368318f7b0d54dc9067d88962306d4b0d4ed65d651e4",
|
||||
"vendor\/pdfjs\/css\/images\/annotation-paragraph.svg": "f016ff103e8de8e6cf19aee5e7b627ccce075844e41395cfa20342a0b42a13dce82106e4b06bbb1d7e7c135b0dfb8fba0ab3b0703f40afb9625048076ea3558e",
|
||||
"vendor\/pdfjs\/css\/main.css": "4ddc495360dde690d76b9efbd0c7fbe1bf1d1be84057cb607333d6dcd89eedfaa7de73413b13b670f5d310d80069b6886bfb0b216eaee1149b1fe3d16cd7d13a",
|
||||
"vendor\/pdfjs\/css\/main.css": "1da78c281eddc61935ca89f905f5ba6f2943722e11ce9dd09a7a3005a0f733a8cd643f30669507cf5d830cda217b14de3a9201e4e246c70973fc916a2a2a3c35",
|
||||
"vendor\/pdfjs\/css\/normalize.css": "2640cf3ac3153b95939d2c6d1b6903d24a906d7737d48f79cda4e0e6bb41098c18b0d345deb1ce41d5d27f734d92b558c8f857e9909eec23bf8147abbd4a0fd7",
|
||||
"vendor\/pdfjs\/css\/popup.css": "d44a1a4647f2216ca0698300d9e462b6e5a57b19a68c93642a46bdc7681caad89888c1adbbf4e5322a6789d81dc00ab102001fcd761187f87ff330d5fde428fa",
|
||||
"vendor\/pdfjs\/css\/sidebar.css": "aa4aa85bcc4e4ec3c40fccf59c671802ce1fa3eb49bb0c048d9a20361d56f0d0b24602ce17fb6cce4433b982147a565ef7b2922a7a88e8edbc636a47ed8d492f",
|
||||
|
@ -116,7 +121,7 @@
|
|||
"vendor\/pdfjs\/lib\/pdf.js": "2d7241061e30e69963a78c64345ecbb889b831ec72cdccdb07d0e684c9cf907bcf45e3781b91e51c1ca4258e796eed0a69d83e8945ccd98ace75cd57ca57d5a0",
|
||||
"vendor\/pdfjs\/lib\/pdf.worker.js": "03cd966b7b23dabebbc1652e19f2511c41237d8cafcc8fef655b6424c1b5884e48fa3ea052d1ebafe3c6be096c0c6aec1c9cbad45115912a4a75eb886c591534",
|
||||
"vendor\/pdfjs\/lib\/text_layer_builder.js": "f56f1d3b1a61a2b5ba4945a60057604d95a3595f2dec4e5c99b79db10f3b00a0e6be30169383fccda3a64aadda3f607f650ac261c47bbea7f0f6a3196b645f28",
|
||||
"vendor\/pdfjs\/pdf.reader.js": "5d68a51aac6a3750a9264cfd97517eab9772dfd93c7e372f309095559410536176d583357c6342cb8933bb86d8f2ed9c41ff2824c575ef471da6de03a49e4631",
|
||||
"vendor\/pdfjs\/pdf.reader.js": "4c3cc3bc3f5b796ff3f9691a505fd051f768e359e4d2a9dea7725e7cede15e529c8a99760c9d1b9bdd199bc215d3db6861253ca50df75fcebf5437dce064df65",
|
||||
"vendor\/pdfjs\/services\/eventbus_service.js": "851b741ec0eb06a7298664d626e648613f86d3958f4c7045cadaafb5c146088952ce584d5a4079ea51b54f07fc0cb2e9a9ddfefe52a70b2162c083b10b6293bc",
|
||||
"vendor\/pdfjs\/services\/link_service.js": "b227d4163e2fcb3db4ed0ee2dd9f0af59dd263bc05153139d9588dd536071ca6d6430be214795f440061bcce6c6685986b5b002e4c9af7d0e2268ed83fe43424",
|
||||
"vendor\/pdfjs\/services\/simple_link_service.js": "ffaa00f383100c5c689da1f8bfbe3baa06fc42147acfa781356eb67958cc6fbf2c34d8f448afa7f5bb14a5132c43fb78b3ad6a469f2af32ac0e29c93aa7f7ac3",
|
||||
|
@ -127,6 +132,6 @@
|
|||
"vendor\/pixastic\/pixastic_combined.js": "a69bff7c76e6cdce7de3184184114e10f2ddcb369a2de03b1986c9a74d71f67f038d452d60df4a638e12420314bdc5c052a791a98d22ae5347a5f43bffd8b2f2",
|
||||
"vendor\/sindresorhus\/screenfull.js": "29d23b28b76827f037265ce60ef5cf76c0d560c7aece03593021feae9f6220c3170abf5a8b5f380885fe15e9204425fb5446fef61c3b0ca83d6f332eb1bd1571"
|
||||
},
|
||||
"signature": "rMVMYfVxZqTBw\/bMLGDFQ6Fq1LWsVUjZfaXk8NqTo8N5cNTljTGJcaVg3JB1y5BN5DwVnCltcS6tSc0MC66swH5XjN4IHIY8vyJaAtH0DS8g4myvtHjzJy8bytsr7jHsfZ537kH2LwKBAQrI0kezQ7wyZ1n\/fw1e+pGE+J6NmhCx+B\/vEL+pwohED8UvV99pL6zN5gVJBbYtBB9I5E8JVGQNBBQcMNSRMopYZMvLWUFtep6gC1tEuhqdq+PJ6jxqJHm7KpVFeH\/PghiqtOjaGBQ9c7UmQ4Fo1VeFDJ8k8EqJXH7FLX7tD6jQ6bSWFoxCp8Cgk0cRcCKEdXUvBrL0cvig3GlyaE7vna7pWI39A5EuBy8Bhbjv3wwJtxdeQEJLP5izTaPMhErIfMhva8YFyFlDSxJu6WfMhZEIIqxCCHO5641k4LfO4OczkjYL7NNT09Pb\/G4WoLfzlRc1cUQ+OJ3vatzrehT5ZxxfUb\/SCziL11L6n2NxKPu4jw5E3xB3BDjAu\/NkcA6RmrXqkaIIuyeraFWoG891DSMBg8b5zABTlzNp0ZvedZhVM7L+ApthE\/eu4qzRH45VA5m3xSsr9aKWmUS6yM6AN3YfJ1+FgBXBl975UZMO+we0kZCrYGvT\/XAuuwyRBE5PoekRi6anNaTQREN+WhfrG+xxOYJDSHM=",
|
||||
"signature": "zy6afzqSQYt3M1uXnIJFHBsW3qu7tGs5BpXtrxmCECu39QT3CHJSu++kJsCrykeF1jwBjeRZmC7WNnT+SmopfkoyGcxORguF30fwD76ErDvvIUxV8DYRx0mnrMKmyANr88K9iib8a+EemVK0mG50HtJdQ4USWVKjbwlepxPLFeqFptEwE7oIsDg2k5XNnI1GRySGRNtawRv7cSOgOnEQHGGFZYOCe5rNEEJnzqWkcLZ\/XzQ6QJzmBncqM6pVtiVr4srcB6OM\/YGNgdn+pXQj2C24oWDoiEG1Ecq6WtYgqB2Andz05EPrkVTdeMOsis9O3THvNa4QslbutoMld8AXvT1n+KdwS77gXkabs4g4F1tPs\/WJ3pFFLh82jfsk8un0RaLC1EVBvzDboc4A1+U3BJ49glgbq0dAgYgVy7xuHfc5FqD\/AOtQoqSV7rnnxLzdW+CSaV7XbsUQINWdlnxDiKISYnAtJm9CYa2LqZlsjBiLXncxVZ9CVq4CC4s3Y3EYuyAvWk96Ub+p2HhOeS8YKo96xR5vHbHo\/xxZZydpZJ0IUaN7mnyn1FLn\/Mp1c1erS6RPfcnf23E4F9cPni2QAwYhe8XtCTPSlAaXMSMsCgJWwBrRLa9Se4DvIPX9W5xqJV+wVJ\/iS5omEusrSXXQBq6kx04rFFCrtdtxsa6B59k=",
|
||||
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIE+TCCAuECAhBPMA0GCSqGSIb3DQEBCwUAMG0xCzAJBgNVBAYTAlVTMQ8wDQYD\r\nVQQIDAZCb3N0b24xFjAUBgNVBAoMDW93bkNsb3VkIEluYy4xNTAzBgNVBAMMLG93\r\nbkNsb3VkIENvZGUgU2lnbmluZyBJbnRlcm1lZGlhdGUgQXV0aG9yaXR5MB4XDTE4\r\nMDExODIxMzMyNFoXDTI4MDExNjIxMzMyNFowFzEVMBMGA1UEAwwMZmlsZXNfcmVh\r\nZGVyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2Dro3KQnJEnKeJVG\r\nnhKvrQSzLNyphcF5UNj4j3Km6wLcb86RkWtq6uX5eR6g0HI9NFZF3qxBLUGN8bpM\r\ngGyalTLwj5IsDYO\/naSZe\/wXNCBl82vZq+jjnDCYll7r2yNjTFVzRtH+o9AIQlmM\r\npt8+PCcw8n8QqlXUIq9A3kb8wggczEZnw6bCudDLQWXHYKD5\/tn7n06h9fA4VxfB\r\nQMyuv8hIjKEQqun3Qqvi3DfaR52sbeDvv9bGACxWqjiE3P6sZvL7MlDqJ5KeqWoM\r\n4qPGkgDusTtXuO7h3ro2H4NMydWXcrbUAPTXcAPo2jzTfhV8m9xQDc+45VlONjIp\r\nTFwV1oF53hnu81TlNniz1RTbDYMkExvPYtobNjNIR+VsOQs8Gq9iEDEIxyqCm2it\r\ncuMjeFhYr1rjyeS21i6cNtD\/kMxSFwKnluQPrb49pK6g2Nq5Go1iP8WgT12hAQhr\r\ni7wwH32bLe11xnD53ko6pAzhqmciaSHLxkZCm+eyTNwJzQa0uQ+gAD8gJ7bVQUxg\r\nPSjm1amfhMAzsHIraMFqzlz7IWjWA7vJGkR9DcweYBXsyt6ZloLekPsNxEKnuh3F\r\ngjBHEoy7iPLmDxGvTfPW76r6vBwBF9JgIrhJzRMtTHTsYX9olblQr957SLyiZaqJ\r\n\/kKCQZ3cKPhWBh1KydMjPlXbGFUCAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAcYdp\r\ntoKFBZV7rswQ9yL6Y8F\/\/VUM1J1jincG3soCz5\/n5rL0TDekS0FI8eNWX0tay0ne\r\n3\/FZ93\/fb+gkQf7KutU\/9EWZwnc90XNq+Q3\/3DWz+nIm3EFttz6GioVYz7XEAx3A\r\nSMWeWY05ei9V7SVSnqglhouhLENrKKI8ilzGI\/pEtCs3RUv3xi7GPBdCDnvqqeXy\r\nRHrP7ZFe3v1go84v1MwQOt4\/OtaYk\/4HU51oxzUI8yDMNtLNmZm7gqLbT9bRsWCz\r\n5gqFa15K4X7sVL\/ECI72zEDZsF0RtmTCp9fJLoYXIPPQ1CACi0K0hB\/ssE6BC9Zl\r\naUXcbZ2BLwvQiZmEUhyyr0WYK4D\/dE4LbYqYpDDGRhXpf4cRhQahsYL8aMzZtZfl\r\nNDE4PN\/4sV6id6MnwrtDmsW3frMlkhzrsm8ftzwkbIyJD1Io5OAOJn6oxN2sjlWD\r\ngof0tuweAlTGuAI7\/CUA2yMZb45MFkLWDExzZsiVy9UtU641cDzOxAbg7UIeTBRZ\r\nYUdl5ci1f8299Yridc4n70yQg2GHwa8YJ6p42f93sTOo0E1UAX1+eBmuAmc\/eBq0\r\nFjjmMyPZy7EhElAUa2sqw5QS2\/AK34P0rccCaJerRJ0mU54neL5qSEuuPQnVcn\/\/\r\n3LGndYF8t5kHI3iXV3TJ2vyagUkWeDl6z9pyW0Y=\r\n-----END CERTIFICATE-----"
|
||||
}
|
3
files_reader/css/settings.css
Normal file
3
files_reader/css/settings.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
.nav-icon-reader {
|
||||
background-image: url('../img/app.svg?v=2');
|
||||
}
|
|
@ -5,39 +5,13 @@
|
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="svg5261"
|
||||
version="1.1"
|
||||
id="svg4096"
|
||||
viewBox="0 0 32 32"
|
||||
height="32"
|
||||
width="32"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="app.svg">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="798"
|
||||
inkscape:window-height="1186"
|
||||
id="namedview7"
|
||||
showgrid="false"
|
||||
inkscape:zoom="20.5625"
|
||||
inkscape:cx="16"
|
||||
inkscape:cy="16"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="12"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg4096" />
|
||||
<defs
|
||||
id="defs4098" />
|
||||
height="32">
|
||||
<metadata
|
||||
id="metadata4101">
|
||||
id="metadata5267">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
|
@ -48,29 +22,29 @@
|
|||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs5265" />
|
||||
<g
|
||||
transform="translate(0,-1020.3622)"
|
||||
style="fill:#060000;fill-opacity:1"
|
||||
id="layer1"
|
||||
style="fill:#ffffff">
|
||||
transform="translate(1.4457782,-1020.2752)">
|
||||
<path
|
||||
style="fill:#ffffff"
|
||||
d="m 11.168042,1021.5246 c -2.2036689,-1.0138 -6.5467059,0.9451 -7.7942059,2.6697 -0.555819,0.7717 -0.516525,1.3278 -0.516525,1.6433 v 16.8796 l 16.2867569,8.8577 3.062736,-1.4617 v -16.4387 l -16.7222168,-8.3914 c 0.897356,-0.9871 2.9155749,-2.1908 4.4288007,-1.7074 l 14.8949581,6.9633 v 18.3129 l 3.070508,-1.4642 v -18.3122 z"
|
||||
id="path2989"
|
||||
d="m 11.168042,1021.5246 c -2.2036689,-1.0138 -6.5467059,0.9451 -7.7942059,2.6697 -0.555819,0.7717 -0.516525,1.3278 -0.516525,1.6433 l 0,16.8796 16.2867569,8.8577 3.062736,-1.4617 0,-16.4387 -16.7222168,-8.3914 c 0.897356,-0.9871 2.9155749,-2.1908 4.4288007,-1.7074 l 14.8949581,6.9633 0,18.3129 3.070508,-1.4642 0,-18.3122 z" />
|
||||
style="fill:#060000;fill-opacity:1" />
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="4.7659574"
|
||||
y="11.6231"
|
||||
id="text3335"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3337"
|
||||
x="4.7659574"
|
||||
y="11.6231"></tspan></text>
|
||||
y="11.710122"
|
||||
x="6.2117367"
|
||||
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-size:40px;line-height:1.25"
|
||||
y="11.710122"
|
||||
x="6.2117367"
|
||||
id="tspan3337"> </tspan></text>
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 10.49012,22.464615 -3.7773658,-6.800426 4.5440898,-2.201163 1.259258,2.266597 -3.0296238,1.467379 1.2591488,2.266823 4.54409,-2.201162 -3.290553,-5.923647 C 11.730489,10.855032 11.250429,10.589741 10.926916,10.74647 l -6.4023569,3.101677 c -0.3232373,0.156596 -0.3674685,0.675885 -0.098794,1.159868 l 5.322202,9.580704 c 0.2689279,0.484123 0.7489899,0.749415 1.0722499,0.592546 l 6.402424,-3.10145 c 0.32326,-0.156869 0.367492,-0.676158 0.09879,-1.159868 l -0.772645,-1.390597 -6.05867,2.935265 z"
|
||||
style="fill:#fcfcfc;fill-opacity:1"
|
||||
id="path4015-6"
|
||||
style="fill:#000000" />
|
||||
d="m 11.935898,22.551661 -3.7773648,-6.800426 4.5440888,-2.201163 1.259258,2.266597 -3.029623,1.467379 1.259148,2.266823 4.544091,-2.201162 -3.290554,-5.923647 c -0.268675,-0.483984 -0.748735,-0.749275 -1.072248,-0.592546 l -6.4023558,3.101677 c -0.323238,0.156596 -0.367469,0.675885 -0.09879,1.159868 l 5.3222018,9.580704 c 0.268927,0.484123 0.748989,0.749415 1.072249,0.592546 l 6.402425,-3.10145 c 0.32326,-0.156869 0.367492,-0.676158 0.09879,-1.159868 l -0.772645,-1.390597 z" />
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 2.2 KiB |
22
files_reader/js/personal.js
Normal file
22
files_reader/js/personal.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
$(document).ready(function(){
|
||||
// save settings
|
||||
var readerSettings = {
|
||||
save : function() {
|
||||
var data = {
|
||||
EpubEnable: document.getElementById('EpubEnable').checked ? 'true' : 'false',
|
||||
PdfEnable: document.getElementById('PdfEnable').checked ? 'true' : 'false',
|
||||
CbxEnable: document.getElementById('CbxEnable').checked ? 'true' : 'false'
|
||||
};
|
||||
|
||||
OC.msg.startSaving('#reader-personal .msg');
|
||||
$.post(OC.filePath('files_reader', 'lib', 'personal-back.php'), data, readerSettings.afterSave);
|
||||
},
|
||||
afterSave : function(data){
|
||||
OC.msg.finishedSaving('#reader-personal .msg', data);
|
||||
}
|
||||
};
|
||||
$('#EpubEnable').on("change", readerSettings.save);
|
||||
$('#PdfEnable').on("change", readerSettings.save);
|
||||
$('#CbxEnable').on("change", readerSettings.save);
|
||||
});
|
||||
|
|
@ -133,8 +133,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
if (oc_appconfig.filesReader.enableEpub === 'true')
|
||||
fileActions.setDefault('application/epub+zip', 'view-epub');
|
||||
if (oc_appconfig.filesReader.enableCbr === 'true')
|
||||
fileActions.setDefault('application/x-cbr', 'view-cbr');
|
||||
if (oc_appconfig.filesReader.enablePdf === 'true')
|
||||
fileActions.setDefault('application/pdf', 'view-pdf');
|
||||
}
|
||||
};
|
||||
|
|
22
files_reader/js/settings.js
Normal file
22
files_reader/js/settings.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
$(document).ready(function(){
|
||||
// save settings
|
||||
var readerSettings = {
|
||||
save : function() {
|
||||
var data = {
|
||||
EpubEnable: document.getElementById('EpubEnable').checked ? 'true' : 'false',
|
||||
PdfEnable: document.getElementById('PdfEnable').checked ? 'true' : 'false',
|
||||
CbxEnable: document.getElementById('CbxEnable').checked ? 'true' : 'false'
|
||||
};
|
||||
|
||||
OC.msg.startSaving('#reader-personal .msg');
|
||||
$.post(OC.filePath('files_reader', 'ajax', 'personal.php'), data, readerSettings.afterSave);
|
||||
},
|
||||
afterSave : function(data){
|
||||
OC.msg.finishedSaving('#reader-personal .msg', data);
|
||||
}
|
||||
};
|
||||
$('#EpubEnable').on("change", readerSettings.save);
|
||||
$('#PdfEnable').on("change", readerSettings.save);
|
||||
$('#CbxEnable').on("change", readerSettings.save);
|
||||
});
|
||||
|
|
@ -13,11 +13,14 @@ namespace OCA\Files_Reader;
|
|||
use OCP\IDBConnection;
|
||||
use OCP\Files\Node;
|
||||
use OCP\IUser;
|
||||
use OCP\Util;
|
||||
use \OC\User\User as User;
|
||||
|
||||
class Hooks {
|
||||
|
||||
public static function register() {
|
||||
Util::connectHook('\OCP\Config', 'js', 'OCA\Files_Reader\Hooks', 'announce_settings');
|
||||
|
||||
\OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) {
|
||||
$fileId = $node->getId();
|
||||
$connection = \OC::$server->getDatabaseConnection();
|
||||
|
@ -30,6 +33,14 @@ class Hooks {
|
|||
});
|
||||
}
|
||||
|
||||
public static function announce_settings(array $settings) {
|
||||
$array = json_decode($settings['array']['oc_appconfig'], true);
|
||||
$array['filesReader']['enableEpub'] = Config::get('epub_enable', true);
|
||||
$array['filesReader']['enablePdf'] = Config::get('pdf_enable', true);
|
||||
$array['filesReader']['enableCbx'] = Config::get('cbx_enable', true);
|
||||
$settings['array']['oc_appconfig'] = json_encode($array);
|
||||
}
|
||||
|
||||
protected static function deleteFile(IDBConnection $connection, $fileId) {
|
||||
$queryBuilder = $connection->getQueryBuilder();
|
||||
$queryBuilder->delete('reader_bookmarks')->where('file_id = :file_id')->setParameter(':file_id', $fileId);
|
||||
|
|
63
files_reader/lib/config.php
Normal file
63
files_reader/lib/config.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Files_Reader App
|
||||
*
|
||||
* @author Frank de Lange
|
||||
* @copyright 2014,2018 Frank de Lange
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Files_Reader;
|
||||
|
||||
/**
|
||||
* Config class for Reader
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
* @brief get user config value
|
||||
*
|
||||
* @param string $key value to retrieve
|
||||
* @param string $default default value to use
|
||||
* @return string retrieved value or default
|
||||
*/
|
||||
public static function get($key, $default) {
|
||||
return \OCP\Config::getUserValue(\OCP\User::getUser(), 'files_reader', $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set user config value
|
||||
*
|
||||
* @param string $key key for value to change
|
||||
* @param string $value value to use
|
||||
* @return bool success
|
||||
*/
|
||||
public static function set($key, $value) {
|
||||
return \OCP\Config::setUserValue(\OCP\User::getUser(), 'files_reader', $key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get app config value
|
||||
*
|
||||
* @param string $key value to retrieve
|
||||
* @param string $default default value to use
|
||||
* @return string retrieved value or default
|
||||
*/
|
||||
public static function getApp($key, $default) {
|
||||
return \OCP\Config::getAppValue('files_reader', $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set app config value
|
||||
*
|
||||
* @param string $key key for value to change
|
||||
* @param string $value value to use
|
||||
* @return bool success
|
||||
*/
|
||||
public static function setApp($key, $value) {
|
||||
return \OCP\Config::setAppValue('files_reader', $key, $value);
|
||||
}
|
||||
}
|
25
files_reader/personal.php
Normal file
25
files_reader/personal.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - Files_Reader app
|
||||
*
|
||||
* Copyright (c) 2014,2018 Frank de Lange
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace OCA\Files_Reader;
|
||||
|
||||
use OCP\Util;
|
||||
|
||||
#$l = \OC::$server->getL10N('files_reader');
|
||||
|
||||
$tmpl = new \OCP\Template('files_reader', 'settings-personal');
|
||||
$EpubEnable = Config::get('epub_enable', true);
|
||||
$PdfEnable = Config::get('pdf_enable', true);
|
||||
$CbxEnable = Config::get('cbx_enable', true);
|
||||
$tmpl->assign('EpubEnable', $EpubEnable);
|
||||
$tmpl->assign('PdfEnable', $PdfEnable);
|
||||
$tmpl->assign('CbxEnable', $CbxEnable);
|
||||
|
||||
return $tmpl->fetchPage();
|
|
@ -13,7 +13,7 @@
|
|||
$metadata = $_['metadata'];
|
||||
$annotations = $_['annotations'];
|
||||
$title = htmlentities(basename($downloadLink));
|
||||
$revision = '0047';
|
||||
$revision = '0048';
|
||||
$version = \OCP\App::getAppVersion('files_reader') . '.' . $revision;
|
||||
|
||||
/* Mobile safari, the new IE6 */
|
||||
|
@ -32,7 +32,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<base href="<?php p($urlGenerator->linkTo('files_reader',''));?>">
|
||||
<!-- <base href="<?php p($urlGenerator->linkTo('files_reader',''));?>"> -->
|
||||
<title>
|
||||
<?php p($title);?>
|
||||
</title>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
$metadata = $_['metadata'];
|
||||
$annotations = $_['annotations'];
|
||||
$title = htmlentities(basename($downloadLink));
|
||||
$revision = '0071';
|
||||
$revision = '0072';
|
||||
$version = \OCP\App::getAppVersion('files_reader') . '.' . $revision;
|
||||
|
||||
/* Mobile safari, the new IE6 */
|
||||
|
@ -32,7 +32,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<base href="<?php p($urlGenerator->linkTo('files_reader',''));?>">
|
||||
<!-- <base href="<?php p($urlGenerator->linkTo('files_reader',''));?>"> -->
|
||||
<title>
|
||||
<?php p($title);?>
|
||||
</title>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
$metadata = $_['metadata'];
|
||||
$annotations = $_['annotations'];
|
||||
$title = htmlentities(basename($downloadLink));
|
||||
$revision = '0071';
|
||||
$revision = '0130';
|
||||
$version = \OCP\App::getAppVersion('files_reader') . '.' . $revision;
|
||||
|
||||
/* Mobile safari, the new IE6 */
|
||||
|
@ -32,9 +32,9 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<base href="<?php p($urlGenerator->linkTo('files_reader',''));?>">
|
||||
<!-- <base href="<?php p($urlGenerator->linkTo('files_reader',''));?>"> -->
|
||||
<title>
|
||||
<?php p($_['title']);?>
|
||||
<?php p($title);?>
|
||||
</title>
|
||||
<link rel="shortcut icon" href="img/book.png">
|
||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/icomoon/style.css')) ?>?v=<?php p($version) ?>">
|
||||
|
@ -63,6 +63,7 @@
|
|||
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/controllers/annotationlayer_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/controllers/notes_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/controllers/bookmarks_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/controllers/styles_controller.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||
<?php if ($idevice): ?>
|
||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/pdfjs/css/idevice.css')) ?>?v=<?php p($version) ?>">
|
||||
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/bgrins/spectrum.js')) ?>?v=<?php p($version) ?>"> </script>
|
||||
|
@ -91,11 +92,11 @@
|
|||
<div class="pull-left">
|
||||
<button id="show-Toc" class="show_view icon-dns open" title="Table of Contents" data-view="Toc"></button>
|
||||
<button id="show-Outline" class="show_view icon-format_list_numbered" title="Outline" data-view="Outline"></button>
|
||||
<!-- currently not used
|
||||
<button id="show-Notes" class="show_view icon-comment" title="Annotations" data-view="Notes"></button>
|
||||
-->
|
||||
<button id="show-Bookmarks" class="show_view icon-turned_in" title="Bookmarks" data-view="Bookmarks"></button>
|
||||
<button id="show-Search" class="show_view icon-search" title="Search" data-view="Search"></button>
|
||||
<!-- notes not implemented yet
|
||||
<button id="show-Notes" class="show_view icon-comment" title="Notes" data-view="Notes"></button>
|
||||
-->
|
||||
<button id="show-Settings" class="show_view icon-settings" title="Settings" data-view="Settings"></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
|
@ -112,6 +113,19 @@
|
|||
<ul id="outline" class="outline">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- currently not used
|
||||
<div id="notesView" class="notes-view view">
|
||||
<div>
|
||||
<div class="notes-input">
|
||||
<textarea id="note-text" class="note-text" placeholder="Write note, press 'marker' button and select position in text to link note."></textarea>
|
||||
<button id="note-anchor" class="note-anchor icon-room pull-right"></button>
|
||||
</div>
|
||||
<ol id="notes" class="notes">
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div id="bookmarksView" class="bookmarks-view view">
|
||||
<ul id="bookmarks" class="bookmarks">
|
||||
</ul>
|
||||
|
@ -127,61 +141,43 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- notes not implemented yet
|
||||
<div id="notesView" class="notes-view view">
|
||||
<div>
|
||||
<div class="notes-input">
|
||||
<textarea id="note-text" class="note-text" placeholder="Write note, press 'marker' button and select position in text to link note."></textarea>
|
||||
<button id="note-anchor" class="note-anchor icon-room pull-right"></button>
|
||||
</div>
|
||||
<ol id="notes" class="notes">
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div id="settingsView" class="settings-view view">
|
||||
<!-- font settings not implemented yet
|
||||
<fieldset class="settings-container" name="colour-settings">
|
||||
<legend>colors</legend>
|
||||
<fieldset>
|
||||
<legend>normal</legend>
|
||||
<div class="control-group">
|
||||
<input type="checkbox" id="use_custom_colors" name="use_custom_colors">
|
||||
<label for="use_custom_colors">
|
||||
Use custom colors
|
||||
</label>
|
||||
<div class="center-box">
|
||||
<input type="color" id="day_color" value="#0a0a0a">
|
||||
on
|
||||
<input type="color" id="day_background" value="#f0f0f0">
|
||||
</div>
|
||||
<div id="day_example" class="day font_example">
|
||||
<div>
|
||||
Et nos esse veri viri scire volemus
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>night</legend>
|
||||
<div class="control-group">
|
||||
<form id="nightmode_form">
|
||||
<div class="center-box nightshift">
|
||||
nightmode can be toggled by clicking the book title
|
||||
nightmode can be toggled by clicking the nightmode button
|
||||
</div>
|
||||
<div class="center-box">
|
||||
<input type="color" id="night_color" value="#454545">
|
||||
on
|
||||
<input type="color" id="night_background" value="#000000">
|
||||
<div class="control-group">
|
||||
<label title="adjust brightness">brightness</label>
|
||||
<input id="night_brightness" type="range" min="0" max="1" step="0.01" value="1">
|
||||
</div>
|
||||
<div id="night_example" class="night font_example">
|
||||
<div>
|
||||
Et nos esse veri viri scire volemus
|
||||
<div class="control-group">
|
||||
<label title="adjust contrast">constrast</label>
|
||||
<input id="night_contrast" type="range" min="0" max="2" step="0.01" value="1">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label title="adjust sepia">sepia</label>
|
||||
<input id="night_sepia" type="range" min="0" max="1" step="0.01" value="0">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label title="adjust hue">hue</label>
|
||||
<input id="night_huerotate" type="range" min="0" max="359" step="1" value="0">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label title="adjust saturation">saturation</label>
|
||||
<input id="night_saturate" type="range" min="0" max="5" step="0.01" value="1">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<input type="reset" id="nightmode_reset" name="nightmode_reset">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
-->
|
||||
<fieldset class="settings-container" name="display-settings">
|
||||
<legend>display</legend>
|
||||
<div class="control-group">
|
||||
|
@ -196,6 +192,12 @@
|
|||
show page turn arrows
|
||||
</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<input type="checkbox" id="scrollToTop" name="scrollToTop">
|
||||
<label for="scrollToTop">
|
||||
scroll to top of page on page turn
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@ -218,7 +220,7 @@
|
|||
<div id="status_message_left">
|
||||
</div>
|
||||
</div>
|
||||
<div id="metainfo" class="nightshift">
|
||||
<div id="metainfo">
|
||||
<span id="book-title">
|
||||
</span>
|
||||
<span id="title-separator">
|
||||
|
@ -236,6 +238,9 @@
|
|||
</div>
|
||||
<div id="match_count">
|
||||
</div>
|
||||
<div id="nightmode" class="icon-brightness_low2 nightshift">
|
||||
</div>
|
||||
<span class="controls-separator"> </span>
|
||||
<!-- select works fine, except for the fact that - as usual - apple mobile acts up... -->
|
||||
<div id="zoom_options" class="hide">
|
||||
<div class="zoom_option icon-double_page_mode" data-value="spread" data-class="icon-double_page_mode" data-text=""></div>
|
||||
|
|
42
files_reader/templates/settings-personal.php
Normal file
42
files_reader/templates/settings-personal.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Frank de Lange
|
||||
* @copyright 2018 Frank de Lange
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
script('files_reader', 'settings');
|
||||
style('files_reader', 'settings');
|
||||
|
||||
?>
|
||||
|
||||
<div id="reader-personal" class="section">
|
||||
<table><tr><td><h2><?php p($l->t('Reader'));?></h2></td><td> <span class="msg"></span></td></tr></table>
|
||||
<p class="settings-hint"><?php p($l->t('Select file types for which Reader should be the default viewer.')); ?></p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="EpubEnable" id="EpubEnable" class="checkbox"
|
||||
value="1" <?php if ($_['EpubEnable'] === "true") print_unescaped('checked="checked"'); ?> />
|
||||
<label for="EpubEnable">
|
||||
<?php p($l->t('Epub'));?>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="PdfEnable" id="PdfEnable" class="checkbox"
|
||||
value="1" <?php if ($_['PdfEnable'] === "true") print_unescaped('checked="checked"'); ?> />
|
||||
<label for="PdfEnable">
|
||||
<?php p($l->t('PDF'));?>
|
||||
</label><br/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="CbxEnable" id="CbxEnable" class="checkbox"
|
||||
value="1" <?php if ($_['CbxEnable'] === "true") print_unescaped('checked="checked"'); ?> />
|
||||
<label for="CbxEnable">
|
||||
<?php p($l->t('CBR/CBZ'));?>
|
||||
</label><br/>
|
||||
</p>
|
||||
</div>
|
Binary file not shown.
Binary file not shown.
|
@ -19,56 +19,46 @@ PDFJS.reader.BookmarksController = function() {
|
|||
|
||||
var addBookmarkItem = function (bookmark) {
|
||||
$list.append(reader.NotesController.createItem(bookmark));
|
||||
reader.settings.session.setBookmark(bookmark.id, bookmark.anchor, bookmark.type, bookmark);
|
||||
//reader.settings.session.setBookmark(bookmark.id, bookmark.anchor, bookmark.type, bookmark);
|
||||
};
|
||||
|
||||
var addBookmark = function (pageNum) {
|
||||
var bookmark = new reader.Annotation(
|
||||
"bookmark",
|
||||
pageNum,
|
||||
null,
|
||||
pageToId(pageNum)
|
||||
);
|
||||
eventBus.on('bookmarkcreated', function createBookmark1(e) {
|
||||
var id = e.id,
|
||||
$item = $("#"+id);
|
||||
|
||||
addBookmarkItem(bookmark);
|
||||
};
|
||||
addBookmarkItem(reader.getAnnotation(id));
|
||||
|
||||
var removeBookmark = function (pageNum) {
|
||||
var id = pageToId(pageNum);
|
||||
console.log("ID", id);
|
||||
|
||||
if (isBookmarked(id)) {
|
||||
delete reader.settings.annotations[id];
|
||||
reader.settings.session.deleteBookmark(id);
|
||||
if (id === pageToId(reader.settings.currentPage)) {
|
||||
if (id === reader.pageToId(reader.settings.currentPage))
|
||||
$bookmark
|
||||
.removeClass("icon-turned_in")
|
||||
.addClass("icon-turned_in_not");
|
||||
}
|
||||
}
|
||||
};
|
||||
.addClass("icon-turned_in")
|
||||
.removeClass("icon-turned_in_not");
|
||||
});
|
||||
|
||||
eventBus.on('bookmarkremoved', function removeBookmark1(e) {
|
||||
var id = e.id,
|
||||
$item = $("#"+id);
|
||||
|
||||
console.log($item);
|
||||
|
||||
console.log("event bookmarkremoved caught:",e,id);
|
||||
|
||||
if (reader.isBookmarked(id)) {
|
||||
//delete reader.settings.annotations[id];
|
||||
//reader.settings.session.deleteBookmark(id);
|
||||
console.log("removing bookmark ", $item, reader.pageToId(reader.settings.currentPage), id);
|
||||
|
||||
$item.remove();
|
||||
$item.remove();
|
||||
$item.remove();
|
||||
$item.remove();
|
||||
|
||||
if (id === pageToId(reader.settings.currentPage)) {
|
||||
if (id === reader.pageToId(reader.settings.currentPage))
|
||||
$bookmark
|
||||
.removeClass("icon-turned_in")
|
||||
.addClass("icon-turned_in_not");
|
||||
}
|
||||
});
|
||||
|
||||
var pageToId = function (pageNum) {
|
||||
return "page_" + pageNum;
|
||||
};
|
||||
|
||||
var isBookmarked = function (pageNum) {
|
||||
return (reader.settings.annotations[pageToId(pageNum)] !== undefined);
|
||||
};
|
||||
|
||||
for (var bookmark in annotations) {
|
||||
if (annotations.hasOwnProperty(bookmark) && (annotations[bookmark].type === "bookmark"))
|
||||
addBookmarkItem(annotations[bookmark]);
|
||||
|
@ -78,9 +68,5 @@ PDFJS.reader.BookmarksController = function() {
|
|||
"show" : show,
|
||||
"hide" : hide,
|
||||
"addItem" : addBookmarkItem,
|
||||
"addBookmark" : addBookmark,
|
||||
"removeBookmark" : removeBookmark,
|
||||
"pageToId" : pageToId,
|
||||
"isBookmarked" : isBookmarked
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
PDFJS.reader.ControlsController = function(book) {
|
||||
var reader = this,
|
||||
settings = reader.settings;
|
||||
eventBus = this.eventBus,
|
||||
settings = reader.settings,
|
||||
customStyles = reader.settings.customStyles,
|
||||
activeStyles = reader.settings.activeStyles;
|
||||
|
||||
var $store = $("#store"),
|
||||
$viewer = $("#viewer"),
|
||||
|
@ -26,7 +29,9 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
$page_num = $("#page_num"),
|
||||
$total_pages = $("#total_pages"),
|
||||
$status_message_left = $("#status_message_left"),
|
||||
$status_message_right = $("#status_message_right");
|
||||
$status_message_right = $("#status_message_right"),
|
||||
$nightmode = $("#nightmode"),
|
||||
$nightshift = $(".nightshift");
|
||||
|
||||
var STATUS_MESSAGE_LENGTH = 30,
|
||||
STATUS_MESSAGE_TIMEOUT = 3000,
|
||||
|
@ -83,12 +88,8 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
$slider.on("click", function () {
|
||||
if(reader.sidebarOpen) {
|
||||
reader.SidebarController.hide();
|
||||
//$slider.addClass("icon-menu");
|
||||
//$slider.removeClass("icon-right2");
|
||||
} else {
|
||||
reader.SidebarController.show();
|
||||
//$slider.addClass("icon-right2");
|
||||
//$slider.removeClass("icon-menu");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -122,20 +123,12 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
|
||||
$bookmark.on("click", function() {
|
||||
var currentPage = reader.settings.currentPage,
|
||||
bmc = reader.BookmarksController;
|
||||
|
||||
if(!bmc.isBookmarked(currentPage)) { //-- Add bookmark
|
||||
bmc.addBookmark(currentPage);
|
||||
$bookmark
|
||||
.addClass("icon-turned_in")
|
||||
.removeClass("icon-turned_in_not");
|
||||
} else { //-- Remove Bookmark
|
||||
bmc.removeBookmark(currentPage);
|
||||
$bookmark
|
||||
.removeClass("icon-turned_in")
|
||||
.addClass("icon-turned_in_not");
|
||||
}
|
||||
id = reader.pageToId(currentPage);
|
||||
|
||||
if (!reader.isBookmarked(id))
|
||||
reader.addBookmark(currentPage)
|
||||
else
|
||||
reader.removeBookmark(currentPage);
|
||||
});
|
||||
|
||||
/* select works fine on most browsers, but - of course - apple mobile has 'special needs' so
|
||||
|
@ -146,7 +139,6 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
// zooooooooooooooom
|
||||
$zoom_icon.on("click", function () {
|
||||
var offset = $(this).offset();
|
||||
console.log(offset);
|
||||
$zoom_options.css("opacity", 0);
|
||||
$zoom_options.toggleClass("hide");
|
||||
$zoom_options.css({
|
||||
|
@ -169,16 +161,6 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
|
||||
setZoomIcon(settings.zoomLevel);
|
||||
|
||||
/*
|
||||
$zoom_icon[0].className="";
|
||||
var $current_zoom_option = $zoom_options.find("[data-value='" + settings.zoomLevel + "']");
|
||||
if ($current_zoom_option.data("class")) {
|
||||
$zoom_icon.addClass($current_zoom_option.data("class"));
|
||||
} else {
|
||||
$zoom_icon[0].textContent = $current_zoom_option.data("text");
|
||||
}
|
||||
*/
|
||||
|
||||
$zoom_option.on("click", function () {
|
||||
var $this = $(this);
|
||||
reader.setZoom($this.data("value"));
|
||||
|
@ -241,6 +223,25 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
});
|
||||
/* end custom select */
|
||||
|
||||
var setNightmodeIcon = function (mode) {
|
||||
if (mode)
|
||||
$nightmode.removeClass("icon-brightness_low2").addClass("icon-brightness_4");
|
||||
else
|
||||
$nightmode.removeClass("icon-brightness_4").addClass("icon-brightness_low2");
|
||||
};
|
||||
|
||||
$nightshift.off('click').on('click', function () {
|
||||
if (settings.nightMode) {
|
||||
reader.disableStyle(customStyles.nightMode);
|
||||
settings.nightMode = false;
|
||||
} else {
|
||||
reader.enableStyle(customStyles.nightMode);
|
||||
settings.nightMode = true;
|
||||
}
|
||||
|
||||
setNightmodeIcon(settings.nightMode);
|
||||
});
|
||||
|
||||
var enterPageNum = function(e) {
|
||||
var text = e.target,
|
||||
page;
|
||||
|
@ -277,6 +278,20 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
$page_num[0].addEventListener("keydown", enterPageNum, false);
|
||||
});
|
||||
|
||||
eventBus.on("renderer:pagechanged", function toggleControls1(e) {
|
||||
var page = e.pageNum,
|
||||
id = reader.pageToId(page);
|
||||
|
||||
if (reader.isBookmarked(id))
|
||||
$bookmark
|
||||
.addClass("icon-turned_in")
|
||||
.removeClass("icon-turned_in_not");
|
||||
else
|
||||
$bookmark
|
||||
.removeClass("icon-turned_in")
|
||||
.addClass("icon-turned_in_not");
|
||||
});
|
||||
|
||||
var setPageCount = function (_numPages) {
|
||||
|
||||
var numPages = _numPages || reader.settings.numPages;
|
||||
|
@ -315,44 +330,13 @@ PDFJS.reader.ControlsController = function(book) {
|
|||
$page_num[0].textContent = text;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
book.on('renderer:locationChanged', function(cfi){
|
||||
var cfiFragment = "#" + cfi;
|
||||
// save current position (cursor)
|
||||
reader.settings.session.setCursor(cfi);
|
||||
//-- Check if bookmarked
|
||||
if(!(reader.isBookmarked(cfi))) { //-- Not bookmarked
|
||||
$bookmark
|
||||
.removeClass("icon-turned_in")
|
||||
.addClass("icon-turned_in_not");
|
||||
} else { //-- Bookmarked
|
||||
$bookmark
|
||||
.addClass("icon-turned_in")
|
||||
.removeClass("icon-turned_in_not");
|
||||
}
|
||||
|
||||
reader.currentLocationCfi = cfi;
|
||||
|
||||
// Update the History Location
|
||||
if(reader.settings.history &&
|
||||
window.location.hash != cfiFragment) {
|
||||
// Add CFI fragment to the history
|
||||
history.pushState({}, '', cfiFragment);
|
||||
}
|
||||
});
|
||||
|
||||
book.on('book:pageChanged', function(location){
|
||||
console.log("page", location.page, location.percentage)
|
||||
});
|
||||
*/
|
||||
|
||||
return {
|
||||
"show": show,
|
||||
"hide": hide,
|
||||
"toggle": toggle,
|
||||
"setZoomIcon": setZoomIcon,
|
||||
"setRotateIcon": setRotateIcon,
|
||||
"setNightmodeIcon": setNightmodeIcon,
|
||||
"setCurrentPage": setCurrentPage,
|
||||
"setPageCount": setPageCount,
|
||||
"setStatus": setStatus
|
||||
|
|
|
@ -2,6 +2,7 @@ PDFJS.reader.NotesController = function(book) {
|
|||
|
||||
var book = this.book,
|
||||
reader = this,
|
||||
eventBus = this.eventBus,
|
||||
$notesView = $("#notesView"),
|
||||
$notes = $("#notes"),
|
||||
$text = $("#note-text"),
|
||||
|
@ -90,12 +91,17 @@ PDFJS.reader.NotesController = function(book) {
|
|||
|
||||
var addAnnotationItem = function(annotation) {
|
||||
$notes.append(createItem(annotation));
|
||||
reader.settings.session.setBookmark(annotation.id, annotation.anchor, annotation.type, annotation);
|
||||
//reader.settings.session.setBookmark(annotation.id, annotation.anchor, annotation.type, annotation);
|
||||
};
|
||||
|
||||
var removeAnnotation = function (id) {
|
||||
|
||||
if (annotations[id] !== undefined) {
|
||||
if (annotations[id].type == "bookmark")
|
||||
eventBus.dispatch("bookmarkremoved", {
|
||||
source: this,
|
||||
id: id
|
||||
});
|
||||
deleteAnnotationItem(id);
|
||||
delete annotations[id];
|
||||
reader.settings.session.deleteBookmark(id);
|
||||
|
@ -103,16 +109,10 @@ PDFJS.reader.NotesController = function(book) {
|
|||
};
|
||||
|
||||
var deleteAnnotationItem = function (id) {
|
||||
var marker = book.renderer.doc.getElementById("note-" + id);
|
||||
var item = document.getElementById(id);
|
||||
|
||||
if (item)
|
||||
item.remove();
|
||||
|
||||
if (marker) {
|
||||
marker.remove();
|
||||
renumberMarkers();
|
||||
}
|
||||
};
|
||||
|
||||
/* items are HTML-representations of annotations */
|
||||
|
@ -132,7 +132,8 @@ PDFJS.reader.NotesController = function(book) {
|
|||
item.classList.add("note");
|
||||
del.classList.add("item-delete", "item-control", "icon-delete");
|
||||
edit.classList.add("item-edit", "item-control", "icon-rate_review");
|
||||
link.classList.add("note-link", "icon-link2");
|
||||
link.classList.add("note-link");
|
||||
//link.classList.add("note-link", "icon-link2");
|
||||
date.classList.add("item-date");
|
||||
del.setAttribute("title", "delete");
|
||||
edit.setAttribute("title", "edit");
|
||||
|
@ -144,16 +145,19 @@ PDFJS.reader.NotesController = function(book) {
|
|||
cancel.setAttribute("display", "none");
|
||||
|
||||
link.href = "#"+annotation.anchor;
|
||||
link.textContent = "Page " + annotation.anchor;
|
||||
|
||||
link.onclick = function(){
|
||||
reader.queuePage(annotation.anchor);
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
if (!annotation.readonly) {
|
||||
del.onclick = function() {
|
||||
var id = this.parentNode.parentNode.getAttribute("id");
|
||||
console.log("ID", id);
|
||||
removeAnnotation(id);
|
||||
deleteAnnotationItem(id);
|
||||
reader.removeAnnotation(id);
|
||||
};
|
||||
|
||||
save.onclick = function() {
|
||||
|
@ -184,8 +188,11 @@ PDFJS.reader.NotesController = function(book) {
|
|||
div.appendChild(save);
|
||||
div.appendChild(del);
|
||||
div.appendChild(edit);
|
||||
}
|
||||
|
||||
div.appendChild(link);
|
||||
item.appendChild(text);
|
||||
if (!annotation.readonly)
|
||||
item.appendChild(date);
|
||||
item.appendChild(div);
|
||||
return item;
|
||||
|
@ -250,25 +257,6 @@ PDFJS.reader.NotesController = function(book) {
|
|||
renumberMarkers();
|
||||
}
|
||||
|
||||
var renumberMarkers = function() {
|
||||
for (var note in annotations) {
|
||||
if (annotations.hasOwnProperty(note)) {
|
||||
var chapter = renderer.currentChapter;
|
||||
// var cfi = epubcfi.parse(annotations[note].anchor);
|
||||
// if(cfi.spinePos === chapter.spinePos) {
|
||||
// try {
|
||||
// var marker = book.renderer.doc.getElementById("note-" + annotations[note].id);
|
||||
// if (marker !== undefined) {
|
||||
// marker.innerHTML = findIndex(annotations[note].id) + "[Reader]";
|
||||
// }
|
||||
// } catch(e) {
|
||||
// console.log("renumbering of markers failed", annotations[note].anchor);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var markerEvents = function(item, txt){
|
||||
var id = item.id;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ PDFJS.reader.ReaderController = function() {
|
|||
$fullscreen = $("#fullscreen"),
|
||||
$bookmark = $("#bookmark"),
|
||||
$note = $("#note"),
|
||||
$nightmode = $("#nightmode"),
|
||||
$rotate_left = $("#rotate_left"),
|
||||
$rotate_right = $("#rotate_right"),
|
||||
$clear_search = $("#clear_search");
|
||||
|
@ -22,22 +23,14 @@ PDFJS.reader.ReaderController = function() {
|
|||
|
||||
var slideIn = function() {
|
||||
if (reader.viewerResized) {
|
||||
var currentPosition = book.getCurrentLocationCfi();
|
||||
var currentPosition = settings.currentPage;
|
||||
reader.viewerResized = false;
|
||||
$main.removeClass('single');
|
||||
$main.one("transitionend", function(){
|
||||
book.gotoCfi(currentPosition);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var slideOut = function() {
|
||||
var currentPosition = book.getCurrentLocationCfi();
|
||||
var currentPosition = settings.currentPage;
|
||||
reader.viewerResized = true;
|
||||
$main.addClass('single');
|
||||
$main.one("transitionend", function(){
|
||||
book.gotoCfi(currentPosition);
|
||||
});
|
||||
};
|
||||
|
||||
var showLoader = function() {
|
||||
|
@ -47,11 +40,6 @@ PDFJS.reader.ReaderController = function() {
|
|||
|
||||
var hideLoader = function() {
|
||||
$loader.hide();
|
||||
|
||||
//-- If the book is using spreads, show the divider
|
||||
// if(book.settings.spreads) {
|
||||
// showDivider();
|
||||
// }
|
||||
};
|
||||
|
||||
var showDivider = function() {
|
||||
|
@ -111,10 +99,7 @@ PDFJS.reader.ReaderController = function() {
|
|||
$fullscreen.click();
|
||||
break;
|
||||
case 'toggleNight':
|
||||
$metainfo.click();
|
||||
break;
|
||||
case 'toggleDay':
|
||||
$use_custom_colors.click();
|
||||
$nightmode.click();
|
||||
break;
|
||||
case 'rotateLeft':
|
||||
$rotate_left.click();
|
||||
|
@ -129,6 +114,9 @@ PDFJS.reader.ReaderController = function() {
|
|||
reader.SearchController.nextMatch(true);
|
||||
break;
|
||||
case 'nextMatch':
|
||||
if (e.shiftKey)
|
||||
reader.SearchController.nextMatch(true);
|
||||
else
|
||||
reader.SearchController.nextMatch(false);
|
||||
break;
|
||||
case 'clearSearch':
|
||||
|
@ -154,48 +142,18 @@ PDFJS.reader.ReaderController = function() {
|
|||
|
||||
$next.on("click", function(e){
|
||||
|
||||
//if(book.metadata.direction === "rtl") {
|
||||
// reader.prevPage();
|
||||
//} else {
|
||||
reader.nextPage();
|
||||
//}
|
||||
|
||||
showActive($next);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$prev.on("click", function(e){
|
||||
|
||||
//if(book.metadata.direction === "rtl") {
|
||||
// reader.nextPage();
|
||||
//} else {
|
||||
reader.prevPage();
|
||||
//}
|
||||
|
||||
showActive($prev);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
/*
|
||||
book.on("renderer:spreads", function(bool){
|
||||
if(bool) {
|
||||
showDivider();
|
||||
} else {
|
||||
hideDivider();
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
// book.on("book:atStart", function(){
|
||||
// $prev.addClass("disabled");
|
||||
// });
|
||||
//
|
||||
// book.on("book:atEnd", function(){
|
||||
// $next.addClass("disabled");
|
||||
// });
|
||||
|
||||
return {
|
||||
"slideOut" : slideOut,
|
||||
"slideIn" : slideIn,
|
||||
|
|
|
@ -11,6 +11,7 @@ PDFJS.reader.SettingsController = function() {
|
|||
$prev = $("#prev"),
|
||||
$close = $("#close"),
|
||||
$sidebarReflow = $('#sidebarReflow'),
|
||||
$scrollToTop = $('#scrollToTop'),
|
||||
$touch_nav = $("#touch_nav"),
|
||||
$page_turn_arrows = $("#page_turn_arrows"),
|
||||
$prev_arrow = $("#prev :first-child"),
|
||||
|
@ -24,6 +25,17 @@ PDFJS.reader.SettingsController = function() {
|
|||
$settings.removeClass('open');
|
||||
};
|
||||
|
||||
if (settings.scrollToTop) {
|
||||
$scrollToTop.prop('checked', true);
|
||||
} else {
|
||||
$scrollToTop.prop('checked', false);
|
||||
}
|
||||
|
||||
$scrollToTop.off('click').on('click', function() {
|
||||
settings.scrollToTop = !settings.scrollToTop;
|
||||
settings.session.setDefault("scrollToTop", settings.scrollToTop);
|
||||
});
|
||||
|
||||
if (settings.sidebarReflow) {
|
||||
$sidebarReflow.prop('checked', true);
|
||||
} else {
|
||||
|
|
|
@ -1,90 +1,27 @@
|
|||
PDFJS.reader.StylesController = function (renderer) {
|
||||
|
||||
var reader = this,
|
||||
book = this.book,
|
||||
settings = reader.settings,
|
||||
customStyles = reader.settings.customStyles,
|
||||
activeStyles = reader.settings.activeStyles,
|
||||
$viewer = $("#viewer"),
|
||||
$day_example = $('#day_example'),
|
||||
$night_example = $('#night_example'),
|
||||
$font_example = $('#font_example'),
|
||||
$page_width = $("#page_width"),
|
||||
$day_background = $('#day_background'),
|
||||
$day_color = $('#day_color'),
|
||||
$night_background = $('#night_background'),
|
||||
$night_color = $('#night_color'),
|
||||
$use_custom_colors = $('#use_custom_colors'),
|
||||
$nightshift = $('.nightshift'),
|
||||
$custom_font_family = $('#custom_font_family'),
|
||||
$font_family = $('#font_family'),
|
||||
$custom_font_size = $('#custom_font_size'),
|
||||
$font_size = $("#font_size"),
|
||||
$custom_font_weight = $('#custom_font_weight'),
|
||||
$font_weight = $("#font_weight"),
|
||||
$maximize_page = $('#maximize_page');
|
||||
|
||||
// register hook to refresh styles on chapter change
|
||||
renderer.registerHook("beforeChapterDisplay", this.refreshStyles.bind(this), true);
|
||||
|
||||
this.addStyle("dayMode", "*", {
|
||||
color: $day_color.val(),
|
||||
background: $day_background.val()
|
||||
});
|
||||
$main = $("#main"),
|
||||
$nightmode_form = $('#nightmode_form'),
|
||||
$nightmode_reset = $('#nightmode_reset'),
|
||||
$night_brightness = $('#night_brightness'),
|
||||
$night_contrast = $('#night_contrast'),
|
||||
$night_sepia = $('#night_sepia'),
|
||||
$night_huerotate = $('#night_huerotate'),
|
||||
$night_saturate = $('#night_saturate'),
|
||||
$nightshift = $('.nightshift');
|
||||
|
||||
this.addStyle("nightMode", "*", {
|
||||
color: $night_color.val(),
|
||||
background: $night_background.val()
|
||||
});
|
||||
|
||||
this.addStyle("fontFamily", "*", {
|
||||
"font-family": $font_family.val()
|
||||
});
|
||||
|
||||
this.addStyle("fontSize", "*", {
|
||||
"font-size": $font_size.val() + '%'
|
||||
});
|
||||
|
||||
this.addStyle("fontWeight", "*", {
|
||||
"font-weight": $font_weight.val()
|
||||
});
|
||||
|
||||
this.addStyle("pageWidth", "#viewer", {
|
||||
"max-width": $page_width.val() + 'em'
|
||||
});
|
||||
|
||||
this.addStyle("maximizePage", "#viewer", {
|
||||
"margin": "auto",
|
||||
"width": "100%",
|
||||
"height": "95%",
|
||||
"top": "5%"
|
||||
filter: 'invert(1) sepia(' + $night_sepia.val() + ') hue-rotate(' + $night_huerotate.val() + 'deg) brightness(' + $night_brightness.val() + ') contrast(' + $night_contrast.val() + ') saturate(' + $night_saturate.val() + ')'
|
||||
});
|
||||
|
||||
this.addStyle("appleBugs", "document, html, body, p, span, div", {
|
||||
"cursor": "pointer"
|
||||
});
|
||||
|
||||
$day_example.css({
|
||||
'background': customStyles.dayMode.rules.background,
|
||||
'color': customStyles.dayMode.rules.color
|
||||
});
|
||||
|
||||
$night_example.css({
|
||||
'background': customStyles.nightMode.rules.background,
|
||||
'color': customStyles.nightMode.rules.color
|
||||
});
|
||||
|
||||
$font_example.css({
|
||||
'font-size': customStyles.fontSize.rules["font-size"],
|
||||
'font-family': customStyles.fontFamily.rules["font-family"],
|
||||
'font-weight': customStyles.fontWeight.rules["font-weight"]
|
||||
});
|
||||
|
||||
$font_family.val(customStyles.fontFamily.rules["font-family"]);
|
||||
$font_size.val(parseInt(customStyles.fontSize.rules["font-size"]));
|
||||
$font_weight.val(customStyles.fontWeight.rules["font-weight"]);
|
||||
$page_width.val(parseInt(0 + parseInt(customStyles.pageWidth.rules["max-width"])));
|
||||
|
||||
// fix click-bug in apple products
|
||||
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g))
|
||||
activeStyles['appleBugs'] = true;
|
||||
|
@ -93,19 +30,8 @@ PDFJS.reader.StylesController = function (renderer) {
|
|||
if (!activeStyles.hasOwnProperty(style)) continue;
|
||||
|
||||
switch (style) {
|
||||
case "dayMode":
|
||||
$use_custom_colors.prop("checked", true);
|
||||
break;
|
||||
case "fontFamily":
|
||||
$custom_font_family.prop("checked", true);
|
||||
$font_family.prop('disabled',false);
|
||||
break;
|
||||
case "fontSize":
|
||||
$custom_font_size.prop("checked", true);
|
||||
$font_size.prop('disabled',false);
|
||||
break;
|
||||
case "maximizePage":
|
||||
$maximize_page.prop("checked", true);
|
||||
case "nightMode":
|
||||
reader.ControlsController.setNightmodeIcon(true);
|
||||
break;
|
||||
case "appleBugs":
|
||||
console.log("Apple mobile bugs detected, applying workarounds...");
|
||||
|
@ -115,115 +41,52 @@ PDFJS.reader.StylesController = function (renderer) {
|
|||
reader.enableStyle(customStyles[style]);
|
||||
}
|
||||
|
||||
$day_background.off('change').on('change', function() {
|
||||
customStyles.dayMode.rules.background = $day_background.val();
|
||||
$day_example.css('background', customStyles.dayMode.rules.background);
|
||||
reader.updateStyle(customStyles.dayMode);
|
||||
$night_brightness.off('change').on('change', function() {
|
||||
updateNightmode();
|
||||
});
|
||||
|
||||
$day_color.off('change').on('change', function() {
|
||||
customStyles.dayMode.rules.color = $day_color.val();
|
||||
$day_example.css('color', customStyles.dayMode.rules.color);
|
||||
reader.updateStyle(customStyles.dayMode);
|
||||
$night_contrast.off('change').on('change', function() {
|
||||
updateNightmode();
|
||||
});
|
||||
|
||||
$night_background.off('change').on('change', function() {
|
||||
customStyles.nightMode.rules.background = $night_background.val();
|
||||
$night_example.css('background', customStyles.nightMode.rules.background);
|
||||
$night_sepia.off('change').on('change', function() {
|
||||
updateNightmode();
|
||||
});
|
||||
|
||||
$night_huerotate.off('change').on('change', function() {
|
||||
updateNightmode();
|
||||
});
|
||||
|
||||
$night_saturate.off('change').on('change', function() {
|
||||
updateNightmode();
|
||||
});
|
||||
|
||||
$nightmode_form.off('reset').on('reset', function () {
|
||||
setTimeout(function() {
|
||||
updateNightmode();
|
||||
}, 10);
|
||||
});
|
||||
|
||||
var parseFilter = function(str, element) {
|
||||
var re = new RegExp(element+'\\(([\\d.]+)\\S*\\)'),
|
||||
value = null;
|
||||
|
||||
if (re.test(str))
|
||||
value = str.match(re)[1];
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
var updateNightmode = function() {
|
||||
customStyles.nightMode.rules.filter = 'invert(1) sepia(' + $night_sepia.val() + ') hue-rotate(' + $night_huerotate.val() + 'deg) brightness(' + $night_brightness.val() + ') contrast(' + $night_contrast.val() + ') saturate(' + $night_saturate.val() + ')';
|
||||
reader.updateStyle(customStyles.nightMode);
|
||||
});
|
||||
};
|
||||
|
||||
$night_color.off('change').on('change', function() {
|
||||
customStyles.nightMode.rules.color = $night_color.val();
|
||||
$night_example.css('color', customStyles.nightMode.rules.color);
|
||||
reader.updateStyle(customStyles.nightMode);
|
||||
});
|
||||
|
||||
$use_custom_colors.off('change').on('change', function () {
|
||||
if ($(this).prop('checked')) {
|
||||
reader.enableStyle(customStyles.dayMode);
|
||||
} else {
|
||||
reader.disableStyle(customStyles.dayMode);
|
||||
}
|
||||
});
|
||||
|
||||
$nightshift.off('click').on('click', function () {
|
||||
if (settings.nightMode) {
|
||||
reader.disableStyle(customStyles.nightMode);
|
||||
settings.nightMode = false;
|
||||
} else {
|
||||
reader.enableStyle(customStyles.nightMode);
|
||||
settings.nightMode = true;
|
||||
}
|
||||
});
|
||||
|
||||
$page_width.off('change').on("change", function () {
|
||||
customStyles.pageWidth.rules["page-width"] = $(this).val() + "em";
|
||||
reader.updateStyle(customStyles.pageWidth);
|
||||
$viewer.css("max-width", customStyles.pageWidth.rules["page-width"]);
|
||||
});
|
||||
|
||||
$custom_font_family.off('click').on('click', function() {
|
||||
if ($(this).prop('checked')) {
|
||||
$font_family.prop('disabled',false);
|
||||
reader.enableStyle(customStyles.fontFamily);
|
||||
} else {
|
||||
$font_family.prop('disabled',true);
|
||||
reader.disableStyle(customStyles.fontFamily);
|
||||
}
|
||||
});
|
||||
|
||||
$custom_font_size.off('click').on('click', function() {
|
||||
if ($(this).prop('checked')) {
|
||||
$font_size.prop('disabled',false);
|
||||
reader.enableStyle(customStyles.fontSize);
|
||||
} else {
|
||||
$font_size.prop('disabled',true);
|
||||
reader.disableStyle(customStyles.fontSize);
|
||||
}
|
||||
});
|
||||
|
||||
$custom_font_weight.off('click').on('click', function() {
|
||||
if ($(this).prop('checked')) {
|
||||
$font_weight.prop('disabled',false);
|
||||
reader.enableStyle(customStyles.fontWeight);
|
||||
} else {
|
||||
$font_weight.prop('disabled',true);
|
||||
reader.disableStyle(customStyles.fontWeight);
|
||||
}
|
||||
});
|
||||
|
||||
$maximize_page.off('click').on('click', function() {
|
||||
if ($(this).prop('checked')) {
|
||||
reader.enableStyle(customStyles.maximizePage);
|
||||
} else {
|
||||
reader.disableStyle(customStyles.maximizePage);
|
||||
}
|
||||
});
|
||||
|
||||
$font_size.off('change').on('change', function() {
|
||||
$font_example.css('font-size', $(this).val() + '%');
|
||||
customStyles.fontSize.rules["font-size"] = $(this).val() + '%';
|
||||
reader.updateStyle(customStyles.fontSize);
|
||||
});
|
||||
|
||||
$font_weight.off('change').on('change', function() {
|
||||
customStyles.fontWeight.rules["font-weight"] = $(this).val();
|
||||
$font_example.css('font-weight', $(this).val());
|
||||
reader.updateStyle(customStyles.fontWeight);
|
||||
});
|
||||
|
||||
$font_family.off('change').on('change', function() {
|
||||
customStyles.fontFamily.rules["font-family"] = $(this).val();
|
||||
$font_example.css('font-family', $(this).val());
|
||||
reader.updateStyle(customStyles.fontFamily);
|
||||
});
|
||||
|
||||
$page_width.off('change').on("change", function () {
|
||||
customStyles.pageWidth.rules["page-width"] = $(this).val() + "em";
|
||||
reader.updateStyle(customStyles.pageWidth);
|
||||
$viewer.css("max-width", customStyles.pageWidth.rules["page-width"]);
|
||||
});
|
||||
$night_brightness.val(parseFilter(customStyles.nightMode.rules.filter,"brightness"));
|
||||
$night_contrast.val(parseFilter(customStyles.nightMode.rules.filter,"contrast"));
|
||||
$night_sepia.val(parseFilter(customStyles.nightMode.rules.filter,"sepia"));
|
||||
$night_huerotate.val(parseFilter(customStyles.nightMode.rules.filter,"hue-rotate"));
|
||||
$night_saturate.val(parseFilter(customStyles.nightMode.rules.filter,"saturate"));
|
||||
|
||||
return {
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ PDFJS.reader.TocController = function() {
|
|||
if (isVisible(elements[i])) {
|
||||
pagenum = elements[i].getAttribute("data-pagenum");
|
||||
elements[i].removeAttribute("data-pagenum");
|
||||
reader.getThumb(pagenum, true);
|
||||
reader.getThumb(parseInt(pagenum), true);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
80
files_reader/vendor/pdfjs/css/main.css
vendored
80
files_reader/vendor/pdfjs/css/main.css
vendored
|
@ -20,7 +20,10 @@ fieldset {
|
|||
body {
|
||||
background: #4e4e4e;
|
||||
overflow: hidden;
|
||||
font-style:
|
||||
}
|
||||
|
||||
.night {
|
||||
filter: opacity(80%) invert(100%);
|
||||
}
|
||||
|
||||
#main {
|
||||
|
@ -31,8 +34,9 @@ body {
|
|||
border-radius: 5px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
-webkit-transition: -webkit-transform .4s, width .2s;
|
||||
-moz-transition: -webkit-transform .4s, width .2s;
|
||||
-webkit-transition: -webkit-transform .4s, width .2s, filter .2s;
|
||||
-moz-transition: -webkit-transform .4s, width .2s, filter .2s;
|
||||
transition: transform .4s, width .2s, filter .2s;
|
||||
/*
|
||||
-moz-box-shadow: inset 0 0 50px rgba(0,0,0,.1);
|
||||
-webkit-box-shadow: inset 0 0 50px rgba(0,0,0,.1);
|
||||
|
@ -136,8 +140,6 @@ body {
|
|||
|
||||
#metainfo {
|
||||
position: fixed;
|
||||
/* width: 80%;
|
||||
left: 10%; */
|
||||
width: 50%;
|
||||
width: calc(100% - 7.5em);
|
||||
left: 1.5em;
|
||||
|
@ -146,12 +148,14 @@ body {
|
|||
height: 1em;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
#title-controls {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#nightmode,
|
||||
#zoom_icon,
|
||||
#rotate_icon,
|
||||
#rotate_left,
|
||||
|
@ -164,6 +168,11 @@ body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
#nightmode {
|
||||
padding 0 .5em;
|
||||
}
|
||||
|
||||
#nightmode:hover,
|
||||
#zoom_icon:hover,
|
||||
#rotate_icon:hover,
|
||||
#rotate_left:hover,
|
||||
|
@ -172,6 +181,7 @@ body {
|
|||
border: 1px rgba(0,0,0,.2) solid;
|
||||
}
|
||||
|
||||
#nightmode:active,
|
||||
#zoom_icon:active,
|
||||
#rotate_icon:active,
|
||||
#rotate_left:active,
|
||||
|
@ -401,12 +411,6 @@ body {
|
|||
|
||||
|
||||
@media only screen and (max-width: 1040px) {
|
||||
/*
|
||||
#viewer{
|
||||
width: 50%;
|
||||
margin-left: 25%;
|
||||
}
|
||||
*/
|
||||
#divider,
|
||||
#divider.show {
|
||||
display: none;
|
||||
|
@ -414,12 +418,6 @@ body {
|
|||
}
|
||||
|
||||
@media only screen and (max-width: 900px) {
|
||||
/*
|
||||
#viewer{
|
||||
width: 60%;
|
||||
margin-left: 20%;
|
||||
}
|
||||
*/
|
||||
#prev {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
@ -430,16 +428,6 @@ body {
|
|||
}
|
||||
|
||||
@media only screen and (max-width: 550px) {
|
||||
/*
|
||||
#viewer{
|
||||
width: 80%;
|
||||
margin-left: 10%;
|
||||
}
|
||||
#viewer {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
*/
|
||||
#prev {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
@ -454,40 +442,10 @@ body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
#main {
|
||||
-webkit-transform: translate(0, 0);
|
||||
-moz-transform: translate(0, 0);
|
||||
-webkit-transition: -webkit-transform .3s;
|
||||
-moz-transition: -moz-transform .3s;
|
||||
#metainfo {
|
||||
width: unset;
|
||||
display: flex;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
#main.closed {
|
||||
-webkit-transform: translate(260px, 0);
|
||||
-moz-transform: translate(260px, 0);
|
||||
}
|
||||
*/
|
||||
#titlebar {
|
||||
/* font-size: 16px; */
|
||||
/* margin: 0 50px 0 50px; */
|
||||
}
|
||||
|
||||
#metainfo span {
|
||||
font-size: 0.5em;
|
||||
}
|
||||
/*
|
||||
#tocView {
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
#tocView li {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#tocView > ul{
|
||||
padding-left: 10px;
|
||||
-webkit-padding-start:;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
265
files_reader/vendor/pdfjs/pdf.reader.js
vendored
265
files_reader/vendor/pdfjs/pdf.reader.js
vendored
|
@ -42,9 +42,10 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
cssZoomOnly: false, // true || false, only zoom using CSS, render document at 100% size
|
||||
textSelect: true, // true || false, add selectable text layer
|
||||
annotationLayer: true, // true || false. show PDF annotations
|
||||
mergeAnnotations: true,// true || false, merge PDF annotations into bookmarks/annotations
|
||||
mergeAnnotations: false,// true || false, merge PDF annotations into bookmarks/annotations
|
||||
doubleBuffer: true, // true || false, draw to off-screen canvas
|
||||
cacheNext: true, // true || false, pre-render next page (by creathing thumbnail))
|
||||
scrollToTop: false, // true || false, scroll to top of page on page turn
|
||||
numPages: 0,
|
||||
currentPage: 1,
|
||||
scale: DEFAULT_SCALE,
|
||||
|
@ -73,17 +74,15 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
83: 'toggleSidebar',// s
|
||||
84: 'toggleTitlebar', // t
|
||||
68: 'toggleDay', // d
|
||||
//78: 'toggleNight', // n
|
||||
78: 'toggleNight', // n
|
||||
55: 'search', // '/'
|
||||
80: 'previousMatch', // p
|
||||
78: 'nextMatch', // n
|
||||
70: 'toggleFullscreen', // f
|
||||
27: 'closeSidebar', // esc
|
||||
114: 'nextMatch' // F3
|
||||
},
|
||||
nightMode: false,
|
||||
dayMode: false,
|
||||
maxWidth: 72,
|
||||
pageArrows: false,
|
||||
annotations: {},
|
||||
customStyles: {},
|
||||
|
@ -113,6 +112,7 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
this.id = id || PDFJS.core.uuid();
|
||||
this.type = type;
|
||||
this.date = Date.now();
|
||||
this.readonly = true;
|
||||
this.edited = this.date;
|
||||
this.anchor = anchor;
|
||||
this.body = body;
|
||||
|
@ -126,6 +126,7 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
this.extra = extra || null;
|
||||
};
|
||||
|
||||
// resource list for single-page and 2-page display
|
||||
this.resourcelst = [
|
||||
{
|
||||
canvas: document.getElementById("left"),
|
||||
|
@ -153,6 +154,7 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
}
|
||||
];
|
||||
|
||||
// list of pages in the render queue which should be discarded
|
||||
this.cancelPage = {};
|
||||
|
||||
this.renderQueue = false;
|
||||
|
@ -194,9 +196,9 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
}
|
||||
|
||||
|
||||
//this.restoreDefaults(this.settings.session.defaults);
|
||||
//this.restorePreferences(this.settings.session.preferences);
|
||||
//this.restoreAnnotations(this.settings.session.annotations);
|
||||
this.restoreDefaults(this.settings.session.defaults);
|
||||
this.restorePreferences(this.settings.session.preferences);
|
||||
this.restoreAnnotations(this.settings.session.annotations);
|
||||
this.sideBarOpen = false;
|
||||
this.viewerResized = false;
|
||||
this.pageNumPending = null;
|
||||
|
@ -221,16 +223,12 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
|
||||
function(_book) {
|
||||
reader.book = book = _book;
|
||||
//console.log(book);
|
||||
reader.settings.numPages = reader.book.numPages;
|
||||
document.getElementById('total_pages').textContent = reader.settings.numPages;
|
||||
console.log(reader.settings);
|
||||
console.log("numPages",reader.settings.numPages);
|
||||
console.log("cursor",reader.settings.session.cursor);
|
||||
if(!$.isEmptyObject(reader.settings.session.cursor)
|
||||
&& (reader.settings.session.cursor.value !== null)
|
||||
&& (reader.settings.session.cursor.value < reader.settings.numPages)) {
|
||||
console.log("setting cursor:", reader.settings.session.cursor);
|
||||
&& (reader.settings.session.cursor.value > 0)
|
||||
&& (reader.settings.session.cursor.value <= reader.settings.numPages)) {
|
||||
reader.settings.currentPage = parseInt(reader.settings.session.cursor.value);
|
||||
}
|
||||
|
||||
|
@ -254,6 +252,7 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
reader.SettingsController = PDFJS.reader.SettingsController.call(reader, book);
|
||||
reader.ControlsController = PDFJS.reader.ControlsController.call(reader, book);
|
||||
reader.SidebarController = PDFJS.reader.SidebarController.call(reader, book);
|
||||
reader.StyleController = PDFJS.reader.StylesController.call(reader, book);
|
||||
|
||||
reader.queuePage(reader.settings.currentPage);
|
||||
reader.ReaderController.hideLoader();
|
||||
|
@ -263,15 +262,14 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
reader.OutlineController = PDFJS.reader.OutlineController.call(reader, outline);
|
||||
});
|
||||
reader.book.getMetadata().then(function (metadata) {
|
||||
console.log("metadata", metadata);
|
||||
reader.settings.pdfMetadata = metadata;
|
||||
});
|
||||
reader.book.getAttachments().then(function (attachments) {
|
||||
console.log("attachments", attachments);
|
||||
// console.log("attachments", attachments);
|
||||
});
|
||||
|
||||
reader.book.getStats().then(function (stats) {
|
||||
console.log("stats", stats);
|
||||
// console.log("stats", stats);
|
||||
});
|
||||
|
||||
// BookmarksController depends on NotesController so load NotesController first
|
||||
|
@ -289,7 +287,8 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
for (var annotation in annotations) {
|
||||
if (annotations.hasOwnProperty(annotation) && !annotations[annotation].parentId) {
|
||||
var ann = annotations[annotation],
|
||||
type = (ann.contents && ann.contents !== "") ? "annotation" : "bookmark",
|
||||
//type = (ann.contents && ann.contents !== "") ? "annotation" : "bookmark",
|
||||
type = "annotation",
|
||||
item;
|
||||
|
||||
item = new reader.Annotation(
|
||||
|
@ -298,13 +297,10 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
ann.contents,
|
||||
ann.id || PDFJS.core.uuid()
|
||||
);
|
||||
console.log(ann);
|
||||
|
||||
if (type === "annotation") {
|
||||
item.body = ann.subtype.toString() + ":" + ann.id.toString();
|
||||
|
||||
reader.NotesController.addItem(item);
|
||||
} else {
|
||||
reader.BookmarksController.addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,6 +338,108 @@ PDFJS.Reader = function(bookPath, _options) {
|
|||
return this;
|
||||
};
|
||||
|
||||
|
||||
// Annotations - bookmarks and PDF annotations
|
||||
PDFJS.Reader.prototype.pageToId = function (pageNum) {
|
||||
return "page_" + pageNum;
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.addAnnotation = function (note) {
|
||||
this.settings.annotations[note.id] = note;
|
||||
this.settings.session.setBookmark(note.id, note.anchor, note.type, note);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.removeAnnotation = function (id) {
|
||||
if (this.settings.annotations[id] !== undefined) {
|
||||
var type = this.settings.annotations[id].type;
|
||||
this.eventBus.dispatch(type + "removed", {
|
||||
source: this,
|
||||
id: id
|
||||
});
|
||||
this.settings.session.deleteBookmark(id);
|
||||
delete this.settings.annotations[id];
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.updateAnnotation = function (note) {
|
||||
note.edited = Date.now();
|
||||
this.settings.annotations[note.id] = note;
|
||||
this.settings.session.setBookmark(note.id, note.anchor, note.type, note);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.clearAnnotations = function(type) {
|
||||
if (type) {
|
||||
for (var id in this.settings.annotations) {
|
||||
if (this.settings.annotations.hasOwnProperty(id) && this.settings.annotations[id].type === type)
|
||||
this.removeAnnotation(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.isBookmarked = function (id) {
|
||||
return (this.settings.annotations[id] !== undefined);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.addBookmark = function(pageNum) {
|
||||
var id = this.pageToId(pageNum);
|
||||
|
||||
var text = " ",
|
||||
bookmark;
|
||||
|
||||
// TODO: get text content around bookmark location, needed for annotation editor (not yet implemented)
|
||||
for (var i = 0; i <= 1; i++) {
|
||||
if (this.resourcelst[i].pageNum == pageNum
|
||||
&& this.resourcelst[i].textdiv.textContent !== null) {
|
||||
text = this.ellipsize(this.resourcelst[i].textdiv.textContent);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isBookmarked(id)) {
|
||||
bookmark = this.getAnnotation(id);
|
||||
this.updateAnnotation(bookmark);
|
||||
} else {
|
||||
bookmark = new this.Annotation("bookmark", pageNum, text, id);
|
||||
bookmark.readonly = false;
|
||||
this.addAnnotation(bookmark);
|
||||
}
|
||||
|
||||
this.eventBus.dispatch("bookmarkcreated", {
|
||||
source: this,
|
||||
id: id
|
||||
});
|
||||
|
||||
return bookmark;
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.updateBookmark = function (bookmark) {
|
||||
this.updateAnnotation(bookmark);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.removeBookmark = function (pageNum) {
|
||||
var id = this.pageToId(pageNum);
|
||||
this.removeAnnotation(id);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.clearBookmarks = function () {
|
||||
this.clearAnnotations("bookmark");
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.getAnnotation = function (id) {
|
||||
return this.settings.annotations[id];
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.restoreAnnotations = function (annotations) {
|
||||
if (annotations !== {}) {
|
||||
for (var note in this.settings.session.annotations) {
|
||||
if (annotations.hasOwnProperty(note) && annotations[note].content !== null) {
|
||||
this.settings.annotations[annotations[note].name] = annotations[note].content;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Render thumbnail, page, etc.
|
||||
|
||||
PDFJS.Reader.prototype.getThumb = function (pageNum, insert) {
|
||||
|
||||
var reader = this,
|
||||
|
@ -513,6 +611,7 @@ PDFJS.Reader.prototype.renderPage = function(pageNum) {
|
|||
swap_orientation,
|
||||
double_buffer,
|
||||
cache_next,
|
||||
scroll_to_top,
|
||||
pageShift;
|
||||
|
||||
max_view_width = window.innerWidth;
|
||||
|
@ -561,6 +660,7 @@ PDFJS.Reader.prototype.renderPage = function(pageNum) {
|
|||
fraction = reader.approximateFraction(outputscale);
|
||||
double_buffer = reader.settings.doubleBuffer;
|
||||
cache_next = reader.settings.cacheNext;
|
||||
scroll_to_top = reader.settings.scrollToTop;
|
||||
|
||||
textdiv.innerHTML = "";
|
||||
annotationdiv.innerHTML = "";
|
||||
|
@ -591,7 +691,6 @@ PDFJS.Reader.prototype.renderPage = function(pageNum) {
|
|||
page.getAnnotations().then(function (annotations) {
|
||||
console.log("annotations", annotations);
|
||||
});
|
||||
//console.log(page);
|
||||
page_rotation = page.rotate;
|
||||
rotation = (page_rotation + reader.settings.rotation) % 360;
|
||||
initial_viewport = page.getViewport(1, rotation);
|
||||
|
@ -713,7 +812,6 @@ PDFJS.Reader.prototype.renderPage = function(pageNum) {
|
|||
/* annotationLayer */
|
||||
if (reader.settings.annotationLayer) {
|
||||
annotationdiv.style.width = reader.roundToDivide(viewport.width, fraction[1]) + 'px';
|
||||
//annotationdiv.style.height = reader.roundToDivide(viewport.height, fraction[1]) + 'px';
|
||||
annotationdiv.style.height = 0;
|
||||
offset = $(canvas).offset();
|
||||
$(annotationdiv).offset({
|
||||
|
@ -752,12 +850,18 @@ PDFJS.Reader.prototype.renderPage = function(pageNum) {
|
|||
renderTask.promise.then(
|
||||
function pdfPageRenderCallback (something) {
|
||||
if (reader.cancelPage[pageNum] === undefined) {
|
||||
if (scroll_to_top)
|
||||
document.getElementById('viewer').scrollTo(0,0);
|
||||
if (double_buffer)
|
||||
ctx.drawImage(oscanvas, 0, 0);
|
||||
if (textLayer)
|
||||
textLayer.render(reader.settings.textRenderDelay);
|
||||
if (cache_next)
|
||||
reader.getThumb(parseInt(pageNum + pageShift), true);
|
||||
reader.eventBus.dispatch("renderer:pagechanged", {
|
||||
source: this,
|
||||
pageNum: pageNum
|
||||
});
|
||||
}
|
||||
},
|
||||
function pdfPageRenderError(error) {
|
||||
|
@ -788,6 +892,11 @@ PDFJS.Reader.prototype.queuePage = function(page) {
|
|||
oddPageRight = reader.settings.oddPageRight,
|
||||
pageShift;
|
||||
|
||||
if (page < 1)
|
||||
page = 1;
|
||||
if (page > this.settings.numPages)
|
||||
page = this.settings.numPages;
|
||||
|
||||
if (zoom === "spread") {
|
||||
pageShift = 2;
|
||||
if (oddPageRight === true) {
|
||||
|
@ -861,6 +970,20 @@ PDFJS.Reader.prototype.defaults = function (obj) {
|
|||
return obj;
|
||||
};
|
||||
|
||||
// Defaults and Preferences
|
||||
// Preferences are per-book settings and can override defaults
|
||||
PDFJS.Reader.prototype.restoreDefaults = function (defaults) {
|
||||
for (var i=0; i < defaults.length; i++) {
|
||||
this.settings[defaults[i].name] = defaults[i].value;
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.restorePreferences = function (preferences) {
|
||||
for (var i=0; i < preferences.length; i++) {
|
||||
this.settings[preferences[i].name] = preferences[i].value;
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.setScale = function (scale) {
|
||||
|
||||
};
|
||||
|
@ -1007,11 +1130,9 @@ PDFJS.Reader.prototype.bindLink = function (element, item) {
|
|||
return;
|
||||
} else {
|
||||
|
||||
//element.href = reader.getDestinationHash(destination);
|
||||
element.href = linkService.getDestinationHash(destination);
|
||||
element.onclick = function () {
|
||||
if (destination) {
|
||||
//reader._navigateTo(destination);
|
||||
linkService.navigateTo(destination);
|
||||
}
|
||||
|
||||
|
@ -1082,3 +1203,95 @@ PDFJS.Reader.prototype.isVisible = function (element) {
|
|||
return visible;
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.addStyleSheet = function (_id, _parentNode) {
|
||||
var id = _id,
|
||||
parentNode = _parentNode || document.head,
|
||||
style = document.createElement("style");
|
||||
// WebKit hack
|
||||
style.appendChild(document.createTextNode(""));
|
||||
style.setAttribute("id", id);
|
||||
parentNode.appendChild(style);
|
||||
return style.sheet;
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.getStyleSheet = function (id, _parentNode) {
|
||||
if (id !== undefined) {
|
||||
var parentNode = _parentNode || document.head;
|
||||
var style = $(parentNode).find("style#" + id);
|
||||
if (style.length) return style[0];
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.addCSSRule = function (sheet, selector, rules, index) {
|
||||
if (index === undefined) index = 0;
|
||||
if("insertRule" in sheet) {
|
||||
sheet.insertRule(selector + "{" + rules + "}", index);
|
||||
} else if ("addRule" in sheet) {
|
||||
sheet.addRule(selector, rules, index);
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.addStyle = function (name, selector, rules, extra) {
|
||||
if (undefined === this.settings.customStyles[name]) {
|
||||
this.settings.customStyles[name] = new this.Style(name, selector, rules, extra);
|
||||
this.settings.session.setDefault("customStyles",this.settings.customStyles)
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.enableStyle = function (style) {
|
||||
var currentMain = this.getStyleSheet(style.name);
|
||||
if (currentMain) $(currentMain).remove();
|
||||
var rules = "",
|
||||
sheetMain = this.addStyleSheet(style.name);
|
||||
for (var clause in style.rules) {
|
||||
rules += clause + ":" + style.rules[clause] + "!important;";
|
||||
}
|
||||
this.addCSSRule(sheetMain, (style.selector === "*") ? "#main" : style.selector, rules, 0);
|
||||
this.settings.activeStyles[style.name] = true;
|
||||
|
||||
this.settings.session.setDefault("activeStyles", this.settings.activeStyles);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.disableStyle = function (style) {
|
||||
var currentMain = this.getStyleSheet(style.name, document.head);
|
||||
if (currentMain) $(currentMain).remove();
|
||||
if (this.settings.activeStyles[style.name]) {
|
||||
delete this.settings.activeStyles[style.name];
|
||||
this.settings.session.setDefault("activeStyles", this.settings.activeStyles);
|
||||
}
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.updateStyle = function (style) {
|
||||
this.settings.session.setDefault("customStyles",this.settings.customStyles)
|
||||
var current = this.getStyleSheet(style.name);
|
||||
if (current) this.enableStyle(style);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.deleteStyle = function (style) {
|
||||
this.disableStyle(style);
|
||||
delete this.customStyles[style.name];
|
||||
this.settings.session.setDefault("customStyles",this.settings.customStyles);
|
||||
};
|
||||
|
||||
PDFJS.Reader.prototype.refreshStyles = function (callback) {
|
||||
var activeStyles = this.settings.activeStyles,
|
||||
customStyles = this.settings.customStyles;
|
||||
|
||||
for (var style in activeStyles) {
|
||||
if (!activeStyles.hasOwnProperty(style)) continue;
|
||||
|
||||
var rules = "",
|
||||
sheet = this.addStyleSheet(style);
|
||||
|
||||
for (var clause in customStyles[style].rules) {
|
||||
if (!customStyles[style].rules.hasOwnProperty(clause)) continue;
|
||||
rules += clause + ":" + customStyles[style].rules[clause] + "!important;";
|
||||
}
|
||||
|
||||
this.addCSSRule(sheet, customStyles[style].selector, rules, 0);
|
||||
}
|
||||
|
||||
if (callback) callback();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue