-
Notifications
You must be signed in to change notification settings - Fork 34
Injectables
Aferdita Muriqi edited this page May 25, 2020
·
4 revisions
<script>
var injectables = [
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-before.css', r2before: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-default.css', r2default: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-after.css', r2after: true },
]
D2Reader.load({
url: new URL("http....."),
injectables: injectables
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var injectables = [
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-before.css', r2before: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-default.css', r2default: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-after.css', r2after: true },
{ type: 'script', url: 'http://localhost:4444/viewer/injectables/footnotes/footnotes.js' },
{ type: 'style', url: 'http://localhost:4444/viewer/injectables/footnotes/footnotes.css' },
]
D2Reader.load({
url: new URL("http....."),
injectables: injectables
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var injectables = [
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-before.css', r2before: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-default.css', r2default: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-after.css', r2after: true },
// in this example the footnotes script will be injected first
{ type: 'script', url: 'http://localhost:4444/viewer/injectables/footnotes/footnotes.js' },
{ type: 'style', url: 'http://localhost:4444/viewer/injectables/footnotes/footnotes.css' },
// then the glossary script
{ type: 'script', url: 'http://localhost:4444/viewer/injectables/glossary/glossary.js' },
{ type: 'style', url: 'http://localhost:4444/viewer/injectables/glossary/glossary.css' },
]
D2Reader.load({
url: new URL("http....."),
injectables: injectables
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var injectables = [
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-before.css', r2before: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-default.css', r2default: true },
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/ReadiumCSS-after.css', r2after: true },
{ type: 'script', url: 'http://localhost:4444/viewer/injectables/footnotes/footnotes.js' },
{ type: 'style', url: 'http://localhost:4444/viewer/injectables/footnotes/footnotes.css' },
{ type: 'style', url: 'http://localhost:4444/viewer/fonts/opendyslexic/opendyslexic.css', fontFamily: 'opendyslexic', systemFont: false },
{ type: 'style', fontFamily: 'Courier', systemFont: true },
]
D2Reader.load({
url: new URL("http....."),
injectables: injectables
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var injectables = [
{ type: 'style', url: 'http://localhost:4444/viewer/readium-css/neon-after.css', r2after: true, appearance: 'neon' },
]
D2Reader.load({
url: new URL("http....."),
injectables: injectables
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
// Enforce synchronous behaviour of injected scripts
// unless specifically marked async, as though they
// were inserted using <script> tags
//
// See comment on differing default behaviour of
// dynamically inserted script loading at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#Attributes
<script>
var injectables = [
{ type: 'script', url: 'http://localhost:4444/....js' async: true },
]
D2Reader.load({
url: new URL("http....."),
injectables: injectables
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
- GitHub Package
- Initialize Reader
-
Injectables
- Readium CSS
- Footnotes
- Glossary
- Fonts
- Pagebreak
- Injectable Context Menu
-
Reader API
- User Settings API
- Navigator API
- Bookmark API
- Annotation API
- TTS API
- Search API
- Callback API
-
Modules
- Bookmarks
- Annotations
- Search
- TTS