Skip to content

Instantly share code, notes, and snippets.

@gregory-seidman
Created July 6, 2021 14:11
Show Gist options
  • Save gregory-seidman/21eebcb811e85ff16a91322ca96fe198 to your computer and use it in GitHub Desktop.
Save gregory-seidman/21eebcb811e85ff16a91322ca96fe198 to your computer and use it in GitHub Desktop.
// ==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