Stack Snippet Console
by Michael Barros
HTML
<a href="https://stackoverflow.com/q/39130610/1366033"><h3>How to get console inside jsfiddle</h3></a>
JavaScript
// MIT License, see: https://github.com/gh-canon/stack-snippet-console/blob/master/LICENSE
(function() {
function getCss() {
return `.as-console-wrapper {
position: fixed;
bottom: 0;
left: 0;
right: 0;
max-height: 150px;
overflow-y: scroll;
overflow-x: hidden;
border-top: 1px solid #000;
display: none;
color: #f0f0f0
}
.as-console {
background: #1e1e1e;
border: 1px solid #333;
display: table;
width: 100%;
border-collapse: collapse;
}
.as-console-row {
display: table-row;
font-family: monospace;
font-size: 13px;
}
.as-console-row:before {
display: table-cell;
padding: 3px 6px;
color: rgba(240, 240, 240, 0.35);
border: 1px solid #333;
content: attr(data-date);
vertical-align: top;
}
.as-console-row + .as-console-row > * {
border: 1px solid #333;
}
.as-console-row-code {
width: 100%;
white-space: pre-wrap;
padding: 3px 5px;
display: table-cell;
font-family: monospace;
font-size: 13px;
vertical-align: middle;
}
.as-console-error:before {
content: 'Error: ';
color: #dc5b5b;
}
.as-console-assert:before {
content: 'Assertion failed: ';
color: #dc5b5b;
}
.as-console-info:before {
content: 'Info: ';
color: #5b5bdc;
}
.as-console-debug:before {
content: 'Debug: ';
color: #5b5bdc;
}
.as-console-warning:before {
content: 'Warning: ';
color: #dcaf5b;
}
@-webkit-keyframes flash {
0% {
background: rgba(68, 68, 68, 0.25);
}
100% {
background: none;
}
}
@-moz-keyframes flash {
0% {
background: rgba(68, 68, 68, 0.25);
}
100% {
background: none;
}
}
@-ms-keyframes flash {
0% {
background: rgba(68, 68, 68, 0.25);
}
100% {
background: none;
}
}
@keyframes flash {
0% {
background: rgba(68, 68, 68, 0.25);
}
100% {
background: none;
...