UnFuck Crayon-Syntax-Highlighter

Crayon-Syntax-Highlighter is a horrible (horrible!) piece of code.

The following code will convert it into a lovely,
JavaScript-free and easy-to-copy container.

NodeList.prototype.forEach = Array.prototype.forEach;
NodeList.prototype.map     = Array.prototype.map;

document.querySelectorAll('div[id^="crayon-"][class*="crayon"]').forEach(function(element){
  var container = document.createElement("pre");
  container.innerText = element.querySelectorAll('div.crayon-line').map(function(line){ return line.innerText; }).join("\n");
  
  element.parentElement.replaceChild(container, element);
});