-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into time
- Loading branch information
Showing
13 changed files
with
212 additions
and
31 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
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
let next = document.querySelector("a.next"); | ||
let next = document.querySelector('a.next'); | ||
let previous = document.querySelector('a.previous'); | ||
|
||
if (next) { | ||
window.addEventListener("keydown", e => { | ||
if (e.key == "ArrowRight") { | ||
window.location = next.href; | ||
} | ||
}); | ||
} | ||
|
||
let previous = document.querySelector("a.previous"); | ||
window.addEventListener('keydown', e => { | ||
if (document.activeElement.tagName == 'INPUT') { | ||
return; | ||
} | ||
|
||
if (previous) { | ||
window.addEventListener("keydown", e => { | ||
if (e.key == "ArrowLeft") { | ||
window.location = previous.href; | ||
} | ||
}); | ||
} | ||
switch (e.key) { | ||
case 'ArrowRight': | ||
if (next) { | ||
window.location = next.href; | ||
} | ||
return; | ||
case 'ArrowLeft': | ||
if (previous) { | ||
window.location = previous.href; | ||
} | ||
return; | ||
} | ||
}); | ||
|
||
for (let time of document.body.getElementsByTagName("time")) { | ||
for (let time of document.body.getElementsByTagName('time')) { | ||
time.setAttribute('title', new Date(time.textContent)); | ||
} |
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,14 @@ | ||
html { | ||
height: 100%; | ||
} | ||
|
||
body { | ||
height: 100%; | ||
margin: 0; | ||
} | ||
|
||
canvas { | ||
height: 100%; | ||
width: 100%; | ||
object-fit: contain; | ||
} |
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,23 @@ | ||
import pdfjs from 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.2.146/+esm'; | ||
|
||
pdfjs.GlobalWorkerOptions.workerSrc = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.2.146/build/pdf.worker.min.js'; | ||
|
||
let canvas = document.querySelector('canvas'); | ||
|
||
let pdf = await pdfjs.getDocument(`/content/${canvas.dataset.inscription}`).promise; | ||
|
||
let page = await pdf.getPage(1); | ||
|
||
let scale = window.devicePixelRatio || 1; | ||
|
||
let viewport = page.getViewport({ scale }); | ||
|
||
canvas.width = Math.ceil(viewport.width * scale); | ||
|
||
canvas.height = Math.ceil(viewport.height * scale); | ||
|
||
page.render({ | ||
canvasContext: canvas.getContext('2d'), | ||
transform: [scale, 0, 0, scale, 0, 0], | ||
viewport, | ||
}); |
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,16 @@ | ||
html { | ||
background-color: #131516; | ||
height: 100%; | ||
} | ||
|
||
body { | ||
align-items: center; | ||
display: flex; | ||
height: 100%; | ||
margin: 0; | ||
} | ||
|
||
video { | ||
height: 100%; | ||
width: 100%; | ||
} |
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,11 @@ | ||
<!doctype html> | ||
<html lang=en> | ||
<head> | ||
<meta charset=utf-8> | ||
<link rel=stylesheet href=/static/preview-pdf.css> | ||
<script src=/static/preview-pdf.js defer type=module></script> | ||
</head> | ||
<body> | ||
<canvas data-inscription={{self.inscription_id}}></canvas> | ||
</body> | ||
</html> |
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,12 @@ | ||
<!doctype html> | ||
<html lang=en> | ||
<head> | ||
<meta charset=utf-8> | ||
<link rel=stylesheet href=/static/preview-video.css> | ||
</head> | ||
<body> | ||
<video controls loop> | ||
<source src=/content/{{self.inscription_id}}> | ||
</video> | ||
</body> | ||
</html> |