Skip to content

Instantly share code, notes, and snippets.

@illuminist
Last active June 29, 2020 13:12
Show Gist options
  • Save illuminist/758717dfb7e68f4f9ed36aecee07c0e6 to your computer and use it in GitHub Desktop.
Save illuminist/758717dfb7e68f4f9ed36aecee07c0e6 to your computer and use it in GitHub Desktop.
Detect Rick Roll on Reddit.com
// ==UserScript==
// @name Rick Roll Detector
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Detect Rick Roll on Reddit
// @author /u/illuminist_ova
// @match https://www.reddit.com/*
// @grant none
// ==/UserScript==
(async function() {
'use strict';
const gistPage = 'https://api.github.com/gists/758717dfb7e68f4f9ed36aecee07c0e6'
const selectorFile = 'rickrollselectors'
const pageRes = await (await fetch(gistPage)).json()
const fileInfo = pageRes.files[selectorFile]
const selectors = fileInfo.content
.split('\n')
.filter(s=>s)
.map(s=>s+'::after')
.join(',')
const head = document.head || document.getElementsByTagName('head')[0];
const style = document.createElement('style');
style.type = 'text/css';
style.id = "detect_rickroll";
style.appendChild(document.createTextNode(selectors + "{content:'ITS RICK ROLL!!!';font-size:0.6em;vertical-align:super;}"));
head.appendChild(style);
})();
a[href*='dQw4w9WgXcQ']
a[href*='ub82Xb1C8os']
a[href*='oHg5SJYRHA0']
a[href*='0JgF4CMXU9M']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment