Thank You
thankyouwiki
https://thankyou.wikipedia.org/wiki/Main_Page
MediaWiki 1.44.0-wmf.4
first-letter
Media
Special
Talk
User
User talk
Thank You
Thank You talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
TimedText
TimedText talk
Module
Module talk
MediaWiki:Common.js
8
32
986
984
2024-11-22T17:48:42Z
Pcoombe (WMF)
1
replace one use of deprecated mw.Uri with native URL - [[phab:T374314]]
986
javascript
text/javascript
/* Any JavaScript here will be loaded for all users on every page load. */
// Framebuster for https://phabricator.wikimedia.org/T176669
if ( self !== top ) {
top.location.href = window.location;
}
// Redirect anons to en if page doesn't exist
if ( mw.config.get('wgUserName') === null && mw.config.get('wgArticleId') === 0 ) {
var basePageName = mw.config.get('wgPageName').split('/')[0];
var redirectUrl = 'https://thankyou.wikipedia.org/wiki/';
if ( basePageName === 'Recurring_donor_page' ) {
redirectUrl += 'Recurring_donor_page/en';
} else {
redirectUrl += 'Thank_You/en';
}
redirectUrl += window.location.search; // params
window.location.replace( redirectUrl );
}
mw.loader.using( [ 'mediawiki.cookie', 'mediawiki.Uri' ], function() {
/**
* Extend a url with a subset of query parameters
*
* @param {string} url Base url to extend
* @param {object} allParams Object with all available query parameters (usually for the current location)
* @param {array} paramsToInclude List of parameters to include in the extended url
* @return {string} Extended url
*/
function extendWithSomeParams( url, allParams, paramsToInclude ) {
var uriObject = new mw.Uri( url ),
filteredParams = {};
// Fallback for survey links
allParams.wmf_medium = allParams.wmf_medium || allParams.utm_medium;
allParams.wmf_campaign = allParams.wmf_campaign || allParams.utm_campaign;
allParams.wmf_source = allParams.wmf_source || allParams.utm_source;
paramsToInclude.forEach( function(key) {
if ( allParams[key] ) {
filteredParams[key] = allParams[key];
}
});
uriObject.extend( filteredParams );
return uriObject.toString();
}
/* -- Start of main TY page code -- */
var params = {};
for ( const [key, value] of new URLSearchParams( location.search ) ) {
params[key] = value;
}
var country = params.country,
pageLanguage = mw.config.get('wgPageName').split('/')[1];
if ( params.payment_method === 'bt' ) {
document.getElementById('ty-banktransfer').style.display = 'block';
}
if ( params.recurring === '1' ) {
document.getElementById('ty-recurringOrganic').style.display = 'block';
}
if ( params.recurring === '1' && params.frequency_unit === 'year' ) {
document.getElementById('ty-recurringOrganic').style.display = 'none';
document.getElementById('ty-recurringOrganicAnnual').style.display = 'block';
}
if ( params.recurringConversion === '1' ) {
document.getElementById('ty-recurringConversion').style.display = 'block';
}
if ( params.recurringConversion === '1' && params.frequency_unit === 'year' ) {
document.getElementById('ty-recurringConversion').style.display = 'none';
document.getElementById('ty-recurringConversionAnnual').style.display = 'block';
}
// Recurring Upgrade
if ( params.recurUpgrade === '1' ) {
var recurUpgradeAmt = params.recurAmount;
var recurUpgradeDate = params.recurDate;
$('.recurUpgrade-yes').show();
if ( recurUpgradeAmt && recurUpgradeDate ) {
$('.recurUpgradeAmt').text(recurUpgradeAmt);
if ( params.country === 'US' ) {
$('.recurUpgradeAmt').prepend("$");
}
var upgradeDate = new Date(recurUpgradeDate);
var formatOptions = { timeZone: 'UTC', weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
$('.recurUpgradeDate').text( upgradeDate.toLocaleDateString('en-US', formatOptions) );
$('.recurUpgrade-receipt').show();
} else {
$('.recurUpgrade-receipt').hide();
}
} else if ( params.recurUpgrade === '0' ) {
$('.recurUpgrade-no').show();
} else {
$('.ty-vision, .ty-text').show();
}
// Extend survey links
$('.ty-survey-link, a[href^="https://www.surveymonkey.com"]').attr('href', function( i, val ) {
return extendWithSomeParams( val, params, [ 'country', 'payment_method', 'recurring', 'recurringConversion', 'amount', 'currency', 'order_id', 'wmf_medium', 'wmf_campaign', 'wmf_source' ] );
});
// Return to Wikipedia link
var returnToUrl = mw.cookie.get( 'fundraising_returnTo', '' );
if ( returnToUrl ) {
$( '.ty-return a' ).attr( 'href', returnToUrl );
$( '.ty-return' ).show();
mw.cookie.set( 'fundraising_returnTo', null, { prefix: '', domain: '.wikipedia.org' } );
}
// TODO: refactor this to be by feature instead of country?
if ( params.featureEndowment ) {
// To force endowment feature
$( '.primary-ctas .endowment, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .survey, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'US' ) {
$( '.primary-ctas .matching, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .will-US, \
.other-ctas .survey' ).show();
} else if ( country === 'CA' || country === 'GB' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .will-notUS, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'IE' || country === 'AU' || country === 'NZ' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'IT' || country === 'PT' || country === 'BR' || country === 'JP' || country === 'FR' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else if ( country === 'ES' || country === 'CL' || country === 'CO' || country === 'MX' || country === 'PE' || country === 'UY' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else if ( country === 'BE' || country === 'CZ' || country === 'NO' ) {
$( '.primary-ctas .survey, \
.other-ctas' ).show();
} else {
$( '.primary-ctas .survey' ).show();
}
if ( country === 'SE' ) {
$('.chapter-SE').show();
}
if ( country === 'CZ' ) {
$('.chapter-CZ').show();
}
if ( country === 'IT' ) {
$('.chapter-IT').show();
}
if ( country === 'AU' ) {
$('.chapter-AU').show();
}
if ( country === 'FR' ) {
$('.chapter-FR').show();
$('.tax-disclaimer-frfr').show();
}
if ( country === 'GB' ) {
$('.chapter-GB').show();
}
if ( country === 'CA' ) {
$('.chapter-CA').show();
$('.tax-disclaimer-frca').show();
}
if ( country === 'NO' ) {
$('.chapter-NO').show();
}
if ( country === 'BE' ) {
$('.chapter-BE').show();
}
if ( country === 'NL' ) {
$('.chapter-NL').show();
}
if ( country === 'NZ' ) {
$('.chapter-NZ').show();
}
/* Tax deductability disclaimer */
if ( country != 'US' && country != 'NL') {
$('.tax-disclaimer-en').show();
}
if ( country === 'ES') {
$('.tax-disclaimer-en').show();
$('.tax-disclaimer-es').show();
}
/* -- "Try editing" feature -- */
var editingUrls = {
'IN': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-in-en-2022'
},
'ZA': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-za-en-2022'
},
// Latin America
'BR': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'pt-br': 'https://pt.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-pt-2022&uselang=pt-br'
},
'AR': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'CL': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'CO': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'MX': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'PE': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'UY': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
// Northern and Western Europe
'SE': {
'sv': 'https://sv.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-sv-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-sv-2023'
},
'IT': {
'it': 'https://it.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-it-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-it-2023'
},
'FR': {
'fr': 'https://fr.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-fr-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-fr-2023'
},
'NL': {
'nl': 'https://nl.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-nl-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-nl-2023'
},
// East, Southeast Asia, and Pacific
'JP': {
'ja': 'https://ja.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-eseap-ja-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-eseap-ja-2023'
},
};
// Separate list so we can have others in prep for proofing
var editingCTACountries = [ 'IN', 'ZA', 'BR', 'AR', 'CL', 'CO', 'MX', 'PE', 'UY',
'SE', 'IT', 'FR', 'NL', 'JP' ];
if ( editingCTACountries.indexOf(country) !== -1 || params.testEditingCTA ) {
if ( editingUrls[country] ) {
if ( editingUrls[country][pageLanguage] ) {
$( '.try-editing a' ).attr( 'href', editingUrls[country][pageLanguage] );
$( '.primary-ctas .survey' ).hide();
$( '.primary-ctas .try-editing, .other-ctas, .other-ctas .survey' ).show();
}
}
}
// Only show survey 25% of time on English page
//if ( pageLanguage === 'en' ) {
// if ( Math.random() > 0.25 ) {
// $('.survey').hide();
// }
//}
if ( pageLanguage === 'en' ) {
var surveyNumber = Math.random();
if ( surveyNumber > 0.5 ) {
$('.survey').hide();
} else if ( surveyNumber > 0.25 && surveyNumber <= 0.5 ) {
$('.survey-1').hide();
} else if ( surveyNumber > 0 && surveyNumber <= 0.25 ) {
$('.survey-2').hide();
}
}
// Don't show editing CTAs on apps: https://phabricator.wikimedia.org/T353023
if ( params.utm_medium === 'WikipediaApp' || params.wmf_medium === 'WikipediaApp' ) {
$('.other-ctas .edit-6c, .primary-ctas .try-editing').hide();
}
// Finally, if there are no secondary CTAs shown then hide the section header
if ( $('.other-ctas .focus-block:visible').length === 0 ) {
$('.other-ctas h2').hide();
}
});
if ( navigator.share ) {
$('#ty-web-share').click(function(e) {
var url = 'https://donate.wikimedia.org/?wmf_medium=SocialMedia&wmf_campaign=ThankYouPage&wmf_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();
}
/* Show all elements for testing and checking translations */
function tyDebug() {
$('.ty-page *').show();
}
g1kirca5fbrxeif0udqaowd1hn6it6l
987
986
2024-11-22T18:17:41Z
Pcoombe (WMF)
1
replace other use of deprecated mw.Uri with native URL - [[phab:T374314]]
987
javascript
text/javascript
/* Any JavaScript here will be loaded for all users on every page load. */
// Framebuster for https://phabricator.wikimedia.org/T176669
if ( self !== top ) {
top.location.href = window.location;
}
// Redirect anons to en if page doesn't exist
if ( mw.config.get('wgUserName') === null && mw.config.get('wgArticleId') === 0 ) {
var basePageName = mw.config.get('wgPageName').split('/')[0];
var redirectUrl = 'https://thankyou.wikipedia.org/wiki/';
if ( basePageName === 'Recurring_donor_page' ) {
redirectUrl += 'Recurring_donor_page/en';
} else {
redirectUrl += 'Thank_You/en';
}
redirectUrl += window.location.search; // params
window.location.replace( redirectUrl );
}
mw.loader.using( [ 'mediawiki.cookie' ], function() {
/**
* Extend a url with a subset of query parameters
*
* @param {string} url Base url to extend
* @param {object} allParams Object with all available query parameters (usually for the current location)
* @param {array} paramsToInclude List of parameters to include in the extended url
* @return {string} Extended url
*/
function extendWithSomeParams( url, allParams, paramsToInclude ) {
var urlObject = new URL( url );
// Fallback for survey links
allParams.wmf_medium = allParams.wmf_medium || allParams.utm_medium;
allParams.wmf_campaign = allParams.wmf_campaign || allParams.utm_campaign;
allParams.wmf_source = allParams.wmf_source || allParams.utm_source;
paramsToInclude.forEach( function(key) {
if ( allParams[key] ) {
urlObject.searchParams.set( key, allParams[key] );
}
});
return urlObject.toString();
}
/* -- Start of main TY page code -- */
var params = {};
for ( const [key, value] of new URLSearchParams( location.search ) ) {
params[key] = value;
}
var country = params.country,
pageLanguage = mw.config.get('wgPageName').split('/')[1];
if ( params.payment_method === 'bt' ) {
document.getElementById('ty-banktransfer').style.display = 'block';
}
if ( params.recurring === '1' ) {
document.getElementById('ty-recurringOrganic').style.display = 'block';
}
if ( params.recurring === '1' && params.frequency_unit === 'year' ) {
document.getElementById('ty-recurringOrganic').style.display = 'none';
document.getElementById('ty-recurringOrganicAnnual').style.display = 'block';
}
if ( params.recurringConversion === '1' ) {
document.getElementById('ty-recurringConversion').style.display = 'block';
}
if ( params.recurringConversion === '1' && params.frequency_unit === 'year' ) {
document.getElementById('ty-recurringConversion').style.display = 'none';
document.getElementById('ty-recurringConversionAnnual').style.display = 'block';
}
// Recurring Upgrade
if ( params.recurUpgrade === '1' ) {
var recurUpgradeAmt = params.recurAmount;
var recurUpgradeDate = params.recurDate;
$('.recurUpgrade-yes').show();
if ( recurUpgradeAmt && recurUpgradeDate ) {
$('.recurUpgradeAmt').text(recurUpgradeAmt);
if ( params.country === 'US' ) {
$('.recurUpgradeAmt').prepend("$");
}
var upgradeDate = new Date(recurUpgradeDate);
var formatOptions = { timeZone: 'UTC', weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
$('.recurUpgradeDate').text( upgradeDate.toLocaleDateString('en-US', formatOptions) );
$('.recurUpgrade-receipt').show();
} else {
$('.recurUpgrade-receipt').hide();
}
} else if ( params.recurUpgrade === '0' ) {
$('.recurUpgrade-no').show();
} else {
$('.ty-vision, .ty-text').show();
}
// Extend survey links
$('.ty-survey-link, a[href^="https://www.surveymonkey.com"]').attr('href', function( i, val ) {
return extendWithSomeParams( val, params, [ 'country', 'payment_method', 'recurring', 'recurringConversion', 'amount', 'currency', 'order_id', 'wmf_medium', 'wmf_campaign', 'wmf_source' ] );
});
// Return to Wikipedia link
var returnToUrl = mw.cookie.get( 'fundraising_returnTo', '' );
if ( returnToUrl ) {
$( '.ty-return a' ).attr( 'href', returnToUrl );
$( '.ty-return' ).show();
mw.cookie.set( 'fundraising_returnTo', null, { prefix: '', domain: '.wikipedia.org' } );
}
// TODO: refactor this to be by feature instead of country?
if ( params.featureEndowment ) {
// To force endowment feature
$( '.primary-ctas .endowment, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .survey, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'US' ) {
$( '.primary-ctas .matching, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .will-US, \
.other-ctas .survey' ).show();
} else if ( country === 'CA' || country === 'GB' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .will-notUS, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'IE' || country === 'AU' || country === 'NZ' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'IT' || country === 'PT' || country === 'BR' || country === 'JP' || country === 'FR' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else if ( country === 'ES' || country === 'CL' || country === 'CO' || country === 'MX' || country === 'PE' || country === 'UY' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else if ( country === 'BE' || country === 'CZ' || country === 'NO' ) {
$( '.primary-ctas .survey, \
.other-ctas' ).show();
} else {
$( '.primary-ctas .survey' ).show();
}
if ( country === 'SE' ) {
$('.chapter-SE').show();
}
if ( country === 'CZ' ) {
$('.chapter-CZ').show();
}
if ( country === 'IT' ) {
$('.chapter-IT').show();
}
if ( country === 'AU' ) {
$('.chapter-AU').show();
}
if ( country === 'FR' ) {
$('.chapter-FR').show();
$('.tax-disclaimer-frfr').show();
}
if ( country === 'GB' ) {
$('.chapter-GB').show();
}
if ( country === 'CA' ) {
$('.chapter-CA').show();
$('.tax-disclaimer-frca').show();
}
if ( country === 'NO' ) {
$('.chapter-NO').show();
}
if ( country === 'BE' ) {
$('.chapter-BE').show();
}
if ( country === 'NL' ) {
$('.chapter-NL').show();
}
if ( country === 'NZ' ) {
$('.chapter-NZ').show();
}
/* Tax deductability disclaimer */
if ( country != 'US' && country != 'NL') {
$('.tax-disclaimer-en').show();
}
if ( country === 'ES') {
$('.tax-disclaimer-en').show();
$('.tax-disclaimer-es').show();
}
/* -- "Try editing" feature -- */
var editingUrls = {
'IN': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-in-en-2022'
},
'ZA': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-za-en-2022'
},
// Latin America
'BR': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'pt-br': 'https://pt.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-pt-2022&uselang=pt-br'
},
'AR': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'CL': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'CO': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'MX': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'PE': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'UY': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
// Northern and Western Europe
'SE': {
'sv': 'https://sv.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-sv-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-sv-2023'
},
'IT': {
'it': 'https://it.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-it-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-it-2023'
},
'FR': {
'fr': 'https://fr.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-fr-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-fr-2023'
},
'NL': {
'nl': 'https://nl.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-nl-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-nl-2023'
},
// East, Southeast Asia, and Pacific
'JP': {
'ja': 'https://ja.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-eseap-ja-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-eseap-ja-2023'
},
};
// Separate list so we can have others in prep for proofing
var editingCTACountries = [ 'IN', 'ZA', 'BR', 'AR', 'CL', 'CO', 'MX', 'PE', 'UY',
'SE', 'IT', 'FR', 'NL', 'JP' ];
if ( editingCTACountries.indexOf(country) !== -1 || params.testEditingCTA ) {
if ( editingUrls[country] ) {
if ( editingUrls[country][pageLanguage] ) {
$( '.try-editing a' ).attr( 'href', editingUrls[country][pageLanguage] );
$( '.primary-ctas .survey' ).hide();
$( '.primary-ctas .try-editing, .other-ctas, .other-ctas .survey' ).show();
}
}
}
// Only show survey 25% of time on English page
//if ( pageLanguage === 'en' ) {
// if ( Math.random() > 0.25 ) {
// $('.survey').hide();
// }
//}
if ( pageLanguage === 'en' ) {
var surveyNumber = Math.random();
if ( surveyNumber > 0.5 ) {
$('.survey').hide();
} else if ( surveyNumber > 0.25 && surveyNumber <= 0.5 ) {
$('.survey-1').hide();
} else if ( surveyNumber > 0 && surveyNumber <= 0.25 ) {
$('.survey-2').hide();
}
}
// Don't show editing CTAs on apps: https://phabricator.wikimedia.org/T353023
if ( params.utm_medium === 'WikipediaApp' || params.wmf_medium === 'WikipediaApp' ) {
$('.other-ctas .edit-6c, .primary-ctas .try-editing').hide();
}
// Finally, if there are no secondary CTAs shown then hide the section header
if ( $('.other-ctas .focus-block:visible').length === 0 ) {
$('.other-ctas h2').hide();
}
});
if ( navigator.share ) {
$('#ty-web-share').click(function(e) {
var url = 'https://donate.wikimedia.org/?wmf_medium=SocialMedia&wmf_campaign=ThankYouPage&wmf_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();
}
/* Show all elements for testing and checking translations */
function tyDebug() {
$('.ty-page *').show();
}
34bwvyirwsxvtfp19omt2wxqymkezps
988
987
2024-11-22T18:31:23Z
Pcoombe (WMF)
1
convert spacing to tabs since that's what the mediawiki editor uses now
988
javascript
text/javascript
/* Any JavaScript here will be loaded for all users on every page load. */
// Framebuster for https://phabricator.wikimedia.org/T176669
if ( self !== top ) {
top.location.href = window.location;
}
// Redirect anons to en if page doesn't exist
if ( mw.config.get('wgUserName') === null && mw.config.get('wgArticleId') === 0 ) {
var basePageName = mw.config.get('wgPageName').split('/')[0];
var redirectUrl = 'https://thankyou.wikipedia.org/wiki/';
if ( basePageName === 'Recurring_donor_page' ) {
redirectUrl += 'Recurring_donor_page/en';
} else {
redirectUrl += 'Thank_You/en';
}
redirectUrl += window.location.search; // params
window.location.replace( redirectUrl );
}
mw.loader.using( [ 'mediawiki.cookie' ], function() {
/**
* Extend a url with a subset of query parameters
*
* @param {string} url Base url to extend
* @param {object} allParams Object with all available query parameters (usually for the current location)
* @param {array} paramsToInclude List of parameters to include in the extended url
* @return {string} Extended url
*/
function extendWithSomeParams( url, allParams, paramsToInclude ) {
var urlObject = new URL( url );
// Fallback for survey links
allParams.wmf_medium = allParams.wmf_medium || allParams.utm_medium;
allParams.wmf_campaign = allParams.wmf_campaign || allParams.utm_campaign;
allParams.wmf_source = allParams.wmf_source || allParams.utm_source;
paramsToInclude.forEach( function(key) {
if ( allParams[key] ) {
urlObject.searchParams.set( key, allParams[key] );
}
});
return urlObject.toString();
}
/* -- Start of main TY page code -- */
var params = {};
for ( const [key, value] of new URLSearchParams( location.search ) ) {
params[key] = value;
}
var country = params.country,
pageLanguage = mw.config.get('wgPageName').split('/')[1];
if ( params.payment_method === 'bt' ) {
document.getElementById('ty-banktransfer').style.display = 'block';
}
if ( params.recurring === '1' ) {
document.getElementById('ty-recurringOrganic').style.display = 'block';
}
if ( params.recurring === '1' && params.frequency_unit === 'year' ) {
document.getElementById('ty-recurringOrganic').style.display = 'none';
document.getElementById('ty-recurringOrganicAnnual').style.display = 'block';
}
if ( params.recurringConversion === '1' ) {
document.getElementById('ty-recurringConversion').style.display = 'block';
}
if ( params.recurringConversion === '1' && params.frequency_unit === 'year' ) {
document.getElementById('ty-recurringConversion').style.display = 'none';
document.getElementById('ty-recurringConversionAnnual').style.display = 'block';
}
// Recurring Upgrade
if ( params.recurUpgrade === '1' ) {
var recurUpgradeAmt = params.recurAmount;
var recurUpgradeDate = params.recurDate;
$('.recurUpgrade-yes').show();
if ( recurUpgradeAmt && recurUpgradeDate ) {
$('.recurUpgradeAmt').text(recurUpgradeAmt);
if ( params.country === 'US' ) {
$('.recurUpgradeAmt').prepend("$");
}
var upgradeDate = new Date(recurUpgradeDate);
var formatOptions = { timeZone: 'UTC', weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
$('.recurUpgradeDate').text( upgradeDate.toLocaleDateString('en-US', formatOptions) );
$('.recurUpgrade-receipt').show();
} else {
$('.recurUpgrade-receipt').hide();
}
} else if ( params.recurUpgrade === '0' ) {
$('.recurUpgrade-no').show();
} else {
$('.ty-vision, .ty-text').show();
}
// Extend survey links
$('.ty-survey-link, a[href^="https://www.surveymonkey.com"]').attr('href', function( i, val ) {
return extendWithSomeParams( val, params, [ 'country', 'payment_method', 'recurring', 'recurringConversion', 'amount', 'currency', 'order_id', 'wmf_medium', 'wmf_campaign', 'wmf_source' ] );
});
// Return to Wikipedia link
var returnToUrl = mw.cookie.get( 'fundraising_returnTo', '' );
if ( returnToUrl ) {
$( '.ty-return a' ).attr( 'href', returnToUrl );
$( '.ty-return' ).show();
mw.cookie.set( 'fundraising_returnTo', null, { prefix: '', domain: '.wikipedia.org' } );
}
// TODO: refactor this to be by feature instead of country?
if ( params.featureEndowment ) {
// To force endowment feature
$( '.primary-ctas .endowment, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .survey, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'US' ) {
$( '.primary-ctas .matching, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .will-US, \
.other-ctas .survey' ).show();
} else if ( country === 'CA' || country === 'GB' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .will-notUS, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'IE' || country === 'AU' || country === 'NZ' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store, \
.other-ctas .edit-6c' ).show();
} else if ( country === 'IT' || country === 'PT' || country === 'BR' || country === 'JP' || country === 'FR' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else if ( country === 'ES' || country === 'CL' || country === 'CO' || country === 'MX' || country === 'PE' || country === 'UY' ) {
$( '.primary-ctas .survey, \
.other-ctas, \
.other-ctas .store' ).show();
} else if ( country === 'BE' || country === 'CZ' || country === 'NO' ) {
$( '.primary-ctas .survey, \
.other-ctas' ).show();
} else {
$( '.primary-ctas .survey' ).show();
}
if ( country === 'SE' ) {
$('.chapter-SE').show();
}
if ( country === 'CZ' ) {
$('.chapter-CZ').show();
}
if ( country === 'IT' ) {
$('.chapter-IT').show();
}
if ( country === 'AU' ) {
$('.chapter-AU').show();
}
if ( country === 'FR' ) {
$('.chapter-FR').show();
$('.tax-disclaimer-frfr').show();
}
if ( country === 'GB' ) {
$('.chapter-GB').show();
}
if ( country === 'CA' ) {
$('.chapter-CA').show();
$('.tax-disclaimer-frca').show();
}
if ( country === 'NO' ) {
$('.chapter-NO').show();
}
if ( country === 'BE' ) {
$('.chapter-BE').show();
}
if ( country === 'NL' ) {
$('.chapter-NL').show();
}
if ( country === 'NZ' ) {
$('.chapter-NZ').show();
}
/* Tax deductability disclaimer */
if ( country != 'US' && country != 'NL') {
$('.tax-disclaimer-en').show();
}
if ( country === 'ES') {
$('.tax-disclaimer-en').show();
$('.tax-disclaimer-es').show();
}
/* -- "Try editing" feature -- */
var editingUrls = {
'IN': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-in-en-2022'
},
'ZA': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-za-en-2022'
},
// Latin America
'BR': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'pt-br': 'https://pt.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-pt-2022&uselang=pt-br'
},
'AR': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'CL': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'CO': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'MX': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'PE': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
'UY': {
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-en-2022',
'es-419': 'https://es.wikipedia.org/w/index.php?title=Special:CreateAccount&geEnabled=1&campaign=typage-latam-es-2022'
},
// Northern and Western Europe
'SE': {
'sv': 'https://sv.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-sv-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-sv-2023'
},
'IT': {
'it': 'https://it.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-it-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-it-2023'
},
'FR': {
'fr': 'https://fr.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-fr-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-fr-2023'
},
'NL': {
'nl': 'https://nl.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-nl-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-nwe-nl-2023'
},
// East, Southeast Asia, and Pacific
'JP': {
'ja': 'https://ja.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-eseap-ja-2023',
'en': 'https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&campaign=typage-eseap-ja-2023'
},
};
// Separate list so we can have others in prep for proofing
var editingCTACountries = [ 'IN', 'ZA', 'BR', 'AR', 'CL', 'CO', 'MX', 'PE', 'UY',
'SE', 'IT', 'FR', 'NL', 'JP' ];
if ( editingCTACountries.indexOf(country) !== -1 || params.testEditingCTA ) {
if ( editingUrls[country] ) {
if ( editingUrls[country][pageLanguage] ) {
$( '.try-editing a' ).attr( 'href', editingUrls[country][pageLanguage] );
$( '.primary-ctas .survey' ).hide();
$( '.primary-ctas .try-editing, .other-ctas, .other-ctas .survey' ).show();
}
}
}
// Only show survey 25% of time on English page
//if ( pageLanguage === 'en' ) {
// if ( Math.random() > 0.25 ) {
// $('.survey').hide();
// }
//}
if ( pageLanguage === 'en' ) {
var surveyNumber = Math.random();
if ( surveyNumber > 0.5 ) {
$('.survey').hide();
} else if ( surveyNumber > 0.25 && surveyNumber <= 0.5 ) {
$('.survey-1').hide();
} else if ( surveyNumber > 0 && surveyNumber <= 0.25 ) {
$('.survey-2').hide();
}
}
// Don't show editing CTAs on apps: https://phabricator.wikimedia.org/T353023
if ( params.utm_medium === 'WikipediaApp' || params.wmf_medium === 'WikipediaApp' ) {
$('.other-ctas .edit-6c, .primary-ctas .try-editing').hide();
}
// Finally, if there are no secondary CTAs shown then hide the section header
if ( $('.other-ctas .focus-block:visible').length === 0 ) {
$('.other-ctas h2').hide();
}
});
if ( navigator.share ) {
$('#ty-web-share').click(function(e) {
var url = 'https://donate.wikimedia.org/?wmf_medium=SocialMedia&wmf_campaign=ThankYouPage&wmf_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();
}
/* Show all elements for testing and checking translations */
function tyDebug() {
$('.ty-page *').show();
}
pb37s8owm0lc7k1nbbbzkuczldea6hj