Skip to content

Instantly share code, notes, and snippets.

@jhthorsen
Last active December 15, 2015 21:29
Show Gist options
  • Save jhthorsen/5326366 to your computer and use it in GitHub Desktop.
Save jhthorsen/5326366 to your computer and use it in GitHub Desktop.
How to add inline styling (<tag style="...">) from calculated styles.
/*
add inline styling (<tag style="...">) from calculated css.
1. Paste the code below into the javascript console
2. Go back to the "Elements" view, where all the selected element and all sub elements has inline styling
*/
// add to whole document
$('body, body *').each(function(){var $e=$(this);$e.attr('style',$.map(["opacity","filter","azimuth","background","background-attachment","background-color","background-image","background-position","background-repeat","border","border-collapse","border-color","border-spacing","border-style","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width","border-width","bottom","caption-side","clear","clip","color","content","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","elevation","empty-cells","css-float","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","height","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-top","margin-right","margin-bottom","margin-left","marker-offset","marks","max-height","max-width","min-height","min-width","orphans","outline","outline-color","outline-style","outline-width","overflow","padding","padding-top","padding-right","padding-bottom","padding-left","page","page-break-after","page-break-before","page-break-inside","position","quotes","richness","right","size","table-layout","text-align","text-decoration","text-indent","text-shadow","text-transform","top","unicode-bidi","vertical-align","visibility","white-space","width","word-spacing","z-index"],function(p){return p+":"+$e.css(p)}).join(';'))}).removeAttr('class');
/*
Inject jQuery
1. Open up the console
2. Paste inn the code below
*/
s=document.createElement('script');s.src='http://code.jquery.com/jquery-latest.min.js';document.getElementsByTagName('head')[0].appendChild(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment