1$(function(){ 2 3 //$(".js-currency-mask").maskMoney({precision:0, thousands:' ', decimal:'.', allowZero:false, suffix: ' ÑÑм'}); 4 5 /*$('.rates-list .item-panel a').on('mouseover', function(e){ 6 //e.preventDefault(); 7 $(this).trigger('click'); 8 $(this).parent().find('a.active').removeClass('active').removeClass('selectedLava'); 9 $(this).addClass('active').addClass('selectedLava'); 10 });*/ 11 12 //var arCurrenciesList = {'UZS':'ÑÑм','USD':'$','EUR':'â¬','RUB':'ÑÑб','GBP':'GBP','JPY':'JPY'}; 13 //var arCurrenciesList = {'UZS':'ÑÑм','USD':'$','EUR':'â¬','GBP':'GBP','JPY':'JPY'}; 14 var arCurrenciesList = {'UZS':'ÑÑм','USD':'$','EUR':'â¬','GBP':'GBP','JPY':'JPY','RUB':'RUB'}; 15 16 17 18 19 $(".js-convert-change-rates").on('click', function(){ 20 21 var curCurrency = $('.exchange__select_active__text').eq(0).text(); 22 //console.log('curCurrency: ' + curCurrency); 23 24 var toCurrency = $('.exchange__select_active__text').eq(1).text(); 25 //console.log('toCurrency: ' + toCurrency); 26 27 $('.exchange__select:eq(0) .exchange__select_item').each(function(index, obj){ 28 if($(obj).find('input').val() == toCurrency) 29 { 30 //console.log('trigger click 1: ' + toCurrency); 31 $(obj).trigger('click'); 32 } 33 }); 34 35 $('.exchange__select:eq(1) .exchange__select_item').each(function(index, obj){ 36 if($(obj).find('input').val() == curCurrency) 37 { 38 //console.log('trigger click 2: ' + curCurrency); 39 $(obj).trigger('click'); 40 } 41 }); 42 }); 43 44 /*$(".js-convert-change-rates").on('click', function(){ 45 46 if(!$(this).hasClass('active')){ 47 $(".calc-rates-changer-from .calc-rates-list-dropdown").detach().appendTo('.calc-rates-changer-to'); 48 $(".calc-rates-changer-to .calc-rates-result-currency").detach().appendTo('.calc-rates-changer-from'); 49 }else{ 50 $(".calc-rates-changer-from .calc-rates-result-currency").detach().appendTo('.calc-rates-changer-to'); 51 $(".calc-rates-changer-to .calc-rates-list-dropdown").detach().appendTo('.calc-rates-changer-from'); 52 } 53 54 $(this).toggleClass('active'); 55 56 $('.calc-rates').toggleClass('is-inverse'); 57 58 $(".calc-rates-input").keyup(); 59 });*/ 60 61 62 // Click on tabs (BANK ATM APP) 63 // Recalculate 64 $('.js-calc-cat button').on('click', function () { 65 setTimeout(function () { 66 $(".js-calc-rates-input-1").keyup(); 67 }, 1000); 68 }); 69 70 $(".js-calc-rates-input-1").on('keyup input', function(){ 71 var sum = $(this).val(); 72 73 //var bInverse = $('.calc-rates').hasClass('is-inverse'); 74 //console.log('bInverse: ' + bInverse); 75 76 // Clear sum 77 sum = str_replace(' ', '', sum); 78 $.each(arCurrenciesList, function(idx, val){ 79 sum = str_replace(val, '', sum); 80 }); 81 //console.log('sum: ' + sum); 82 83 if(!$(this).hasClass('js-last-active')) 84 { 85 $(this).addClass('js-last-active'); 86 $('.js-calc-rates-input-2').removeClass('js-last-active'); 87 } 88 89 /*if(bInverse){ 90 var curCurrency = $('.calc-rates-list .item-button.selected-to').attr('data-value'); 91 //console.log('curCurrency: ' + curCurrency); 92 93 var toCurrency = $('.calc-rates-list .item-button.selected').attr('data-value'); 94 //console.log('toCurrency: ' + toCurrency); 95 }else{ 96 var curCurrency = $('.calc-rates-list .item-button.selected').attr('data-value'); 97 //console.log('curCurrency: ' + curCurrency); 98 99 var toCurrency = $('.calc-rates-list .item-button.selected-to').attr('data-value'); 100 //console.log('toCurrency: ' + toCurrency); 101 }*/ 102 103 //var curCurrency = $('.exchange__select_active__text').eq(0).text(); 104 var curCurrency = $('.js-currency-field-1').attr('data-currency'); 105 //console.log('curCurrency: ' + curCurrency); 106 107 //var toCurrency = $('.exchange__select_active__text').eq(1).text(); 108 var toCurrency = $('.js-currency-field-2').attr('data-currency'); 109 //console.log('toCurrency: ' + toCurrency); 110 111 112 var strCalcType = $('.js-calc-types button.selected').attr('data-type'); 113 //console.log('strCalcType: ' + strCalcType); 114 115 var strCategory = $('.js-calc-cat button.active').attr('data-category'); 116 //console.log('strCategory: ' + strCategory); 117 118 //var arRates = <?=json_encode($arItem['RATES'])?>; 119 //var arRates = arCurrencyRates; 120 var arRates = arCurrencyRates[strCategory][strCalcType]; 121 //console.log('arRates:'); 122 //console.log(arRates); 123 124 var index = 0; 125 126 $.each(arRates, function( itemCurrency, itemRate ) { 127 128 //console.log(itemCurrency + ": " + itemRate); 129 130 if(itemCurrency == toCurrency) 131 { 132 //console.log(itemCurrency + ": " + itemRate); 133 134 if(curCurrency == 'UZS') 135 { 136 //console.log("UZS process..."); 137 138 if(curCurrency != itemCurrency) 139 { 140 var rate = sum / itemRate; 141 142 //if(toCurrency == 'JPY') rate = rate / 10; 143 144 var rate_formated = number_format(rate, 2, '.', ' '); 145 146 //console.log('rate: '+rate); 147 //console.log('rate_formated: '+rate_formated); 148 149 if(rate == 0) rate_formated = ''; 150 151 //tu//$('.calc-rates-results .calc-rates-result').eq(index).html(rate); 152 //$('.calc-rates-results .calc-rates-result-currency').eq(index).html(arCurrenciesList[itemCurrency]); 153 //tu//$('.calc-rates-results .calc-rates-result-currency').eq(index).html(itemCurrency); 154 155 $('.js-calc-rates-input-2').val(rate_formated); 156 157 // Set info 158 $('.js-currency__info').text(itemRate + ' UZS = ' + 1 + ' ' + arCurrenciesList[toCurrency
158]); 159 160 index++; 161 } 162 //else 163 //{ 164 //console.log('curCurrency: ' + curCurrency + ' - continue...'); 165 //} 166 } 167 else 168 { 169 //console.log(curCurrency + " process..."); 170 171 if(curCurrency != itemCurrency) 172 { 173 var rate = sum * arRates[curCurrency] / arRates[itemCurrency]; 174 175 //if(toCurrency == 'JPY') rate = rate / 10; 176 177 var rate_formated = number_format(rate, 2, '.', ' '); 178 179 //tu//$('.calc-rates-results .calc-rates-result').eq(index).html(rate); 180 //$('.calc-rates-results .calc-rates-result-currency').eq(index).html(arCurrenciesList[itemCurrency]); 181 //tu//$('.calc-rates-results .calc-rates-result-currency').eq(index).html(itemCurrency); 182 183 //console.log('rate: '+rate); 184 //console.log('rate_formated: '+rate_formated); 185 186 if(rate == 0) rate_formated = ''; 187 188 $('.js-calc-rates-input-2').val(rate_formated); 189 190 var cur_to_rate = number_format(arRates[curCurrency] / arRates[itemCurrency], 2, '.', ' '); 191 192 // Set info 193 $('.js-currency__info').text('1 ' + arCurrenciesList[curCurrency] + ' = ' + cur_to_rate + ' ' + arCurrenciesList[toCurrency
193]); 194 195 index++; 196 } 197 //else 198 //{ 199 //console.log('curCurrency: ' + curCurrency + ' - continue...'); 200 //} 201 } 202 } 203 }); 204 }).keyup(); 205 206 207 208 209 // ÐеÑеклÑÑаÑÐµÐ»Ñ "Тип конвеÑÑеÑа" - (покÑпка или пÑодажа) 210 // ÐапÑÑкаеÑÑÑ Ð¿ÐµÑеÑаÑÑÐµÑ ÐºÐ¾Ð½Ð²ÐµÑÑеÑа 211 $('.js-calc-types .item-type').on('click', function(){ 212 //alert('.js-calc-types .item-type'); 213 $('.js-calc-types .item-type').removeClass('active'); 214 $(this).addClass('active'); 215 //$(".js-calc-rates-input").keyup(); 216 $(".js-calc-rates-input.js-last-active").keyup(); 217 }); 218 219 // ÐÑи вÑбоÑе валÑÑÑ Ð¿ÐµÑезапÑÑкаем ÑаÑÑÐµÑ (Ñ Ð¿Ð¾Ð»Ñ Ð²Ð²Ð¾Ð´Ð° ÑÑммÑ) 220 //$('.exchange__select .exchange__select_item').on('click touchstart', function(){ 221 $('.currency-field__list .currency-field__item').on('click touchstart', function(){ 222 setTimeout(function(){ 223 //console.log('Trigger: .exchange__select label -> click touchstart'); 224 //$(".calc-rates-input").keyup(); 225 $(".js-calc-rates-input.js-last-active").keyup(); 226 }, 100); 227 }); 228 229 // ÐÑи пеÑеÑÑановке валÑÑ - менÑем валÑÑÑ Ð¼ÐµÑÑами 230 $('.exchange__reverse').on('click touchstart', function(){ 231 setTimeout(function(){ 232 233 //console.log('.exchange__reverse -> click touchstart'); 234 235 var curCurrency = $('.currency-field__header--value').eq(0).text(); 236 //console.log('curCurrency: ' + curCurrency); 237 238 var toCurrency = $('.currency-field__header--value').eq(1).text(); 239 //console.log('toCurrency: ' + toCurrency); 240 241 $('.currency-field__list:eq(0) .currency-field__item[data-currency-type="'+toCurrency+'"]').trigger('click'); 242 $('.currency-field__list:eq(1) .currency-field__item[data-currency-type="'+curCurrency+'"]').trigger('click'); 243 244 //console.log('.exchange__reverse -> FINISH'); 245 246 }, 100); 247 }); 248 249 250 // ÐÑи вÑбоÑе валÑÑÑ Ð² пеÑвом ÑпиÑке, во вÑоÑом ÑпиÑке ÑдалÑем ÑÑÑ Ð²Ð°Ð»ÑÑÑ 251 $('.currency-field__list:eq(0) .currency-field__item').on('click touchstart', function(){ 252 //console.log('.currency-field__list:eq(0) .currency-field__item -> click touchstart'); 253 setTimeout(function () { 254 255 //console.log('setTimeout RUN 1!'); 256 257 var curCurrency = $('.currency-field__header--value').eq(0).text(); 258 //console.log('curCurrency: ' + curCurrency); 259 260 //var toCurrency = $('.currency-field__header--value').eq(1).text(); 261 //console.log('toCurrency: ' + toCurrency); 262 263 //if(curCurrency == toCurrency) 264 //{ 265 // Change 2 currency 266 //console.log('NEED change second currency!'); 267 268 // ÐÑобÑажаем Ñанее ÑкÑÑÑÑÑ Ð²Ð°Ð»ÑÑÑ 269 $('.currency-field__list:eq(1) .currency-field__item').show(); 270 271 272 // СкÑÑваем вÑбÑаннÑÑ Ð²Ð°Ð»ÑÑÑ 273 $('.currency-field__list:eq(1) .currency-field__item[data-currency-type="'+curCurrency+'"]').hide(); 274 275 // 276 /*$('.currency-field__list:eq(1) .currency-field__item').each(function(index, obj){ 277 //console.log($(obj).find('input').val()); 278 console.log($(obj).attr('data-currency-type')); 279 if($(obj).attr('data-currency-type') != curCurrency) 280 { 281 console.log('trigger click'); 282 283 $(obj).trigger('click'); 284 return false; 285 } 286 //$(body).append($(obj).attr('class')); 287 });*/ 288 //} 289 //$(".calc-rates-input").keyup(); 290 $(".js-calc-rates-input.js-last-active").keyup(); 291 }, 100); 292 }); 293 294 295 296 // ÐÑи вÑбоÑе валÑÑÑ Ð²Ð¾ вÑоÑом ÑпиÑке, в пеÑвом ÑпиÑке ÑдалÑем ÑÑÑ Ð²Ð°Ð»ÑÑÑ 297 $('.currency-field__list:eq(1) .currency-field__item').on('click touchstart', function(){ 298 //console.log('.currency-field__list:eq(1) .currency-field__item -> click touchstart'); 299 setTimeout(function () { 300 301 //console.log('setTimeout RUN 2!'); 302 303 //var curCurrency = $('.currency-field__header--value').eq(0).text(); 304 //console.log('curCurrency: ' + curCurrency); 305 306 var toCurrency = $('.currency-field__header--value').eq(1).text(); 307 //console.log('toCurrency: ' + toCurrency); 308 309 //if(curCurrency == toCurrency) 310 //{ 311 // Change 2 currency 312 //console.log('NEED change second currency!'); 313 314 // ÐÑобÑажаем Ñанее ÑкÑÑÑÑÑ Ð²Ð°Ð»ÑÑÑ 315 $('.currency-field__list:eq(0) .currency-field__item').show(); 316 317 318 // СкÑÑваем вÑбÑаннÑÑ Ð²Ð°Ð»ÑÑÑ 319 $('.currency-field__list:eq(0) .currency-field__item[data-currency-type="'+toCurrency+'"]').hide(); 320 321 //} 322 //$(".calc-rates-input").keyup(); 323 $(".js-calc-rates-input.js-last-active").keyup(); 324 }, 100); 325 }); 326}); 327 328
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.