Last active
July 24, 2017 09:18
-
-
Save ClarSco/74c7c5548ff3f99a3f242ff94e49869a to your computer and use it in GitHub Desktop.
Opens the explainxkcd.com entry for the current xkcd.com comic
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
javascript: { | |
function getComicId() { | |
const middleContainerHtml = document.getElementById("middleContainer").innerHTML; | |
const searchKey = "https://xkcd.com/"; | |
var comicId = ""; | |
var i = middleContainerHtml.indexOf(searchKey) + searchKey.length; | |
while (middleContainerHtml.charAt(i) !== "/") { | |
comicId += middleContainerHtml.charAt(i); | |
i++; | |
} | |
return comicId; | |
} | |
window.open("http://www.explainxkcd.com/wiki/index.php/" + getComicId()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment