MediaWiki:Common.js: Difference between revisions

Content deleted Content added
replace deprecated mw.Uri with native URL - phab:T374314
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 5:
$(function() {
 
mw.loader.using( ['mediawiki.util', 'mediawiki.Uri'] ).done( function() {
 
// If Jimmy tweets a bare link to https://donate.wikimedia.org/w/index.php?title=Special:LandingPage
Line 71:
document.getElementById('country-select-go').addEventListener( 'click', function(e) {
if ( countrySelect.value ) {
// Chapter countries, use the built-in donatewiki redirects
mw.loader.using( ['mediawiki.Uri'] ).done( function() {
uri.query.countryif =( countrySelect.value; === 'DE' ) {
var uri = new mw.Uri( document.location.href );
window.location = 'https://donate.wikimedia.org/?country=DE';
uri.query.country = countrySelect.value;
} else if ( countrySelect.value === 'CH' ) {
document.location = uri.toString();
window.location = 'https://donate.wikimedia.org/?country=CH';
});
} else {
var uriurl = new mw.UriURL( document.location.href );
url.searchParams.set( 'country', countrySelect.value );
documentwindow.location = uriurl.toString();
});
}
});