Skip to content

Commit

Permalink
Include url-polyfill by default, fix linear default to yes
Browse files Browse the repository at this point in the history
  • Loading branch information
fchasen committed Jul 3, 2017
1 parent 2caf885 commit fdf7fda
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(config) {

// {pattern: 'node_modules/es6-promise/dist/es6-promise.auto.js', watched: false, included: true, served: true},

{pattern: 'libs/url/url.js', watched: false, included: true, served: true}
{pattern: 'libs/url/url-polyfill.js', watched: false, included: true, served: true}

],

Expand Down
19 changes: 13 additions & 6 deletions libs/url/url.js → libs/url/url-polyfill.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
/* From https://github.com/webcomponents/URL/blob/master/url.js
* Added UMD, file link handling */

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// Fix for this being undefined in modules
if (!root) {
root = window || global;
}
if (typeof module === 'object' && module.exports) {
// Node
console.log("root", root);
module.exports = factory(root);
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(global);
} else {
// Browser globals (root is window)
root.URL = factory(root);
}
}(this, function (scope) {

// feature detect for URL constructor
var hasWorkingUrl = false;
if (!scope.forceJURL) {
Expand Down Expand Up @@ -595,7 +602,7 @@
// WebKit/Blink returns String("SCHEME://") for file: mailto:
switch (this._scheme) {
case 'file':
return 'file://'
return 'file://' // EPUBJS Added
case 'data':
case 'javascript':
case 'mailto':
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "epubjs",
"version": "0.3.38",
"version": "0.3.39",
"description": "Parse and Render Epubs",
"main": "lib/index.js",
"module": "src/index.js",
Expand Down
1 change: 1 addition & 0 deletions src/epub.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import EpubCFI from "./epubcfi";
import Rendition from "./rendition";
import Contents from "./contents";
import * as core from "./utils/core";
import '../libs/url/url-polyfill'

/**
* Creates a new Book
Expand Down
2 changes: 1 addition & 1 deletion src/packaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class Packaging {

var itemref = {
"idref" : idref,
"linear" : item.getAttribute("linear") || "",
"linear" : item.getAttribute("linear") || "yes",
"properties" : propArray,
// "href" : manifest[Id].href,
// "url" : manifest[Id].url,
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var LEGACY = (process.env.LEGACY)
var hostname = "localhost";
var port = 8080;
var enter = LEGACY ? {
"epub.legacy": ["babel-polyfill", "./libs/url/url.js", "./src/epub.js"]
"epub.legacy": ["babel-polyfill", "./src/epub.js"]
} : {
"epub": "./src/epub.js",
};
Expand Down

0 comments on commit fdf7fda

Please sign in to comment.