2020-04-10 15:07:08 -04:00
|
|
|
import _ from './anime-client.js';
|
2018-09-20 16:08:46 -04:00
|
|
|
|
2018-09-27 16:45:12 -04:00
|
|
|
// Click on hidden MAL checkbox so
|
|
|
|
// that MAL id is passed
|
2018-09-20 16:08:46 -04:00
|
|
|
_.on('main', 'change', '.big-check', (e) => {
|
|
|
|
const id = e.target.id;
|
|
|
|
document.getElementById(`mal_${id}`).checked = true;
|
|
|
|
});
|
|
|
|
|
2018-08-22 12:54:06 -04:00
|
|
|
export function renderAnimeSearchResults (data) {
|
2021-02-18 07:14:07 -05:00
|
|
|
return data.map(item => {
|
2020-04-23 18:51:12 -04:00
|
|
|
const titles = item.titles.join('<br />');
|
2018-08-22 12:54:06 -04:00
|
|
|
|
2021-02-18 07:14:07 -05:00
|
|
|
return `
|
2018-08-22 12:54:06 -04:00
|
|
|
<article class="media search">
|
|
|
|
<div class="name">
|
2020-10-21 15:45:30 -04:00
|
|
|
<input type="radio" class="mal-check" id="mal_${item.slug}" name="mal_id" value="${item.mal_id}" />
|
|
|
|
<input type="radio" class="big-check" id="${item.slug}" name="id" value="${item.id}" />
|
2018-08-22 12:54:06 -04:00
|
|
|
<label for="${item.slug}">
|
2018-10-05 22:36:54 -04:00
|
|
|
<picture width="220">
|
2020-10-21 15:45:30 -04:00
|
|
|
<source srcset="/public/images/anime/${item.id}.webp" type="image/webp" />
|
|
|
|
<source srcset="/public/images/anime/${item.id}.jpg" type="image/jpeg" />
|
|
|
|
<img src="/public/images/anime/${item.id}.jpg" alt="" width="220" />
|
2018-10-05 22:36:54 -04:00
|
|
|
</picture>
|
2018-08-22 12:54:06 -04:00
|
|
|
<span class="name">
|
|
|
|
${item.canonicalTitle}<br />
|
|
|
|
<small>${titles}</small>
|
|
|
|
</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="table">
|
|
|
|
<div class="row">
|
|
|
|
<span class="edit">
|
|
|
|
<a class="bracketed" href="/anime/details/${item.slug}">Info Page</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</article>
|
2021-02-18 07:14:07 -05:00
|
|
|
`;
|
|
|
|
}).join('');
|
2018-08-22 12:54:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function renderMangaSearchResults (data) {
|
2021-02-18 07:14:07 -05:00
|
|
|
return data.map(item => {
|
2020-04-23 18:51:12 -04:00
|
|
|
const titles = item.titles.join('<br />');
|
2021-02-18 07:14:07 -05:00
|
|
|
return `
|
2018-08-22 12:54:06 -04:00
|
|
|
<article class="media search">
|
|
|
|
<div class="name">
|
2020-10-21 15:45:30 -04:00
|
|
|
<input type="radio" id="mal_${item.slug}" name="mal_id" value="${item.mal_id}" />
|
|
|
|
<input type="radio" class="big-check" id="${item.slug}" name="id" value="${item.id}" />
|
2018-08-22 12:54:06 -04:00
|
|
|
<label for="${item.slug}">
|
2018-10-05 22:36:54 -04:00
|
|
|
<picture width="220">
|
2020-10-21 15:45:30 -04:00
|
|
|
<source srcset="/public/images/manga/${item.id}.webp" type="image/webp" />
|
|
|
|
<source srcset="/public/images/manga/${item.id}.jpg" type="image/jpeg" />
|
|
|
|
<img src="/public/images/manga/${item.id}.jpg" alt="" width="220" />
|
2018-10-05 22:36:54 -04:00
|
|
|
</picture>
|
2018-08-22 12:54:06 -04:00
|
|
|
<span class="name">
|
|
|
|
${item.canonicalTitle}<br />
|
|
|
|
<small>${titles}</small>
|
|
|
|
</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="table">
|
|
|
|
<div class="row">
|
|
|
|
<span class="edit">
|
|
|
|
<a class="bracketed" href="/manga/details/${item.slug}">Info Page</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</article>
|
2021-02-18 07:14:07 -05:00
|
|
|
`;
|
|
|
|
}).join('');
|
2018-08-22 12:54:06 -04:00
|
|
|
}
|