Jdlrobson has uploaded a new change for review.

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


Change subject: Rename #mw-mf-search to #searchInput
......................................................................

Rename #mw-mf-search to #searchInput

This is consistent with desktops naming convention for the
search box. I am rewriting the skin to be desktop friendly.

Note: haven't refactored mf-search.js to use overlay - that's
another exercise

Change-Id: I7867dcd4d9f7b477e19219fe6456713f15a3e714
---
M javascripts/modules/mf-search.js
M less/common/ui.less
M stylesheets/common/ui.css
M stylesheets/devices/iphone.css
M stylesheets/devices/nokia.css
M tests/js/test_beta_opensearch.js
6 files changed, 19 insertions(+), 19 deletions(-)


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

diff --git a/javascripts/modules/mf-search.js b/javascripts/modules/mf-search.js
index 0e87eb7..ba29446 100644
--- a/javascripts/modules/mf-search.js
+++ b/javascripts/modules/mf-search.js
@@ -11,7 +11,7 @@
        var apiUrl = '/api.php', timer = -1, typingDelay = 500,
                numResults = 15, term, mfePrefix = M.prefix,
                message = M.message,
-               search = document.getElementById(  mfePrefix + 'search' ),
+               search = document.getElementById(  'searchInput' ),
                oldValue,
                focusBlurTimeout,
                u = M.utils;
@@ -102,7 +102,7 @@
                        term, search,
                        section, escapedTerm, suggestionsResult, link, label;
 
-               search = document.getElementById(  mfePrefix + 'search' );
+               search = document.getElementById( 'searchInput' );
                term = htmlEntities( search.value );
 
                if ( !sections || sections.length < 1 ) {
@@ -208,7 +208,7 @@
        function initClearSearch() {
                var $clearSearch,
                        results = document.getElementById( 'results' ),
-                       search = document.getElementById( mfePrefix + 'search' 
);
+                       search = document.getElementById( 'searchInput' );
 
                $clearSearch = $( '<a class="clearlink">' ).appendTo( 
'#mw-mf-sq' );
                function clearSearchBox( event ) {
@@ -250,7 +250,7 @@
        }
 
        function init() {
-               if ( document.getElementById( 'mw-mf-search' ) ) {
+               if ( document.getElementById( 'searchInput' ) ) {
                        initSearch();
                }
        }
diff --git a/less/common/ui.less b/less/common/ui.less
index 681f629..f8a1545 100644
--- a/less/common/ui.less
+++ b/less/common/ui.less
@@ -100,7 +100,7 @@
 
 /* samsung galaxy s gt-19000 */
 @media all and ( max-width:240px ) {
-       #mw-mf-search {
+       .search-box input.search {
                font-size: 0.8em;
                padding-left: 0;
        }
diff --git a/stylesheets/common/ui.css b/stylesheets/common/ui.css
index 3191a90..d9c4640 100644
--- a/stylesheets/common/ui.css
+++ b/stylesheets/common/ui.css
@@ -328,7 +328,7 @@
 }
 /* samsung galaxy s gt-19000 */
 @media all and (max-width: 240px) {
-  #mw-mf-search {
+  .search-box input.search {
     font-size: 0.8em;
     padding-left: 0;
   }
diff --git a/stylesheets/devices/iphone.css b/stylesheets/devices/iphone.css
index 1624ef5..222d395 100644
--- a/stylesheets/devices/iphone.css
+++ b/stylesheets/devices/iphone.css
@@ -3,6 +3,6 @@
        -webkit-text-size-adjust: none;
 }
 
-#mw-mf-search {
+#searchInput {
        line-height: normal; /* placeholder displays incorrectly on iphones */
 }
diff --git a/stylesheets/devices/nokia.css b/stylesheets/devices/nokia.css
index c99ba32..90ac38d 100644
--- a/stylesheets/devices/nokia.css
+++ b/stylesheets/devices/nokia.css
@@ -1,4 +1,4 @@
 /* empty */
-#mw-mf-search {
+#searchInput {
        background-color: white !important; /* see bug 36490 */
 }
diff --git a/tests/js/test_beta_opensearch.js b/tests/js/test_beta_opensearch.js
index 6fde558..85e5bfc 100644
--- a/tests/js/test_beta_opensearch.js
+++ b/tests/js/test_beta_opensearch.js
@@ -1,7 +1,7 @@
 (function ( $, MFE, MFEOS ) {
 module( 'MobileFrontend: mf-search.js - test highlight', {
        setup: function() {
-               $( '<form id="mw-mf-searchForm"><input 
id="mw-mf-search"></form>' ).appendTo( document.body );
+               $( '<form id="mw-mf-searchForm"><input 
id="searchInput"></form>' ).appendTo( document.body );
                $( '<div id="results">' ).appendTo( document.body );
                MFEOS.init();
        },
@@ -20,8 +20,8 @@
                { label: "Hello world", value: "/HelloWorld" },
                { label: "Hello kitty", value: "/HelloKitty" }
        ], pageLink, pageLink2;
-       $("#mw-mf-search").val("el");
-       $( '#mw-mf-search' ).trigger( 'keyup' );
+       $( '#searchInput' ).val( 'el' );
+       $( '#searchInput' ).trigger( 'keyup' );
        MFEOS.writeResults(results);
        pageLink = $( '#results .suggestions-result a.search-result-item' )[ 0 
];
        pageLink2 = $( '#results .suggestions-result a.search-result-item' )[ 1 
];
@@ -35,8 +35,8 @@
                { label: "Hello world", value: "/HelloWorld" },
                { label: "Hello kitty", value: "/HelloKitty" }
        ], pageLink;
-       $("#mw-mf-search").val("hel");
-       $( '#mw-mf-search' ).trigger( 'keyup' );
+       $( '#searchInput' ).val( 'hel' );
+       $( '#searchInput' ).trigger( 'keyup' );
        MFEOS.writeResults(results);
        pageLink = $( '#results .suggestions-result a.search-result-item' )[ 0 
];
        strictEqual($(pageLink).html(), "<strong>Hel</strong>lo world", "check 
the highlight is correct");
@@ -47,8 +47,8 @@
                { label: "Belle & Sebastian", value: "/B1" },
                { label: "Belle & the Beast", value: "/B2" }
        ], pageLink;
-       $("#mw-mf-search").val("Belle & S");
-       $( '#mw-mf-search' ).trigger( 'keyup' );
+       $( '#searchInput' ).val( 'Belle & S' );
+       $( '#searchInput' ).trigger( 'keyup' );
        MFEOS.writeResults(results);
        pageLink = $( '#results .suggestions-result a.search-result-item' )[ 0 
];
        strictEqual($(pageLink).html(), "<strong>Belle &amp; 
S</strong>ebastian", "check the highlight is correct");
@@ -58,8 +58,8 @@
        var results = [
                { label: "Title with ? in it", value: "/B1" }
        ], pageLink;
-       $("#mw-mf-search").val("with ?");
-       $( '#mw-mf-search' ).trigger( 'keyup' );
+       $( '#searchInput' ).val( 'with ?' );
+       $( '#searchInput' ).trigger( 'keyup' );
        MFEOS.writeResults(results);
        pageLink = $( '#results .suggestions-result a.search-result-item' )[ 0 
];
        strictEqual($(pageLink).html(), "Title <strong>with ?</strong> in it", 
"check the highlight is correct");
@@ -69,8 +69,8 @@
        var results = [
                { label: "<script>alert('FAIL')</script> should be safe", 
value: "/B1" }
        ], pageLink;
-       $("#mw-mf-search").val("<script>alert('FAIL'");
-       $( '#mw-mf-search' ).trigger( 'keyup' );
+       $( '#searchInput' ).val( "<script>alert('FAIL'" );
+       $( '#searchInput' ).trigger( 'keyup' );
        MFEOS.writeResults(results);
        pageLink = $( '#results .suggestions-result a.search-result-item' )[ 0 
];
        strictEqual($(pageLink).html(),

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

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

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

Reply via email to