Last active
August 29, 2015 14:02
-
-
Save padenot/73ffe8e2f5e500f621fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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