Jdlrobson has submitted this change and it was merged.
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/common/mf-navigation.js
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
7 files changed, 20 insertions(+), 20 deletions(-)
Approvals:
JGonera: Looks good to me, but someone else must approve
Jdlrobson: Verified; Looks good to me, approved
jenkins-bot: Checked
diff --git a/javascripts/common/mf-navigation.js
b/javascripts/common/mf-navigation.js
index c7e076c..734a9ff 100644
--- a/javascripts/common/mf-navigation.js
+++ b/javascripts/common/mf-navigation.js
@@ -117,7 +117,7 @@
function init() {
var
- search = document.getElementById( mfePrefix + 'search'
);
+ search = document.getElementById( 'searchInput' );
$( '#mw-mf-menu-main a' ).click( function() {
toggleNavigation(); // close before following link so
that certain browsers on back don't show menu open
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 1ebd713..6dad40e 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 af23f98..b80096f 100644
--- a/stylesheets/common/ui.css
+++ b/stylesheets/common/ui.css
@@ -316,7 +316,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 b7c2978..bf61569 100644
--- a/tests/js/test_beta_opensearch.js
+++ b/tests/js/test_beta_opensearch.js
@@ -1,7 +1,7 @@
(function ( $, MFE, MFEOS ) {
QUnit.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 &
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: merged
Gerrit-Change-Id: I7867dcd4d9f7b477e19219fe6456713f15a3e714
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits