generated from acdh-oeaw/template-app-nuxt
-
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.
Merge branch 'feat/iiif-viewer' into dev
- Loading branch information
Showing
11 changed files
with
357 additions
and
41 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
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ node_modules/ | |
|
||
# generated libs | ||
lib/api.ts | ||
# generated manifests | ||
assets/manifests/ | ||
|
||
# logs | ||
*.log | ||
|
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,42 @@ | ||
<script setup lang="ts"> | ||
import "tify/dist/tify.css"; | ||
import "tify"; | ||
import type { Manifest } from "@iiif/presentation-3"; | ||
const route = useRoute(); | ||
const router = useRouter(); | ||
const manifest = ref<Manifest>(); | ||
onMounted(async () => { | ||
let manifestUrl; | ||
const page = route.query.page; | ||
if (typeof route.query.book === "string") { | ||
const book = route.query.book.replaceAll(/\(|\)/g, ""); | ||
manifestUrl = await import(`~/assets/manifests/${decodeURI(book)}.json?url`); | ||
manifest.value = await import(`~/assets/manifests/${decodeURI(book)}.json`); | ||
} | ||
if (manifest.value === undefined) return; | ||
const pageIdx = manifest.value.items.findIndex((item) => item.label?.de?.[0] === page); | ||
//@ts-expect-error no Tify export | ||
const tify = new Tify({ | ||
container: "#tify", | ||
manifestUrl: manifestUrl.default, | ||
pages: [pageIdx + 1], | ||
}); | ||
tify.ready.then(() => { | ||
tify.viewer.addHandler("open", () => { | ||
const page = tify.options.pages[0] ?? 1; | ||
void router.replace({ | ||
query: { page: manifest.value?.items[page - 1]?.label?.de?.[0], book: route.query.book }, | ||
}); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div id="tify" class="h-full"></div> | ||
</template> |
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
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
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
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
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,15 @@ | ||
<script setup lang="ts"> | ||
import IiifViewer from "@/components/iiif-viewer.vue"; | ||
definePageMeta({ | ||
title: "Pages.iiif.title", | ||
}); | ||
</script> | ||
|
||
<template> | ||
<main> | ||
<ClientOnly> | ||
<IiifViewer></IiifViewer> | ||
</ClientOnly> | ||
</main> | ||
</template> |
Oops, something went wrong.