Kibakus / Play.shikimori.org

// ==UserScript==
// @name         Play.shikimori.org
// @namespace    https://github.com/Kibakus
// @version      0.01
// @description  Play online on shikimori.org
// @author       Kibakus
// @match        https://shikimori.org/*
// @match        http://shikimori.org/*
// @match        https://shikimori.one/*
// @match        http://shikimori.one/*
// @require      https://code.jquery.com/jquery-3.3.1.slim.min.js
// @grant        none
// @license      MIT
// @copyright    2019, Kibakus (https://github.com/Kibakus)
// ==/UserScript==

function start() {
  var url = window.location.pathname.split('/');
  if (url.length != 3 || url[1] != 'animes')
    return;
  var ne = $(".current-episodes").text() - -1;
  var e = $(".watch-online-placeholer");
  var me = - -e.data('total_episodes');
  var link = $("<a/>", {
    'class': 'b-link_button dark watch-online',
    'href': "https://plashiki.online" + ((location.pathname.split("-")[0]).replace("s","")).replace("y","") + "/episodes/" + (ne > me ? 1 : ne)
  }).text('plashiki.online');
  e.append($("<div/>", {'class': 'block'}).append(link));
  var link1 = $("<a/>", {
    'class': 'b-link_button dark watch-online',
    'href': "https://beta.shikimorilive.top/player" + (location.pathname.split("-")[0]).replace("/animes","") + "/subbed/" + (ne > me ? 1 : ne)
  }).text('beta.shikimorilive.top');
  e.append($("<div/>", {'class': 'block'}).append(link1));
}
$(document).ready(start);
$(document).on('page:load', start);
$(document).on('turbolinks:load', start);