Merge "Add redirect=no only to redirects on redirect pages"
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.search.js
index 23602b3..ab83e1a 100644 (file)
                        $( '<label>' )
                                .text( mw.msg( 'powersearch-togglelabel' ) )
                ).append(
-                       $( '<input type="button" />' )
+                       $( '<input>' ).attr( 'type', 'button' )
                                .attr( 'id', 'mw-search-toggleall' )
                                .prop( 'value', mw.msg( 'powersearch-toggleall' ) )
                                .click( function () {
                                        $checkboxes.prop( 'checked', true );
                                } )
                ).append(
-                       $( '<input type="button" />' )
+                       $( '<input>' ).attr( 'type', 'button' )
                                .attr( 'id', 'mw-search-togglenone' )
                                .prop( 'value', mw.msg( 'powersearch-togglenone' ) )
                                .click( function () {
 
                // Change the header search links to what user entered
                $headerLinks = $( '.search-types a' );
-               OO.ui.infuse( 'searchText' ).on( 'change', function ( searchterm ) {
+               $( '#searchText, #powerSearchText' ).change( function () {
+                       var searchterm = $( this ).val();
                        $headerLinks.each( function () {
                                var parts = $( this ).attr( 'href' ).split( 'search=' ),
                                        lastpart = '',
                                        prefix = 'search=';
-                               if ( parts.length > 1 && parts[1].indexOf( '&' ) !== -1 ) {
-                                       lastpart = parts[1].slice( parts[1].indexOf( '&' ) );
+                               if ( parts.length > 1 && parts[ 1 ].indexOf( '&' ) !== -1 ) {
+                                       lastpart = parts[ 1 ].slice( parts[ 1 ].indexOf( '&' ) );
                                } else {
                                        prefix = '&search=';
                                }
-                               this.href = parts[0] + prefix + encodeURIComponent( searchterm ) + lastpart;
+                               this.href = parts[ 0 ] + prefix + encodeURIComponent( searchterm ) + lastpart;
                        } );
-               } );
+               } ).trigger( 'change' );
 
                // When saving settings, use the proper request method (POST instead of GET).
                $( '#mw-search-powersearch-remember' ).change( function () {