-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconsole.style.min.js
1 lines (1 loc) · 1.25 KB
/
console.style.min.js
1
(function(b,a){'function'===typeof define&&define.amd?define([],a):a()})(this,function(){!function(e){if(e&&e.log){var c,n,t="Black Blue Cyan Gray Green Magenta Red White Yellow".split(" "),i=/<(css|b|i)(?:=['"](.*?)['"])?>(.*?)<\/(?:css|b|i)>/gi,s=/([a-z\-]+)\s?:\s?([^;'"]+);?/gi,a=/%[sdifoO]/g,r=/<img=['"](.*?)['"]>/gi,o="background",l="px",u=function(e){var c=[e];return"string"==typeof e&&(e=e.replace(r,function(e,c){var t,i,a,r,u=["font-size:1px"];return c.replace(s,function(e,c,n){switch(c){case o:case o+"-image":u.push(c+":"+n,o+"-repeat:no-repeat");break;case"width":t=n;break;case"height":i=n,u.push("line-height:"+n)}}),r=Math.ceil(parseInt(t)/2),a=Math.ceil(parseInt(i)/2),u.push(o+"-size:"+t+" "+i),u.push("padding:"+a+l+" "+r+l),n("",u.join(";"))}),c[0]=e.replace(i,function(e,n,t,i){switch(t=t||"",i=i.replace(a,""),n){case"b":t+=";font-weight:bold";break;case"i":t+=";font-style:italic"}return c.push(t,""),"%c"+i+"%c"})),c};e.colors={},t.forEach(function(c){e.colors[c.toLowerCase()]=function(e){return n(e,"color:"+c)},e.colors["bg"+c]=function(e){return n(e,o+"-color:"+c)}}),e.style=c=function(){var c=[].slice.call(arguments);e.log.apply(e,u(c.shift()).concat(c))},e.style.wrap=n=function(e,c){return'<css="'+c+'">'+e+"</css>"}}}(window.console);});