forked from biblioverse/biblioteca
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
2,689 additions
and
2,370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<div id="area" style="width: 100vw; height: 100vh; min-height: 95vh;"> | ||
<vue-reader | ||
:url="props.file" | ||
:showToc="true" | ||
:getRendition="getRendition" | ||
backgroundColor="#000" | ||
@update:location="locationChange" | ||
:location="getInitialLocation()" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({'file': String}) | ||
import { VueReader } from 'vue-book-reader' | ||
const initialCfi = new URLSearchParams(window.location.search).get('cfi'); | ||
const locationChange = (detail) => { | ||
const { fraction } = detail | ||
console.log('locationChange', fraction, detail) | ||
history.pushState({fraction: fraction, }, document.title, "?cfi=" + encodeURIComponent(detail.cfi) + "#page="+ detail.location.current+"&percent=" + (fraction * 100).toFixed(2)); | ||
} | ||
const getInitialLocation = () => { | ||
return initialCfi ?? null | ||
} | ||
const getRendition = async (rendition) => { | ||
rendition.renderer.setStyles([ | ||
` | ||
html { | ||
background: #000; | ||
color: #fff; | ||
}`, | ||
]) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createApp } from 'vue' | ||
import ReadEBook from './ReadEbook.vue' | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
const file = document.getElementById('mount').getAttribute('data-file') | ||
createApp(ReadEBook, {file: file}).mount('#mount'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.