Comparing version 0.3.60 to 0.3.61
@@ -7,4 +7,2 @@ "use strict"; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -100,2 +98,3 @@ | ||
* @param {method} [options.canonical] optional function to determine canonical urls for a path | ||
* @param {string} [options.openAs] optional string to determine the input type | ||
* @returns {Book} | ||
@@ -113,3 +112,3 @@ * @example new Book("/path/to/book.epub", {}) | ||
// Allow passing just options to the Book | ||
if (typeof options === "undefined" && (typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") { | ||
if (typeof options === "undefined" && typeof url !== "string" && url instanceof Blob === false) { | ||
options = url; | ||
@@ -125,3 +124,4 @@ url = undefined; | ||
replacements: undefined, | ||
canonical: undefined | ||
canonical: undefined, | ||
openAs: undefined | ||
}); | ||
@@ -261,3 +261,3 @@ | ||
if (url) { | ||
this.open(url).catch(function (error) { | ||
this.open(url, this.settings.openAs).catch(function (error) { | ||
var err = new Error("Cannot load book at " + url); | ||
@@ -264,0 +264,0 @@ _this.emit(_constants.EVENTS.BOOK.OPEN_FAILED, err); |
@@ -31,5 +31,7 @@ "use strict"; | ||
var isChrome = /Chrome/.test(navigator.userAgent); | ||
var isWebkit = !isChrome && /AppleWebKit/.test(navigator.userAgent); | ||
var hasNavigator = typeof navigator !== "undefined"; | ||
var isChrome = hasNavigator && /Chrome/.test(navigator.userAgent); | ||
var isWebkit = hasNavigator && !isChrome && /AppleWebKit/.test(navigator.userAgent); | ||
var ELEMENT_NODE = 1; | ||
@@ -36,0 +38,0 @@ var TEXT_NODE = 3; |
@@ -189,3 +189,3 @@ "use strict"; | ||
key: "override", | ||
value: function override(name, value) { | ||
value: function override(name, value, priority) { | ||
var _this2 = this; | ||
@@ -195,6 +195,9 @@ | ||
this._overrides[name] = value; | ||
this._overrides[name] = { | ||
value: value, | ||
priority: priority === true | ||
}; | ||
contents.forEach(function (content) { | ||
content.css(name, _this2._overrides[name]); | ||
content.css(name, _this2._overrides[name].value, _this2._overrides[name].priority); | ||
}); | ||
@@ -209,3 +212,3 @@ } | ||
if (overrides.hasOwnProperty(rule)) { | ||
contents.css(rule, overrides[rule]); | ||
contents.css(rule, overrides[rule].value, overrides[rule].priority); | ||
} | ||
@@ -234,3 +237,3 @@ } | ||
value: function font(f) { | ||
this.override("font-family", f); | ||
this.override("font-family", f, true); | ||
} | ||
@@ -237,0 +240,0 @@ }, { |
@@ -93,3 +93,3 @@ "use strict"; | ||
if (this.status === 200 || responseXML) { | ||
if (this.status === 200 || this.status === 0 || responseXML) { | ||
//-- Firefox is reporting 0 for blob urls | ||
@@ -96,0 +96,0 @@ var r; |
{ | ||
"name": "epubjs", | ||
"version": "0.3.60", | ||
"version": "0.3.61", | ||
"description": "Parse and Render Epubs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -42,2 +42,3 @@ import EventEmitter from "event-emitter"; | ||
* @param {method} [options.canonical] optional function to determine canonical urls for a path | ||
* @param {string} [options.openAs] optional string to determine the input type | ||
* @returns {Book} | ||
@@ -50,4 +51,5 @@ * @example new Book("/path/to/book.epub", {}) | ||
// Allow passing just options to the Book | ||
if (typeof(options) === "undefined" | ||
&& typeof(url) === "object") { | ||
if (typeof(options) === "undefined" && | ||
typeof(url) !== "string" && | ||
url instanceof Blob === false) { | ||
options = url; | ||
@@ -63,3 +65,4 @@ url = undefined; | ||
replacements: undefined, | ||
canonical: undefined | ||
canonical: undefined, | ||
openAs: undefined | ||
}); | ||
@@ -208,3 +211,3 @@ | ||
if(url) { | ||
this.open(url).catch((error) => { | ||
this.open(url, this.settings.openAs).catch((error) => { | ||
var err = new Error("Cannot load book at "+ url ); | ||
@@ -211,0 +214,0 @@ this.emit(EVENTS.BOOK.OPEN_FAILED, err); |
@@ -8,5 +8,7 @@ import EventEmitter from "event-emitter"; | ||
const isChrome = /Chrome/.test(navigator.userAgent); | ||
const isWebkit = !isChrome && /AppleWebKit/.test(navigator.userAgent); | ||
const hasNavigator = typeof (navigator) !== "undefined"; | ||
const isChrome = hasNavigator && /Chrome/.test(navigator.userAgent); | ||
const isWebkit = hasNavigator && !isChrome && /AppleWebKit/.test(navigator.userAgent); | ||
const ELEMENT_NODE = 1; | ||
@@ -13,0 +15,0 @@ const TEXT_NODE = 3; |
@@ -155,9 +155,12 @@ import Url from "./utils/url"; | ||
override (name, value) { | ||
override (name, value, priority) { | ||
var contents = this.rendition.getContents(); | ||
this._overrides[name] = value; | ||
this._overrides[name] = { | ||
value: value, | ||
priority: priority === true | ||
}; | ||
contents.forEach( (content) => { | ||
content.css(name, this._overrides[name]); | ||
content.css(name, this._overrides[name].value, this._overrides[name].priority); | ||
}); | ||
@@ -171,3 +174,3 @@ } | ||
if (overrides.hasOwnProperty(rule)) { | ||
contents.css(rule, overrides[rule]); | ||
contents.css(rule, overrides[rule].value, overrides[rule].priority); | ||
} | ||
@@ -190,3 +193,3 @@ } | ||
font (f) { | ||
this.override("font-family", f); | ||
this.override("font-family", f, true); | ||
} | ||
@@ -193,0 +196,0 @@ |
@@ -83,3 +83,3 @@ import {defer, isXml, parse} from "./core"; | ||
if (this.status === 200 || responseXML ) { //-- Firefox is reporting 0 for blob urls | ||
if (this.status === 200 || this.status === 0 || responseXML) { //-- Firefox is reporting 0 for blob urls | ||
var r; | ||
@@ -86,0 +86,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
2990511
141
54297
19