admin_devel.js
982 Bytes
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
(function($) {
/**
* jQuery debugging helper.
*
* Invented for Dreditor.
*
* @usage
* $.debug(var [, name]);
* $variable.debug( [name] );
*/
jQuery.extend({
debug: function () {
// Setup debug storage in global window. We want to look into it.
window.debug = window.debug || [];
args = jQuery.makeArray(arguments);
// Determine data source; this is an object for $variable.debug().
// Also determine the identifier to store data with.
if (typeof this == 'object') {
var name = (args.length ? args[0] : window.debug.length);
var data = this;
}
else {
var name = (args.length > 1 ? args.pop() : window.debug.length);
var data = args[0];
}
// Store data.
window.debug[name] = data;
// Dump data into Firebug console.
if (typeof console != 'undefined') {
console.log(name, data);
}
return this;
}
});
// @todo Is this the right way?
jQuery.fn.debug = jQuery.debug;
})(jQuery);