Raw Source
CoderOffka / Nekomori.CH on shikimori

// ==UserScript==
// @name:ru         Nekomori.CH на shikimori
// @name:en         Nekomori.CH on shikimori
// @name            Nekomori.CH on shikimori
// @namespace       https://shikimori.one
// @match           https://shikimori.one/*
// @description     Nekomori.CH watch online on shikimori
// @description:en  Nekomori.CH watch online on shikimori
// @description:ru  Nekomori.CH онлайн просмотр для shikimori
// @author          idMysteries
// @version         1.05
// @license         MIT
// @downloadURL https://greasyfork.org/scripts/430647-nekomori-ch-on-shikimori/code/NekomoriCH%20on%20shikimori.user.js
// @updateURL https://greasyfork.org/scripts/430647-nekomori-ch-on-shikimori/code/NekomoriCH%20on%20shikimori.meta.js
// ==/UserScript==

function addButton(i) {
  let e = document.createElement("div");
  let button = e;
  let a = document.createElement("a");
  let icon = document.createElement("span");
  let wrap = document.createElement("div");
  let span = document.createElement("span");
			
  e.classList.add("block");
  e.classList.add("nekomoriPlayBtn");
			
	// Styles
  icon.style.cssText = "display:flex;justify-content:center;align-items:center;width:20%;height:100%;color:white;text-shadow: 1px 1px 1px #000; height: 43px;";
  a.style.cssText = "font-weight: 600;font-family: var(--font-alt);color:white;text-align:center;width:100%;display: inline-block;padding-top: 11px;"; // 80%
  button.style.cssText = "display:flex;align-items:center;margin:1em auto;height:35px;max-width:200px;max-height:45px;background-color:#456;border-bottom: 2px solid #333; height: auto; max-width:250px; font-size: 16px; cursor: pointer;"; //#2E2E2E
  wrap.style.cssText = "color:white;text-align:center;width:80%;";
  span.style.cssText = "color:white;font-size:12px;display:inline-block;width:100%;position: relative; top: -10px;";
			
  button.appendChild(icon);
  wrap.appendChild(a);
  wrap.appendChild(span);
  button.appendChild(wrap);
			
  button.target = "_blank";			
  icon.innerHTML = '►';
  a.textContent = 'Смотреть онлайн';
  a.href = "https://nekomori.ch/anime/" + -i + "/general";
  icon.style.backgroundColor = "#456";
  icon.style.color = 'white';
  icon.style.fontSize = '25px';
  e.setAttribute('onclick', 'window.open("'+a.href+'"); return false;');
  span.textContent = '(искать на nekomori.ch)';
  button.title = "Искать на nekomori.ch";
			
  document.querySelectorAll(".c-info-right")[0].appendChild(e);
}

function addEvent(rfn) {
  document.addEventListener('turbolinks:load', rfn);
  document.addEventListener('page:load', rfn);

  if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
    rfn();
  } else {
    document.addEventListener('DOMContentLoaded', rfn);
  }
}

addEvent(function() {
  if (document.getElementsByClassName('nekomoriPlayBtn').length > 0) return;
  let ldata = document.location.href.match(/^https?:\/\/shikimori\.one\/animes\/[a-zA-Z]*(\d+)(?:.+)?$/);
  if (ldata !== null) {
    addButton(ldata[1]);
  }
});