Skip to content

Instantly share code, notes, and snippets.

@eviltester
Last active August 16, 2017 09:21
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 eviltester/65d6f47950699646c8e2cb0fe382b4fe to your computer and use it in GitHub Desktop.
Save eviltester/65d6f47950699646c8e2cb0fe382b4fe to your computer and use it in GitHub Desktop.
run bookmarklet on http.cat to link page to httpstatuses.com
javascript:(function(){var%20cats=document.querySelectorAll(%22li.status%22);%20for%20(var%20i%20=%200,%20len%20=%20cats.length;%20i%20%3C%20len;%20i++)%20%7B%20cats%5Bi%5D.innerHTML%20+=%20%22%5Binfo%5D%22.link(%22https://httpstatuses.com/%22+cats%5Bi%5D.innerText);%20%7D})()
@eviltester
Copy link
Author

The following code, converted to a bookmarklet, when run on http.cats links the cats to the status codes via an "[info]" link

var cats=document.querySelectorAll("li.status");
for (var i = 0, len = cats.length; i < len; i++) {
    cats[i].innerHTML += "[info]".link("https://httpstatuses.com/"+cats[i].innerText);
}

Use of .link is deprecated but works for the moment and kept code short.

@eviltester
Copy link
Author

eviltester commented Aug 16, 2017

You can create a bookmarklet link by converting the above code to http://compendiumdev.co.uk/apps/eviltester/bookmarklets.html or just copy the raw contents of gistfile1.txt into your browser bookmarks. Or run the code in the comment above in your dev console when on the http.cat site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment