MediaWiki talk:DefaultSearch.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Compatibility[edit]

This script has been tested in all skins using Firefox 3.

Firefox 3 OK FF 3.0.7 on Win XP Pro, SP2
Firefox 2 unknown presumed OK
Internet Explorer 8 unknown
Internet Explorer 7 unknown presumed OK
Internet Explorer 6 OK Win XP Pro, SP2
Konqueror unknown presumed OK
Opera OK Opera 9.6.3 on Win XP, SP2
Safari 3/Mac unknown presumed OK
Safari 3/Win OK Safari 3.2.2 (WebKit 525.28.1) on Win XP, SP2
Safari 2/Mac unknown
Safari 2/Win don't care Early Safari versions for Windows are known to be buggy.
We don't cater to broken browsers (well, except IE :-)
Users should upgrade their browsers to Safari 3.
Firefox 1.5 unknown needed?
IE/Mac unknown needed?
IE 5.5 unknown needed?

Inverting the order of the buttons[edit]

...had occurred to me, too, but still doesn't work in IE 6. Enter in the input field invokes "Go". It appears as if IE caches the default submit when it initially reads the form from the XHTML, and we have no way of overriding that later using JS. But maybe we can only use a keydown handler? If we trap enter anyway, we wouldn't need to fiddle around with changing button types or creating new buttons. Lupo 14:59, 24 March 2009 (UTC)[reply]

Ugh. This is bat-shit-insane ;-). Just a keydown handler wouldn't allow us to change bolding. I'm starting to think rather have a simple 5 line script that supports up-to-date browsers and the skins 99% of all users use is better than having a 60 line javascript nightmare that also covers the last 1% of users... --Dschwen (talk) 15:14, 24 March 2009 (UTC)[reply]
Yes it does. You may change the style of the buttons, even in IE. See the top of my User:Lupo/monobook.js. That code works across browsers (Safari 3.2.2, Opera 9.6.3, IE 6, FF3). I've also switched back to local searching by name: name is not globally unique, contrary to id. Besides, according to en:Internet Explorer#Market adoption and usage share, there were still 18.85% of the people on the Internet using IE 6 in February 2009. Lupo 15:27, 24 March 2009 (UTC)[reply]
Yeah, I just looked at the classic skin. Geez. How about adding IDs to those... In any case, then we might as well add keydown handler for every browser and just change the bolding. --Dschwen (talk) 15:36, 24 March 2009 (UTC)[reply]
Ok, switched. That something that simple can get that complex... Lupo 16:07, 24 March 2009 (UTC)[reply]
And now it doesn't work anymore in Safari. Damn. The last version that really worked was this one. Lupo 16:13, 24 March 2009 (UTC)[reply]
Uhm yeah, why don't you go ahead and revert it. Sorry, I thought this must be easier than this... --Dschwen (talk) 16:30, 24 March 2009 (UTC)[reply]
Ok... I didn't revert, but just re-added a try catch block and used your original button-type change as the default and the keydown handler only as the fallback option. It now works again on all browsers I tested: Opera, Safari, Firefox, and IE 6. It's a bit shorter than the old version which also created whole new buttons (which actually isn't necessary on IE since a keydown handler does work there). Lupo 08:25, 25 March 2009 (UTC)[reply]

New search box[edit]

Please see Commons:Village_pump#New_search_box. -- User:Docu at 16:04, 14 May 2010 (UTC)[reply]

How to disable in my monobook.js[edit]

I preferred to have "Go" as the default button. Can I disable this in my monobook.js? /Ö 16:59, 2 November 2010 (UTC)[reply]

OK, one sec, I'll add an option--DieBuche (talk) 17:00, 2 November 2010 (UTC)[reply]
Use

window.GoButton = true;

to disable it --DieBuche (talk) 17:05, 2 November 2010 (UTC)[reply]
That does not seem to work. I think the GoButton if switch needs to be inside the function, since site scripts are executed before personal scripts. So variables from personal scripts are only available inside functions that runs later. /Ö 18:16, 2 November 2010 (UTC)[reply]
Yep, right. Try again now--DieBuche (talk) 19:04, 2 November 2010 (UTC)[reply]
Thank you. Now it works fine. /Ö 19:12, 2 November 2010 (UTC)[reply]

phab:T255953: replacing searchGoButton with searchButton[edit]

{{Edit request}} Per phab:T255953, searchGoButton is to be replaced with searchButton on 23 July, 2020. Since this script is used on MediaWiki:Monobook.js and searchGoButton is used in it, I think the change will affect users using Monobook as their default skin, and a change will be required. This should be the only affected script in the MediaWiki namespace. If I'm not mistaken, there is unfortunately no transition period; on 23 July, one stops working and the other works, so we should change it then. Ahmadtalk 19:54, 29 June 2020 (UTC)[reply]

✓ Done, though I ended up removing the mention of search(Go)Button completely. The HTML which these selectors used to target seems to have changed a bit since the script was last edited. --Lucas Werkmeister (talk) 21:03, 27 September 2020 (UTC)[reply]