Donate donatewiki https://foundation.wikimedia.org/wiki/Home MediaWiki 1.43.0-wmf.2 first-letter Media Special Talk User User talk Donate Donate talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk Campaign Campaign talk TimedText TimedText talk Module Module talk Template:MonthlyConvert/Default 10 8604 39703 39308 2024-04-25T21:40:24Z Pcoombe 5 accessibility improvements wikitext text/x-wiki <noinclude><html><meta name="viewport" content="width=device-width, initial-scale=1"><style>.action-view .mc-modal-screen { display: block !important; }</style><form name="donateForm"></form></html>{{IncludeCSS | Template:Styles/Default.css }}</noinclude> <templatestyles src="Template:MonthlyConvert/Default/styles.css"/> <html> <div class="mc-modal-screen"> <div class="mc-modal" role="dialog" aria-labelledby="mc-title"> <div class="mc-choice"> <div class="mc-back" tabindex="0"> <svg class="mc-icon mc-icon-back" aria-labelledby="frb-icon-back-title" xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16"><title id="frb-icon-back-title"></html>{{Translated|Template:MonthlyConvertText/Back}}<html></title><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.778" d="M7.181 13.285L.753 7 7.181.715"/><rect width="18.182" height="1.778" x=".818" y="6.111" fill="#72777D" rx=".889"/></g></svg> </div> <h2 id="mc-title"> <svg class="frb-icon frb-icon-heart" aria-hidden="true" width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 66 66"><path fill="#900" d="M66 20.8C66 9.3 57.6 0 47.3 0 41.6 0 36.4 2.9 33 7.4 29.6 2.9 24.4 0 18.7 0 8.4 0 0 9.3 0 20.8 0 27 2.5 32.5 6.3 36.3L33.1 66l28-31.2c3-3.7 4.9-8.6 4.9-14z"></path></svg> </html>{{Translated|Template:MonthlyConvertText/Ask}}<html> </h2> <p> </html>{{Translated|Template:MonthlyConvertText/BestWay}}<html> </p> <div class="mc-buttons"> <button class="mc-button mc-no-button"></html>{{Translated|Template:MonthlyConvertText/ResponseNo}}<html></button> <button class="mc-button mc-yes-button"></html>{{Translated|Template:MonthlyConvertText/ResponseYes}}<html></button> </div><!--mc-buttons--> <div class="mc-link mc-diff-amount-link" tabindex="0"></html>{{Translated|Template:MonthlyConvertText/ResponseDifferentAmount}}<html></div> </div><!--mc-choice--> <div class="mc-edit-amount" style="display: none"> <div class="mc-back" tabindex="0"> <svg class="mc-icon mc-icon-back" aria-labelledby="frb-icon-back-title" xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16"><title id="frb-icon-back-title"></html>{{Translated|Template:MonthlyConvertText/Back}}<html></title><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.778" d="M7.181 13.285L.753 7 7.181.715"/><rect width="18.182" height="1.778" x=".818" y="6.111" fill="#72777D" rx=".889"/></g></svg> </div> <h1></html>{{Translated|Template:MonthlyConvertText/Thank}}<html></h1> <label for="mc-other-amount-input"></html>{{Translated|Template:MonthlyConvertText/EnterDifferentAmount}}<html></label> <div class="mc-other-amount"> <input id="mc-other-amount-input" name="otherMonthlyAmount" class="noime" type="text" inputmode="decimal" autocomplete="off" value="" tabindex="0" /> <span class="mc-currencycode"></span> <div class="mc-error mc-error-smallamount lp-error-smallamount"></html>{{int:donate_interface-smallamount-error}}<html></div> <div class="mc-error mc-error-bigamount lp-error-bigamount"></html>{{int:donate_interface-bigamount-error}}<html></div> </div> <div class="mc-buttons"> <button class="mc-button mc-donate-monthly-button"></html>{{Translated|Template:MonthlyConvertText/ConfirmButton}}<html></button> </div><!--mc-buttons--> </div><!--mc-edit-amount--> </div><!--mc-modal--> </div> </html> fu7tkfuvyi416tqzl08szf7c6wraj6q 39706 39703 2024-04-25T21:53:19Z Pcoombe 5 wikitext text/x-wiki <noinclude><html><meta name="viewport" content="width=device-width, initial-scale=1"><style>.action-view .mc-modal-screen { display: block !important; }</style><form name="donateForm"></form></html>{{IncludeCSS | Template:Styles/Default.css }}</noinclude> <templatestyles src="Template:MonthlyConvert/Default/styles.css"/> <html> <div class="mc-modal-screen"> <div class="mc-modal" role="dialog" aria-labelledby="mc-title"> <div class="mc-choice"> <div class="mc-back" tabindex="0"> <svg class="mc-icon mc-icon-back" aria-labelledby="frb-icon-back-title" xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16"><title id="frb-icon-back-title"></html>{{Translated|Template:MonthlyConvertText/Back}}<html></title><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.778" d="M7.181 13.285L.753 7 7.181.715"/><rect width="18.182" height="1.778" x=".818" y="6.111" fill="#72777D" rx=".889"/></g></svg> </div> <h2 id="mc-title"> <svg class="frb-icon frb-icon-heart" aria-hidden="true" width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 66 66"><path fill="#900" d="M66 20.8C66 9.3 57.6 0 47.3 0 41.6 0 36.4 2.9 33 7.4 29.6 2.9 24.4 0 18.7 0 8.4 0 0 9.3 0 20.8 0 27 2.5 32.5 6.3 36.3L33.1 66l28-31.2c3-3.7 4.9-8.6 4.9-14z"></path></svg> </html>{{Translated|Template:MonthlyConvertText/Ask}}<html> </h2> <p> </html>{{Translated|Template:MonthlyConvertText/BestWay}}<html> </p> <div class="mc-buttons"> <button class="mc-button mc-no-button"></html>{{Translated|Template:MonthlyConvertText/ResponseNo}}<html></button> <button class="mc-button mc-yes-button"></html>{{Translated|Template:MonthlyConvertText/ResponseYes}}<html></button> </div><!--mc-buttons--> <div class="mc-link mc-diff-amount-link" tabindex="0"></html>{{Translated|Template:MonthlyConvertText/ResponseDifferentAmount}}<html></div> </div><!--mc-choice--> <div class="mc-edit-amount" style="display: none"> <div class="mc-back" tabindex="0"> <svg class="mc-icon mc-icon-back" aria-labelledby="frb-icon-back-title" xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16"><title id="frb-icon-back-title"></html>{{Translated|Template:MonthlyConvertText/Back}}<html></title><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.778" d="M7.181 13.285L.753 7 7.181.715"/><rect width="18.182" height="1.778" x=".818" y="6.111" fill="#72777D" rx=".889"/></g></svg> </div> <h2></html>{{Translated|Template:MonthlyConvertText/Thank}}<html></h2> <label for="mc-other-amount-input"></html>{{Translated|Template:MonthlyConvertText/EnterDifferentAmount}}<html></label> <div class="mc-other-amount"> <input id="mc-other-amount-input" name="otherMonthlyAmount" class="noime" type="text" inputmode="decimal" autocomplete="off" value="" tabindex="0" /> <span class="mc-currencycode"></span> <div class="mc-error mc-error-smallamount lp-error-smallamount"></html>{{int:donate_interface-smallamount-error}}<html></div> <div class="mc-error mc-error-bigamount lp-error-bigamount"></html>{{int:donate_interface-bigamount-error}}<html></div> </div> <div class="mc-buttons"> <button class="mc-button mc-donate-monthly-button"></html>{{Translated|Template:MonthlyConvertText/ConfirmButton}}<html></button> </div><!--mc-buttons--> </div><!--mc-edit-amount--> </div><!--mc-modal--> </div> </html> fbh0ru718cqugvb18t2oilzesok03hk Template:MonthlyConvert/Default/styles.css 10 8605 39704 39306 2024-04-25T21:40:31Z Pcoombe 5 sanitized-css text/css .mc-modal *, .mc-modal *:before, .mc-modal *:after { box-sizing: border-box; } /* Back button */ .mc-back { cursor: pointer; position: absolute; top: 20px; left: 15px; opacity: 0.6; } .mc-back:hover { opacity: 1; } .mc-icon-back { height: 18px; width: 26px; } body.rtl .mc-icon-back { transform: rotate(180deg); } /* Modal Screen */ .mc-modal-screen { position: fixed; top: 0; left: 0; z-index: 100; background: rgba( 0, 0, 0, 0.8 ); width: 100%; height: 100%; display: none; } /* Modal Box */ .mc-modal { position: absolute; top: 5vh; left: 5%; z-index: 110; background: #fff; padding: 40px 30px; text-align: center; color: #000; font-size: 16px; line-height: 1.4; font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; font-style: normal; box-shadow: 0 0 20px rgba( 0, 0, 0, 0.3 ); width: calc( 90% ); max-height: 90vh; overflow: auto; } @media ( min-width: 800px ) { .mc-modal { left: 50%; top: 10vh; margin-left: -330px; padding: 60px; font-size: 17px; width: 660px; } } .mc-modal h2 { line-height: 1.3; border: 0; font-size: 120%; font-weight: bold; } .mc-modal p { margin: 1em 0 0; } /* Buttons */ .mc-buttons { margin: 1em auto; text-align: center; } @media ( min-width: 800px ) { .mc-buttons { margin: 2em auto 1em; } } .mc-button { width: 100%; min-height: 64px; padding: 12px; margin-bottom: 10px; font-size: 17px; font-weight: bold; background-color: #36c; border: 1px solid #36c; border-radius: 6px; outline: 0; color: #fff; cursor: pointer; transition: all 0.25s ease-in-out; } .mc-button:focus { outline: 0; border-color: #36c !important; box-shadow: inset 0 0 0 1px #36c, inset 0 0 0 2px #fff; } .mc-button:hover { background-color: #447ff5; border-color: #447ff5; } .mc-button:active { background-color: #2a4b8d; border-color: #2a4b8d; box-shadow: none; } .mc-link { color: #36c; font-weight: bold; text-decoration: underline; cursor: pointer; } .mc-edit-amount label { display: block; margin: 1em 0; } .mc-other-amount { font-size: 200%; } #mc-other-amount-input { width: 30%; font-size: 100%; border: 0; outline: 0; border-bottom: 1px solid #000; text-align: center; } /* Error messages */ .mc-error { display: none; font-size: 14px; color: #d33; } 7vg56mdftv3hji0edk6lz6qlii18xrp MediaWiki:MonthlyConvert.js 8 8606 39705 39355 2024-04-25T21:50:57Z Pcoombe 5 focus first button on opening mc-modal - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role javascript text/javascript var mc = {}; // 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 mc.amounts = { 'EUR' : [ // also GBP [ 1.99, 0 ], [ 2.35, 1.40 ], [ 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 ] ], 'USD' : [ // also 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 ] ] }; mc.amounts.GBP = mc.amounts.EUR; mc.amounts.CAD = mc.amounts.USD; mc.amounts.AUD = mc.amounts.USD; mc.amounts.NZD = mc.amounts.USD; mc.amounts.RON = mc.amounts.MYR; mc.amounts.PLN = mc.amounts.MYR; mc.amounts.NOK = mc.amounts.SEK; mc.getSuggestedAmount = function ( amount, currency ) { var i, amountsForCurrency = mc.amounts[ currency ], numAmounts; if ( !amountsForCurrency ) { return 0; } numAmounts = amountsForCurrency.length; for ( i = 0; i < numAmounts; i++ ) { if ( amount <= amountsForCurrency[ i ][ 0 ] ) { return amountsForCurrency[ i ][ 1 ]; } } return 0; }; mc.formatAmount = function ( amount, currency, locale ) { var formattedAmount; try { formattedAmount = amount.toLocaleString( locale, { currency: currency, style: 'currency' } ); } catch ( e ) { // Assume a two decimal place currency for fallback formattedAmount = currency + ' ' + amount.toFixed( 2 ); } return formattedAmount; }; mc.getOtherAmount = function() { var otherInput = document.getElementById('mc-other-amount-input'), otherAmount = null; if ( otherInput.value !== '' ) { otherAmount = donationForm.parseOtherAmount( otherInput.value ); } return otherAmount; }; /** * Check if selected amount is valid i.e. a positive number, between minimum and maximum. * If not, show an error and return false. */ mc.validateOtherAmount = function() { var amount = mc.getOtherAmount(); var minAmount = donationForm.minimums[ donationForm.currency ] || 1; if ( amount === null || isNaN(amount) || amount <= 0 || amount < minAmount ) { $('.mc-edit-amount').addClass('mc-haserror'); $('.mc-error-bigamount').hide(); $('.mc-error-smallamount').show(); return false; } else if ( amount > donationForm.maxUSD * minAmount ) { $('.mc-edit-amount').addClass('mc-haserror'); $('.mc-error-smallamount').hide(); $('.mc-error-bigamount').show(); return false; } else { $('.mc-edit-amount').removeClass('mc-haserror'); $('.mc-error-smallamount, .mc-error-bigamount').hide(); return true; } }; mc.main = function( params, callback ) { var initialAmount = params.amount, currency = params.currency || 'USD', suggestedAmount = mc.getSuggestedAmount( initialAmount, currency ), locale = donationForm.getLocale( params.uselang, params.country ), skipMc; if ( mw.util.getParamValue( 'monthlyconvert' ) === 'false' || mw.util.getParamValue( 'monthlyconvert' ) === 'none' ) { skipMc = true; } if ( mw.util.getParamValue( 'utm_medium' ) === 'endowment' ) { // No recurring for endowment skipMc = true; } if ( params.recurring ) { // Already recurring skipMc = true; } if ( donationForm.noRecurringCountries.indexOf( params.country ) !== -1 ) { // Country where we don't offer any recurring skipMc = true; } if ( params.payment_method === 'paypal' && donationForm.noRecurringPaypalCountries.indexOf( params.country ) !== -1 ) { skipMc = true; } if ( suggestedAmount === 0 ) { // Amount too low, or we don't have any suggestions skipMc = true; } if ( ( params.payment_method === 'paypal' ) || ( params.payment_method === 'rtbt' && params.payment_submethod === 'rtbt_ideal' ) || ( params.payment_method === 'bt' && params.payment_submethod === 'upi' ) || ( params.payment_method === 'bt' && params.payment_submethod === 'paytmwallet' ) ) { // suitable method! } else { skipMc = true; } if ( skipMc ) { callback( params ); } else { $('.mc-currencycode').text( currency ); $('.mc-amt-initial').text( mc.formatAmount( initialAmount, currency, locale) ); $('.mc-amt-suggest').text( mc.formatAmount( suggestedAmount, currency, locale ) ); // Block typing symbols in Other field donationForm.otherInputControl( document.getElementById( 'mc-other-amount-input' ) ); $('.mc-no-button').on( 'click', function() { params.amount = initialAmount; params.recurring = false; callback( params ); }); $('.mc-yes-button').on( 'click', function() { donationForm.extraData.donateMC = 1; donationForm.extraData.originalAmt = initialAmount; params.amount = suggestedAmount; params.recurring = true; callback( params ); }); $('#mc-other-amount-input').on('input change', function() { if ( mc.validateOtherAmount() ) { $( '.mc-amt-custom' ).text( mc.formatAmount( mc.getOtherAmount(), currency, locale ) ); } else { $( '.mc-amt-custom' ).text( '' ); } }); $( '.mc-donate-monthly-button' ).on( 'click', function() { if ( mc.validateOtherAmount() ) { donationForm.extraData.donateMC = 1; donationForm.extraData.originalAmt = initialAmount; params.amount = mc.getOtherAmount(); params.recurring = true; callback( params ); } }); $('.mc-modal-screen').show(); document.querySelector('.mc-button').focus(); $('body').addClass('modal-open'); } }; $(function() { $( '.mc-diff-amount-link' ).on( 'click keypress', function ( e ) { if ( e.which === 13 || e.type === 'click' ) { $( '.mc-choice' ).hide(); $( '.mc-edit-amount' ).show(); $( '.mc-other-amount-input' ).focus(); } } ); $( '.mc-choice .mc-back' ).on( 'click keypress', function ( e ) { if ( e.which === 13 || e.type === 'click' ) { $( '.mc-edit-amount' ).hide(); $('.mc-modal-screen').hide(); $('body').removeClass('modal-open'); } } ); $( '.mc-edit-amount .mc-back' ).on( 'click keypress', function ( e ) { if ( e.which === 13 || e.type === 'click' ) { $( '.mc-edit-amount' ).hide(); $( '.mc-choice' ).show(); } } ); }); 94u62way432qhgn05mlpsh0v0y74ssk