Created
December 8, 2016 06:56
-
-
Save brillenfux/ef8b28cfa520fac7256676eaee53e55b to your computer and use it in GitHub Desktop.
This file contains 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 Reddit spoilers without custom CSS | |
// @description Show correct spoiler formatting for Reddit even without custom CSS | |
// @author /u/brillenfukx | |
// @match *://www.reddit.com/*/comments/* | |
// @run-at document-start | |
// @version 0.1 | |
// ==/UserScript== | |
(function() {var css = [ | |
"a[href='#s'] {", | |
" display: inline-block;", | |
" //background: lightgrey !important;", | |
" color: #222222 !important;", | |
" cursor: text;", | |
"}", | |
"a[href='#s']::after {", | |
" content: attr(title);", | |
" background: #222222 !important;", | |
" color: #222222 !important;", | |
" visibility: visible;", | |
" border-radius: 3px;", | |
" padding: 0 3px;", | |
" margin-left: 5px;", | |
"}", | |
"a[href='#s']:hover::after, a[href='#s']:active::after {", | |
" background: white !important;", | |
" //background: lightgrey !important;", | |
" //color: white !important;", | |
"}" | |
].join("\n"); | |
if (typeof GM_addStyle != "undefined") { | |
GM_addStyle(css); | |
} else if (typeof PRO_addStyle != "undefined") { | |
PRO_addStyle(css); | |
} else if (typeof addStyle != "undefined") { | |
addStyle(css); | |
} else { | |
var node = document.createElement("style"); | |
node.type = "text/css"; | |
node.appendChild(document.createTextNode(css)); | |
var heads = document.getElementsByTagName("head"); | |
if (heads.length > 0) { | |
heads[0].appendChild(node); | |
} else { | |
// no head yet, stick it whereever | |
document.documentElement.appendChild(node); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment