1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00
This commit is contained in:
Fred Chasen 2016-10-31 14:07:41 +01:00
parent 15b368d912
commit 9b1066fddb
6 changed files with 513 additions and 79 deletions

130
dist/epub.js vendored
View file

@ -7,7 +7,7 @@
exports["ePub"] = factory((function webpackLoadOptionalExternalModule() { try { return require("JSZip"); } catch(e) {} }()), require("xmldom"));
else
root["ePub"] = factory(root["JSZip"], root["xmldom"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_44__, __WEBPACK_EXTERNAL_MODULE_14__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_45__, __WEBPACK_EXTERNAL_MODULE_14__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -71,14 +71,14 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ __webpack_require__.p = "/dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 46);
/******/ return __webpack_require__(__webpack_require__.s = 47);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
var base64 = __webpack_require__(20);
var base64 = __webpack_require__(21);
var path = __webpack_require__(3);
var requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;
@ -1639,8 +1639,8 @@ module.exports = EpubCFI;
"use strict";
'use strict';
var d = __webpack_require__(21)
, callable = __webpack_require__(30)
var d = __webpack_require__(22)
, callable = __webpack_require__(31)
, apply = Function.prototype.apply, call = Function.prototype.call
, create = Object.create, defineProperty = Object.defineProperty
@ -3596,8 +3596,8 @@ var core = __webpack_require__(0);
var EpubCFI = __webpack_require__(1);
var Mapping = __webpack_require__(7);
var Queue = __webpack_require__(8);
var Stage = __webpack_require__(38);
var Views = __webpack_require__(39);
var Stage = __webpack_require__(39);
var Views = __webpack_require__(40);
function DefaultViewManager(options) {
@ -4147,7 +4147,7 @@ var replace = __webpack_require__(13);
var Hook = __webpack_require__(6);
var EpubCFI = __webpack_require__(1);
var Queue = __webpack_require__(8);
var Layout = __webpack_require__(36);
var Layout = __webpack_require__(37);
var Mapping = __webpack_require__(7);
function Rendition(book, options) {
@ -5395,18 +5395,19 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_14__;
/***/ },
/* 15 */,
/* 16 */
/* 16 */,
/* 17 */
/***/ function(module, exports, __webpack_require__) {
var EventEmitter = __webpack_require__(2);
var path = __webpack_require__(3);
var core = __webpack_require__(0);
var Spine = __webpack_require__(42);
var Locations = __webpack_require__(37);
var Spine = __webpack_require__(43);
var Locations = __webpack_require__(38);
var Parser = __webpack_require__(12);
var Navigation = __webpack_require__(40);
var Navigation = __webpack_require__(41);
var Rendition = __webpack_require__(11);
var Unarchive = __webpack_require__(43);
var Unarchive = __webpack_require__(44);
var request = __webpack_require__(4);
var EpubCFI = __webpack_require__(1);
@ -5521,7 +5522,7 @@ Book.prototype.open = function(_url, options){
if(url.origin) {
// this.baseUrl = uri.origin() + uri.directory() + "/";
this.baseUrl = url.origin + "/" + path.dirname(pathname) + "/";
this.baseUrl = url.origin + path.dirname(pathname) + "/";
// } else if(absoluteUri){
// this.baseUrl = absoluteUri.origin();
// this.baseUrl += absoluteUri.directory() + "/";
@ -5641,6 +5642,7 @@ Book.prototype.unpack = function(packageXml){
book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
book.package.basePath = book.basePath; // Provides a url base for resolving paths
console.log("book.baseUrl", book.baseUrl );
this.spine.load(book.package);
@ -5757,7 +5759,7 @@ EventEmitter(Book.prototype);
/***/ },
/* 17 */
/* 18 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
@ -6442,7 +6444,7 @@ module.exports = ContinuousViewManager;
/***/ },
/* 18 */
/* 19 */
/***/ function(module, exports, __webpack_require__) {
var EventEmitter = __webpack_require__(2);
@ -7023,7 +7025,7 @@ module.exports = IframeView;
/***/ },
/* 19 */
/* 20 */
/***/ function(module, exports) {
/*
@ -7200,7 +7202,7 @@ module.exports = {
/***/ },
/* 20 */
/* 21 */
/***/ function(module, exports) {
"use strict";
@ -7321,16 +7323,16 @@ function fromByteArray (uint8) {
/***/ },
/* 21 */
/* 22 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
var assign = __webpack_require__(22)
, normalizeOpts = __webpack_require__(29)
, isCallable = __webpack_require__(25)
, contains = __webpack_require__(32)
var assign = __webpack_require__(23)
, normalizeOpts = __webpack_require__(30)
, isCallable = __webpack_require__(26)
, contains = __webpack_require__(33)
, d;
@ -7391,19 +7393,19 @@ d.gs = function (dscr, get, set/*, options*/) {
/***/ },
/* 22 */
/* 23 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
module.exports = __webpack_require__(23)()
module.exports = __webpack_require__(24)()
? Object.assign
: __webpack_require__(24);
: __webpack_require__(25);
/***/ },
/* 23 */
/* 24 */
/***/ function(module, exports) {
"use strict";
@ -7419,14 +7421,14 @@ module.exports = function () {
/***/ },
/* 24 */
/* 25 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
var keys = __webpack_require__(26)
, value = __webpack_require__(31)
var keys = __webpack_require__(27)
, value = __webpack_require__(32)
, max = Math.max;
@ -7448,7 +7450,7 @@ module.exports = function (dest, src/*, …srcn*/) {
/***/ },
/* 25 */
/* 26 */
/***/ function(module, exports) {
"use strict";
@ -7460,19 +7462,19 @@ module.exports = function (obj) { return typeof obj === 'function'; };
/***/ },
/* 26 */
/* 27 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
module.exports = __webpack_require__(27)()
module.exports = __webpack_require__(28)()
? Object.keys
: __webpack_require__(28);
: __webpack_require__(29);
/***/ },
/* 27 */
/* 28 */
/***/ function(module, exports) {
"use strict";
@ -7487,7 +7489,7 @@ module.exports = function () {
/***/ },
/* 28 */
/* 29 */
/***/ function(module, exports) {
"use strict";
@ -7501,7 +7503,7 @@ module.exports = function (object) {
/***/ },
/* 29 */
/* 30 */
/***/ function(module, exports) {
"use strict";
@ -7525,7 +7527,7 @@ module.exports = function (options/*, …options*/) {
/***/ },
/* 30 */
/* 31 */
/***/ function(module, exports) {
"use strict";
@ -7538,7 +7540,7 @@ module.exports = function (fn) {
/***/ },
/* 31 */
/* 32 */
/***/ function(module, exports) {
"use strict";
@ -7551,19 +7553,19 @@ module.exports = function (value) {
/***/ },
/* 32 */
/* 33 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
'use strict';
module.exports = __webpack_require__(33)()
module.exports = __webpack_require__(34)()
? String.prototype.contains
: __webpack_require__(34);
: __webpack_require__(35);
/***/ },
/* 33 */
/* 34 */
/***/ function(module, exports) {
"use strict";
@ -7578,7 +7580,7 @@ module.exports = function () {
/***/ },
/* 34 */
/* 35 */
/***/ function(module, exports) {
"use strict";
@ -7592,8 +7594,8 @@ module.exports = function (searchString/*, position*/) {
/***/ },
/* 35 */,
/* 36 */
/* 36 */,
/* 37 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
@ -7719,7 +7721,7 @@ module.exports = Layout;
/***/ },
/* 37 */
/* 38 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
@ -7948,7 +7950,7 @@ module.exports = Locations;
/***/ },
/* 38 */
/* 39 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
@ -8185,7 +8187,7 @@ module.exports = Stage;
/***/ },
/* 39 */
/* 40 */
/***/ function(module, exports) {
function Views(container) {
@ -8356,7 +8358,7 @@ module.exports = Views;
/***/ },
/* 40 */
/* 41 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
@ -8472,7 +8474,7 @@ module.exports = Navigation;
/***/ },
/* 41 */
/* 42 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
@ -8632,13 +8634,13 @@ module.exports = Section;
/***/ },
/* 42 */
/* 43 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
var EpubCFI = __webpack_require__(1);
var Hook = __webpack_require__(6);
var Section = __webpack_require__(41);
var Section = __webpack_require__(42);
var replacements = __webpack_require__(13);
function Spine(_request){
@ -8773,12 +8775,12 @@ module.exports = Spine;
/***/ },
/* 43 */
/* 44 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
var request = __webpack_require__(4);
var mime = __webpack_require__(19);
var mime = __webpack_require__(20);
function Unarchive() {
@ -8792,7 +8794,7 @@ Unarchive.prototype.checkRequirements = function(callback){
if (typeof JSZip !== 'undefined') {
this.zip = new JSZip();
} else {
JSZip = __webpack_require__(44);
JSZip = __webpack_require__(45);
this.zip = new JSZip();
}
} catch (e) {
@ -8965,18 +8967,18 @@ module.exports = Unarchive;
/***/ },
/* 44 */
/* 45 */
/***/ function(module, exports) {
if(typeof __WEBPACK_EXTERNAL_MODULE_44__ === 'undefined') {var e = new Error("Cannot find module \"JSZip\""); e.code = 'MODULE_NOT_FOUND'; throw e;}
module.exports = __WEBPACK_EXTERNAL_MODULE_44__;
if(typeof __WEBPACK_EXTERNAL_MODULE_45__ === 'undefined') {var e = new Error("Cannot find module \"JSZip\""); e.code = 'MODULE_NOT_FOUND'; throw e;}
module.exports = __WEBPACK_EXTERNAL_MODULE_45__;
/***/ },
/* 45 */,
/* 46 */
/* 46 */,
/* 47 */
/***/ function(module, exports, __webpack_require__) {
var Book = __webpack_require__(16);
var Book = __webpack_require__(17);
var EpubCFI = __webpack_require__(1);
var Rendition = __webpack_require__(11);
var Contents = __webpack_require__(9);
@ -9003,11 +9005,11 @@ ePub.register = {
};
// Default Views
ePub.register.view("iframe", __webpack_require__(18));
ePub.register.view("iframe", __webpack_require__(19));
// Default View Managers
ePub.register.manager("default", __webpack_require__(10));
ePub.register.manager("continuous", __webpack_require__(17));
ePub.register.manager("continuous", __webpack_require__(18));
module.exports = ePub;

2
dist/epub.js.map vendored

File diff suppressed because one or more lines are too long

8
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

446
dist/polyfills.js vendored
View file

@ -71,7 +71,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ __webpack_require__.p = "/dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 47);
/******/ return __webpack_require__(__webpack_require__.s = 48);
/******/ })
/************************************************************************/
/******/ ({
@ -215,7 +215,7 @@ function flush() {
function attemptVertx() {
try {
var r = require;
var vertx = __webpack_require__(45);
var vertx = __webpack_require__(46);
vertxNext = vertx.runOnLoop || vertx.runOnContext;
return useVertxTimer();
} catch (e) {
@ -1238,11 +1238,442 @@ return Promise;
ES6Promise.polyfill();
//# sourceMappingURL=es6-promise.auto.map
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5), __webpack_require__(35)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5), __webpack_require__(36)))
/***/ },
/***/ 35:
/***/ 16:
/***/ function(module, exports) {
// URL Polyfill
// Draft specification: https://url.spec.whatwg.org
// Notes:
// - Primarily useful for parsing URLs and modifying query parameters
// - Should work in IE8+ and everything more modern
(function (global) {
'use strict';
// Browsers may have:
// * No global URL object
// * URL with static methods only - may have a dummy constructor
// * URL with members except searchParams
// * Full URL API support
var origURL = global.URL;
var nativeURL;
try {
if (origURL) {
nativeURL = new global.URL('http://example.com');
if ('searchParams' in nativeURL)
return;
if (!('href' in nativeURL))
nativeURL = undefined;
}
} catch (_) {}
// NOTE: Doesn't do the encoding/decoding dance
function urlencoded_serialize(pairs) {
var output = '', first = true;
pairs.forEach(function (pair) {
var name = encodeURIComponent(pair.name);
var value = encodeURIComponent(pair.value);
if (!first) output += '&';
output += name + '=' + value;
first = false;
});
return output.replace(/%20/g, '+');
}
// NOTE: Doesn't do the encoding/decoding dance
function urlencoded_parse(input, isindex) {
var sequences = input.split('&');
if (isindex && sequences[0].indexOf('=') === -1)
sequences[0] = '=' + sequences[0];
var pairs = [];
sequences.forEach(function (bytes) {
if (bytes.length === 0) return;
var index = bytes.indexOf('=');
if (index !== -1) {
var name = bytes.substring(0, index);
var value = bytes.substring(index + 1);
} else {
name = bytes;
value = '';
}
name = name.replace(/\+/g, ' ');
value = value.replace(/\+/g, ' ');
pairs.push({ name: name, value: value });
});
var output = [];
pairs.forEach(function (pair) {
output.push({
name: decodeURIComponent(pair.name),
value: decodeURIComponent(pair.value)
});
});
return output;
}
function URLUtils(url) {
if (nativeURL)
return new origURL(url);
var anchor = document.createElement('a');
anchor.href = url;
return anchor;
}
function URLSearchParams(init) {
var $this = this;
this._list = [];
if (init === undefined || init === null)
init = '';
if (Object(init) !== init || (init instanceof URLSearchParams))
init = String(init);
if (typeof init === 'string') {
if (init.substring(0, 1) === '?') {
init = init.substring(1);
}
this._list = urlencoded_parse(init);
}
this._url_object = null;
this._setList = function (list) { if (!updating) $this._list = list; };
var updating = false;
this._update_steps = function() {
if (updating) return;
updating = true;
if (!$this._url_object) return;
// Partial workaround for IE issue with 'about:'
if ($this._url_object.protocol === 'about:' &&
$this._url_object.pathname.indexOf('?') !== -1) {
$this._url_object.pathname = $this._url_object.pathname.split('?')[0];
}
$this._url_object.search = urlencoded_serialize($this._list);
updating = false;
};
}
Object.defineProperties(URLSearchParams.prototype, {
append: {
value: function (name, value) {
this._list.push({ name: name, value: value });
this._update_steps();
}, writable: true, enumerable: true, configurable: true
},
'delete': {
value: function (name) {
for (var i = 0; i < this._list.length;) {
if (this._list[i].name === name)
this._list.splice(i, 1);
else
++i;
}
this._update_steps();
}, writable: true, enumerable: true, configurable: true
},
get: {
value: function (name) {
for (var i = 0; i < this._list.length; ++i) {
if (this._list[i].name === name)
return this._list[i].value;
}
return null;
}, writable: true, enumerable: true, configurable: true
},
getAll: {
value: function (name) {
var result = [];
for (var i = 0; i < this._list.length; ++i) {
if (this._list[i].name === name)
result.push(this._list[i].value);
}
return result;
}, writable: true, enumerable: true, configurable: true
},
has: {
value: function (name) {
for (var i = 0; i < this._list.length; ++i) {
if (this._list[i].name === name)
return true;
}
return false;
}, writable: true, enumerable: true, configurable: true
},
set: {
value: function (name, value) {
var found = false;
for (var i = 0; i < this._list.length;) {
if (this._list[i].name === name) {
if (!found) {
this._list[i].value = value;
found = true;
++i;
} else {
this._list.splice(i, 1);
}
} else {
++i;
}
}
if (!found)
this._list.push({ name: name, value: value });
this._update_steps();
}, writable: true, enumerable: true, configurable: true
},
entries: {
value: function() {
var $this = this, index = 0;
return { next: function() {
if (index >= $this._list.length)
return {done: true, value: undefined};
var pair = $this._list[index++];
return {done: false, value: [pair.name, pair.value]};
}};
}, writable: true, enumerable: true, configurable: true
},
keys: {
value: function() {
var $this = this, index = 0;
return { next: function() {
if (index >= $this._list.length)
return {done: true, value: undefined};
var pair = $this._list[index++];
return {done: false, value: pair.name};
}};
}, writable: true, enumerable: true, configurable: true
},
values: {
value: function() {
var $this = this, index = 0;
return { next: function() {
if (index >= $this._list.length)
return {done: true, value: undefined};
var pair = $this._list[index++];
return {done: false, value: pair.value};
}};
}, writable: true, enumerable: true, configurable: true
},
forEach: {
value: function(callback) {
var thisArg = (arguments.length > 1) ? arguments[1] : undefined;
this._list.forEach(function(pair, index) {
callback.call(thisArg, pair.value, pair.name);
});
}, writable: true, enumerable: true, configurable: true
},
toString: {
value: function () {
return urlencoded_serialize(this._list);
}, writable: true, enumerable: false, configurable: true
}
});
if ('Symbol' in global && 'iterator' in global.Symbol) {
Object.defineProperty(URLSearchParams.prototype, global.Symbol.iterator, {
value: URLSearchParams.prototype.entries,
writable: true, enumerable: true, configurable: true});
}
function URL(url, base) {
if (!(this instanceof global.URL))
throw new TypeError("Failed to construct 'URL': Please use the 'new' operator.");
if (base) {
url = (function () {
if (nativeURL) return new origURL(url, base).href;
var doc;
// Use another document/base tag/anchor for relative URL resolution, if possible
if (document.implementation && document.implementation.createHTMLDocument) {
doc = document.implementation.createHTMLDocument('');
} else if (document.implementation && document.implementation.createDocument) {
doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null);
doc.documentElement.appendChild(doc.createElement('head'));
doc.documentElement.appendChild(doc.createElement('body'));
} else if (window.ActiveXObject) {
doc = new window.ActiveXObject('htmlfile');
doc.write('<head><\/head><body><\/body>');
doc.close();
}
if (!doc) throw Error('base not supported');
var baseTag = doc.createElement('base');
baseTag.href = base;
doc.getElementsByTagName('head')[0].appendChild(baseTag);
var anchor = doc.createElement('a');
anchor.href = url;
return anchor.href;
}());
}
// An inner object implementing URLUtils (either a native URL
// object or an HTMLAnchorElement instance) is used to perform the
// URL algorithms. With full ES5 getter/setter support, return a
// regular object For IE8's limited getter/setter support, a
// different HTMLAnchorElement is returned with properties
// overridden
var instance = URLUtils(url || '');
// Detect for ES5 getter/setter support
// (an Object.defineProperties polyfill that doesn't support getters/setters may throw)
var ES5_GET_SET = (function() {
if (!('defineProperties' in Object)) return false;
try {
var obj = {};
Object.defineProperties(obj, { prop: { 'get': function () { return true; } } });
return obj.prop;
} catch (_) {
return false;
}
})();
var self = ES5_GET_SET ? this : document.createElement('a');
var query_object = new URLSearchParams(
instance.search ? instance.search.substring(1) : null);
query_object._url_object = self;
Object.defineProperties(self, {
href: {
get: function () { return instance.href; },
set: function (v) { instance.href = v; tidy_instance(); update_steps(); },
enumerable: true, configurable: true
},
origin: {
get: function () {
if ('origin' in instance) return instance.origin;
return this.protocol + '//' + this.host;
},
enumerable: true, configurable: true
},
protocol: {
get: function () { return instance.protocol; },
set: function (v) { instance.protocol = v; },
enumerable: true, configurable: true
},
username: {
get: function () { return instance.username; },
set: function (v) { instance.username = v; },
enumerable: true, configurable: true
},
password: {
get: function () { return instance.password; },
set: function (v) { instance.password = v; },
enumerable: true, configurable: true
},
host: {
get: function () {
// IE returns default port in |host|
var re = {'http:': /:80$/, 'https:': /:443$/, 'ftp:': /:21$/}[instance.protocol];
return re ? instance.host.replace(re, '') : instance.host;
},
set: function (v) { instance.host = v; },
enumerable: true, configurable: true
},
hostname: {
get: function () { return instance.hostname; },
set: function (v) { instance.hostname = v; },
enumerable: true, configurable: true
},
port: {
get: function () { return instance.port; },
set: function (v) { instance.port = v; },
enumerable: true, configurable: true
},
pathname: {
get: function () {
// IE does not include leading '/' in |pathname|
if (instance.pathname.charAt(0) !== '/') return '/' + instance.pathname;
return instance.pathname;
},
set: function (v) { instance.pathname = v; },
enumerable: true, configurable: true
},
search: {
get: function () { return instance.search; },
set: function (v) {
if (instance.search === v) return;
instance.search = v; tidy_instance(); update_steps();
},
enumerable: true, configurable: true
},
searchParams: {
get: function () { return query_object; },
enumerable: true, configurable: true
},
hash: {
get: function () { return instance.hash; },
set: function (v) { instance.hash = v; tidy_instance(); },
enumerable: true, configurable: true
},
toString: {
value: function() { return instance.toString(); },
enumerable: false, configurable: true
},
valueOf: {
value: function() { return instance.valueOf(); },
enumerable: false, configurable: true
}
});
function tidy_instance() {
var href = instance.href.replace(/#$|\?$|\?(?=#)/g, '');
if (instance.href !== href)
instance.href = href;
}
function update_steps() {
query_object._setList(instance.search ? urlencoded_parse(instance.search.substring(1)) : []);
query_object._update_steps();
};
return self;
}
if (origURL) {
for (var i in origURL) {
if (origURL.hasOwnProperty(i) && typeof origURL[i] === 'function')
URL[i] = origURL[i];
}
}
global.URL = URL;
global.URLSearchParams = URLSearchParams;
}(self));
/***/ },
/***/ 36:
/***/ function(module, exports) {
var g;
@ -1268,17 +1699,18 @@ module.exports = g;
/***/ },
/***/ 45:
/***/ 46:
/***/ function(module, exports) {
/* (ignored) */
/***/ },
/***/ 47:
/***/ 48:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(15);
__webpack_require__(15);
module.exports = __webpack_require__(16);
/***/ },

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long