Skip to content

Commit

Permalink
Added jQuery.Console
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzaadi committed Oct 20, 2009
1 parent 5c05711 commit 69994bc
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
jQueryPlugins/
_site/
boks/
.project
.tmp_*
.DS_Store
10 changes: 10 additions & 0 deletions jQuery.Console/README
@@ -0,0 +1,10 @@

jQuery Console Plugin

Copyright (c) 2009 Erik Zaadi

Home Page : http://erikzaadi.github.com/jQueryPlugins/jQuery.Console

Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
83 changes: 83 additions & 0 deletions jQuery.Console/jQuery.Console.js
@@ -0,0 +1,83 @@
/*
* jQuery Console Plugin
*
* Copyright (c) 2009 Erik Zaadi
*
* Home Page : http://erikzaadi.github.com/jQueryPlugins/jQuery.Console
* jQuery Plugin home page : http://plugins.jquery.com/project/Console
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;
(function($){

//http://getfirebug.com/console.html
var functions = {
Log: 'log',
Trace: 'trace',
Debug: 'debug',
Info: 'info',
Warn: 'warn',
Error: 'error',
Dir: 'dir',
DirXML: 'dirxml',
Group: 'group',
GroupCollapsed: 'groupCollapsed',
GroupEnd: 'groupEnd',
Time: 'time',
TimeEnd: 'timeEnd',
Profile: 'profile',
ProfileEnd: 'profileEnd',
Count: 'count'
};

$.Console = {};

_initExports();

$.Console.functions = functions;

$.fn.Console = function(functionName){
//log is default
var funcToCall = functionName || functions.Log;
return this.each(function(){
_consoleCaller(funcToCall, this);
});
};

function _initExports(){
for (var fn in functions) {
$.Console[fn] = function(){
_consoleCaller(arguments.callee.fn, arguments);
};
$.Console[fn].fn = functions[fn];
}
};

function _consoleCaller(func, params){
//if it's the argument object
if (params.callee) {
for (var x = 0; x < params.length; x++) {
_consoleCaller(func, params[x]);
}
return false;
}
if (typeof(window['console']) != 'undefined') {
if (console[func]) {
console[func](params);
}
else {
if (console.log)
console.log(params);
}
}
else {
if (window.opera) {
opera.postError(params);
}
}
return false;
}
})(jQuery);
1 change: 1 addition & 0 deletions jQuery.Console/jQuery.Console.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 69994bc

Please sign in to comment.