Skip to content

Instantly share code, notes, and snippets.

@BoberMod
Last active May 15, 2019 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoberMod/08962097fe888a7c4cf83ab79e28863f to your computer and use it in GitHub Desktop.
Save BoberMod/08962097fe888a7c4cf83ab79e28863f to your computer and use it in GitHub Desktop.
Adds a watch online button on the anime page on shikimori.one
// ==UserScript==
// @name Shikimori.one anime watch button
// @name:ru Кнопка "смотреть онлайн" на shikimori.one
// @namespace https://shikimori.one/
// @version 0.2
// @description Adds a watch online button on the anime page
// @description:ru Добавляет кнопку "смотреть онлайн" на странице аниме shikimori.one
// @author BoberMod
// @match https://shikimori.one/animes/*
// @downloadURL https://gist.github.com/BoberMod/08962097fe888a7c4cf83ab79e28863f/raw/shikimori-watch-online-button.user.js
// @updateURL https://gist.github.com/BoberMod/08962097fe888a7c4cf83ab79e28863f/raw/shikimori-watch-online-button.user.js
// @grant none
// ==/UserScript==
function add() {
"use strict";
let watch = document.getElementsByClassName("watch-online-placeholer")[0];
let block = document.createElement("div");
let watchButton = document.createElement("A");
block.setAttribute("class", "block");
watchButton.text = "Смотреть онлайн";
watchButton.setAttribute("class", "b-link_button dark watch-online");
watchButton.setAttribute('href', "https://play.shikimori.org" + window.location.pathname);
watch.appendChild(block);
block.appendChild(watchButton);
}
function onload(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);
}
}
onload(add);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment