Code update

This commit is contained in:
tom5079
2022-01-20 15:35:49 +09:00
parent 47abbfe35b
commit 2ac8bbf36d
4 changed files with 9 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ async function get_gallery(galleryid) {
Array.from(doc.querySelectorAll('#lang-list a')).forEach(elm => lang_list[elm.innerText] = elm.getAttribute('href').slice(11, -5)); Array.from(doc.querySelectorAll('#lang-list a')).forEach(elm => lang_list[elm.innerText] = elm.getAttribute('href').slice(11, -5));
const cover = doc.querySelector('.cover img').src.replace('bigtn', 'webpbigtn').replace(/.jpg$/, '.webp'); const cover = replace_jpg_tn(doc.querySelector('.cover img').src);
const title = doc.querySelector('.gallery h1 a').innerText; const title = doc.querySelector('.gallery h1 a').innerText;
const artists = Array.from(doc.querySelectorAll('.gallery h2 a'), elm => elm.innerText); const artists = Array.from(doc.querySelectorAll('.gallery h2 a'), elm => elm.innerText);

View File

@@ -11,7 +11,7 @@ async function get_gallery_block(galleryid) {
const gallery_url = title_elm.href; const gallery_url = title_elm.href;
const title = title_elm.textContent; const title = title_elm.textContent;
const thumbnails = Array.from(doc.querySelectorAll('.dj-img-cont img'), elm => `https:${elm.getAttribute('data-src').replace('bigtn', 'webpbigtn').replace(/.jpg$/, '.webp')}`); const thumbnails = Array.from(doc.querySelectorAll('.dj-img-cont img'), elm => replace_jpg_tn(elm.getAttribute('data-src')));
const artists = Array.from(doc.querySelectorAll('.artist-list a'), elm => elm.innerText); const artists = Array.from(doc.querySelectorAll('.artist-list a'), elm => elm.innerText);
const series = Array.from(doc.querySelectorAll('a[href^="/series/"]'), elm => elm.innerText); const series = Array.from(doc.querySelectorAll('a[href^="/series/"]'), elm => elm.innerText);

View File

@@ -61,4 +61,10 @@ function do_search(query) {
put_results_on_page(); put_results_on_page();
} }
}); });
}
function replace_jpg_tn(tn) {
if (tn.endsWith('jpg')) tn = tn.replace('bigtn', 'webpbigtn').replace(/jpg$/, 'webp');
return `https:${tn}`
} }

View File

@@ -1 +1 @@
0.0.7-DEV06 0.0.7-DEV07