MediaWiki:Centralnotice-template-B1819 120623 en2C m p2 sm opt les
<style> /* Box-sizing */ .frb, .frb *, .frb *:before, .frb *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
/* Hide when printed */ @media print {
.frb { display: none !important; }
}
/* In-article banner styles
*/
- frb-inline {
display: table; position: relative; background: white; color: black; font-size: 14px; line-height: 1.2; /*16.8px @14px*/ margin-top: 14px; -webkit-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out; -o-transition: all .2s ease-in-out; -ms-transition: all .2s ease-in-out; transition: all .2s ease-in-out;
}
/*Removing space above infobox below 720px*/ .infobox:first-of-type {
margin-top: 0;
}
.frb-inline-border {
position: relative; border: 5px solid #990000; border-radius: 1em; background-color: #E5E5EA;
}
.frb-inline-border:before {
content: ""; display: block; width: 27px; height: 18px; position: absolute; left: -18px; bottom: -5px; border-right: 1em solid #990000; border-bottom-right-radius: 100%;
}
body.rtl .frb-inline-border:before {
left: auto; border-right: none; border-bottom-right-radius: 0; right: -18px; border-left: 1em solid #990000; border-bottom-left-radius: 100%;
}
.frb-inline-border:after {
content: ""; display: block; width: 20px; height: 13px; position: absolute; left: -6px; bottom: .5px; border-right: 1em solid #E5E5EA; border-bottom-right-radius: 100%;
}
body.rtl .frb-inline-border:after {
left: auto; border-right: none; border-bottom-right-radius: 0; right: -6px; border-left: 1em solid #E5E5EA; border-bottom-left-radius: 100%;
}
@media (max-width : 719px) { #frb-inline { clear: both; } }
html[lang="en"] #frb-inline {
font-size: 14px;
}
.frb-inline-message {
padding: 8px 11px; font-size: 16px;
}
.frb-inline-message .frb-icon-info {
height: 16px; margin-bottom: -2px;
}
.hidden-text p {
margin: .5em 0 0;
}
.frb-form {
margin-top: 0; padding: 0 11px 8px 11px;
}
.frb-form ul {
padding: 0;
}
.frb-fieldset {
margin-bottom: 8px;
}
/* --- Form legends --- */
.frb-form legend {
width: 100%; margin: 0 0 5px; text-align: center; font-size: 14px; font-weight: 500; color: #222; -webkit-transition: color .2s ease-in-out; -moz-transition: color .2s ease-in-out; transition: color .2s ease-in-out;
}
.frb-form fieldset.frb-haserror .error-highlight {
color: #d33;
}
/* --- Common Button Styles --- */
.frb-btn {
display: block; background-color: #f8f9fa; color: #222; border: 1px solid #9aa0a7; border-radius: 2px; padding: 12px 6px; outline: 0; text-align: center; font-size: 16px; line-height: 1; /*16px @16px*/ cursor: pointer; font-family: inherit; font-weight: 500; transition: background 100ms, color 100ms, border-color 100ms, box-shadow 100ms;
} .frb-btn:hover {
background-color: #fff; color: #444; border-color: #a2a9b1;
} .frb-btn:active {
background-color: #d9d9d9; color: #000; border-color: #7d8389;
}
.frb-btn:focus, .frb-fieldset input[type="radio"]:focus + label, .frb-fieldset input[type="radio"]:focus + .frb-btn, .frb-frq-switch.is-active {
border-color: #36c; box-shadow: inset 0 0 0 1px #36c;
}
- frb-form input[type="radio"]:checked + .frb-btn,
- frb-form .frb-btn.checked {
background-color: #2a4b8d; color: #fff; border-color: #7d8389;
}
/* Blue text buttons */ .frb-btn.frb-btn-btxt {
color: #36c;
} .frb-btn.frb-btn-btxt:active {
color: #2a4b8d;
}
/* Submit/Continue buttons (blue background) */ .frb-submit {
display: block; width: 100%; margin-top: 8px; padding: 12px 8px; color: #fff; background-color: #36c; border-color: #36c; cursor: pointer; border: 0; border-radius: 2px; font-size: 14px; font-weight: 500; transition: background 100ms, color 100ms, border-color 100ms, box-shadow 100ms;
} .frb-submit:hover {
background-color: #447ff5; border-color: #447ff5;
} .frb-submit:active {
background-color: #2a4b8d; border-color: #2a4b8d; box-shadow: none;
}
.frb-continue .frb-submit {
font-size: 16px;
}
/* Hide radio buttons. Based on http://jqueryui.com/button/#radio */ .frb-ptf-checkbox, .frb-fieldset li input[type="radio"], .frb-frequency li input[type="radio"] {
position: absolute; overflow: hidden; height: 1px; width: 1px; clip: rect(0 0 0 0); border: 0; margin: -1px; padding: 0;
}
/* --- Amount buttons layout --- */
.frb-fieldset ul li {
display: block; width: 49%; clear: none; float: left; margin-bottom: 6px; margin-right: 2%;
}
body.rtl .frb-fieldset ul li{
float: right; margin-right: 0; margin-left: 2%;
}
.frb-frequency ul li:last-child, .frb-optin ul li:last-child {
margin-right: 0;
}
body.rtl .frb-frequency ul li:last-child, body.rtl .frb-optin ul li:last-child {
margin-left: 0;
}
@media (min-width : 570px) { .frb-amounts ul li { margin-bottom: 10px; } }
/* Very small screen layout, 2 amount buttons per row */ @media (max-width: 374px) {
body.ltr .frb-amounts ul li:nth-child(2n) { margin-right: 0; }
body.rtl .frb-amounts ul li:nth-child(2n) { margin-left: 0; }
}
/* Larger screen layout, 4 amount buttons per row */ @media (min-width: 375px) {
.frb-amounts ul li { width: 31.8333333%; margin-right: 1.5%; }
body.rtl .frb-amounts ul li { margin-right: 0; margin-left: 1.5%; }
body.ltr .frb-amounts ul li:nth-child(3n) { margin-right: 0; }
body.rtl .frb-amounts ul li:nth-child(3n) { margin-left: 0; }
}
/* --- Amount buttons appearance --- */
.frb-amounts li label {
font-size: 18px;
}
@media (min-width: 768px) {
.frb-amounts li label { font-size: 20px; }
}
.frb-amounts li label:active , .frb-amounts li input[type="radio"]:checked + label, .frb-amounts li input[type="radio"].checked + label, .frb-amounts li label.checked {
background-color: #2a4b8d; border-color: #7d8389; color: #fff;
}
.frb-amounts li label {
display: block; width: 100%; height: 50px; padding: 5px; font-size: 16px; line-height: 2.5; /*40px @16px*/ font-style: normal; font-weight: normal
}
/* --- Other amount --- */
- frb-amt-other-input {
margin: 0; padding: 0; background: transparent; border: none; width: 90%; color: #222222; text-align: center; direction: ltr; border-radius: 0; font-size: 16px;
}
/*Disable number spinner*/
- frb-amt-other-input::-webkit-inner-spin-button,
- frb-amt-other-input::-webkit-outer-spin-button {
-webkit-appearance: none; margin: 0;
}
- frb-amt-other-input::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: #222222;
}
- frb-amt-other-input::-moz-placeholder { /* Firefox 19+ */
color: #222222;
}
- frb-amt-other-input:-moz-placeholder { /* Firefox 18- */
color: #222222;
}
- frb-amt-other-input:-ms-input-placeholder { /* IE 10+ */
color: #222222;
}
/* Placeholder focus styles */ .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input:focus::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: #fff;
} .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input:focus:-moz-placeholder { /* Firefox 18- */
color: #fff; opacity: 1 !important;
} .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input:focus::-moz-placeholder { /* Firefox 19+ */
color: #fff; opacity: 1 !important;
} .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input:focus:-ms-input-placeholder { /* IE 10+ */
color: #fff;
}
/* Placeholder checked styles */ .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: #fff;
} .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input:-moz-placeholder { /* Firefox 18- */
color: #fff;
} .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input::-moz-placeholder { /* Firefox 19+ */
color: #fff;
} .frb-amounts input[type="radio"]:checked + #frb-amt-other-label #frb-amt-other-input:-ms-input-placeholder { /* IE 10+ */
color: #fff;
}
- frb-amt-other-label {
background: #f8f9fa; border: 1px solid #9aa0a7; color: #555; padding-left: 3px;
}
- frb-amt-other:checked + #frb-amt-other-label #frb-amt-other-input {
color: #FFFFFF;
}
/* --- Pay the fee --- */ .frb-ptf {
clear: both; line-height: 1; padding: 8px 14px 0px; text-align: left; margin-bottom: 12px;
}
.frb-ptf-checkbox:focus + .frb-ptf-label .frb-ptf-img {
box-shadow: inset 0 0 0 1px #36c, inset 0 0 0 2px #FFFFFF;;
}
.frb-ptf-checkbox:focus + .frb-ptf-label .frb-ptf-img {
border-radius: 5px;
}
.frb-ptf-checkbox + .frb-ptf-label .frb-ptf-img {
display: inline-block; margin-bottom: -4px; width: 32px; height: 32px; background-image: url('https://upload.wikimedia.org/wikipedia/donate/b/b1/Wmf-frb-checkbox.png'); background-size: 64px; background-repeat: no-repeat; background-position: 0 0;
}
.frb-ptf-checkbox:checked + .frb-ptf-label .frb-ptf-img {
background-position: -32px 0;
}
.frb-ptf-label {
display: table; cursor: pointer;
}
.frb-ptf-cell {
display: table-cell; vertical-align: middle;
}
.frb-ptf-cell:first-child {
padding-left: 2px;
}
body.rtl .frb-ptf-cell:first-child {
padding-left: 0; padding-right: 2px;
}
.frb-ptf-cell:nth-child(2) {
padding-left: 10px; font-size: 14px; font-weight: 500;
}
body.rtl .frb-ptf-cell:nth-child(2) {
padding-left: 0; padding-right: 10px;
}
/* --- Payment method buttons layout --- */
.form-monthly .no-monthly {
display: none !important;
}
/* Always horizontal */ .frb-methods ul {
display: table; table-layout: fixed; width: 100%;
} .frb-methods ul li {
display: table-cell; padding: 0 4px; vertical-align: top;
}
/* Only where there are 4 methods, display 2x2 */ .frb-methods ul li:first-child:nth-last-child(4), .frb-methods ul li:first-child:nth-last-child(4) ~ li {
float: left; width: 50%; margin-bottom: 4px;
}
.frb-methods ul li:first-child:nth-last-child(4) .frb-btn, .frb-methods ul li:first-child:nth-last-child(4) ~ li .frb-btn {
min-height: 32px;
}
/* --- Payment method buttons appearance --- */
.frb-methods .frb-btn {
width: 100%; padding: 7px; min-height: 50px;
}
/*Adjust padding for method buttons with logo, e.g. payment methods*/ .frb-methods .frb-btn-logo {
padding: 2px 8px;
}
/*Payment method buttons logo sizing*/ .frb-btn-logo svg {
width: 100%; height: 100%; max-height: 24px;
}
.frb-logo-paypal-usd {
margin-bottom: -4px;
}
.frb-methods legend, .frb-methods button {
-webkit-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out; transition: all .2s ease-in-out;
}
.frb-methods.hint legend {
color: #588fbb;
} .frb-methods.hint button {
box-shadow: 0 0 5px #588fbb;
}
/* --- Close and RML Options --- */
.frb-inline-close-bottom-wrapper {
width: 100%; text-align: center;
}
.frb-inline-rml-wrapper {
display: inline-block; position: relative; padding: 0;
}
.frb-inline-close {
z-index: 999; color: #999999;
}
.frb-inline-close, .frb-inline-rml-link {
padding: 9px; text-transform: uppercase; cursor: pointer; line-height: 18px; /*fixed line height due to normal/bold difference*/
}
.frb-inline-rml-link {
display: inline-block; margin-left: 1px;
}
/* Close button icon */ .frb-close-x {
margin-bottom: -2px; width: 11px;
}
.frb-close-x g {
stroke: #999999;
}
.frb-inline-close-txt, .frb-inline-rml-txt {
font-size: 12px; letter-spacing: 0.2px;
}
/* RML text color */ .frb-inline-rml-txt {
color: #3366cc; font-weight: bold;
}
/* RML clock icon */ .frb-inline-rml-icon {
margin-bottom: -3px; width: 13px;
}
.frb-inline-rml-icon path {
fill: #3366cc;
}
.frb-inline-rml-icon circle {
stroke: #3366cc;
}
.frb-inline-rml-link:hover .frb-inline-rml-txt {
color: #000000;
}
.frb-inline-rml-link:hover .frb-inline-rml-icon path {
fill: #000000;
}
.frb-inline-rml-link:hover .frb-inline-rml-icon circle {
stroke: #000000;
}
/* Close hover and focus */ .frb-inline-close:hover .frb-inline-close-txt, .frb-inline-close:focus .frb-inline-close-txt, .frb-inline-rml-form-close:hover .frb-inline-rml-form-close-txt, .frb-inline-rml-form-close:focus .frb-inline-rml-form-close-txt {
color: #000000;
}
.frb-inline-close:hover .frb-close-x g, .frb-inline-close:focus .frb-close-x g, .frb-inline-rml-form-close:hover .frb-inline-rml-form-close-icon g, .frb-inline-rml-form-close:focus .frb-inline-rml-form-close-icon g {
stroke: #000000;
}
/* --- Remind Me Later (inline) --- */ .frb-rml-disabled .frb-inline-rml-wrapper {
display: none;
}
.frb-inline-rml-link {
position: relative; text-transform: uppercase; display: inline-block; cursor: pointer; color: #666;
}
.frb-inline-rml {
display: none; cursor: default; margin: 2px auto 16px; padding: 14px 14px 4px 14px; z-index: 10000; width: 100%; background: #fff; color: #000; border: 1px solid #aaa; border-radius: 2px; box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.15); text-transform: none;
}
.frb-inline-close-bottom-wrapper.active .frb-inline-rml-wrapper:before, .frb-inline-close-bottom-wrapper.active .frb-inline-rml-wrapper:after {
display: block;
}
.frb-inline-rml-wrapper:before, .frb-inline-rml-wrapper:after {
display: none; bottom: -3px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; left: auto; right: 5px; pointer-events: none;
}
body.rtl .frb-inline-rml-wrapper:before, body.rtl .frb-inline-rml-wrapper:after {
left: 5px; right: auto;
}
.frb-inline-rml-wrapper:before {
border-bottom-color: #888; border-width: 11px;
}
.frb-inline-rml-wrapper:after {
border-bottom-color: #fff; border-width: 10px; margin-right: 1px; /*Triangle pixel glitch fix (margin left and right)*/ margin-left: 0;
}
/* Triangle pixel glitch fix for RTL */ body.rtl .frb-inline-rml-wrapper:after {
margin-right: 0; margin-left: 1px;
}
.frb-inline-rml-form form {
display: table; width: 100%; text-align: center; font-weight: 500;
}
.frb-inline-rml-label {
font-weight: normal; line-height: 1.6923076923; /*22px @14px*/
}
.frb-inline-rml-form input {
background: #fff; width: 100%; display: block; padding: 7px; margin: 0; font-size: inherit; font-family: inherit; color: #000; border: 1px solid #9aa0a7; border-radius: 2px;
}
.frb-inline-rml-form input.error {
border-color: #d33; box-shadow: inset 0 0 0 1px #d33;
}
.frb-inline-rml-form #errorMessageContainerId {
color: #d33; margin-top: 4px;
} .frb-inline-rml-done {
text-align: left; font-size: 15px;
}
body.rtl .frb-inline-rml-done {
text-align: right;
}
.frb-inline-rml-form .smallprint {
margin-top: 5px; font-size: 11px; color: #555; line-height: 1.4;/*15.4px @11px*/
}
.frb-inline-rml-form-close-wrapper {
padding-top: 4px; text-align: center;
}
.frb-inline-rml-form-close {
margin: 6px auto 0 auto; color: #999999; font-size: 11px; cursor: pointer;
}
.frb-inline-rml-form-close-txt {
text-transform: uppercase;
}
.frb-inline-rml-form-close-icon {
width: 9px; height: 9px;
}
.frb-inline-rml-form-close-icon g {
stroke: #999999;
}
/* --- Smallprint --- */
- frb-inline #frbanner-smallprint {
width: 100%; font-size: 80%; margin-top: 23px; text-align: center; color: #3c3c3c;
}
- frb-inline .recurring-details {
display: none;
}
/* Bottom "nag" banner styles
*/
- frb-nag {
z-index: 100; position: fixed; left: 0; bottom: 0; width: 100%; display: block; color: black; background-color: white; padding: 10px 25px; text-align: center; font-size: 15px; line-height: 1; /*15px @15px*/ font-weight: bold; border: 5px solid #990000; box-shadow: 0 0 10px rgba(0,0,0,.5); cursor: pointer;
}
- frb-nag:hover {
text-decoration: none;
}
@media (min-width: 720px) {
#frb-nag { font-size: 17px; }
}
- frb-nag .frb-icon-info {
height: 19px; width: 19px; margin-bottom: -3px; padding-right: 4px;
}
body.rtl #frb-nag .frb-icon-info {
padding-right: 0; padding-left: 4px;
}
- frb-nag .frb-btn {
display: inline-block; font-size: 12px; padding: 3px 6px;
}
.frb-nag-message {
vertical-align: middle; margin-bottom: 8px; line-height: 1.1; /*16.5px @15px*/
} .frb-nag-message:hover {
text-decoration: underline;
}
.frb-nag-close {
position: absolute; display: block; border: 2px solid black; background-color: #fff; top: -20px; right: -5px; width: 35px; height: 35px; padding: 5px; cursor: pointer; border-radius: 50%; box-shadow: 0 0 10px rgba(0,0,0,.3); -webkit-transition: all .25s ease-in-out; -moz-transition: all .25s ease-in-out; transition: all .25s ease-in-out;
} body.rtl .frb-nag-close {
right: auto; left: -5px;
}
.frb-nag-close:active {
-moz-transform: scale(1.05); -ms-transform: scale(1.05); -webkit-transform: scale(1.05); transform: scale(1.05);
}
.frb-icon-nag-close {
margin-top: 2px; width: 18px; height: 18px;
}
/* give the footer padding so it's visible above the nag */ footer {
padding-bottom: 120px;
}
/*!--- Focus styles ----*/
/*Outline reset*/ .frb-rml-link:focus, .frb-submit:focus,
- frb-amt-other-input:focus,
.email_input:focus, .frb-submit:focus {
outline: 0;
}
.frb-rml-link:focus {
box-shadow: inset 0 0 0 2px #f2f2f2, inset 0 0 0 4px #36c;
}
.smallprint a:focus {
outline: 2px solid #36c;
}
.frb-btn-submit:focus, .frb-fieldset input[type="radio"]:checked + label:focus, .frb-fieldset input[type="radio"]:checked + .frb-btn:focus, .frb-fieldset input[type="radio"]:checked:focus + label, .frb-fieldset input[type="radio"]:checked:focus + .frb-btn, .frb-amt-other.is-focused .frb-btn, .frb-input-email:focus, .frb-btn-submit:focus {
border-color: #36c; box-shadow: inset 0 0 0 1px #36c, inset 0 0 0 2px #fff;
}
/* Error messages */ .frb-form .frb-error {
display: none; margin: 4px 0; color: #d33;
}
/* Email optin */ .frb-optin-no-prompt {
display: none; clear: both; padding: 6px 12px 7px; border: 1px solid #b32424; background-color: #fee7e6; border-radius: 2px; font-size: 14px; line-height: 1.2857142857; /*18px @14px*/ font-weight: normal;
}
.frb-optin-no-prompt.is-positive {
border-color: #14866d; background-color: #d5fdf4; font-weight: bold;
}
.frb-optin-no-prompt__yes {
display: none;
}
.frb-optin-no-prompt__no {
display: block;
}
.frb-optin-no-prompt.is-positive .frb-optin-no-prompt__yes {
display: block;
}
.frb-optin-no-prompt.is-positive .frb-optin-no-prompt__no {
display: none;
} </style>
<script> var frb = frb || {};
frb.storedOptions = {};
frb.setMethod = function(options) {
frb.storedOptions = options || { method: 'cc' }; // Default to credit card
$('.frb-methods').fadeOut('fast', function() { if ( frb.shouldShowRecurring( frb.storedOptions, mw.centralNotice.data.country ) ) { $('.frb-frequency, .recurring-details').show(); } $('#frb-inline-close-options').hide(); $('.frb-step2, .hidden-text').fadeIn('fast'); });
};
frb.insertInlineBanner = function() {
// Place frb-inline in article, before first paragraph or at top var $inlineBanner = $('#frb-inline'); var $firstPara = $('.mw-parser-output > div > p:not(.mw-empty-elt)').first();
if ( $firstPara.length > 0 && !mw.config.get('wgIsMainPage') ) { $firstPara.before( $inlineBanner ); } else { $('#mw-content-text').prepend( $inlineBanner ); }
$inlineBanner.show();
};
frb.postReminderForm = function() {
// Create the iframe for the form and use it as the form's target var frameName = "remindFrame"; var $form = $(".frb-inline-rml-form form"); if ($("iframe[name=" + frameName + "]").length == 0) { var $iframe = $('<iframe style="display: none;" name="' + frameName + '"></iframe>'); $form.attr("target", $iframe.attr("name")); $form.after($iframe); } $form[0].submit();
};
frb.getCurrentDate = function() {
var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear();
if(dd<10) { dd='0'+dd; } if(mm<10) { mm='0'+mm; }
today = mm+'/'+dd+'/'+yyyy; return today;
};
frb.initReminderForm = function() {
$(".frb-inline-rml-form input[name=rml_country]").val(mw.centralNotice.data.country); $(".frb-inline-rml-form input[name=rml_language]").val(mw.config.get('wgUserLanguage')); $(".frb-inline-rml-form input[name=rml_submitDate]").val(frb.getCurrentDate()); $(".frb-inline-rml-form input[name=rml_segment]").val(Math.floor((Math.random() * 100) + 1));
$(".frb-nag-rml-form input[name=rml_country]").val(mw.centralNotice.data.country); $(".frb-nag-rml-form input[name=rml_language]").val(mw.config.get('wgUserLanguage')); $(".frb-nag-rml-form input[name=rml_submitDate]").val(frb.getCurrentDate()); $(".frb-nag-rml-form input[name=rml_segment]").val(Math.floor((Math.random() * 100) + 1));
$(".frb-inline-rml-link").on('click keypress', function(e) { if (e.which === 13 || e.type === 'click') { $('.frb-inline-rml').toggle(); $('.frb-inline-close-bottom-wrapper').toggleClass('active'); // Use standard JS focus() method not jQuery, because of IE10 scrolling bug // https://phabricator.wikimedia.org/T162049 $('.frb-inline-rml .email_input').get(0).focus(); } });
$(".frb-nag-rml-link").on('click keypress', function(e) { if (e.which === 13 || e.type === 'click') { $('.frb-nag-rml').toggle(); $('.frb-nag-rml .email_input').get(0).focus(); return false; } });
$(".frb-inline-rml-form button").bind("click keypress", function(e) { if (e.which === 13 || e.type === 'click') { if ( mw.util.validateEmail( $(".frb-inline-rml-form form input[name='Email']").val() ) ) { frb.postReminderForm(); $(".frb-inline-rml-form form").hide(); $(".frb-inline-rml-done").show(); $(".frb-inline-rml").delay(2000).fadeOut(1000, function(){ $("#frb-inline").hide(); // Hide banner $("#centralNotice").hide(); // Hide nag }); mw.centralNotice.internal.hide.setHideWithCloseButtonCookies(); // Hide future banners for 7 days return false; } else { $(".frb-inline-rml-form form input[name='Email']").addClass("error"); $(".frb-inline-rml-form #errorMessageContainerId").show(); $('.frb-inline-rml .email_input').get(0).focus(); return false; } } });
$(".frb-nag-rml-form button").bind("click keypress", function(e) { if (e.which === 13 || e.type === 'click') { if ( mw.util.validateEmail( $(".frb-nag-rml-form form input[name='Email']").val() ) ) { frb.postNagReminderForm(); $(".frb-nag-rml-form form").hide(); $(".frb-nag-rml .frb-inline-rml-done").show(); $(".frb-nag-rml-form form").hide(); $(".frb-nag-rml-done").show(); $(".frb-nag-rml").delay(2000).fadeOut(1000, function(){ $('#frb-nag').hide(); }); mw.centralNotice.internal.hide.setHideWithCloseButtonCookies(); // Hide future banners for 7 days return false; } else { $(".frb-nag-rml-form form input[name='Email']").addClass("error"); $(".frb-nag-rml-form #errorMessageContainerId").show(); $('.frb-nag-rml .email_input').get(0).focus(); return false; } } });
};
frb.initNag = function() {
/* --- Code for sticky "nag" banner --- */ var nagHoverTimeout;
$(window).scroll(function() { var nagRevealPosition = $('#frb-inline').offset().top + $('#frb-inline').outerHeight();
if ( $(window).scrollTop() <= nagRevealPosition ) { $('#frb-nag').finish(); $('#frb-nag').hide(); } else { setTimeout(function(){ if ( $(window).scrollTop() > nagRevealPosition ) { $('#frb-nag').slideDown(); } }, 1500); } });
$('.frb-nag-close').click(function(e) { $('#centralNotice').hide(); // Hide nag (but not inline banner) e.stopPropagation(); });
$('#frb-nag').click(function() { $('html, body').animate({ scrollTop: $('#frb-inline').offset().top }, 400); $('#frb-nag').slideToggle(400); frb.extraData.clickedNag = 1; });
};
frb.amounts = frb.amounts || {};
// Hard minimum amounts that can be given frb.amounts.minimums = {
/* From https://github.com/wikimedia/wikimedia-fundraising-SmashPig/blob/master/PaymentData/ReferenceData/CurrencyRates.php */ 'ADF' : 5.65, 'ADP' : 143, 'AED' : 3.67, 'AFA' : 73, 'AFN' : 73, 'ALL' : 109, 'AMD' : 477, 'ANG' : 1.79, 'AOA' : 278, 'AON' : 278, 'ATS' : 12, 'AUD' : 1.39, 'AWG' : 1.78, 'AZM' : 8486, 'AZN' : 1.7, 'BAM' : 1.69, 'BBD' : 2, 'BDT' : 83, 'BEF' : 35, 'BGL' : 1.69, 'BGN' : 1.69, 'BHD' : 0.38, 'BIF' : 1748, 'BMD' : 1, 'BND' : 1.38, 'BOB' : 6.8, 'BRL' : 4.15, 'BSD' : 1, 'BTN' : 72, 'BWP' : 11, 'BYR' : 21035, 'BZD' : 1.98, 'CAD' : 1.32, 'CDF' : 1573, 'CHF' : 0.98, 'CNY' : 6.83, 'CRC' : 572, 'CUC' : 1, 'CUP' : 25, 'CVE' : 95, 'CYP' : 0.51, 'CZK' : 22, 'DEM' : 1.69, 'DJF' : 178, 'DKK' : 6.42, 'DOP' : 50, 'DZD' : 118, 'ECS' : 24094, 'EEK' : 13, 'EGP' : 18, 'ESP' : 143, 'ETB' : 27, 'EUR' : 0.87, 'FIM' : 5.12, 'FJD' : 2.1, 'FKP' : 0.78, 'FRF' : 5.65, 'GBP' : 0.78, 'GEL' : 2.52, 'GHC' : 47467, 'GHS' : 4.75, 'GIP' : 0.78, 'GMD' : 48, 'GNF' : 8983, 'GRD' : 294, 'GTQ' : 7.5, 'GYD' : 204, 'HKD' : 7.85, 'HNL' : 24, 'HRK' : 6.4, 'HTG' : 68, 'HUF' : 282, 'IDR' : 14966, 'IEP' : 0.68, 'ILS' : 3.61, 'INR' : 72, 'IQD' : 1178, 'IRR' : 42000, 'ISK' : 109, 'ITL' : 1669, 'JMD' : 136, 'JOD' : 0.71, 'JPY' : 112, 'KES' : 100, 'KGS' : 69, 'KHR' : 4025, 'KMF' : 424, 'KPW' : 135, 'KRW' : 1120, 'KWD' : 0.31, 'KYD' : 0.84, 'KZT' : 369, 'LAK' : 8393, 'LBP' : 1508, 'LKR' : 162, 'LRD' : 154, 'LSL' : 15, 'LTL' : 2.98, 'LUF' : 35, 'LVL' : 0.61, 'LYD' : 1.37, 'MAD' : 9.39, 'MDL' : 17, 'MGA' : 3311, 'MGF' : 9150, 'MKD' : 53, 'MMK' : 1529, 'MNT' : 2460, 'MOP' : 8.08, 'MRO' : 357, 'MTL' : 0.37, 'MUR' : 33, 'MVR' : 15, 'MWK' : 717, 'MYR' : 4.15, 'MZM' : 59754, 'MZN' : 60, 'NAD' : 15, 'NGN' : 359, 'NIO' : 32, 'NLG' : 1.9, 'NOK' : 8.4, 'NPR' : 114, 'NZD' : 1.52, 'OMR' : 0.39, 'PAB' : 1, 'PEN' : 3.3, 'PGK' : 3.26, 'PHP' : 54, 'PKR' : 123, 'PLN' : 3.72, 'PTE' : 173, 'PYG' : 5763, 'QAR' : 3.57, 'ROL' : 39889, 'RON' : 3.99, 'RSD' : 101, 'RUB' : 68, 'RWF' : 862, 'SAR' : 3.75, 'SBD' : 7.6, 'SCR' : 13, 'SDD' : 1795, 'SDG' : 18, 'SDP' : 2261, 'SEK' : 9.08, 'SGD' : 1.38, 'SHP' : 0.78, 'SIT' : 207, 'SKK' : 26, 'SLL' : 8430, 'SOS' : 542, 'SRD' : 7.41, 'SRG' : 7408, 'STD' : 21070, 'SVC' : 8.75, 'SYP' : 215, 'SZL' : 15, 'THB' : 33, 'TJS' : 9.36, 'TMM' : 17050, 'TMT' : 3.41, 'TND' : 2.76, 'TOP' : 2.29, 'TRL' : 6629223, 'TRY' : 6.63, 'TTD' : 6.64, 'TWD' : 31, 'TZS' : 2281, 'UAH' : 28, 'UGX' : 3749, 'USD' : 1, 'UZS' : 7780, 'VEB' : 6050841136, 'VEF' : 6050841, 'VND' : 23150, 'VUV' : 111, 'WST' : 2.64, 'XAF' : 565, 'XCD' : 2.7, 'XOF' : 565, 'XPF' : 103, 'YER' : 250, 'YUN' : 101, 'ZAR' : 15, 'ZMK' : 5176, 'ZWD' : 373, /* Astropay currencies have higher minimums - 1.50 USD */ 'ARS' : 58.5, 'BRL' : 6.23, 'CLP' : 1035, 'COP' : 4640, 'MXN' : 28.5
};
frb.amounts.options7 = {
// Big English 'USD' : [2.75, 5, 10, 20, 30, 50, 100], 'CAD' : [2.75, 5, 10, 20, 30, 50, 100], 'AUD' : [2.75, 5, 10, 20, 30, 50, 100], 'NZD' : [2.75, 5, 10, 20, 30, 50, 100], 'GBP' : [2, 5, 10, 20, 30, 50, 100], 'EUR' : { 'default' : [2, 5, 10, 20, 30, 50, 100] }, // Others 'DKK' : [20, 100, 150, 200, 300, 500, 1000], 'HUF' : [500, 1000, 2000, 4000, 5000, 7000, 10000], 'ILS' : [10, 50, 100, 200, 300, 500, 1000], 'JPY' : [300, 1000, 1500, 2000, 3000, 5000, 10000], 'MYR' : [10, 30, 50, 100, 200, 300, 500], 'NOK' : [20, 100, 150, 200, 500, 750, 1000], 'PLN' : [10, 20, 50, 100, 200, 300, 500], 'RON' : [10, 50, 75, 100, 200, 300, 500], 'SEK' : [30, 50, 100, 200, 300, 500, 1000], 'UAH' : [50, 75, 150, 300, 500, 750, 1000], 'ZAR' : [30, 50, 100, 200, 300, 500, 1000], // Latin America 'BRL' : [10, 20, 30, 50, 100, 250, 500], 'ARS' : [60, 100, 200, 400, 1000, 1500, 2000], 'CLP' : [1500, 2500, 5000, 10000, 15000, 25000, 50000], 'COP' : [7000, 10000, 20000, 50000, 100000, 150000, 200000], 'MXN' : [35, 50, 100, 200, 500, 750, 1000], 'PEN' : [10, 30, 50, 150, 200, 275, 700], 'UYU' : [70, 100, 200, 400, 1000, 1500, 2000]
};
// 5 amount options. Used e.g. on mobile // Usual formula: take 1st, 3rd, 4th, 6th and 7th from asks7 */ frb.amounts.options5 = {
// Big English 'USD' : [2.75, 16.36, 20, 50, 100], 'CAD' : [2.75, 15, 20, 50, 100], 'AUD' : [2.75, 15, 20, 50, 100], 'NZD' : [2.75, 15, 20, 50, 100], 'GBP' : [2, 10, 20, 50, 100], 'EUR' : [2, 10, 20, 50, 100], // Others 'DKK' : [20, 100, 200, 500, 1000], 'HUF' : [500, 2500, 4000, 7000, 10000], 'ILS' : [10, 50, 200, 600, 1000], 'JPY' : [300, 1500, 2000, 5000, 10000], 'MYR' : [10, 50, 100, 300, 500], 'NOK' : [20, 100, 200, 500, 1000], 'PLN' : [10, 50, 100, 300, 500], 'RON' : [10, 50, 100, 200, 1000], 'SEK' : [30, 100, 200, 500, 1000], 'UAH' : [50, 150, 300, 750, 1000], 'ZAR' : [30, 100, 200, 500, 1000], // Latin America 'BRL' : [10, 30, 50, 100, 250], 'ARS' : [60, 200, 400, 1000, 2000], 'CLP' : [1500, 5000, 10000, 25000, 50000], 'COP' : [7000, 20000, 50000, 150000, 200000], 'MXN' : [35, 100, 200, 750, 1000], 'PEN' : [10, 50, 150, 300, 700], 'UYU' : [70, 200, 400, 1500, 2000]
};
/* "Average" donation */ frb.amounts.averages = {
'USD' : 16.36, 'CAD' : 15, 'AUD' : 15, 'NZD' : 15, 'GBP' : 10, 'EUR' : 10, // Others 'DKK' : 100, 'HUF' : 2500, 'ILS' : 50, 'JPY' : 1500, 'MYR' : 50, 'NOK' : 100, 'PLN' : 50, 'RON' : 50, 'SEK' : 100, 'UAH' : 150, 'ZAR' : 150, // Latin America 'BRL' : 25, 'ARS' : 200, 'CLP' : 8000, 'COP' : 30000, 'MXN' : 150, 'PEN' : 40, 'UYU' : 300
};
// 'If everyone gave X'. Mostly the same as first asks option. frb.amounts.ifEveryone = {
// Big English 'USD' : 2.75, 'CAD' : 2.75, 'AUD' : 2.75, 'NZD' : 2.75, 'GBP' : 2, 'EUR' : { 'default' : 2 }, // Others 'DKK' : 20, 'HUF' : 500, 'ILS' : 10, 'JPY' : 300, 'MYR' : 10, 'NOK' : 20, 'PLN' : 10, 'RON' : 10, 'SEK' : 30, 'UAH' : 50, 'ZAR' : 30, // Latin America 'BRL' : 10, 'ARS' : 60, 'CLP' : 1500, 'COP' : 7000, 'MXN' : 35, 'PEN' : 10, 'UYU' : 70
};
// Minimum fee/PTF amounts. Default is 1. // Updated 2018-07-05 based on Ppena's feedback frb.amounts.feeMinimums = {
'DKK' : 6, 'HUF' : 50, 'ILS' : 2, 'MYR' : 1, 'NOK' : 8, 'PLN' : 2, 'RON' : 2, 'SEK' : 10, 'UAH' : 2, 'ZAR' : 1.2, // Latin America 'BRL' : 2, 'ARS' : 1.5, 'CLP' : 300, 'COP' : 500, 'PEN' : 1.5, 'MXN' : 2, 'UYU' : 10
};
frb.currencyFormats = {
'USD' : '$\t', 'CAD' : { 'fr' : '$\t', 'default' : '$\t' }, 'AUD' : '$\t', 'NZD' : '$\t', 'GBP' : '£\t', 'EUR' : { 'en' : '€\t', 'cy' : '€\t', 'ga' : '€\t', 'mt' : '€\t', 'nl' : '€ \t', 'lv' : '€ \t', 'tr' : '€ \t', 'default' : '\t €' }, // Others 'DKK' : '\t kr.', 'HUF' : '\t Ft', 'ILS' : { 'he' : '\t ₪', 'yi' : '\t ₪', 'ar' : '\t ₪', 'default' : '₪ \t' }, 'JPY' : '¥\t', 'MYR' : 'RM\t', 'NOK' : '\t kr', 'PLN' : '\t zł', 'RON' : '\t lei', 'SEK' : '\t kr', 'UAH' : '₴\t', 'ZAR' : 'R \t', // Latin America 'BRL' : 'R$\t', 'ARS' : '$\t', 'CLP' : '$\t', 'COP' : '$\t', 'MXN' : '$\t', 'PEN' : 'S/. \t', 'UYU' : '$U \t'
};
// Check in user language first, then fall back to English frb.countryNames = {
'en' : { 'US' : 'the U.S.', 'CA' : 'Canada', 'GB' : 'the UK', 'IE' : 'Ireland', 'AU' : 'Australia', 'NZ' : 'New Zealand', 'AR' : 'Argentina', 'AT' : 'Austria', 'BE' : 'Belgium', 'BR' : 'Brazil', 'CL' : 'Chile', 'CO' : 'Colombia', 'DK' : 'Denmark', 'ES' : 'Spain', 'FR' : 'France', 'HK' : 'Hong Kong', 'HU' : 'Hungary', 'IL' : 'Israel', 'IN' : 'India', 'IT' : 'Italy', 'JP' : 'Japan', 'LU' : 'Luxembourg', 'LV' : 'Latvia', 'MX' : 'Mexico', 'MY' : 'Malaysia', 'NL' : 'the Netherlands', 'NO' : 'Norway', 'PE' : 'Peru', 'PL' : 'Poland', 'PT' : 'Portugal', 'RO' : 'Romania', 'SE' : 'Sweden', 'SK' : 'Slovakia', 'UA' : 'Ukraine', 'UY' : 'Uruguay', 'ZA' : 'South Africa' }, 'es' : { 'MX' : 'México', 'PE' : 'Perú', 'ES' : 'España' }, 'da' : { 'AT' : 'i Østrig', 'BE' : 'i Belgien', 'DK' : 'i Danmark', 'HU' : 'i Ungarn', 'IL' : 'i Israel', 'LV' : 'i Letland', 'LU' : 'i Luxembourg', 'MY' : 'i Malaysia', 'NO' : 'i Norge', 'PL' : 'i Polen', 'PT' : 'i Portugal', 'RO' : 'i Rumænien', 'SK' : 'i Slovakiet', 'ZA' : 'i Sydafrika', 'UA' : 'i Ukraine' }, 'nl' : { 'NL' : 'in Nederland', 'AT' : 'in Oostenrijk', 'BE' : 'in België', 'DK' : 'in Denemarken', 'HU' : 'in Hongarije', 'IL' : 'in Israël', 'LV' : 'in Letland', 'LU' : 'in Luxemburg', 'MY' : 'in Maleisië', 'NO' : 'in Noorwegen', 'PL' : 'in Polen', 'PT' : 'in Portugal', 'RO' : 'in Roemenië', 'SK' : 'in Slowakije', 'ZA' : 'in Zuid-Afrika', 'UA' : 'in Oekraïne' }, 'fr' : { 'AT' : 'en Autriche', 'BE' : 'en Belgique', 'DK' : 'au Danemark', 'HU' : 'en Hongrie', 'IL' : 'en Israël', 'LV' : 'en Lettonie', 'LU' : 'au Luxembourg', 'MY' : 'en Malaisie', 'NO' : 'en Norvège', 'PL' : 'en Pologne', 'PT' : 'au Portugal', 'RO' : 'en Roumanie', 'SK' : 'en Slovaquie', 'ZA' : 'en Afrique du Sud', 'UA' : 'en Ukraine' }, 'de' : { 'AT' : 'in Österreich', 'BE' : 'in Belgien', 'DK' : 'in Dänemark', 'HU' : 'in Ungarn', 'IL' : 'in Israel', 'LV' : 'in Lettland', 'LU' : 'in Luxemburg', 'MY' : 'in Malaysia', 'NO' : 'in Norwegen', 'PL' : 'in Polen', 'PT' : 'in Portugal', 'RO' : 'in Rumänien', 'SK' : 'in der Slowakei', 'ZA' : 'in Südafrika', 'UA' : 'in der Ukraine' }, 'he' : { 'AT' : 'באוסטרליה', 'BE' : 'בבלגיה', 'DK' : 'בדנמרק', 'HU' : 'בהונגריה', 'IL' : 'בישראל', 'LV' : 'בלטביה', 'LU' : 'בלוקסמבורג', 'MY' : 'במלזיה', 'NO' : 'בנורבגיה', 'PL' : 'בפולין', 'PT' : 'בפורטוגל', 'RO' : 'ברומניה', 'SK' : 'בסלובקיה', 'ZA' : 'בדרום אפריקה', 'UA' : 'באוקראינה' }, 'hu' : { 'AT' : 'Ausztriában', 'BE' : 'Belgiumban', 'DK' : 'Dániában', 'HU' : 'magyarországon', 'IL' : 'Izraelben', 'LV' : 'Lettországban', 'LU' : 'Luxemburgban', 'MY' : 'Malajziában', 'NO' : 'Norvégiában', 'PL' : 'Lengyelországban', 'PT' : 'Portugáliában', 'RO' : 'Romániában', 'SK' : 'Szlovákiában', 'ZA' : 'Dél-Afrikában', 'UA' : 'Ukrajnában' }, 'lv' : { 'AT' : 'valstī Austrijā', 'BE' : 'valstī Beļģijā', 'DK' : 'valstī Dānijā', 'HU' : 'valstī Ungārijā', 'IL' : 'Izraēlas valstī', 'LV' : 'valstī Latvijā', 'LU' : 'valstī Luksemburgā', 'MY' : 'valstī Malaizijā', 'NO' : 'valstī Norvēģijā', 'PL' : 'valstī Polijā', 'PT' : 'valstī Portugālē', 'RO' : 'valstī Rumānijā', 'SK' : 'valstī Slovākijā', 'ZA' : 'Dienvidāfrikas valstī', 'UA' : 'valstī Ukrainā' }, 'nb' : { 'AT' : 'i Østerrike', 'BE' : 'i Belgia', 'DK' : 'i Danmark', 'HU' : 'i Ungarn', 'IL' : 'i Israel', 'LV' : 'i Latvia', 'LU' : 'i Luxembourg', 'MY' : 'i Malaysia', 'NO' : 'i Norge', 'PL' : 'i Polen', 'PT' : 'i Portugal', 'RO' : 'i Romania', 'SK' : 'i Slovakia', 'ZA' : 'i Sør-Afrika', 'UA' : 'i Ukraina' }, 'pl' : { 'AT' : 'w Austrii', 'BE' : 'w Belgii', 'DK' : 'w Danii', 'HU' : 'na Węgrzech', 'IL' : 'w Izraelu', 'LV' : 'na Łotwie', 'LU' : 'w Luksemburgu', 'MY' : 'w Malezji', 'NO' : 'w Norwegii', 'PL' : 'w Polsce', 'PT' : 'w Portugalii', 'RO' : 'w Rumunii', 'SK' : 'na Słowacji', 'ZA' : 'w Republice Południowej Afryki', 'UA' : 'na Ukrainie' }, 'pt' : { 'AT' : 'na Áustria', 'BE' : 'na Bélgica', 'DK' : 'na Dinamarca', 'HU' : 'na Hungria', 'IL' : 'em Israel', 'LV' : 'na Letónia', 'LU' : 'no Luxemburgo', 'MY' : 'na Malásia', 'NO' : 'na Noruega', 'PL' : 'na Polónia', 'PT' : 'em Portugal', 'RO' : 'na Roménia', 'SK' : 'na Eslováquia', 'ZA' : 'na África do Sul', 'UA' : 'na Ucrânia' }, 'ro' : { 'AT' : 'în Austria', 'BE' : 'în Belgia', 'DK' : 'în Danemarca', 'HU' : 'în Ungaria', 'IL' : 'în Israel', 'LV' : 'în Latvia', 'LU' : 'în Luxemburg', 'MY' : 'în Malaezia', 'NO' : 'în Norvegia', 'PL' : 'în Polonia', 'PT' : 'în Portugalia', 'RO' : 'în România', 'SK' : 'în Slovacia', 'ZA' : 'în Africa de Sud', 'UA' : 'în Ucraina' }, 'ru' : { 'AT' : 'в Австрии', 'BE' : 'в Бельгии', 'DK' : 'в Дании', 'HU' : 'в Венгрии', 'IL' : 'в Израиле', 'LV' : 'в Латвии', 'LU' : 'в Люксембурге', 'MY' : 'в Малайзии', 'NO' : 'в Норвегии', 'PL' : 'в Польше', 'PT' : 'в Португалии', 'RO' : 'в Румынии', 'SK' : 'в Словакии', 'ZA' : 'в Южной Африке', 'UA' : 'в Украине' }, 'sk' : { 'AT' : 'v Rakúsku', 'BE' : 'v Belgicku', 'DK' : 'v Dánsku', 'HU' : 'v Maďarsku', 'IL' : 'v Izraeli', 'LV' : 'v Lotyšsku', 'LU' : 'v Luxembursku', 'MY' : 'v Malajzii', 'NO' : 'v Nórsku', 'PL' : 'v Poľsku', 'PT' : 'v Portugalsku', 'RO' : 'v Rumunsku', 'SK' : 'na Slovensku', 'ZA' : 'v Juhoafrickej republike', 'UA' : 'na Ukrajine' }, 'uk' : { 'AT' : 'у Австрії', 'BE' : 'у Бельгії', 'DK' : 'у Данії', 'HU' : 'в Угорщині', 'IL' : 'в Ізраїлі', 'LV' : 'у Латвії', 'LU' : 'у Люксембургу', 'MY' : 'у Малайзії', 'NO' : 'у Норвегії', 'PL' : 'у Польщі', 'PT' : 'у Португалії', 'RO' : 'у Румунії', 'SK' : 'у Словаччині', 'ZA' : 'у ПАР', 'UA' : 'в Україні' }
};
frb.dayNames = {
'en' : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ], 'es' : [ 'domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado' ], 'sv' : [ 'söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag' ], 'da' : [ 'søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag' ], 'nb' : [ 'søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag' ], 'it' : [ 'domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato' ], 'nl' : [ 'zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag' ], 'fr' : [ 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi' ], 'de' : [ 'Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag' ], 'he' : [ 'ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת' ], 'lv' : [ 'svētdienā', 'pirmdienā', 'otrdienā', 'trešdienā', 'ceturtdienā', 'piektdienā', 'sestdienā' ], 'pl' : [ 'niedzielę', 'poniedziałek', 'wtorek', 'środę', 'czwartek', 'piątek', 'sobotę' ], 'ru' : [ 'воскресенье', 'понедельник', 'вторник', 'среду', 'четверг', 'пятницу', 'субботу' ], 'uk' : [ 'неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниц', 'суботи' ], 'hu' : [ 'vasárnapon', 'hétfőn', 'kedden', 'szerdán', 'csütörtökön', 'pénteken', 'szombaton' ], 'ro' : [ 'duminica', 'lunea', 'marțea', 'miercurea', 'joia', 'vinerea', 'sâmbăta' ]
};
// "This fooday" translations. Needed for some languages where gender varies and "this" must agree frb.dayNamesThis = {
'en' : [ 'this Sunday', 'this Monday', 'this Tuesday', 'this Wednesday', 'this Thursday', 'this Friday', 'this Saturday' ], 'jp' : [ '今週の日曜日', '今週の月曜日', '今週の火曜日', '今週の水曜日', '今週の木曜日', '今週の金曜日', '今週の土曜日' ], 'it' : [ 'questa domenica', 'questo lunedì', 'questo martedì', 'questo mercoledì', 'questo giovedì', 'questo venerdì', 'questo sabato'], 'pl' : [ 'w tę niedzielę', 'w ten poniedziałek', 'w ten wtorek', 'w tę środę', 'w ten czwartek', 'w ten piątek', 'w tę sobotę' ], 'ru' : [ 'в это воскресенье', 'в этот понедельник', 'в этот вторник', 'в эту среду', 'в этот четверг', 'в эту пятницу', 'в эту субботу' ], 'uk' : [ 'цієї неділі', 'цього понеділка', 'цього вівторка', 'цієї середи', 'цього четверга', 'цієї п’ятниц', 'цієї суботи' ], 'pt' : [ 'neste domingo', 'nesta segunda-feira', 'nesta terça-feira', 'nesta quarta-feira', 'nesta quinta-feira', 'nesta sexta-feira', 'neste sábado'], 'sk' : [ 'túto nedeľu', 'tento pondelok', 'tento utorok', 'túto stredu', 'tento štvrtok', 'tento piatok', 'túto sobotu']
};
frb.iPadTranslations = {
'en' : 'iPad'
}; /* MediaWiki:FundraisingBanners/CoreJS-2018.js
* Core code for banner forms, with new inline error messages */
var frb = frb || {}; frb.loadedTime = Date.now(); frb.didSelectAmount = false;
/**
* Main function to submit to paymentswiki * * @param {Object} options * - method (required) * - submethod (optional) * - gateway (optional) * - ffname (optional) * - skipValidation (optional boolean, for pp-usd. Not yet implemented.) * @param {Boolean} isEndowment */
frb.submitForm = function(options, isEndowment) {
var uri = new mw.Uri('https://payments.wikimedia.org/index.php/Special:GatewayFormChooser'); var params = {};
if ( !frb.validateForm( options ) ) { frb.extraData.validateError = 1; // Flag they had an error, even if fixed later return false; // Error, bail out of submitting }
/* Form selection data */ params.payment_method = options.method; if ( options.submethod ) { params.payment_submethod = options.submethod; } if ( options.gateway ) { params.gateway = options.gateway; } if ( options.ffname ) { params.ffname = options.ffname; } if ( options.variant ) { params.variant = options.variant; } params.recurring = frb.getRecurring();
params.currency_code = frb.getCurrency(mw.centralNotice.data.country) || 'USD';
params.uselang = mw.centralNotice.data.uselang || 'en'; params.country = mw.centralNotice.data.country || 'XX';
if ( params.uselang === 'pt' && params.country === 'BR' ) { params.uselang = 'pt-br'; } if ( params.uselang === 'es' && ( params.country === 'AR' || params.country === 'CL' || params.country === 'CO' || params.country === 'MX' || params.country === 'PE' || params.country === 'UY' ) ) { params.uselang = 'es-419'; }
/* Adyen override. frb.ccAdyenCountries is defined in LocalizeJS-2017.js */ if ( params.payment_method === 'cc' && frb.ccAdyenCountries.indexOf( params.country ) !== -1 ) { params.gateway = 'adyen'; }
/* Amount */ var amount = frb.getAmount(); if ( $('#frb-ptf-checkbox').prop('checked') ) { amount = amount + frb.calculateFee(amount); frb.extraData.ptf = 1; } params.amount = amount;
/* Email optin */ if ( $('input[name="opt_in"]').length > 0 ) { var opt_inValue = $('input[name="opt_in"]:checked').val(); params.opt_in = opt_inValue; // frb.validateForm() already checked it's 1 or 0 params.variant = 'emailExplain'; // Show message about receipt on cc form }
/* Tracking info */ if ( isEndowment ) { params.utm_medium = 'endowment'; } else { params.utm_medium = 'sitenotice'; } params.utm_campaign = mw.centralNotice.data.campaign || 'test'; params.utm_source = frb.buildUtmSource(params);
frb.extraData.vw = window.innerWidth; frb.extraData.vh = window.innerHeight; frb.extraData.time = Math.round( (Date.now() - frb.loadedTime)/1000 );
if ( !$.isEmptyObject( frb.extraData ) ) { params.utm_key = frb.buildUtmKey( frb.extraData ); }
/* Link to Banner History if enabled */ var mixins = mw.centralNotice.getDataProperty( 'mixins' ); if ( mixins && mixins.bannerHistoryLogger ) { params.bannerhistlog = mw.centralNotice.bannerHistoryLogger.id; }
uri.extend(params);
if ( mixins && mixins.bannerHistoryLogger ) { mw.centralNotice.bannerHistoryLogger.ensureLogSent().always(function() { window.location.href = uri.toString(); }); } else { window.location.href = uri.toString(); }
};
/**
* Check the form for errors. * Called on submission, can also be called on input. */
frb.validateForm = function( options ) {
var error = false;
/* Reset all errors */ $('.frb-haserror').removeClass('frb-haserror'); $('.frb-error').hide();
if ( !options.method ) { error = true; $('.frb-methods').addClass('frb-haserror'); $('.frb-error-method').show(); }
if ( !frb.validateAmount() ) { error = true; }
/* Email optin */ if ( $('input[name="opt_in"]').length > 0 && $('.frb-optin').is(':visible') ) { var opt_inValue = $('input[name="opt_in"]:checked').val(); if ( opt_inValue !== '1' && opt_inValue !== '0' ) { $('.frb-optin').addClass('frb-haserror'); $('.frb-error-optin').show(); error = true; } }
return !error;
};
/**
* Check if selected amount is valid i.e. a positive number, between minimum and maximum. * If not, show an error and return false. */
frb.validateAmount = function() {
var amount = frb.getAmount();
var currency = frb.getCurrency( mw.centralNotice.data.country ); var minAmount = frb.amounts.minimums[ currency ]; if ( amount === null || isNaN(amount) || amount <= 0 || amount < minAmount ) { $('fieldset.frb-amounts').addClass('frb-haserror'); $('.frb-error-smallamount').show(); return false; } else if ( amount > 10000 * minAmount ) { $('fieldset.frb-amounts').addClass('frb-haserror'); $('.frb-error-bigamount').show(); return false; } else { $('fieldset.frb-amounts').removeClass('frb-haserror'); $('.frb-error-smallamount, .frb-error-bigamount').hide(); return true; }
};
/**
* Build the utm_source for analytics. * * Own function so it can be overriden for weird tests * * @param {Object} params * @return {string} utm_source */
frb.buildUtmSource = function(params) {
var utm_source; var fullDottedPaymentMethod = params.payment_method; if ( params.recurring ) { fullDottedPaymentMethod = 'r' + fullDottedPaymentMethod; } if ( params.payment_submethod ) { fullDottedPaymentMethod = fullDottedPaymentMethod + '.' + params.payment_submethod; }
utm_source = mw.centralNotice.data.banner;
// Keeping opt-in in utm_source for safety for now // Eventually remove it, or move to utm_key? if ( params.opt_in ) { utm_source += '_optIn' + params.opt_in; }
utm_source += '.no-LP.' + fullDottedPaymentMethod;
return utm_source;
};
/**
* Build a string for utm_key from extra tracking data * * @param {Object} data * @return {string} utm_key */
frb.buildUtmKey = function(data) {
var dataArray = []; for (var key in data) { if (data.hasOwnProperty(key)) { dataArray.push( key + '_' + data[key] ); } } return dataArray.join('.');
};
/**
* Determine if we should show recurring choice on step 2 * @param {Object} options Including method and optional gateway * @param {String} country * @return {boolean} */
frb.shouldShowRecurring = function(options, country) {
if ( frb.noRecurringCountries.indexOf( country ) !== -1 ) { // Defined in LocalizeJS-2017.js return false; } if ( options.method === 'paypal' ) { return true; } if ( options.method === 'cc' ) { if ( options.gateway === 'adyen' || frb.ccAdyenCountries.indexOf( country ) !== -1 ) { // Defined in LocalizeJS-2017.js return false; } else { return true; } } return false;
};
/* Is recurring method selected? This function can be overriden for different forms */ frb.getRecurring = function() {
var form = document.getElementById('frb-form'); return form.frequency.value === 'monthly';
};
/* Return amount selected */ frb.getAmount = function() {
var form = document.getElementById('frb-form'); var amount = null; frb.extraData.otherAmt = 0;
// If there are some amount radio buttons, then look for the checked one if (form.amount) { for (var i = 0; i < form.amount.length; i++) { if (form.amount[i].checked) { amount = form.amount[i].value; } } }
// Check the "other" amount box if (form.otherAmount.value !== ) { var otherAmount = form.otherAmount.value; otherAmount = otherAmount.replace(/[,.](\d)$/, ':$10'); otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, ':$1$2'); otherAmount = otherAmount.replace(/[$£€¥,.]/g, ); otherAmount = otherAmount.replace(/:/, '.'); amount = otherAmount; frb.extraData.otherAmt = 1; }
amount = parseFloat(amount);
if ( isNaN(amount) ) { return 0; } else { return amount; }
};
/* Localize the amount errors. Call when initialising banner. */ frb.localizeErrors = function() {
var currency = frb.getCurrency( mw.centralNotice.data.country ); var minAmount = frb.amounts.minimums[ currency ];
$('.frb-error-smallamount').text( function( index, oldText ) { return oldText.replace( '$1', minAmount + ' ' + currency ); });
$('.frb-error-bigamount').text( function( index, oldText ) { return oldText.replace( '$1', 10000*minAmount ) .replace( '$2', currency ) .replace( '$3', 'benefactors@wikimedia.org' ); });
};
/**
* Shared code for amount input handling */
frb.initAmountOptions = function() {
// Reset "Other" input if user clicks a preset amount $('#frb-form [id^=frb-amt-ps]').click(function() { $('#frb-amt-other-input').val(); });
// Track if they selected and then later changed amount // Only for radios, not for every keystroke in Other and not for PTF $('.frb-amounts input[type="radio"]').on('change', function(e) { if ( frb.didSelectAmount ) { frb.extraData.changedAmt = 1; } frb.didSelectAmount = true; });
// Block typing non-numerics in input field, otherwise Safari allows them and then chokes // https://phabricator.wikimedia.org/T118741, https://phabricator.wikimedia.org/T173431 document.getElementById('frb-amt-other-input').onkeypress = function(e) { // Allow special keys in Firefox if ((e.code == 'ArrowLeft') || (e.code == 'ArrowRight') || (e.code == 'ArrowUp') || (e.code == 'ArrowDown') || (e.code == 'Delete') || (e.code == 'Backspace')) { return; } var chr = String.fromCharCode(e.which); if ("0123456789., ".indexOf(chr) === -1) { return false; } };
};
/**
* Calculate approximate transaction fee on given amount * @param {number} amount * @return {number} Rounded to 2 decimal places */
frb.calculateFee = function(amount) {
var currency = frb.getCurrency(mw.centralNotice.data.country), feeMultiplier = 0.04, feeMinimum = frb.amounts.feeMinimums[currency] || 1, feeAmount = amount * feeMultiplier;
if ( feeAmount < feeMinimum ) { feeAmount = feeMinimum; } return parseFloat(feeAmount.toFixed(2));
};
frb.updateFeeDisplay = function() {
var currency = frb.getCurrency(mw.centralNotice.data.country), language = mw.centralNotice.data.uselang, amount, feeAmount, totalAmount;
amount = frb.getAmount(); feeAmount = frb.calculateFee(amount); if ( $('#frb-ptf-checkbox').prop('checked') ) { totalAmount = amount + feeAmount; } else { totalAmount = amount; }
var feeAmountFormatted = frb.formatCurrency(currency, feeAmount, language); $('.frb-ptf-fee').text(feeAmountFormatted);
var totalAmountFormatted = frb.formatCurrency(currency, totalAmount, language); $('.frb-ptf-total').text(totalAmountFormatted);
$('.frb-ptf').slideDown();
};
/* End of MediaWiki:FundraisingBanners/CoreJS-2018.js */ /* == MediaWiki:FundraisingBanners/LocalizeJS-2017.js == */
/**
* Get the currency for a given country * * NOTE: The following currency mapping is WMF-specific based on payment * provider availability, NOT necessarily the official currency of the country * * @param {string} country code * @return {string} currency code */
frb.getCurrency = function(country) {
switch ( country ) { // Big 6 case 'US': return 'USD'; case 'CA': return 'CAD'; case 'GB': return 'GBP'; case 'IE': return 'EUR'; case 'AU': return 'AUD'; case 'NZ': return 'NZD'; // Euro countries case 'AT': case 'BE': case 'ES': case 'FR': case 'IE': case 'IT': case 'LU': case 'LV': case 'NL': case 'PT': case 'SK': return 'EUR'; // Others case 'DK': return 'DKK'; case 'HU': return 'HUF'; case 'IL': return 'ILS'; case 'JP': return 'JPY'; case 'MY': return 'MYR'; case 'NO': return 'NOK'; case 'PL': return 'PLN'; case 'RO': return 'RON'; case 'SE': return 'SEK'; case 'UA': return 'UAH'; case 'ZA': return 'ZAR'; // Latin America case 'BR': return 'BRL'; case 'AR': return 'ARS'; case 'CL': return 'CLP'; case 'CO': return 'COP'; case 'MX': return 'MXN'; case 'PE': return 'PEN'; case 'UY': return 'UYU'; // Fall back to USD default: return 'USD'; }
};
/**
* Format a currency value * * @param {string} currency code. Leave undefined to get without symbol. * @param {number} amount * @param {string} language code * @return {string} formatted string e.g. '$3', '£5', '10 €' */
frb.formatCurrency = function(currency, amount, language) {
var locale, formatterOptions, formatter, fmAmount;
if (isNaN(amount) || amount === ) { // Not a number, it's probably the 'other' string or box // TODO: better way of doing this? fmAmount = amount; } else { if (window.Intl && typeof window.Intl === 'object') { // Use this for fancy number formatting - thousands separators etc locale = language + '-' + Geo.country; if ( amount % 1 !== 0 ) { // Not a whole number formatterOptions = { minimumFractionDigits: 2 }; } else { formatterOptions = {}; } formatter = new Intl.NumberFormat(locale, formatterOptions); } else { // Bad browser. Just do the basics: 2 decimal places if needed, or none formatter = {}; formatter.format = function(number) { if ( amount % 1 !== 0 ) { // Not a whole number return number.toFixed(2); } else { return number.toString(); } }; } fmAmount = formatter.format(amount); }
// No symbol needed if ( currency === undefined ) { return fmAmount; }
// Better dive into the formatting object if ( frb.currencyFormats[currency] === undefined ) { return currency + ' ' + fmAmount; } if ( frb.currencyFormats[currency] instanceof Object ) { // not a string if ( frb.currencyFormats[currency][language] !== undefined ) { return frb.currencyFormats[currency][language].replace('\t', fmAmount); } return frb.currencyFormats[currency]['default'].replace('\t', fmAmount); }
return frb.currencyFormats[currency].replace('\t', fmAmount);
};
/*
* Select the correct amount or array of amounts from object in "source" * * @param {Object} source - the amounts data object e.g. frb.amounts.options7, frb.amounts.averages * @param {string} currency - ISO code of currency * @param {string} country - ISO code of country (optional) * @return {array/number} - depending on source */
frb.pickAmounts = function(source, currency, country) {
if ( source[currency]['default'] ) { // we need to go deeper if ( source[currency][country] !== undefined ) { return source[currency][country]; } else { return source[currency]['default']; } } else { return source[currency]; }
};
/* Credit card types so we can show the correct logos */ frb.cardTypes = {
// Big 6 'US' : 'vmad', 'CA' : 'vma', 'GB' : 'vmaj', 'IE' : 'vmaj', 'AU' : 'vmaj', 'NZ' : 'vma', // Euro countries 'AT' : 'vmaj', 'BE' : 'vmaj', 'ES' : 'vmaj', 'FR' : 'CBvma', 'IT' : 'vmaj', 'LU' : 'vmaj', 'LV' : 'vma', 'NL' : 'vmaj', 'PT' : 'vmaj', 'SK' : 'vmaj', // Others 'DK' : 'vma', 'HU' : 'vma', 'IL' : 'vmad', // Adyen 'JP' : 'vmaj', 'MY' : 'vmaj', 'NO' : 'vma', 'PL' : 'vma', 'RO' : 'vma', 'SE' : 'vma', 'UA' : 'vma', // Adyen 'ZA' : 'vm'
};
/**
* Display the correct payment methods for current country * * Methods should be labeled with class 'frb-pm-xxxx' * TODO: clean this function up more * * @param {string} country */
frb.localizeMethods = function(country) {
// Hide recurring completely for some countries if ( frb.noRecurringCountries.indexOf(country) !== -1 ) { $('.frb-frequency, .recurring-details').hide(); }
// Remove any leftover WorldPay and Adyen $('.frb-pm-cc-wp').remove(); $('.frb-pm-cc-adyen').remove();
// Countries using Adyen for credit card if ( frb.ccAdyenCountries.indexOf( country ) !== -1 ) { $('.frb-pm-cc').addClass('no-monthly'); }
// Countries with no PayPal option var noPP = ['IN', 'RU', 'SG', 'AE', 'QA', 'OM', 'BD', 'BO', 'PA', 'PY', 'GT', 'JM', 'TT', 'DZ']; if ($.inArray(country, noPP) !== -1) { $('.frb-pm-pp').remove(); $('.frb-pm-pp-usd').remove(); }
// Countries with no PayPal for mobile only - https://phabricator.wikimedia.org/T173001 var noPPmobile = ['PH', 'ID', 'TH', 'KR', 'MY', 'VN']; var mobileRegex = /(_mob_|_ipd_|_m_)/; if ($.inArray(country, noPPmobile) !== -1) { if (mw.centralNotice.data.banner.search(mobileRegex) !== -1) { $('.frb-pm-pp').remove(); $('.frb-pm-pp-usd').remove(); } }
// Countries where PayPal must be in USD var ppUSD = ['BG', 'HR', 'LT', 'MK', 'RO', 'UA', 'SA', 'CN', 'ID', 'KR', 'KZ', 'MY', 'VN', 'AR', 'CL', 'DO', 'CO', 'NI', 'UY', 'ZA', 'BH', 'LB', 'VE', 'TR', 'IS', 'BA', 'MV', 'BB', 'BM', 'BZ', 'CR', 'CW', 'SX', 'HN', 'KN', 'DM', 'AG', 'LC', 'GD', 'FJ', 'TN', 'BJ', 'BF', 'CI', 'GW', 'ML', 'NE', 'SN', 'TG', 'BR', 'PE']; if ($.inArray(country, ppUSD) !== -1) { $('.frb-pm-pp').remove(); $('.frb-pm-pp-usd').show(); } else { $('.frb-pm-pp').show(); $('.frb-pm-pp-usd').remove(); }
// Show any extra local payment methods, or remove them if not needed var extrapaymentmethods = { 'amazon' : ['US'], 'bpay' : [], 'ideal' : ['NL'], 'bt' : ['BR'], // Bank Transfer (Astropay) 'cash' : ['BR'] // 'Cash' methods (Astropay) };
// Methods with different labels per country if (country === 'AR') { $('.frb-pm-bt button, button.frb-pm-bt').html('Santander'); } if (country === 'CO') { $('.frb-pm-bt button, button.frb-pm-bt').html('PSE Pagos'); } if (country === 'UY') { $('.frb-pm-cash button, button.frb-pm-cash').html('RedPagos'); } if (country === 'CL' && mw.config.get('wgUserLanguage') == 'es') { $('.frb-pm-bt button, button.frb-pm-bt').html('Trans. bancaria'); }
for (var method in extrapaymentmethods) { var $methodbutton = $('.frb-pm-' + method); if ( $.inArray(country, extrapaymentmethods[method]) !== -1 ) { // country is in the list $methodbutton.show(); } else { $methodbutton.remove(); } }
/* Add card types class to credit card button, so we can show correct logos */ if ( frb.cardTypes[country] ) { $('.frb-pm-cc').addClass('frb-cctypes-' + frb.cardTypes[country] ); }
};
/**
* Check scheduled payment method outages and hide buttons if needed * * Data at https://meta.wikimedia.org/wiki/MediaWiki:FR2013/Resources/PaymentOutages.js * Methods should be labeled with class 'frb-pm-xxxx' * * @param {string} country code */
frb.checkMethodOutages = function(country) {
// TODO - can we load this a better way? /* This file can be used to schedule hiding of individual payment methods from banners * e.g. if they have scheduled downtime. * * Valid methods are: * ideal, cc, pp, amazon, bpay, webmoney, cash, pp-usd * (most of the time it's 'ideal'...) * Can also limit outage to a specific country with country: "XX" (where XX is an ISO code) * * Note that in JavaScript dates the months (and only the months) start at 0. * Jan=0, Feb=1, Mar=2, Apr=3 etc. How hateful. * * Be sure to also update donatewiki if needed e.g. by commenting the method templates * found at https://donate.wikimedia.org/wiki/Template:2012FR/Form-section/Paymentmethods * */
var outages = [
{ start: new Date(Date.UTC(2016, 8, 18, 1)), end: new Date(Date.UTC(2016, 8, 18, 7)), method: "ideal" }
];
var now = new Date();
for (var i = outages.length - 1; i >= 0; i--) { if ( now > outages[i].start && now < outages[i].end ) { if (outages[i].country === undefined || outages[i].country == country) { $('.frb-pm-' + outages[i].method).hide(); } } }
};
/**
* Adjust the amount options and their labels * * Inputs should have id frb-amt-psX where X is the index number (starting from 1) * * @param {Object} source - object with amounts e.g. frb.amounts.options7 * @param {string} currency - currency code e.g. 'USD' * @param {string} country - country code e.g. 'FR' Some currencies can have different options per country. * @param {string} language - language code e.g. 'en' For symbol formatting * @param {boolean} useSymbols - use currency symbols on labels or not? (3 vs $3) */
frb.localizeAmountOptions = function(source, currency, country, language, useSymbols) {
var amountOptions = frb.pickAmounts(source, currency, country);
$('#frb-form input[name="amount"]').each(function(index) { var $input = $(this); var $label = $input.siblings('label');
var i = $input.attr('id').replace('frb-amt-ps', ); var amount = amountOptions[i-1]; // because IDs start from 1
if ( amount ) { $input.val( amount ); if ( useSymbols ) { $label.html( frb.formatCurrency( currency, amount, language) ); } else { $label.html( frb.formatCurrency( undefined, amount, language) ); } } });
};
/**
* Make an element into a link * * @param {string} selector CSS selector for elements to convert to a link * @param {string} baseUrl URL of link (function will add language parameter) */
frb.makeLink = function( selector, baseUrl ) {
var url = baseUrl + '&language=' + mw.config.get( 'wgUserLanguage' ); // TODO: pt-br and es-419 $( selector ).each( function() { var $link = $( '<a></a>' ); $link.html( $( this ).html() ); $link.attr( { href: url, target: '_blank' } ); $( this ).replaceWith( $link ); });
};
frb.noRecurringCountries = ['AR', 'CL', 'CO', 'MX', 'PE', 'UY', 'BR']; frb.ccAdyenCountries = ['FR', 'IL', 'UA'];
/* These countries use potentially ambiguous $ sign. Use ISO code instead in text (but still $ for buttons) */ frb.textAmountIsoCountries = ['AR', 'CL', 'CO', 'MX'];
$(function() {
var language = mw.centralNotice.data.uselang; var country = mw.centralNotice.data.country; var currency = frb.getCurrency(country);
// Payment methods frb.localizeMethods(country); frb.checkMethodOutages(country);
// Basic replacements $('.frb-replace-currencysymbol').html( frb.formatCurrency( currency, , language ).replace(' ', ) ); $('.frb-replace-currencycode').html( currency );
// Country name var countryName; if ( frb.countryNames[language] ) { countryName = frb.countryNames[language][country] || frb.countryNames.en[country]; } else { countryName = frb.countryNames.en[country]; } $('.frb-replace-countryname').html( countryName );
// Day of week var now = new Date(); var dayNumber = now.getDay(); var capitalizeText = function( text ) { // Capitalize first letter, for use at start of sentence return text.charAt(0).toUpperCase() + text.slice(1); }
if ( $('.frb-replace-dayofweek, .frb-replace-dayofweek-capitalize').length > 0 ) { if ( frb.dayNames[language] ) { $('.frb-replace-dayofweek').html( frb.dayNames[language][dayNumber] ); $('.frb-replace-dayofweek-capitalize').html( capitalizeText( frb.dayNames[language][dayNumber] ) ); } else { console.log('Warning: banner should contain a day of the week, but no translations found.'); } }
if ( $('.frb-replace-dayofweek-this, .frb-replace-dayofweek-this-capitalize').length > 0 ) { if ( frb.dayNamesThis[language] ) { $('.frb-replace-dayofweek-this').html( frb.dayNamesThis[language][dayNumber] ); $('.frb-replace-dayofweek-this-capitalize').html( capitalizeText( frb.dayNamesThis[language][dayNumber] ) ); } else { console.log('Warning: banner should contain "this DAY", but no translations found.'); } }
// Capitalize $('.frb-capitalize').text(function( index, text ) { return text.charAt(0).toUpperCase() + text.slice(1); });
// Replace device with iPad if needed var ua = navigator.userAgent; if ( ua.match( /ipad/i ) ) { $('.frb-replace-device').html( frb.iPadTranslations[language] || frb.iPadTranslations.en ); }
// Replace %AVERAGE% with formatted "average" amount
var average = frb.pickAmounts(frb.amounts.averages, currency, country);
if ( frb.textAmountIsoCountries.indexOf(country) !== -1 ) {
var avgString = average + ' ' + currency;
} else {
var avgString = frb.formatCurrency(currency, average, language).replace(/\.$/, ); // strip any period from end for use in running text
}
$('.frb').each(function(index){
var newHtml = $(this).html().replace(/%AVERAGE%/g, '' + avgString + '');
$(this).html(newHtml);
});
// Replace %MINIMUM% with formatted "if everyone" amount
var ifEveryone = frb.pickAmounts(frb.amounts.ifEveryone, currency, country);
if ( frb.textAmountIsoCountries.indexOf(country) !== -1 ) {
var ifString = ifEveryone + ' ' + currency;
} else {
var ifString = frb.formatCurrency(currency, ifEveryone, language).replace(/\.$/, ); // strip any period from end for use in running text
}
$('.frb').each(function(index){
var newHtml = $(this).html().replace(/%MINIMUM%/g, '' + ifString + '');
$(this).html(newHtml);
});
/* Links (in smallprint) TODO: merge with frb.makeLink() */ $('.frb-localize-links a').each(function() { // Add parameters for LandingCheck var uri = new mw.Uri( $(this).attr('href') ); uri.extend({ country: country, language: language, uselang: language, utm_medium: 'sitenotice', utm_campaign: mw.centralNotice.data.campaign || 'test', utm_source: mw.centralNotice.data.banner }); $(this).attr('href', uri.toString()); $(this).attr('target', '_blank'); // Make links open in new tab });
// Add links frb.makeLink( '.frb-link-privacy', 'https://foundation.wikimedia.org/wiki/Special:LandingCheck?basic=true&landing_page=Donor_privacy_policy' ); frb.makeLink( '.frb-link-tax', 'https://foundation.wikimedia.org/wiki/Special:LandingCheck?basic=true&landing_page=Tax_Deductibility' ); frb.makeLink( '.frb-link-cancel', 'https://donate.wikimedia.org/wiki/Special:LandingCheck?basic=true&landing_page=Cancel_or_change_recurring_giving' );
// Legal text variants if (country === 'US') { $('.frb-legal-US').show(); $('.frb-legal-nonUS, .frb-legal-NL').hide(); } else if (country === 'NL') { $('.frb-legal-NL').show(); $('.frb-legal-US, .frb-legal-nonUS').hide(); } else { $('.frb-legal-nonUS').show(); $('.frb-legal-US, .frb-legal-NL').hide(); }
// Countries where Remind Me Later should be shown rmlCountries = ['US', 'CA', 'GB', 'IE', 'AU', 'NZ', 'SE', 'IT', 'NL', 'ES', 'JP', 'FR'];
if ( rmlCountries.indexOf(country) === -1 ) { $('.frb').addClass('frb-rml-disabled'); } else { $('.frb').addClass('frb-rml-enabled'); }
});
/* == end of MediaWiki:FundraisingBanners/LocalizeJS-2017.js == */
/** Provides alterImpressionData hook for CentralNotice
* This info will be sent back with Special:RecordImpression */
mediaWiki.centralNotice.bannerData.alterImpressionData = function( impressionData ) {
// Returning true from this function indicates the banner was shown if (mediaWiki.centralNotice.bannerData.hideReason) { impressionData.reason = mediaWiki.centralNotice.bannerData.hideReason; } if (mediaWiki.centralNotice.bannerData.cookieCount) { impressionData.banner_count = mediaWiki.centralNotice.bannerData.cookieCount; } return !mediaWiki.centralNotice.bannerData.hideResult;
};
$(function() {
var language = mw.centralNotice.data.uselang; var country = mw.centralNotice.data.country; var currency = frb.getCurrency(country);
frb.extraData = {};
frb.initReminderForm();
frb.initAmountOptions(); frb.localizeAmountOptions(frb.amounts.options5, currency, country, language, true); frb.localizeErrors();
$('.frb-amounts').on('input change', function() { frb.validateAmount(); frb.updateFeeDisplay(); });
// Opt-in interaction $('.frb-optin').on('change', function() { $('.frb-optin').removeClass('frb-haserror'); $('.frb-error-optin').hide(); if ( $('#frb-optin-no').is(':checked') ) { $('.frb-optin-no-prompt').removeClass('is-positive'); if ( !$('.frb-optin-no-prompt').is(':visible') ) { $('.frb-optin-no-prompt').slideDown(); } } else { $('.frb-optin-no-prompt').addClass('is-positive'); } });
$('.frb-inline-close').on('click keypress', function(e) { if (e.which === 13 || e.type === 'click') { $('#frb-inline').hide(); mw.centralNotice.hideBanner(); e.stopPropagation(); } });
// Close inline rml form on click or return $('.frb-inline-rml-form-close').on('click keypress', function(e) { if (e.which === 13 || e.type === 'click') { $('.frb-inline-rml').hide(); $('.frb-inline-close-bottom-wrapper').removeClass('active'); e.stopPropagation(); } });
// Provide a hint they should click the buttons $('.frb-inline-message').click(function() { $('.frb-methods').addClass('hint'); setTimeout(function() { $('.frb-methods').removeClass('hint'); }, 400); });
/* Hide banner outside of main namespace (and Main Page, for sites where that isn't in main namespace) */ if ( mw.config.get('wgNamespaceNumber') > 0 && !mw.config.get('wgIsMainPage') ) { mw.centralNotice.bannerData.hideResult = true; mw.centralNotice.bannerData.hideReason = 'namespace'; } /* Hide banner on desktop site, in case wrong device settings were chosen */ if ( mw.config.get('skin') !== 'minerva' ) { mw.centralNotice.bannerData.hideResult = true; mw.centralNotice.bannerData.hideReason = 'other'; }
if (!mw.centralNotice.bannerData.hideResult) { frb.insertInlineBanner(); frb.initNag(); }
// Focus for #input_amount_other $('.frb-amt-other').on('click keypress', function(e) { if (e.which === 13 || e.type === 'click') { document.getElementById('frb-amt-other').checked = true; $('#frb-amt-other-input').focus(); e.stopPropagation(); } });
// Activate #input_amount_other radio when tabbing into #frb-amt-other-input // Add focus class to parent $('#frb-amt-other-input').blur(function() { $(this).closest('.frb-amt-other').removeClass('is-focused'); }) .focus(function() { document.getElementById('frb-amt-other').checked = true; $(this).closest('.frb-amt-other').addClass('is-focused'); });
}); </script>