"non-redirect picarto links" By ZippySqrl (https://pastebin.com/u/ZippySqrl) URL: https://pastebin.com/b9WwV1Zj Created on: Saturday 7th of July 2018 11:55:16 AM CDT Retrieved on: Saturday 31 of October 2020 04:26:08 PM UTC // ==UserScript== // @name PicartoLinkFixer // @namespace http://zippysqrl.tumblr.com/ // @version 0.2 // @description replace picarto links // @author ZippySqrl // @match https://picarto.tv/* // @updateURL https://pastebin.com/raw/b9WwV1Zj // @grant none // ==/UserScript== (function() { 'use strict'; function ScanMessage(M){ console.log("Message: "); //console.log(M); var inner = M.innerHTML; var links = M.getElementsByTagName("a"); if (links.length>0){ console.log("links found"); for (var I of links){ I.setAttribute("href", I.textContent); } } } var newMessageConfig = { attributes: false, childList: true, subtree: true }; function getMessages(MutationList){ //console.log("new message: ") //console.log(MutationList); for (var Mutation of MutationList){ if (Mutation.type == 'childList') { for (var Node of Mutation.addedNodes){ //console.log("Node: "); //console.log(Node); var nodeclassname = Node.getAttribute("class"); if (nodeclassname == "theMsg usrMsg"){ ScanMessage(Node); }else if (nodeclassname.substring(0, 9) === "messageli"){ try { var messagelist = Node.getElementsByClassName("infoContent")[0].getElementsByClassName("msgContent msgContentIdentifier")[0].childNodes; for (var Span of messagelist){ ScanMessage(Span); } }catch(err){ console.log("unable to get messages"); console.log(err); } } } } } //get tag //get innerhtml } try { var chatcontainer = document.getElementById("chatContainer"); var messages = chatcontainer.childNodes[1]; //console.log(messages); var observer = new MutationObserver(getMessages); observer.observe(messages, newMessageConfig); } catch(err){ console.log(err); } // Your code here... })();