Comparing version 0.3.15 to 0.3.16
@@ -683,2 +683,12 @@ "use strict"; | ||
}, { | ||
key: "cfiFromRange", | ||
value: function cfiFromRange(range, ignoreClass) { | ||
return new _epubcfi2.default(range, this.cfiBase, ignoreClass).toString(); | ||
} | ||
}, { | ||
key: "cfiFromNode", | ||
value: function cfiFromNode(node, ignoreClass) { | ||
return new _epubcfi2.default(node, this.cfiBase, ignoreClass).toString(); | ||
} | ||
}, { | ||
key: "map", | ||
@@ -685,0 +695,0 @@ value: function map(layout) { |
@@ -78,3 +78,4 @@ "use strict"; | ||
minSpreadWidth: 800, | ||
stylesheet: null | ||
stylesheet: null, | ||
script: null | ||
}); | ||
@@ -120,2 +121,6 @@ | ||
if (this.settings.script) { | ||
this.book.spine.hooks.content.register(this.injectScript.bind(this)); | ||
} | ||
// this.hooks.display.register(this.afterDisplay.bind(this)); | ||
@@ -742,2 +747,11 @@ this.themes = new _themes2.default(this); | ||
} | ||
}, { | ||
key: "injectScript", | ||
value: function injectScript(doc, section) { | ||
var script = doc.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", this.settings.script); | ||
script.textContent = " "; // Needed to prevent self closing tag | ||
doc.getElementsByTagName("head")[0].appendChild(script); | ||
} | ||
}]); | ||
@@ -744,0 +758,0 @@ |
{ | ||
"name": "epubjs", | ||
"version": "0.3.15", | ||
"version": "0.3.16", | ||
"description": "Parse and Render Epubs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -636,2 +636,10 @@ import EventEmitter from "event-emitter"; | ||
cfiFromRange(range, ignoreClass){ | ||
return new EpubCFI(range, this.cfiBase, ignoreClass).toString(); | ||
} | ||
cfiFromNode(node, ignoreClass){ | ||
return new EpubCFI(node, this.cfiBase, ignoreClass).toString(); | ||
} | ||
map(layout){ | ||
@@ -638,0 +646,0 @@ var map = new Mapping(layout); |
@@ -39,3 +39,4 @@ import EventEmitter from "event-emitter"; | ||
minSpreadWidth: 800, | ||
stylesheet: null | ||
stylesheet: null, | ||
script: null | ||
}); | ||
@@ -81,2 +82,6 @@ | ||
if (this.settings.script) { | ||
this.book.spine.hooks.content.register(this.injectScript.bind(this)); | ||
} | ||
// this.hooks.display.register(this.afterDisplay.bind(this)); | ||
@@ -641,2 +646,11 @@ this.themes = new Themes(this); | ||
} | ||
injectScript(doc, section) { | ||
let script = doc.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", this.settings.script); | ||
script.textContent = " "; // Needed to prevent self closing tag | ||
doc.getElementsByTagName("head")[0].appendChild(script); | ||
} | ||
} | ||
@@ -643,0 +657,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
2103607
35789