MediaWiki:ThankYouPage.js

From Donate
Revision as of 17:21, 19 April 2019 by Pcoombe (talk | contribs)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
mw.loader.using( 'mediawiki.util', function() {

    var paymentMethod = mw.util.getParamValue('payment_method'),
        country = mw.util.getParamValue('country');

    if ( paymentMethod === 'bt' ) {
        document.getElementById('ty-banktransfer').style.display = 'block';
    }
    if ( paymentMethod === 'bitcoin' ) {
        document.getElementById('ty-bitcoin').style.display = 'block';
    }
    if ( paymentMethod === 'bpay' ) {
        document.getElementById('ty-bpay').style.display = 'block';
    }

    if ( country === 'US' || country === 'CA' ) {
        document.getElementById('ty-store').style.display = 'block';
    }

});

// Hint to click a share button when icon is clicked
document.getElementsByClassName('ty-share')[0].addEventListener('click', function() {
    var primaryClick = this;
    primaryClick.classList.add('highlight');
    setTimeout(function() {
        primaryClick.classList.remove('highlight');
    }, 400);
});

if ( navigator.share ) {
    $('#ty-web-share').click(function() {
        navigator.share({
            text: $(this).data('share-text'),
            url: 'https://donate.wikimedia.org/?utm_medium=SocialMedia&utm_campaign=ThankYouPage&utm_source=WebShare&uselang=' + $(this).data('share-lang')
        });
    });
    $('#ty-web-share').show();
}