MediaWiki:Centralnotice-template-robin 20171207 mob lg nag redesign

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

<style> /* Resets */ .frb * {

   margin: 0;
   padding: 0;

}

/* Box-sizing */ .frb, .frb *, .frb *:before, .frb *:after, .frb-nag {

   -moz-box-sizing: border-box;
   -webkit-box-sizing: border-box;
   box-sizing: border-box;

}

.frb input[type="radio"], .frb input[type="number"] {

   appearance: none;
   -webkit-appearance: none;
   -moz-appearance: none;

}

.frb input[type="radio"]:focus, .frb input[type="number"]:focus, .frb-radio:focus + .frb-label, .frb button:focus, .frb-rml-email:focus, .frb-btn-submit:focus {

   outline: 0;

}

.frb-ptf-checkbox, .frb input[type="radio"] {

   position: absolute;
   overflow: hidden;
   height: 1px;
   width: 1px;
   clip: rect(0 0 0 0);
   border: 0;
   margin: -1px;
   padding: 0;

}

.frb input[type="number"] {

   background-color: transparent;
   -moz-appearance:textfield;

}

.frb input[type="number"]::-webkit-outer-spin-button, .frb input[type="number"]::-webkit-inner-spin-button {

   -webkit-appearance: none;
   margin: 0;

}

.frb img {

   max-width: 100%;

}

/* Font sizes and line heights */ .frb-close, .frb-options, .frb-footer {

   font-size: 12px;

}

.frb-footer {

   line-height: 1.5;

}

.frb-legend {

   font-size: 16px;
   line-height: 1.2;

}

.frb, .frb input, .frb button, .frb-ptf {

   font-size: 17px;

}

.frb, .frb input, .frb button {

   line-height: 1;

}

.frb-message, .frb-rml-error, .frb-ptf {

   line-height: 1.4117647059; /*24px @17px*/

}

/* Styles */ /* Hide banner when Wikipedia site search is enabled */ .overlay-enabled .frb, .overlay-enabled .frb-nag {

   display: none !important;

}

.frb-top {

   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   z-index: 110;
   height: 100%;
   border-bottom: 1px solid #c8ccd1;
   box-shadow: 0 1px 1px rgba(0,0,0,0.1);
   font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
   font-weight: bold;

}

.frb-mask {

   position: absolute;
   z-index: 1000;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: black;
   opacity: 0.8;

}

.frb-window {

   position: relative;
   z-index: 1001;
   top: 0;
   left: 0;
   right: auto;
   width: 100%;
   margin-top: 0;
   color: #000;
   background: #fff;

}

.frb-close {

   color: #000000;
   font-weight: normal;
   text-transform: uppercase;
   cursor: pointer;
   white-space: nowrap;

}

.frb-close:hover, .frb-close:focus {

   color: #36c;

}

.frb-close-icon {

   height: 11px;
   width: 11px;
   margin-bottom: -1px;

}

.frb-close:hover .frb-close-icon g, .frb-close:focus .frb-close-icon g {

   stroke: #36c;

}

.frb-inline-close {

   position: absolute;
   z-index: 2;
   top: 8px;
   right: 8px;
   padding: 8px; /* increase click/tap area */

}

.frb-header {

   padding: 24px 20px 0 20px;
   text-align: center;

}

.frb-header-logo {

   width: 100%;
   height: 100%;
   max-height: 20px;

}

.frb-conversation {

   max-width: 640px;
   margin: 0 auto;

}

.frb-message {

   position: relative;
   margin: 12px 14px 0;
   padding: 12px 20px;
   background-color: #E5E5EA;
   font-weight: bold;
   border-radius: 1em;
   font-size: 18px;
   line-height: 1.5; /* 27px @18px */

}

.frb-message:before {

   content: ;
   display: block;
   width: 1.5em;
   height: 1em;
   position: absolute;
   left: -0.5em;
   bottom: 0;
   border-right: 1em solid #E5E5EA;
   border-bottom-right-radius: 100%;

}

.frb-greeting {

   display: block;
   padding-bottom: 17px;

}

.frb-message--typing {

   max-width: 82px;
   padding: 6px 20px 8px;

}

.is-hidden {

   display: none;

}

/* Type indicator */ @keyframes blink {

   50% {
       fill: #A2A9B1;
   }

}

.type-indicator__circle {

   fill: #C8CCD1;

}

.type-indicator__circle {

   animation: 1s blink infinite;

}

.type-indicator__circle:nth-child(2) {

   animation-delay: 250ms;

}

.type-indicator__circle:nth-child(3) {

   animation-delay: 500ms;

}

.frb-form {

   position: relative;
   width: 100%;

}

.form-monthly .no-monthly {

   display: none !important;

}

.frb-fieldset {

   border: 0;
   margin: 8px 10px 0;

}

.form-monthly .no-monthly {

   display: none !important;

}

/* Balance out paddings, since 4px button padding */ .frb-fieldset + .frb-message, .frb-fieldset + .frb-message + .frb-message {

   margin-top: 8px;

}

.frb-legend {

   padding-left: 4px;
   padding-bottom: 4px;
   color: #000000;
   font-weight: 500;

}

.frb-button {

   display: table;
   float: left;
   padding: 4px;
   cursor: pointer;

}

.frb-payment-options {

   display: table;
   table-layout: fixed;
   width: 100%;

}

.frb-payment .frb-button {

   display: table-cell;
   float: none;
   vertical-align: top;

}

.frb-button-table {

   display: table;
   width: 100%;

}

/*Label is replaced by icons, but here for accessibility*/ .frb-pm-cc-label {

   display: none;

}

.frb-frequency .frb-button {

   width: 50%;

}

.frb-amounts .frb-button {

   width: 33.333333333%;

}

.frb-payment-options .frb-button {

   width: 100%;

}

.frb-payment-options .frb-button:first-child:nth-last-child(4), .frb-payment-options .frb-button:first-child:nth-last-child(4) ~ .frb-button {

   width: 50%;

}

/* Other amount field */ .frb-other-txt, .frb-other-input {

   line-height: 1;
   text-align: left;

}

.frb-other-txt {

   white-space: nowrap;
   font-size: 16px;
   display: block;
   text-align: center;
   margin-bottom: 8px;

}

@media all and (min-width: 720px) {

   .frb-other-txt {
       font-size: inherit;
   }

}

.frb-other-input {

   width: 100% !important;
   border: none;
   text-align: center !important;
   font-weight: bold;
   color: #36c;
   box-shadow: 0 2px 0 0 #36c;
   text-align: right;
   border-radius: 0; /* Needed for iOS */

}

.frb-other-input::-webkit-input-placeholder { /* Chrome/Opera/Safari */

   color: #A2A9B1;
   font-weight: normal;

} .frb-other-input::-moz-placeholder { /* Firefox 19+ */

   color: #A2A9B1;
   font-weight: normal;
   opacity: 1;

} .frb-other-input:-ms-input-placeholder { /* IE 10+ */

   color: #A2A9B1;
   font-weight: normal;

} .frb-other-input:-moz-placeholder { /* Firefox 18- */

   color: #A2A9B1;
   font-weight: normal;

}

.frb-button--other .frb-label {

   padding: 4px 6px;

}

@media all and (min-width: 720px) {

   .frb-button--other .frb-label {
       padding: 4px 8px;
   }

}

.frb-radio:checked + .frb-label .frb-other-input {

   color: #FFFFFF;
   box-shadow: 0 2px 0 0 #FFFFFF;

}

.frb-label, .frb-cta {

   height: 76px;
   padding: 4px 6px;
   line-height: 1; /* 19px @19px */

}

.frb-label {

   display: table-cell; /* To vertical align content */
   vertical-align: middle;
   width: 100%;
   color: #36c;
   background-color: #f8f9fa;
   border-radius: 10px;
   border: 1px solid #a2a9b1;
   text-align: center;
   transition: background-color 0.5s ease;
   cursor: pointer;
   transition: all 0.5s ease;

}

.frb-label:hover, .frb-rml-email:hover, .frb-btn-submit:hover {

   background-color: #EAF3FF;

}

.frb-radio:checked + .frb-label {

   background-color: #36c;
   border-color: #36c;
   color: #FFFFFF;
   font-weight: bold;

}

.frb-radio:checked + .frb-label path {

   fill: #FFFFFF;

}

.frb-radio:focus + .frb-ptf-label {

   box-shadow: inset 0 0 0 1px #36c;

}

.frb-radio:focus:checked + .frb-label, .frb-cta:focus, .frb-button--is-focused .frb-label, .frb-ptf-checkbox:focus + .frb-ptf-label .frb-ptf-img, .frb .frb-nag-btn:focus {

   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-radio:hover + .frb-label, .frb-radio:focus + .frb-label, .frb-rml-email:focus, .frb-btn-submit:focus, .frb-nag-close:focus {

   border-color: #36c;

}

.frb-logo-payments {

   float: left;
   width: 100%;
   height: 100%;
   max-height: 34px;
   margin-top: -2px; /* Visual tweak */

}

.frb-logo-payments--paypal-usd {

   margin-top: 4px; /* Visual tweak */

}

.frb-submit {

   display: none;

}

.frb-cta {

   display: inline-block;
   cursor: pointer;
   margin: 8px 4px 0;
   width: calc(100% - 8px);
   background-color: #36c;
   border: 1px solid #36c;
   border-radius: 10px;
   color: #FFFFFF;
   font-weight: bold;
   text-transform: uppercase;
   transition: background-color 0.5s ease;

}

.frb-cta:hover {

   background-color: #447ff5;
   border-color: #447ff5;

}

.frb-cta-amount {

   display: none;

}

.frb-footer {

   padding: 16px 12px 24px 12px;
   font-weight: normal;
   color: #666666;

}

.frb-footer a {

   color: #36c;

}

.frb-footer a:hover {

   text-decoration: underline;

}

/* Remind me later (RML) */ .frb-options {

   margin: 0 20px;
   text-align: center;
   color: #000000;
   font-weight: bold;
   text-transform: uppercase;

}

.frb-options-link {

   display: inline-block;
   margin-top: 12px;
   padding: 4px;
   cursor: pointer;
   color: #36c;
   transition: color 0.5s ease;

}

.frb-options-link:hover {

   text-decoration: underline;

}

.frb-btn-submit-wrapper {

   text-align: center;

}

.frb-rml-email {

   margin: 4px 0 0 0;
   padding: 16px 12px;
   width: 100%;
   color: #000000;
   background-color: #f8f9fa;
   border-radius: 10px;
   border: 1px solid #a2a9b1;
   transition: background-color 0.5s ease;
   cursor: pointer;
   font-weight: normal;

}

.frb-btn-grp {

   display: block;
   margin-top: 8px;

}

.frb-btn-submit {

   cursor: pointer;
   margin-top: 8px;
   padding: 16px;
   color: #36c;
   background-color: #f8f9fa;
   border-radius: 10px;
   border: 1px solid #a2a9b1;
   transition: background-color 0.5s ease;
   cursor: pointer;

}

.frb-rml-error {

   padding: 12px 12px 8px 12px;
   color: #b32424;

}

/* Nag */ .frb-nag {

   z-index: 1003;
   position: fixed;
   left: 0;
   bottom: -100%;
   width: 100%;
   display: block;
   color: black;
   background-color: white;
   padding: 8px 10px;
   text-align: center;
   font-size: 15px;
   line-height: 1.2; /*18px @15px*/
   font-weight: bold;
   border: 5px solid #990000;
   cursor: pointer;
   transition: all 1s ease-in-out;
   margin: 5px 8px;
   width: calc(100% - 16px);
   border-radius: 2px;

}

.frb-nag.reveal {

   bottom: 0;

}

.frb-icon-info {

   height: 15px;
   width: 15px;
   margin-bottom: -2px;

}

.frb .frb-nag-btn, .frb-nag-close {

   display: inline-block;
   border-radius: 2px;
   padding: 7px 16px 8px;
   font-size: 13px !important;
   line-height: 1.1538461538 !important; /*15px @13px*/
   cursor: pointer;

}

.frb .frb-nag-btn {

   color: #fff;
   border: 1px solid #36c;
   background-color: #36c;

}

.frb .frb-nag-btn:hover {

   background-color: #447ff5;

}

.frb .frb-nag-close {

   color: #36c;
   border: 1px solid #a2a9b1;
   background-color: #f8f9fa;
   font-weight: bold;
   margin-left: 6px;
   text-transform: none;

}

.frb .frb-nag-close:hover {

   background-color: #fff;

}

/*Credit Card Icons*/

/*Countries with 4 available payment options*/ .frb-payment-logo-wrapper {

   display: block;
   margin: 0 auto;
   width: 78px;

}

@media all and (min-width: 375px) {

   .frb-payment-logo-wrapper {
       width: 97px;
   }

}

@media all and (min-width: 720px) {

   .frb-payment-logo-wrapper {
       width: 106px;
   }

}

.frb-country-CA .frb-payment-logo-wrapper, .frb-country-NZ .frb-payment-logo-wrapper {

   display: table;
   width: 100%;

}

.frb-payment-logo {

   float: left;

}

.frb-payment-logo svg {

   width: 35px;
   margin: 1px 2px;

}

@media all and (min-width: 375px) {

   .frb-payment-logo svg {
       width: 44px;
   }

}

@media all and (min-width: 720px) {

   .frb-payment-logo svg {
       width: 45px;
       margin: 2px 4px;
   }

}

/*Countries with 3 available payment options (stretches to available space)*/ .frb-country-CA .frb-payment-logo, .frb-country-NZ .frb-payment-logo {

   float: none;
   display: table-cell;
   width: 33.333333%;

}

.frb-country-CA .frb-payment-logo svg, .frb-country-NZ .frb-payment-logo svg {

   width: auto;
   max-width: 100%;

}

.frb-country-US .frb-payment-logo-jcb, .frb-country-CA .frb-payment-logo-jcb, .frb-country-NZ .frb-payment-logo-jcb, .frb-country-AU .frb-payment-logo-discover, .frb-country-CA .frb-payment-logo-discover, .frb-country-GB .frb-payment-logo-discover, .frb-country-IE .frb-payment-logo-discover, .frb-country-NZ .frb-payment-logo-discover {

   display: none;

}

.frb-ptf {

   padding: 8px 14px 0px;

}

.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;

}

.frb-ptf-cell:nth-child(2) {

   padding-left: 10px;

}

</style>

   
       <svg class="frb-icon frb-icon-info" role="img" aria-labelledby="frb-icon-info-title" width="17" height="17" viewBox="0 0 17 17" xmlns="http://www.w3.org/2000/svg"><title id="frb-icon-info-title">If everyone reading this donated $3, we could keep Wikipedia thriving for years to come.</title><g fill-rule="nonzero" fill="none"><circle fill="#991B1E" cx="8.493" cy="8.493" r="8.493"></circle><path d="M10.266 6.277l-1.835 6.366c-.102.364-.153.603-.153.716 0 .066.027.127.08.184.055.057.111.085.171.085a.463.463 0 0 0 .304-.134c.269-.221.591-.621.967-1.2l.305.179c-.902 1.57-1.86 2.355-2.874 2.355-.388 0-.697-.11-.927-.327a1.092 1.092 0 0 1-.344-.828c0-.221.05-.502.152-.842l1.244-4.28c.12-.411.18-.722.18-.93a.459.459 0 0 0-.17-.35c-.114-.101-.27-.152-.466-.152-.09 0-.197.003-.323.009l.117-.358 3.035-.493h.537zM9.711 2.16c.37 0 .682.128.935.385.254.257.381.567.381.931 0 .364-.128.675-.385.931a1.268 1.268 0 0 1-.931.385c-.358 0-.666-.128-.922-.385a1.268 1.268 0 0 1-.385-.931c0-.364.126-.674.38-.931s.563-.385.927-.385z" fill="#FFF"></path></g></svg>
       If everyone reading this donated %MINIMUM%, we could keep Wikipedia thriving for years to come.
       
           <button class="frb-nag-btn">Donate now</button>
           <button class="frb-nag-close frb-close js-close-nag" tabindex="0">Close</button>
       
   

<script> /* Allow overriding country */ if( mw.util.getParamValue("country") ) {

   Geo.country = mw.util.getParamValue("country");

}

var frb = frb || {};

/* Add space for the banner, and extra px if given below. called on load and window resize. */ frb.addSpace = function() {

   if ( $('.frb').is(':visible') ) {
       var bannerHeight = $('.frb-main').height();
       $('#mw-panel').css('top', bannerHeight);
       $('#mw-head').css('top', bannerHeight);
       $('#mw-page-base').css('margin-top', bannerHeight);
       $('.frb').addClass('frb-country-' + Geo.country);
   }

};

frb.show = function() {

   $('#content_wrapper').prepend($('.frb'));
   $('.frb-window').css('top', $(window).scrollTop() ); // position banner where they have scrolled to
   $('.frb').css('display', 'block');
   frb.addSpace();
   $(window).resize(function() {
       frb.addSpace();
   });

};

frb.toggleMonthly = function(monthly) {

   if( monthly.type === 'checkbox' ) {
       monthly = monthly.checked;
   }
   if ( monthly ) {
       $('#frb-form').addClass('form-monthly');
   } else {
       $('#frb-form').removeClass('form-monthly');
   }

};

frb.togglePTF = function() {

   frb.updateFeeDisplay();

}

// TODO: Purge currencies that are no longer needed 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' : 6.01,
   'ADP' : 152,
   'AED' : 3.67,
   'AFA' : 68,
   'AFN' : 68,
   'ALL' : 122,
   'AMD' : 468,
   'ANG' : 1.77,
   'AOA' : 165,
   'AON' : 165,
   'ATS' : 13,
   'AUD' : 1.33,
   'AWG' : 1.79,
   'AZM' : 8510,
   'AZN' : 1.7,
   'BAM' : 1.79,
   'BBD' : 2,
   'BDT' : 81,
   'BEF' : 37,
   'BGL' : 1.79,
   'BGN' : 1.79,
   'BHD' : 0.37445,
   'BIF' : 1681,
   'BMD' : 1,
   'BND' : 1.39,
   'BOB' : 6.8,
   'BRL' : 3.17,
   'BSD' : 1,
   'BTN' : 64,
   'BWP' : 10,
   'BYR' : 20020,
   'BZD' : 1.97,
   'CAD' : 1.37,
   'CDF' : 1369,
   'CHF' : 1,
   'CNY' : 6.89,
   'CRC' : 547,
   'CUC' : 1,
   'CUP' : 25,
   'CVE' : 101,
   'CYP' : 0.54,
   'CZK' : 25,
   'DEM' : 1.79,
   'DJF' : 178,
   'DKK' : 6.81,
   'DOP' : 47,
   'DZD' : 109,
   'ECS' : 25589,
   'EEK' : 14,
   'EGP' : 18,
   'ESP' : 152,
   'ETB' : 23,
   'EUR' : 0.92,
   'FIM' : 5.45,
   'FJD' : 2.08,
   'FKP' : 0.78,
   'FRF' : 6.01,
   'GBP' : 0.78,
   'GEL' : 2.43,
   'GHC' : 41911,
   'GHS' : 4.19,
   'GIP' : 0.78,
   'GMD' : 44,
   'GNF' : 9172,
   'GRD' : 312,
   'GTQ' : 7.17,
   'GYD' : 198,
   'HKD' : 7.78,
   'HNL' : 23,
   'HRK' : 6.83,
   'HTG' : 68,
   'HUF' : 286,
   'IDR' : 13316,
   'IEP' : 0.73,
   'ILS' : 3.61,
   'INR' : 64,
   'IQD' : 1149,
   'IRR' : 32438,
   'ISK' : 106,
   'ITL' : 1774,
   'JMD' : 128,
   'JOD' : 0.71,
   'JPY' : 112,
   'KES' : 101,
   'KGS' : 68,
   'KHR' : 3972,
   'KMF' : 451,
   'KPW' : 135,
   'KRW' : 1129,
   'KWD' : 0.30384,
   'KYD' : 0.81632,
   'KZT' : 314,
   'LAK' : 8068,
   'LBP' : 1491,
   'LKR' : 151,
   'LRD' : 91,
   'LSL' : 13,
   'LTL' : 3.16,
   'LUF' : 37,
   'LVL' : 0.65,
   'LYD' : 1.39,
   'MAD' : 9.85,
   'MDL' : 19,
   'MGA' : 3160,
   'MGF' : 9149,
   'MKD' : 56,
   'MMK' : 1339,
   'MNT' : 2410,
   'MOP' : 7.84,
   'MRO' : 356,
   'MTL' : 0.40,
   'MUR' : 33,
   'MVR' : 15,
   'MWK' : 721,
   'MYR' : 4.33,
   'MZM' : 70440,
   'MZN' : 70,
   'NAD' : 13,
   'NGN' : 312,
   'NIO' : 29,
   'NLG' : 2.02,
   'NOK' : 8.59,
   'NPR' : 101,
   'NZD' : 1.44,
   'OMR' : 0.38365,
   'PAB' : 1,
   'PEN' : 3.21,
   'PGK' : 3.13,
   'PHP' : 50,
   'PKR' : 104,
   'PLN' : 3.86,
   'PTE' : 184,
   'PYG' : 5467,
   'QAR' : 3.64,
   'ROL' : 41607,
   'RON' : 4.16,
   'RSD' : 112,
   'RUB' : 57,
   'RWF' : 822,
   'SAR' : 3.75,
   'SBD' : 7.69,
   'SCR' : 13,
   'SDD' : 665,
   'SDG' : 6.65,
   'SDP' : 2272,
   'SEK' : 8.83,
   'SGD' : 1.39,
   'SHP' : 0.78,
   'SIT' : 220,
   'SKK' : 28,
   'SLL' : 7451,
   'SOS' : 545,
   'SRD' : 7.48,
   'SRG' : 7480,
   'STD' : 22420,
   'SVC' : 8.54,
   'SYP' : 215,
   'SZL' : 13,
   'THB' : 34,
   'TJS' : 8.5,
   'TMM' : 17022,
   'TMT' : 3.4,
   'TND' : 2.41,
   'TOP' : 2.31,
   'TRL' : 3540300,
   'TRY' : 3.54,
   'TTD' : 6.65,
   'TWD' : 30,
   'TZS' : 2213,
   'UAH' : 26,
   'UGX' : 3612,
   'USD' : 1,
   'UZS' : 3728,
   'VEB' : 10022,
   'VEF' : 10,
   'VND' : 22484,
   'VUV' : 107,
   'WST' : 2.59,
   'XAF' : 601,
   'XCD' : 2.69,
   'XOF' : 600,
   'XPF' : 109,
   'YER' : 250,
   'YUN' : 112,
   'ZAR' : 13,
   'ZMK' : 5328,
   'ZWD' : 376,
   /* Astropay currencies have higher minimums - 1.50 USD */
   'ARS' : 22.5,
   'CLP' : 993,
   'COP' : 4380,
   'MXN' : 28.5,
   'UYU' : 42

};

frb.amounts.options7 = {

   'USD' : [3, 5, 10, 20, 30, 50, 100],
   'EUR' : {
       'default' : [2, 5, 10, 20, 30, 50, 100]
   },
   'GBP' : [2, 5, 10, 20, 30, 50, 100],
   'CAD' : [3, 5, 10, 20, 30, 50, 100],
   'AUD' : [3, 5, 10, 20, 30, 50, 100],
   'NZD' : [3, 5, 10, 20, 30, 50, 100],
   'ANG' : [5, 10, 20, 35, 50, 100, 200],
   'ARS' : [30, 50, 100, 200, 500, 750, 1000],
   'BAM' : [3, 5, 10, 25, 40, 70, 140],
   'BBD' : [5, 10, 20, 40, 60, 100, 200],
   'BDT' : [200, 400, 800, 1500, 2000, 4000, 7500],
   'BGN' : [10, 25, 50, 75, 100, 150, 200],
   'BHD' : [1, 2, 4, 8, 10, 20, 40],
   'BMD' : [3, 5, 10, 20, 30, 50, 100],
   'BOB' : [20, 30, 60, 140, 200, 300, 600],
   'BRL' : [10, 20, 30, 50, 100, 250, 500],
   'BZD' : [5, 10, 20, 40, 60, 100, 200],
   'CLP' : [1500, 2500, 5000, 10000, 15000, 25000, 50000],
   'CNY' : [50, 75, 100, 300, 500, 1000, 1500],
   'COP' : [7000, 10000, 20000, 50000, 100000, 150000, 200000],
   'CRC' : [2500, 5000, 10000, 20000, 50000, 75000, 100000],
   'CZK' : [50, 100, 200, 400, 600, 1000, 2000],
   'DKK' : [20, 100, 150, 200, 300, 500, 1000],
   'DOP' : [200, 500, 1000, 2000, 5000, 7500, 10000],
   'DZD' : [200, 400, 750, 1500, 2000, 4000, 7500],
   'FJD' : [5, 10, 20, 40, 50, 100, 200],
   'GTQ' : [20, 40, 80, 150, 200, 350, 750],
   'HKD' : [20, 50, 100, 150, 200, 500, 1000],
   'HNL' : [50, 100, 200, 400, 600, 1000, 1800],
   'HRK' : [35, 50, 100, 250, 500, 1000, 1500],
   'HUF' : [500, 1000, 2000, 4000, 5000, 7000, 10000],
   'ISK' : [300, 500, 1000, 2000, 3000, 5000, 10000],
   'ILS' : [10, 50, 100, 200, 300, 500, 1000],
   'INR' : [100, 200, 300, 500, 1000, 2000, 3000],
   'JMD' : [300, 500, 1000, 2000, 3000, 5000, 10000],
   'JPY' : [300, 1000, 1500, 2000, 3000, 5000, 10000],
   'KRW' : [5000, 10000, 20000, 30000, 50000, 75000, 100000],
   'KWD' : [2, 5, 10,15, 25, 30, 75],
   'KZT' : [750, 1500, 3000, 7500, 12000, 15000, 35000],
   'MKD' : [100, 200, 400, 800, 1200, 2000, 4000],
   'MVR' : [40, 75, 150, 300, 450, 750, 1500],
   'MXN' : [35, 50, 100, 200, 500, 750, 1000],
   'MYR' : [10, 30, 50, 100, 200, 300, 500],
   'NIO' : [100, 250, 500, 1000, 1500, 2500, 5500],
   'NOK' : [20, 100, 150, 200, 500, 750, 1000],
   'OMR' : [1, 2, 4, 8, 10, 20, 40],
   'PAB' : [3, 5, 10, 20, 30, 50, 100],
   'PEN' : [10, 30, 50, 150, 200, 275, 700],
   'PHP' : [200, 500, 750, 1000, 2000, 3000, 5000],
   'PLN' : [10, 20, 50, 100, 200, 300, 500],
   'PYG' : [10000, 20000, 40000, 80000, 120000, 200000, 400000],
   'QAR' : [20, 50, 75, 185, 250, 350, 1000],
   'RON' : [10, 50, 75, 100, 200, 300, 500],
   'SEK' : [30, 50, 100, 200, 300, 500, 1000],
   'SGD' : [3, 5, 10, 20, 30, 50, 100],
   'THB' : [50, 100, 250, 500, 750, 1000, 2000],
   'TND' : [5, 10, 15, 30, 50, 75, 150],
   'TTD' : [20, 30, 60, 120, 200, 300, 600],
   'TWD' : [150, 300, 500, 1000, 1500, 2000, 5000],
   'UAH' : [50, 75, 150, 300, 500, 750, 1000],
   'UYU' : [70, 100, 200, 400, 1000, 1500, 2000],
   'VEF' : [20, 30, 50, 100, 200, 300, 600],
   'VND' : [60000, 100000, 200000, 400000, 600000, 1000000, 2000000],
   'XCD' : [5, 10, 20, 50, 80, 120, 250],
   'XOF' : [1000, 2000, 5000, 10000, 150000, 200000, 400000],
   'XPF' : [250, 400, 800, 1600, 2500, 4000, 8000],
   'ZAR' : [30, 50, 100, 200, 300, 500, 1000],
   'CHF' : [3, 5, 10, 20, 30, 50, 100]

};

// 5 amount options. Used e.g. on mobile // Usual formula: take 1st, 3rd, 4th, 6th and 7th from asks7 */ frb.amounts.options5 = {

   'USD' : [3, 15, 20, 50, 100],
   'CAD' : [3, 15, 20, 50, 100],
   'AUD' : [3, 15, 20, 50, 100],
   'NZD' : [3, 15, 20, 50, 100],
   'GBP' : [2, 10, 20, 50, 100],
   'EUR' : [2, 10, 20, 50, 100],
   'ARS' : [30, 100, 200, 750, 1000],
   'BRL' : [10, 30, 50, 100, 250],
   'CHF' : [3, 15, 20, 50, 100],
   'CLP' : [1500, 5000, 10000, 25000, 50000],
   'CNY' : [50, 100, 300, 500, 1000],
   'COP' : [7000, 20000, 50000, 150000, 200000],
   'DKK' : [20, 100, 200, 500, 1000],
   'HKD' : [20, 100, 150, 500, 1000],
   'HUF' : [500, 2500, 4000, 7000, 10000],
   'ILS' : [10, 50, 200, 600, 1000],
   'INR' : [100, 300, 500, 2000, 3000],
   'JPY' : [300, 1500, 2000, 5000, 10000],
   'MXN' : [35, 100, 200, 750, 1000],
   'MYR' : [10, 50, 100, 300, 500],
   'NOK' : [20, 100, 200, 500, 1000],
   'PEN' : [10, 50, 150, 300, 700],
   'PLN' : [10, 50, 100, 300, 500],
   'RON' : [10, 50, 100, 200, 1000],
   'SEK' : [30, 100, 200, 500, 1000],
   'UAH' : [50, 150, 300, 750, 1000],
   'UYU' : [70, 200, 400, 1500, 2000],
   'ZAR' : [30, 100, 200, 500, 1000]

};

/* "Average" donation */ frb.amounts.averages = {

   'USD' : 15,
   'EUR' : 10,
   'GBP' : 10,
   'CAD' : 15,
   'AUD' : 15,
   'NZD' : 15,
   'ALL' : 1500,
   'AMD' : 5000,
   'ANG' : 25,
   'ARS' : 100,
   'AZN' : 10,
   'BAM' : 20,
   'BBD' : 30,
   'BDT' : 1000,
   'BGN' : 20,
   'BHD' : 6,
   'BMD' : 15,
   'BND' : 20,
   'BOB' : 100,
   'BRL' : 25,
   'BSD' : 15,
   'BZD' : 30,
   'CHF' : 15,
   'CLP' : 8000,
   'CNY' : 100,
   'COP' : 30000,
   'CRC' : 7500,
   'CZK' : 250,
   'DKK' : 100,
   'DOP' : 600,
   'DZD' : 1000,
   'EGP' : 100,
   'ETB' : 250,
   'FJD' : 25,
   'GEL' : 25,
   'GNF' : 100000,
   'GTQ' : 100,
   'HKD' : 100,
   'HNL' : 250,
   'HRK' : 80,
   'HUF' : 2500,
   'ILS' : 50,
   'INR' : 750,
   'ISK' : 1500,
   'JMD' : 1500,
   'JOD' : 10,
   'JPY' : 1500,
   'KES' : 1000,
   'KRW' : 15000,
   'KWD' : 5,
   'KZT' : 2000,
   'LKR' : 2000,
   'MAD' : 120,
   'MKD' : 600,
   'MOP' : 100,
   'MUR' : 500,
   'MVR' : 200,
   'MXN' : 150,
   'MYR' : 50,
   'MZN' : 50,
   'NGN' : 2500,
   'NIO' : 350,
   'NOK' : 100,
   'OMR' : 5,
   'PAB' : 15,
   'PEN' : 40,
   'PHP' : 600,
   'PKR' : 1500,
   'PLN' : 50,
   'PYG' : 60000,
   'QAR' : 50,
   'RON' : 50,
   'RSD' : 1200,
   'SBD' : 100,
   'SEK' : 100,
   'SGD' : 20,
   'THB' : 500,
   'TND' : 25,
   'TTD' : 100,
   'TWD' : 500,
   'UAH' : 150,
   'UYU' : 300,
   'VEF' : 100,
   'VND' : 300000,
   'XCD' : 40,
   'XOF' : 7000,
   'XPF' : 1000,
   'ZAR' : 150,

};

// 'If everyone gave X'. Mostly the same as first asks option. frb.amounts.ifEveryone = {

   'USD' : 3,
   'EUR' : {
       'default' : 2
   },
   'GBP' : 2,
   'CAD' : 3,
   'AUD' : 3,
   'NZD' : 3,
   'ANG' : 5,
   'ARS' : 30,
   'BAM' : 3,
   'BBD' : 5,
   'BDT' : 200,
   'BGN' : 10,
   'BHD' : 1,
   'BMD' : 3,
   'BOB' : 20,
   'BRL' : 10,
   'BZD' : 5,
   'CHF' : 3,
   'CLP' : 1500,
   'CNY' : 50,
   'COP' : 7000,
   'CRC' : 2500,
   'CZK' : 50,
   'DKK' : 20,
   'DOP' : 200,
   'DZD' : 200,
   'FJD' : 5,
   'GTQ' : 20,
   'HKD' : 20,
   'HNL' : 50,
   'HRK' : 35,
   'HUF' : 500,
   'ILS' : 10,
   'INR' : 100,
   'ISK' : 300,
   'JMD' : 300,
   'JPY' : 300,
   'KRW' : 5000,
   'KWD' : 2,
   'KZT' : 750,
   'MKD' : 100,
   'MVR' : 40,
   'MXN' : 35,
   'MYR' : 10,
   'NIO' : 100,
   'NOK' : 20,
   'OMR' : 1,
   'PAB' : 3,
   'PEN' : 10,
   'PHP' : 200,
   'PLN' : 10,
   'PYG' : 10000,
   'QAR' : 20,
   'RON' : 10,
   'SEK' : 30,
   'SGD' : 3,
   'THB' : 50,
   'TND' : 5,
   'TTD' : 20,
   'TWD' : 150,
   'UAH' : 50,
   'UYU' : 70,
   'VEF' : 20,
   'VND' : 60000,
   'XCD' : 5,
   'XOF' : 1000,
   'XPF' : 250,
   'ZAR' : 30

};

// TODO: purge unneeded currencies frb.currencyFormats = {

   'USD' : '$\t',
   'EUR' : {
       'en' : '€\t',
       'cy' : '€\t',
       'ga' : '€\t',
       'mt' : '€\t',
       'nl' : '€ \t',
       'lv' : '€ \t',
       'tr' : '€ \t',
       'default' : '\t €'
   },
   'ANG' : 'ƒ\t',
   'ARS' : '$\t',
   'AUD' : '$\t',
   'BAM' : '\t KM',
   'BBD' : 'Bcs$\t',
   'BDT' : '৳\t',
   'BGN' : 'лв\t',
   'BHD' : 'د.ب\t',
   'BMD' : 'BD$\t',
   'BOB' : '$b\t',
   'BRL' : 'R$\t',
   'BZD' : 'BZ$\t',
   'CAD' : {
       'fr' : '$\t',
       'default' : '$\t'
   },
   'CHF' : 'Fr. \t',
   'CLP' : '$\t',
   'CNY' : '\t ¥',
   'COP' : '$\t',
   'CRC' : '\t ₡',
   'CZK' : '\t Kč',
   'DKK' : '\t kr.',
   'DOP' : 'RD$\t',
   'DZD' : 'د.ج\t',
   'EGP' : {
       'en' : 'E£\t',
       'default' : '\t جنيه'
   },
   'FJD' : 'FJ$\t',
   'GBP' : '£\t',
   'GTQ' : 'Q\t',
   'HKD' : 'HK$\t',
   'HNL' : 'L\t',
   'HRK' : '\t kn',
   'HUF' : '\t Ft',
   'ILS' : {
       'he' : '\t ₪',
       'yi' : '\t ₪',
       'ar' : '\t ₪',
       'default' : '₪ \t'
   },
   'INR' : '₹ \t',
   'ISK' : '\t kr',
   'JMD' : 'J$ \t',
   'JOD' : 'دينار\t',
   'JPY' : '¥\t',
   'KES' : '\t KSh',
   'KRW' : '₩\t',
   'KWD' : 'د.ك \t',
   'KZT' : '〒 \t', // TODO: don't use the JP postal code symbol once KZT works in unicode
   'LKR' : '\t Rs.',
   'MAD' : 'د.م.\t',
   'MKD' : '\t ден',
   'MOP' : 'MOP$\t',
   'MUR' : '\t Rs',
   'MXN' : '$\t',
   'MVR' : 'Rf. \t',
   'MYR' : 'RM\t',
   'NIO' : 'C$\t',
   'NOK' : '\t kr',
   'NZD' : '$\t',
   'OMR' : 'ر.ع\t',
   'PAB' : '\t B/.',
   'PEN' : 'S/. \t',
   'PHP' : '₱\t',
   'PKR' : 'Rs \t',
   'PLN' : '\t zł',
   'PYG' : '\t ₲',
   'QAR' : 'ر.ق\t',
   'RON' : '\t lei',
   'SCR' : 'SR \t',
   'SEK' : '\t kr',
   'SGD' : 'S$ \t',
   'SVC' : '\t ₡',
   'THB' : {
       'th' : '\t บาท',
       'default' : '\t ฿'
   },
   'TND' : '\t د.ت',
   'TTD' : 'TT$\t',
   'TWD' : 'NT$\t',
   'TZS' : '\t/=',
   'UAH' : '₴\t',
   'UYU' : '$U \t',
   'UZS' : '\t сўм',
   'VEF' : 'Bs.F. \t',
   'VND' : '\t₫',
   'VUV' : 'VT\t',
   'XAF' : 'FCFA\t',
   'XCD' : 'EC$\t',
   'XOF' : 'CFA \t',
   'XPF' : '\t F',
   'ZAR' : 'R \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ú'
   }

};

// Just in English for now, but we may want to add other languages later frb.dayNames = {

   'en' : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ]

};

frb.iPadTranslations = {

   'en' : 'iPad'

}; /* 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';
   /* Express Checkout overrides for Japan and Big English. Remove once it's default. */
   if ( params.payment_method === 'paypal' &&
        $.inArray(params.country, ['JP']) !== -1
   ) {
       params.gateway = 'paypal_ec';
   }
   if (params.uselang === 'pt' && params.country === 'BR') {
       params.uselang = 'pt-br';
   }
   /* 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);
   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;
   // For popups test - only on Big English desktop. Remove this once testing completed.
   if ( utm_source.indexOf( 'en6C_dsk' ) !== -1 ) {
       if ( mw.popups ) {
           utm_source += '_' + ( mw.popups.isEnabled() ? 'popupsEnabled' : 'popupsDisabled' );
       } else {
           utm_source += '_' + 'popupsUnknown';
       }
   }
   utm_source += '.no-LP.' + fullDottedPaymentMethod;
   return utm_source;

};

/* 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 and at least minimum.
* 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 = Math.ceil( frb.amounts.minimums[currency] ); // NOTE: Round up actual min to nearest whole number
   if ( amount === null || isNaN(amount) || amount <= 0 || amount < minAmount ) {
       alert('Please select an amount (minimum $1)'.replace('$1', minAmount + ' ' + currency));
       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;
       }
   };

};

( function () {

   // For popups test - only on Big English desktop. Remove this once testing completed.
   if ( mw.centralNotice.data.banner.indexOf('en6C_dsk') !== -1 ) {
       var deferred = $.Deferred();
       mw.loader.using( 'ext.popups' ).done( function () {
           mw.requestIdleCallback( function () {
               deferred.resolve();
           } );
       } );
       mw.centralNotice.requestRecordImpressionDelay( deferred.promise() ).done( function () {
           if ( mw.popups ) {
               mw.centralNotice.registerTest( ( mw.popups.isEnabled() ? 'popupsEnabled' : 'popupsDisabled' ) );
           } else {
               mw.centralNotice.registerTest( 'popupsUnknown' );
           }
       } );
   }

})(); /* End of MediaWiki:FundraisingBanners/CoreJS-2017.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 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'     : [],
       '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 and donatewiki e.g. if they have scheduled downtime.
* Valid methods are:
* ideal, yandex, cc, dd, sofort, pp, amazon, bpay, webmoney, boletos, enets, 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
*/

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 );
   // Day of week
   var dayName;
   var now = new Date();
   var dayNumber = now.getDay();
   if ( frb.dayNames[language] ) {
       dayName = frb.dayNames[language][dayNumber] || frb.dayNames.en[dayNumber];
   } else {
       dayName = frb.dayNames.en[dayNumber];
   }
   $('.frb-replace-dayofweek').html( dayName );
   // 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();
   }

});

/* == 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;

}; 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');
       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();
   });

});

frb.initNag = function() {

   /* --- Code for sticky "nag" banner --- */
   /* Reveal nag after scroll interaction. */
   $(window).scroll(function() {
       if ( $(window).scrollTop() > 300 && $('.frb' ).css('display') == 'none' ) {
           $('.frb-nag').addClass('reveal');
       } else {
           $('.frb-nag').removeClass('reveal');
       }
   });
   /* Close nag, behavior from mobile small, sets a cookie to hide banner for 24 hours. */
   $('.js-close-nag').on('click keypress', function(event) {
       if ( event.which === 13 || event.type === 'click' ) {
           mw.centralNotice.customHideBanner('next_time_24h', '86400');
           event.stopPropagation();
       }
   });
   /* Scroll to top after clicking the nag */
   $('.frb-nag').click(function() {
       $('.frb-window').css('top', $(window).scrollTop() ); // position banner where they have scrolled to
       $('.frb').show();
       $('.frb-nag').removeClass('reveal');
   });

};

$(function() {

   var language = mw.centralNotice.data.uselang;
   var country = mw.centralNotice.data.country;
   var currency = frb.getCurrency(country);
   frb.initAmountOptions();
   frb.localizeAmountOptions(frb.amounts.options5, currency, country, language, true);
   /* Currency formatting */
   var currencySymbol = frb.formatCurrency( currency, , language ).replace(' ', );
   /**
    * Calculate approximate transaction fee on given amount
    * @param  {number} amount
    * @return {number}        Rounded to 2 decimal places
    */
   frb.calculateFee = function(amount) {
       var feeMultiplier = 0.04;
       var feeMinimum = 1;
       var feeAmount = amount * feeMultiplier;
       if ( feeAmount < feeMinimum ) {
           feeAmount = feeMinimum;
       }
       return parseFloat(feeAmount.toFixed(2));
   };
   frb.updateFeeDisplay = function() {
       var form = document.getElementById('frb-form');
       var amount, feeAmount, totalAmount;
       amount = frb.getAmount(form);
       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();
   };
   $('#frb-form [id^=frb-amt-ps]').click( frb.updateFeeDisplay );
   $('#frb-amt-other-input').on( 'input', frb.updateFeeDisplay );
   /* Close option */
   $('.js-close').on('click keypress', function(event) {
       if ( event.which === 13 || event.type === 'click' ) {
           // Don't set a hide cookie here, as we expect them to always close this
           $('.frb-top').hide();
       }
   });
   /* Close banner when clicked outside. */
   $('.frb-mask').on('click.bannerHide', function(event) {
       if ( $(event.target).closest('#frb-window').length === 0 ) {
           $('.frb-top').hide();
           $('.frb-nag').addClass('reveal');
           $(document).off('click.bannerHide');
       }
   });
   /* 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();
       frb.initNag();
   }
   /* Chat animation speed setting, mainly used for RML user interaction. */
   var frbMessageDelay = 500;
   /* Remind me later (RML) form */
   /* Reveal the RML form after clicking 'Donate Later' */
   $('.frb-options-rml').on('click keypress', function(event){
       if ( event.which === 13 || event.type === 'click' ) {
           event.stopPropagation();
           var $rmlButtonParent = $(this).parent();
           if ( $rmlButtonParent.next().next().css('display') == 'none' ) {
               $rmlButtonParent.next().show().delay(frbMessageDelay).fadeOut(function() {
                   $rmlButtonParent.next().next().fadeIn();
                   $('.frb-rml').fadeIn(function() {
                       $('.frb-rml-email').focus();
                       frb.addSpace();
                   });
               });
           } else {
               $('.frb-rml-email').focus();
           }
       }
   });
   /* Hide banner and nag after RML submit. */
   $('.frb-btn-submit').on('click keypress', function(event){
       if ( event.which === 13 || event.type === 'click' ) {
           if ( mw.util.validateEmail( $('.frb-rml-email').val() ) ) {
               $('.frb-inline-rml-form').hide();
               $('.frb').delay(3000).fadeOut(frbMessageDelay, function() {
                   $('.frb').hide();
               });
               mw.centralNotice.internal.hide.setHideWithCloseButtonCookies(); // Hide future banners for 7 days
               return false;
           }
       }
   });
   /* Other amount field */
   $('.frb-button--other').on('click keypress', function(event) {
       if ( event.which === 13 || event.type === 'click' ) {
           if ( $('.frb-other-input').val() ===  ) {
               $('.frb-cta-amount').hide();
           }
           document.getElementById('frb-input-other').checked = true;
           $('.frb-other-input').focus();
       }
   });
   /* Other amount field focus styles */
   $('.frb-other-input')
   .focus(function() {
       $('.frb-button--other').addClass('frb-button--is-focused');
   })
   .blur(function() {
       $('.frb-button--other').removeClass('frb-button--is-focused');
   });

}); </script>