-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAniList To MAL and Simkl.js
34 lines (34 loc) · 1.32 KB
/
AniList To MAL and Simkl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name AniList To MAL/Simkl
// @namespace Deterio
// @author Deterio
// @description Adds MAL/Simkl links to AniList anime and manga pages
// @match https://anilist.co/manga/*
// @match https://anilist.co/anime/*
// @grant GM_xmlhttpRequest
// @version 1
// ==/UserScript==
GM_xmlhttpRequest({
method: "POST",
url: "https://graphql.anilist.co",
data: JSON.stringify({
query: `query($id:Int,$type:MediaType){
Media(id:$id,type:$type){
idMal
}
}`,
variables: {
"id": window.location.pathname.split("/")[2],
"type": "ANIME"
}
}),
headers: {
"Content-Type": "application/json"
},
onload: function(response) {
var MalUrl= "https://myanimelist.net/anime/" + JSON.parse(response.responseText)["data"]["Media"]["idMal"]
var SimklUrl= "https://api.simkl.com/redirect?mal=" + JSON.parse(response.responseText)["data"]["Media"]["idMal"]
document.querySelector(".content").querySelector(".nav").innerHTML+=`<a data-v-5e562a30 rel="noopener noreferrer" class="link" href="${MalUrl}">MyAnimeList</a>`
document.querySelector(".content").querySelector(".nav").innerHTML+=`<a data-v-5e562a30 rel="noopener noreferrer" class="link" href="${SimklUrl}">Simkl</a>`
}
});