// ==UserScript== // @name Anime Songs - AniList Player // @namespace Openings and Endings Player // @version 1.2.8 // @description This Script allows You to play Openings and Endings directly on AniList // @author NurarihyonMaou // @match https://anilist.co/* // @icon https://www.google.com/s2/favicons?sz=64&domain=anilist.co // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @require http://code.jquery.com/jquery-3.5.1.min.js // @downloadURL none // ==/UserScript== const $ = window.jQuery; let result; let openings, endings; let url = "https://graphql.anilist.co"; let AnimeID; let AniID = {}; function loadVideos(AnimeID) { let Song = 0; (function init() { openings = document.getElementsByClassName("openings"); endings = document.getElementsByClassName("endings"); if (openings.length > 0 || endings.length > 0) { GM_xmlhttpRequest({ method: "GET", url: "https://staging.animethemes.moe/api/anime?filter[has]=resources&filter[site]=MyAnimeList&filter[external_id]=" + AnimeID + "&include=animethemes.animethemeentries.videos,animethemes.song.artists", data: AnimeID, headers: { "Content-Type": "application/json" }, onload: function (response) { result = JSON.parse(response.responseText); openings = openings.length > 0 ? openings : endings; if ($("body video#Player").length == 0) { $(openings).append( "