mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
Switched from URIjs to URL and Node Path
This commit is contained in:
parent
869a170564
commit
315650006e
22 changed files with 1060 additions and 3614 deletions
3950
dist/epub.js
vendored
3950
dist/epub.js
vendored
File diff suppressed because it is too large
Load diff
2
dist/epub.js.map
vendored
2
dist/epub.js.map
vendored
File diff suppressed because one or more lines are too long
64
dist/epub.min.js
vendored
64
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
386
dist/polyfills.js
vendored
386
dist/polyfills.js
vendored
|
@ -44,7 +44,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
/******/
|
/******/
|
||||||
/******/ // __webpack_public_path__
|
/******/ // __webpack_public_path__
|
||||||
/******/ __webpack_require__.p = "";
|
/******/ __webpack_require__.p = "/dist/";
|
||||||
/******/
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(0);
|
/******/ return __webpack_require__(0);
|
||||||
|
@ -55,12 +55,199 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
/***/ 0:
|
/***/ 0:
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
module.exports = __webpack_require__(47);
|
module.exports = __webpack_require__(44);
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
|
|
||||||
/***/ 47:
|
/***/ 18:
|
||||||
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
|
// shim for using process in browser
|
||||||
|
var process = module.exports = {};
|
||||||
|
|
||||||
|
// cached from whatever global is present so that test runners that stub it
|
||||||
|
// don't break things. But we need to wrap it in a try catch in case it is
|
||||||
|
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
||||||
|
// function because try/catches deoptimize in certain engines.
|
||||||
|
|
||||||
|
var cachedSetTimeout;
|
||||||
|
var cachedClearTimeout;
|
||||||
|
|
||||||
|
function defaultSetTimout() {
|
||||||
|
throw new Error('setTimeout has not been defined');
|
||||||
|
}
|
||||||
|
function defaultClearTimeout () {
|
||||||
|
throw new Error('clearTimeout has not been defined');
|
||||||
|
}
|
||||||
|
(function () {
|
||||||
|
try {
|
||||||
|
if (typeof setTimeout === 'function') {
|
||||||
|
cachedSetTimeout = setTimeout;
|
||||||
|
} else {
|
||||||
|
cachedSetTimeout = defaultSetTimout;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
cachedSetTimeout = defaultSetTimout;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (typeof clearTimeout === 'function') {
|
||||||
|
cachedClearTimeout = clearTimeout;
|
||||||
|
} else {
|
||||||
|
cachedClearTimeout = defaultClearTimeout;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
cachedClearTimeout = defaultClearTimeout;
|
||||||
|
}
|
||||||
|
} ())
|
||||||
|
function runTimeout(fun) {
|
||||||
|
if (cachedSetTimeout === setTimeout) {
|
||||||
|
//normal enviroments in sane situations
|
||||||
|
return setTimeout(fun, 0);
|
||||||
|
}
|
||||||
|
// if setTimeout wasn't available but was latter defined
|
||||||
|
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
||||||
|
cachedSetTimeout = setTimeout;
|
||||||
|
return setTimeout(fun, 0);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||||
|
return cachedSetTimeout(fun, 0);
|
||||||
|
} catch(e){
|
||||||
|
try {
|
||||||
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||||
|
return cachedSetTimeout.call(null, fun, 0);
|
||||||
|
} catch(e){
|
||||||
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||||||
|
return cachedSetTimeout.call(this, fun, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function runClearTimeout(marker) {
|
||||||
|
if (cachedClearTimeout === clearTimeout) {
|
||||||
|
//normal enviroments in sane situations
|
||||||
|
return clearTimeout(marker);
|
||||||
|
}
|
||||||
|
// if clearTimeout wasn't available but was latter defined
|
||||||
|
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||||||
|
cachedClearTimeout = clearTimeout;
|
||||||
|
return clearTimeout(marker);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||||
|
return cachedClearTimeout(marker);
|
||||||
|
} catch (e){
|
||||||
|
try {
|
||||||
|
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||||
|
return cachedClearTimeout.call(null, marker);
|
||||||
|
} catch (e){
|
||||||
|
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||||||
|
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||||||
|
return cachedClearTimeout.call(this, marker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
var queue = [];
|
||||||
|
var draining = false;
|
||||||
|
var currentQueue;
|
||||||
|
var queueIndex = -1;
|
||||||
|
|
||||||
|
function cleanUpNextTick() {
|
||||||
|
if (!draining || !currentQueue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
draining = false;
|
||||||
|
if (currentQueue.length) {
|
||||||
|
queue = currentQueue.concat(queue);
|
||||||
|
} else {
|
||||||
|
queueIndex = -1;
|
||||||
|
}
|
||||||
|
if (queue.length) {
|
||||||
|
drainQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function drainQueue() {
|
||||||
|
if (draining) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var timeout = runTimeout(cleanUpNextTick);
|
||||||
|
draining = true;
|
||||||
|
|
||||||
|
var len = queue.length;
|
||||||
|
while(len) {
|
||||||
|
currentQueue = queue;
|
||||||
|
queue = [];
|
||||||
|
while (++queueIndex < len) {
|
||||||
|
if (currentQueue) {
|
||||||
|
currentQueue[queueIndex].run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queueIndex = -1;
|
||||||
|
len = queue.length;
|
||||||
|
}
|
||||||
|
currentQueue = null;
|
||||||
|
draining = false;
|
||||||
|
runClearTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.nextTick = function (fun) {
|
||||||
|
var args = new Array(arguments.length - 1);
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
args[i - 1] = arguments[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queue.push(new Item(fun, args));
|
||||||
|
if (queue.length === 1 && !draining) {
|
||||||
|
runTimeout(drainQueue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// v8 likes predictible objects
|
||||||
|
function Item(fun, array) {
|
||||||
|
this.fun = fun;
|
||||||
|
this.array = array;
|
||||||
|
}
|
||||||
|
Item.prototype.run = function () {
|
||||||
|
this.fun.apply(null, this.array);
|
||||||
|
};
|
||||||
|
process.title = 'browser';
|
||||||
|
process.browser = true;
|
||||||
|
process.env = {};
|
||||||
|
process.argv = [];
|
||||||
|
process.version = ''; // empty string to avoid regexp issues
|
||||||
|
process.versions = {};
|
||||||
|
|
||||||
|
function noop() {}
|
||||||
|
|
||||||
|
process.on = noop;
|
||||||
|
process.addListener = noop;
|
||||||
|
process.once = noop;
|
||||||
|
process.off = noop;
|
||||||
|
process.removeListener = noop;
|
||||||
|
process.removeAllListeners = noop;
|
||||||
|
process.emit = noop;
|
||||||
|
|
||||||
|
process.binding = function (name) {
|
||||||
|
throw new Error('process.binding is not supported');
|
||||||
|
};
|
||||||
|
|
||||||
|
process.cwd = function () { return '/' };
|
||||||
|
process.chdir = function (dir) {
|
||||||
|
throw new Error('process.chdir is not supported');
|
||||||
|
};
|
||||||
|
process.umask = function() { return 0; };
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
|
||||||
|
/***/ 44:
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
var require;/* WEBPACK VAR INJECTION */(function(process, global) {/*!
|
var require;/* WEBPACK VAR INJECTION */(function(process, global) {/*!
|
||||||
|
@ -199,7 +386,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
function attemptVertx() {
|
function attemptVertx() {
|
||||||
try {
|
try {
|
||||||
var r = require;
|
var r = require;
|
||||||
var vertx = __webpack_require__(49);
|
var vertx = __webpack_require__(45);
|
||||||
vertxNext = vertx.runOnLoop || vertx.runOnContext;
|
vertxNext = vertx.runOnLoop || vertx.runOnContext;
|
||||||
return useVertxTimer();
|
return useVertxTimer();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -1222,198 +1409,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
ES6Promise.polyfill();
|
ES6Promise.polyfill();
|
||||||
//# sourceMappingURL=es6-promise.auto.map
|
//# sourceMappingURL=es6-promise.auto.map
|
||||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(48), (function() { return this; }())))
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18), (function() { return this; }())))
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
|
|
||||||
/***/ 48:
|
/***/ 45:
|
||||||
/***/ function(module, exports) {
|
|
||||||
|
|
||||||
// shim for using process in browser
|
|
||||||
var process = module.exports = {};
|
|
||||||
|
|
||||||
// cached from whatever global is present so that test runners that stub it
|
|
||||||
// don't break things. But we need to wrap it in a try catch in case it is
|
|
||||||
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
||||||
// function because try/catches deoptimize in certain engines.
|
|
||||||
|
|
||||||
var cachedSetTimeout;
|
|
||||||
var cachedClearTimeout;
|
|
||||||
|
|
||||||
function defaultSetTimout() {
|
|
||||||
throw new Error('setTimeout has not been defined');
|
|
||||||
}
|
|
||||||
function defaultClearTimeout () {
|
|
||||||
throw new Error('clearTimeout has not been defined');
|
|
||||||
}
|
|
||||||
(function () {
|
|
||||||
try {
|
|
||||||
if (typeof setTimeout === 'function') {
|
|
||||||
cachedSetTimeout = setTimeout;
|
|
||||||
} else {
|
|
||||||
cachedSetTimeout = defaultSetTimout;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
cachedSetTimeout = defaultSetTimout;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (typeof clearTimeout === 'function') {
|
|
||||||
cachedClearTimeout = clearTimeout;
|
|
||||||
} else {
|
|
||||||
cachedClearTimeout = defaultClearTimeout;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
cachedClearTimeout = defaultClearTimeout;
|
|
||||||
}
|
|
||||||
} ())
|
|
||||||
function runTimeout(fun) {
|
|
||||||
if (cachedSetTimeout === setTimeout) {
|
|
||||||
//normal enviroments in sane situations
|
|
||||||
return setTimeout(fun, 0);
|
|
||||||
}
|
|
||||||
// if setTimeout wasn't available but was latter defined
|
|
||||||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
||||||
cachedSetTimeout = setTimeout;
|
|
||||||
return setTimeout(fun, 0);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
||||||
return cachedSetTimeout(fun, 0);
|
|
||||||
} catch(e){
|
|
||||||
try {
|
|
||||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
||||||
return cachedSetTimeout.call(null, fun, 0);
|
|
||||||
} catch(e){
|
|
||||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
||||||
return cachedSetTimeout.call(this, fun, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
function runClearTimeout(marker) {
|
|
||||||
if (cachedClearTimeout === clearTimeout) {
|
|
||||||
//normal enviroments in sane situations
|
|
||||||
return clearTimeout(marker);
|
|
||||||
}
|
|
||||||
// if clearTimeout wasn't available but was latter defined
|
|
||||||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
||||||
cachedClearTimeout = clearTimeout;
|
|
||||||
return clearTimeout(marker);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
||||||
return cachedClearTimeout(marker);
|
|
||||||
} catch (e){
|
|
||||||
try {
|
|
||||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
||||||
return cachedClearTimeout.call(null, marker);
|
|
||||||
} catch (e){
|
|
||||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
||||||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
||||||
return cachedClearTimeout.call(this, marker);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
var queue = [];
|
|
||||||
var draining = false;
|
|
||||||
var currentQueue;
|
|
||||||
var queueIndex = -1;
|
|
||||||
|
|
||||||
function cleanUpNextTick() {
|
|
||||||
if (!draining || !currentQueue) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
draining = false;
|
|
||||||
if (currentQueue.length) {
|
|
||||||
queue = currentQueue.concat(queue);
|
|
||||||
} else {
|
|
||||||
queueIndex = -1;
|
|
||||||
}
|
|
||||||
if (queue.length) {
|
|
||||||
drainQueue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function drainQueue() {
|
|
||||||
if (draining) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var timeout = runTimeout(cleanUpNextTick);
|
|
||||||
draining = true;
|
|
||||||
|
|
||||||
var len = queue.length;
|
|
||||||
while(len) {
|
|
||||||
currentQueue = queue;
|
|
||||||
queue = [];
|
|
||||||
while (++queueIndex < len) {
|
|
||||||
if (currentQueue) {
|
|
||||||
currentQueue[queueIndex].run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queueIndex = -1;
|
|
||||||
len = queue.length;
|
|
||||||
}
|
|
||||||
currentQueue = null;
|
|
||||||
draining = false;
|
|
||||||
runClearTimeout(timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
process.nextTick = function (fun) {
|
|
||||||
var args = new Array(arguments.length - 1);
|
|
||||||
if (arguments.length > 1) {
|
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
|
||||||
args[i - 1] = arguments[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queue.push(new Item(fun, args));
|
|
||||||
if (queue.length === 1 && !draining) {
|
|
||||||
runTimeout(drainQueue);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// v8 likes predictible objects
|
|
||||||
function Item(fun, array) {
|
|
||||||
this.fun = fun;
|
|
||||||
this.array = array;
|
|
||||||
}
|
|
||||||
Item.prototype.run = function () {
|
|
||||||
this.fun.apply(null, this.array);
|
|
||||||
};
|
|
||||||
process.title = 'browser';
|
|
||||||
process.browser = true;
|
|
||||||
process.env = {};
|
|
||||||
process.argv = [];
|
|
||||||
process.version = ''; // empty string to avoid regexp issues
|
|
||||||
process.versions = {};
|
|
||||||
|
|
||||||
function noop() {}
|
|
||||||
|
|
||||||
process.on = noop;
|
|
||||||
process.addListener = noop;
|
|
||||||
process.once = noop;
|
|
||||||
process.off = noop;
|
|
||||||
process.removeListener = noop;
|
|
||||||
process.removeAllListeners = noop;
|
|
||||||
process.emit = noop;
|
|
||||||
|
|
||||||
process.binding = function (name) {
|
|
||||||
throw new Error('process.binding is not supported');
|
|
||||||
};
|
|
||||||
|
|
||||||
process.cwd = function () { return '/' };
|
|
||||||
process.chdir = function (dir) {
|
|
||||||
throw new Error('process.chdir is not supported');
|
|
||||||
};
|
|
||||||
process.umask = function() { return 0; };
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
|
|
||||||
/***/ 49:
|
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
/* (ignored) */
|
/* (ignored) */
|
||||||
|
|
2
dist/polyfills.js.map
vendored
2
dist/polyfills.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/polyfills.min.js
vendored
4
dist/polyfills.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -72,7 +72,8 @@ gulp.task('minify', ['bundle'], function(){
|
||||||
|
|
||||||
// Watch Our Files
|
// Watch Our Files
|
||||||
gulp.task('watch', function(cb) {
|
gulp.task('watch', function(cb) {
|
||||||
webpack(webpackConfig, function(err, stats) {
|
|
||||||
|
watchCompiler.watch({}, function(err, stats) {
|
||||||
if(err) {
|
if(err) {
|
||||||
throw new gutil.PluginError("webpack", err);
|
throw new gutil.PluginError("webpack", err);
|
||||||
}
|
}
|
||||||
|
|
81
src/book.js
81
src/book.js
|
@ -1,5 +1,5 @@
|
||||||
var EventEmitter = require('event-emitter');
|
var EventEmitter = require('event-emitter');
|
||||||
var URI = require('urijs');
|
var path = require('path');
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
var Spine = require('./spine');
|
var Spine = require('./spine');
|
||||||
var Locations = require('./locations');
|
var Locations = require('./locations');
|
||||||
|
@ -73,14 +73,14 @@ function Book(_url, options){
|
||||||
};
|
};
|
||||||
|
|
||||||
Book.prototype.open = function(_url, options){
|
Book.prototype.open = function(_url, options){
|
||||||
var uri;
|
var url;
|
||||||
|
var pathname;
|
||||||
var parse = new Parser();
|
var parse = new Parser();
|
||||||
var epubPackage;
|
var epubPackage;
|
||||||
var epubContainer;
|
var epubContainer;
|
||||||
var book = this;
|
var book = this;
|
||||||
var containerPath = "META-INF/container.xml";
|
var containerPath = "META-INF/container.xml";
|
||||||
var location;
|
var location;
|
||||||
var absoluteUri;
|
|
||||||
var isArrayBuffer = false;
|
var isArrayBuffer = false;
|
||||||
var isBase64 = options && options.base64;
|
var isBase64 = options && options.base64;
|
||||||
|
|
||||||
|
@ -98,13 +98,14 @@ Book.prototype.open = function(_url, options){
|
||||||
if (_url instanceof ArrayBuffer || isBase64) {
|
if (_url instanceof ArrayBuffer || isBase64) {
|
||||||
isArrayBuffer = true;
|
isArrayBuffer = true;
|
||||||
this.url = '/';
|
this.url = '/';
|
||||||
} else {
|
|
||||||
uri = URI(_url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window && window.location && uri) {
|
if (window && window.location && !isArrayBuffer) {
|
||||||
absoluteUri = uri.absoluteTo(window.location.href);
|
// absoluteUri = uri.absoluteTo(window.location.href);
|
||||||
this.url = absoluteUri.toString();
|
url = new URL(_url, window.location.href);
|
||||||
|
pathname = url.pathname;
|
||||||
|
// this.url = absoluteUri.toString();
|
||||||
|
this.url = url.toString();
|
||||||
} else if (window && window.location) {
|
} else if (window && window.location) {
|
||||||
this.url = window.location.href;
|
this.url = window.location.href;
|
||||||
} else {
|
} else {
|
||||||
|
@ -112,18 +113,20 @@ Book.prototype.open = function(_url, options){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find path to the Container
|
// Find path to the Container
|
||||||
if(uri && uri.suffix() === "opf") {
|
// if(uri && uri.suffix() === "opf") {
|
||||||
|
if(url && core.extension(pathname) === "opf") {
|
||||||
// Direct link to package, no container
|
// Direct link to package, no container
|
||||||
this.packageUrl = _url;
|
this.packageUrl = _url;
|
||||||
this.containerUrl = '';
|
this.containerUrl = '';
|
||||||
|
|
||||||
if(uri.origin()) {
|
if(url.origin) {
|
||||||
this.baseUrl = uri.origin() + "/" + uri.directory() + "/";
|
// this.baseUrl = uri.origin() + uri.directory() + "/";
|
||||||
} else if(absoluteUri){
|
this.baseUrl = url.origin + "/" + path.dirname(pathname) + "/";
|
||||||
this.baseUrl = absoluteUri.origin();
|
// } else if(absoluteUri){
|
||||||
this.baseUrl += absoluteUri.directory() + "/";
|
// this.baseUrl = absoluteUri.origin();
|
||||||
|
// this.baseUrl += absoluteUri.directory() + "/";
|
||||||
} else {
|
} else {
|
||||||
this.baseUrl = uri.directory() + "/";
|
this.baseUrl = path.dirname(pathname) + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
epubPackage = this.request(this.packageUrl)
|
epubPackage = this.request(this.packageUrl)
|
||||||
|
@ -131,10 +134,11 @@ Book.prototype.open = function(_url, options){
|
||||||
book.opening.reject(error);
|
book.opening.reject(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if(isArrayBuffer || isBase64 || this.isArchivedUrl(uri)) {
|
} else if(isArrayBuffer || isBase64 || this.isArchivedUrl(_url)) {
|
||||||
// Book is archived
|
// Book is archived
|
||||||
this.url = '/';
|
this.url = '';
|
||||||
this.containerUrl = URI(containerPath).absoluteTo(this.url).toString();
|
// this.containerUrl = URI(containerPath).absoluteTo(this.url).toString();
|
||||||
|
this.containerUrl = path.resolve("", containerPath);
|
||||||
|
|
||||||
epubContainer = this.unarchive(_url, isBase64).
|
epubContainer = this.unarchive(_url, isBase64).
|
||||||
then(function() {
|
then(function() {
|
||||||
|
@ -145,7 +149,7 @@ Book.prototype.open = function(_url, options){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Find the path to the Package from the container
|
// Find the path to the Package from the container
|
||||||
else if (!uri.suffix()) {
|
else if (!core.extension(pathname)) {
|
||||||
|
|
||||||
this.containerUrl = this.url + containerPath;
|
this.containerUrl = this.url + containerPath;
|
||||||
|
|
||||||
|
@ -162,21 +166,29 @@ Book.prototype.open = function(_url, options){
|
||||||
return parse.container(containerXml); // Container has path to content
|
return parse.container(containerXml); // Container has path to content
|
||||||
}).
|
}).
|
||||||
then(function(paths){
|
then(function(paths){
|
||||||
var packageUri = URI(paths.packagePath);
|
// var packageUri = URI(paths.packagePath);
|
||||||
var absPackageUri = packageUri.absoluteTo(book.url);
|
// var absPackageUri = packageUri.absoluteTo(book.url);
|
||||||
var absWindowUri;
|
var packageUrl;
|
||||||
|
|
||||||
book.packageUrl = absPackageUri.toString();
|
if (book.url) {
|
||||||
|
packageUrl = new URL(paths.packagePath, book.url);
|
||||||
|
book.packageUrl = packageUrl.toString();
|
||||||
|
} else {
|
||||||
|
book.packageUrl = "/" + paths.packagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
book.packagePath = paths.packagePath;
|
||||||
book.encoding = paths.encoding;
|
book.encoding = paths.encoding;
|
||||||
|
|
||||||
// Set Url relative to the content
|
// Set Url relative to the content
|
||||||
if(absPackageUri.origin()) {
|
if(packageUrl && packageUrl.origin) {
|
||||||
book.baseUrl = absPackageUri.origin() + absPackageUri.directory() + "/";
|
book.baseUrl = book.url + path.dirname(paths.packagePath) + "/";
|
||||||
} else {
|
} else {
|
||||||
if(packageUri.directory()) {
|
if(path.dirname(paths.packagePath)) {
|
||||||
book.baseUrl = "/" + packageUri.directory() + "/";
|
book.baseUrl = ""
|
||||||
|
book.basePath = "/" + path.dirname(paths.packagePath) + "/";
|
||||||
} else {
|
} else {
|
||||||
book.baseUrl = "/"
|
book.basePath = "/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +240,7 @@ Book.prototype.unpack = function(packageXml){
|
||||||
}
|
}
|
||||||
|
|
||||||
book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
|
book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
|
||||||
|
book.package.basePath = book.basePath; // Provides a url base for resolving paths
|
||||||
|
|
||||||
this.spine.load(book.package);
|
this.spine.load(book.package);
|
||||||
|
|
||||||
|
@ -240,8 +253,11 @@ Book.prototype.unpack = function(packageXml){
|
||||||
// //-- Set Global Layout setting based on metadata
|
// //-- Set Global Layout setting based on metadata
|
||||||
// MOVE TO RENDER
|
// MOVE TO RENDER
|
||||||
// book.globalLayoutProperties = book.parseLayoutProperties(book.package.metadata);
|
// book.globalLayoutProperties = book.parseLayoutProperties(book.package.metadata);
|
||||||
|
if (book.baseUrl) {
|
||||||
book.cover = URI(book.package.coverPath).absoluteTo(book.baseUrl).toString();
|
book.cover = new URL(book.package.coverPath, book.baseUrl).toString();
|
||||||
|
} else {
|
||||||
|
book.cover = path.resolve(book.baseUrl, book.package.coverPath);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Alias for book.spine.get
|
// Alias for book.spine.get
|
||||||
|
@ -286,7 +302,6 @@ Book.prototype.unarchive = function(bookUrl, isBase64){
|
||||||
|
|
||||||
//-- Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
|
//-- Checks if url has a .epub or .zip extension, or is ArrayBuffer (of zip/epub)
|
||||||
Book.prototype.isArchivedUrl = function(bookUrl){
|
Book.prototype.isArchivedUrl = function(bookUrl){
|
||||||
var uri;
|
|
||||||
var extension;
|
var extension;
|
||||||
|
|
||||||
if (bookUrl instanceof ArrayBuffer) {
|
if (bookUrl instanceof ArrayBuffer) {
|
||||||
|
@ -299,8 +314,8 @@ Book.prototype.isArchivedUrl = function(bookUrl){
|
||||||
// } else {
|
// } else {
|
||||||
// uri = core.uri(bookUrl);
|
// uri = core.uri(bookUrl);
|
||||||
// }
|
// }
|
||||||
uri = URI(bookUrl);
|
// uri = URI(bookUrl);
|
||||||
extension = uri.suffix();
|
extension = core.extension(bookUrl);
|
||||||
|
|
||||||
if(extension && (extension == "epub" || extension == "zip")){
|
if(extension && (extension == "epub" || extension == "zip")){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -303,7 +303,13 @@ Contents.prototype.mediaQueryListeners = function() {
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
for (var i = 0; i < sheets.length; i += 1) {
|
for (var i = 0; i < sheets.length; i += 1) {
|
||||||
var rules = sheets[i].cssRules;
|
var rules;
|
||||||
|
// Firefox errors if we access cssRules cross-domain
|
||||||
|
try {
|
||||||
|
rules = sheets[i].cssRules;
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!rules) return; // Stylesheets changed
|
if(!rules) return; // Stylesheets changed
|
||||||
for (var j = 0; j < rules.length; j += 1) {
|
for (var j = 0; j < rules.length; j += 1) {
|
||||||
//if (rules[j].constructor === CSSMediaRule) {
|
//if (rules[j].constructor === CSSMediaRule) {
|
||||||
|
|
39
src/core.js
39
src/core.js
|
@ -1,4 +1,5 @@
|
||||||
var base64 = require('base64-js');
|
var base64 = require('base64-js');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
var requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;
|
var requestAnimationFrame = (typeof window != 'undefined') ? (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame) : false;
|
||||||
/*
|
/*
|
||||||
|
@ -82,6 +83,42 @@ function folder(url){
|
||||||
|
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function extension(_url) {
|
||||||
|
var url;
|
||||||
|
var pathname;
|
||||||
|
var ext;
|
||||||
|
|
||||||
|
try {
|
||||||
|
url = new Url(url);
|
||||||
|
pathname = url.pathname;
|
||||||
|
} catch (e) {
|
||||||
|
pathname = _url;
|
||||||
|
}
|
||||||
|
|
||||||
|
ext = path.extname(pathname);
|
||||||
|
if (ext) {
|
||||||
|
return ext.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function directory(_url) {
|
||||||
|
var url;
|
||||||
|
var pathname;
|
||||||
|
var ext;
|
||||||
|
|
||||||
|
try {
|
||||||
|
url = new Url(url);
|
||||||
|
pathname = url.pathname;
|
||||||
|
} catch (e) {
|
||||||
|
pathname = _url;
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.dirname(pathname);
|
||||||
|
}
|
||||||
|
|
||||||
function isElement(obj) {
|
function isElement(obj) {
|
||||||
return !!(obj && obj.nodeType == 1);
|
return !!(obj && obj.nodeType == 1);
|
||||||
};
|
};
|
||||||
|
@ -537,6 +574,8 @@ function defer() {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// 'uri': uri,
|
// 'uri': uri,
|
||||||
// 'folder': folder,
|
// 'folder': folder,
|
||||||
|
'extension' : extension,
|
||||||
|
'directory' : directory,
|
||||||
'isElement': isElement,
|
'isElement': isElement,
|
||||||
'uuid': uuid,
|
'uuid': uuid,
|
||||||
'values': values,
|
'values': values,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
var URI = require('urijs');
|
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -162,6 +162,7 @@ IframeView.prototype.render = function(request, show) {
|
||||||
|
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.catch(function(e){
|
.catch(function(e){
|
||||||
|
console.error(e);
|
||||||
this.emit("loaderror", e);
|
this.emit("loaderror", e);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ var EventEmitter = require('event-emitter');
|
||||||
var core = require('../../core');
|
var core = require('../../core');
|
||||||
var EpubCFI = require('../../epubcfi');
|
var EpubCFI = require('../../epubcfi');
|
||||||
var Contents = require('../../contents');
|
var Contents = require('../../contents');
|
||||||
var URI = require('urijs');
|
// var URI = require('urijs');
|
||||||
|
|
||||||
function InlineView(section, options) {
|
function InlineView(section, options) {
|
||||||
this.settings = core.extend({
|
this.settings = core.extend({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
var Parser = require('./parser');
|
var Parser = require('./parser');
|
||||||
var URI = require('urijs');
|
var path = require('path');
|
||||||
|
|
||||||
function Navigation(_package, _request){
|
function Navigation(_package, _request){
|
||||||
var navigation = this;
|
var navigation = this;
|
||||||
|
@ -13,7 +13,11 @@ function Navigation(_package, _request){
|
||||||
this.tocById = {};
|
this.tocById = {};
|
||||||
|
|
||||||
if(_package.navPath) {
|
if(_package.navPath) {
|
||||||
this.navUrl = URI(_package.navPath).absoluteTo(_package.baseUrl).toString();
|
if (_package.baseUrl) {
|
||||||
|
this.navUrl = new URL(_package.navPath, _package.baseUrl).toString();
|
||||||
|
} else {
|
||||||
|
this.navUrl = path.resolve(_package.basePath, _package.navPath);
|
||||||
|
}
|
||||||
this.nav = {};
|
this.nav = {};
|
||||||
|
|
||||||
this.nav.load = function(_request){
|
this.nav.load = function(_request){
|
||||||
|
@ -32,7 +36,12 @@ function Navigation(_package, _request){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_package.ncxPath) {
|
if(_package.ncxPath) {
|
||||||
this.ncxUrl = URI(_package.ncxPath).absoluteTo(_package.baseUrl).toString();
|
if (_package.baseUrl) {
|
||||||
|
this.ncxUrl = new URL(_package.ncxPath, _package.baseUrl).toString();
|
||||||
|
} else {
|
||||||
|
this.ncxUrl = path.resolve(_package.basePath, _package.ncxPath);
|
||||||
|
}
|
||||||
|
|
||||||
this.ncx = {};
|
this.ncx = {};
|
||||||
|
|
||||||
this.ncx.load = function(_request){
|
this.ncx.load = function(_request){
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var URI = require('urijs');
|
var path = require('path');
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
var EpubCFI = require('./epubcfi');
|
var EpubCFI = require('./epubcfi');
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ Parser.prototype.container = function(containerXml){
|
||||||
}
|
}
|
||||||
|
|
||||||
fullpath = rootfile.getAttribute('full-path');
|
fullpath = rootfile.getAttribute('full-path');
|
||||||
folder = URI(fullpath).directory();
|
folder = path.dirname(fullpath);
|
||||||
encoding = containerXml.xmlEncoding;
|
encoding = containerXml.xmlEncoding;
|
||||||
|
|
||||||
//-- Now that we have the path we can parse the contents
|
//-- Now that we have the path we can parse the contents
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var EventEmitter = require('event-emitter');
|
var EventEmitter = require('event-emitter');
|
||||||
var URI = require('urijs');
|
var path = require('path');
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
var replace = require('./replacements');
|
var replace = require('./replacements');
|
||||||
var Hook = require('./hook');
|
var Hook = require('./hook');
|
||||||
|
@ -440,7 +440,8 @@ Rendition.prototype.replacements = function(){
|
||||||
// Create blob urls for all the assets
|
// Create blob urls for all the assets
|
||||||
var processing = urls.
|
var processing = urls.
|
||||||
map(function(url) {
|
map(function(url) {
|
||||||
var absolute = URI(url).absoluteTo(this.book.baseUrl).toString();
|
// var absolute = new URL(url, this.book.baseUrl).toString();
|
||||||
|
var absolute = path.resolve(this.book.basePath, url);
|
||||||
// Full url from archive base
|
// Full url from archive base
|
||||||
return this.book.unarchived.createUrl(absolute, {"base64": this.settings.useBase64});
|
return this.book.unarchived.createUrl(absolute, {"base64": this.settings.useBase64});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -483,15 +484,43 @@ Rendition.prototype.replaceCss = function(href, urls, replacementUrls){
|
||||||
var indexInUrls;
|
var indexInUrls;
|
||||||
|
|
||||||
// Find the absolute url of the css file
|
// Find the absolute url of the css file
|
||||||
var fileUri = URI(href);
|
// var fileUri = URI(href);
|
||||||
var absolute = fileUri.absoluteTo(this.book.baseUrl).toString();
|
// var absolute = fileUri.absoluteTo(this.book.baseUrl).toString();
|
||||||
|
|
||||||
|
if (path.isAbsolute(href)) {
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
resolve(urls, replacementUrls);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileUri;
|
||||||
|
var absolute;
|
||||||
|
if (this.book.baseUrl) {
|
||||||
|
fileUri = new URL(href, this.book.baseUrl);
|
||||||
|
absolute = fileUri.toString();
|
||||||
|
} else {
|
||||||
|
absolute = path.resolve(this.book.basePath, href);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get the text of the css file from the archive
|
// Get the text of the css file from the archive
|
||||||
var textResponse = this.book.unarchived.getText(absolute);
|
var textResponse = this.book.unarchived.getText(absolute);
|
||||||
// Get asset links relative to css file
|
// Get asset links relative to css file
|
||||||
var relUrls = urls.
|
var relUrls = urls.
|
||||||
map(function(assetHref) {
|
map(function(assetHref) {
|
||||||
var assetUri = URI(assetHref).absoluteTo(this.book.baseUrl);
|
// var assetUri = URI(assetHref).absoluteTo(this.book.baseUrl);
|
||||||
var relative = assetUri.relativeTo(absolute).toString();
|
// var relative = assetUri.relativeTo(absolute).toString();
|
||||||
|
|
||||||
|
var assetUrl;
|
||||||
|
var relativeUrl;
|
||||||
|
if (this.book.baseUrl) {
|
||||||
|
assetUrl = new URL(assetHref, this.book.baseUrl);
|
||||||
|
relative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);
|
||||||
|
} else {
|
||||||
|
assetUrl = path.resolve(this.book.basePath, assetHref);
|
||||||
|
relative = path.relative(path.dirname(absolute), assetUrl);
|
||||||
|
}
|
||||||
|
|
||||||
return relative;
|
return relative;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
@ -521,12 +550,32 @@ Rendition.prototype.replaceCss = function(href, urls, replacementUrls){
|
||||||
};
|
};
|
||||||
|
|
||||||
Rendition.prototype.replaceAssets = function(section, urls, replacementUrls){
|
Rendition.prototype.replaceAssets = function(section, urls, replacementUrls){
|
||||||
var fileUri = URI(section.url);
|
// var fileUri = URI(section.url);
|
||||||
|
var fileUri;
|
||||||
|
var absolute;
|
||||||
|
if (this.book.baseUrl) {
|
||||||
|
fileUri = new URL(section.url, this.book.baseUrl);
|
||||||
|
absolute = fileUri.toString();
|
||||||
|
} else {
|
||||||
|
absolute = path.resolve(this.book.basePath, section.url);
|
||||||
|
}
|
||||||
|
|
||||||
// Get Urls relative to current sections
|
// Get Urls relative to current sections
|
||||||
var relUrls = urls.
|
var relUrls = urls.
|
||||||
map(function(href) {
|
map(function(href) {
|
||||||
var assetUri = URI(href).absoluteTo(this.book.baseUrl);
|
// var assetUri = URI(href).absoluteTo(this.book.baseUrl);
|
||||||
var relative = assetUri.relativeTo(fileUri).toString();
|
// var relative = assetUri.relativeTo(fileUri).toString();
|
||||||
|
|
||||||
|
var assetUrl;
|
||||||
|
var relativeUrl;
|
||||||
|
if (this.book.baseUrl) {
|
||||||
|
assetUrl = new URL(href, this.book.baseUrl);
|
||||||
|
relative = path.relative(path.dirname(fileUri.pathname), assetUrl.pathname);
|
||||||
|
} else {
|
||||||
|
assetUrl = path.resolve(this.book.basePath, href);
|
||||||
|
relative = path.relative(path.dirname(absolute), assetUrl);
|
||||||
|
}
|
||||||
|
|
||||||
return relative;
|
return relative;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var URI = require('urijs');
|
// var URI = require('urijs');
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
|
|
||||||
function base(doc, section){
|
function base(doc, section){
|
||||||
|
@ -54,11 +54,22 @@ function links(view, renderer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var linkUri = URI(href);
|
// var linkUri = URI(href);
|
||||||
var absolute = linkUri.absoluteTo(view.section.url);
|
// var absolute = linkUri.absoluteTo(view.section.url);
|
||||||
var relative = absolute.relativeTo(this.book.baseUrl).toString();
|
// var relative = absolute.relativeTo(this.book.baseUrl).toString();
|
||||||
|
var linkUrl;
|
||||||
|
var linkPath;
|
||||||
|
var relative;
|
||||||
|
|
||||||
if(linkUri.protocol()){
|
if (this.book.baseUrl) {
|
||||||
|
linkUrl = new URL(href, this.book.baseUrl);
|
||||||
|
relative = path.relative(path.dirname(linkUrl.pathname), this.book.packagePath);
|
||||||
|
} else {
|
||||||
|
linkPath = path.resolve(this.book.basePath, href);
|
||||||
|
relative = path.relative(this.book.packagePath, linkPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(linkUrl && linkUrl.protocol){
|
||||||
|
|
||||||
link.setAttribute("target", "_blank");
|
link.setAttribute("target", "_blank");
|
||||||
|
|
||||||
|
@ -79,14 +90,14 @@ function links(view, renderer) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(linkUri.fragment()) {
|
// if(linkUri.fragment()) {
|
||||||
// do nothing with fragment yet
|
// do nothing with fragment yet
|
||||||
} else {
|
// } else {
|
||||||
link.onclick = function(){
|
link.onclick = function(){
|
||||||
renderer.display(relative);
|
renderer.display(relative);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
var URI = require('urijs');
|
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
|
|
||||||
function request(url, type, withCredentials, headers) {
|
function request(url, type, withCredentials, headers) {
|
||||||
|
@ -41,8 +40,9 @@ function request(url, type, withCredentials, headers) {
|
||||||
|
|
||||||
// If type isn't set, determine it from the file extension
|
// If type isn't set, determine it from the file extension
|
||||||
if(!type) {
|
if(!type) {
|
||||||
uri = URI(url);
|
// uri = new URI(url);
|
||||||
type = uri.suffix();
|
// type = uri.suffix();
|
||||||
|
type = core.extension(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == 'blob'){
|
if(type == 'blob'){
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
var URI = require('urijs');
|
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
var EpubCFI = require('./epubcfi');
|
var EpubCFI = require('./epubcfi');
|
||||||
var Hook = require('./hook');
|
var Hook = require('./hook');
|
||||||
|
@ -37,7 +36,7 @@ Section.prototype.load = function(_request){
|
||||||
request(this.url)
|
request(this.url)
|
||||||
.then(function(xml){
|
.then(function(xml){
|
||||||
var base;
|
var base;
|
||||||
var directory = URI(this.url).directory();
|
var directory = core.directory(this.url);
|
||||||
|
|
||||||
this.document = xml;
|
this.document = xml;
|
||||||
this.contents = xml.documentElement;
|
this.contents = xml.documentElement;
|
||||||
|
|
|
@ -28,7 +28,7 @@ Spine.prototype.load = function(_package) {
|
||||||
this.items = _package.spine;
|
this.items = _package.spine;
|
||||||
this.manifest = _package.manifest;
|
this.manifest = _package.manifest;
|
||||||
this.spineNodeIndex = _package.spineNodeIndex;
|
this.spineNodeIndex = _package.spineNodeIndex;
|
||||||
this.baseUrl = _package.baseUrl || '';
|
this.baseUrl = _package.baseUrl || _package.basePath || '';
|
||||||
this.length = this.items.length;
|
this.length = this.items.length;
|
||||||
|
|
||||||
this.items.forEach(function(item, index){
|
this.items.forEach(function(item, index){
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
var URI = require('urijs');
|
|
||||||
var core = require('./core');
|
var core = require('./core');
|
||||||
var request = require('./request');
|
var request = require('./request');
|
||||||
var mime = require('../libs/mime/mime');
|
var mime = require('../libs/mime/mime');
|
||||||
|
@ -41,8 +40,7 @@ Unarchive.prototype.request = function(url, type){
|
||||||
|
|
||||||
// If type isn't set, determine it from the file extension
|
// If type isn't set, determine it from the file extension
|
||||||
if(!type) {
|
if(!type) {
|
||||||
uri = URI(url);
|
type = core.extension(url);
|
||||||
type = uri.suffix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == 'blob'){
|
if(type == 'blob'){
|
||||||
|
|
|
@ -16,7 +16,8 @@ module.exports = {
|
||||||
filename: "[name].js",
|
filename: "[name].js",
|
||||||
sourceMapFilename: "[name].js.map",
|
sourceMapFilename: "[name].js.map",
|
||||||
library: "ePub",
|
library: "ePub",
|
||||||
libraryTarget: "umd"
|
libraryTarget: "umd",
|
||||||
|
publicPath: "/dist/"
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
"jszip": "JSZip",
|
"jszip": "JSZip",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue