Last active
August 29, 2015 13:57
-
-
Save toddmotto/9829578 to your computer and use it in GitHub Desktop.
console.loge(), many log, much console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.console.loge = function (msg) { | |
var gifs = ['wink','shake-space','peepers','prizza','hat','gradient','fat','rainbow','sunglasses','derp','shake'], | |
wow = ['', 'wow! ', 'amaze! ', 'dazzle! '], | |
adjs = ['so', 'such', 'many', 'much', 'very'], | |
randomizr = function (a) { return a[Math.floor(Math.random() * a.length)];}, | |
message = '%c ' + randomizr(wow) + randomizr(adjs) + ' ' + typeof msg + ': ', | |
css = 'background: url(http://d1e3ezyatlol8u.cloudfront.net/img/212/doge-' + randomizr(gifs) + '-212.gif) no-repeat 0 0; background-size: 80px 80px; font-family: \'Comic Sans MS\', cursive; text-shadow: 0 1px 1px rgba(0,0,0,1); font-size: 14px; padding: 25px; line-height: 70px; color: #fff; font-weight: 100;'; | |
console.log.apply(console, typeof msg === 'object' ? [message, css, msg] : [message += msg, css]); | |
}; |
(function () {
'use strict';
var wow = ['', 'wow\n'];
var adjs = 'so such many much very'.split(' ');
var randomizr = function (a) {
return a[Math.floor(Math.random() * a.length)];
};
if (window.console && !console.loge) {
console.loge = function () {
console.log.apply(console, [].concat.apply([randomizr(wow) + randomizr(adjs)], arguments));
};
}
})();
much arguments wow so apply
+1 to @chee
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Randomise message from https://gist.github.com/aalaap/f4fa7baa4934882e471d Gifs implementation from: http://zachinglis.com/posts/console-loge