From 69994bc8d304c4986461c418d5aea9f41d4e7d8c Mon Sep 17 00:00:00 2001 From: erikzaadi Date: Tue, 20 Oct 2009 16:15:36 +0200 Subject: [PATCH] Added jQuery.Console --- .gitignore | 6 ++ jQuery.Console/README | 10 ++++ jQuery.Console/jQuery.Console.js | 83 ++++++++++++++++++++++++++++ jQuery.Console/jQuery.Console.min.js | 1 + 4 files changed, 100 insertions(+) create mode 100644 .gitignore create mode 100644 jQuery.Console/README create mode 100644 jQuery.Console/jQuery.Console.js create mode 100644 jQuery.Console/jQuery.Console.min.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07513fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +jQueryPlugins/ +_site/ +boks/ +.project +.tmp_* +.DS_Store \ No newline at end of file diff --git a/jQuery.Console/README b/jQuery.Console/README new file mode 100644 index 0000000..6aeaf76 --- /dev/null +++ b/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 diff --git a/jQuery.Console/jQuery.Console.js b/jQuery.Console/jQuery.Console.js new file mode 100644 index 0000000..561757f --- /dev/null +++ b/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); diff --git a/jQuery.Console/jQuery.Console.min.js b/jQuery.Console/jQuery.Console.min.js new file mode 100644 index 0000000..77c7faa --- /dev/null +++ b/jQuery.Console/jQuery.Console.min.js @@ -0,0 +1 @@ +/* * 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($){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){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(params.callee){for(var x=0;x