Jdlrobson has uploaded a new change for review.

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


Change subject: Bug 47857: Deprecate #mw-mf-searchForm, allow search term 
clearing
......................................................................

Bug 47857: Deprecate #mw-mf-searchForm, allow search term clearing

Previously when typing a search term a cross appeared that allowed you
to reset the value. This code seems to have been lying dormant

Take opportunity to rename clearlink to more meaningful clear
Bug: 47857

Change-Id: Ib3db61be25452c4b3eedb5e54756cfe0d144882a
---
M javascripts/modules/search-2.js
M less/common/ui.less
M less/modules/mf-search.less
M less/modules/mf-watchstar.less
M stylesheets/common/ui.css
M stylesheets/devices/wii.css
M stylesheets/modules/mf-search.css
M stylesheets/modules/mf-watchstar.css
M templates/overlays/search/search.html
9 files changed, 11 insertions(+), 18 deletions(-)


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

diff --git a/javascripts/modules/search-2.js b/javascripts/modules/search-2.js
index 26d36e5..2ece4d0 100644
--- a/javascripts/modules/search-2.js
+++ b/javascripts/modules/search-2.js
@@ -36,7 +36,7 @@
        defaults: {
                explanation: mw.msg( 'mobile-frontend-search-help' ),
                noresults: mw.msg( 'mobile-frontend-search-noresults' ),
-               action: $( '#mw-mf-searchForm' ).attr( 'action' )
+               action: $( '#mw-mf-page-center .header form.search-box' ).attr( 
'action' )
        },
        initialize: function() {
                overlayInitialize.apply( this, arguments );
@@ -52,6 +52,10 @@
                        }
                } );
                this.results = [];
+               this.$( '.clear' ).on( 'click', function() {
+                       console.log( 'hello' );
+                       self.$( 'input' ).val( '' ).focus();
+               } );
        },
        /**
         * A wrapper for $.ajax() to be used when calling server APIs.
diff --git a/less/common/ui.less b/less/common/ui.less
index 1f66788..ca110c3 100644
--- a/less/common/ui.less
+++ b/less/common/ui.less
@@ -88,6 +88,7 @@
 }
 
 .search-box {
+       position: relative;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
 
        #mw-mf-sq {
diff --git a/less/modules/mf-search.less b/less/modules/mf-search.less
index 498989a..05df06c 100644
--- a/less/modules/mf-search.less
+++ b/less/modules/mf-search.less
@@ -17,16 +17,15 @@
        }
 }
 
-#mw-mf-searchForm {
+form {
 
-       .clearlink {
+       .clear {
                top: @searchMarginTop;
                right: 10px;
                width: 24px;
                height: @searchBoxHeight;
                background: url(../common/images/close-button-beta.png) 
no-repeat scroll 0 0 transparent;
                margin: 0;
-               display: none;
                background-position: right center;
                .background-size( auto, 12px );
                cursor: pointer;
diff --git a/less/modules/mf-watchstar.less b/less/modules/mf-watchstar.less
index be0604e..64b7b35 100644
--- a/less/modules/mf-watchstar.less
+++ b/less/modules/mf-watchstar.less
@@ -16,10 +16,6 @@
        }
 }
 
-.full-screen-search #mw-mf-searchForm a.watch-this-article {
-       display: none;
-}
-
 li a.watch-this-article {
        right: 12px;
        top: 0;
diff --git a/stylesheets/common/ui.css b/stylesheets/common/ui.css
index 668a9f3..227729b 100644
--- a/stylesheets/common/ui.css
+++ b/stylesheets/common/ui.css
@@ -312,6 +312,7 @@
   font-size: 9px;
 }
 .search-box {
+  position: relative;
   -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
 }
 .search-box #mw-mf-sq {
diff --git a/stylesheets/devices/wii.css b/stylesheets/devices/wii.css
index 2a25dba..8897210 100644
--- a/stylesheets/devices/wii.css
+++ b/stylesheets/devices/wii.css
@@ -1,7 +1,3 @@
-#mw-mf-searchForm {
-       margin: 0;
-}
-
 .thumb {
        margin: 0.5em 0;
 }
diff --git a/stylesheets/modules/mf-search.css 
b/stylesheets/modules/mf-search.css
index f1134f7..372fd95 100644
--- a/stylesheets/modules/mf-search.css
+++ b/stylesheets/modules/mf-search.css
@@ -12,14 +12,13 @@
 .full-screen-search .search-box {
   padding-right: 8px;
 }
-#mw-mf-searchForm .clearlink {
+form .clear {
   top: 9px;
   right: 10px;
   width: 24px;
   height: 30px;
   background: url(../common/images/close-button-beta.png) no-repeat scroll 0 0 
transparent;
   margin: 0;
-  display: none;
   background-position: right center;
   /* use -webkit prefix for older android browsers eg. nexus 1 */
 
diff --git a/stylesheets/modules/mf-watchstar.css 
b/stylesheets/modules/mf-watchstar.css
index 60057b3..8e40c50 100644
--- a/stylesheets/modules/mf-watchstar.css
+++ b/stylesheets/modules/mf-watchstar.css
@@ -15,9 +15,6 @@
   -webkit-transform: rotate(72deg);
   transform: rotate(72deg);
 }
-.full-screen-search #mw-mf-searchForm a.watch-this-article {
-  display: none;
-}
 li a.watch-this-article {
   right: 12px;
   top: 0;
diff --git a/templates/overlays/search/search.html 
b/templates/overlays/search/search.html
index 0c80176..86fb73f 100644
--- a/templates/overlays/search/search.html
+++ b/templates/overlays/search/search.html
@@ -2,8 +2,8 @@
        <button class="cancel">{{closeMsg}}</button>
        <form class="search-box" method="get" action="{{action}}">
                <input type="search" class="search" name="search">
+               <a class="clear"></a>
        </form>
-       <a class="clearlink"></a>
 </div>
 <ul class="suggestions-results">
        <li>{{explanation}}</li>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3db61be25452c4b3eedb5e54756cfe0d144882a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to