Sha256: f30a000f9fe68146655bd4c547a0f86aa2608b4eb56bf80c31350602d464138c

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

(function(){var t=[].slice;this.DeLogger=function(){function n(t){var n,e;null==t&&(t={}),n=t.disabled||!1,e=null==t.formatStrings||t.formatStrings,this.settings={disabled:n,formatStrings:e}}var e,r,o;return n.prototype.log=function(){return this.print.apply(this,["log"].concat(t.call(arguments)))},n.prototype.info=function(){return this.print.apply(this,["info"].concat(t.call(arguments)))},n.prototype.debug=function(){return this.print.apply(this,["debug"].concat(t.call(arguments)))},n.prototype.warn=function(){return this.print.apply(this,["warn"].concat(t.call(arguments)))},n.prototype.error=function(){return this.print.apply(this,["error"].concat(t.call(arguments)))},n.prototype.enable=function(){return localStorage.setItem("deloggerEnabled",!0)},n.prototype.disable=function(){return localStorage.removeItem("deloggerEnabled")},n.prototype.print=function(){var n,e,o,l,i,a,c,p,s,u,g;if(a=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],this.canPrint()){for(g="",u=[],o=0,l=0,i=e.length;l<i&&(n=e[l],"string"==typeof n&&this.settings.formatStrings);l++)c=r(n),p=c[0],s=c[1],g+=p,u.push.apply(u,s),o+=1;return e.splice(0,o),console[a].apply(console,[g].concat(t.call(u),t.call(e)))}},n.prototype.canPrint=function(){return!this.settings.disabled&&null!=localStorage.deloggerEnabled},r=function(t){var n,r,o;for(n=[],o=/\(([^\(\)]+)\)(\.[\.\w]+)/;r=t.match(o);)n.push(e(r[2].split(".").join(" "))),n.push(e("default")),t=t.replace(o,"%c"+r[1]+"%c");return[t,n]},e=function(t){var n,e,r,l;return e=document.createElement("div"),e.id="delogger",e.className=t,e.style="display: none;",document.getElementsByTagName("body")[0].appendChild(e),n=getComputedStyle(e),l=function(){var t,e,l;for(l=[],t=0,e=o.length;t<e;t++)r=o[t],l.push(r+":"+n.getPropertyValue(r));return l}().join(";"),e.parentNode.removeChild(e),l},o=["margin-right","color","background-color","border-radius","padding","font-weight","font-style"],n}()}).call(this);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
delogger-0.3.0.alpha2 vendor/assets/javascripts/delogger.js