From 85cf0e0378a11419d72a733cbf9432cc0e0d7b9c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 22 Apr 2008 22:35:50 +0000 Subject: [PATCH] * (bug 13824) AJAX search suggestion now works with non-SkinTemplate skins The setup code was using a MonoBook-specific div ID to insert the results container into. Swapped that for the plain ol' document.body and fixed the styles for MonoBook and Modern so it gets the scale-up fix for the font size (they both use a weird system where they shrink the font size on the body, then scale it back up inside.... very wtf territory!) Added setup for form and input IDs used for the second search box on Cologne Blue, and copied those IDs over to Nostalgia and Classic skins. Note that the drop-down is a bit unsatisfactory on the page-bottom search boxes in Nostalgia, Classic, and Cologne Blue, as it tries to squish in at the bottom of the page, and you only get two lines of data. The sidebar search boxes are also not very wide, which makes results pretty cramped. --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 2 +- includes/Skin.php | 9 +++++++-- skins/CologneBlue.php | 3 --- skins/common/mwsuggest.js | 7 +++---- skins/modern/main.css | 3 ++- skins/monobook/main.css | 4 ++++ 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 25a02435e3..2cc5255294 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -210,6 +210,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 13796) Show links to parent pages even if some of them are missing * (bug 13816) Filter by main namespace doesn't work on WhatLinksHere * (bug 13822) Fatal error on some pages when calculating subpage subtitle +* (bug 13824) AJAX search suggestion now works with non-SkinTemplate skins + === API changes in 1.13 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4ec5eb16dd..57b5bf9a0c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1334,7 +1334,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '138'; +$wgStyleVersion = '139'; # Server-side caching: diff --git a/includes/Skin.php b/includes/Skin.php index 5abb40b930..b60709cef3 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -17,6 +17,8 @@ class Skin extends Linker { * @private */ var $mWatchLinkNum = 0; // Appended to end of watch link id's + // How many search boxes have we made? Avoid duplicate id's. + protected $searchboxes = ''; /**#@-*/ protected $mRevisionId; // The revision ID we're looking at, null if not applicable. protected $skinname = 'standard' ; @@ -986,13 +988,16 @@ END; global $wgRequest; $search = $wgRequest->getText( 'search' ); - $s = '
searchboxes.'" name="search" class="inline" method="post" action="' . $this->escapeSearchLink() . "\">\n" - . '\n" . ' ' . '\n
"; + // Ensure unique id's for search boxes made after the first + $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1; + return $s; } diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 6889b396dc..72598f26bf 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -15,9 +15,6 @@ if( !defined( 'MEDIAWIKI' ) ) */ class SkinCologneBlue extends Skin { - private $searchboxes = ''; - // How many search boxes have we made? Avoid duplicate id's. - function getStylesheet() { return 'common/cologneblue.css'; } diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js index 53dbcf941b..a65f82b04b 100644 --- a/skins/common/mwsuggest.js +++ b/skins/common/mwsuggest.js @@ -25,8 +25,8 @@ var os_mouse_moved = false; // delay between keypress and suggestion (in ms) var os_search_timeout = 250; // these pairs of inputs/forms will be autoloaded at startup -var os_autoload_inputs = new Array('searchInput', 'powerSearchText', 'searchText'); -var os_autoload_forms = new Array('searchform', 'powersearch', 'search' ); +var os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText'); +var os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' ); // if we stopped the service var os_is_stopped = false; // max lines to show in suggest table @@ -178,10 +178,9 @@ function os_createContainer(r){ var pos = os_getElementPosition(r.searchbox); var left = pos.left; var top = pos.top + s.offsetHeight; - var body = document.getElementById("globalWrapper"); c.className = "os-suggest"; c.setAttribute("id", r.container); - body.appendChild(c); + document.body.appendChild(c); // dynamically generated style params // IE workaround, cannot explicitely set "style" attribute diff --git a/skins/modern/main.css b/skins/modern/main.css index bfa77b0564..a00a5d48da 100644 --- a/skins/modern/main.css +++ b/skins/modern/main.css @@ -12,7 +12,8 @@ body { #mw_main, #p-personal, -#mw_header { +#mw_header, +.os-suggest { font-size: 130%; } diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 9a45c6f636..001e050ba9 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -1566,3 +1566,7 @@ span.searchmatch { font-weight: bold; } +/* God-damned hack for the crappy layout */ +.os-suggest { + font-size: 127%; +} -- 2.20.1