admin_devel.js 982 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (function($) {
  2. /**
  3. * jQuery debugging helper.
  4. *
  5. * Invented for Dreditor.
  6. *
  7. * @usage
  8. * $.debug(var [, name]);
  9. * $variable.debug( [name] );
  10. */
  11. jQuery.extend({
  12. debug: function () {
  13. // Setup debug storage in global window. We want to look into it.
  14. window.debug = window.debug || [];
  15. args = jQuery.makeArray(arguments);
  16. // Determine data source; this is an object for $variable.debug().
  17. // Also determine the identifier to store data with.
  18. if (typeof this == 'object') {
  19. var name = (args.length ? args[0] : window.debug.length);
  20. var data = this;
  21. }
  22. else {
  23. var name = (args.length > 1 ? args.pop() : window.debug.length);
  24. var data = args[0];
  25. }
  26. // Store data.
  27. window.debug[name] = data;
  28. // Dump data into Firebug console.
  29. if (typeof console != 'undefined') {
  30. console.log(name, data);
  31. }
  32. return this;
  33. }
  34. });
  35. // @todo Is this the right way?
  36. jQuery.fn.debug = jQuery.debug;
  37. })(jQuery);