Last active
August 21, 2018 09:32
-
-
Save Hugovdberg/774c02008f5f94b53302e6d4688b52a9 to your computer and use it in GitHub Desktop.
Remify & Cornify The Daily WTF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Remify & Cornify The Daily WTF | |
| // @namespace https://github.com/Hugovdberg | |
| // @version 0.2.1 | |
| // @description Replace comments with dark green text and highlight the cornify spans. | |
| // @author Hugo van den Berg | |
| // @match thedailywtf.com/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| function remify(idx, article) { | |
| article.innerHTML = article.innerHTML.replace(/<!--[^>]+?-->/g, function(comment) { | |
| return comment | |
| .replace(/<!\-\-/g, ' <span style="color: green; font-weight: bold;">') | |
| .replace(/\-\->/g, '</span> ') | |
| .replace(/(https?:\/\/[^ ]+)/g, '<a href="$1">$1</a>'); | |
| }); | |
| } | |
| $('.article-body').each(remify); | |
| $('.ArticleBody').each(remify); | |
| $('#ArticleFull').each(remify); | |
| $('[onclick^=cornify]').each(function(idx, corny){ | |
| console.log(corny); | |
| corny.style.color = "#ff7f95"; | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment