code dump
This commit is contained in:
parent
445c5c35be
commit
a4150f41ce
44
autoindex.js
44
autoindex.js
@ -5,16 +5,16 @@ const infoRegex = /(-thumb)?\.(jpg|nfo|srt)$/;
|
||||
|
||||
const arrow = `
|
||||
<svg version="1.1" id="back-arrow" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 492 492" style="enable-background:new 0 0 492 492;" xml:space="preserve">
|
||||
viewBox="0 0 492 492" style="enable-background:new 0 0 492 492;" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#fff" d="M464.344,207.418l0.768,0.168H135.888l103.496-103.724c5.068-5.064,7.848-11.924,7.848-19.124
|
||||
c0-7.2-2.78-14.012-7.848-19.088L223.28,49.538c-5.064-5.064-11.812-7.864-19.008-7.864c-7.2,0-13.952,2.78-19.016,7.844
|
||||
L7.844,226.914C2.76,231.998-0.02,238.77,0,245.974c-0.02,7.244,2.76,14.02,7.844,19.096l177.412,177.412
|
||||
c5.064,5.06,11.812,7.844,19.016,7.844c7.196,0,13.944-2.788,19.008-7.844l16.104-16.112c5.068-5.056,7.848-11.808,7.848-19.008
|
||||
c0-7.196-2.78-13.592-7.848-18.652L134.72,284.406h329.992c14.828,0,27.288-12.78,27.288-27.6v-22.788
|
||||
C492,219.198,479.172,207.418,464.344,207.418z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#fff" d="M464.344,207.418l0.768,0.168H135.888l103.496-103.724c5.068-5.064,7.848-11.924,7.848-19.124
|
||||
c0-7.2-2.78-14.012-7.848-19.088L223.28,49.538c-5.064-5.064-11.812-7.864-19.008-7.864c-7.2,0-13.952,2.78-19.016,7.844
|
||||
L7.844,226.914C2.76,231.998-0.02,238.77,0,245.974c-0.02,7.244,2.76,14.02,7.844,19.096l177.412,177.412
|
||||
c5.064,5.06,11.812,7.844,19.016,7.844c7.196,0,13.944-2.788,19.008-7.844l16.104-16.112c5.068-5.056,7.848-11.808,7.848-19.008
|
||||
c0-7.196-2.78-13.592-7.848-18.652L134.72,284.406h329.992c14.828,0,27.288-12.78,27.288-27.6v-22.788
|
||||
C492,219.198,479.172,207.418,464.344,207.418z"/>
|
||||
</g>
|
||||
</svg>
|
||||
`
|
||||
|
||||
@ -45,7 +45,7 @@ function deduplicateJointEpisode(textContent) {
|
||||
result.push(line);
|
||||
}
|
||||
resolve(result.join('\n'));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
const parser = new window.DOMParser();
|
||||
@ -76,6 +76,7 @@ function createOrImproveMovieMeta(original, thumbnail, nfo) {
|
||||
original.classList.add('movie');
|
||||
original.innerHTML = imgTag + '<div class="meta-wrap">' + movieTitle + movieDescription + '</div>';
|
||||
original.parentElement.classList.add('enhanced');
|
||||
// quick innerHTML hack to create elements here lol
|
||||
imgTag = original.querySelector('.thumbnail');
|
||||
movieTitle = original.querySelector('.movie-title');
|
||||
movieDescription = original.querySelector('.movie-description');
|
||||
@ -91,15 +92,16 @@ function createOrImproveMovieMeta(original, thumbnail, nfo) {
|
||||
const titleEl = content.querySelector('title');
|
||||
const plotEl = content.querySelector('plot');
|
||||
const airedEl = content.querySelector('aired');
|
||||
const premieredEl = content.querySelector('premiered');
|
||||
|
||||
if (!titleEl || !plotEl) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (airedEl) {
|
||||
if (airedEl || premieredEl) {
|
||||
const timestamp = original.parentElement.parentElement.querySelector('.timestamp');
|
||||
if (timestamp) {
|
||||
timestamp.innerText = airedEl.textContent;
|
||||
timestamp.innerText = (airedEl || premieredEl).textContent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +119,6 @@ function createOrImproveMovieMeta(original, thumbnail, nfo) {
|
||||
}
|
||||
|
||||
let tvShow;
|
||||
|
||||
function accountForMetadata() {
|
||||
allLinks.forEach((link) => {
|
||||
const url = link.getAttribute('href');
|
||||
@ -125,8 +126,8 @@ function accountForMetadata() {
|
||||
link.parentElement.parentElement.style.display = 'none';
|
||||
let findOriginal
|
||||
if (url === 'tvshow.nfo' || url === 'poster.jpg') {
|
||||
// dirty hack
|
||||
if (url === 'poster.jpg' && window.location.pathname.includes('/movies/')) {
|
||||
const isTVShow = allLinks.find((found) => found.getAttribute('href') === 'tvshow.nfo');
|
||||
if (url === 'poster.jpg' && !isTVShow) {
|
||||
findOriginal = document.querySelector('a:not([href=".."])');
|
||||
} else {
|
||||
if (tvShow) {
|
||||
@ -145,13 +146,13 @@ function accountForMetadata() {
|
||||
const sn = url.match(/season(\d+)/);
|
||||
if (sn) {
|
||||
const number = parseInt(sn[1], 10);
|
||||
const findByNumber = allLinks.filter((url) => url.innerText.includes(number));
|
||||
if (findByNumber.length) {
|
||||
findOriginal = findByNumber[0];
|
||||
const findByNumber = allLinks.find((allurl) => allurl.innerText.includes(number));
|
||||
if (findByNumber) {
|
||||
findOriginal = findByNumber;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
findOriginal = findByInfoFile(encodeURIComponent(decodeURIComponent(url)));
|
||||
findOriginal = findByInfoFile(url);
|
||||
}
|
||||
if (findOriginal) {
|
||||
createOrImproveMovieMeta(findOriginal,
|
||||
@ -200,8 +201,3 @@ if ('localStorage' in window) {
|
||||
} else {
|
||||
accountForMetadata();
|
||||
}
|
||||
/*
|
||||
const loc = 'Index of ' + decodeURIComponent(document.location.pathname);
|
||||
document.getElementById('dirname').innerHTML = loc;
|
||||
document.title = loc;
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user