js:foliate-js:reader

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
js:foliate-js:reader [2024/03/26 13:05] – créée avillepreuxjs:foliate-js:reader [2024/03/26 13:52] (Version actuelle) – ancienne révision (2024/03/26 13:27) restaurée avillepreux
Ligne 1: Ligne 1:
-<JS>+<html><script type="module">
  
-import './view.js' +import 'https://johnfactotum.github.io/foliate-js/view.js' 
-import { createTOCView } from './ui/tree.js' +import { createTOCView } from 'https://johnfactotum.github.io/foliate-js/ui/tree.js' 
-import { createMenu } from './ui/menu.js' +import { createMenu } from 'https://johnfactotum.github.io/foliate-js/ui/menu.js' 
-import { Overlayer } from './overlayer.js'+import { Overlayer } from 'https://johnfactotum.github.io/foliate-js/overlayer.js'
  
 const isZip = async file => { const isZip = async file => {
Ligne 20: Ligne 20:
 const makeZipLoader = async file => { const makeZipLoader = async file => {
     const { configure, ZipReader, BlobReader, TextWriter, BlobWriter } =     const { configure, ZipReader, BlobReader, TextWriter, BlobWriter } =
-        await import('./vendor/zip.js')+        await import('https://johnfactotum.github.io/foliate-js/vendor/zip.js')
     configure({ useWebWorkers: false })     configure({ useWebWorkers: false })
     const reader = new ZipReader(new BlobReader(file))     const reader = new ZipReader(new BlobReader(file))
Ligne 70: Ligne 70:
     if (file.isDirectory) {     if (file.isDirectory) {
         const loader = await makeDirectoryLoader(file)         const loader = await makeDirectoryLoader(file)
-        const { EPUB } = await import('./epub.js')+        const { EPUB } = await import('https://johnfactotum.github.io/foliate-js/epub.js')
         book = await new EPUB(loader).init()         book = await new EPUB(loader).init()
     }     }
Ligne 77: Ligne 77:
         const loader = await makeZipLoader(file)         const loader = await makeZipLoader(file)
         if (isCBZ(file)) {         if (isCBZ(file)) {
-            const { makeComicBook } = await import('./comic-book.js')+            const { makeComicBook } = await import('https://johnfactotum.github.io/foliate-js/comic-book.js')
             book = makeComicBook(loader, file)             book = makeComicBook(loader, file)
         } else if (isFBZ(file)) {         } else if (isFBZ(file)) {
-            const { makeFB2 } = await import('./fb2.js')+            const { makeFB2 } = await import('https://johnfactotum.github.io/foliate-js/fb2.js')
             const { entries } = loader             const { entries } = loader
             const entry = entries.find(entry => entry.filename.endsWith('.fb2'))             const entry = entries.find(entry => entry.filename.endsWith('.fb2'))
Ligne 86: Ligne 86:
             book = await makeFB2(blob)             book = await makeFB2(blob)
         } else {         } else {
-            const { EPUB } = await import('./epub.js')+            const { EPUB } = await import('https://johnfactotum.github.io/foliate-js/epub.js')
             book = await new EPUB(loader).init()             book = await new EPUB(loader).init()
         }         }
     }     }
     else if (await isPDF(file)) {     else if (await isPDF(file)) {
-        const { makePDF } = await import('./pdf.js')+        const { makePDF } = await import('https://johnfactotum.github.io/foliate-js/pdf.js')
         book = await makePDF(file)         book = await makePDF(file)
     }     }
     else {     else {
-        const { isMOBI, MOBI } = await import('./mobi.js')+        const { isMOBI, MOBI } = await import('https://johnfactotum.github.io/foliate-js/mobi.js')
         if (await isMOBI(file)) {         if (await isMOBI(file)) {
-            const fflate = await import('./vendor/fflate.js')+            const fflate = await import('https://johnfactotum.github.io/foliate-js/vendor/fflate.js')
             book = await new MOBI({ unzlib: fflate.unzlibSync }).open(file)             book = await new MOBI({ unzlib: fflate.unzlibSync }).open(file)
         } else if (isFB2(file)) {         } else if (isFB2(file)) {
-            const { makeFB2 } = await import('./fb2.js')+            const { makeFB2 } = await import('https://johnfactotum.github.io/foliate-js/fb2.js')
             book = await makeFB2(file)             book = await makeFB2(file)
         }         }
Ligne 106: Ligne 106:
     if (!book) throw new Error('File type not supported')     if (!book) throw new Error('File type not supported')
     const view = document.createElement('foliate-view')     const view = document.createElement('foliate-view')
-    document.body.append(view)+    document.querySelector("#ebook").append(view)
     await view.open(book)     await view.open(book)
     return view     return view
Ligne 299: Ligne 299:
  
 const open = async file => { const open = async file => {
-    document.body.removeChild($('#drop-target'))+    document.querySelector("#ebook").removeChild($('#drop-target'))
     const reader = new Reader()     const reader = new Reader()
     globalThis.reader = reader     globalThis.reader = reader
Ligne 331: Ligne 331:
 else dropTarget.style.visibility = 'visible' else dropTarget.style.visibility = 'visible'
  
-</JS>+</script></html>
  • js/foliate-js/reader.1711454744.txt.gz
  • Dernière modification : 2024/03/26 13:05
  • de avillepreux