Making WordPress.org

Changeset 12684


Ignore:
Timestamp:
07/03/2023 04:47:25 AM (3 years ago)
Author:
dd32
Message:

Main: Stats: Merge https://github.com/WordPress/wporg-main-2022/commit/fe2398b9b32044c08d704768d93a6cb78d291723

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/js/page-stats.js

    r12669 r12684  
    120120                if ( 'versions' === sort ) {
    121121                        tableData.sort( function ( a, b ) {
    122                                 return a[0] - b[0];
     122                                /*
     123                                 * Converts a string such as 'Example 1.1' to '1.01', or 'Example 10.10' to '10.10'.
     124                                 *
     125                                 * This allows for MariaDB 10.10 to appear beside 10.9.
     126                                 */
     127                                var a_version = a[0].replace( /[^0-9.]/g, '' ).replace( /\.(\d{1})$/g, '.0$1' ),
     128                                        b_version = b[0].replace( /[^0-9.]/g, '' ).replace( /\.(\d{1})$/g, '.0$1' );
     129
     130                                return b_version - a_version;
    123131                        } );
    124                         tableData.reverse();
    125132                } else if ( 'alphabeticaly' === sort ) {
    126133                        tableData.sort();
     
    225232                                        color: '#444'
    226233                                },
    227                                 showColorCode: true
     234                                showColorCode: true,
     235                                trigger: 'selection'
    228236                        }
    229237                };
     
    238246                chart.setOptions( chartOptions );
    239247                chart.draw();
     248
     249                google.visualization.events.addListener(
     250                        chart.getChart(),
     251                        'onmouseover',
     252                        ( entry ) => chart.getChart().setSelection( [ { row: entry.row } ] )
     253                );
     254
     255                google.visualization.events.addListener(
     256                        chart.getChart(),
     257                        'onmouseout',
     258                        ( entry ) => chart.getChart().setSelection( [] )
     259                );
    240260        }
    241261} )( window.jQuery, window.google, window.wporgPageStats );
Note: See TracChangeset for help on using the changeset viewer.