1$(function () { 2 $('.select2-currency').select2({ 3 templateSelection: formatStateCur, 4 templateResult: formatStateCur, 5 width: "100%" 6 }); 7 8 function formatStateCur(icon) { 9 return $('<span><i class=" ' + $(icon.element).data('icon') + '"></i> ' + icon.text + '</span>'); 10 } 11 12 $('.select2-language').select2({ 13 templateSelection: formatState, 14 templateResult: formatState, 15 minimumResultsForSearch: -1, 16 width: "100%" 17 }); 18 19 function formatState(icon) { 20 return $('<span><i class="flag-icon ' + $(icon.element).data('icon') + '"></i> ' + icon.text + '</span>'); 21 } 22 23 $('.select2-payment-method').select2({ 24 templateSelection: formatState2, 25 templateResult: formatState2, 26 width: "100%" 27 }); 28 29 function formatState2(icon) { 30 return $('<span><i class=" ' + $(icon.element).data('icon') + '"></i> ' + icon.text + '</span>'); 31 }; 32 33 $(window).on('scroll', function () { 34 console.log("Main Wrapper"); 35 if ($(window).scrollTop()) { 36 console.log("Main Wrapper"); 37 $('header').addClass('sticky'); 38 39 } else { 40 $('header').removeClass('sticky'); 41 42 } 43 }); 44 45 $('#menu-btn').on('click', function () { 46 $(this).css('display', 'none'); 47 $('#menu-close').fadeIn(); 48 $('#mobile-nav').slideDown(); 49 }); 50 51 $('#menu-close').on('click', function () { 52 $(this).css('display', 'none'); 53 $('#menu-btn').fadeIn(); 54 $('#mobile-nav').slideUp(); 55 }); 56 57 var stripe_fee = 6; 58 var paypal_fee = 7; 59 var wechat_fee = 8; 60 var alipay_fee = 5; 61 var iflexmoney_fee = 0; 62 63 var final_rec_amt = null; 64 var min_send_amount_usd = 5; 65 var max_send_amount_usd = 1000; 66 var min_send_amount = null; 67 var max_send_amount = null; 68 69 $('#receiving-amount').on('keyup', function () { 70 $(this).attr('disabled', 'true'); 71 $(this).val(final_rec_amt.toFixed(2)); 72 }); 73 74 $('#send-amount').on('keyup', function () { 75 setExRate(); 76 clc_min_max(); 77 var send_amount_val = $(this).val(); 78 send_amount_val = parseInt(send_amount_val); 79 80 var receiving_amount = $('#receiving-amount'); 81 82 $('#amount-less').css('display', 'none'); 83 $('#amount-exceeded').css('display', 'none'); 84 85 min_send_amount = parseInt(min_send_amount); 86 max_send_amount = parseInt(max_send_amount); 87 receiving_amount.attr('placeholder', 'Please Enter Amount in Range'); 88 89 90 if (send_amount_val < min_send_amount) { 91 receiving_amount.val(''); 92 isValidAmountLess = true; 93 $('#amount-exceeded').css('display', 'none'); 94 $('#amount-less').fadeIn(); 95 } else if (send_amount_val > max_send_amount) { 96 receiving_amount.val(''); 97 isValidAmountExceed = true; 98 $('#amount-less').css('display', 'none'); 99 $('#amount-exceeded').fadeIn(); 100 } else { 101 receiving_amount.attr('placeholder', 'Estimated Receiving Amount'); 102 isValidAmountLess = false; 103 isValidAmountExceed = false; 104 calculateAmount(); 105 } 106 107 }); 108 109 async function calculateAmount() { 110 var sender_currency = $('#sender-currency').val(); 111 var receiver_currency = $('#receiver-currency').val(); 112 var sender_payment_method = $('#sender-payment-method').val(); 113 114 var sending_amount = $('#send-amount').val(); 115 var receiving_amount = $('#receiving-amount'); 116 117 var fee_amt = $('.fee-amount'); 118 var fee_per = $('.fee-percent'); 119 120 var fee = 0; 121 122 if (sender_payment_method == "iflexbalance") fee = iflexmoney_fee; 123 if (sender_payment_method == "stripe") fee = stripe_fee; 124 if (sender_payment_method == "paypal") fee = paypal_fee; 125 if (sender_payment_method == "alipay") fee = alipay_fee; 126 if (sender_payment_method == "wechat") fee = wechat_fee; 127 128 fee_per.text(fee); 129 130 fee_amount = (sending_amount * fee) / 100; 131 final_fee_amt = fee_amount; 132 final_fee_amt_usd = await currencyConverter(sender_currency, 'USD', fee_amount); 133 fee_amt.text(fee_amount.toFixed(2)); 134 135 final_send_amt = sending_amount; 136 final_send_amt_usd = await currencyConverter(sender_currency, 'USD', sending_amount); 137 138 var amount_after_fee = sending_amount - fee_amount; 139 var rr; 140 if (sending_amount != '' && sender_currency != '' && sender_payment_method != '' && receiver_currency != '') rr = await currencyConverter(sender_currency, receiver_currency, amount_after_fee); 141 142 if (rr != "") { 143 receiving_amount.val(rr.toFixed(2)); 144 } 145 final_rec_amt = rr; 146 final_rec_amt_usd = await currencyConverter(receiver_currency, 'USD', rr); 147 148 } 149 150 async function clc_min_max() { 151 var sender_currency = $('#sender-currency').val(); 152 var receiver_currency = $('#receiver-currency').val(); 153 154 var min_amt = await currencyConverter('USD', sender_currency, min_send_amount_usd); 155 var max_amt = await currencyConverter('USD', sender_currency, max_send_amount_usd); 156 157 min_send_amount = min_amt; 158 max_send_amount = max_amt; 159 160 $('.min-send-amount').text(min_amt.toFixed(2)); 161 $('.max-send-amount').text(max_amt.toFixed(2)); 162 163 $('.r-currency').text(receiver_currency); 164 $('.s-currency').text(sender_currency); 165 } 166 167 $('#sender-currency').on('change', function () { 168 var sender_currency = $('#sender-currency').val(); 169 var receiver_currency = $('#receiver-currency').val(); 170 var sender_payment_method = $('#sender-payment-method').val(); 171 172 var sending_amount = $('#send-amount').val(); 173 174 clc_min_max();
175 176 if (sender_currency != '') { 177 $('#receiver-currency').removeAttr('disabled', 'true'); 178 } else { 179 $('#receiver-currency').attr('disabled', 'true'); 180 $('#sender-payment-method').attr('disabled', 'true') 181 $('#send-amount').attr('disabled', 'true'); 182 } 183 184 if (sender_payment_method != '' && receiver_currency != '' && sender_currency != '') { 185 $('#send-amount').removeAttr('disabled'); 186 } 187 188 if (receiver_currency != '' && sender_currency != '') { 189 $('#sender-payment-method').removeAttr('disabled'); 190 } 191 setExRate(); 192 193 if (sending_amount != '' && sender_currency != '' && sender_payment_method != '' && receiver_currency != '') 194 195 calculateAmount(); 196 }) 197 198 $('#receiver-currency').on('change', function () { 199 var sender_currency = $('#sender-currency').val(); 200 var receiver_currency = $('#receiver-currency').val(); 201 var sender_payment_method = $('#sender-payment-method').val(); 202 203 var sending_amount = $('#send-amount').val(); 204 $('.r-currency').text(receiver_currency); 205 206 if (receiver_currency != '' && sender_currency != '') { 207 $('#sender-payment-method').removeAttr('disabled'); 208 } else { 209 $('#send-amount').attr('disabled', 'true'); 210 } 211 212 if (sender_payment_method != '' && receiver_currency != '' && sender_currency != '') { 213 $('#send-amount').removeAttr('disabled'); 214 } 215 216 if (receiver_currency != '' && sender_currency != '') { 217 $('#sender-payment-method').removeAttr('disabled'); 218 } 219 setExRate(); 220 221 clc_min_max(); 222 223 if (sending_amount != '' && sender_currency != '' && sender_payment_method != '' && receiver_currency != '') 224 calculateAmount(); 225 }) 226 227 $('#sender-payment-method').on('change', function () { 228 var sender_currency = $('#sender-currency').val(); 229 var receiver_currency = $('#receiver-currency').val(); 230 var sender_payment_method = $('#sender-payment-method').val(); 231 232 var sending_amount = $('#send-amount').val(); 233 234 clc_min_max(); 235 236 if (sender_payment_method != '' && receiver_currency != '' && sender_currency != '') { 237 $('#send-amount').removeAttr('disabled'); 238 } 239 240 if (sender_payment_method != '' && receiver_currency != '' && sender_currency != '') { 241 $('#send-amount').removeAttr('disabled'); 242 } 243 setExRate(); 244 if (sending_amount != '' && sender_currency != '' && sender_payment_method != '' && receiver_currency != '') 245 calculateAmount(); 246 }) 247 248 249 250 async function currencyConverter(fromC, toC, amount) { 251 var fromCur = fromC.toString(); 252 var toCur = toC.toString(); 253 var c_amount = null; 254 endpoint = 'latest' 255 access_key = '5f1b56148fc082384c31bfdf160b5f70'; 256 // get the most recent exchange rates via the "latest" endpoint: 257 await $.ajax({
258 url: 'https://data.fixer.io/api/' + endpoint + '?access_key=' + access_key + '&symbols=' + toCur + 259 '&base=' + fromCur, 260 dataType: 'jsonp', 261 success: function (json) { 262 arr = json.rates; 263 var oneUnit = Object.values(arr); 264 var amt = parseFloat(amount); 265 c_amount = oneUnit * amt; 266 } 267 }); 268 return c_amount; 269 } 270 271 async function setExRate() { 272 var sender_currency = $('#sender-currency').val(); 273 var receiving_currency = $('#receiver-currency').val(); 274 var ex_s_amt = 1; 275 var ex_r_amt = null; 276 277 if (receiving_currency != '' && sender_currency != '') { 278 ex_r_amt = await currencyConverter(sender_currency, receiving_currency, ex_s_amt); 279 $('#ex-s-amt').text(ex_s_amt); 280 $('#ex-s-cur').text(sender_currency); 281 $('#ex-r-amt').text(ex_r_amt.toFixed(2)) 282 $('#ex-r-cur').text(receiving_currency); 283 284 $('#ex_s_amt').text(ex_s_amt); 285 $('#ex_s_cur').text(sender_currency); 286 $('#ex_r_amt').text(ex_r_amt) 287 $('#ex_r_cur').text(receiving_currency); 288 } 289 290 291 } 292}); 293 294function change_lang(elang) { 295 document.cookie = "lang=" + elang; 296} 297 298function isNumberKey(evt, element) { 299 var charCode = (evt.which) ? evt.which : event.keyCode 300 if (charCode > 31 && (charCode < 48 || charCode >
300 57) && !(charCode == 46 || charCode == 8)) 301 return false; 302 else { 303 var len = $(element).val().length; 304 var index = $(element).val().indexOf('.'); 305 if (index > 0 && charCode == 46) { 306 return false; 307 } 308 if (index > 0) { 309 var CharAfterdot = (len + 1) - index; 310 if (CharAfterdot > 3) { 311 return false; 312 } 313 } 314 } 315 return true; 316}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.