Advertisement
10basetom

Get Used CSS bookmarklet

Mar 6th, 2017
1,785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:function mq(n,t){var i,r;return n==="root"?(i=0,r=1):t==="root"?(i=1,r=0):(i=+n.replace(/\D/g,""),r=+t.replace(/\D/g,""),n.indexOf("max-")>-1&&(i*=-1),t.indexOf("max-")>-1&&(r*=-1)),i===r?0:i<r?-1:1}(function(){var i=document,v,r,u={root:""},c,y=i.styleSheets,w=/\{.+?\}$/,f,a,s,e,n,p;if(y.length){for(e=0;e<y.length;++e)if(c=y[e].cssRules,c&&c.length)for(a=0;a<c.length;++a)if(f=c[a].cssText,f.indexOf("@media")===0)for(n=f.replace(/^(@media .+\))[\s\S]+/,"$1"),u[n]||(u[n]=""),r=f.split("\n"),r=r.slice(1,r.length-1),s=0;s<r.length;++s)r[s].indexOf("{ }")<0&&(r[s].indexOf("@")>-1||i.querySelector(r[s].replace(w,"")))&&(u[n]+=r[s]+"\n");else f.indexOf("{ }")<0&&(f.indexOf("@")===0||i.querySelector(f.replace(w,"")))&&(u.root+=f+"\n");v=Object.keys(u).sort(mq);var l=i.createElement("DIV"),o=l.style,h=i.createElement("TEXTAREA"),t=h.style;for(o.position="fixed",o.top="0",o.left="0",o.width="100%",o.height="100%",o.background="#000",o.opacity="0.8",o.zIndex="9999",t.position="fixed",t.top="0",t.bottom="0",t.left="0",t.right="0",t.width="90%",t.height="90%",t.margin="auto",t.whiteSpace="nowrap",t.zIndex="9999",l.appendChild(h),l.onclick=function(){delete i.body.removeChild(h);delete i.body.removeChild(l)},h.onfocus=function(){this.select()},e=0;e<v.length;++e)n=v[e],u[n]?(p=n==="root",h.value+=(p?"":n+" {\n")+u[n]+(p?"":"}\n")):delete u[n];i.body.appendChild(l);i.body.appendChild(h)}})();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement