Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/opensearch.js |
— | — | @@ -67,11 +67,13 @@ |
68 | 68 | if ( !sections || sections.length < 1 ) { |
69 | 69 | results.innerHTML = "No results"; |
70 | 70 | } else { |
71 | | - var html = ''; |
| 71 | + var html = '<div class="suggestions-results">'; |
72 | 72 | for ( i = 0; i < sections.length; i++ ) { |
73 | 73 | var section = sections[i]; |
74 | | - html = html + "<a href='" + section.value + "'>" + section.label + "</a><br/>"; |
| 74 | + var rel = i + 1; |
| 75 | + html = html + "<div class=\"suggestions-result\" rel=\"" + rel + "\" title=\"" + section.label + "\"><a href='" + section.value + "'>" + section.label + "</a></div>"; |
75 | 76 | } |
| 77 | + html = html + '</div>'; |
76 | 78 | results.innerHTML = html; |
77 | 79 | } |
78 | 80 | } |
\ No newline at end of file |
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/stylesheets/common.css |
— | — | @@ -15,6 +15,41 @@ |
16 | 16 | display: none; |
17 | 17 | } |
18 | 18 | |
| 19 | +.suggestions-results { |
| 20 | + font-size: 0.8em; |
| 21 | + cursor: pointer; |
| 22 | +} |
| 23 | + |
| 24 | +.suggestions-result { |
| 25 | + color: black; |
| 26 | + color: WindowText; |
| 27 | + margin: 0; |
| 28 | + line-height: 1.5em; |
| 29 | + padding: 0.01em 0.25em; |
| 30 | + text-align: left; |
| 31 | +} |
| 32 | + |
| 33 | +.suggestions-result a { |
| 34 | + text-decoration: none; |
| 35 | + color: #000000; |
| 36 | +} |
| 37 | +.suggestions-result a:link { |
| 38 | + text-decoration: none; |
| 39 | + color:#000000; |
| 40 | +} |
| 41 | +.suggestions-result a:visited { |
| 42 | + text-decoration: none; |
| 43 | + color:#000000; |
| 44 | +} |
| 45 | +.suggestions-result a:hover { |
| 46 | + text-decoration: none; |
| 47 | + color:#000000; |
| 48 | +} |
| 49 | +.suggestions-result a:active { |
| 50 | + text-decoration: none; |
| 51 | + color:#000000; |
| 52 | +} |
| 53 | + |
19 | 54 | #results { |
20 | 55 | display: none; |
21 | 56 | background-color: #ffffff; |
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -82,8 +82,8 @@ |
83 | 83 | * @return bool |
84 | 84 | */ |
85 | 85 | function efExtMobileFrontendUnitTests( &$files ) { |
86 | | - $files[] = dirname( __FILE__ ) . '/tests/MobileFrontendTest.php'; |
87 | | - return true; |
| 86 | + $files[] = dirname( __FILE__ ) . '/tests/MobileFrontendTest.php'; |
| 87 | + return true; |
88 | 88 | } |
89 | 89 | |
90 | 90 | class ExtMobileFrontend { |
— | — | @@ -291,10 +291,10 @@ |
292 | 292 | * @param $field string |
293 | 293 | * @return string |
294 | 294 | */ |
295 | | - private function removeQueryStringParameter( $url, $field ) { |
296 | | - $url = preg_replace( '/(.*)(\?|&)' . $field . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&' ); |
297 | | - $url = substr( $url, 0, -1 ); |
298 | | - return $url; |
| 295 | + private function removeQueryStringParameter( $url, $field ) { |
| 296 | + $url = preg_replace( '/(.*)(\?|&)' . $field . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&' ); |
| 297 | + $url = substr( $url, 0, -1 ); |
| 298 | + return $url; |
299 | 299 | } |
300 | 300 | |
301 | 301 | public function getMsg() { |
— | — | @@ -313,7 +313,7 @@ |
314 | 314 | if ( stristr( $copyright, '<li class="noprint">' ) !== false ) { |
315 | 315 | $copyright = '<ul><li>' . $copyright . '</li></ul>'; |
316 | 316 | } |
317 | | - |
| 317 | + |
318 | 318 | // Need to stash the results of the "wfMsg" call before the Output Buffering handler |
319 | 319 | // because at this point the database connection is shut down, etc. |
320 | 320 | |
— | — | @@ -597,17 +597,17 @@ |
598 | 598 | wfProfileOut( __METHOD__ ); |
599 | 599 | return true; |
600 | 600 | } |
601 | | - |
| 601 | + |
602 | 602 | private function checkUserStatus() { |
603 | 603 | wfProfileIn( __METHOD__ ); |
604 | | - |
605 | | - if ( !empty( $_SERVER['HTTP_APPLICATION_VERSION'] ) && |
| 604 | + |
| 605 | + if ( !empty( $_SERVER['HTTP_APPLICATION_VERSION'] ) && |
606 | 606 | strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Wikipedia Mobile' ) !== false ) { |
607 | 607 | self::$hideSearchBox = true; |
608 | 608 | } |
609 | | - |
| 609 | + |
610 | 610 | $optInCookie = $this->getOptInOutCookie(); |
611 | | - if ( !empty( $optInCookie ) && |
| 611 | + if ( !empty( $optInCookie ) && |
612 | 612 | $optInCookie == 1 ) { |
613 | 613 | self::$isBetaGroupMember = true; |
614 | 614 | } |
— | — | @@ -626,13 +626,13 @@ |
627 | 627 | $wgCookieDomain = $tempWgCookieDomain; |
628 | 628 | wfProfileOut( __METHOD__ ); |
629 | 629 | } |
630 | | - |
| 630 | + |
631 | 631 | private function getOptInOutCookie() { |
632 | 632 | global $wgRequest; |
633 | 633 | wfProfileIn( __METHOD__ ); |
634 | 634 | $optInCookie = $wgRequest->getCookie( 'optin' ); |
635 | 635 | wfProfileOut( __METHOD__ ); |
636 | | - return $optInCookie; |
| 636 | + return $optInCookie; |
637 | 637 | } |
638 | 638 | |
639 | 639 | /** |
— | — | @@ -692,7 +692,7 @@ |
693 | 693 | $wgOut->addVaryHeader( 'Cookie' ); |
694 | 694 | wfProfileOut( __METHOD__ ); |
695 | 695 | } |
696 | | - |
| 696 | + |
697 | 697 | private function sendApplicationVersionVaryHeader() { |
698 | 698 | global $wgOut, $wgRequest; |
699 | 699 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1153,7 +1153,7 @@ |
1154 | 1154 | if ( self::$isMainPage ) { |
1155 | 1155 | $contentHtml = $this->DOMParseMainPage( $contentHtml ); |
1156 | 1156 | } |
1157 | | - |
| 1157 | + |
1158 | 1158 | $title = htmlspecialchars( self::$title->getText() ); |
1159 | 1159 | $htmlTitle = htmlspecialchars( self::$htmlTitle ); |
1160 | 1160 | |
— | — | @@ -1178,12 +1178,12 @@ |
1179 | 1179 | // Add segmentation markers |
1180 | 1180 | $contentHtml = $this->headingTransform( $contentHtml ); |
1181 | 1181 | |
1182 | | - // Content removal for WML rendering |
| 1182 | + // Content removal for WML rendering |
1183 | 1183 | $elements = array( 'span', 'div', 'sup', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'sup', 'sub' ); |
1184 | 1184 | foreach ( $elements as $element ) { |
1185 | 1185 | $contentHtml = preg_replace( '#</?' . $element . '[^>]*>#is', '', $contentHtml ); |
1186 | 1186 | } |
1187 | | - |
| 1187 | + |
1188 | 1188 | //Wml for searching |
1189 | 1189 | $searchWml = '<p><input emptyok="true" format="*M" type="text" name="search" value="" size="16" />' . |
1190 | 1190 | '<do type="accept" label="' . self::$messages['mobile-frontend-search-submit'] . '">' . |