fix image sizing, fix name resolving fallback, continue watching excludes up to date progress

This commit is contained in:
ThaUnknown 2021-08-13 15:49:31 +02:00
parent 76fc62a803
commit e43259f1b3
5 changed files with 23 additions and 13 deletions

View file

@ -64,8 +64,8 @@
<div class="d-flex h-full top w-full">
<div class="container-xl w-full">
<div class="row d-flex justify-content-end flex-row h-full px-20 pt-20 px-xl-0">
<div class="col-md-3 col-4 d-flex h-full justify-content-end flex-column align-items-center">
<img class="contain-img rounded w-quarter w-full mb-15 shadow"
<div class="col-md-3 col-4 d-flex h-full justify-content-end flex-column pb-15 align-items-center">
<img class="contain-img rounded mw-full mh-full shadow"
src="https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx16498-m5ZMNtFioc7j.png">
</div>
<div class="col-md-9 col-8 row align-content-end">

View file

@ -264,7 +264,7 @@ export async function resolveFileMedia (opts) {
res = await alRequest(method)
if (!res.data.Page.media[0]) {
const index = method.name.search(/S\d/)
method.name = (method.name.slice(0, index) + method.name.slice(index + 1, method.name.length)).replace('(TV)', '').replace(/ (19[5-9]\d|20[0-6]\d)/, '').replace('-', '')
method.name = ((index !== -1 && method.name.slice(0, index) + method.name.slice(index + 1, method.name.length)) || method.name).replace('(TV)', '').replace(/ (19[5-9]\d|20[0-6]\d)/, '').replace('-', '')
method.status = undefined
res = await alRequest(method)
}

View file

@ -573,7 +573,7 @@ async function resolveFileMedia (opts) {
res = await (0,_anilist_js__WEBPACK_IMPORTED_MODULE_2__.alRequest)(method)
if (!res.data.Page.media[0]) {
const index = method.name.search(/S\d/)
method.name = (method.name.slice(0, index) + method.name.slice(index + 1, method.name.length)).replace('(TV)', '').replace(/ (19[5-9]\d|20[0-6]\d)/, '').replace('-', '')
method.name = ((index !== -1 && method.name.slice(0, index) + method.name.slice(index + 1, method.name.length)) || method.name).replace('(TV)', '').replace(/ (19[5-9]\d|20[0-6]\d)/, '').replace('-', '')
method.status = undefined
res = await (0,_anilist_js__WEBPACK_IMPORTED_MODULE_2__.alRequest)(method)
}
@ -723,8 +723,10 @@ function loadHomePage () {
const homeLoadFunctions = {
continue: async function (page) {
if (!page) gallerySkeleton(browseGallery)
const mediaList = (await (0,_anilist_js__WEBPACK_IMPORTED_MODULE_0__.alRequest)({ method: 'UserLists', status_in: 'CURRENT', id: alID, page: page || 1 })).data.Page.mediaList
galleryAppend({ media: mediaList.map(i => i.media), gallery: browseGallery, method: 'continue', page: page || 1 })
const mediaList = (await (0,_anilist_js__WEBPACK_IMPORTED_MODULE_0__.alRequest)({ method: 'UserLists', status_in: 'CURRENT', id: alID, page: page || 1 })).data.Page.mediaList.map(i => i.media).filter(media => {
return !(media.status === 'RELEASING' && media.mediaListEntry?.progress === media.nextAiringEpisode?.episode - 1)
})
galleryAppend({ media: mediaList, gallery: browseGallery, method: 'continue', page: page || 1 })
},
releases: async function () {
gallerySkeleton(browseGallery)
@ -786,8 +788,11 @@ function loadHomePage () {
}
const homePreviewFunctions = {
continue: function () {
;(0,_anilist_js__WEBPACK_IMPORTED_MODULE_0__.alRequest)({ method: 'UserLists', status_in: 'CURRENT', id: alID, perPage: 5 }).then(res => {
galleryAppend({ media: res.data.Page.mediaList.map(i => i.media), gallery: homeContinue })
;(0,_anilist_js__WEBPACK_IMPORTED_MODULE_0__.alRequest)({ method: 'UserLists', status_in: 'CURRENT', id: alID, perPage: 50 }).then(res => {
const mediaList = res.data.Page.mediaList.filter(({ media }) => {
return !(media.status === 'RELEASING' && media.mediaListEntry?.progress === media.nextAiringEpisode?.episode - 1)
}).slice(0, 5).map(i => i.media)
galleryAppend({ media: mediaList, gallery: homeContinue })
})
},
releases: async function () { // this could be cleaner, but oh well

File diff suppressed because one or more lines are too long

View file

@ -15,8 +15,10 @@ export function loadHomePage () {
const homeLoadFunctions = {
continue: async function (page) {
if (!page) gallerySkeleton(browseGallery)
const mediaList = (await alRequest({ method: 'UserLists', status_in: 'CURRENT', id: alID, page: page || 1 })).data.Page.mediaList
galleryAppend({ media: mediaList.map(i => i.media), gallery: browseGallery, method: 'continue', page: page || 1 })
const mediaList = (await alRequest({ method: 'UserLists', status_in: 'CURRENT', id: alID, page: page || 1 })).data.Page.mediaList.map(i => i.media).filter(media => {
return !(media.status === 'RELEASING' && media.mediaListEntry?.progress === media.nextAiringEpisode?.episode - 1)
})
galleryAppend({ media: mediaList, gallery: browseGallery, method: 'continue', page: page || 1 })
},
releases: async function () {
gallerySkeleton(browseGallery)
@ -78,8 +80,11 @@ export function loadHomePage () {
}
const homePreviewFunctions = {
continue: function () {
alRequest({ method: 'UserLists', status_in: 'CURRENT', id: alID, perPage: 5 }).then(res => {
galleryAppend({ media: res.data.Page.mediaList.map(i => i.media), gallery: homeContinue })
alRequest({ method: 'UserLists', status_in: 'CURRENT', id: alID, perPage: 50 }).then(res => {
const mediaList = res.data.Page.mediaList.filter(({ media }) => {
return !(media.status === 'RELEASING' && media.mediaListEntry?.progress === media.nextAiringEpisode?.episode - 1)
}).slice(0, 5).map(i => i.media)
galleryAppend({ media: mediaList, gallery: homeContinue })
})
},
releases: async function () { // this could be cleaner, but oh well