1$.ajaxSetup({ 2 headers: { 3 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 4 } 5}); 6 7window.bravo_format_money = function($money) { 8 9 if (!$money) { 10 //return fresco.free_text; 11 } 12 //if (typeof fresco.booking_currency_precision && fresco.booking_currency_precision) { 13 // $money = Math.round($money).toFixed(fresco.booking_currency_precision); 14 //} 15 16 $money = bravo_number_format($money/fresco.currency_rate, fresco.booking_decimals, fresco.decimal_separator, fresco.thousand_separator); 17 18 var $symbol = fresco.currency_symbol; 19 var $money_string = ''; 20 21 switch (fresco.currency_position) { 22 case "right": 23 $money_string = $money + $symbol; 24 break; 25 case "left_space": 26 $money_string = $symbol + " " + $money; 27 break; 28 29 case "right_space": 30 $money_string = $money + " " + $symbol; 31 break; 32 case "left": 33 default: 34 $money_string = $symbol + $money; 35 break; 36 } 37 38 return $money_string; 39} 40 41window.bravo_format_float_money = function($money) { 42 43 if (!$money) { 44 //return fresco.free_text; 45 } 46 //if (typeof fresco.booking_currency_precision && fresco.booking_currency_precision) { 47 // $money = Math.round($money).toFixed(fresco.booking_currency_precision); 48 //} 49 50 $money = bravo_number_format($money/fresco.currency_rate, 2, fresco.decimal_separator, fresco.thousand_separator); 51 52 var $symbol = fresco.currency_symbol; 53 var $money_string = ''; 54 55 switch (fresco.currency_position) { 56 case "right": 57 $money_string = $money + $symbol; 58 break; 59 case "left_space": 60 $money_string = $symbol + " " + $money; 61 break; 62 63 case "right_space": 64 $money_string = $money + " " + $symbol; 65 break; 66 case "left": 67 default: 68 $money_string = $symbol + $money; 69 break; 70 } 71 72 return $money_string; 73} 74 75window.bravo_number_format = function (number, decimals, dec_point, thousands_sep) { 76 77 78 number = (number + '') 79 .replace(/[^0-9+\-Ee.]/g, ''); 80 var n = !isFinite(+number) ? 0 : +number, 81 prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), 82 sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, 83 dec = (typeof dec_point === 'undefined') ? '.' : dec_point, 84 s = '', 85 toFixedFix = function (n, prec) { 86 var k = Math.pow(10, prec); 87 return '' + (Math.round(n * k) / k) 88 .toFixed(prec); 89 }; 90 // Fix for IE parseFloat(0.55).toFixed(0) = 0; 91 s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) 92 .split('.'); 93 if (s[0].length > 3) { 94 s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); 95 } 96 if ((s[1] || '') 97 .length < prec) { 98 s[1] = s[1] || ''; 99 s[1] += new Array(prec - s[1].length + 1) 100 .join('0'); 101 } 102 return s.join(dec); 103} 104 105window.bravo_handle_error_response = function(e){ 106 switch (e.status) { 107 case 401: 108 // not logged in 109 $('#login').modal('show'); 110 break; 111 } 112}; 113 114// Form validation 115var forms = document.getElementsByClassName('needs-validation'); 116// Loop over them and prevent submission 117var validation = Array.prototype.filter.call(forms, function(form) { 118 form.addEventListener('submit', function(event) { 119 if (form.checkValidity() === false) { 120 event.preventDefault(); 121 event.stopPropagation(); 122 } 123 form.classList.add('was-validated'); 124 }, false); 125}); 126 127var frescoApp ={ 128 showSuccess:function (configs){ 129 var args = {}; 130 if(typeof configs == 'object') 131 { 132 args = configs; 133 }else{ 134 args.message = configs; 135 } 136 if(!args.title){ 137 args.title = i18n.success; 138 } 139 args.centerVertical = true; 140 bootbox.alert(args); 141 }, 142 showError:function (configs) { 143 var args = {}; 144 if(typeof configs == 'object') 145 { 146 args = configs; 147 }else{ 148 args.message = configs; 149 } 150 if(!args.title){ 151 args.title = i18n.warning; 152 } 153 args.centerVertical = true; 154 bootbox.alert(args); 155 }, 156 showAjaxError:function (e) { 157 var json = e.responseJSON; 158 if(typeof json !='undefined'){ 159 if(typeof json.errors !='undefined'){ 160 var html = ''; 161 _.forEach(json.errors,function (val) { 162 html+=val+'<br>'; 163 }); 164 165 return this.showError(html); 166 } 167 if(json.message){ 168 return this.showError(json.message); 169 } 170 } 171 if(e.responseText){ 172 return this.showError(e.responseText); 173 } 174 }, 175 showAjaxMessage:function (json) { 176 if(json.message) 177 { 178 if(json.status){ 179 this.showSuccess(json); 180 }else{ 181 this.showError(json); 182 } 183 } 184 }, 185 showConfirm:function (configs) { 186 var args = {}; 187 if(typeof configs == 'object') 188 { 189 args = configs; 190 } 191 args.buttons = { 192 confirm: { 193 label: '<i class="fa fa-check"></i> '+i18n.confirm, 194 }, 195 cancel: { 196 label: '<i class="fa fa-times"></i> '+i18n.cancel, 197 } 198 }; 199 args.centerVertical = true; 200 bootbox.confirm(args); 201 } 202};
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.