Robmoen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177136

Change subject: Improve search interaction experience for low end devices
......................................................................

Improve search interaction experience for low end devices

On special:search
* Open search if no search params ( current search )
* Always hide .mw-search-formheader ( advanced search )
* Hide search form if current search
** Questionable if this is a benefit

Change-Id: I54463f41f5237899f3ad0f60a7a2845cae96c417
---
M javascripts/modules/search/init.js
1 file changed, 30 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/36/177136/1

diff --git a/javascripts/modules/search/init.js 
b/javascripts/modules/search/init.js
index 9b7065e..bf76fc8 100644
--- a/javascripts/modules/search/init.js
+++ b/javascripts/modules/search/init.js
@@ -1,7 +1,17 @@
 ( function ( M, $ ) {
 
        var SearchOverlay = M.require( 'modules/search/SearchOverlay' ),
-               schema = M.require( 'loggingSchemas/MobileWebClickTracking' );
+               schema = M.require( 'loggingSchemas/MobileWebClickTracking' ),
+               $searchInput = $( '#searchInput' ),
+               currentSearch;
+
+       function openSearchOverlay( term ) {
+               schema.log( 'search' );
+               new SearchOverlay( {
+                       searchTerm: term
+               } ).show();
+               M.router.navigate( '/search' );
+       }
 
        //
        // don't use focus event 
(https://bugzilla.wikimedia.org/show_bug.cgi?id=47499)
@@ -9,14 +19,27 @@
        // focus() (see SearchOverlay#show) opens virtual keyboard only if 
triggered
        // from user context event, so using it in route callback won't work
        // 
http://stackoverflow.com/questions/6837543/show-virtual-keyboard-on-mobile-phones-in-javascript
-       $( '#searchInput' ).on( 'click', function () {
-               schema.log( 'search' );
-               new SearchOverlay( {
-                       searchTerm: $( this ).val()
-               } ).show();
-               M.router.navigate( '/search' );
+       $searchInput.on( 'click', function () {
+               openSearchOverlay( $( this ).val() );
        } );
 
+       // Special handling for Special:Search
+       // Open search overlay if there is no current search
+       // Hide it if there is a current Search
+       if ( mw.config.get( 'wgPageName' ).toLowerCase() === 'special:search' ) 
{
+
+               // Always hide .mw-search-formheader
+               $( '.mw-search-formheader' ).hide();
+
+               currentSearch = M.query.search;
+               if ( currentSearch ) {
+                       $searchInput.hide();
+               } else {
+                       openSearchOverlay();
+               }
+       }
+
+
        // FIXME: ugly hack that removes search from browser history when 
navigating
        // to search results (we can't rely on History API yet)
        // alpha does it differently in lazyload.js

-- 
To view, visit https://gerrit.wikimedia.org/r/177136
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54463f41f5237899f3ad0f60a7a2845cae96c417
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to