NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Reddit PkgLinks Auto Decoder // @namespace http://tampermonkey.net/ // @version 1.0 // @description Decode Base64 encoded links from the /r/PkgLinks // @author Drigtime // @match https://www.reddit.com/r/PkgLinks/* // @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{20,})$/g // Must set an interval, otherwise the content that is lazy loaded (e.g. loaded on scrolling) will not get decoded setInterval(() => { const pTags = document.querySelectorAll('p') pTags.forEach(pTag => { // Split the string into an array and check each element for a base64 encoded string const pTagText = pTag.innerText.split(/\s+/); pTagText.forEach(text => { if (base64Regex.test(text)) { // If the string is a base64 encoded string, decode it and replace the p tag with the decoded string pTag.innerText = pTag.innerText.replace(text, atob(text)); } }); }) }, 500) })();