WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/23/2015 02:22:51 AM (5 years ago)
Author:
dd32
Message:

Translate: Fix the Filter Javascript when paging is involved.
Fixes #1408

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-projects.php

    r2072 r2115  
    9898<script>
    9999    jQuery('#sort-filter').change( function() {
    100         var current_url = document.location.href.replace(/[?&]filter=[^&$]*/, '' );
    101         document.location.replace(
    102             current_url +
    103             ( -1 == current_url.indexOf('?') ? '?filter=' : '&filter=' ) +
    104             this.options[ this.options.selectedIndex ].value
    105         );
     100        var current_url = document.location.href;
     101        var filter = this.options[ this.options.selectedIndex ].value;
     102
     103        if ( current_url.indexOf( 'filter=' ) > -1 ) {
     104            document.location.replace(
     105                current_url.replace(/([?&]filter=)([^&$]*)/, '$1' + filter )
     106            );
     107        } else {
     108            document.location.replace(
     109                current_url +
     110                ( -1 == current_url.indexOf('?') ? '?filter=' : '&filter=' ) +
     111                filter
     112            );
     113        }
    106114    } ).prop('disabled', '');
    107115</script>
Note: See TracChangeset for help on using the changeset viewer.