diff --git a/assets/js/dev/gallery.js b/assets/js/dev/gallery.js index 8cc359c3..752cff39 100644 --- a/assets/js/dev/gallery.js +++ b/assets/js/dev/gallery.js @@ -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)); - 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 artists = Array.from(doc.querySelectorAll('.gallery h2 a'), elm => elm.innerText); diff --git a/assets/js/dev/galleryblock.js b/assets/js/dev/galleryblock.js index 88e58d94..2e7b5a58 100644 --- a/assets/js/dev/galleryblock.js +++ b/assets/js/dev/galleryblock.js @@ -11,7 +11,7 @@ async function get_gallery_block(galleryid) { const gallery_url = title_elm.href; 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 series = Array.from(doc.querySelectorAll('a[href^="/series/"]'), elm => elm.innerText); diff --git a/assets/js/dev/misc.js b/assets/js/dev/misc.js index e6185811..76bc19af 100644 --- a/assets/js/dev/misc.js +++ b/assets/js/dev/misc.js @@ -61,4 +61,10 @@ function do_search(query) { put_results_on_page(); } }); +} + +function replace_jpg_tn(tn) { + if (tn.endsWith('jpg')) tn = tn.replace('bigtn', 'webpbigtn').replace(/jpg$/, 'webp'); + + return `https:${tn}` } \ No newline at end of file diff --git a/hitomi-dev.html.ver b/hitomi-dev.html.ver index b543d7b4..e4985bc8 100644 --- a/hitomi-dev.html.ver +++ b/hitomi-dev.html.ver @@ -1 +1 @@ -0.0.7-DEV06 \ No newline at end of file +0.0.7-DEV07 \ No newline at end of file