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]]
)
Version: 1.18.x
Severity: enhancement