Created
February 5, 2023 17:09
-
-
Save michaelfm1211/51739b09808b2814e26d2401187c2b12 to your computer and use it in GitHub Desktop.
Tampermonkey script to show Explain XKCD links on xkcd.com
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 Explain XKCD shortcut | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Shows link to Explain XKCD on xkcd.com | |
// @author michaelfm1211 | |
// @match https://xkcd.com/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const ctitle = document.getElementById('ctitle'); | |
const url = `https://www.explainxkcd.com/wiki/index.php/${location.href.split('/')[3]}` | |
ctitle.insertAdjacentHTML('beforebegin', ` | |
<div> | |
<span id="ctitle">${ctitle.textContent}</span> | |
<a href="${url}" target="_blank" style="font-size: 12px;">explain</a> | |
</div>`); | |
ctitle.remove(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment