Making WordPress.org

Changeset 12098


Ignore:
Timestamp:
09/29/2022 09:20:16 PM (20 months ago)
Author:
coffee2code
Message:

Plugin Directory: Remove JS for active install growth chart due to insufficient data obfuscation.

See #3016, [12097].
Reverts [6245].

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
Files:
2 edited

Legend:

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

    r11655 r12098  
    100100    if ( get_query_var( 'plugin_advanced' ) ) {
    101101        wp_enqueue_script( 'google-charts-loader', 'https://www.gstatic.com/charts/loader.js', array(), false, true );
    102         wp_enqueue_script( 'wporg-plugins-stats', get_stylesheet_directory_uri() . '/js/stats.js', array( 'jquery', 'google-charts-loader' ), '20210329b', true );
     102        wp_enqueue_script( 'wporg-plugins-stats', get_stylesheet_directory_uri() . '/js/stats.js', array( 'jquery', 'google-charts-loader' ), '20220929', true );
    103103
    104104        wp_localize_script( 'wporg-plugins-stats', 'pluginStats', array(
     
    107107                'date'      => __( 'Date', 'wporg-plugins' ),
    108108                'downloads' => __( 'Downloads', 'wporg-plugins' ),
    109                 'growth'    => __( 'Growth', 'wporg-plugins' ),
    110109                'noData'    => __( 'No data yet', 'wporg-plugins' ),
    111110                'today'     => __( 'Today', 'wporg-plugins' ),
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/stats.js

    r10855 r12098  
    4343                        viewWindowMode: 'explicit',
    4444                        viewWindow: { min: 0 }
    45                     },
    46                     bar: { groupWidth: ( data.getNumberOfRows() > 100 ? '100%' : null ) },
    47                     height: 350,
    48                     curveType: 'function',
    49                     trendlines: {
    50                         0: {
    51                           type: 'linear',
    52                           color: '#ffc733',
    53                           lineWidth: 1,
    54                           opacity: 0.4,
    55                           showR2: false,
    56                           visibleInLegend: false,
    57                           tooltip: false,
    58                         }
    59                       }
    60                 } );
    61             } );
    62         } );
    63 
    64         $.getJSON('https://api.wordpress.org/stats/plugin/1.0/active-installs.php?slug=' + settings.slug + '&limit=267&callback=?', function( downloads ) {
    65             google.charts.setOnLoadCallback( function() {
    66                 var data = new google.visualization.DataTable(),
    67                     count = 0,
    68                     sml;
    69 
    70                 data.addColumn( 'date', settings.l10n.date );
    71                 data.addColumn( 'number', settings.l10n.growth );
    72 
    73                 $.each( downloads, function( key, value ) {
    74                     data.addRow();
    75                     data.setValue( count, 0, new Date( key ) );
    76                     data.setValue( count, 1, Number( value ) );
    77                     count++;
    78                 } );
    79 
    80                 var formatter = new google.visualization.NumberFormat({pattern: '#,###.##\'%\''});
    81                 formatter.format(data, 1); // format column 1
    82 
    83                 sml = data.getNumberOfRows() < 36;
    84 
    85                 new google.visualization.LineChart( document.getElementById( 'plugin-growth-stats' ) ).draw( data, {
    86                     colors: ['#253578'],
    87                     legend: { position: 'none' },
    88                     titlePosition: 'in',
    89                     axisTitlesPosition: 'in',
    90                     chartArea: {
    91                         height: 280,
    92                         left: ( sml ? 50 : 0 ),
    93                         width: ( sml ? 482 : '100%' )
    94                     },
    95                     hAxis: {
    96                         textStyle: { color: 'black', fontSize: 9 },
    97                         format: 'MMM y'
    98                     },
    99                     vAxis: {
    100                         format: '#.##\'%\'',
    101                         textPosition: ( sml ? 'out' : 'in' ),
    102                         viewWindowMode: 'pretty',
    10345                    },
    10446                    bar: { groupWidth: ( data.getNumberOfRows() > 100 ? '100%' : null ) },
Note: See TracChangeset for help on using the changeset viewer.