Making WordPress.org

Changeset 1439


Ignore:
Timestamp:
03/20/2015 04:01:40 PM (11 years ago)
Author:
obenland
Message:

WP.org Themes: Remove download graph from server output.

If there is no JS, there won't be a graph anyway.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/content-single.php

    r1417 r1439  
    6565
    6666                <div id="theme-download-stats-<?php echo esc_attr( $slug ); ?>" class="chart"></div>
    67                 <script type="text/javascript">
    68                     google.load("visualization", "1", {packages:["corechart"]});
    69                     google.setOnLoadCallback(drawThemeDownloadsChart);
    70 
    71                     function drawThemeDownloadsChart() {
    72                         jQuery(document).ready(function($){
    73                             $.getJSON('https://api.wordpress.org/stats/themes/1.0/downloads.php?slug=<?php echo $slug; ?>&limit=260&callback=?', function (downloads) {
    74                                 var data = new google.visualization.DataTable(),
    75                                     count = 0;
    76 
    77                                 data.addColumn('string', _wpThemeSettings.l10n.date);
    78                                 data.addColumn('number', _wpThemeSettings.l10n.downloads);
    79 
    80                                 $.each(downloads, function (key, value) {
    81                                     data.addRow();
    82                                     data.setValue(count, 0, new Date(key).toLocaleDateString() );
    83                                     data.setValue(count, 1, Number(value));
    84                                     count++;
    85                                 });
    86 
    87                                 new google.visualization.ColumnChart(document.getElementById('theme-download-stats-<?php echo esc_attr( $slug ); ?>')).draw(data, {
    88                                     colors: ['#253578'],
    89                                     legend: {
    90                                         position: 'none'
    91                                     },
    92                                     titlePosition: 'in',
    93                                     axisTitlesPosition: 'in',
    94                                     chartArea: {
    95                                         height: 280,
    96                                         left: 35,
    97                                         width: '98%'
    98                                     },
    99                                     hAxis: {
    100                                         textStyle: {color: 'black', fontSize: 9}
    101                                     },
    102                                     vAxis: {
    103                                         format: '###,###',
    104                                         textPosition: 'out',
    105                                         viewWindowMode: 'explicit',
    106                                         viewWindow: {min: 0}
    107                                     },
    108                                     bar: {
    109                                         groupWidth: ( data.getNumberOfRows() > 100 ) ? "100%" : null
    110                                     },
    111                                     height: 350
    112                                 });
    113                             });
    114                         });
    115                     }
    116                 </script>
    11767                <p class="total-downloads"><?php printf( __( 'Total downloads: %s' ), '<strong>' . number_format_i18n( $theme->downloaded ) . '</strong>' ); ?></p>
    11868            </div><!-- .theme-downloads -->
Note: See TracChangeset for help on using the changeset viewer.