1export const simulator = () => { 2 const $totalElm = $('.js-simulator-total') 3 const $30dElm = $('.js-simulator-30d') 4 const $1gbElm = $('.js-simulator-1gb') 5 6 $('.p-modal-simulator_list-item input').on('change',function(){ 7 let freeTotal = 0 8 let dataTotal = 0 9 let callTotal = 0 10 let total = 0 11 let totalDays = 0 12 let totalGb = 0 13 let per30d = 0 14 let per1gb = 0 15 $('.p-modal-simulator_list-item input').each(function(){ 16 const $this = $(this) 17 if($this.is(':checked')) { 18 if($this.data('gb')!=='') totalGb += parseInt($this.data('gb')) 19 if($this.data('price')!==''){ 20 if($this.data('days')<0){ 21 freeTotal += parseInt($this.data('price')) 22 } else if($this.data('days')>=30){ 23 totalDays+=parseInt($this.data('days')) 24 per30d += Math.floor((parseInt($this.data('price')) / parseInt($this.data('days'))) * 100) / 100 * 30 25 dataTotal += parseInt($this.data('price')) 26 } else { 27 per30d += parseInt($this.data('price')) 28 dataTotal += parseInt($this.data('price')) 29 } 30 31 } 32 if($this.data('callprice')!=='') callTotal += parseInt($this.data('callprice')) 33 } 34 }); 35 36 total = dataTotal+callTotal+freeTotal 37 per30d = totalDays>0?totalDays<30?total:per30d + callTotal + freeTotal : total 38 per1gb = totalGb>0?(Math.round((dataTotal / totalGb) * 10)/10).toLocaleString():0 39 $totalElm.text(total.toLocaleString()) 40 $30dElm.text(Math.floor(per30d).toLocaleString()) 41 $1gbElm.text(per1gb) 42 }) 43}
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.