JSFiddle - React, Tailwind, and code Playground
by lomatek
JavaScript
(function() {
var formats, getOrderedMatches, hasMatches, isFirefox, isIE, isSafari, log, makeArray, safariSupport, stringToArgs, _log;
if (!(window.console && window.console.log)) {
return;
}
isFirefox = /Firefox/.test(navigator.userAgent);
var log = function() {
var args, caller, file, html, right, span, stack, style;
args = [];
makeArray(arguments).forEach(function(arg) {
if (typeof arg === 'string') {
return args = args.concat(stringToArgs(arg));
} else {
return args.push(arg);
}
});
stack = new Error().stack.split('\n');
if (isFirefox) {
caller = arguments.callee.caller;
file = stack[1].replace(/^.*\//, '');
file = ' @ ' + file.split(':').join(' (line ') + ')';
style = 'position:absolute;right:9px;z-index:1;min-width:150px;background-color:white;margin-top:6px;text-align:right;color:blue;font-family:Lucida Grande,sans-serif;font-weight:bold';
span = document.createElement('span');
span.innerHTML = file;
span.setAttribute('style', style + ';top:-100px;right:100px;width:auto;min-width:auto;font-size:11px;');
html = document.getElementsByTagName('html')[0];
html.appendChild(span);
right = 13 + span.clientWidth;
html.removeChild(span);
console.log('%c%c' + file + '%c%o', 'width:105%;height:1px;margin-left:-10px;margin-top:-3px;display:block;position:absolute:z-index:1;background-color:white', style, style + ';right:' + right + 'px;width:auto', caller || 'global');
return console.log.apply(console, args);
} else {
console.groupCollapsed.apply(console, args);
console.log(stack[2]);
return console.groupEnd();
}
};
_log = console.log.bind(console);
makeArray = function(arrayLikeThing) {
return Array.prototype.slice.call(arrayLikeThing);
};
formats = [
{
regex: /\*([^\*)]+)\*/,
replacer: function(m, p1) {
return "%c" + p1 + "%c";
},
styles:...