MediaWiki:Centralnotice-template-peter dsk lg 250
<style> /* Hide when editing */ .action-edit #centralNotice, .ve-activated #centralNotice {
display: none !important;
}
/* Border-Box */
.frb *, .frb *:before, .frb *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
/* Banner wide settings */
.frb input, .frb button {
font-size: inherit; font-family: inherit;
}
.frb button {
cursor: pointer; outline: 0; text-align: center;
}
/* --- Main banner wrapper --- */
.frb {
display: none; position: absolute; top: 0; left: 0; right: 0; z-index: 110; background: transparent;
}
.frb {
border-bottom: 1px solid #c8ccd1; background-color: #fff; box-shadow: 0 1px 1px rgba(0,0,0,0.1); color: #222; font-size: 16px; line-height: 1.1875; /*19px @16px*/ font-family: "Helvetica Neue", "Helvetica", "Nimbus Sans L", "Arial", "Liberation Sans", sans-serif; font-weight: 500;
}
.frb.frb--minimized {
position: fixed;
}
/* --- Window Styles --- */
.frb-main {
position: relative; display: table; width: 100%; padding: 16px 0 16px 8px; background-color: #FFFFFF; transition: background-color 0.5s ease;
}
body.rtl .frb-main {
padding: 16px 8px 16px 0;
}
/* Minimized styles */ .frb--minimized {
cursor: pointer;
}
.frb--minimized .frb-main:hover {
background-color: #eaf3ff;
}
/* --- Close button --- */
.frb-controls {
display: inline-block; position: absolute; right: 0; top: 0; z-index: 999; font-size: 12px; text-transform: uppercase; cursor: pointer; padding: 8px 16px; color: #72777d;
} body.rtl .frb-controls {
right: auto; left: 0;
}
.frb-close:hover {
color: #000000;
} .frb-close:hover .frb-icon g {
stroke: #000000;
}
/* -------------- Message -------------- */
.frb-message {
position: relative; display: table-cell; width: auto; vertical-align: top; border: 8px solid #990000; border-radius: 12px; background-color: #f8f9fa; padding: 16px 30px; color: #000; font-family: "Linux Libertine", Georgia, Times, serif; font-size: 16px; line-height: 1.4; /*22.4px @16px*/ transition: background-color 0.5s ease;
}
@media (min-width: 900px) {
.frb-message { font-size: 19px; }
}
@media (min-width: 1100px) {
.frb-message { font-size: 22px; }
}
@media (min-width: 1300px) {
html[lang="en"] .frb-message { font-size: 24px; }
}
@media (min-width: 1500px) {
.frb-message { font-size: 24px; }
}
.frb-message-icon {
float: left; margin-top: 0.07368421053em; /*1.4px @19px*/ margin-left: calc(-1em + -0.05263157895em); /*-19px + -1px @19px*/ height: 1em; width: 1em;
}
body.rtl .frb-message-icon {
float: right; margin-right: calc(-1em + -0.2105263158em); /*-19px + -4px @19px*/
}
.frb-message p {
margin: 0;
}
.frb-highlight {
border-bottom: 3px solid #990000;
}
/* Minimized styles */ .frb--minimized .frb-message {
padding: 16px 10px 16px 30px; cursor: pointer; font-size: 16px; background-color: transparent;
} body.rtl .frb--minimized .frb-message {
padding: 16px 30px 16px 10px;
}
@media (min-width: 900px) {
.frb--minimized .frb-message { font-size: 14px; }
}
@media (min-width: 1050px) {
.frb--minimized .frb-message { font-size: 16px; }
}
@media (min-width: 1200px) {
.frb--minimized .frb-message { font-size: 18px; }
}
@media (min-width: 1300px) {
.frb--minimized .frb-message { font-size: 22px; }
}
/* -------------- Form -------------- */
.frb-form {
display: table-cell; position: relative; width: 25%; min-width: 300px; height: 100%; vertical-align: middle; padding: 0 12px; background: #fff;
}
/* Minimized styles */ .frb--minimized .frb-form {
background-color: transparent;
}
.frb-form:before {
position: absolute; left: 0; top: 50%; content: " "; margin: -10px 0 0 0; border: 10px solid transparent; border-left-color: #990000; pointer-events: none;
} body.rtl .frb-form:before {
left: auto; right: 0; border-left-color: transparent; border-right-color: #990000;
}
.frb-form fieldset {
width: 100%; border: 0; margin: 0 auto; padding: 0 0 8px 0;
}
.frb-form legend {
width: 100%; margin: 0; padding: 0 0 8px 0; text-align: center; font-size: 14px;
}
.frb-form ul {
display: table; table-layout: fixed; width: 100%; margin: 0; padding: 0; list-style: none;
}
.frb-form li {
display: table-cell; padding: 4px; vertical-align: top;
}
- frb-form {
margin-top: 12px;
}
/* --- Common Button Styles --- */
/* Hide radio buttons */ .frb-form input[type="radio"] {
position: absolute; overflow: hidden; height: 1px; width: 1px; clip: rect(0 0 0 0); border: 0; margin: -1px; padding: 0;
}
.frb-btn {
width: 100%; height: 48px; display: block; background-color: #f8f9fa; color: #222222; font-size: 16px; line-height: 1.25; /*20px @16px*/ padding: 13px 4px 15px 4px; border: 1px solid #9aa0a7; border-radius: 2px; outline: 0; text-align: center; cursor: pointer; font-family: inherit; font-weight: 500; -webkit-transition: all .25s ease-in-out; -moz-transition: all .25s ease-in-out; transition: all .25s ease-in-out;
} .frb-btn:hover {
background-color: #fff; color: #444; border-color: #a2a9b1;
} .frb-btn:active {
background-color: #d9d9d9; color: #000; border-color: #7d8389;
} .frb-form input[type=radio]:checked + .frb-btn {
background-color: #2a4b8d; color: #fff; border-color: #7d8389;
}
/* Focus styles */ .frb a:focus, .frb button:focus, .frb input:focus, .frb-btn:focus, .frb-close:focus, .frb-btn-submit:focus, .frb-form input[type=radio]:focus + .frb-btn, .frb-form input[type=radio]:focus + #frb-amt-other-label {
outline: 0; border-color: #36c; box-shadow: inset 0 0 0 1px #36c;
}
.frb-form input[type=radio]:focus + .frb-btn, .frb-form input[type=radio]:focus + #frb-amt-other-label, .frb-form input[type=radio]:checked + .frb-btn:focus, .frb-form input[type=radio]:checked + #frb-amt-other-label:focus, .frb-form .frb-btn-submit:focus {
box-shadow: inset 0 0 0 1px #36c, inset 0 0 0 2px #fff;
}
.frb-btn img {
padding: 0 4px; max-width: 100%; max-height: 20px; /*must equal font line height of frb-btn*/
}
.frb-methods .frb-btn {
height: 64px; line-height: 1.125; /*18px @16px*/
}
.frb-methods svg {
max-width: 100%;
}
.frb-methods .frb-pm-cc .frb-btn {
padding: 7px 4px
}
.frb-methods .frb-pm-cc svg {
max-width: 30%;
}
.frb-country-GB .frb-methods .frb-pm-cc svg, .frb-country-IE .frb-methods .frb-pm-cc svg {
max-width: 38%; max-height: 24px;
}
.frb-country-US .frb-methods .frb-pm-cc svg, .frb-country-AU .frb-methods .frb-pm-cc svg {
max-width: 45%; max-height: 23px;
}
@media (min-width: 1800px) {
.frb-country-US .frb-methods .frb-pm-cc svg, .frb-country-AU .frb-methods .frb-pm-cc svg { max-width: 22%; }
}
.frb-country-US .frb-logo-jcb, .frb-country-CA .frb-logo-jcb, .frb-country-NZ .frb-logo-jcb, .frb-country-AU .frb-logo-discover, .frb-country-CA .frb-logo-discover, .frb-country-GB .frb-logo-discover, .frb-country-IE .frb-logo-discover, .frb-country-NZ .frb-logo-discover { display: none; }
/* Blue text buttons */ .frb-btn.frb-btn-btxt {
color: #3366cc;
} .frb-btn.frb-btn-btxt:active {
color: #2a4b8d;
}
/* Submit/Continue buttons (blue background) */ .frb-btn-submit {
width: 100%; display: block; margin-top: 8px; padding: 8px; color: #fff; background-color: #3366cc; border-color: #3366cc; cursor: pointer; border: 0; border-radius: 2px; font-size: 16px; -webkit-transition: all .25s ease-in-out; -moz-transition: all .25s ease-in-out; transition: all .25s ease-in-out;
} .frb-btn-submit:hover {
background-color: #447ff5; border-color: #447ff5;
} .frb-btn-submit:active {
background-color: #2a4b8d; border-color: #2a4b8d; box-shadow: none;
}
/* --- Other Amount --- */
.frb-amt-other .frb-btn {
display: inline-block; width: 100%; padding: 2px 0 3px 0;
}
.frb-amt-other span {
display: block; height: auto; margin-bottom: 1px; font-size: 10px; line-height: 1; /*10px @16px*/ cursor: pointer;
}
.frb-amt-other #frb-amt-other-input {
width: 85%; border: 1px solid #ccc; color: #555; font-size: 16px; padding: 4px; border-radius: 2px; direction: ltr; text-align: center; font-family: inherit;
}
/* --- Payment method Buttons --- */
/* Hide methods which aren't monthly capable when monthly option is selected */ .form-monthly .no-monthly {
display: none !important;
}
.frb-form .frb-methods {
padding-bottom: 0;
}
/* 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%;
} .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 {
height: 48px; padding: 13px 4px 15px 4px;
}
/* --- Secure Transaction Legend --- */ .frb-secure-transaction {
display: block; padding: 5px 12px; margin: 0 auto; color: #000; font-size: 12px; text-transform: uppercase; text-align: center; opacity: .7;
} .frb-secure-transaction img {
width: 14px; height: 14px; display: inline-block;
}
/* --- Footer / Small Print --- */ .frb-footer {
padding: 0 24px 6px; font-size: 12px; color: #555; text-align: center; display: none; font-weight: normal;
}
.frb:hover .frb-footer {
display: block;
}
/* Minimized styles */ .frb.frb--minimized:hover .frb-footer {
display: none;
}
/* --- Show and Hiding (Minimize and Maximize) --- */ .frb-btn-toggle-size {
display: none; /*shows when minimized*/ width: 100%; font-size: 16px; background-color: #2a4b8d; color: #fff; border-color: #2a4b8c; transition: color 0.5s ease; text-transform: uppercase; font-weight: bold; letter-spacing: 0.0375em; /*0.6px @16px*/
}
.frb-btn-toggle-size:hover, .frb-btn-toggle-size:focus {
background-color: #2a4b8d; border-color: #2a4b8c; color: #eaf3ff;
}
/*Minimized styles*/ .frb--minimized .frb-btn-toggle-size {
display: block;
}
.frb--minimized:hover .frb-btn-toggle-size {
color: #eaf3ff;
}
/* Messages */ .frb-message__minimized {
display: none;
} .frb-message__maximized {
display: block;
} .frb-greeting {
display: block; margin-bottom: 4px;
}
/* Minimized styles */ .frb--minimized .frb-message__minimized {
display: block;
} .frb--minimized .frb-message__maximized, .frb--minimized #frb-form, .frb--minimized .frb-rml {
display: none;
}
/* --- Maybe later --- */
.frb-rml {
position: relative; width: auto; padding: 0; margin-top: 4px;
}
.frb-rml-form {
display: none; position: absolute; width: 100%; padding: 16px; margin-top: 6px; text-align: center; background: white; border: 1px solid #888888; border-radius: 2px; box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.15); z-index: 10;
}
.frb-rml-form:after, .frb-rml-form:before {
bottom: 100%; left: 50%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none;
}
.frb-rml-form:after {
border-bottom-color: #fff; border-width: 10px; margin-left: -10px;
}
.frb-rml-form:before {
border-bottom-color: #888; border-width: 11px; margin-left: -11px;
}
.frb-rml-form input {
width: 100%; padding: 8px; margin: 0; border: 1px solid #9aa0a7; border-radius: 2px; color: #000; direction: ltr;
}
.frb-rml-form input.error {
border-color: #ff0000; box-shadow: inset 0 0 0 2px #ff0000;
}
.frb-rml-form .frb-rml-error {
color: #ff0000; padding-top: 4px;
}
.frb-rml-ty {
padding: 0 16px; text-align: center; cursor: default;
} </style>
<script>
/* Allow overriding country */ if( mw.util.getParamValue("country") ) { Geo.country = mw.util.getParamValue("country"); }
</script>
<script> var frb = frb || {};
frb.addSpace = function() {
if ( $('.frb').is(':visible') ) { /* Add space for the banner, and extra px if given below. called on load and window resize */ var extra = 32; var bannerHeight = $('.frb-main').height(); $('#mw-panel').css('top', bannerHeight+extra); $('#mw-head').css('top', bannerHeight+extra); $('#mw-page-base').css('margin-top', bannerHeight+extra); $('.frb').addClass('frb-country-' + Geo.country); }
};
frb.show = function() {
$('body').prepend($('#centralNotice')); $('.frb').css('display', 'block'); frb.addSpace(); $(window).resize(function() { frb.addSpace(); });
};
frb.resetMw = function() {
$('#mw-panel').css('top', '0px'); $('#mw-head').css('top', '0px'); $('#mw-page-base').css('margin-top', '0');
}
frb.hide = function() {
/* Hide the banner, and remove the extra space which was added for it */ /* Don't set a cookie: this is a large banner and only shown on first view anyway */ $('.frb').hide(); frb.resetMw();
};
frb.toggleMonthly = function( monthly ) {
if( monthly.type === 'checkbox' ){ monthly = monthly.checked; } if ( monthly ) { $('#frb-form').addClass('form-monthly'); } else { $('#frb-form').removeClass('form-monthly'); }
};
/* jshint maxerr: 600 */ frb.amounts = frb.amounts || {};
// Hard minimum amounts that can be given // From https://github.com/wikimedia/wikimedia-fundraising-SmashPig/blob/master/PaymentData/ReferenceData/CurrencyRates.php // Updated 2023-12-12 frb.amounts.minimums = { 'USD' : 1, 'CAD' : 1.36, 'AUD' : 1.52, 'NZD' : 1.63, 'GBP' : 0.80, 'EUR' : 0.93, 'DKK' : 6.91, 'HUF' : 355, 'ILS' : 3.71, 'INR' : 10, // T309818 'JPY' : 146, 'MYR' : 4.68, 'NOK' : 11, 'PLN' : 4.02, 'CZK' : 23, 'RON' : 4.61, 'SEK' : 10, 'UAH' : 37, 'ZAR' : 19, // Latin America 'BRL' : 4.95, 'ARS' : 366, 'CLP' : 880, 'COP' : 3970, 'MXN' : 17, 'PEN' : 3.74, 'UYU' : 39, 'CHF' : 0.88 };
frb.amounts.options7 = { // Big English 'USD' : [2.75, 10, 15, 25, 50, 75, 100], 'CAD' : [2.75, 10, 15, 25, 50, 75, 100], 'AUD' : [2.75, 10, 15, 25, 50, 75, 100], 'NZD' : [2.75, 10, 15, 25, 50, 75, 100], 'GBP' : [2.75, 10, 15, 25, 50, 75, 100], 'EUR' : [2.75, 10, 15, 25, 50, 75, 100], // Others 'DKK' : [20, 75, 100, 200, 300, 500, 700], 'HUF' : [500, 1000, 2000, 4000, 5000, 7000, 10000], 'ILS' : [10, 35, 50, 100, 200, 300, 400], 'INR' : [25, 300, 500, 1000, 1500, 3000, 5000], 'JPY' : [300, 1000, 1500, 2000, 3000, 5000, 10000], 'MYR' : [10, 30, 50, 100, 200, 300, 500], 'NOK' : [30, 100, 150, 200, 500, 750, 1000], 'PLN' : [10, 20, 50, 100, 200, 300, 500], 'CZK' : [50, 100, 250, 500, 1000, 1500, 2500], 'RON' : [10, 50, 75, 100, 200, 300, 500], 'SEK' : [30, 100, 150, 200, 500, 750, 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, 200, 300], 'ARS' : [200, 250, 500, 750, 1000, 1500, 2000], 'CLP' : [2000, 3000, 5000, 10000, 20000, 30000, 50000], 'COP' : [10000, 15000, 25000, 50000, 100000, 150000, 200000], 'MXN' : [40, 70, 150, 250, 500, 700, 1000], 'PEN' : [10, 15, 25, 50, 100, 150, 200], 'UYU' : [100, 200, 300, 500, 1000, 1500, 2000], 'CHF' : [3, 5, 10, 25, 50, 100, 200] };
// 5 amount options. Since 2020 6C, no longer used frb.amounts.options5 = { // Big English 'USD' : [2.75, 15, 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], 'INR' : [150, 500, 1000, 3000, 5000], '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], 'CHF' : [3, 10, 25, 50, 100] };
// "Average" donation frb.amounts.averages = { 'USD' : 13, 'CAD' : 12, 'AUD' : 11, 'NZD' : 12, 'GBP' : 6, 'EUR' : 8, // Others 'DKK' : 60, 'HUF' : 2500, 'ILS' : 50, 'INR' : 229, 'JPY' : 800, 'MYR' : 30, 'NOK' : 75, 'PLN' : 50, 'CZK' : 150, 'RON' : 50, 'SEK' : 85, 'UAH' : 150, 'ZAR' : 65, // Latin America 'BRL' : 25, 'ARS' : 780, 'CLP' : 10200, 'COP' : 35000, 'MXN' : 140, 'PEN' : 30, 'UYU' : 525, 'CHF' : 25 };
// '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.75, 'EUR' : 2.75, // Others 'DKK' : 20, 'HUF' : 500, 'ILS' : 10, 'INR' : 25, 'JPY' : 300, 'MYR' : 10, 'NOK' : 30, 'PLN' : 10, 'CZK' : 50, 'RON' : 10, 'SEK' : 30, 'UAH' : 50, 'ZAR' : 30, // Latin America 'BRL' : 10, 'ARS' : 175, 'CLP' : 1500, 'COP' : 7000, 'MXN' : 40, 'PEN' : 10, 'UYU' : 100, 'CHF' : 5 };
// Minimum fee/PTF amounts. Default is 0.35. // Updated 2018-07-05 based on Ppena's feedback // Updated 2019-05-21 to approx 0.35 USD equivalent frb.amounts.feeMinimums = { 'DKK' : 2, 'HUF' : 100, 'ILS' : 1.2, 'INR' : 4, 'JPY' : 35, 'MYR' : 1, 'NOK' : 3, 'PLN' : 1.35, 'CZK' : 7.5, 'RON' : 1.5, 'SEK' : 3, 'UAH' : 10, 'ZAR' : 5, // Latin America // Updated 2024-08-22 to approx 0.35 USD equivalent 'BRL' : 1.75, 'ARS' : 300, 'CLP' : 300, 'COP' : 1400, 'MXN' : 6, 'PEN' : 1.2, 'UYU' : 14 };
// If one-time amount <= left amount, suggest right amount for monthly // If changing these, please update spreadsheet // https://docs.google.com/spreadsheets/d/1z36zi8EegPLAvR5FYAgwz8ywKZ50QNB82SpwpTdk-xQ/edit#gid=1258723967 frb.amounts.monthlySuggest = { 'USD' : [ // also EUR, GBP, CAD, AUD, NZD [ 2.74, 0 ], [ 9, 1.75 ], [ 12, 2 ], [ 15, 2.5 ], [ 18, 3 ], [ 21, 3.5 ], [ 24, 4 ], [ 27, 4.5 ], [ 30, 5 ], [ 33, 5.5 ], [ 36, 6 ], [ 39, 6.5 ], [ 42, 7 ], [ 45, 7.5 ], [ 48, 8 ], [ 51, 8.5 ], [ 54, 9 ], [ 57, 9.5 ], [ 60, 10 ], [ 63, 10.5 ], [ 66, 11 ], [ 69, 11.5 ], [ 72, 12 ], [ 75, 12.5 ], [ 102, 17 ], [ 250, 25 ], [ 499, 50 ], [ Infinity, 0 ] ], 'JPY' : [ [ 299, 0 ], [ 900, 150 ], [ 1200, 200 ], [ 1500, 250 ], [ 1800, 300 ], [ 2100, 350 ], [ 2400, 400 ], [ 2700, 450 ], [ 3000, 500 ], [ 3300, 550 ], [ 3600, 600 ], [ 3900, 650 ], [ 4200, 700 ], [ 4500, 750 ], [ 4800, 800 ], [ 5100, 850 ], [ 5400, 900 ], [ 5700, 950 ], [ 6000, 1000 ], [ 6300, 1050 ], [ 6600, 1100 ], [ 6900, 1150 ], [ 7200, 1200 ], [ 7500, 1250 ], [ 10800, 1800 ], [ 18000, 3000 ], [ 50000, 6000 ], [ Infinity, 0 ] ], 'SEK' : [ // Also NOK [ 29, 0 ], [ 35, 20 ], [ 55, 25 ], [ 105, 30 ], [ 160, 40 ], [ 210, 50 ], [ 360, 60 ], [ 450, 75 ], [ 600, 100 ], [ 800, 125 ], [ 900, 150 ], [ 1200, 200 ], [ 1500, 250 ], [ 1800, 300 ], [ 2100, 350 ], [ Infinity, 0 ] ], 'HUF' : [ [ 499, 0 ], [ 3000, 500 ], [ 6000, 1000 ], [ 9000, 1500 ], [ 12000, 2000 ], [ 18000, 3000 ], [ 24000, 4000 ], [ 30000, 5000 ], [ 36000, 6000 ], [ 42000, 7000 ], [ 48000, 8000 ], [ 54000, 9000 ], [ 60000, 10000 ], [ Infinity, 0 ] ], 'ILS' : [ [ 9, 0 ], [ 10, 5 ], [ 60, 10 ], [ 90, 15 ], [ 120, 20 ], [ 180, 30 ], [ 240, 40 ], [ 300, 50 ], [ 360, 60 ], [ 420, 70 ], [ 480, 80 ], [ 540, 90 ], [ 600, 100 ], [ Infinity, 0 ] ], 'ZAR' : [ [ 29, 0 ], [ 30, 20 ], [ 50, 30 ], [ 100, 40 ], [ 300, 50 ], [ 450, 75 ], [ 600, 100 ], [ 900, 150 ], [ 1200, 200 ], [ 1500, 250 ], [ 1800, 300 ], [ 2400, 400 ], [ 3000, 500 ], [ 3600, 600 ], [ Infinity, 0 ] ], 'MYR' : [ // Also RON, PLN [ 9, 0 ], [ 30, 5 ], [ 50, 10 ], [ 120, 20 ], [ 180, 30 ], [ 240, 40 ], [ 300, 50 ], [ 360, 60 ], [ 420, 70 ], [ 480, 80 ], [ 540, 90 ], [ 600, 100 ], [ 900, 150 ], [ Infinity, 0 ] ], 'DKK' : [ [ 19, 0 ], [ 25, 10 ], [ 120, 20 ], [ 250, 40 ], [ 350, 50 ], [ 450, 75 ], [ 600, 100 ], [ 750, 125 ], [ 900, 150 ], [ 1200, 200 ], [ 1500, 250 ], [ 1800, 300 ], [ 2100, 350 ], [ Infinity, 0 ] ], 'CZK' : [ [ 49, 0 ], [ 180, 30 ], [ 300, 50 ], [ 600, 100 ], [ 900, 150 ], [ 1200, 200 ], [ 1500, 250 ], [ 1800, 300 ], [ 2100, 350 ], [ 2400, 400 ], [ 3000, 500 ], [ 3600, 600 ], [ 4200, 700 ], [ 4800, 800 ], [ Infinity, 0 ] ], 'CLP' : [ [ 1999, 0 ], [ 2300, 1000 ], [ 2700, 1100 ], [ 3300, 1200 ], [ 4200, 1300 ], [ 5500, 1400 ], [ 9000, 1500 ], [ 10500, 1700 ], [ 16000, 2600 ], [ 20800, 3400 ], [ 26000, 4200 ], [ 31200, 5000 ], [ 38400, 6400 ], [ 55000, 8500 ], [ Infinity, 0 ] ], 'UYU' : [ [ 99, 0 ], [ 120, 50 ], [ 170, 65 ], [ 220, 70 ], [ 320, 75 ], [ 480, 85 ], [ 520, 90 ], [ 750, 125 ], [ 1050, 170 ], [ 1350, 225 ], [ 1600, 250 ], [ 1800, 300 ], [ 2100, 320 ], [ Infinity, 0 ] ], 'PEN' : [ [ 9, 0 ], [ 12, 5 ], [ 17, 6 ], [ 26, 7 ], [ 48, 8 ], [ 55, 9 ], [ 78, 13 ], [ 105, 17 ], [ 130, 21 ], [ 160, 26 ], [ 180, 30 ], [ 210, 32 ], [ Infinity, 0 ] ], 'COP' : [ [ 9999, 0 ], [ 11300, 5000 ], [ 17000, 5200 ], [ 22000, 5500 ], [ 27000, 5800 ], [ 45000, 7500 ], [ 55000, 9000 ], [ 75000, 12500 ], [ 105000, 17000 ], [ 120000, 20000 ], [ 160000, 25000 ], [ 180000, 30000 ], [ 250000, 34000 ], [ Infinity, 0 ] ], 'BRL' : [ [ 9, 0 ], [ 12, 6 ], [ 22, 7 ], [ 35, 8 ], [ 45, 9 ], [ 55, 10 ], [ 80, 12 ], [ 105, 16 ], [ 160, 25 ], [ 210, 35 ], [ 270, 45 ], [ 320, 50 ], [ Infinity, 0 ] ], 'MXN' : [ [ 39, 0 ], [ 48, 25 ], [ 60, 28 ], [ 110, 30 ], [ 160, 35 ], [ 260, 45 ], [ 270, 50 ], [ 350, 60 ], [ 550, 85 ], [ 650, 90 ], [ 750, 120 ], [ 1500, 160 ], [ Infinity, 0 ] ], 'INR' : [ [ 29, 0 ], [ 75, 25 ], [ 79, 29 ], [ 104, 30 ], [ 208, 35 ], [ 312, 55 ], [ 416, 70 ], [ 520, 90 ], [ 624, 110 ], [ 728, 130 ], [ 832, 140 ], [ 936, 160 ], [ 1040, 175 ], [ 1144, 190 ], [ 1248, 210 ], [ 1352, 235 ], [ 1456, 245 ], [ 1560, 265 ], [ 2080, 350 ], [ 3120, 530 ], [ 4160, 700 ], [ 5200, 880 ], [ 7800, 1320 ], [ 10400, 1760 ], [ 15600, 2650 ], [ 20800, 3530 ], [ 26000, 4420 ], [ Infinity, 0 ] ] }; frb.amounts.monthlySuggest.EUR = frb.amounts.monthlySuggest.USD; frb.amounts.monthlySuggest.GBP = frb.amounts.monthlySuggest.USD; frb.amounts.monthlySuggest.CAD = frb.amounts.monthlySuggest.USD; frb.amounts.monthlySuggest.AUD = frb.amounts.monthlySuggest.USD; frb.amounts.monthlySuggest.NZD = frb.amounts.monthlySuggest.USD;
frb.amounts.monthlySuggest.RON = frb.amounts.monthlySuggest.MYR; frb.amounts.monthlySuggest.PLN = frb.amounts.monthlySuggest.MYR; frb.amounts.monthlySuggest.NOK = frb.amounts.monthlySuggest.SEK;
frb.amounts.test = function() {
/** * Check if amounts are less than minimum acceptable * * @param {string} desc - description for error message e.g. 'amount option' * @param {Object} dataObject - data to check e.g. frb.amounts.options7 * @param {Function} extractFunction - function to get test value e.g. d => d[0] for 1st amount */ var testMinimums = function( desc, dataObject, extractFunction = d => d ) { const errorMessage = 'Error %s %s %s is less than minimum %s'; for ( const currency in dataObject ) { let data = dataObject[currency].default || dataObject[currency], // need default for some EUR value = extractFunction(data), minimum = frb.amounts.minimums[currency]; console.assert( value >= minimum, errorMessage, currency, desc, value, minimum ); } };
testMinimums( 'if everyone', frb.amounts.ifEveryone, d => d ); testMinimums( 'average', frb.amounts.averages, d => d ); testMinimums( 'amount option', frb.amounts.options7, d => d[0] ); testMinimums( 'monthly suggestion', frb.amounts.monthlySuggest, d => d[1][1] );
};
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 'CZK' : '\t Kč', 'DKK' : '\t kr.', 'HUF' : '\t Ft', 'ILS' : { 'he' : '\t ₪', 'yi' : '\t ₪', 'ar' : '\t ₪', 'default' : '₪ \t' }, 'INR' : '₹ \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' : { 'en' : 'R$\t', 'default' : 'R$ \t' }, 'ARS' : '$\t', 'CLP' : '$\t', 'COP' : '$\t', 'MXN' : '$\t', 'PEN' : 'S/. \t', 'UYU' : '$U \t', 'CHF' : '\t CHF' };
// Check in user language first, then fall back to English frb.countryNames = { 'af' : { 'ZA' : 'Suid-Afrika' }, 'en' : { 'US' : 'the United States', 'CA' : 'Canada', 'GB' : 'the UK', 'IE' : 'Ireland', 'AU' : 'Australia', 'NZ' : 'New Zealand', 'AR' : 'Argentina', 'AT' : 'Austria', 'BE' : 'Belgium', 'BR' : 'Brazil', 'CH' : 'Switzerland', 'CL' : 'Chile', 'CO' : 'Colombia', 'CZ' : 'the Czech Republic', 'DK' : 'Denmark', 'ES' : 'Spain', 'FR' : 'France', 'GR' : 'Greece', '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' }, 'ca' : { 'AT' : 'd’Àustria', 'BE' : 'de Bèlgica', 'DK' : 'de Dinamarca', 'ES' : 'a Espanya', 'HU' : 'd’Hongria', 'IL' : 'd’Israel', 'LV' : 'de Letònia', 'LU' : 'de Luxemburg', 'MY' : 'de Malàisia', 'NO' : 'de Noruega', 'PL' : 'de Polònia', 'PT' : 'de Portugal', 'RO' : 'de Romania', 'SK' : 'd’Eslovàquia', 'ZA' : 'de Sud-àfrica', 'UA' : 'd’Ucraïna' }, 'cs' : { 'CZ' : 'v České republice', 'AT' : 'v Rakousku', 'BE' : 'v Belgii', 'DK' : 'v Dánsku', 'GR' : 'v Řecku', 'IL' : 'v Izraeli', 'LU' : 'v Lucembursku', 'MY' : 'v Malajsii', 'NO' : 'v Norsku', 'PT' : 'v Portugalsku', 'SE' : 've Švédsku', 'ZA' : 'v Jihoafrické republice' }, 'es' : { 'AR' : 'en Argentina', 'AT' : 'en Austria', 'BE' : 'en Bélgica', 'BR' : 'en Brasil', 'CL' : 'en Chile', 'CO' : 'en Colombia', 'DK' : 'en Dinamarca', 'ES' : 'en España', 'HU' : 'en Hungría', 'IL' : 'en Israel', 'LU' : 'en Luxemburgo', 'LV' : 'en Letonia', 'MX' : 'en México', 'MY' : 'en Malasia ', 'NO' : 'en Noruega', 'PE' : 'en Perú', 'PL' : 'en Polonia', 'PT' : 'en Portugal', 'RO' : 'en Rumania', 'SK' : 'en Eslovaquia', 'UA' : 'en Ucrania', 'US' : 'en los Estados Unidos', 'UY' : 'en Uruguay', 'ZA' : 'en Sudafrica' }, 'da' : { 'AT' : 'i Østrig', 'BE' : 'i Belgien', 'CZ' : 'i Tjekkiet', 'DK' : 'i Danmark', 'ES' : 'i Spanien', 'GR' : 'i Grækenland', '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', 'SE' : 'i Sverige', 'SK' : 'i Slovakiet', 'ZA' : 'i Sydafrika', 'UA' : 'i Ukraine' }, 'nl' : { 'NL' : 'in Nederland', 'AT' : 'in Oostenrijk', 'BE' : 'in België', 'DK' : 'in Denemarken', 'CZ' : 'in Tsjechië', 'ES' : 'in Spanje', 'GR' : 'in Griekenland', '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ë', 'SE' : 'in Zweden', 'SK' : 'in Slowakije', 'ZA' : 'in Zuid-Afrika', 'UA' : 'in Oekraïne' }, 'fr' : { 'AT' : 'en Autriche', 'BE' : 'en Belgique', 'CH' : 'en Suisse', 'CA' : 'au Canada', 'CZ' : 'en République tchèque', 'DK' : 'au Danemark', 'ES' : 'en Espagne', 'FR' : 'en France', 'GR' : 'en Grèce', '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', 'SE' : 'en Suède', 'SK' : 'en Slovaquie', 'ZA' : 'en Afrique du Sud', 'UA' : 'en Ukraine' }, 'de' : { 'AT' : 'in Österreich', 'BE' : 'in Belgien', 'CH' : 'in der Schweiz', 'CZ' : 'in Tschechien', 'DK' : 'in Dänemark', 'ES' : 'in Spanien', 'GR' : 'in Griechenland', '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', 'SE' : 'in Schweden', 'SK' : 'in der Slowakei', 'ZA' : 'in Südafrika', 'UA' : 'in der Ukraine' }, 'el' : { 'AT' : 'στην Αυστρία', 'BE' : 'στο Βέλγιο', 'CZ' : 'στην Τσεχία', 'DK' : 'στη Δανία', 'ES' : 'στην Ισπανία', 'GR' : 'στην Ελλάδα', 'HU' : 'στην Ουγγαρία', 'IL' : 'στο Ισραήλ', 'LV' : 'στη Λετονία', 'LU' : 'στο Λουξεμβούργο', 'MY' : 'στη Μαλαισία', 'NO' : 'στη Νορβηγία', 'PL' : 'στην Πολωνία', 'PT' : 'στην Πορτογαλία', 'RO' : 'στη Ρουμανία', 'SE' : 'στη Σουηδία', 'SK' : 'στη Σλοβακία', 'ZA' : 'στη Νότια Αφρική', 'UA' : 'στην Ουκρανία' }, 'he' : { 'AT' : 'אוסטרליה', 'BE' : 'בלגיה', 'CZ' : "בצ'כיה", 'DK' : 'דנמרק', 'ES' : 'ספרד', 'GR' : 'ביוון', 'HU' : 'הונגריה', 'IL' : 'ישראל', 'LV' : 'לטביה', 'LU' : 'לוקסמבורג', 'MY' : 'מלזיה', 'NO' : 'נורווגיה', 'PL' : 'פולין', 'PT' : 'פורטוגל', 'RO' : 'רומניה', 'SE' : 'בשוודיה', 'SK' : 'סלובקיה', 'ZA' : 'דרום אפריקה', 'UA' : 'אוקראינה' }, 'hu' : { 'AT' : 'ausztriai', 'BE' : 'belgiumi', 'DK' : 'dániai', 'ES' : 'spanyolországi', 'HU' : 'magyarországi', 'IL' : 'izraeli', 'LV' : 'lettországi', 'LU' : 'luxemburgi', 'MY' : 'malajziai', 'NO' : 'norvégiai', 'PL' : 'lengyelországi', 'PT' : 'portugáliai', 'RO' : 'romániai', 'SK' : 'szlovákiai', 'ZA' : 'dél-afrikai', 'UA' : 'ukrajnai' }, 'it' : { 'IT' : 'Italia', 'CH' : 'Svizzera' }, 'lv' : { 'AT' : 'valstī Austrijā', 'BE' : 'valstī Beļģijā', 'DK' : 'valstī Dānijā', 'ES' : 'valstī Spā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', 'CZ' : 'i Tsjekkia', 'DK' : 'i Danmark', 'ES' : 'i Spania', 'GR' : 'i Hellas', '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', 'SE' : 'i Sverige', 'SK' : 'i Slovakia', 'ZA' : 'i Sør-Afrika', 'UA' : 'i Ukraina' }, 'pl' : { 'AT' : 'w Austrii', 'BE' : 'w Belgii', 'DK' : 'w Danii', 'ES' : 'w Hiszpanii', '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', 'BR' : 'no Brasil', 'CZ' : 'na República Checa', 'DK' : 'na Dinamarca', 'ES' : 'na Espanha', 'GR' : 'na Grécia', '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', 'SE' : 'na Suécia', 'SK' : 'na Eslováquia', 'ZA' : 'na África do Sul', 'UA' : 'na Ucrânia' }, 'ro' : { 'AT' : 'din Austria', 'BE' : 'din Belgia', 'DK' : 'din Danemarca', 'ES' : 'în Spania', 'HU' : 'din Ungaria', 'IL' : 'din Israel', 'LV' : 'din Latvia', 'LU' : 'din Luxemburg', 'MY' : 'din Malaezia', 'NO' : 'din Norvegia', 'PL' : 'din Polonia', 'PT' : 'din Portugalia', 'RO' : 'din România', 'SK' : 'din Slovacia', 'ZA' : 'din Africa de Sud', 'UA' : 'din Ucraina' }, 'ru' : { 'AT' : 'в Австрии', 'BE' : 'в Бельгии', 'DK' : 'в Дании', 'ES' : 'в Испании', 'HU' : 'в Венгрии', 'IL' : 'в Израиле', 'LV' : 'в Латвии', 'LU' : 'в Люксембурге', 'MY' : 'в Малайзии', 'NO' : 'в Норвегии', 'PL' : 'в Польше', 'PT' : 'в Португалии', 'RO' : 'в Румынии', 'SK' : 'в Словакии', 'ZA' : 'в Южной Африке', 'UA' : 'в Украине' }, 'sk' : { 'AT' : 'v Rakúsku', 'BE' : 'v Belgicku', 'DK' : 'v Dánsku', 'ES' : 'v Španielsku', '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' }, 'sv' : { 'SE' : 'i Sverige', 'AT' : 'i Österrike', 'BE' : 'i Belgien', 'CZ' : 'i Tjeckien', 'DK' : 'i Danmark', 'ES' : 'i Spanien', 'GR' : 'i Grekland', 'HU' : 'i Ungern', 'IL' : 'i Israel', 'LV' : 'i Lettland', 'LU' : 'i Luxemburg', 'MY' : 'i Malaysia', 'NO' : 'i Norge', 'PL' : 'i Polen', 'PT' : 'i Portugal', 'RO' : 'i Rumänien', 'SK' : 'i Slovakien', 'ZA' : 'i Sydafrika', 'UA' : 'i Ukraina' }, 'uk' : { 'AT' : 'у Австрії', 'BE' : 'у Бельгії', 'DK' : 'у Данії', 'ES' : 'в Іспанії', 'HU' : 'в Угорщині', 'IL' : 'в Ізраїлі', 'LV' : 'у Латвії', 'LU' : 'у Люксембургу', 'MY' : 'у Малайзії', 'NO' : 'у Норвегії', 'PL' : 'у Польщі', 'PT' : 'у Португалії', 'RO' : 'у Румунії', 'SK' : 'у Словаччині', 'ZA' : 'у ПАР', 'UA' : 'в Україні' } };
/* Most of the translations are actually using "in COUNTRY" or similar to account for grammar differences. So this makes English do the same, and allows us to use a clearer %in-country% variable, while avoiding breaking old content using %country%.
- /
frb.inCountryNames = JSON.parse( JSON.stringify( frb.countryNames ) ); // deep copy frb.inCountryNames.en = { 'US' : 'in the United States', 'CA' : 'in Canada', 'GB' : 'in the UK', 'IE' : 'in Ireland', 'AU' : 'in Australia', 'NZ' : 'in New Zealand', 'AR' : 'in Argentina', 'AT' : 'in Austria', 'BE' : 'in Belgium', 'BR' : 'in Brazil', 'CH' : 'in Switzerland', 'CL' : 'in Chile', 'CO' : 'in Colombia', 'CZ' : 'in the Czech Republic', 'DK' : 'in Denmark', 'ES' : 'in Spain', 'FR' : 'in France', 'GR' : 'in Greece', 'HK' : 'in Hong Kong', 'HU' : 'in Hungary', 'IL' : 'in Israel', 'IN' : 'in India', 'IT' : 'in Italy', 'JP' : 'in Japan', 'LU' : 'in Luxembourg', 'LV' : 'in Latvia', 'MX' : 'in Mexico', 'MY' : 'in Malaysia', 'NL' : 'in the Netherlands', 'NO' : 'in Norway', 'PE' : 'in Peru', 'PL' : 'in Poland', 'PT' : 'in Portugal', 'RO' : 'in Romania', 'SE' : 'in Sweden', 'SK' : 'in Slovakia', 'UA' : 'in Ukraine', 'UY' : 'in Uruguay', 'ZA' : 'in South Africa' };
frb.dayNames = { 'en' : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ], 'ca' : [ 'diumenge', 'dilluns', 'dimarts', 'dimecres', 'dijous', 'divendres', 'dissabte' ], 'ja' : [ '日', '月', '火', '水', '木', '金', '土' ], '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øndagen', 'mandagen', 'tirsdagen', 'onsdagen', 'torsdagen', 'fredagen', 'lørdagen' ], '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ę' ], 'pt' : [ 'neste domingo', 'nesta segunda-feira', 'nesta terça-feira', 'nesta quarta-feira', 'nesta quinta-feira', 'nesta sexta-feira', 'neste sábado' ], 'ru' : [ 'воскресенье', 'понедельник', 'вторник', 'среду', 'четверг', 'пятницу', 'субботу' ], 'uk' : [ 'неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниц', 'суботи' ], 'hu' : [ 'vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat' ], 'ro' : [ 'duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă' ], 'af' : [ 'Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag' ], 'aa' : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] };
// "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' ], 'el' : [ 'Αυτήν την Κυριακή', 'Αυτή τη Δευτέρα', 'Αυτήν την Τρίτη', 'Αυτήν την Τετάρτη', 'Αυτήν την Πέμπτη', 'Αυτήν την Παρασκευή', 'Αυτό το Σάββατο' ], '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' : [ 'este domingo', 'esta segunda-feira', 'esta terça-feira', 'esta quarta-feira', 'esta quinta-feira', 'esta sexta-feira', 'este sábado'], 'sk' : [ 'túto nedeľu', 'tento pondelok', 'tento utorok', 'túto stredu', 'tento štvrtok', 'tento piatok', 'túto sobotu'], 'cs' : [ 'tuto neděli', 'toto pondělí', 'toto úterý', 'tuto středu', 'tento čtvrtek', 'tento pátek', 'tuto sobotu'] };
frb.iPadTranslations = { 'en' : 'iPad' }; frb.amounts.ifEveryone.GBP = 2.50; frb.amounts.options7.GBP = [2.50, 5, 10, 20, 30, 50, 100]; /* MediaWiki:FundraisingBanners/CoreJS-2017.js
* Core code for banner forms */
var frb = frb || {};
/**
* 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.) */
frb.submitForm = function(options) {
var form = document.getElementById('frb-form'); var uri = new mw.Uri('https://payments.wikimedia.org/index.php/Special:GatewayFormChooser'); var params = {};
/* 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(form);
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(form); // See if "Pay the fee" is checked if ( $('#frb-ptf-checkbox').prop('checked') ) { amount = amount + frb.calculateFee(amount); } if ( !frb.validateAmount(amount) ) { return false; // Amount problem, bail out of submitting } params.amount = amount;
/* Tracking info */ params.utm_medium = 'sitenotice'; params.utm_campaign = mw.centralNotice.data.campaign || 'test'; params.utm_source = frb.buildUtmSource(params); // No longer used since we have banner history, could use to store something else // params.utm_key = mw.centralNotice.bannerData.cookieCount || 0;
/* 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(); }
};
/**
* 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; utm_source += '.no-LP.' + fullDottedPaymentMethod;
return utm_source;
};
/**
* 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?
* * Own function so can be overriden for different forms */
frb.getRecurring = function(form) {
return form.frequency.value === 'monthly';
};
/**
* Return amount selected */
frb.getAmount = function(form) {
var amount = null;
// 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; }
amount = parseFloat(amount); if ( isNaN(amount) ) { return 0; } else { return amount; }
};
/**
* Check if given amount is valid i.e. a positive number, between minimum and maximum. * If not, show an error and return false. * * @param {number} amount [description] * @return {boolean} [description] */
frb.validateAmount = function( amount ) {
var currency = frb.getCurrency( mw.centralNotice.data.country ); var minAmount = frb.amounts.minimums[ currency ]; var errorMessage; if ( amount === null || isNaN(amount) || amount <= 0 || amount < minAmount ) { errorMessage = "Please select an amount (minimum $1)" .replace( '$1', minAmount + ' ' + currency ); window.alert( errorMessage ); return false; } else if ( amount > 10000 * minAmount ) { errorMessage = "We cannot accept donations greater than USD $4 ($1 $2) through our website. Please contact our major gifts staff at $3." .replace( '$1', 10000*minAmount ) .replace( '$2', currency ) .replace( '$3', 'benefactors@wikimedia.org' ); window.alert( errorMessage ); return false; } else { return true; }
};
/**
* 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(); });
// 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; } };
}; /* End of MediaWiki:FundraisingBanners/CoreJS-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 5 at the top for speed case 'US': return 'USD'; case 'CA': return 'CAD'; case 'GB': return 'GBP'; case 'AU': return 'AUD'; case 'NZ': return 'NZD'; // Euro countries case 'AD': case 'AL': case 'AM': case 'AT': case 'AW': case 'AZ': case 'BE': case 'BY': case 'CI': case 'CY': case 'DE': case 'EE': case 'ES': case 'FI': case 'FR': case 'GF': case 'GR': case 'IE': case 'IT': case 'LT': case 'LU': case 'LV': case 'LY': case 'MC': case 'ME': case 'MG': case 'MT': case 'NL': case 'PT': case 'RE': case 'RS': case 'SI': case 'SK': case 'SM': case 'SR': case 'VA': return 'EUR'; // The rest case 'AE': return 'AED'; case 'AR': return 'ARS'; case 'BA': return 'BAM'; case 'BB': return 'BBD'; case 'BD': return 'BDT'; case 'BG': return 'BGN'; case 'BH': return 'BHD'; case 'BM': return 'BMD'; case 'BO': return 'BOB'; case 'BR': return 'BRL'; case 'BZ': return 'BZD'; case 'CH': return 'CHF'; case 'CK': return 'NZD'; case 'CL': return 'CLP'; case 'CN': return 'CNY'; case 'CO': return 'COP'; case 'CR': return 'CRC'; case 'CZ': return 'CZK'; case 'DK': return 'DKK'; case 'DO': return 'DOP'; case 'DZ': return 'DZD'; case 'EG': return 'EGP'; case 'FJ': return 'FJD'; case 'FO': return 'DKK'; case 'GL': return 'DKK'; case 'GT': return 'GTQ'; case 'HK': return 'HKD'; case 'HN': return 'HNL'; case 'HR': return 'HRK'; case 'HU': return 'HUF'; case 'ID': return 'IDR'; case 'IL': return 'ILS'; case 'IN': return 'INR'; case 'IS': return 'ISK'; case 'JM': return 'JMD'; case 'JO': return 'JOD'; case 'JP': return 'JPY'; case 'KE': return 'KES'; case 'KI': return 'AUD'; case 'KR': return 'KRW'; case 'KZ': return 'KZT'; case 'LB': return 'LBP'; case 'LI': return 'CHF'; case 'LK': return 'LKR'; case 'MA': return 'MAD'; case 'MK': return 'MKD'; case 'MV': return 'MVR'; case 'MW': return 'GBP'; case 'MX': return 'MXN'; case 'MY': return 'MYR'; case 'NI': return 'NIO'; case 'NO': return 'NOK'; case 'NP': return 'INR'; case 'NR': return 'AUD'; case 'OM': return 'OMR'; case 'PA': return 'PAB'; case 'PE': return 'PEN'; case 'PG': return 'AUD'; case 'PH': return 'PHP'; case 'PK': return 'PKR'; case 'PL': return 'PLN'; case 'PY': return 'PYG'; case 'QA': return 'QAR'; case 'RO': return 'RON'; case 'RU': return 'RUB'; case 'SA': return 'SAR'; case 'SD': return 'GBP'; case 'SE': return 'SEK'; case 'SG': return 'SGD'; case 'TH': return 'THB'; case 'TM': return 'RUB'; case 'TN': return 'TND'; case 'TR': return 'TRY'; case 'TT': return 'TTD'; case 'TW': return 'TWD'; case 'UA': return 'UAH'; case 'UY': return 'UYU'; case 'UZ': return 'RUB'; case 'VE': return 'VEF'; case 'VN': return 'VND'; case 'VU': return 'AUD'; case 'ZA': return 'ZAR'; // small multi-country currencies case 'CW': case 'SX': return 'ANG'; case 'AG': case 'DM': case 'GD': case 'KN': case 'LC': return 'XCD'; case 'BJ': case 'BF': case 'CI': case 'GW': case 'ML': case 'NE': case 'SN': case 'TG': return 'XOF'; case 'PF': case 'NC': case 'WF': return 'XPF'; // 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]; }
};
/**
* 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) {
// Countries with no credit card option (currently none) var noCC = []; if ($.inArray(country, noCC) !== -1) { $('.frb-pm-cc').remove(); }
// Can't do monthly credit card in Brazil if (country === 'BR') { $('.frb-pm-cc').addClass('no-monthly'); }
// Remove any leftover WorldPay $('.frb-pm-cc-wp').remove();
// Countries using Adyen for credit card if (country === 'FR' || country === 'IL' || country === 'UA') { $('.frb-pm-cc').remove(); $('.frb-pm-cc-adyen').show(); } else { $('.frb-pm-cc-adyen').remove(); }
// Countries with no PayPal option var noPP = ['IN', 'RU', 'SG', 'AE', 'QA', 'OM', 'BD', 'BO', 'PA', 'PY', 'GT', 'JM', 'TT', 'DZ', 'PE']; if ($.inArray(country, noPP) !== -1) { $('.frb-pm-pp').remove(); $('.frb-pm-pp-usd').remove(); }
// Countries with no PayPal for mobile only var noPPmobile = ['PH', 'ID', 'TH', 'KR', 'MY', 'VN']; var mobileRegex = /(_mob_|_ipd_)/ 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']; 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' : ['AU'], 'ideal' : ['NL'], 'bt' : ['AR', 'BR', 'CL', 'CO'], // Bank Transfer (Astropay) 'cash' : ['AR', 'BR', 'CO', 'MX', 'UY'] // '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(); } }
};
/**
* 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) ); } } });
};
frb.noRecurringCountries = ['AR', 'CL', 'CO', 'MX', 'PE', 'UY', 'BR'];
/* 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);
// Hide recurring for some countries if ( frb.noRecurringCountries.indexOf(country) !== -1 ) { // country is in the list $('.frb-frequency, .recurring-details').hide(); }
// 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 );
// 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) */ $('.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 });
// 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(); }
}); frb.rml = {
post: function() { /* Create the iframe for the form and use it as the form's target */ var frameName = 'remindFrame'; var $form = $('#frb-rml-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(); },
getCurrentDate: function() { /* Get current date in correct format for Silverpop */ 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; }
return mm+'/'+dd+'/'+yyyy; },
init: function() { /* Prep the reminder form */
var form = document.getElementById('frb-rml-form'); if ( !form ) return;
form.rml_country.value = mw.centralNotice.data.country; form.rml_language.value = mw.centralNotice.data.uselang; form.rml_submitDate.value = frb.rml.getCurrentDate(); form.rml_segment.value = Math.floor((Math.random() * 100) + 1);
$('.frb-rml-link').click(function() { $('.frb-rml-form').toggle(); $('#frb-rml-email').focus(); });
$('#frb-rml-submit').click(function() { if ( mw.util.validateEmail( form.Email.value ) ) { frb.rml.post(); $('.frb-rml-form, .frb-rml-link').hide(); $('.frb-rml-ty').show(); mw.centralNotice.internal.hide.setHideWithCloseButtonCookies(); // Hide future banners for 7 days return false; } else { $('#frb-rml-email').addClass('error').focus(); $('.frb-rml-error').show(); return false; } }); }
};
$(function() {
mw.loader.using(['mediawiki.util']).then(function() { frb.rml.init(); });
});
/** 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.initAmountOptions(); frb.localizeAmountOptions(frb.amounts.options7, currency, country, language, false);
// Hide Banner when on click and enter when focused $('.frb-close').on('click keypress', function(e){ if (e.which === 13 || e.type === 'click') { frb.hide(); e.stopPropagation(); } });
// Show RML form on Enter $('.frb-rml-link').keyup(function(event){ if (event.keyCode == 13) { $('.frb-rml-form').toggle(); $('#frb-rml-email').focus(); } });
// Focus for #input_amount_other $('.frb-amt-other').click(function() { document.getElementById('input_amount_other').checked = true; $('#frb-amt-other-input').focus(); });
// Activate #input_amount_other radio when tabbing into #frb-amt-other-input $('#frb-amt-other-input').focus(function() { document.getElementById('input_amount_other').checked = true; });
// Minimize on scroll var stickyHeaderTop = $('.frb').height(); function minimizeScrollFunction() { if( $(window).scrollTop() > stickyHeaderTop ) { $('.frb').css({position: 'fixed', top: '0px'}).addClass('frb--minimized'); } else { $('.frb').css({position: 'absolute', top: '0px'}).removeClass('frb--minimized'); frb.addSpace(); } }
var scrollPos; $(window).on('scroll resize', function() { scrollPos = $(window).scrollTop(); // Keep frb minimized until clicked or the user scrolls to the top of the page. if ( frb.clicked === false ) { minimizeScrollFunction(); } // Restore default state if ( scrollPos === 0 ) { $('.frb').css({position: 'absolute', top: '0px'}).removeClass('frb--minimized'); frb.addSpace(); frb.clicked = false; } });
frb.clicked = false; $('.frb').click(function() { if ( $(this).hasClass('frb--minimized') ) { $(this).css({position: 'fixed', top: '0px'}).removeClass('frb--minimized'); frb.clicked = true; } });
/* 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'; }
if (!mw.centralNotice.bannerData.hideResult) { frb.show(); }
}); </script>