MediaWiki:ThankYouPage.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
use matching as primary CTA in US, instead of endowment |
||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
// Framebuster for https://phabricator.wikimedia.org/T176669 |
|||
if ( self !== top ) { |
|||
top.location.href = window.location; |
|||
} |
|||
mw.loader.using( 'mediawiki.util', function() { |
mw.loader.using( 'mediawiki.util', function() { |
||
/* -- Both old and 2019 pages -- */ |
|||
var paymentMethod = mw.util.getParamValue('payment_method'), |
var paymentMethod = mw.util.getParamValue('payment_method'), |
||
country = mw.util.getParamValue('country'); |
country = mw.util.getParamValue('country'); |
||
Line 14: | Line 20: | ||
} |
} |
||
if ( mw.util.getParamValue('recurringConversion') ) { |
|||
$('#ty-recurringConversion').show(); |
|||
⚫ | |||
// Adjust survey link |
|||
if ( country ) { |
|||
$('.ty-survey-link, a[href^="https://www.surveymonkey.com"]').attr('href', function( i, val ) { |
|||
return val + "?country=" + country; |
|||
}); |
|||
} |
|||
/* -- Old page -- */ |
|||
if ( country === 'US' || country === 'CA' ) { |
if ( country === 'US' || country === 'CA' ) { |
||
$('#ty-store').show(); |
|||
} |
} |
||
/* -- New 2019 page -- */ |
|||
}); |
|||
// To force endowment feature |
|||
if ( mw.util.getParamValue( 'featureEndowment' ) ) { |
|||
// Hint to click a share button when icon is clicked |
|||
$( '.primary-ctas .endowment, \ |
|||
document.getElementsByClassName('ty-share')[0].addEventListener('click', function() { |
|||
.other-ctas, \ |
|||
var primaryClick = this; |
|||
.other-ctas .survey, \ |
|||
primaryClick.classList.add('highlight'); |
|||
.other-ctas .store, \ |
|||
setTimeout(function() { |
|||
.other-ctas .matching' ).show(); |
|||
} else if ( country === 'US' ) { |
|||
⚫ | |||
$( '.primary-ctas .matching, \ |
|||
.other-ctas, \ |
|||
.other-ctas .survey, \ |
|||
.other-ctas .store, \ |
|||
.other-ctas .endowment' ).show(); |
|||
} else if ( country === 'CA' ) { |
|||
$( '.primary-ctas .survey, \ |
|||
.other-ctas, \ |
|||
.other-ctas .store' ).show(); |
|||
} else { |
|||
$( '.primary-ctas .survey' ).show(); |
|||
} |
|||
}); |
}); |
||
if ( navigator.share ) { |
if ( navigator.share ) { |
||
$('#ty-web-share').click(function() { |
$('#ty-web-share').click(function(e) { |
||
var url = 'https://donate.wikimedia.org/?utm_medium=SocialMedia&utm_campaign=ThankYouPage&utm_source=WebShare'; |
var url = 'https://donate.wikimedia.org/?utm_medium=SocialMedia&utm_campaign=ThankYouPage&utm_source=WebShare'; |
||
if ( $(this).data('share- |
if ( $(this).data('share-language') ) { |
||
url += '&uselang=' + $(this).data('share- |
url += '&uselang=' + $(this).data('share-language'); |
||
} |
} |
||
navigator.share({ |
navigator.share({ |
||
text: $(this).data('share-text'), |
text: $(this).data('share-text'), |
||
url: url |
url: url |
||
}); |
}); |
||
e.preventDefault(); |
|||
}); |
}); |
||
$('#ty-web-share').show(); |
$('#ty-web-share').show(); |
Latest revision as of 16:56, 14 April 2020
// Framebuster for https://phabricator.wikimedia.org/T176669
if ( self !== top ) {
top.location.href = window.location;
}
mw.loader.using( 'mediawiki.util', function() {
/* -- Both old and 2019 pages -- */
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 ( mw.util.getParamValue('recurringConversion') ) {
$('#ty-recurringConversion').show();
}
// Adjust survey link
if ( country ) {
$('.ty-survey-link, a[href^="https://www.surveymonkey.com"]').attr('href', function( i, val ) {
return val + "?country=" + country;
});
}
/* -- Old page -- */
if ( country === 'US' || country === 'CA' ) {
$('#ty-store').show();
}
/* -- New 2019 page -- */
// To force endowment feature
if ( mw.util.getParamValue( 'featureEndowment' ) ) {
$( '.primary-ctas .endowment, \
.other-ctas, \
.other-ctas .survey, \
.other-ctas .store, \
.other-ctas .matching' ).show();
} else if ( country === 'US' ) {
$( '.primary-ctas .matching, \
.other-ctas, \
.other-ctas .survey, \
.other-ctas .store, \
.other-ctas .endowment' ).show();
} else if ( country === 'CA' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else {
$( '.primary-ctas .survey' ).show();
}
});
if ( navigator.share ) {
$('#ty-web-share').click(function(e) {
var url = 'https://donate.wikimedia.org/?utm_medium=SocialMedia&utm_campaign=ThankYouPage&utm_source=WebShare';
if ( $(this).data('share-language') ) {
url += '&uselang=' + $(this).data('share-language');
}
navigator.share({
text: $(this).data('share-text'),
url: url
});
e.preventDefault();
});
$('#ty-web-share').show();
}