Skip to content

Instantly share code, notes, and snippets.

@ericpedia
Created November 4, 2011 19:20
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 ericpedia/1340236 to your computer and use it in GitHub Desktop.
Save ericpedia/1340236 to your computer and use it in GitHub Desktop.
docraptor excluding scripts
myHTML = jQuery('html').clone();
// I tried removing elements one by one, like this:
myHTML.find('script[src*="aloha"], link[href*="aloha"], .admin-only, script[src*="pro-player"], script[src*="proplayer"], script[src*="colorbox"], script[src*="sharethis"], script:contains("Aloha"), script:contains("colorbox"), script:contains("analytics"), script[src*="analytics"], script:contains("stLight"), style:contains("AdBlock"), style[style*="display: none !important"], script:contains("front-end-editor"), script:contains("thickbox"), link:contains("admin-bar"), #wpadminbar').remove();
// another way to do it is to remove all scripts except a particular script, like this:
myHTML.find('script:not([src*="typekit"])').remove();
// at one point I just removed all scripts, to see if that helped (not really)
myHTML.find('script').remove();
// then put it into the content var, which gets sent to docraptor in document_content
content = "<!DOCTYPE html><html>" + myHTML.html() + "</html>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment