Last active
October 19, 2023 15:47
-
-
Save pblop/505a9be7abc84a4641f59cc27e4a546c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name RollTogether Helper | |
// @namespace http://pabl.eu/ | |
// @version 1.2 | |
// @description try to take over the world! | |
// @author @pblop | |
// @match https://www.crunchyroll.com/es/watch/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=crunchyroll.com | |
// @grant none | |
// ==/UserScript== | |
function replace_urls(rollTogetherRoom) { | |
const links = Array.from(document.querySelectorAll("a[href]")).filter(x => x.href.includes("watch") && !x.href.includes("rollTogetherRoom")); | |
links.forEach(x => x.href = `${x.href}?rollTogetherRoom=${rollTogetherRoom}`); | |
} | |
(function() { | |
'use strict'; | |
const urlParams = new URLSearchParams(window.location.search); | |
const rollTogetherRoom = urlParams.get('rollTogetherRoom'); | |
console.log(rollTogetherRoom) | |
window.addEventListener('load', ()=>replace_urls(rollTogetherRoom), false); | |
setInterval(()=>replace_urls(rollTogetherRoom), 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment