Skip to content

Instantly share code, notes, and snippets.

@shinmai
Last active April 14, 2024 11:57
Show Gist options
  • Save shinmai/fbb442875139033f690716044b3814b4 to your computer and use it in GitHub Desktop.
Save shinmai/fbb442875139033f690716044b3814b4 to your computer and use it in GitHub Desktop.
Replace Pateron dot com cumstain with an actual logo 🤯
// ==UserScript==
// @name replace cumstain with a logo
// @namespace wtf.shinmai.userscripts
// @version 0.0.4
// @description Replace the Patron dot com cumstain with an actual logotype, for fun
// @author @shinmai - shinmai.wtf
// @match https://www.patreon.com/*
// @icon https://i.imgur.com/jmpscwv.png
// @updateURL https://gist.github.com/shinmai/fbb442875139033f690716044b3814b4/raw/wipe-it-on-a-sock.user.js
// @downloadURL https://gist.github.com/shinmai/fbb442875139033f690716044b3814b4/raw/wipe-it-on-a-sock.user.js
// @grant none
// ==/UserScript==
/**
* Changelog:
* 0.0.1 (240413) - initial version
* 0.0.2 (240413) - add delay to favicon replacement because Patreon is a silly little prankster
* 0.0.3 (240414) - more aggressive replacement, fixed old logo alignment, replaced externally hosted data with dataURLs, increased timeout for favicon replacement (might need to swap to a MutationObserver, though)
* 0.0.4 (240414) - changed to MutationObserver for icon replacement (still sometimes gets reverted, I'm guessing due to some caching mechanism, sadge)
*/
(function() {
'use strict';
var cleanupTimeout=undefined
const EVEN_OLDER = false,
headNode = document.querySelector('head'),
observerConfig = { childList: true, subtree: true, attributes: true },
observer = new MutationObserver((mutationsList) => {
clean_up_the_stain()
}),
clean_up_the_stain = e => {
document.querySelector('.sc-GEbAx > svg:nth-child(1)').innerHTML=EVEN_OLDER?'<svg preserveAspectRatio="xMidYMid" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><path d="m127.996927.00236401c-70.6933383 0-127.996927 57.30358869-127.996927 127.99692699v127.935462h29.7127618v-127.935462c0-54.2776568 44.0060356-98.2860564 98.2860562-98.2860564 54.280021 0 98.286056 44.0060356 98.286056 98.2860564 0 52.750506-41.569214 95.784934-93.732974 98.163128-16.57407-.135676-30.704227-2.825512-36.8932039-6.633884v-42.242012c9.2371309 6.048082 20.2850919 9.574239 32.1505279 9.574239 32.453595 0 58.759819-26.306697 58.759819-58.759819 0-32.4535941-26.306697-58.7740023-58.759819-58.7740023-32.4535939 0-58.759818 26.3213538-58.759818 58.7740023v127.836174c19.3938605-.018108 39.995257.026572 58.953667 0 70.693338 0 127.996927-57.246852 127.996927-127.935462-.004728-70.6980663-57.313045-128.001655-128.001655-128.001655z" fill="#ff5900"/></svg>':'<svg enable-background="new 0 0 1024 1024" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><circle cx="512" cy="512" fill="#f96854" r="512"/><path d="m600.5 279c-96.5 0-175 78.5-175 175 0 96.2 78.5 174.4 175 174.4 96.2 0 174.4-78.2 174.4-174.4.1-96.5-78.2-175-174.4-175m-311.5 466h85.5v-466h-85.5" fill="#fff"/></svg>'
clearTimeout(cleanupTimeout)
cleanupTimeout = setTimeout(function(){
console.log("run")
observer.disconnect()
document.querySelectorAll('head link[rel*="icon"]').forEach(link => link.remove())
const newIcon = document.createElement('link')
newIcon.rel = 'icon'
newIcon.type = 'image/svg+xml'
newIcon.href = EVEN_OLDER?'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1NiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiB3aWR0aD0iMjU2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Im0xMjcuOTk2OTI3LjAwMjM2NDAxYy03MC42OTMzMzgzIDAtMTI3Ljk5NjkyNyA1Ny4zMDM1ODg2OS0xMjcuOTk2OTI3IDEyNy45OTY5MjY5OXYxMjcuOTM1NDYyaDI5LjcxMjc2MTh2LTEyNy45MzU0NjJjMC01NC4yNzc2NTY4IDQ0LjAwNjAzNTYtOTguMjg2MDU2NCA5OC4yODYwNTYyLTk4LjI4NjA1NjQgNTQuMjgwMDIxIDAgOTgu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Tc1IDc4LjUtMTc1IDE3NSAwIDk2LjIgNzguNSAxNzQuNCAxNzUgMTc0LjQgOTYuMiAwIDE3NC40LTc4LjIgMTc0LjQtMTc0LjQuMS05Ni41LTc4LjItMTc1LTE3NC40LTE3NW0tMzExLjUgNDY2aDg1LjV2LTQ2NmgtODUuNSIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg=='
document.head.appendChild(newIcon)
observer.observe(headNode, observerConfig)
}, 700)
}
if (document.readyState !== 'loading')
clean_up_the_stain()
else
document.addEventListener('DOMContentLoaded', clean_up_the_stain)
window.onload = clean_up_the_stain
observer.observe(headNode, observerConfig)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment