/data/layouts/default/Content/js/profiling/config.js

http://github.com/jacksonh/manos · JavaScript · 59 lines · 27 code · 19 blank · 13 comment · 3 complexity · 5a846c86e1a35fd1e748bc3fbb390903 MD5 · raw file

  1. // call PROFILE.show() to show the profileViewer
  2. var PROFILE = {
  3. init : function(bool) {
  4. // define what objects, constructors and functions you want to profile
  5. // documentation here: http://developer.yahoo.com/yui/profiler/
  6. YAHOO.tool.Profiler.registerObject("jQuery", jQuery, true);
  7. // the following would profile all methods within constructor's prototype
  8. // YAHOO.tool.Profiler.registerConstructor("Person");
  9. // the following would profile the global function sayHi
  10. // YAHOO.tool.Profiler.registerFunction("sayHi", window);
  11. // if true is passed into init(), F9 will bring up the profiler
  12. if (bool){
  13. $(document).keyup(function(e){
  14. if (e.keyCode === 120){
  15. PROFILE.show();
  16. $(document).unbind('keyup',arguments.callee);
  17. }
  18. })
  19. }
  20. },
  21. //When the showProfile button is clicked, use YUI Loader to get all required
  22. //dependencies and then show the profile:
  23. show : function() {
  24. var s = document.createElement('link');
  25. s.setAttribute('rel','stylesheet');
  26. s.setAttribute('type','text/css');
  27. s.setAttribute('href','js/profiling/yahoo-profiling.css');
  28. document.body.appendChild(s);
  29. YAHOO.util.Dom.addClass(document.body, 'yui-skin-sam');
  30. //instantiate ProfilerViewer with desired options:
  31. var pv = new YAHOO.widget.ProfilerViewer("", {
  32. visible: true, //expand the viewer mmediately after instantiation
  33. showChart: true,
  34. // base:"../../build/",
  35. swfUrl: "js/profiling/charts.swf"
  36. });
  37. }
  38. };
  39. // check some global debug variable to see if we should be profiling..
  40. if (true) { PROFILE.init(true) }