1import { ACard } from "../../modules/AnimeCard.js"; 2import { Kodik } from "../../modules/api.kodik.js"; 3import { GraphQl } from "../../modules/api.shiki.js"; 4import { Sleep } from "../../modules/functions.js"; 5 6const _limitAnime = 8; 7const _exclude_ids = { 8 '': [60108], // ÐÑе 9 4: [], // ÐÐ¾Ð¼ÐµÐ´Ð¸Ñ 10 24: [58379, 57827, 59883], // ФанÑаÑÑика 11 14: [], // УжаÑÑ 12 10: [], // ФÑнÑÑзи 13 22: [], // РоманÑика 14 8: [], // ÐÑама 15 18: [57827, 59387, 60913], // ÐÐµÑ Ð° 16 7: [], // ÐÑÑÑкÑив 17 38: [60207] // Ðоенное 18} 19 20let _loadedAnime = false; 21let _loadedUpdates = false; 22 23let _functionsLoaded = []; 24 25export function LoadAnimeShikimori({ status = 'ongoing', limit = _limitAnime, genre = '', take = 1, reflex = false, order = 'ranked', exclude_ids = _exclude_ids.toString() } = {}) { 26 const arg = { 27 kind: `"tv,movie"`, 28 order: `${order}`, 29 status: `"${status}"`, 30 limit: limit, 31 genre: `"${genre}"`, 32 excludeIds: `"${(_exclude_ids[genre] || []).toString()}"`, 33 season: `"${new Date().getFullYear() - take}_${new Date().getFullYear()}"` 34 } 35 36 if(!reflex){ 37 for (let i = 0; i < limit; i++) { 38 $(`.section-anime`).append(ACard.LoadV2({id: i})); 39 } 40 } 41 42 GraphQl.animes(arg, async (response) => { 43 if (response.failed && response.status == 429) { 44 await Sleep(1000); 45 return LoadAnimeShikimori({ status, limit, genre, take, reflex, order, exclude_ids }); 46 } 47 48 const element = $('.section-anime'); 49 //ÐÑиÑение елеменÑа 50 if (!reflex) { 51 element.empty(); 52 } 53 54 //ÐÑолиÑÑÑваем в наÑало 55 element.scrollLeft(0) 56 57 const animes = response.data.animes; 58 59 for (let i = 0; i < animes.length; i++) { 60 element.append(ACard.GenV2({ type: "a", anime: animes[i] })); 61 } 62 63 if ($('.section-anime').find('.card-anime').length < _limitAnime) { 64 LoadAnimeShikimori({ limit: _limitAnime - animes.length, genre, take: take + 1, status: 'released', reflex: true }); 65 } 66 67 68 _loadedAnime = true; 69 AnimeLoaded(); 70 }).POST(["id", { poster: ["mainUrl"] }, "russian", { airedOn: ["year"] }, "score"]); 71} 72 73/** 74 * ÐолÑÑаем обновленнÑе аниме в kodik плееÑе 75 */ 76export async function LoadUpdatetAnime() { 77 const response = await Kodik.List({ 78 sort: 'updated_at', 79 limit: _limitAnime, 80 types: 'anime-serial' 81 }); 82 83 if (response.failed) { 84 await Sleep(1000); 85 return LoadUpdatetAnime(); 86 } 87 88 let ids = []; 89 90 for (let index = 0; index < response.results.length; index++) { 91 ids.push(response.results[index].shikimori_id); 92 } 93 94 _loadAnimes(ids) 95 96 //ÐоÑÑÐ°ÐµÑ Ð´Ð°Ð½Ð½Ñе Ñ shikimori cо взÑÑÑÑ id из kodik ÑеÑвеÑа 97 function _loadAnimes(ids) { 98 for (let i = 0; i < ids.length; i++) { 99 $(`.section-update`).append(ACard.LoadV2({id: i})); 100 } 101 GraphQl.animes({ ids: `"${ids.toString()}"`, limit: ids.length }, async (response) => { 102 if (response.failed && response.status == 429) { 103 await Sleep(1000); 104 return _loadAnimes(ids); 105 } 106 107 const element = $('.section-update'); 108 const animes = response.data.animes; 109 110 $(`.section-update`).empty(); 111 112 for (let i = 0; i < animes.length; i++) { 113 element.append(ACard.GenV2({ type: "a", anime: animes[i] })); 114 } 115 116 _loadedUpdates = true; 117 AnimeLoaded(); 118 }).POST(["id", { poster: ["mainUrl"] }, "russian", { airedOn: ["year"] }, "score"]); 119 } 120} 121 122 123//ФÑнкÑÐ¸Ñ Ð±ÑÐ´ÐµÑ Ð²Ñзвана ÑолÑко Ñогда когда аниме бÑÐ´ÐµÑ Ð·Ð°Ð³ÑÑжено 124export function AnimeLoaded(event) { 125 if (event && typeof event == "function") { 126 if (_loadedAnime && _loadedUpdates) { 127 return event(); 128 } 129 130 return _functionsLoaded.push(event); 131 } 132 133 for (let i = 0; i < _functionsLoaded.length; i++) { 134 const e = _functionsLoaded[i]; 135 e(); 136 } 137 _functionsLoaded = []; 138}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.