Created
July 6, 2021 14:11
-
-
Save gregory-seidman/21eebcb811e85ff16a91322ca96fe198 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 SMBC hover text | |
// @include https://www.smbc-comics.com/comic/* | |
// @version 1 | |
// @grant unsafeWindow | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const id = "cc-comic-title"; | |
const css = ` | |
#${id} { | |
border: 4px solid gray; | |
color: gray; | |
background: gray; | |
margin: 10px; | |
} | |
#${id}:hover { | |
opacity: 1.0; | |
border-color: green; | |
color: black; | |
background: #DDDDDD; | |
} | |
`; | |
const div = document.getElementById("cc-comicbody"); | |
const img = document.getElementById("cc-comic"); | |
const text = document.createElement("h2"); | |
const style = document.createElement("style"); | |
text.innerText = img.title; | |
text.id = id; | |
div.appendChild(text); | |
style.innerText = css; | |
document.head.appendChild(style); | |
if (unsafeWindow.showBlock) { | |
unsafeWindow.showBlock("aftercomic"); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment