Chortowod / Shiki Rutracker

// ==UserScript==
// @name         Shiki Rutracker
// @description  Добавляет пункт "Rutracker" в список "На других сайтах" для поиска аниме на рутрекере
// @namespace    http://shikimori.one/
// @version      1.2.2
// @match        http://shikimori.org/*
// @match        https://shikimori.org/*
// @match        http://shikimori.one/*
// @match        https://shikimori.one/*
// @license      MIT
// @require      https://gist.githubusercontent.com/arantius/3123124/raw/grant-none-shim.js
// @copyright    2020, Chortowod
// @updateURL    https://openuserjs.org/meta/Chortowod/Shiki_Rutracker.meta.js
// ==/UserScript==

var style = ` #linkRutracker.b-link:before { background: url(https://rutracker.org/favicon.ico) no-repeat; -webkit-background-size: 19px 19px; background-size: 19px 19px;} `;

function checker() {
    if (!location.href.includes("/animes/") && !location.href.includes("/mangas/") && !location.href.includes("/ranobe/")) return;
    if (document.getElementById('linkRutracker')) return;
    var title = document.querySelector("meta[property='og:title']").getAttribute('content');
    var appendContainer = document.querySelector(".subheadline.m8").parentElement;
    var rutrackerLink = appendContainer.childNodes[1].cloneNode(true);
    if (location.href.includes("/mangas/")) rutrackerLink.children[0].href = "https://rutracker.org/forum/tracker.php?f=2461,2462,2463,2464,2465,2473,281,862&nm=" + title;
    if (location.href.includes("/animes/")) rutrackerLink.children[0].href = "https://rutracker.org/forum/tracker.php?f=1105,1386,1387,1389,1390,1391,1642,2484,2491,33,404,599,809,893&nm=" + title;
    if (location.href.includes("/ranobe/")) rutrackerLink.children[0].href = "https://rutracker.org/forum/tracker.php?f=2458&nm=" + title;
    rutrackerLink.children[0].target = "_blank";
    rutrackerLink.children[0].id = "linkRutracker";
    rutrackerLink.children[0].textContent = "Rutracker";
    GM_addStyle(style);
    appendContainer.insertBefore(rutrackerLink, appendContainer.childNodes[1]);
}

function ready(fn) {
    document.addEventListener('page:load', fn);
    document.addEventListener('turbolinks:load', fn);
    if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading") fn();
    else document.addEventListener('DOMContentLoaded', fn);
}

ready(checker);