Skip to content

Instantly share code, notes, and snippets.

@ClarSco
Last active July 24, 2017 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ClarSco/74c7c5548ff3f99a3f242ff94e49869a to your computer and use it in GitHub Desktop.
Save ClarSco/74c7c5548ff3f99a3f242ff94e49869a to your computer and use it in GitHub Desktop.
Opens the explainxkcd.com entry for the current xkcd.com comic
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