-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.toad.js
57 lines (48 loc) · 1.36 KB
/
console.toad.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* One copy of console.frog.
* Console.toad. A better way to log!
*/
(function dothething(global) {
if( !global.console ) {
return;
}
global.console.toad = function() {
var i,
css = "color: #333";
var inBrowser = (typeof window !== 'undefined');
var toad;
if( inBrowser ) {
toad = ['%c%c',
"%c/_____ _____\\%c",
"%c| \\\\ |__| \\\\ |%c",
"%c|_____/ \\_____|%c",
"%c /^ ^ \\ %c",
"%c ( ____; ) %c",
'%c%c'];
} else {
toad = ['',
"/_____ _____\\",
"| \\\\ |__| \\\\ |",
"|_____/ \\_____|",
" /^ ^ \\ ",
" ( ____; ) ",
''];
}
var args = Array.prototype.slice.call(arguments);
var stringOfArgs = args.join(' ');
if( stringOfArgs.length > 0 ) {
toad[1] = toad[1] + " ---" + ("-".repeat(stringOfArgs.length)) + "-";
toad[2] = toad[2] + "-( " + stringOfArgs + " )";
toad[3] = toad[3] + " ---" + ("-".repeat(stringOfArgs.length)) + "-";
}
if( inBrowser ) {
for( i = 0; i < toad.length; i++ ) {
console.log(toad[i], css, "");
}
} else {
for( i = 0; i < toad.length; i++ ) {
console.log(toad[i]);
}
}
}
})(this);