Skip to content

Instantly share code, notes, and snippets.

@hober
Created March 27, 2012 19:38
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 hober/2219591 to your computer and use it in GitHub Desktop.
Save hober/2219591 to your computer and use it in GitHub Desktop.
Bookmarklet for toggling between sections of the WHATWG and W3C versions of the HTML5 spec
// javascript:(function()%7b%20%20%20%20%20var%20prefix%3b%20%20%20%20%20var%20hash%20%3d%20window.location.hash%3b%20%20%20%20%20var%20specpart%20%3d%20window.location.pathname.split(%22%2f%22)%3b%20%20%20%20%20specpart%20%3d%20specpart%5bspecpart.length-1%5d%3b%20%20%20%20%20if%20(window.location.hostname%3d%3d%22www.whatwg.org%22)%20%7b%20%20%20%20%20%20%20%20%20prefix%20%3d%20%22http%3a%2f%2fdev.w3.org%2fhtml5%2fspec%2f%22%3b%20%20%20%20%20%7d%20else%20%7b%20%20%20%20%20%20%20%20%20prefix%20%3d%20%22http%3a%2f%2fwww.whatwg.org%2fspecs%2fweb-apps%2fcurrent-work%2fmultipage%2f%22%3b%20%20%20%20%20%7d%20%20%20%20%20window.location%20%3d%20prefix%20%2b%20specpart%20%2b%20hash%3b%20%7d)()%3b%20
(function(){
var prefix;
var hash = window.location.hash;
var specpart = window.location.pathname.split("/");
specpart = specpart[specpart.length-1];
if (window.location.hostname=="www.whatwg.org") {
prefix = "http://dev.w3.org/html5/spec/";
} else {
prefix = "http://www.whatwg.org/specs/web-apps/current-work/multipage/";
}
window.location = prefix + specpart + hash;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment