// ==UserScript== // @name Decode Buttondown emails to remove tracking // @namespace http://tampermonkey.net/ // @version 2025-09-20 // @description Replace the URL of links in Buttondown emails with the actual link target, bypassing Buttondown’s redirector (which probably does some tracking stuff) // @author Lucas Werkmeister // @match https://buttondown.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=buttondown.com // @grant none // ==/UserScript== (function() { 'use strict'; const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; for (const link of document.querySelectorAll('a[href^="https://buttondown-"]')) { const originalUrl = link.href; const match = originalUrl.match(/^https:\/\/buttondown-[0-9][0-9][0-9][0-9].com\/c\/([A-Za-z0-9+/]+)/); if (!match) { console.info('Not updating', link, 'because it does not look like a tracking link'); continue; } const payload = atob(match[1]); // decode base64 const parts = payload.split('|'); if (parts.length !== 4) { console.warn('Not updating', link, 'because the payload has the wrong length (expected four pipe-separated parts):', payload); continue; } const [uuid1, uuid2, url, web] = parts; if (!UUID.test(uuid1) || !UUID.test(uuid2) || web !== 'web') { console.warn('Not updating', link, 'because the payload looks unexpected:', payload); continue; } link.href = url; } })();