mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-19 10:42:04 +00:00
make nameresolving more restrictive, UI work
This commit is contained in:
parent
c7f0a478ef
commit
b0a6b96c41
8 changed files with 77 additions and 171 deletions
|
|
@ -461,4 +461,7 @@ section:target:not(#player),
|
|||
}
|
||||
#viewLabels.movie .episodes {
|
||||
display: none !important;
|
||||
}
|
||||
#viewPlayback.hidden .btn-group {
|
||||
display: none;
|
||||
}
|
||||
153
app/index.html
153
app/index.html
|
|
@ -58,27 +58,26 @@
|
|||
<span>×</span>
|
||||
</button>
|
||||
<div class="h-md-half w-full position-relative z-20">
|
||||
<div class="h-full w-full position-absolute banner bg-dark-light"
|
||||
style="background-image: linear-gradient(0deg, rgba(17,20,23,1) 0%, rgba(17,20,23,0.80) 25%, rgba(17,20,23,0.40) 50%, rgba(37,40,44,0) 100%), url('https://s4.anilist.co/file/anilistcdn/media/anime/banner/16498-8jpFCOcDmneX.jpg') !important">
|
||||
<div class="h-full w-full position-absolute banner bg-dark-light" id="viewBanner"
|
||||
style="background-image: linear-gradient(0deg, rgba(17,20,23,1) 0%, rgba(17,20,23,0.80) 25%, rgba(17,20,23,0.40) 50%, rgba(37,40,44,0) 100%)!important">
|
||||
</div>
|
||||
<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 pb-15 align-items-center">
|
||||
<img class="contain-img rounded mw-full mh-full shadow" id="viewImg"
|
||||
src="https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx16498-m5ZMNtFioc7j.png">
|
||||
src="">
|
||||
</div>
|
||||
<div class="col-md-9 col-8 row align-content-end">
|
||||
<div class="col-md-9 col-8 row align-content-end pl-20">
|
||||
<div class="col-md-8 col-12 d-flex justify-content-end flex-column">
|
||||
<div class="px-md-20 ml-20 d-flex flex-column font-size-12">
|
||||
<span class="title font-weight-bold pb-sm-15 text-white" id="viewTitle">Shingeki no Kyojin</span>
|
||||
<div class="px-md-20 d-flex flex-column font-size-12">
|
||||
<span class="title font-weight-bold pb-sm-15 text-white" id="viewTitle"></span>
|
||||
<div class="d-flex flex-row font-size-18 pb-sm-15" id="viewLabels">
|
||||
<span class="material-icons mr-10 font-size-24">
|
||||
trending_up
|
||||
</span>
|
||||
<span>Rating:
|
||||
<span class="font-weight-bold mr-20" id="viewRating">
|
||||
85%
|
||||
</span>
|
||||
</span>
|
||||
<span class="material-icons mx-10 font-size-24">
|
||||
|
|
@ -86,7 +85,6 @@
|
|||
</span>
|
||||
<span>Format:
|
||||
<span class="font-weight-bold mr-20 text-capitalize" id="viewFormat">
|
||||
TV
|
||||
</span>
|
||||
</span>
|
||||
<div class="d-flex episodes">
|
||||
|
|
@ -95,7 +93,6 @@
|
|||
</span>
|
||||
<span>Episodes:
|
||||
<span class="font-weight-bold mr-20" id="viewEpisode">
|
||||
25
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -105,28 +102,23 @@
|
|||
</span>
|
||||
<span>Length:
|
||||
<span class="font-weight-bold mr-20" id="viewDuration">
|
||||
24 mins
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pb-15 pt-5 overflow-x-auto text-nowrap font-weight-bold" id="viewBadges">
|
||||
<span class="badge badge-pill shadow">Action</span>
|
||||
<span class="badge badge-pill shadow">Drama</span>
|
||||
<span class="badge badge-pill shadow">Fantasy</span>
|
||||
<span class="badge badge-pill shadow">Mystery</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 d-flex justify-content-end flex-column pl-20 p-md-0">
|
||||
<div class="d-flex flex-column flex-wrap">
|
||||
<div class="col-md-4 d-flex justify-content-end flex-column">
|
||||
<div class="d-flex flex-column flex-wrap" id="viewPlayback">
|
||||
<div class="btn-group mb-5" role="group">
|
||||
<button class="btn btn-primary d-flex align-items-center font-weight-bold font-size-24 h-50"
|
||||
type="button" id="viewPlay">
|
||||
<span class="material-icons mr-10 font-size-24 w-30">
|
||||
play_arrow
|
||||
</span>
|
||||
Play
|
||||
<span id="viewPlayText">Play</span>
|
||||
</button>
|
||||
<div class="btn-group dropdown with-arrow" role="group">
|
||||
<button class="btn btn-square btn-primary d-flex h-50 w-50 justify-content-center"
|
||||
|
|
@ -147,8 +139,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="btn-group mb-5 border-0" role="group">
|
||||
<button class="btn d-flex align-items-center font-weight-bold font-size-16 border-0"
|
||||
type="button" id="viewDownload">
|
||||
<button class="btn d-flex align-items-center font-weight-bold font-size-16 border-0" type="button"
|
||||
id="viewDownload">
|
||||
<span class="material-icons mr-10 font-size-18 w-30">
|
||||
get_app
|
||||
</span>
|
||||
|
|
@ -172,7 +164,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn d-flex align-items-center mb-5 font-weight-bold font-size-16" type="button" id="viewTrailer">
|
||||
<button class="btn d-flex align-items-center mb-5 font-weight-bold font-size-16" type="button"
|
||||
id="viewTrailer">
|
||||
<span class="material-icons mr-10 font-size-18 w-30">
|
||||
live_tv
|
||||
</span>
|
||||
|
|
@ -190,15 +183,6 @@
|
|||
<div class="col-md-9 px-20">
|
||||
<h1 class="title font-weight-bold text-white">Sypnosis</h1>
|
||||
<div class="font-size-16 pr-15" id="viewDescription">
|
||||
Several hundred years ago, humans were nearly exterminated by titans. Titans are typically several stories
|
||||
tall, seem to have no intelligence, devour human beings and, worst of all, seem to do it for the pleasure
|
||||
rather than as a food source. A small percentage of humanity survived by walling themselves in a city
|
||||
protected by extremely high walls, even taller than the biggest of titans.<br><br> Flash forward to the
|
||||
present and the city has not seen a titan in over 100 years. Teenage boy Eren and his foster sister Mikasa
|
||||
witness something horrific as the city walls are destroyed by a colossal titan that appears out of thin
|
||||
air. As the smaller titans flood the city, the two kids watch in horror as their mother is eaten alive.
|
||||
Eren vows that he will murder every single titan and take revenge for all of mankind.<br><br> (Source:
|
||||
MangaHelpers)
|
||||
</div>
|
||||
<h1 class="title font-weight-bold text-white pt-20">Episodes</h1>
|
||||
<div id="episodes" class="d-flex flex-wrap justify-content-start">
|
||||
|
|
@ -388,115 +372,8 @@
|
|||
</div>
|
||||
<div class="col-md-3 px-sm-0 px-20">
|
||||
<h1 class="title font-weight-bold text-white">Details</h1>
|
||||
<div class="card m-0 px-20 py-10 d-flex flex-md-column flex-row overflow-x-auto text-capitalize" id='viewDetails'>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
theater_comedy
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Genres</div>
|
||||
<div>Action, Drama, Fantasy, Mystery</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
spa
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Season</div>
|
||||
<div>Spring 2013</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
theaters
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Episodes</div>
|
||||
<div>Watched <b>0</b> of <b>25</b></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
timer
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Episode Length</div>
|
||||
<div>24 mins</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
monitor
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Format</div>
|
||||
<div>TV</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
live_tv
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Status</div>
|
||||
<div>Finished</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
business
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Studios</div>
|
||||
<div>Wit Studio</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
source
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Source</div>
|
||||
<div>Manga</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
trending_up
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Rating</div>
|
||||
<div>85%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
title
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">English</div>
|
||||
<div>Attack on Titan</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="material-icons mr-10 font-size-24">
|
||||
translate
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Romaji</div>
|
||||
<div>Shingeki no Kyojin</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-row px-10 py-5">
|
||||
<div class="mr-10 font-size-12 font-weight-bold d-flex align-items-center text-nowrap">
|
||||
日本
|
||||
</div>
|
||||
<div class="d-flex flex-column justify-content-center text-nowrap">
|
||||
<div class="font-weight-bold">Native</div>
|
||||
<div>進撃の巨人</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card m-0 px-20 py-10 d-flex flex-md-column flex-row overflow-x-auto text-capitalize"
|
||||
id='viewDetails'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -155,9 +155,9 @@ relations {
|
|||
case 'SearchName': {
|
||||
variables.search = opts.name
|
||||
query = `
|
||||
query ($page: Int, $perPage: Int, $sort: [MediaSort], $type: MediaType, $search: String, $status: MediaStatus) {
|
||||
query ($page: Int, $perPage: Int, $sort: [MediaSort], $type: MediaType, $search: String, $status: [MediaStatus]) {
|
||||
Page (page: $page, perPage: $perPage) {
|
||||
media(type: $type, search: $search, sort: $sort, status: $status) {
|
||||
media(type: $type, search: $search, sort: $sort, status_in: $status) {
|
||||
${queryObjects}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,23 +249,23 @@ export async function nyaaSearch (media, episode, isOffline) {
|
|||
// resolve anime name based on file name and store it
|
||||
|
||||
export async function resolveFileMedia (opts) {
|
||||
// opts.fileName opts.method opts.isRelease
|
||||
// opts.fileName opts.isRelease
|
||||
|
||||
async function resolveTitle (title) {
|
||||
if (!(title in relations)) {
|
||||
// resolve name and shit
|
||||
let method, res
|
||||
if (opts.isRelease) {
|
||||
method = { name: title, method: 'SearchName', perPage: 1, status: 'RELEASING', sort: 'SEARCH_MATCH' }
|
||||
method = { name: title, method: 'SearchName', perPage: 1, status: ['RELEASING'], sort: 'SEARCH_MATCH' }
|
||||
// maybe releases should include this and last season? idfk
|
||||
} else {
|
||||
method = { name: title, method: opts.method, perPage: 1, sort: 'SEARCH_MATCH' }
|
||||
method = { name: title, method: 'SearchName', perPage: 1, status: ['RELEASING', 'FINISHED'], sort: 'SEARCH_MATCH' }
|
||||
}
|
||||
res = await alRequest(method)
|
||||
if (!res.data.Page.media[0]) {
|
||||
const index = method.name.search(/S\d/)
|
||||
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
|
||||
method.status = ['RELEASING', 'FINISHED']
|
||||
res = await alRequest(method)
|
||||
}
|
||||
if (res.data.Page.media[0]) {
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@ relations {
|
|||
case 'SearchName': {
|
||||
variables.search = opts.name
|
||||
query = `
|
||||
query ($page: Int, $perPage: Int, $sort: [MediaSort], $type: MediaType, $search: String, $status: MediaStatus) {
|
||||
query ($page: Int, $perPage: Int, $sort: [MediaSort], $type: MediaType, $search: String, $status: [MediaStatus]) {
|
||||
Page (page: $page, perPage: $perPage) {
|
||||
media(type: $type, search: $search, sort: $sort, status: $status) {
|
||||
media(type: $type, search: $search, sort: $sort, status_in: $status) {
|
||||
${queryObjects}
|
||||
}
|
||||
}
|
||||
|
|
@ -564,23 +564,23 @@ async function nyaaSearch (media, episode, isOffline) {
|
|||
// resolve anime name based on file name and store it
|
||||
|
||||
async function resolveFileMedia (opts) {
|
||||
// opts.fileName opts.method opts.isRelease
|
||||
// opts.fileName opts.isRelease
|
||||
|
||||
async function resolveTitle (title) {
|
||||
if (!(title in relations)) {
|
||||
// resolve name and shit
|
||||
let method, res
|
||||
if (opts.isRelease) {
|
||||
method = { name: title, method: 'SearchName', perPage: 1, status: 'RELEASING', sort: 'SEARCH_MATCH' }
|
||||
method = { name: title, method: 'SearchName', perPage: 1, status: ['RELEASING'], sort: 'SEARCH_MATCH' }
|
||||
// maybe releases should include this and last season? idfk
|
||||
} else {
|
||||
method = { name: title, method: opts.method, perPage: 1, sort: 'SEARCH_MATCH' }
|
||||
method = { name: title, method: 'SearchName', perPage: 1, status: ['RELEASING', 'FINISHED'], sort: 'SEARCH_MATCH' }
|
||||
}
|
||||
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 = ((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
|
||||
method.status = ['RELEASING', 'FINISHED']
|
||||
res = await (0,_anilist_js__WEBPACK_IMPORTED_MODULE_2__.alRequest)(method)
|
||||
}
|
||||
if (res.data.Page.media[0]) {
|
||||
|
|
@ -717,6 +717,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* eslint-env browser */
|
||||
/* global navHome, searchClear, searchWrapper, skeletonCardTemplate, bareCardTemplate, fullCardTemplate, home, searchText, searchGenre, searchYear, searchSeason, searchFormat, searchStatus, searchSort, navSchedule, homeContinueMore, homeReleasesMore, homePlanningMore, homeTrendingMore, homeRomanceMore, homeActionMore, homeContinue, homeReleases, homePlanning, homeTrending, homeRomance, homeAction */
|
||||
|
||||
// THIS IS WHY YOU FUCKING USE FRAMEWORKS
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -812,7 +814,7 @@ function loadHomePage () {
|
|||
if (lastRSSDate !== pubDate) {
|
||||
if (lastRSSDate) {
|
||||
homeReleases.append(...gallerySkeletonFrag(5))
|
||||
;(0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.resolveFileMedia)({ fileName: doc.querySelector('item title').textContent, method: 'SearchName', isRelease: true }).then(mediaInformation => {
|
||||
;(0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.resolveFileMedia)({ fileName: doc.querySelector('item title').textContent, isRelease: true }).then(mediaInformation => {
|
||||
if (_settings_js__WEBPACK_IMPORTED_MODULE_3__.settings.other1) {
|
||||
const notification = new Notification(mediaInformation.media.title.userPreferred, {
|
||||
body: `Episode ${mediaInformation.episode} was just released!`,
|
||||
|
|
@ -989,7 +991,7 @@ function cardCreator (opts) {
|
|||
|
||||
async function releasesCards (items, limit) {
|
||||
const cards = []
|
||||
const media = await (0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.resolveFileMedia)({ fileName: [...items].map(item => item.querySelector('title').textContent).slice(0, limit), method: 'SearchName', isRelease: true })
|
||||
const media = await (0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.resolveFileMedia)({ fileName: [...items].map(item => item.querySelector('title').textContent).slice(0, limit), isRelease: true })
|
||||
media.forEach((mediaInformation, index) => {
|
||||
mediaInformation.onclick = () => _main_js__WEBPACK_IMPORTED_MODULE_4__.client.playTorrent(items[index].querySelector('link').textContent, { media: mediaInformation, episode: mediaInformation.episode })
|
||||
cards.push(cardCreator(mediaInformation))
|
||||
|
|
@ -1069,7 +1071,7 @@ function mediaDetails (media) {
|
|||
} else if (detail.property === 'averageScore') {
|
||||
value.textContent = media.averageScore + '%'
|
||||
} else if (detail.property === 'season') {
|
||||
value.textContent = [media.season, media.seasonYear].filter(f => f).join(' ')
|
||||
value.textContent = [media.season?.toLowerCase(), media.seasonYear].filter(f => f).join(' ')
|
||||
} else {
|
||||
value.textContent = media[detail.property]
|
||||
}
|
||||
|
|
@ -1090,7 +1092,7 @@ function trailerPopup (trailer) {
|
|||
break
|
||||
}
|
||||
}
|
||||
/* global viewImg, viewTitle, viewRating, viewFormat, viewLabels, viewDuration, viewEpisode, viewBadges, viewPlay, viewPlayEp, viewDescription, viewDetails,viewDownload, viewDownloadEp, trailerVideo, viewTrailer */
|
||||
/* global viewImg, viewTitle, viewRating, viewFormat, viewLabels, viewDuration, viewEpisode, viewBadges, viewPlay, viewPlayEp, viewPlayText, viewDescription, viewDetails, viewDownload, viewDownloadEp, trailerVideo, viewTrailer, viewPlayback, viewBanner */
|
||||
function viewMedia (input) {
|
||||
console.log(input)
|
||||
const media = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__.flattenObj)(input)
|
||||
|
|
@ -1107,11 +1109,22 @@ function viewMedia (input) {
|
|||
viewBadges.textContent = ''
|
||||
viewBadges.append(...genreBadges(media.genres))
|
||||
|
||||
viewPlay.onclick = () => (0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.nyaaSearch)(input, viewPlayEp.value)
|
||||
viewPlayEp.value = media.progress || 1
|
||||
if (media.episodes || media.episode) {
|
||||
viewPlayback.classList.remove('hidden')
|
||||
viewPlay.onclick = () => (0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.nyaaSearch)(input, viewPlayEp.value)
|
||||
viewPlayEp.value = media.progress || 1
|
||||
viewPlayText.textContent = media.progress && media.progress !== media.episodes ? 'Continue' : 'Play'
|
||||
|
||||
viewDownload.onclick = () => (0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.nyaaSearch)(input, viewPlayEp.value, true)
|
||||
viewDownloadEp.value = media.progress || 1
|
||||
viewDownload.onclick = () => (0,_anime_js__WEBPACK_IMPORTED_MODULE_1__.nyaaSearch)(input, viewPlayEp.value, true)
|
||||
viewDownloadEp.value = media.progress || 1
|
||||
} else {
|
||||
viewPlayback.classList.add('hidden')
|
||||
}
|
||||
if (media.bannerImage) {
|
||||
viewBanner.style = `background-image: linear-gradient(0deg, rgba(17,20,23,1) 0%, rgba(17,20,23,0.80) 25%, rgba(17,20,23,0.40) 50%, rgba(37,40,44,0) 100%), url('${media.bannerImage}') !important`
|
||||
} else {
|
||||
viewBanner.style = 'background-image: linear-gradient(0deg, rgba(17,20,23,1) 0%, rgba(17,20,23,0.80) 25%, rgba(17,20,23,0.40) 50%, rgba(37,40,44,0) 100%) !important'
|
||||
}
|
||||
|
||||
viewTrailer.onclick = () => trailerPopup(input.trailer)
|
||||
|
||||
|
|
@ -1263,7 +1276,7 @@ client.on('prev', ({ filemedia }) => {
|
|||
}
|
||||
})
|
||||
client.on('offline-torrent', torrent => {
|
||||
;(0,_anime_js__WEBPACK_IMPORTED_MODULE_2__.resolveFileMedia)({ fileName: torrent.name, method: 'SearchName' }).then(mediaInformation => {
|
||||
;(0,_anime_js__WEBPACK_IMPORTED_MODULE_2__.resolveFileMedia)({ fileName: torrent.name }).then(mediaInformation => {
|
||||
mediaInformation.onclick = () => client.playTorrent(torrent, { media: mediaInformation, episode: mediaInformation.episode })
|
||||
const template = (0,_interface_js__WEBPACK_IMPORTED_MODULE_5__.cardCreator)(mediaInformation)
|
||||
document.querySelector('.downloads').appendChild(template)
|
||||
|
|
@ -1273,7 +1286,7 @@ client.on('video-files', async ({ files, torrent }) => {
|
|||
document.querySelector('.playlist').textContent = ''
|
||||
const cards = []
|
||||
for (const file of files) {
|
||||
const mediaInformation = await (0,_anime_js__WEBPACK_IMPORTED_MODULE_2__.resolveFileMedia)({ fileName: file.name, method: 'SearchName' })
|
||||
const mediaInformation = await (0,_anime_js__WEBPACK_IMPORTED_MODULE_2__.resolveFileMedia)({ fileName: file.name })
|
||||
mediaInformation.onclick = () => {
|
||||
client.buildVideo(torrent, {
|
||||
media: mediaInformation,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,8 @@
|
|||
/* eslint-env browser */
|
||||
/* global navHome, searchClear, searchWrapper, skeletonCardTemplate, bareCardTemplate, fullCardTemplate, home, searchText, searchGenre, searchYear, searchSeason, searchFormat, searchStatus, searchSort, navSchedule, homeContinueMore, homeReleasesMore, homePlanningMore, homeTrendingMore, homeRomanceMore, homeActionMore, homeContinue, homeReleases, homePlanning, homeTrending, homeRomance, homeAction */
|
||||
|
||||
// THIS IS WHY YOU FUCKING USE FRAMEWORKS
|
||||
|
||||
import { alRequest } from './anilist.js'
|
||||
import { resolveFileMedia, viewAnime, relations, nyaaSearch } from './anime.js'
|
||||
import { getRSSurl, getRSSContent } from './rss.js'
|
||||
|
|
@ -96,7 +98,7 @@ export function loadHomePage () {
|
|||
if (lastRSSDate !== pubDate) {
|
||||
if (lastRSSDate) {
|
||||
homeReleases.append(...gallerySkeletonFrag(5))
|
||||
resolveFileMedia({ fileName: doc.querySelector('item title').textContent, method: 'SearchName', isRelease: true }).then(mediaInformation => {
|
||||
resolveFileMedia({ fileName: doc.querySelector('item title').textContent, isRelease: true }).then(mediaInformation => {
|
||||
if (settings.other1) {
|
||||
const notification = new Notification(mediaInformation.media.title.userPreferred, {
|
||||
body: `Episode ${mediaInformation.episode} was just released!`,
|
||||
|
|
@ -273,7 +275,7 @@ export function cardCreator (opts) {
|
|||
|
||||
async function releasesCards (items, limit) {
|
||||
const cards = []
|
||||
const media = await resolveFileMedia({ fileName: [...items].map(item => item.querySelector('title').textContent).slice(0, limit), method: 'SearchName', isRelease: true })
|
||||
const media = await resolveFileMedia({ fileName: [...items].map(item => item.querySelector('title').textContent).slice(0, limit), isRelease: true })
|
||||
media.forEach((mediaInformation, index) => {
|
||||
mediaInformation.onclick = () => client.playTorrent(items[index].querySelector('link').textContent, { media: mediaInformation, episode: mediaInformation.episode })
|
||||
cards.push(cardCreator(mediaInformation))
|
||||
|
|
@ -353,7 +355,7 @@ function mediaDetails (media) {
|
|||
} else if (detail.property === 'averageScore') {
|
||||
value.textContent = media.averageScore + '%'
|
||||
} else if (detail.property === 'season') {
|
||||
value.textContent = [media.season, media.seasonYear].filter(f => f).join(' ')
|
||||
value.textContent = [media.season?.toLowerCase(), media.seasonYear].filter(f => f).join(' ')
|
||||
} else {
|
||||
value.textContent = media[detail.property]
|
||||
}
|
||||
|
|
@ -374,7 +376,7 @@ function trailerPopup (trailer) {
|
|||
break
|
||||
}
|
||||
}
|
||||
/* global viewImg, viewTitle, viewRating, viewFormat, viewLabels, viewDuration, viewEpisode, viewBadges, viewPlay, viewPlayEp, viewDescription, viewDetails,viewDownload, viewDownloadEp, trailerVideo, viewTrailer */
|
||||
/* global viewImg, viewTitle, viewRating, viewFormat, viewLabels, viewDuration, viewEpisode, viewBadges, viewPlay, viewPlayEp, viewPlayText, viewDescription, viewDetails, viewDownload, viewDownloadEp, trailerVideo, viewTrailer, viewPlayback, viewBanner */
|
||||
function viewMedia (input) {
|
||||
console.log(input)
|
||||
const media = flattenObj(input)
|
||||
|
|
@ -391,11 +393,22 @@ function viewMedia (input) {
|
|||
viewBadges.textContent = ''
|
||||
viewBadges.append(...genreBadges(media.genres))
|
||||
|
||||
viewPlay.onclick = () => nyaaSearch(input, viewPlayEp.value)
|
||||
viewPlayEp.value = media.progress || 1
|
||||
if (media.episodes || media.episode) {
|
||||
viewPlayback.classList.remove('hidden')
|
||||
viewPlay.onclick = () => nyaaSearch(input, viewPlayEp.value)
|
||||
viewPlayEp.value = media.progress || 1
|
||||
viewPlayText.textContent = media.progress && media.progress !== media.episodes ? 'Continue' : 'Play'
|
||||
|
||||
viewDownload.onclick = () => nyaaSearch(input, viewPlayEp.value, true)
|
||||
viewDownloadEp.value = media.progress || 1
|
||||
viewDownload.onclick = () => nyaaSearch(input, viewPlayEp.value, true)
|
||||
viewDownloadEp.value = media.progress || 1
|
||||
} else {
|
||||
viewPlayback.classList.add('hidden')
|
||||
}
|
||||
if (media.bannerImage) {
|
||||
viewBanner.style = `background-image: linear-gradient(0deg, rgba(17,20,23,1) 0%, rgba(17,20,23,0.80) 25%, rgba(17,20,23,0.40) 50%, rgba(37,40,44,0) 100%), url('${media.bannerImage}') !important`
|
||||
} else {
|
||||
viewBanner.style = 'background-image: linear-gradient(0deg, rgba(17,20,23,1) 0%, rgba(17,20,23,0.80) 25%, rgba(17,20,23,0.40) 50%, rgba(37,40,44,0) 100%) !important'
|
||||
}
|
||||
|
||||
viewTrailer.onclick = () => trailerPopup(input.trailer)
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ client.on('prev', ({ filemedia }) => {
|
|||
}
|
||||
})
|
||||
client.on('offline-torrent', torrent => {
|
||||
resolveFileMedia({ fileName: torrent.name, method: 'SearchName' }).then(mediaInformation => {
|
||||
resolveFileMedia({ fileName: torrent.name }).then(mediaInformation => {
|
||||
mediaInformation.onclick = () => client.playTorrent(torrent, { media: mediaInformation, episode: mediaInformation.episode })
|
||||
const template = cardCreator(mediaInformation)
|
||||
document.querySelector('.downloads').appendChild(template)
|
||||
|
|
@ -101,7 +101,7 @@ client.on('video-files', async ({ files, torrent }) => {
|
|||
document.querySelector('.playlist').textContent = ''
|
||||
const cards = []
|
||||
for (const file of files) {
|
||||
const mediaInformation = await resolveFileMedia({ fileName: file.name, method: 'SearchName' })
|
||||
const mediaInformation = await resolveFileMedia({ fileName: file.name })
|
||||
mediaInformation.onclick = () => {
|
||||
client.buildVideo(torrent, {
|
||||
media: mediaInformation,
|
||||
|
|
|
|||
Loading…
Reference in a new issue