prod-monitor.performance.js 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. (function ($) {
  2. // Trigger loading of the Google graphs.
  3. Drupal.behaviors.prod_monitor_init = {
  4. attach: function(context, settings) {
  5. var script = document.createElement('script');
  6. script.src = document.location.protocol + '//www.google.com/jsapi?callback=Drupal.behaviors.prod_monitor_performance.initGoogleDependencies';
  7. script.type = 'text/javascript';
  8. $('head').append(script);
  9. }
  10. }
  11. // All functions used to setup and render the graphs.
  12. Drupal.behaviors.prod_monitor_performance = {
  13. initGoogleDependencies: function() {
  14. google.load('visualization', '1', {
  15. 'callback':Drupal.behaviors.prod_monitor_performance.initGraphs,
  16. 'packages':['annotatedtimeline']
  17. })
  18. },
  19. initGraphs: function() {
  20. $('.performance-data').each(function() {
  21. var callback = $(this).attr('id').replace('-', '_');
  22. //console.log(Drupal.behaviors.prod_monitor_performance[callback]);
  23. Drupal.behaviors.prod_monitor_performance[callback]();
  24. });
  25. }
  26. }
  27. })(jQuery);