formatted timestamps
This commit is contained in:
parent
72502368b2
commit
0f6a5c3a9e
@ -129,6 +129,9 @@ button .tooltip {
|
|||||||
.movie-buttons a {
|
.movie-buttons a {
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.timestamp .original {
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
@media screen and (max-width: 1200px) {
|
@media screen and (max-width: 1200px) {
|
||||||
.inner {
|
.inner {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
22
autoindex.js
22
autoindex.js
@ -50,6 +50,14 @@ function findByInfoFile(infoFile) {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pZ = (n) => n.toString().padStart(2, '0');
|
||||||
|
function restampDateTime(datetime, includeTime = true) {
|
||||||
|
const date = new Date(datetime);
|
||||||
|
const [month, day, year] = [date.getMonth() + 1, date.getDate(), date.getFullYear()];
|
||||||
|
const [hour, minutes, seconds] = [date.getHours(), date.getMinutes(), date.getSeconds()];
|
||||||
|
return `${pZ(day)}/${pZ(month)}/${year}${includeTime ? ` ${pZ(hour)}:${pZ(minutes)}:${pZ(seconds)}` : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
function deduplicateJointEpisode(textContent) {
|
function deduplicateJointEpisode(textContent) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const lns = textContent.split('\n');
|
const lns = textContent.split('\n');
|
||||||
@ -99,7 +107,11 @@ function fillMeta(
|
|||||||
if (airedEl || premieredEl) {
|
if (airedEl || premieredEl) {
|
||||||
const timestamp = original.parentElement.parentElement.querySelector('.timestamp');
|
const timestamp = original.parentElement.parentElement.querySelector('.timestamp');
|
||||||
if (timestamp) {
|
if (timestamp) {
|
||||||
timestamp.innerText = (airedEl || premieredEl).textContent;
|
const original = timestamp.innerText;
|
||||||
|
const airdate = restampDateTime((airedEl || premieredEl).textContent, false);
|
||||||
|
const wrapper = `<span class="airdate">${airdate}</span>`;
|
||||||
|
const originalWrapper = ` <span class="original">(${original})</span>`;
|
||||||
|
timestamp.innerHTML = wrapper + originalWrapper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +208,12 @@ function createOrImproveMovieMeta(original, thumbnail, nfo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function timestampify() {
|
||||||
|
Array.from(document.body.querySelectorAll('.timestamp')).forEach((stamp) => {
|
||||||
|
stamp.innerText = restampDateTime(stamp.innerText);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Promise that resolves when all info files that were found have been parsed
|
// Promise that resolves when all info files that were found have been parsed
|
||||||
function waitUntilInfoComplete() {
|
function waitUntilInfoComplete() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -331,10 +349,12 @@ function createToggleCheckbox(field, value, description) {
|
|||||||
if ('localStorage' in window) {
|
if ('localStorage' in window) {
|
||||||
const plainMode = window.localStorage.getItem('plainMode');
|
const plainMode = window.localStorage.getItem('plainMode');
|
||||||
if (plainMode !== 'true') {
|
if (plainMode !== 'true') {
|
||||||
|
timestampify();
|
||||||
accountForMetadata();
|
accountForMetadata();
|
||||||
}
|
}
|
||||||
createToggleCheckbox('plainMode', plainMode, 'Disable metadata / display plain index listing (less bandwidth required)');
|
createToggleCheckbox('plainMode', plainMode, 'Disable metadata / display plain index listing (less bandwidth required)');
|
||||||
} else {
|
} else {
|
||||||
|
timestampify();
|
||||||
accountForMetadata();
|
accountForMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user