Skip to content

Instantly share code, notes, and snippets.

@ClarSco
ClarSco / explainXkcdBookmarklet.js
Last active July 24, 2017 09:18
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++;
}