// ==UserScript== // @name Open in Miru // @namespace http://tampermonkey.net/ // @version 0.1 // @description Adds a link to open an anime in Miru, if you have MAL-Sync installed then it will be at the bottom of the Quicklinks. // @author WhiteTapeti // @match https://anilist.co/* // @icon https://raw.githubusercontent.com/ThaUnknown/miru/master/docs/logo.png // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @grant none // @downloadURL none // ==/UserScript== var functionIsRunning = false; document.body.onload = function() { if (window.location.href.indexOf('https://anilist.co/anime/') == 0) { setTimeout(function() { console.log('dsa'); $(`
`).insertBefore(".data"); }, 1500); } } window.addEventListener('popstate', (event) => { if (window.location.href.indexOf('https://anilist.co/anime/') == 0) { setTimeout(function() { console.log('dsa'); $(``).insertBefore(".data"); }, 1500); } }); window.addEventListener('locationchange', function() { if (window.location.href.indexOf('https://anilist.co/anime/') == 0) { setTimeout(function() { console.log('dsa'); $(``).insertBefore(".data"); }, 1500); } }); $(document).click(function() { if (window.location.href.indexOf('https://anilist.co/anime/') == 0) { setTimeout(function() { if (document.getElementById("MiruLinks") == null) { if (!functionIsRunning) { functionIsRunning = true; console.log('dsa'); $(``).insertBefore(".data"); functionIsRunning = false; } } }, 1500); } });