MediaWiki:Common.js: Difference between revisions

Content deleted Content added
add utm parameter handling (from form)
Line 23:
 
function getQuerystring( key ) {
// TODO: Replace with mw.util.getParamValue() everywhere, and remove
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\.\_\-]*)' );
var qs = regex.exec( window.location.search );
return qs == null ? '' : qs[1];
}
 
Line 295:
if ( code == 13 ) return false;
});
 
document.paypalcontribution.utm_medium.value = mw.util.getParamValue( 'utm_medium' );
document.paypalcontribution.utm_campaign.value = mw.util.getParamValue( 'utm_campaign' );
document.paypalcontribution.utm_key.value = mw.util.getParamValue( 'utm_key' );
document.paypalcontribution.referrer.value = document.referrer;
 
// Disable logo link