Greasy Fork is available in English.
adds anilist links to mal
当前为
// ==UserScript==
// @name Anilist links on MAL
// @namespace http://greasyfork.icu/en/users/12725-alistair1231
// @version 0.2
// @description adds anilist links to mal
// @author Alistair1231
// @match https://myanimelist.net/anime/*
// @icon https://icons.duckduckgo.com/ip2/myanimelist.net.ico
// @grant none
// @license GPL-3.0
// ==/UserScript==
function createButton(href, icon, textContent) {
var link = document.createElement("a");
link.href = href;
link.target = "_blank";
link.className = "link ga-click";
var img = document.createElement("img");
img.src = icon;
img.className = "link_icon";
img.alt = "icon";
link.appendChild(img);
var div = document.createElement("div");
div.className = "caption";
div.textContent = textContent;
link.appendChild(div);
return link;
}
(function (window, undefined) {
var anilistLink = `https://www.google.com/search?btnI=I&q=${document.querySelector(".title-name.h1_bold_none strong").innerHTML}+site%3Aanilist.co%2Fanime`;
var anilistIcon = "https://icons.duckduckgo.com/ip2/anilist.co.ico";
// array from all div.external_links -> get the last one -> get the first child -> add the button before that
[...document.querySelectorAll("div.external_links")].splice(-1)[0].firstChild.before(
createButton(anilistLink, anilistIcon, "Anilist")
);
})(window);