1(function ($) { 2 "use strict"; 3 4 $(document).ready(function () { 5 $('.cbcurrencyconverter_cal_wrapper').each(function (index, element) { 6 7 //hide the result window first 8 $(element).find('.cbcurrencyconverter_result').hide(); 9 10 $(element).find(".cbcurrencyconverter_cal_from").chosen({ 11 disable_search_threshold: 5, 12 width : "99%" 13 }); 14 15 $(element).find(".cbcurrencyconverter_cal_to").chosen({ 16 disable_search_threshold: 5, 17 width : "99%" 18 19 }); 20 21 $(element).on('click', '.cbcurrencyconverter_calculate', function (e) { 22 e.preventDefault(); 23 24 25 var $this = $(this); 26 var $parent = $this.parents('.cbcurrencyconverter_cal_wrapper'); 27 var button_ref = $this.attr('data-ref'); 28 var button_busy = $this.attr('data-busy'); 29 var decimalpoint = $this.attr('data-decimalpoint'); 30 31 32 var cbcurrencyconverter_data = {}; 33 34 35 cbcurrencyconverter_data['nonce'] = cbcurrencyconverter.nonce; 36 cbcurrencyconverter_data['decimal'] = decimalpoint; 37 cbcurrencyconverter_data['ref'] = button_ref; 38 39 cbcurrencyconverter_data['cbcurconvert_error'] = ''; 40 41 cbcurrencyconverter_data['cbcurconvert_amount'] = $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_cal_amount').val(); 42 cbcurrencyconverter_data['cbcurconvert_from'] = $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_cal_from').val(); 43 cbcurrencyconverter_data['cbcurconvert_to'] = $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_cal_to').val(); 44 45 46 // validation check 47 if (cbcurrencyconverter_data['cbcurconvert_to'] == '') { 48 cbcurrencyconverter_data['cbcurconvert_error'] = cbcurrencyconverter.empty_selection; 49 } 50 51 if (cbcurrencyconverter_data['cbcurconvert_from'] == '') { 52 cbcurrencyconverter_data['cbcurconvert_error'] = cbcurrencyconverter.empty_selection; 53 } 54 55 if (cbcurrencyconverter_data['cbcurconvert_error'] == '' && (cbcurrencyconverter_data['cbcurconvert_to'] == cbcurrencyconverter_data['cbcurconvert_from'])) { 56 cbcurrencyconverter_data['cbcurconvert_error'] = cbcurrencyconverter.same_selection; 57 } 58 59 60 if (cbcurrencyconverter_data['cbcurconvert_error'] == '' && button_busy == '0') { 61 62 $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_result').html(''); 63 $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_result').hide(); 64 65 $this.attr('data-busy', '1'); 66 $this.addClass('cbcurrencyconverter_active'); 67 68 $.ajax({
69 type : "post", 70 dataType: "json", 71 url : cbcurrencyconverter.ajaxurl, 72 data : {action: "currrency_convert", cbcurrencyconverter_data: cbcurrencyconverter_data}, 73 success : function (data, textStatus, XMLHttpRequest) { 74 75 $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_result').show(); 76 77 $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_result').html(cbcurrencyconverter_data['cbcurconvert_amount'] + ' ' + cbcurrencyconverter_data['cbcurconvert_from'] + ' = ' + data + ' ' + cbcurrencyconverter_data['cbcurconvert_to']); 78 79 $this.attr('data-busy', '0'); 80 $this.removeClass('cbcurrencyconverter_active'); 81 } 82 });// end of ajax 83 }// end of if error msg null 84 else { 85 86 $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_result').show(); 87 $this.parents('.cbcurrencyconverter_cal_wrapper').find('.cbcurrencyconverter_result').html(cbcurrencyconverter_data['cbcurconvert_error']); 88 } 89 }); 90 }); 91 });// end of function 92 93}(jQuery));
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.