https://bugzilla.wikimedia.org/show_bug.cgi?id=27730
Summary: Create enhanced version of mw.util.getParamValue to
get an object with all parameters (in one only call)
Product: MediaWiki
Version: 1.18-svn
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: Normal
Component: Javascript
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
With the current implementation of mw.util.getParamValue, if a script needs to
use N url parameters it will need to do N calls to the function, and this means
there will be created N RegExp objects, one for each requested parameter.
It would be better to have a way of requesting all url paramenters at once. The
function could return an object, giving us something similar to
var p = {
'parameter' : 'value',
'foo' : 'bar',
'etc' : '...'
}
which could be used as in
if ( p['parameter'] === 'value' ) {
//Do something
} else if ( p['foo'] === 'bar' ) {
//Do something else
}
One way to implement the feature would be to split the url after the first "?"
and then break it in parts separated by "&", getting an array of "param=value"
pair.
(PS: This is what was made e.g. in the following script:
[[w:pt:Wikipedia:Software/Scripts/Reversão_e_avisos.js]]
)
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l