MediaWiki talk:Common.js/Archive 8: Difference between revisions
Content deleted Content added
Shadowbot3 (talk | contribs) m Automated archival of 1 sections from MediaWiki talk:Common.js |
Shadowbot3 (talk | contribs) m Automated archival of 1 sections from MediaWiki talk:Common.js |
||
Line 188:
:It would require a bit of tweaking to the script since it assumes that there is only one additional parameter besides the free text field used for the search term. For Yahoo!, this is currently being used for <code>vs=en.wikipedia.org</code>. The code would have to be changed to add a hidden element to the form for the <code>ei</code> parameter on submit, which would significantly alter the structure of the code. [[User talk:Mike Dillon|Mike Dillon]] 02:24, 10 July 2007 (UTC)
<span id="63309291258" />
== small replace() bug ==
{{tl|editprotected}}
The definitions of <code>importScript</code> and <code>importStylesheet</code> call <code>page.replace( ' ', '_' )</code>, but this will only replace the first space in <code>page</code>, without touching the rest.
This is not a big deal, because Wikipedia generates a [[301 Moved Permanently]] for the spaced URL, but the code should probably be corrected to <code>page.replace(/_/g, ' ')</code>, for neatness and efficiency. --[[User:Piet Delport|Piet Delport]] 01:42, 5 July 2007 (UTC)
:That is, switch that around, <code>page.replace(/ /g, '_')</code> (or <code>page.replace(/\s/g, '_')</code>). [[User:Gracenotes|<span style="color:#960;">Grace</span><span style="color:#000;">notes</span>]]<sup>[[User talk:Gracenotes|<span style="color:#960;">T</span>]]</sup> <span title="MediaWiki talk:Common.js">§</span> 04:13, 5 July 2007 (UTC)
::{{tick}} '''Done''' (after testing the relevant expressions). (There are certainly a lot of ways to express the intended concept; I went for / /g in the actual change, but when writing my own code I often use /\ /g (which is correct in both JavaScript and Perl, even when using Perl's /x modifier) or even split(" ").join("_") (which has the advantages of accepting non-literal strings). --[[User:ais523|ais523]] 17:22, 6 July 2007 ([[User:ais523|U]][[User talk:ais523|T]][[Special:Contributions/Ais523|C]])
:: Right, my copy&paste mistake. --[[User:Piet Delport|Piet Delport]] 10:14, 11 July 2007 (UTC)
|