MediaWiki:Common.js: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1:
* MediaWiki:Common.js - Any JavaScript here will be loaded for all users on every page load.
**/
Line 5:
$(function() {
mw.loader.using( ['mediawiki.util
// If Jimmy tweets a bare link to https://donate.wikimedia.org/w/index.php?title=Special:LandingPage
// we are gonna have a bad time as geolocation doesn't happen. Do a redirect to send them round again
try {
var
if (
url.searchParams.get( 'title' ) === 'Special:LandingPage' &&
url.searchParams.get( 'country' ) === null &&
url.searchParams.get( 'retried' ) === null
) {
console.log( 'redirecting to pick up country parameter' );
window.location.href =
}
} catch (error) {
Line 39 ⟶ 43:
}
});
});
}
}
});
}
// Chapter countries, use the built-in donatewiki redirects
if ( countrySelect.value === 'DE' ) {
var uri = new mw.Uri( document.location.href );▼
window.location = 'https://donate.wikimedia.org/?country=DE';
} else if ( countrySelect.value === 'CH' ) {
document.location = uri.toString();▼
window.location = 'https://donate.wikimedia.org/?country=CH';
} else {
url.searchParams.set( 'country', countrySelect.value );
}
}
});
};
});
}
▲ // if ( document.getElementById('country-select') ) {
}
▲ // enableCountrySelect();
// Fundraise Up privacy footer
if ( mw.util.getParamValue('fundraiseupScript') ) {
document.getElementById('donate-privacy-third-party').style.display = 'block';
}
// Code for Thank You pages - https://donate.wikimedia.org/wiki/MediaWiki:ThankYouPage.js
Line 97 ⟶ 110:
var supportPages = [ 'Ways to Give', 'Problems donating', 'Cancel or change recurring giving',
'Matching Gifts', 'Support Page', 'FAQ', 'Tax deductibility',
'US State Solicitation Disclosures', 'Draft:FAQ', 'Workplace giving' ];
if ( supportPages.indexOf( mw.config.get( 'wgTitle' ).split('/')[0] ) !== -1 || document.querySelector( '.language-switcher' ) ) {
mw.loader.load( '/w/index.php?title=MediaWiki:SupportPage.js&action=raw&ctype=text/javascript' );
}
|