stats_dashboard_head

JavaScript and CSS for dashboard widget.

Description

stats_dashboard_head(); 

Usage

  1. if ( !function_exists( 'stats_dashboard_head' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/stats.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = stats_dashboard_head(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/modules/stats.php  
  1. function stats_dashboard_head() { ?> 
  2. <script type="text/javascript"> 
  3. /* <![CDATA[ */ 
  4. jQuery(window).load( function() { 
  5. jQuery( function($) { 
  6. resizeChart(); 
  7. jQuery(window).resize( _.debounce( function() { 
  8. resizeChart(); 
  9. }, 100) ); 
  10. } ); 
  11.  
  12. function resizeChart() { 
  13. var dashStats = jQuery( '#dashboard_stats div.inside' ); 
  14.  
  15. if ( dashStats.find( '.dashboard-widget-control-form' ).length ) { 
  16. return; 
  17.  
  18. if ( ! dashStats.length ) { 
  19. dashStats = jQuery( '#dashboard_stats div.dashboard-widget-content' ); 
  20. var h = parseInt( dashStats.parent().height() ) - parseInt( dashStats.prev().height() ); 
  21. var args = 'width=' + dashStats.width() + '&height=' + h.toString(); 
  22. } else { 
  23. if ( jQuery('#dashboard_stats' ).hasClass('postbox') ) { 
  24. var args = 'width=' + ( dashStats.prev().width() * 2 ).toString(); 
  25. } else { 
  26. var args = 'width=' + ( dashStats.width() * 2 ).toString(); 
  27.  
  28. dashStats.not( '.dashboard-widget-control' ).load( 'admin.php?page=stats&noheader&dashboard&' + args ); 
  29. } ); 
  30. /* ]]> */ 
  31. </script> 
  32. <style type="text/css"> 
  33. /* <![CDATA[ */ 
  34. #stat-chart { 
  35. background: none !important; 
  36. #dashboard_stats .inside { 
  37. margin: 10px 0 0 0 !important; 
  38. #dashboard_stats #stats-graph { 
  39. margin: 0; 
  40. #stats-info { 
  41. border-top: 1px solid #dfdfdf; 
  42. margin: 7px -10px 0 -10px; 
  43. padding: 10px; 
  44. background: #fcfcfc; 
  45. -moz-box-shadow:inset 0 1px 0 #fff; 
  46. -webkit-box-shadow:inset 0 1px 0 #fff; 
  47. box-shadow:inset 0 1px 0 #fff; 
  48. overflow: hidden; 
  49. border-radius: 0 0 2px 2px; 
  50. -webkit-border-radius: 0 0 2px 2px; 
  51. -moz-border-radius: 0 0 2px 2px; 
  52. -khtml-border-radius: 0 0 2px 2px; 
  53. #stats-info #top-posts, #stats-info #top-search { 
  54. float: left; 
  55. width: 50%; 
  56. #top-posts .stats-section-inner p { 
  57. white-space: nowrap; 
  58. overflow: hidden; 
  59. #top-posts .stats-section-inner p a { 
  60. overflow: hidden; 
  61. text-overflow: ellipsis; 
  62. #stats-info div#active { 
  63. border-top: 1px solid #dfdfdf; 
  64. margin: 0 -10px; 
  65. padding: 10px 10px 0 10px; 
  66. -moz-box-shadow:inset 0 1px 0 #fff; 
  67. -webkit-box-shadow:inset 0 1px 0 #fff; 
  68. box-shadow:inset 0 1px 0 #fff; 
  69. overflow: hidden; 
  70. #top-search p { 
  71. color: #999; 
  72. #stats-info h4 { 
  73. font-size: 1em; 
  74. margin: 0 0 .5em 0 !important; 
  75. #stats-info p { 
  76. margin: 0 0 .25em; 
  77. color: #999; 
  78. #stats-info p.widget-loading { 
  79. margin: 1em 0 0; 
  80. color: #333; 
  81. #stats-info p a { 
  82. display: block; 
  83. #stats-info p a.button { 
  84. display: inline; 
  85. /* ]]> */ 
  86. </style> 
  87. <?php