1
0
Fork 0
mirror of https://github.com/Yetangitu/owncloud-apps.git synced 2025-10-02 14:49:17 +02:00

More and more and more changes, but still not quite there.

This commit is contained in:
frankdelange 2017-02-21 02:14:50 +01:00
parent 58f5bada7f
commit e8f6632214
30 changed files with 4769 additions and 357 deletions

View file

@ -1,33 +0,0 @@
/* For iPad portrait layouts only */
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: portrait) {
#viewer iframe {
width: 460px;
height: 740px;
}
}
/*For iPad landscape layouts only */
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: landscape) {
#viewer iframe {
width: 460px;
height: 415px;
}
}
/* For iPhone portrait layouts only */
@media only screen and (max-device-width: 480px) and (orientation: portrait) {
#viewer {
width: 256px;
height: 432px;
}
#viewer iframe {
width: 256px;
height: 432px;
}
}
/* For iPhone landscape layouts only */
@media only screen and (max-device-width: 480px) and (orientation: landscape) {
#viewer iframe {
width: 256px;
height: 124px;
}
}

BIN
reader/js/.ready.js.swp Normal file

Binary file not shown.

318
reader/js/epubreader.js Normal file
View file

@ -0,0 +1,318 @@
EPUBJS.reader = {};
EPUBJS.reader.plugins = {}; //-- Attach extra Controllers as plugins (like search?)
(function(root, $) {
var previousReader = root.ePubReader || {};
var ePubReader = root.ePubReader = function(path, options) {
return new EPUBJS.Reader(path, options);
};
//exports to multiple environments
if (typeof define === 'function' && define.amd) {
//AMD
define(function(){ return Reader; });
} else if (typeof module != "undefined" && module.exports) {
//Node
module.exports = ePubReader;
}
})(window, jQuery);
EPUBJS.Reader = function(bookPath, _options) {
var reader = this;
var book;
var plugin;
var $viewer = $("#viewer");
var search = window.location.search;
var parameters;
this.settings = EPUBJS.core.defaults(_options || {}, {
bookPath : bookPath,
restore : false,
reload : false,
bookmarks : undefined,
annotations : undefined,
contained : undefined,
bookKey : undefined,
styles : undefined,
sidebarReflow: false,
generatePagination: false,
history: true
});
// Overide options with search parameters
if(search) {
parameters = search.slice(1).split("&");
parameters.forEach(function(p){
var split = p.split("=");
var name = split[0];
var value = split[1] || '';
reader.settings[name] = decodeURIComponent(value);
});
}
this.setBookKey(this.settings.bookPath); //-- This could be username + path or any unique string
if(this.settings.restore && this.isSaved()) {
this.applySavedSettings();
}
this.settings.styles = this.settings.styles || {
fontSize : "100%"
};
this.book = book = new EPUBJS.Book(this.settings);
if(this.settings.previousLocationCfi) {
book.gotoCfi(this.settings.previousLocationCfi);
}
this.offline = false;
this.sidebarOpen = false;
if(!this.settings.bookmarks) {
this.settings.bookmarks = [];
}
if(!this.settings.annotations) {
this.settings.annotations = [];
}
if(this.settings.generatePagination) {
book.generatePagination($viewer.width(), $viewer.height());
}
book.renderTo("viewer");
reader.ReaderController = EPUBJS.reader.ReaderController.call(reader, book);
reader.SettingsController = EPUBJS.reader.SettingsController.call(reader, book);
reader.ControlsController = EPUBJS.reader.ControlsController.call(reader, book);
reader.SidebarController = EPUBJS.reader.SidebarController.call(reader, book);
reader.BookmarksController = EPUBJS.reader.BookmarksController.call(reader, book);
reader.NotesController = EPUBJS.reader.NotesController.call(reader, book);
// Call Plugins
for(plugin in EPUBJS.reader.plugins) {
if(EPUBJS.reader.plugins.hasOwnProperty(plugin)) {
reader[plugin] = EPUBJS.reader.plugins[plugin].call(reader, book);
}
}
book.ready.all.then(function() {
reader.ReaderController.hideLoader();
});
book.getMetadata().then(function(meta) {
reader.MetaController = EPUBJS.reader.MetaController.call(reader, meta);
});
book.getToc().then(function(toc) {
reader.TocController = EPUBJS.reader.TocController.call(reader, toc);
});
window.addEventListener("beforeunload", this.unload.bind(this), false);
window.addEventListener("hashchange", this.hashChanged.bind(this), false);
document.addEventListener('keydown', this.adjustFontSize.bind(this), false);
book.on("renderer:keydown", this.adjustFontSize.bind(this));
book.on("renderer:keydown", reader.ReaderController.arrowKeys.bind(this));
book.on("renderer:selected", this.selectedRange.bind(this));
return this;
};
EPUBJS.Reader.prototype.adjustFontSize = function(e) {
var fontSize;
var interval = 2;
var PLUS = 187;
var MINUS = 189;
var ZERO = 48;
var MOD = (e.ctrlKey || e.metaKey );
if(!this.settings.styles) return;
if(!this.settings.styles.fontSize) {
this.settings.styles.fontSize = "100%";
}
fontSize = parseInt(this.settings.styles.fontSize.slice(0, -1));
if(MOD && e.keyCode == PLUS) {
e.preventDefault();
this.book.setStyle("fontSize", (fontSize + interval) + "%");
}
if(MOD && e.keyCode == MINUS){
e.preventDefault();
this.book.setStyle("fontSize", (fontSize - interval) + "%");
}
if(MOD && e.keyCode == ZERO){
e.preventDefault();
this.book.setStyle("fontSize", "100%");
}
};
EPUBJS.Reader.prototype.addBookmark = function(cfi) {
var present = this.isBookmarked(cfi);
if(present > -1 ) return;
this.settings.bookmarks.push(cfi);
this.trigger("reader:bookmarked", cfi);
};
EPUBJS.Reader.prototype.removeBookmark = function(cfi) {
var bookmark = this.isBookmarked(cfi);
if( bookmark === -1 ) return;
this.settings.bookmarks.splice(bookmark, 1);
this.trigger("reader:unbookmarked", bookmark);
};
EPUBJS.Reader.prototype.isBookmarked = function(cfi) {
var bookmarks = this.settings.bookmarks;
return bookmarks.indexOf(cfi);
};
/*
EPUBJS.Reader.prototype.searchBookmarked = function(cfi) {
var bookmarks = this.settings.bookmarks,
len = bookmarks.length,
i;
for(i = 0; i < len; i++) {
if (bookmarks[i]['cfi'] === cfi) return i;
}
return -1;
};
*/
EPUBJS.Reader.prototype.clearBookmarks = function() {
this.settings.bookmarks = [];
};
//-- Notes
EPUBJS.Reader.prototype.addNote = function(note) {
this.settings.annotations.push(note);
};
EPUBJS.Reader.prototype.removeNote = function(note) {
var index = this.settings.annotations.indexOf(note);
if( index === -1 ) return;
delete this.settings.annotations[index];
};
EPUBJS.Reader.prototype.clearNotes = function() {
this.settings.annotations = [];
};
//-- Settings
EPUBJS.Reader.prototype.setBookKey = function(identifier){
if(!this.settings.bookKey) {
this.settings.bookKey = "epubjsreader:" + EPUBJS.VERSION + ":" + window.location.host + ":" + identifier;
}
return this.settings.bookKey;
};
//-- Checks if the book setting can be retrieved from localStorage
EPUBJS.Reader.prototype.isSaved = function(bookPath) {
var storedSettings;
if(!localStorage) {
return false;
}
storedSettings = localStorage.getItem(this.settings.bookKey);
if(storedSettings === null) {
return false;
} else {
return true;
}
};
EPUBJS.Reader.prototype.removeSavedSettings = function() {
if(!localStorage) {
return false;
}
localStorage.removeItem(this.settings.bookKey);
};
EPUBJS.Reader.prototype.applySavedSettings = function() {
var stored;
if(!localStorage) {
return false;
}
try {
stored = JSON.parse(localStorage.getItem(this.settings.bookKey));
} catch (e) { // parsing error of localStorage
return false;
}
if(stored) {
// Merge styles
if(stored.styles) {
this.settings.styles = EPUBJS.core.defaults(this.settings.styles || {}, stored.styles);
}
// Merge the rest
this.settings = EPUBJS.core.defaults(this.settings, stored);
return true;
} else {
return false;
}
};
EPUBJS.Reader.prototype.saveSettings = function(){
if(this.book) {
this.settings.previousLocationCfi = this.book.getCurrentLocationCfi();
}
if(!localStorage) {
return false;
}
localStorage.setItem(this.settings.bookKey, JSON.stringify(this.settings));
};
EPUBJS.Reader.prototype.unload = function(){
if(this.settings.restore && localStorage) {
this.saveSettings();
}
};
EPUBJS.Reader.prototype.hashChanged = function(){
var hash = window.location.hash.slice(1);
this.book.goto(hash);
};
EPUBJS.Reader.prototype.selectedRange = function(range){
var epubcfi = new EPUBJS.EpubCFI();
var cfi = epubcfi.generateCfiFromRangeAnchor(range, this.book.renderer.currentChapter.cfiBase);
var cfiFragment = "#"+cfi;
// Update the History Location
if(this.settings.history &&
window.location.hash != cfiFragment) {
// Add CFI fragment to the history
history.pushState({}, '', cfiFragment);
this.currentLocationCfi = cfi;
}
};
//-- Enable binding events to reader
RSVP.EventTarget.mixin(EPUBJS.Reader.prototype);

View file

@ -14,7 +14,7 @@ function addStyleSheet() {
function getCSSRule(sheet, selector, del) {
lcSelector = selector.toLowerCase();
for ( var i=0; i<sheet.cssRules.length; i++) {
for (var i=0; i<sheet.cssRules.length; i++) {
if (sheet.cssRules.item(i).selectorText.toLowerCase() == lcSelector) {
if (del) {
sheet.deleteRule(i);
@ -28,6 +28,10 @@ function getCSSRule(sheet, selector, del) {
}
function addCSSRule(sheet, selector, rules, index) {
if (index === undefined) {
index = 0;
}
if("insertRule" in sheet) {
sheet.insertRule(selector + "{" + rules + "}", index);
}
@ -40,13 +44,6 @@ function delCSSRule(sheet, selector) {
getCSSRule(sheet, selector, true);
}
/*function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}*/
function getUrlParameter(param){
var pattern = new RegExp('[?&]'+param+'((=([^&]*))|(?=(&|$)))','i');
var m = window.location.search.match(pattern);
@ -54,16 +51,39 @@ function getUrlParameter(param){
}
function renderEpub(file) {
// only enable close button when launched in an iframe
if (parent !== window) {
$('#close').show();
$('#close').on('click', function() { reader.book.destroy(); parent.OCA.Files_Reader.Plugin.hide(); });
}
// some defaults
EPUBJS.session = {};
EPUBJS.session.version = $('.session').data('version');
/*
EPUBJS.session.filename = filename;
EPUBJS.session.title = filename.replace(/\.[^/.]+$/, '');
EPUBJS.session.format = filename.toLowerCase().match(re_file_ext)[1];
*/
EPUBJS.session.metadata = $('.session').data('metadata') || {};
EPUBJS.session.fileId = $('.session').data('fileid') || "";
EPUBJS.session.scope = $('.session').data('scope') || "";
EPUBJS.session.cursor = $('.session').data('cursor') || {};
EPUBJS.session.defaults = $('.session').data('defaults') || {};
EPUBJS.session.preferences = $('.session').data('preferences') || {};
EPUBJS.session.defaults = $('.session').data('defaults') || {};
EPUBJS.basePath = $('.session').data('basepath');
EPUBJS.downloadLink = $('.session').data('downloadlink');
// some parameters...
EPUBJS.filePath = "vendor/epubjs/";
EPUBJS.cssPath = "css/";
// user-configurable options
EPUBJS.options = {};
// user-configurable styles
EPUBJS.styles = {};
var reader = ePubReader(file, { contained: true });
// touch-enabled devices...
$('#touch_nav').prop('checked', !('ontouchstart' in document.documentElement));
if (!($('#touch_nav').prop('checked'))) {
@ -73,7 +93,11 @@ function renderEpub(file) {
// idevices...
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', document.getElementsByTagName("base").item(0).href + 'css/idevice.css'));
$('head').append($('<script type="text/javascript" />')
.attr('src', document.getElementsByTagName("base").item(0).href + 'vendor/bgrins/spectrum.js' + "?v=" + $('.session').data('version'))
.attr('nonce', $('.session').data('nonce')));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', document.getElementsByTagName("base").item(0).href + 'vendor/bgrins/spectrum.css' + "?v=" + $('.session').data('version')));
}
// IE < 11
@ -86,52 +110,163 @@ function renderEpub(file) {
wgxpath.install(window);
}
function nightModeConfig() {
delCSSRule(EPUBJS.nightSheet, EPUBJS.nightSelector);
addCSSRule(EPUBJS.nightSheet, EPUBJS.nightSelector, 'color: ' + EPUBJS.nightModeColor + ' !important; background: ' + EPUBJS.nightModeBackground + ' !important;');
}
/* user style settings */
EPUBJS.userSheet = addStyleSheet();
// construct a custom mode
function modeConfig(mode) {
var rule = "",
undo_rule = "",
selector = "." + mode.classname + " *",
annulator = ".no" + mode.classname + " *";
delCSSRule(EPUBJS.userSheet, selector);
for (var clause in mode.rules) {
rule += clause + ": " + mode.rules[clause] + " !important;";
undo_rule += clause + ": initial !important;";
}
addCSSRule(EPUBJS.userSheet, selector, rule, 0);
addCSSRule(EPUBJS.userSheet, annulator, undo_rule, 0);
if (mode.extra) {
addCSSRule(EPUBJS.userSheet, mode.extra[0], mode.extra[1], 0);
}
};
// just switching in the "day" classname works on some browsers but not on others, hence the trickery with
// setStyle/removeStyle...
//
// call this with 'style' set to enable a custom style (or change to a different one),
// call this without parameters to disable custom styles
function toggleCustom (style) {
if (style) {
if (EPUBJS.styles.active) {
toggleCustom();
}
EPUBJS.styles.active = style;
$("#outerContainer").addClass(EPUBJS.styles.active.classname);
// and, just in case...
$("#outerContainer").removeClass("night");
EPUBJS.nightMode = false;
for (var clause in EPUBJS.styles.active.rules) {
reader.book.setStyle(clause, EPUBJS.styles.active.rules[clause]);
}
} else {
if (EPUBJS.styles.active) {
$("#outerContainer").removeClass(EPUBJS.styles.active.classname);
for (var clause in EPUBJS.styles.active.rules) {
reader.book.removeStyle(clause);
}
delete EPUBJS.styles.active;
}
}
};
// night mode is not a normal custom style. It can be
// applied at the same time as custom styles (which it overrules).
// Custom styles will be restored when night mode is disabled
function toggleNight () {
if (EPUBJS.nightMode) {
EPUBJS.nightMode = false;
EPUBJS.styles.active = EPUBJS.styles.nightMode;
toggleCustom();
if (EPUBJS.styles.inactive) {
toggleCustom (EPUBJS.styles.inactive);
delete EPUBJS.styles.inactive;
}
} else {
EPUBJS.nightMode = true;
if (EPUBJS.styles.active) {
EPUBJS.styles.inactive = EPUBJS.styles.active;
toggleCustom();
}
for (var clause in EPUBJS.styles.nightMode.rules) {
reader.book.setStyle(clause, EPUBJS.styles.nightMode.rules[clause]);
}
$("#outerContainer").addClass(EPUBJS.styles.nightMode.classname);
}
};
// dayMode (custom colours)
EPUBJS.styles.dayMode = {};
EPUBJS.styles.dayMode.rules = {};
EPUBJS.styles.dayMode.classname = "day";
EPUBJS.styles.dayMode.rules.color = $('#day_color').val();
EPUBJS.styles.dayMode.rules.background = $('#day_background').val();
// nightMode
EPUBJS.styles.nightMode = {};
EPUBJS.styles.nightMode.rules = {};
EPUBJS.styles.nightMode.classname = "night";
EPUBJS.styles.nightMode.rules.color = $('#night_color').val();
EPUBJS.styles.nightMode.rules.background = $('#night_background').val();
modeConfig(EPUBJS.styles.dayMode);
modeConfig(EPUBJS.styles.nightMode);
$('#day_background').on('change', function() {
EPUBJS.styles.dayMode.rules.background = $('#day_background').val();
modeConfig(EPUBJS.styles.dayMode);
});
$('#day_color').on('change', function() {
EPUBJS.styles.dayMode.rules.color = $('#day_color').val();
modeConfig(EPUBJS.styles.dayMode);
});
// nightMode
EPUBJS.nightMode = false;
EPUBJS.nightSheet = addStyleSheet();
EPUBJS.nightSelector = '.night *';
EPUBJS.nightModeBackground = $('#nightModeBackground').val();
EPUBJS.nightModeColor = $('#nightModeColor').val();
addCSSRule(EPUBJS.nightSheet, '.nonight', 'background: initial !important;');
nightModeConfig();
$('#nightModeBackground').on('change', function() {
EPUBJS.nightModeBackground = $('#nightModeBackground').val();
nightModeConfig();
$('#night_background').on('change', function() {
EPUBJS.styles.nightMode.rules.background = $('#night_background').val();
modeConfig(EPUBJS.styles.nightMode);
});
$('#nightModeColor').on('change', function() {
EPUBJS.nightModeColor = $('#nightModeColor').val();
nightModeConfig();
$('#night_color').on('change', function() {
EPUBJS.styles.nightMode.rules.color = $('#night_color').val();
modeConfig(EPUBJS.styles.nightMode);
});
//var reader = ePubReader(document.getElementById("dllink").value, { contained: true });
var reader = ePubReader(file, { contained: true });
// enable day mode switch
$('#use_custom_colors').on('change', function () {
console.log("click!");
if ($(this).prop('checked')) {
toggleCustom(EPUBJS.styles.dayMode);
} else {
toggleCustom();
}
});
// enable night/day mode switch by clicking on the book title/author
// just switching in the "night" class works on some browsers but not on others, hence the trickery with
// setStyle/removeStyle...
$('#metainfo').on('click', function() {
if(EPUBJS.nightMode) {
reader.book.removeStyle("background");
reader.book.removeStyle("color");
$("#outerContainer").removeClass("night");
EPUBJS.nightMode = false;
} else {
reader.book.setStyle("background", EPUBJS.nightModeBackground);
reader.book.setStyle("color", EPUBJS.nightModeColor);
$("#outerContainer").addClass("night");
EPUBJS.nightMode = true;
}
});
// enable night mode switch
$('#metainfo').on('click', toggleNight);
// extra-wide page turn area?
$('#touch_nav').on('click', function() {
$('#touch_nav').on('change', function() {
if ($('#touch_nav').prop('checked')) {
$("#prev").removeClass("touch_nav");
$("#next").removeClass("touch_nav");
@ -140,24 +275,33 @@ function renderEpub(file) {
$("#next").addClass("touch_nav");
}
});
// page width
$("#page_width").on("change", function () {
EPUBJS.options.page_width = $(this).val();
$("#viewer").css("max-width", EPUBJS.options.page_width + "em");
});
// user-defined font
EPUBJS.ignore_css = false;
EPUBJS.bookFrame = null;
EPUBJS.user_fontFamily = $('#fontFamily').val();
EPUBJS.user_fontSize = $('#fontSize').val() + '%';
EPUBJS.options.font_family = $('#font_family').val();
EPUBJS.options.font_size = $('#font_size').val() + '%';
$('#font_example').css('font-size', EPUBJS.options.font_size);
$('#font_example').css('font-family', EPUBJS.options.font_family);
$('#ignore_css').on('click', function() {
EPUBJS.bookFrame = document.getElementsByTagName('iframe')[0].contentDocument;
if ($('#ignore_css').prop('checked')) {
$('#fontFamily').prop('disabled',false);
$('#fontSize').prop('disabled',false);
$('#font_family').prop('disabled',false);
$('#font_size').prop('disabled',false);
EPUBJS.ignore_css = true;
reader.book.setStyle('font-size', EPUBJS.user_fontSize);
reader.book.setStyle('font-family', EPUBJS.user_fontFamily);
reader.book.setStyle('font-size', EPUBJS.options.font_size);
reader.book.setStyle('font-family', EPUBJS.options.font_family);
} else {
$('#fontFamily').prop('disabled',true);
$('#fontSize').prop('disabled',true);
$('#font_family').prop('disabled',true);
$('#font_size').prop('disabled',true);
EPUBJS.ignore_css = false;
reader.book.removeStyle('font-size');
reader.book.removeStyle('font-family');
@ -166,16 +310,31 @@ function renderEpub(file) {
;
});
$('#fontSize').on('change', function() {
EPUBJS.user_fontSize = $('#fontSize').val() + '%';
$('#font_example').css('font-size', EPUBJS.user_fontSize);
reader.book.setStyle('font-size', EPUBJS.user_fontSize);
$('#font_size').on('change', function() {
EPUBJS.options.font_size = $(this).val() + '%';
$('#font_example').css('font-size', EPUBJS.options.font_size);
reader.book.setStyle('font-size', EPUBJS.options.font_size);
});
$('#fontFamily').on('change', function() {
EPUBJS.user_fontFamily = $('#fontFamily').val();
$('#font_example').css('font-family', EPUBJS.user_fontFamily);
reader.book.setStyle('font-family', EPUBJS.user_fontFamily);
$('#font_family').on('change', function() {
EPUBJS.options.font_family = $(this).val();
$('#font_example').css('font-family', EPUBJS.options.font_family);
reader.book.setStyle('font-family', EPUBJS.options.font_family);
});
// only enable close button when launched in an iframe
if (parent !== window) {
$('#close').show();
$('#close').on('click', function() { reader.book.destroy(); parent.OCA.Files_Reader.Plugin.hide(); });
}
// connect event handlers
//
//reader.book.ready.all.then(function () {
// reader.book.on('renderer:locationChanged', function(location){
// console.log(location);
// });
//});
}
function renderCbr(file) {

View file

@ -0,0 +1,35 @@
<?php
/**
* @author Frank de Lange
* @copyright 2015 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\Db;
use OCP\AppFramework\Db\Entity;
class ReaderEntity extends Entity {
/* returns decoded json if input is json, otherwise returns input */
public static function conditional_json_decode($el) {
$result = json_decode($el);
if (json_last_error() === JSON_ERROR_NONE) {
return $result;
} else {
return $el;
}
}
public function toService() {
return [
'name' => $this->getName(),
'value' => $this->conditional_json_decode($this->getValue()),
'lastModified' => $this->getLastModified(),
];
}
}

Binary file not shown.

View file

@ -9,9 +9,8 @@
$defaults = $_['defaults'];
$preferences = $_['preferences'];
$metadata = $_['metadata'];
$revision = '0017';
$revision = '0020';
$version = \OCP\App::getAppVersion('files_reader') . '.' . $revision;
error_log("file_id: " . $fileId);
/* Owncloud currently does not implement CSPv3, remove this test when it does */
$nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
@ -21,7 +20,7 @@
<html dir="ltr">
<head class="session" data-downloadlink='<?php print_unescaped($downloadLink);?>' data-fileid='<?php print_unescaped($fileId);?>' data-basepath='<?php p($urlGenerator->linkTo('files_reader',''));?>' data-scope='<?php print_unescaped($scope);?>' data-cursor='<?php print_unescaped($cursor);?>' data-defaults='<?php print_unescaped($defaults);?>' data-preferences='<?php print_unescaped($preferences);?>' data-metadata='<?php print_unescaped($metadata);?>'>
<head class="session" data-nonce='<?php p($nonce);?>' data-downloadlink='<?php print_unescaped($downloadLink);?>' data-fileid='<?php print_unescaped($fileId);?>' data-basepath='<?php p($urlGenerator->linkTo('files_reader',''));?>' data-scope='<?php print_unescaped($scope);?>' data-cursor='<?php print_unescaped($cursor);?>' data-defaults='<?php print_unescaped($defaults);?>' data-preferences='<?php print_unescaped($preferences);?>' data-metadata='<?php print_unescaped($metadata);?>'>
<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">
@ -114,7 +113,9 @@
<div data-trigger="click" data-action="navigation" data-navigate-side="left" class="cbr-control navigate navigate-left control" name="navigateLeft">
<span class="icon-navigate_before"></span>
</div>
<!-- toggle toolbar (disabled)
<div data-trigger="click" data-action="toggleToolbar" class="toggle-controls control" name="toggleToolbar"></div>
-->
<div data-trigger="click" data-action="navigation" data-navigate-side="right" class="cbr-control navigate navigate-right control" name="navigateRight">
<span class="icon-navigate_next"></span>
</div>
@ -129,12 +130,12 @@
<!-- /inline progressbar -->
<!-- sidebar -->
<div class="sidebar control" name="sidebar">
<div class="sidebar control" name="sidebar" id="sidebar">
<div class="panels">
<div class="pull-left">
<button data-trigger="click" data-action="showToc" title="show table of contents" class="icon-format_list_numbered toc-view open"></button>
<button data-trigger="click" data-action="showBookSettings" title="show book settings" class="icon-rate_review book-settings-view"></button>
<button data-trigger="click" data-action="showSettings" title="show settings" class="icon-settings settings-view"></button>
<button data-trigger="click" data-action="showToc" title="Table of Contents" class="icon-format_list_numbered toc-view open"></button>
<button data-trigger="click" data-action="showBookSettings" title="Book settings" class="icon-rate_review book-settings-view"></button>
<button data-trigger="click" data-action="showSettings" title="Default settings" class="icon-settings settings-view"></button>
</div>
<div class="pull-right">
<button id="toc-populate" data-trigger="click" data-action="tocPopulate" title="generate thumbnails" class="icon-sync" style="display:none"></button>
@ -192,18 +193,35 @@
</div>
</div>
<div class="settings-view view">
<div class="settings-container" name="settings" id="thumbnail-settings">
<div class="settings-container" name="thumbnail-settings" id="thumbnail-settings">
<label for="thumbnail-settings">Thumbnails</label>
<form name="settings" data-trigger="reset" data-action="resetSettings">
<div class="control-group pull-left">
<input id="thumbnail-generate" data-trigger="change" data-action="thumbnails" type="checkbox">
<label for="thumbnail-generate">Thumbnails in index </label>
</div>
<div class="control-group pull-left">
<label for="thumbnail-width">Thumbnail width:</label>
<input id="thumbnail-width" data-trigger="change" data-action="thumbnailWidth" type="number" min="50" max="500" step="10" value="200" >
<label for="thumbnail-width">px</label>
</div>
</div>
<div class="settings-container" name="sidebar-settings" id="sidebar-settings">
<label for="sidebar-settings">Sidebar</label>
<form name="sidebar-preferences" data-trigger="reset" data-action="resetSidebar">
<div class="control-group pull-left">
<input id="thumbnail-generate" data-trigger="change" data-action="thumbnails" type="checkbox">
<label for="thumbnail-generate">Use thumbnails in index </label>
<input id="thumbnail-width" data-trigger="change" data-action="thumbnailWidth" type="number" min="50" max="500" step="10" value="200" >
<label for="thumbnail-width">Thumbnail width</label>
<input id="sidebar-wide" data-trigger="change" data-action="sidebarWide" type="checkbox">
<label for="sidebar-wide">Use extra-wide sidebar</label>
</div>
<div class="control-group pull-left">
<label for="sidebar-width">Sidebar width:</label>
<input id="sidebar-width" data-trigger="change" data-action="sidebarWidth" type="number" min="5" max="100" step="1" value="20" >
<label for="sidebar-width">%</label>
</div>
<div class="control-group pull-right">
<input type="reset" value="reset">
</div>
</form>
</div>
</div>
</div>
<!-- /sidebar -->

View file

@ -1,9 +1,16 @@
<?php
/** @var array $_ */
/** @var array $_ */
/** @var OCP\IURLGenerator $urlGenerator */
$urlGenerator = $_['urlGenerator'];
$version = \OCP\App::getAppVersion('files_reader');
$dllink = isset($_GET['file']) ? $_GET['file'] : '';
$downloadLink = $_['downloadLink'];
$fileId = $_['fileId'];
$scope = $_['scope'];
$cursor = $_['cursor'];
$defaults = $_['defaults'];
$preferences = $_['preferences'];
$metadata = $_['metadata'];
$revision = '0021';
$version = \OCP\App::getAppVersion('files_reader') . '.' . $revision;
/* Owncloud currently does not implement CSPv3, remove this test when it does */
$nonce = class_exists('\OC\Security\CSP\ContentSecurityPolicyNonceManager')
@ -12,185 +19,238 @@
?>
<html dir="ltr">
<head>
<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',''));?>">
<title>
<?php p($_['title']);?>
</title>
<link rel="shortcut icon" href="img/book.png">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/popup.css">
<link rel="stylesheet" href="css/tooltip.css">
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/typedarray.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/Blob.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/wgxpath.install.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/libs/jquery.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/libs/screenfull.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/libs/zip.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/epub.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/hooks.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/hooks/extensions/highlight.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/reader.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/ready.js')) ?>?v=<?php p($version) ?>"> </script>
</head>
<body>
<input type="hidden" id="dllink" value="<?php print_unescaped($dllink);?>">
<div id="outerContainer">
<div id="sidebar">
<div id="panels">
<input id="searchBox" placeholder="not implemented yet" type="search" disabled="">
<a id="show-Search" class="show_view icon-search" data-view="Search">
<?php p($l->t("Search")); ?>
</a>
<a id="show-Toc" class="show_view icon-list-1 active" data-view="Toc">
<?php p($l->t("TOC")); ?>
</a>
<a id="show-Bookmarks" class="show_view icon-bookmark" data-view="Bookmarks">
<?php p($l->t("Bookmarks")); ?>
</a>
<a id="show-Notes" class="show_view icon-edit" data-view="Notes">
<?php p($l->t("Notes")); ?>
</a>
<head class="session" data-nonce='<?php p($nonce);?>' data-downloadlink='<?php print_unescaped($downloadLink);?>' data-fileid='<?php print_unescaped($fileId);?>' data-version='<?php print_unescaped($version);?>' data-basepath='<?php p($urlGenerator->linkTo('files_reader',''));?>' data-scope='<?php print_unescaped($scope);?>' data-cursor='<?php print_unescaped($cursor);?>' data-defaults='<?php print_unescaped($defaults);?>' data-preferences='<?php print_unescaped($preferences);?>' data-metadata='<?php print_unescaped($metadata);?>'>
<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',''));?>">
<title>
<?php p($_['title']);?>
</title>
<link rel="shortcut icon" href="img/book.png">
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/css/main.css')) ?>?v=<?php p($version) ?>"> </script>
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/css/sidebar.css')) ?>?v=<?php p($version) ?>"> </script>
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/css/popup.css')) ?>?v=<?php p($version) ?>"> </script>
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/css/tooltip.css')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/typedarray.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/Blob.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/lib/wgxpath.install.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/libs/jquery.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/bartaz/jquery.highlight.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/sindresorhus/screenfull.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/libs/zip.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/epub.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/hooks.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/hooks/extensions/highlight.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/reader.min.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'vendor/epubjs/plugins/search.js')) ?>?v=<?php p($version) ?>"> </script>
<script type="text/javascript" nonce="<?php p($nonce) ?>" src="<?php p($urlGenerator->linkTo('files_reader', 'js/ready.js')) ?>?v=<?php p($version) ?>"> </script>
</head>
<body>
<div id="outerContainer">
<!-- sidebar -->
<div id="sidebar" class="sidebar">
<div id="panels" class="panels">
<div class="pull-left">
<button id="show-Toc" class="show_view icon-list-1 open" title="Table of Contents" data-view="Toc"></button>
<button id="show-Bookmarks" class="show_view icon-bookmark" title="Bookmarks" data-view="Bookmarks"></button>
<button id="show-Search" class="show_view icon-search" title="Search" data-view="Search"></button>
<button id="show-Notes" class="show_view icon-edit" title="Notes" data-view="Notes"></button>
<button id="show-Settings" class="show_view icon-cog" title="Settings" data-view="Settings"></button>
</div>
<div class="pull-right">
<button id="close-Sidebar" class="close_sidebar icon-right" title="Close sidebar"></button>
</div>
</div>
<div id="tocView" class="toc-view view open">
</div>
<div id="bookmarksView" class="bookmarks-view view">
<ul id="bookmarks">
</ul>
</div>
<div id="searchView" class="view search-view">
<div>
<div class="search-input">
<input id="searchBox" class="searchbox" placeholder="search..." type="input">
<span title="Clear">x</span>
</form>
</div>
<ul id="searchResults" class="search-results">
</ul>
</div>
</div>
<div id="notesView" class="notes-view view">
<div id="new-note" class="new-note">
<textarea id="note-text" class="note-text">
</textarea>
<button id="note-anchor" class="note-anchor">Anchor</button>
</div>
<ol id="notes" class="notes">
</ol>
</div>
<div id="settingsView" class="settings-view view">
<fieldset class="settings-container" name="font-settings">
<legend>font</legend>
<div class="control-group">
<input type="checkbox" id="ignore_css" name="ignore_css">
<label for="ignore_css">use custom font</label>
<div class="center-box">
<select id="font_family" disabled="">
<option value="verdana, trebuchet, droid sans serif, sans, sans-serif"> sans </option>
<option value="georgia, times new roman, droid serif, serif"> serif </option>
<option value="monospace"> monospace </option>
</select>
at <input type="number" id="font_size" value="100" min="50" max="150" disabled=""> %
</div>
<div id="font_example" class="user font_example">
<div>
Et nos esse veri viri scire volemus
</div>
</div>
</div>
</fieldset>
<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 class="day font_example">
<div>
Et nos esse veri viri scire volemus
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>night</legend>
<div class="control-group">
<div class="center-box">
<input type="color" id="night_color" value="#3a516b">
on
<input type="color" id="night_background" value="#000000">
</div>
<div class="night font_example">
<div>
Et nos esse veri viri scire volemus
</div>
</div>
</div>
</fieldset>
</fieldset>
<fieldset class="settings-container" name="display-settings">
<legend>display</legend>
<fieldset>
<legend>page width</legend>
<div class="control-group center-box">
maximum <input type="number" id="page_width" value="72" min="25" max="200"> characters
</div>
</fieldset>
<div class="control-group">
<input type="checkbox" id="sidebarReflow" name="sidebarReflow">
<label for="sidebarReflow">
<?php p($l->t("reflow text when sidebars are open.")); ?>
</label>
</div>
<div class="control-group">
<input type="checkbox" id="touch_nav" name="touch_nav">
<label for="touch_nav" class="tooltip">
<?php p($l->t("disable extra-wide page turn areas")); ?>
<span>
<?php p($l->t("the extra-wide page turn areas as used by default on touch-screen devices interfere with the ability to select links in ebooks. when this option is enabled, the page-turn area is always outside the ebook margins so links are reachable.")); ?>
</span>
</label>
</div>
</fieldset>
</div>
</div>
<div id="tocView" class="view">
<!-- /sidebar -->
<!-- main -->
<div id="main">
<!-- titlebar -->
<div id="titlebar">
<div id="opener" class="pull-left">
<a id="slider" class="icon-menu">
<?php p($l->t("menu")); ?>
</a>
</div>
<div id="metainfo">
<span id="book-title">
</span>
<span id="title-seperator">
    
</span>
<span id="chapter-title">
</span>
</div>
<div id="title-controls" class="pull-right">
<a id="bookmark" class="icon-bookmark-empty">
<?php p($l->t("bookmark")); ?>
</a>
<a id="setting" class="icon-cog">
<?php p($l->t("settings")); ?>
</a>
<a id="fullscreen" class="icon-resize-full">
<?php p($l->t("fullscreen")); ?>
</a>
<a id="close" class="icon-cancel-circled2" style="display:none">
<?php p($l->t("close")); ?>
</a>
</div>
</div>
<!-- /titlebar -->
<!-- divider -->
<div id="divider">
</div>
<!-- /divider -->
<!-- navigation + viewer -->
<div id="prev" class="arrow noday nonight">
<div class="noday nonight">
</div>
</div>
<div id="viewer">
</div>
<div id="next" class="arrow noday nonight">
<div class="noday nonight">
</div>
</div>
<div id="loader" class="noday nonight">
<img src="img/loading.gif">
</div>
<!-- /navigation + viewer -->
</div>
<div id="searchView" class="view">
<ul id="searchResults">
</ul>
<!-- /main -->
<div class="overlay noday nonight">
</div>
<div id="bookmarksView" class="view">
<ul id="bookmarks">
</ul>
</div>
<div id="notesView" class="view">
<div id="new-note">
<textarea id="note-text">
</textarea>
<button id="note-anchor">
<?php p($l->t("Anchor")); ?>
</button>
</div>
<ol id="notes">
</ol>
</div>
</div>
<div id="main">
<div id="titlebar">
<div id="opener">
<a id="slider" class="icon-menu">
<?php p($l->t("Menu")); ?>
</a>
</div>
<div id="metainfo">
<span id="book-title">
</span>
<span id="title-seperator">
    
</span>
<span id="chapter-title">
</span>
</div>
<div id="title-controls">
<a id="bookmark" class="icon-bookmark-empty">
<?php p($l->t("Bookmark")); ?>
</a>
<a id="setting" class="icon-cog">
<?php p($l->t("Settings")); ?>
</a>
<a id="fullscreen" class="icon-resize-full">
<?php p($l->t("Fullscreen")); ?>
</a>
<a id="close" class="icon-cancel-circled2" style="display:none">
<?php p($l->t("Close")); ?>
</a>
</div>
</div>
<div id="divider">
</div>
<div id="prev" class="arrow nonight">
<div class="nonight">
</div>
</div>
<div id="viewer">
</div>
<div id="next" class="arrow nonight">
<div class="nonight">
</div>
</div>
<div id="loader" class="nonight">
<img src="img/loading.gif">
</div>
</div>
<div class="modal md-effect-1" id="settings-modal">
<div class="md-content">
<h3>
<?php p($l->t("Settings")); ?>
</h3>
<div>
<p>
<input type="checkbox" id="ignore_css" name="ignore_css">
<label for="ignore_css">
<?php p($l->t("Always use")); ?>
</label>
<select id="fontFamily" disabled="">
<option value="verdana, trebuchet, droid sans serif, sans, sans-serif">
Sans
</option>
<option value="georgia, times new roman, droid serif, serif">
Serif
</option>
<option value="monospace">
Monospace
</option>
</select>
<?php p($l->t("font scaled to")); ?>
<input type="number" id="fontSize" value="100" min="50" max="150" disabled="">
%
</p>
<div id="font_example" class="user">
<?php p($l->t("Et nos esse veri viri scire volemus")); ?>
</div>
<p>
<input type="checkbox" id="sidebarReflow" name="sidebarReflow">
<label for="sidebarReflow">
<?php p($l->t("Reflow text when sidebars are open.")); ?>
</label>
</p>
<p>
<?php p($l->t("Night mode background")); ?>
<input type="color" id="nightModeBackground" value="#000000">
<?php p($l->t("and text")); ?>
<input type="color" id="nightModeColor" value="#3A516B">
<?php p($l->t("colour")); ?>
</p>
<div id="nightModeExample" class="night">
<div>
Et nos esse veri viri scire volemus
</div>
</div>
<p>
<input type="checkbox" id="touch_nav" name="touch_nav">
<label for="touch_nav" class="tooltip">
<?php p($l->t("Disable extra-wide page turn areas")); ?>
<span>
<?php p($l->t("The extra-wide page turn areas as used by default on touch-screen devices interfere with the ability to select links in ebooks. When this option is enabled, the page-turn area is always outside the ebook margins so links are reachable.")); ?>
</span>
</label>
</p>
</div>
<div class="closer icon-cancel-circled nonight">
</div>
</div>
</div>
<div class="overlay nonight">
</div>
</div>
</body>
</div>
</body>
</html>

108
reader/vendor/bartaz/jquery.highlight.js vendored Normal file
View file

@ -0,0 +1,108 @@
/*
* jQuery Highlight plugin
*
* Based on highlight v3 by Johann Burkard
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
*
* Code a little bit refactored and cleaned (in my humble opinion).
* Most important changes:
* - has an option to highlight only entire words (wordsOnly - false by default),
* - has an option to be case sensitive (caseSensitive - false by default)
* - highlight element tag and class names can be specified in options
*
* Usage:
* // wrap every occurrance of text 'lorem' in content
* // with <span class='highlight'> (default options)
* $('#content').highlight('lorem');
*
* // search for and highlight more terms at once
* // so you can save some time on traversing DOM
* $('#content').highlight(['lorem', 'ipsum']);
* $('#content').highlight('lorem ipsum');
*
* // search only for entire word 'lorem'
* $('#content').highlight('lorem', { wordsOnly: true });
*
* // don't ignore case during search of term 'lorem'
* $('#content').highlight('lorem', { caseSensitive: true });
*
* // wrap every occurrance of term 'ipsum' in content
* // with <em class='important'>
* $('#content').highlight('ipsum', { element: 'em', className: 'important' });
*
* // remove default highlight
* $('#content').unhighlight();
*
* // remove custom highlight
* $('#content').unhighlight({ element: 'em', className: 'important' });
*
*
* Copyright (c) 2009 Bartek Szopka
*
* Licensed under MIT license.
*
*/
jQuery.extend({
highlight: function (node, re, nodeName, className) {
if (node.nodeType === 3) {
var match = node.data.match(re);
if (match) {
var highlight = document.createElement(nodeName || 'span');
highlight.className = className || 'highlight';
var wordNode = node.splitText(match.index);
wordNode.splitText(match[0].length);
var wordClone = wordNode.cloneNode(true);
highlight.appendChild(wordClone);
wordNode.parentNode.replaceChild(highlight, wordNode);
return 1; //skip added node in parent
}
} else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
!/(script|style)/i.test(node.tagName) && // ignore script and style nodes
!(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
for (var i = 0; i < node.childNodes.length; i++) {
i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
}
}
return 0;
}
});
jQuery.fn.unhighlight = function (options) {
var settings = { className: 'highlight', element: 'span' };
jQuery.extend(settings, options);
return this.find(settings.element + "." + settings.className).each(function () {
var parent = this.parentNode;
parent.replaceChild(this.firstChild, this);
parent.normalize();
}).end();
};
jQuery.fn.highlight = function (words, options) {
var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };
jQuery.extend(settings, options);
if (words.constructor === String) {
words = [words];
}
words = jQuery.grep(words, function(word, i){
return word != '';
});
words = jQuery.map(words, function(word, i) {
return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
});
if (words.length == 0) { return this; };
var flag = settings.caseSensitive ? "" : "i";
var pattern = "(" + words.join("|") + ")";
if (settings.wordsOnly) {
pattern = "\\b" + pattern + "\\b";
}
var re = new RegExp(pattern, flag);
return this.each(function () {
jQuery.highlight(this, re, settings.element, settings.className);
});
};

507
reader/vendor/bgrins/spectrum.css vendored Normal file
View file

@ -0,0 +1,507 @@
/***
Spectrum Colorpicker v1.8.0
https://github.com/bgrins/spectrum
Author: Brian Grinstead
License: MIT
***/
.sp-container {
position:absolute;
top:0;
left:0;
display:inline-block;
*display: inline;
*zoom: 1;
/* https://github.com/bgrins/spectrum/issues/40 */
z-index: 9999994;
overflow: hidden;
}
.sp-container.sp-flat {
position: relative;
}
/* Fix for * { box-sizing: border-box; } */
.sp-container,
.sp-container * {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
.sp-top {
position:relative;
width: 100%;
display:inline-block;
}
.sp-top-inner {
position:absolute;
top:0;
left:0;
bottom:0;
right:0;
}
.sp-color {
position: absolute;
top:0;
left:0;
bottom:0;
right:20%;
}
.sp-hue {
position: absolute;
top:0;
right:0;
bottom:0;
left:84%;
height: 100%;
}
.sp-clear-enabled .sp-hue {
top:33px;
height: 77.5%;
}
.sp-fill {
padding-top: 80%;
}
.sp-sat, .sp-val {
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
}
.sp-alpha-enabled .sp-top {
margin-bottom: 18px;
}
.sp-alpha-enabled .sp-alpha {
display: block;
}
.sp-alpha-handle {
position:absolute;
top:-4px;
bottom: -4px;
width: 6px;
left: 50%;
cursor: pointer;
border: 1px solid black;
background: white;
opacity: .8;
}
.sp-alpha {
display: none;
position: absolute;
bottom: -14px;
right: 0;
left: 0;
height: 8px;
}
.sp-alpha-inner {
border: solid 1px #333;
}
.sp-clear {
display: none;
}
.sp-clear.sp-clear-display {
background-position: center;
}
.sp-clear-enabled .sp-clear {
display: block;
position:absolute;
top:0px;
right:0;
bottom:0;
left:84%;
height: 28px;
}
/* Don't allow text selection */
.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
-webkit-user-select:none;
-moz-user-select: -moz-none;
-o-user-select:none;
user-select: none;
}
.sp-container.sp-input-disabled .sp-input-container {
display: none;
}
.sp-container.sp-buttons-disabled .sp-button-container {
display: none;
}
.sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
display: none;
}
.sp-palette-only .sp-picker-container {
display: none;
}
.sp-palette-disabled .sp-palette-container {
display: none;
}
.sp-initial-disabled .sp-initial {
display: none;
}
/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
.sp-sat {
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
}
.sp-val {
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
}
.sp-hue {
background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}
/* IE filters do not support multiple color stops.
Generate 6 divs, line them up, and do two color gradients for each.
Yes, really.
*/
.sp-1 {
height:17%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
}
.sp-2 {
height:16%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
}
.sp-3 {
height:17%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
}
.sp-4 {
height:17%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
}
.sp-5 {
height:16%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
}
.sp-6 {
height:17%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
}
.sp-hidden {
display: none !important;
}
/* Clearfix hack */
.sp-cf:before, .sp-cf:after { content: ""; display: table; }
.sp-cf:after { clear: both; }
.sp-cf { *zoom: 1; }
/* Mobile devices, make hue slider bigger so it is easier to slide */
@media (max-device-width: 480px) {
.sp-color { right: 40%; }
.sp-hue { left: 63%; }
.sp-fill { padding-top: 60%; }
}
.sp-dragger {
border-radius: 5px;
height: 5px;
width: 5px;
border: 1px solid #fff;
background: #000;
cursor: pointer;
position:absolute;
top:0;
left: 0;
}
.sp-slider {
position: absolute;
top:0;
cursor:pointer;
height: 3px;
left: -1px;
right: -1px;
border: 1px solid #000;
background: white;
opacity: .8;
}
/*
Theme authors:
Here are the basic themeable display options (colors, fonts, global widths).
See http://bgrins.github.io/spectrum/themes/ for instructions.
*/
.sp-container {
border-radius: 0;
background-color: #ECECEC;
border: solid 1px #f0c49B;
padding: 0;
}
.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.sp-top {
margin-bottom: 3px;
}
.sp-color, .sp-hue, .sp-clear {
border: solid 1px #666;
}
/* Input */
.sp-input-container {
float:right;
width: 100px;
margin-bottom: 4px;
}
.sp-initial-disabled .sp-input-container {
width: 100%;
}
.sp-input {
font-size: 12px !important;
border: 1px inset;
padding: 4px 5px;
margin: 0;
width: 100%;
background:transparent;
border-radius: 3px;
color: #222;
}
.sp-input:focus {
border: 1px solid orange;
}
.sp-input.sp-validation-error {
border: 1px solid red;
background: #fdd;
}
.sp-picker-container , .sp-palette-container {
float:left;
position: relative;
padding: 10px;
padding-bottom: 300px;
margin-bottom: -290px;
}
.sp-picker-container {
width: 172px;
border-left: solid 1px #fff;
}
/* Palettes */
.sp-palette-container {
border-right: solid 1px #ccc;
}
.sp-palette-only .sp-palette-container {
border: 0;
}
.sp-palette .sp-thumb-el {
display: block;
position:relative;
float:left;
width: 24px;
height: 15px;
margin: 3px;
cursor: pointer;
border:solid 2px transparent;
}
.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
border-color: orange;
}
.sp-thumb-el {
position:relative;
}
/* Initial */
.sp-initial {
float: left;
border: solid 1px #333;
}
.sp-initial span {
width: 30px;
height: 25px;
border:none;
display:block;
float:left;
margin:0;
}
.sp-initial .sp-clear-display {
background-position: center;
}
/* Buttons */
.sp-palette-button-container,
.sp-button-container {
float: right;
}
/* Replacer (the little preview div that shows up instead of the <input>) */
.sp-replacer {
margin:0;
overflow:hidden;
cursor:pointer;
padding: 4px;
display:inline-block;
*zoom: 1;
*display: inline;
border: solid 1px #91765d;
background: #eee;
color: #333;
vertical-align: middle;
}
.sp-replacer:hover, .sp-replacer.sp-active {
border-color: #F0C49B;
color: #111;
}
.sp-replacer.sp-disabled {
cursor:default;
border-color: silver;
color: silver;
}
.sp-dd {
padding: 2px 0;
height: 16px;
line-height: 16px;
float:left;
font-size:10px;
}
.sp-preview {
position:relative;
width:25px;
height: 20px;
border: solid 1px #222;
margin-right: 5px;
float:left;
z-index: 0;
}
.sp-palette {
*width: 220px;
max-width: 220px;
}
.sp-palette .sp-thumb-el {
width:16px;
height: 16px;
margin:2px 1px;
border: solid 1px #d0d0d0;
}
.sp-container {
padding-bottom:0;
}
/* Buttons: http://hellohappy.org/css3-buttons/ */
.sp-container button {
background-color: #eeeeee;
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
border: 1px solid #ccc;
border-bottom: 1px solid #bbb;
border-radius: 3px;
color: #333;
font-size: 14px;
line-height: 1;
padding: 5px 4px;
text-align: center;
text-shadow: 0 1px 0 #eee;
vertical-align: middle;
}
.sp-container button:hover {
background-color: #dddddd;
background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
border: 1px solid #bbb;
border-bottom: 1px solid #999;
cursor: pointer;
text-shadow: 0 1px 0 #ddd;
}
.sp-container button:active {
border: 1px solid #aaa;
border-bottom: 1px solid #888;
-webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
-moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
-ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
-o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
}
.sp-cancel {
font-size: 11px;
color: #d93f3f !important;
margin:0;
padding:2px;
margin-right: 5px;
vertical-align: middle;
text-decoration:none;
}
.sp-cancel:hover {
color: #d93f3f !important;
text-decoration: underline;
}
.sp-palette span:hover, .sp-palette span.sp-thumb-active {
border-color: #000;
}
.sp-preview, .sp-alpha, .sp-thumb-el {
position:relative;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
}
.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
display:block;
position:absolute;
top:0;left:0;bottom:0;right:0;
}
.sp-palette .sp-thumb-inner {
background-position: 50% 50%;
background-repeat: no-repeat;
}
.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
}
.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
}
.sp-clear-display {
background-repeat:no-repeat;
background-position: center;
background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
}

2323
reader/vendor/bgrins/spectrum.js vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -177,19 +177,19 @@ label {
.toolbar,
.panels {
position: absolute;
color: white;
overflow: visible;
/* padding: 0.75em 0; */
/* overflow: visible; */
background: #4e4e4e;
left: 0;
right: 0;
/* left: 0; */
/* right: 0; */
width: 100%;
}
.toolbar {
position: fixed;
/* position: fixed; */
z-index: 99;
margin-bottom: 0;
/* margin-bottom: 0; */
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
opacity: 0;
transition: opacity 0.1s ease-in-out;
@ -266,7 +266,7 @@ body:not(.mobile) .toolbar button[data-action=close]:hover {
background: #6b6b6b;
position: fixed;
top: 0;
width: 20%;
/* width: 20%; */
min-width: 25em;
height: 100%;
overflow: hidden;
@ -274,6 +274,10 @@ body:not(.mobile) .toolbar button[data-action=close]:hover {
z-index: 100;
}
.sidebar.wide {
width: 20%;
}
.panels {
overflow: hidden;
}
@ -295,8 +299,12 @@ body:not(.mobile) .toolbar button[data-action=close]:hover {
overflow-x: hidden;
display: none !important;
width: 100%;
height: 100%;
margin-top: 0;
/* height: 100%; */
/* margin-top: 0; */
position: absolute;
top: 3em;
bottom: 0;
text-align: center;
}
.toc-view li {
@ -323,14 +331,15 @@ body:not(.mobile) .toolbar button[data-action=close]:hover {
}
.settings-container {
position: absolute;
text-align: left;
display: inline-block;
width: 95%;
font-size: 1em;
background: #F8F8F8;
color: #111;
padding: 1em;
padding-top: 1em;
padding-bottom: 1em;
margin-top: 1em;
left: 1em;
right: 1em;
border-radius: 4px;
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}

View file

@ -7,7 +7,7 @@ CBRJS.session = CBRJS.session || {};
CBRJS.Reader = function(bookPath, _options) {
var $progressbar = $('.bar');
var $progressbar = $('.bar');
var filename = decodeURIComponent(bookPath.split('/').pop());
var re_file_ext = new RegExp(/\.([a-z]+)$/);
@ -140,11 +140,6 @@ CBRJS.Reader = function(bookPath, _options) {
vendorPath: 'vendor/'
}, opts);
console.log("opts before extractImages:");
console.log(opts);
console.log("options before extractImages:");
console.log(options);
extractImages(url, {
start: function (filename) {
this.filename = filename;
@ -184,9 +179,6 @@ CBRJS.Reader = function(bookPath, _options) {
$(window).on('beforeunload', function(e) {
book.destroy();
});
console.log("options after extractImages:");
console.log(options);
}
});
@ -196,14 +188,11 @@ CBRJS.Reader = function(bookPath, _options) {
function getPref (arr, name) {
if (found = arr.find(function(e) { return e.name === name; })) {
if (found.hasOwnProperty("value")) {
console.log("property " + name + " has value " + found.value);
return found.value;
}
}
};
console.log("CBRJS:");console.log(CBRJS);
openComicArchive(bookPath, {
/* functions return jquery promises */
getPreference: function(name) {
@ -1961,15 +1950,10 @@ ComicBook = (function ($) {
self.setLayout((window.innerWidth > window.innerHeight) ? 'double' : 'single');
});
console.log("defaults:");console.log(defaults);
console.log("opts:");console.log(opts);
// options = merge(defaults, opts); // options array for internal use
$.extend(true, options, defaults, opts); // options array for internal use
console.log("options:");console.log(options);
var no_pages = srcs.length;
var pages = []; // array of preloaded Image objects
var thumbs = []; // array of preloaded thumbnail Image objects
var canvas; // the HTML5 canvas object
var context; // the 2d drawing context
var tcv = document.createElement("canvas"); // canvas used for thumbnailer
@ -2250,7 +2234,7 @@ ComicBook = (function ($) {
i++;
}
// set, but don't save
// set, but don't save for future sessions
options.thumbnails = true;
$('#toc-populate').removeClass('open');
};
@ -2334,7 +2318,6 @@ ComicBook = (function ($) {
var i = options.currentPage; // the current page counter for this method
var rendered = false;
var queue = [];
console.log("i: " + i);
this.showControl('loadingOverlay');
@ -2704,6 +2687,44 @@ ComicBook = (function ($) {
options.setDefault("thumbnailWidth", options.thumbnailWidth);
};
ComicBook.prototype.sidebarWide = function (wide) {
if (typeof(wide) !== "boolean") {
wide = ($(this).is(':checked') === true);
}
if (wide) {
options.sidebarWide = true;
document.getElementById('sidebar').classList.add('wide');
} else {
options.sidebarWide = false;
document.getElementById('sidebar').classList.remove('wide');
self.sidebarWidth(0);
}
options.setDefault("sidebarWide", options.sidebarWide);
};
ComicBook.prototype.sidebarWidth = function(width) {
if (typeof(width) !== "number") {
width = $(this).val();
}
options.sidebarWidth = width;
// width === 0 is interpreted as 'use value from CSS'
if (options.sidebarWidth > 0) {
document.getElementById('sidebar').style.width = options.sidebarWidth + "%";
} else {
document.getElementById('sidebar').style.width = "";
}
options.setDefault("sidebarWidth", options.sidebarWidth);
};
ComicBook.prototype.resetSidebar = function () {
self.sidebarWide(false);
self.sidebarWidth(0);
};
/* book-specific settings */
ComicBook.prototype.brightness = function () {
@ -2715,7 +2736,6 @@ ComicBook = (function ($) {
self.enhance.brightness($brightness);
options.enhance.brightness = $brightness;
options.setPreference("enhance",options.enhance);
console.log(options.enhance);
};
ComicBook.prototype.sharpen = function () {
@ -2725,7 +2745,6 @@ ComicBook = (function ($) {
});
options.setPreference("enhance",options.enhance);
console.log(options.enhance);
};
ComicBook.prototype.desaturate = function () {
@ -2738,7 +2757,6 @@ ComicBook = (function ($) {
}
options.setPreference("enhance",options.enhance);
console.log(options.enhance);
};
ComicBook.prototype.removenoise = function () {
@ -2751,22 +2769,15 @@ ComicBook = (function ($) {
}
options.setPreference("enhance",options.enhance);
console.log(options.enhance);
};
ComicBook.prototype.resetEnhancements = function () {
self.enhance.reset();
options.setPreference("enhance",options.enhance);
console.log(options.enhance);
};
/**
* Apply image enhancements to the canvas.
*
* Powered by the awesome Pixastic: http://www.pixastic.com/
*
* TODO: reset & apply all image enhancements each time before applying new one
* TODO: abstract this into an 'Enhance' object, separate from ComicBook?
*/
ComicBook.prototype.enhance = {
@ -3023,6 +3034,7 @@ ComicBook = (function ($) {
}
};
/*
* Scroll TOC to page (default: current page)
*/
@ -3032,7 +3044,7 @@ ComicBook = (function ($) {
}
document.getElementById('toc').parentNode.scrollTop =
document.getElementById('page-' + page + 1).offsetTop
document.getElementById('page-' + String(page + 1)).offsetTop
- Math.floor($('.panels').height() * 1.5);
};

BIN
reader/vendor/epubjs/css/.main.css.swp vendored Normal file

Binary file not shown.

Binary file not shown.

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Before After
Before After

13
reader/vendor/epubjs/css/idevice.css vendored Normal file
View file

@ -0,0 +1,13 @@
rewwrweriframe {
width: 1px;
min-width: 100%;
}
* {
border: 1px dotted blue !important;
}
viewer {
max-width: 50% !important;
width: 40%;
}

376
reader/vendor/epubjs/css/main.css vendored Normal file
View file

@ -0,0 +1,376 @@
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
fieldset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
background: #4e4e4e;
overflow: hidden;
font-style:
}
#main {
position: absolute;
width: 100%;
height: 100%;
right: 0;
border-radius: 5px;
background: #fff;
overflow: hidden;
-webkit-transition: -webkit-transform .4s, width .2s;
-moz-transition: -webkit-transform .4s, width .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);
box-shadow: inset 0 0 50px rgba(0,0,0,.1);
}
#titlebar {
/*height: 8%;
min-height: 20px; */
/* height: 3em; */
padding: 0.5em;
/* padding: 10px; */
color: #4f4f4f;
font-weight: 100;
font-family: Georgia, "Times New Roman", Times, serif;
opacity: .5;
text-align: center;
-webkit-transition: opacity .5s;
-moz-transition: opacity .5s;
z-index: 10;
position: fixed;
width: 100%;
}
#titlebar:hover {
opacity: 1;
}
#titlebar a {
width: 1em;
height: 1em;
overflow: hidden;
display: inline-block;
opacity: .5;
padding: 0.2em;
border-radius: 0.2em;
border: 1px rgba(0,0,0,0) solid;
}
#titlebar a::before {
visibility: visible;
}
#titlebar a:hover {
opacity: .8;
border: 1px rgba(0,0,0,.2) solid;
}
#titlebar a:active {
opacity: 1;
color: rgba(0,0,0,.6);
box-shadow: inset 0 0 6px rgba(155,155,155,.8);
}
#book-title {
font-weight: 600;
}
#title-seperator {
display: none;
}
#title-controls {
margin-left: 1em;
margin-right: 1em;
}
#viewer {
width: 80%;
height: 80%;
top: 10%;
margin: auto;
max-width: 72em;
z-index: 2;
position: relative;
overflow: hidden;
}
#viewer iframe {
border: none;
}
#prev, #next {
position: absolute;
top: 10%;
height: 80%;
margin: 0;
opacity: 0;
}
.touch_nav {
width: 35%;
}
.arrow div {
display: table-cell;
vertical-align: middle;
}
#prev {
left: 0;
padding-left: 2em;
}
#next {
right: 0;
padding-right: 2em;
text-align: right;
}
.arrow {
font-size: 64px;
color: #E2E2E2;
font-family: arial, sans-serif;
font-weight: bold;
cursor: pointer;
display: table;
z-index: 3;
}
.arrow:hover {
color: #777;
}
.arrow:active,
.arrow.active {
color: #000;
}
#main.closed {
transform: translate(25em, 0);
}
#main.single {
width: calc(100% - 25em);
}
#metainfo {
display: inline-block;
text-align: center;
max-width: 80%;
}
#divider {
position: absolute;
width: 1px;
border-right: 1px #000 solid;
height: 80%;
z-index: 100;
left: 50%;
margin-left: -1px;
top: 10%;
opacity: .15;
box-shadow: -2px 0 15px rgba(0, 0, 0, 1);
display: none;
}
#divider.show {
display: block;
}
#loader {
position: absolute;
z-index: 10;
left: 50%;
top: 50%;
margin: -33px 0 0 -33px;
}
.pull-left {
float: left;
}
.pull-right {
float: right;
}
.highlight {
background-color: yellow;
}
.overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: rgba(255,255,255,0.8);
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.hide {
display: none !important;
}
@media only screen and (max-width: 1040px) {
/*
#viewer{
width: 50%;
margin-left: 25%;
}
*/
#divider,
#divider.show {
display: none;
}
}
@media only screen and (max-width: 900px) {
/*
#viewer{
width: 60%;
margin-left: 20%;
}
*/
#prev {
padding-left: 20px;
}
#next {
padding-right: 20px;
}
}
@media only screen and (max-width: 550px) {
/*
#viewer{
width: 80%;
margin-left: 10%;
}
*/
#prev {
padding-left: 0;
}
#next {
padding-right: 0;
}
.arrow div {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
#main {
-webkit-transform: translate(0, 0);
-moz-transform: translate(0, 0);
-webkit-transition: -webkit-transform .3s;
-moz-transition: -moz-transform .3s;
}
#main.closed {
-webkit-transform: translate(260px, 0);
-moz-transform: translate(260px, 0);
}
#titlebar {
/* font-size: 16px; */
/* margin: 0 50px 0 50px; */
}
#metainfo {
font-size: 10px;
}
#tocView {
width: 260px;
}
#tocView li {
font-size: 12px;
}
#tocView > ul{
padding-left: 10px;
-webkit-padding-start:;
}
}
/* icon font */
@font-face {
font-family: 'fontello';
src: url('font/fontello.eot?60518104');
src: url('font/fontello.eot?60518104#iefix') format('embedded-opentype'),
url('font/fontello.woff?60518104') format('woff'),
url('font/fontello.ttf?60518104') format('truetype'),
url('font/fontello.svg?60518104#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "fontello";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
}
.icon-search:before { content: '\e807'; } /* '' */
.icon-resize-full-1:before { content: '\e804'; } /* '' */
.icon-cancel-circled2:before { content: '\e80f'; } /* '' */
.icon-link:before { content: '\e80d'; } /* '' */
.icon-bookmark:before { content: '\e805'; } /* '' */
.icon-bookmark-empty:before { content: '\e806'; } /* '' */
.icon-download-cloud:before { content: '\e811'; } /* '' */
.icon-edit:before { content: '\e814'; } /* '' */
.icon-menu:before { content: '\e802'; } /* '' */
.icon-cog:before { content: '\e813'; } /* '' */
.icon-resize-full:before { content: '\e812'; } /* '' */
.icon-cancel-circled:before { content: '\e80e'; } /* '' */
.icon-up-dir:before { content: '\e80c'; } /* '' */
.icon-right-dir:before { content: '\e80b'; } /* '' */
.icon-angle-right:before { content: '\e809'; } /* '' */
.icon-angle-down:before { content: '\e80a'; } /* '' */
.icon-right:before { content: '\e815'; } /* '' */
.icon-list-1:before { content: '\e803'; } /* '' */
.icon-list-numbered:before { content: '\e801'; } /* '' */
.icon-columns:before { content: '\e810'; } /* '' */
.icon-list:before { content: '\e800'; } /* '' */
.icon-resize-small:before { content: '\e808'; } /* '' */

369
reader/vendor/epubjs/css/sidebar.css vendored Normal file
View file

@ -0,0 +1,369 @@
/* sidebar */
.sidebar.open {
box-shadow: 3px 0px 3px 0px rgba(0, 0, 0, 0.4);
display: block;
}
.sidebar {
background: #6b6b6b;
position: fixed;
top: 0;
min-width: 25em;
height: 100%;
overflow: hidden;
display: none;
z-index: 100;
}
.sidebar.wide {
width: 20%;
}
.toolbar,
.panels {
position: absolute;
width: 100%;
height: 2em;
background: #4e4e4e;
}
.toolbar {
text-align: center;
}
.toolbar .metainfo {
font-size: 1.2em;
top: 0.5em;
}
.toolbar div {
display: inline-block;
position: relative;
}
.toolbar .separator {
/* border: solid 1px; */
height: 1em;
opacity: 0.5;
}
.toolbar button, .sidebar button {
color: white;
border: none;
background-color: transparent;
padding: 0;
}
.sidebar div > button {
/* font-size: 1.5em; */
font-size: 1em;
padding: 0.5em;
margin: 0;
}
.mobile .sidebar div > button {
padding: 0.5em;
margin: 0;
}
.sidebar div > button:hover {
color: #8CC746;
}
.panels .open {
background-color: #6B6B6B;
}
.view.open {
display: block !important;
}
.view {
overflow-x: hidden;
display: none !important;
width: 100%;
position: absolute;
top: 2em;
bottom: 0;
}
.list_item a {
color: #AAA;
text-decoration: none;
}
.list_item a.chapter {
font-size: 1em;
}
.list_item a.section {
font-size: .8em;
}
.list_item.currentChapter > a,
.list_item a:hover {
color: #f1f1f1
}
.list_item a:hover {
color: #E2E2E2;
}
.list_item ul {
display: none;
}
.list_item.currentChapter > ul,
.list_item.openChapter > ul {
display: block;
}
legend {
margin-left: 1em;
padding: 0.5em;
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}
.settings-container {
text-align: left;
margin: 1em;
background: #F8F8F8;
color: #111;
border-radius: 4px;
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}
.settings-container > legend {
position: relative;
top: 1em;
margin-bottom: 1em;
text-align: center;
font-weight: 600;
box-shadow: none;
}
.settings-container label {
margin-right: 1em;
}
.center-box {
text-align: center;
margin: 1em;
}
.font_example {
margin: 1em;
text-align: center;
box-shadow: inset 0 1px 10px rgba(0, 0, 0, 0.4);
}
.font_example div {
padding: 1em;
}
.view .control-group input[type=range] {
width: 90%;
float: right;
margin: 0;
}
.view .control-group {
padding: 1em;
}
.view .sliders {
font-size: 1.5em;
}
.view .control-group span {
float: left;
margin: 0 2px;
clear: both;
}
.view .control-group input[type=reset] {
float: right;
}
.metadata {
padding: 1em;
margin: 1em;
}
.metadata table {
font-size: 1.2em;
color: #F8F8F8;
}
.metadata td:nth-child(1) {
font-weight: bold;
padding-right: 1em;
}
/* panels */
.panels a {
visibility: hidden;
overflow: hidden;
display: inline-block;
color: #ccc;
}
.panels a::before {
visibility: visible;
}
.panels a:hover {
color: #AAA;
}
.panels a:active {
color: #AAA;
margin: 1px 0 -1px 6px;
}
.panels a.active,
.panels a.active:hover {
color: #AAA;
}
/* END panels */
/* TOC (and search, and bookmarks) */
.toc_toggle {
display: inline-block;
width: 14px;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.toc_toggle:before {
content: '▸';
color: #fff;
margin-right: -4px;
}
.currentChapter > .toc_toggle:before,
.openChapter > .toc_toggle:before {
content: '▾';
}
#toc-populate.open {
display: inline-block !important;
background-color: #4e4e4e;
}
.toc-view li,
.bookmarks-view li,
.search-view li {
margin: 1em;
font-family: Georgia, "Times New Roman", Times, serif;
list-style: none;
}
.toc-view li,
.bookmarks-view li {
text-transform: capitalize;
}
.toc-vew.hidden {
display: none;
}
/* END TOC */
/* search */
.search-view {
overflow: hidden;
}
.search-results {
overflow-y: scroll;
height: calc(100% - 3em);
}
.search-input {
position: relative;
width: 100%;
padding-top: 1em;
padding-bottom: 1em;
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}
.searchbox {
width: 80%;
float: left;
margin-left: 1em;
}
.searchbox + span {
position: relative;
left: -1em;
visibility: hidden;
font-weight: bold;
font-family: sans-serif;
cursor: pointer;
}
.searchbox + span:hover {
color: red;
}
/* END search */
/* notes */
.notes {
padding: 0 0 0 34px;
}
.notes li {
color: #eee;
border-top: 1px #fff solid;
}
.notes li a {
color: #fff;
display: inline-block;
}
.notes li a:hover {
text-decoration: underline;
}
.notes li img {
}
.note-text {
display: block;
width: calc(100% - 2em);
margin: 1em;
height: 5em;
border-radius: 5px;
}
.note-text[disabled], #note-text[disabled="disabled"]{
opacity: .5;
}
.note-anchor {
}
/* END notes */
/* media-specific rules */
@media only screen and (max-width: 25em) {
.sidebar {
min-width: 10em;
width: 80%;
}
}
/* END sidebar */

View file

@ -257,22 +257,18 @@ body {
color: #AAA;
}
#searchBox {
width: 165px;
float: left;
margin-left: 10px;
margin-top: -1px;
/*
border-radius: 5px;
background: #9b9b9b;
float: left;
margin-left: 5px;
margin-top: -5px;
padding: 3px 10px;
color: #000;
border: none;
outline: none; */
.searchbox {
position: inline-block;
width: 50%;
float: left;
margin-left: 1em;
}
.searchbox + span {
position: relative;
left: -1em;
visibility: hidden;
font-weight: bold;
}
input::-webkit-input-placeholder {

File diff suppressed because one or more lines are too long

142
reader/vendor/epubjs/plugins/search.js vendored Normal file
View file

@ -0,0 +1,142 @@
EPUBJS.reader.plugins.SearchController = function () {
var reader = this;
var book = this.book;
var $searchBox = $("#searchBox"),
$clearBtn = $("#searchBox").next(),
$searchResults = $("#searchResults"),
$searchView = $("#searchView"),
$body = $("#viewer iframe").contents().find('body');
results = document.getElementById('searchResults');
var onShow = function() {
$searchView.addClass("open");
//search();
};
var onHide = function() {
highlight();
$searchView.removeClass("open");
};
var search = function(q) {
if (q === undefined) {
q = $searchBox.val();
}
if (q == '') {
clear();
return;
}
reader.SidebarController.changePanelTo("Search");
$searchResults.empty();
$searchResults.append("<li><p>Searching...</p></li>");
runQuery(q, results);
};
$searchBox.on("keyup", function(e) {
// Show the clear button if text input value is not empty
$clearBtn.css("visibility", (this.value.length) ? "visible" : "hidden");
// run search when Enter is pressed
if (e.keyCode === 13) {
e.preventDefault();
search();
}
});
$clearBtn.on("click", function() {
$(this).css("visibility", "hidden");
$searchBox.val("");
});
function clear () {
$searchResults.empty();
// book.off("renderer:chapterDisplayed");
highlight();
if (reader.SidebarController.getActivePanel() == "Search") {
reader.SidebarController.changePanelTo("Toc");
}
};
// perform search and build result list
function runQuery(query, element) {
return new Promise(function(resolve, reject) {
var results = [];
for (var i = 0; i < book.spine.length; i++) {
var spineItem = book.spine[i];
results.push(new Promise(function(resolve, reject) {
new Promise(function(resolve, reject) {
resolve(new EPUBJS.Chapter(spineItem, book.store, book.credentials));
}).then(function(chapter) {
return new Promise(function(resolve, reject) {
chapter.load().then(function() {
resolve(chapter);
}).catch(reject);
});
}).then(function(chapter) {
return Promise.resolve(chapter.find(query));
}).then(function(result) {
resolve(result);
});
}));
}
Promise.all(results).then(function(results) {
return new Promise(function(resolve, reject) {
resolve(results);
var mergedResults = [].concat.apply([], results);
element.innerHTML = "";
for (var i = 0; i < mergedResults.length; i++) {
try {
var listitem = document.createElement("li");
var link = document.createElement("a");
listitem.classList.add("list_item");
// listitem.setAttribute("data-location", mergedResults[i].cfi);
listitem.id = "search-"+i;
link.href=mergedResults[i].cfi;
link.textContent = mergedResults[i].excerpt;
link.classList.add("toc_link");
link.addEventListener("click", function(e) {
e.preventDefault();
$searchResults.find(".list_item")
.removeClass("currentChapter");
$(this).parent("li").addClass("currentChapter");
book.on("renderer:chapterDisplayed", function() {
highlight(query);
});
book.gotoCfi(this.getAttribute("href"));
});
listitem.appendChild(link);
element.appendChild(listitem);
} catch (e) {
console.warn(e);
}
}
});
});
});
};
highlight = function (query) {
(query !== undefined)
? $body.highlight(query, { element: 'span' })
: $body.unhighlight();
};
return {
"show": onShow,
"hide": onHide,
"search": search
};
};

File diff suppressed because one or more lines are too long