minor fixes

This commit is contained in:
Jon Dough
2024-04-05 07:05:26 +00:00
parent ddf88ed2fc
commit c457119b95
4 changed files with 33 additions and 11 deletions

View File

@@ -52,8 +52,8 @@ for (let listing_type of ["anime", "manga", "music"]) {
name: listing_name, name: listing_name,
type: listing_type, type: listing_type,
favourites: { favourites: {
listing: favourites_info[listing_name] ? favourites_info[listing_name].favourites.listing : false, listing: favourites_info[`${listing_type}-${listing_name}`] ? favourites_info[`${listing_type}-${listing_name}`].favourites.listing : false,
chapters: favourites_info[listing_name] ? favourites_info[listing_name].favourites.chapters : [], chapters: favourites_info[`${listing_type}-${listing_name}`] ? favourites_info[`${listing_type}-${listing_name}`].favourites.chapters : [],
} }
}) })
).filter( ).filter(

View File

@@ -1,5 +1,5 @@
{ {
"senpai-wa-otokonoko": { "manga-senpai-wa-otokonoko": {
"favourites": { "favourites": {
"listing": true, "listing": true,
"chapters": [ "chapters": [
@@ -8,13 +8,13 @@
] ]
} }
} }
"bocchi-the-boulder": { "anime-bocchi-the-boulder": {
"favourites": { "favourites": {
"listing": true, "listing": true,
"chapters": [] "chapters": []
} }
}, },
"not-buna": { "music-not-buna": {
"favourites": { "favourites": {
"listing": false, "listing": false,
"chapters": [ "chapters": [
@@ -22,7 +22,7 @@
] ]
} }
}, },
"arizona-philips": { "music-arizona-philips": {
"favourites": { "favourites": {
"listing": true, "listing": true,
"chapters": [] "chapters": []

View File

@@ -7,7 +7,7 @@
</head> </head>
<body> <body>
<div id="main"> <div id="main">
<input id="master-password" type="password"> <input id="master-password" type="password" onkeydown="detect_enter(event)">
<button onclick="get_passwords()">get</button> <button onclick="get_passwords()">get</button>
<br> <br>
<span id="computed"></span> <span id="computed"></span>
@@ -15,10 +15,6 @@
<span id="computed2"></span> <span id="computed2"></span>
</div> </div>
<script> <script>
function get_passwords() {
get_password(new Date(), "computed");
get_password(new Date((new Date()).getTime() + 24 * 60 * 60 * 1000), "computed2");
}
async function get_password(date, el) { async function get_password(date, el) {
//password changes every day //password changes every day
const master_bytes = new TextEncoder().encode(`${document.getElementById("master-password").value}${date.getUTCFullYear()}-${date.getUTCMonth()}-${date.getUTCDate()}`); const master_bytes = new TextEncoder().encode(`${document.getElementById("master-password").value}${date.getUTCFullYear()}-${date.getUTCMonth()}-${date.getUTCDate()}`);
@@ -32,6 +28,13 @@
} }
document.getElementById(el).innerText = hash_hex.toLowerCase(); document.getElementById(el).innerText = hash_hex.toLowerCase();
} }
function get_passwords() {
get_password(new Date(), "computed");
get_password(new Date((new Date()).getTime() + 24 * 60 * 60 * 1000), "computed2");
}
function detect_enter(e) {
if (e.key === "Enter") get_passwords();
}
</script> </script>
</body> </body>
</html> </html>

View File

@@ -14,6 +14,9 @@
.music { .music {
margin: 25px; margin: 25px;
} }
#captions-box {
height: 1em;
}
</style> </style>
</head> </head>
<body> <body>
@@ -24,9 +27,25 @@
<br> <br>
<audio controls> <audio controls>
<source src="/music_assets/[[ listing.name ]]/[[ chapter ]].mp3" type="audio/mpeg"> <source src="/music_assets/[[ listing.name ]]/[[ chapter ]].mp3" type="audio/mpeg">
<track id="audio-captions" default kind="captions" src="/music_subtitle_assets/[[ listing.name ]]/[[ chapter ]].vtt"/>
</audio> </audio>
<div id="captions-box">
</div>
[[ component:nav ]] <!-- id: nav --> [[ component:nav ]] <!-- id: nav -->
</div> </div>
</div> </div>
<script>
let captions_ele = document.getElementById("audio-captions");
let captions_box = document.getElementById("captions-box");
captions_ele.addEventListener("cuechange", () => {
//do we need to sanitize this? surely not, right?
captions_box.innerHTML = "";
let active_cue = captions_ele.track.activeCues[0];
if (active_cue) {
captions_box.appendChild(active_cue.getCueAsHTML());
}
});
</script>
</body> </body>
</html> </html>