Skip to content

Instantly share code, notes, and snippets.

@padenot
Last active August 29, 2015 14:02
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 padenot/73ffe8e2f5e500f621fe to your computer and use it in GitHub Desktop.
Save padenot/73ffe8e2f5e500f621fe to your computer and use it in GitHub Desktop.
// Converts a spec made with ReSpec to a cheat sheet
// Shift + f4 in Firefox, copy, paste, enjoy
var idl = document.querySelectorAll(".idl");
var cs = document.createElement("div");
cs.className = "lalala123123"
for (var i of idl) {
cs.appendChild(i);
}
// Link back to the original spec
var base = document.createElement("base");
base.href = document.location.origin + document.location.pathname;
document.head.appendChild(base);
base.className = ".lalala123123"
// Put a title
var title = document.createElement("h1");
title.innerHTML = document.querySelector("title").innerHTML + " cheat sheet";
title.className = ".lalala123123"
document.body.appendChild(cs);
var all = document.querySelectorAll("body > *:not(.lalala123123)");
for(var i of all) {
i.remove();
}
document.body.insertBefore(title, document.body.firstChild);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment