Skip to content

Instantly share code, notes, and snippets.

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 matthewmcvickar/2bd1f289f51891a586b1 to your computer and use it in GitHub Desktop.
Save matthewmcvickar/2bd1f289f51891a586b1 to your computer and use it in GitHub Desktop.

Reason

The PDFs Blue Apron provides are two-pages and full of color and detail that wastes ink. This just prints a plain version of the recipe. Blue Apron's print stylesheet doesn't get rid of everything, though, so I made this.

The Code

The bookmarklet just runs this bit of jQuery:

// Remove header and navigation.
$('#header-main').remove();
$('#snap-drawers-container').remove();

// Remove modals.
$('#signup-modal').remove();
$('#signup-wine-modal').remove();

// Remove 'Tools' and 'Reviews' and 'Wine Recommendation' segments of recipe.
$('#tools').remove();
$('#reviews').remove();
$('.rec-wine-section').remove();

// Remove broken image in ingredients list.
$('.ingredients-img-hldr').remove();

// Remove hyperlinks but leave text.
$('a').contents().unwrap();

// Make headings and ingredient black instead of blue.
$('h1.main-title').css('color', 'black');
$('#ingredients li').css('color', 'black');

// Remove 'Print PDF of this recipe' link.
$('.pdf-ico').remove();
$('.pdf-txt').remove();

Bookmarklet

Click here for a bookmarklet you can drag into your toolbar.

(That uses Ben Alman's Bookmarklet Generator.)

Or, create a link in your toolbar with this as the URL:

javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){$("#header-main").remove(),$("#snap-drawers-container").remove(),$("#signup-modal").remove(),$("#signup-wine-modal").remove(),$("#tools").remove(),$("#reviews").remove(),$(".rec-wine-section").remove(),$(".ingredients-img-hldr").remove(),$("a").contents().unwrap(),$("h1.main-title").css("color","black"),$("#ingredients li").css("color","black"),$(".pdf-ico").remove(),$(".pdf-txt").remove();});

You can call it Prepare Blue Apron Recipe for Printing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment