NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Alt Whatcher
// @namespace https://vk.com/shiki_ex
// @updateURL https://openuserjs.org/meta/Newt300/Alt_Whatcher.meta.js
// @downloadURL https://openuserjs.org/install/Newt300/Alt_Whatcher.user.js
// @version 1.2.0
// @description [shikimori.org] Добавляет ссылку на Альтернативные сайты просмотра аниме ###
// @author STorn
// @match https://shikimori.org/*
// @match http://shikimori.org/*
// @grant none
// @license MIT
// @copyright 2018, Newt300 (https://openuserjs.org/users/Newt300)
// ==/UserScript==
/*jshint multistr: true */
//Code Conventions?? Не, не слышал!
var selections = [
"https://smotret-anime.ru/catalog/search?q=",
"https://sovetromantica.com/anime?query=",
"https://hentai365.ru/catalog/search?q="
];
var sNames = [
"Anime 365",
"SR",
"Hentai 365"
];
var animeName;
function main() {
console.log("Alt Whatcher has successfully started");
var t = document.createElement("div");
t.class = "block";
t.innerHTML = '<a id="altBtn" target="_blank" class="b-link_button dark watch-online" href="https://smotret-anime.ru/catalog/search?q=' + animeName[0] + '">Смотреть на Anime365</a>';
document.querySelectorAll("#animes_show > section > div > div.menu-slide-outer.x199 > div > div > div.b-db_entry > div.c-about > div > div.c-info-right > div.watch-online-placeholer")[0].append(t);
var selector = document.createElement("select");
selector.id = "s1";
selector.setAttribute('class', "b-options-floated collapse");
selector.setAttribute("style", "margin: 6px 28% 0px 0");
selector.innerHTML = ' <option>Anime 365</option> \
<option>SovetRomantica</option>';
document.querySelectorAll("#animes_show > section > div > div.menu-slide-outer.x199 > div > div > div.b-db_entry > div.c-about > div > div.c-info-right")[0].append(selector);
if ($(".is-censored").length > 0) selector.innerHTML += '<option selected="selected">Hentai 365</option>';
}
function selectListner() {
var a = document.getElementById('altBtn');
var selector = document.getElementById('s1');
var s = selector.options.selectedIndex;
a.setAttribute('href', selections[s] + animeName[1]);
a.innerText = "Смотреть на " + sNames[s];
}
function start() {
if (window.location.pathname.indexOf("animes") === 0) {return;}
if (document.querySelectorAll(".disabled").length === 0) {return;}
animeName = document.querySelector("#animes_show > section > div > header > h1").innerText;
animeName = animeName.split(" / ");
if (document.querySelectorAll(".watch-online").length > 0) selectListner(); else main();
}
$(document).bind('mouseup mousemove ready', function(){
start();
});
$(document).ready(start());
$(document).ready(function(){start();});
$(document).on('page:load', function(){start();});
$(document).on('turbolinks:load', function(){start();});