1// Rate Calculator plugin for jQuery 2 3(function ($) { 4 $.fn.rateCalc = function (options) { 5 var defaults = { 6 tabs_hide: false 7 , money_slider: 'money-slider' 8 , money_text: 'money-text' 9 , days_text: 'day-text' 10 , date_split: '-' 11 }; 12 13 var options = $.extend(defaults, options); 14 /* create body */ 15 sliderCreateBody($(this)); 16 17 // first loan, register page 18 if (options.logged_in == 0 && isRegisterDesign()) { 19 options.amount_max = options.first_max; 20 } 21 22 $("#" + options.money_slider).slider({ 23 range: "min", 24 min: options.amount_min, 25 max: options.amount_max, 26 value: options.amount_default, 27 step: options.amount_step, 28 29 start: function (event, ui) { 30 $(ui.handle).find('.ui-slider-tooltip').show(); 31 }, 32 stop: function (event, ui) { 33 $(ui.handle).find('.ui-slider-tooltip').hide(); 34 sliderChange($(this), ui.value); 35 }, 36 slide: function (event, ui) { 37 $(ui.handle).find('.ui-slider-tooltip').text(ui.value); 38 sliderChange($(this), ui.value); 39 }, 40 create: function (event, ui) { 41 $(event.target).find('.ui-slider-handle').append('<div class="ui-slider-tooltip"><span></span></div>'); 42 sliderChange($(this), options.amount_default); 43 }, 44 change: function (event, ui) { 45 46 47 } 48 }); 49 50 $("#" + options.money_text).change(function () { 51 if ($('#' + options.money_slider).slider("option", "value") !== this.value) { 52 sliderChange('#' + options.money_slider, this.value); 53 } 54 }); 55 56 $('.minus a').on('mousedown', function (e) { 57 sliderChange('#' + options.money_slider, $('#' + options.money_slider).slider("option", "value") - $('#' + options.money_slider).slider("option", "step")); 58 }); 59 60 $(' .plus a').on('mousedown', function (e) { 61 sliderChange('#' + options.money_slider, $('#' + options.money_slider).slider("option", "value") + $('#' + options.money_slider).slider("option", "step")); 62 }); 63 64 65 if (options.allow_datepicker) { 66 $("#slider_datepicker").datepicker({ 67 dateFormat: options.format_datepicker, 68 changeMonth: false, 69 changeYear: false, 70 minDate: minDatePicker(), 71 maxDate: maxDatePicker(), 72 beforeShowDay: function (date) { 73 var dt = $.datepicker.formatDate('dd-mm-yy', date); 74 return [options.datepicker.indexOf(dt) != -1]; 75 }, 76 onSelect: function (dateText) { 77 d1 = dateToObj(dateText, options.date_split); 78 d2 = dateToObj(dateFormat(new Date(), options.format_datepicker), options.date_split); 79 diff = dateDiffToday(d1, d2); 80 changeInput('#' + options.days_text, diff); 81 sliderChange('#' + options.money_slider, $('#' + options.money_slider).slider("option", "value")); 82 } 83 84 }); 85 } 86 87 $('.tabs_li a').click(function (e) { 88 var class_name = $(this).attr('class'); 89 changeTab(class_name); 90 e.preventDefault(); 91 92 }); 93 $('.submit_button, .calc_submit_simple').click(function (e) { 94 submitCalcForm(); 95 e.preventDefault(); 96 }) 97 $('.change-amount').click(function(e){ 98 $("#calculator-body").slideToggle(); 99 e.preventDefault(); 100 }); 101 102 function submitCalcForm() { 103 var amount = getElemVal('#' + options.money_text); 104 if (parseInt(options.logged_in) === 0 && parseInt(sliderGetActiveTab(amount)) === 1) { 105 showModal('login_exist'); 106 } else if (options.logged_in) { 107 jsCalculatorFormData2(1, ''); 108 } else { 109 $('#sliderForm').submit(); 110 } 111 } 112 113 function changeTab(class_name) { 114 if (class_name === 'tab0') { 115 this.tab_clicked = 0; 116 if (this.loan >= options.amount_null_till) { 117 this.loan = options.amount_null_till; 118 } 119 } else if (class_name === 'tab1') { 120 this.tab_clicked = 1; 121 } 122 $('.calc_intro_txt').html(sliderGetText('intro_' + class_name)); 123 sliderChange('#' + options.money_slider, this.loan); 124 } 125 126 function sliderChange(slider, slider_val) { 127 if (options.block_change_amount) { 128 slider_val = options.amount_default; 129 } 130 new_val = sliderCheckValue(slider, slider_val); 131 changeInput('#' + options.money_text, new_val); 132 sliderChangeVal(); 133 sliderGetActiveTab(new_val); 134 } 135 136 function getArrayByTab(obj, a_tab) { 137 if (!($.isArray(obj))) { 138 return obj; 139 } else if (obj[a_tab]) { 140 return obj[a_tab]; 141 } else { 142 return obj[0]; 143 } 144 } 145 146 function getDefaultMultiplayer(){ 147 return options.default_multiplayer; 148 } 149 150 function sliderChangeVal() { 151 this.loan = parseInt(getElemVal('#' + options.money_text)); 152 a_tab = sliderGetActiveTab(this.loan); 153 defaultMultiplayer = getDefaultMultiplayer(); 154 c_multiplayer = parseFloat(getArrayByTab(options.comm_mult, a_tab)); 155 if (options.logged_in && options.comm_mult.length > 1 && a_tab == 0 && c_multiplayer == defaultMultiplayer) { 156 if (options.logged_in && options.comm_ranges.length > 1) { 157 c_multiplayer = parseFloat(getArrayByTab(options.comm_mult, 0)); 158 } else { 159 c_multiplayer = defaultMultiplayer; 160 } 161 } 162 163 c_fee = getArrayByTab(options.comm_fee, a_tab); 164 i_fee = getArrayByTab(options.initial_fee, a_tab); 165 this.days = diffDatePicker(); 166 this.multiplayer = c_multiplayer; 167 this.sliderMax = getArrayByTab(options.comm_ranges, a_tab)['max']; 168 this.sliderMin = getArrayByTab(options.comm_ranges, a_tab)['min']; 169 if(!a_tab && ((!options.logged_in && options.first_max) || isRegisterDesign())) { 170 this.sliderMax = options.first_max; 171 } 172 173 this.gpl_tooltip = '<a href="#" class="tooltip" title="' + sliderGetText('gpl_tooltip') + '"></a>'; 174 this.comm_tooltip = '<a href="#" class="tooltip" title="' + sliderGetText('commission_tooltip') + '"></a>'; 175 176 commission_monthly = commission_monthly_20 = 0; 177 if (c_multiplayer != 0) { 178 var commission_monthly = default_commission_monthly = parseFloat(RoundFixed(30 * ((this.loan * c_fee * c_multiplayer) / 100), 2)); 179 var commission_monthly_20 = default_commission_monthly_20 = parseFloat(RoundFixed(options.monthly_payment_days * ((this.loan * c_fee * c_multiplayer) / 100), 2)); 180 this.comm_tooltip = ''; 181 } 182 183 if(c_multiplayer != defaultMultiplayer) { 184 var default_commission_monthly = parseFloat(RoundFixed(30 * ((this.loan * c_fee * defaultMultiplayer) / 100), 2)); 185 var default_commission_monthly_20 = parseFloat(RoundFixed(options.monthly_payment_days * ((this.loan * c_fee * defaultMultiplayer) / 100), 2)); 186 } 187 188 var calculated_initial = (this.loan * i_fee) / 100; 189 190 this.commission = commission_monthly; 191 this.next_initial_month = parseFloat(Math.max((calculated_initial + commission_monthly_20 + options.withdrawal_fee), 50)); 192 193 this.default_commission = default_commission_monthly; 194 this.default_next_initial_month = parseFloat(Math.max((calculated_initial + default_commission_monthly_20 + options.withdrawal_fee), 50)); 195 196 this.gpl = getXIRR(this.loan, [this.loan + commission_monthly], [dateToText(getDate(1), options.date_split)], options); 197 this.apr = getSimpleApr(this.loan); 198 199 replaces = [ 200 'loan_sum_html', 201 'loan_amount_html', 202 'commission_html', 203 'commission_reg_html', 204 'gpl_html', 205 'pay_all_html', 206 'pay_all_reg_html', 207 'pay_month_html', 208 'pay_month_reg_html', 209 'return_html', 210 'return_date_html', 211 'amount_span' 212 ]; 213 $.each(replaces, function (i, key) { 214 changeHtml('#' + key, sliderGetReplace(key)); 215 }); 216 217 $('.prc, .js_discount').hide(); 218 if (this.multiplayer !== getDefaultMultiplayer()) { 219 $('.prc, .js_discount').show(); 220 } 221 222 $(".tooltip").tooltip({ 223 position: { 224 my: "center bottom-10", 225 at: "center top", 226 using: function (position, feedback) { 227 $(this).css(position); 228 $("<div>") 229 .addClass("arrow") 230 .addClass(feedback.vertical) 231 .addClass(feedback.horizontal) 232 .appendTo(this); 233 } 234 } 235 }); 236 } 237 238 function sliderCheckValue(slider, valuex) { 239 step = $(slider).slider("option", "step"); 240 if (((valuex) % step) !== 0) { 241 valuex = (parseInt(valuex - ((valuex) % step))); 242 } 243 min = $(slider).slider("option", "min"); 244 max = $(slider).slider("option", "max"); 245 def_value = $(slider).slider("option", "value"); 246 if (min > valuex) { 247 valuex = min; 248 } else if (max < valuex) { 249 valuex = max; 250 } 251 if (def_value !== valuex) { 252 $(slider).slider("option", "animate", "fast"); 253 $(slider).slider('value', valuex); 254 } 255 256 return valuex; 257 } 258 259 function getDate(val) { 260 if (val === 1) { 261 return maxDatePicker(); 262 } else if (val === 0) { 263 return $('#slider_datepicker').val(); 264 } else { 265 return dateFormat(dateAdd(new Date(), options.days_default), options.format_datepicker); 266 } 267 } 268 269 function isRegisterDesign(){ 270 return options.register ||options.design == 'reg-side'; 271 } 272 273 function sliderCreateBody(obj) { 274 275 var datepicker = '<input type="hidden" id="slider_datepicker" value="' + getDate(1) + '" readonly="readonly" />' 276 + '<input type="hidden" id="' + options.days_text + '" name="days" value="' + options.days_default + '" maxlength="5" />'; 277 278 if (isRegisterDesign()) { 279 html = '<div class="slider-wrap" id="calculator-body" style="display:none;">' 280 + '<div class="slider-label clearfix"><span id="amount_span"></span></div>' 281 + '<input type="hidden" id="' + options.money_text
281+ '" name="summ" value="' + options.amount_default + '" maxlength="5" />' 282 + '<div id="' + options.money_slider + '"></div>' 283 + '<div class="slider-buttons">' 284 + '<div class="minus"><a href="#" class="link">-</a></div>' 285 + '<div class="plus"><a href="#" class="link">+</a></div>' 286 + '</div>' 287 + datepicker 288 + '<div class="loan-total"><div class="summ" id="loan_sum_html"></div>' 289 + '</div>' 290 + '</div>' 291 + '<div class="summary-table mob-trigger">' 292 + '<table>' 293 + '<tr><td id="loan_amount_html"></td></tr>' 294 + '<tr><td id="commission_html"></td></tr>' 295 + '<tr><td id="widthdrawal_html">Comision de analiza dosar: <strong>' + options.withdrawal_fee + ' ron</strong></td></tr>' 296 + '<tr><td id="gpl_html"></td></tr>' 297 + '<tr><td id="return_date_html"></td></tr>' 298 + '<tr><td id="pay_all_reg_html"></td></tr>' 299 + '<tr><td id="pay_month_reg_html"></td></tr>' 300 + '</table>' 301 + '</div>'; 302 if (!options.block_change_amount) { 303 html += '<div class="change-amount"><a href="#" id="change-amount">'+sliderGetText('change_amount')+'</a></div>'; 304 } 305 } else if (options.design == 'side') { 306 html = '' + 307 ' <div class="sidebar-calc-block">' + 308 '<div class="slider-wrap">' + 309 '<div class="slider-label clearfix"><h3>Selecteaza suma</h3><span id="amount_span"></span>' + 310 '<input type="text" id="' + options.money_text + '" name="sum" value="' + options.amount_default + '" maxlength="5" /></div>' + 311 '<div class="slider-wrap">' + 312 '<div id="' + options.money_slider + '"></div>' + 313 '<div class="minus"><a href="#">-</a></div>' + 314 '<input type="text" id="' + options.money_text + '" name="sum" value="' + options.amount_default + '" maxlength="5" /></div>' + 315 '<div class="plus"><a href="#">+</a></div>' + 316 '</div>' + 317 datepicker + 318 '<div class="button-orange"><a href="" class="submit_button">' + sliderGetText('submit') + '</a></div>' + 319 '</div></div>' + 320 '<table class="sidebar-table table-1">' + 321 '<tbody>' + 322 '<tr><td id="loan_amount_html"></td></tr>' + 323 '<tr><td id="commission_html"></td></tr>' + 324 '<tr><td id="withdrawal_html">Comision de analiza dosar: <strong>' + options.withdrawal_fee + ' ron</strong></td></tr>' + 325 '<tr><td id="gpl_html"></td></tr>' + 326 '<tr><td id="return_date_html"></td></tr>' + 327 '</tbody></table>'; 328 } else { 329 var tab_counter = 0; 330 var tab_html = ''; 331 //only when tabs is displayed 332 if (!options.tabs_hide && parseInt(options.finished_loans) === 0) { 333 $.each(options.array_tabs, function (key, value) { 334 var tab_class = 'tab' + tab_counter; 335 var li_class = ' class ="tabs_li"'; 336 if (sliderGetActiveTab(options.amount_default) === tab_counter) { 337 li_class = ' class ="tabs_li act"'; 338 } 339 tab_html += '<li' + li_class + '><a href="" class="' + tab_class + '">' + value + '</a></li>'; 340 tab_counter++; 341 }); 342 343 tab_html = '<ul class="slider-tabs">' + tab_html + '</ul>'; 344 } 345 346 var slider_html = 347 '<div class="product-block standard-price">' 348 + '<div class="slider-label clearfix">' 349 + '<h3>' + sliderGetText('amount_header') + '</h3>' 350 //+ '<input type="text" id="' + options.money_text
350+ '" name="summ" value="' + options.amount_default + '" maxlength="5" />' 351 + '<span id="amount_span"></span>' 352 + '</div>' 353 + '<div class="slider-wrap">' 354 + '<div id="' + options.money_slider + '"></div>' 355 + '</div>' 356 + '<div class="amount-wrap">' 357 + '<div class="minus"><a href="#">-</a></div>' 358 + '<input type="text" id="' + options.money_text + '" name="summ" value="' + options.amount_default + '" maxlength="5" class="amount-npt" />' 359 + '<div class="plus"><a href="#">+</a></div>' 360 + '</div>' 361 + '<div clearfix">' 362 + datepicker 363 + '<div class="button-orange"><a href="" class="submit_button">' + sliderGetText('submit') + '</a></div>' 364 + '</div>' 365 + '</div>'; 366 367 var slider_info_html = '<div class="product-table">' 368 + '<table class="table-1">' 369 + '<tr>' 370 + '<td colspan="3" id="loan_amount_html"></td>' 371 + '</tr>' 372 + '<tr>' 373 + '<td colspan="3" id="commission_html"></td>' 374 + '</tr>' 375 + '<tr>' 376 + '<td colspan="3" id="withdrawal_html">Comision de analiza dosar: <strong>' + options.withdrawal_fee + ' ron</strong></td>' 377 + '</tr>' 378 + '<tr>' 379 + '<td colspan="3" id="gpl_html"></td>' 380 + '</tr>' 381 + '<tr><td colspan="3" id="return_date_html"></td></tr>' 382 + '<tr><td colspan="3" style="border-bottom:0;">' + sliderGetText('choose_pay_method') + ' <a href="#" class="tooltip" title="' + sliderGetText('choose_pay_method_tooltip') + '"></a></td></tr>' 383 + '<tr class="dates">' 384 + '<td class="range_in"><div id="pay_month_html" class="act"></div></td>' 385 + '<td class="eller">' + sliderGetText('or') + '</td>' 386 + '<td><div id="pay_all_html"></div></td>' 387 + '</tr>' 388 + '<tr><td colspan="3" align="center"><div class="loan_info white"><p><a href="javascript:;">Informatii standard</a></p></div></td></tr>' 389 + '</table>' 390 + '</div>'; 391 392 var example_html = ''; 393 if ($(obj).hasClass('first-page')) { 394 example_html = '<div class="calc-representative-example disclaimer-3">' 395 + sliderGetText('representative_example') 396 + '</div>'; 397 } 398 399 html = '<div class="product-block-wrap">' + tab_html + slider_html + '</div>' + slider_info_html + example_html; 400 401 } 402 $(obj).append(html); 403 } 404 405 function sliderGetActiveTab(amount) { 406 tab = 0; 407 if (this.tab_clicked >= 0) { 408 tab = this.tab_clicked; 409 if (this.tab_clicked === 0) { 410 if (amount > options.amount_null_till) { 411 this.tab_clicked = -1; 412 return sliderGetActiveTab(amount); 413 } 414 } 415 } else { 416 if (options.weekday_min && options.weekday_min > 0) { 417 /*if (amount > options.weekday_min) { 418 tab = 1; 419 }*/ 420 if (amount > options.weekday_min && options.comm_ranges.length > 1) { 421 tab = options.comm_ranges.length - 1; 422 } 423 424 } else { 425 if (amount <= options.amount_null_till || parseInt(options.finished_loans) > 0) { 426 tab = 0; 427 } else { 428 tab = 1; 429 } 430 } 431 } 432 433 if (!options.tabs_hide && parseInt(options.finished_loans) === 0) { 434 $('.tab0').parent().removeClass('act'); 435 $('.tab1').parent().removeClass('act'); 436 $('.tab' + tab).parent().addClass('act'); 437 438 if (tab === 0) { 439 $(".product-block").removeClass("standard-price"); 440 } else { 441 $(".product-block").addClass("standard-price"); 442 } 443 } 444 445 446 return tab; 447 } 448 449 function isJson(str) { 450 try { 451 JSON.parse(str); 452 } catch (e) { 453 return false;
454 } 455 return true; 456 } 457 458 function sliderGetText(key) { 459 var json_obj = JSON.parse(options.texts); 460 var text; 461 $.each(json_obj, function (i, j_obj) { 462 if (i === key) 463 text = j_obj; 464 }); 465 466 return text; 467 } 468 469 function minDatePicker() { 470 return dateFormat(findMinDate(options.datepicker, options.date_split), options.format_datepicker); 471 } 472 473 function maxDatePicker() { 474 return dateFormat(findMaxDate(options.datepicker, options.date_split), options.format_datepicker); 475 } 476 477 function diffDatePicker() { 478 d1 = dateToObj(getDate(0), options.date_split); 479 d2 = dateToObj(dateFormat(new Date(), options.format_datepicker), options.date_split); 480 diff = dateDiffToday(d1, d2); 481 changeInput('#' + options.days_text, Math.max(Math.min(diff, options.days_max), options.days_min)); 482 return diff; 483 } 484 485 function getGrafic(amount, max_count, cfee) { 486 var repay_format = 'days_month'; /* or month */ 487 var holidays_on = false; 488 var loan_days = 30; 489 490 a_tab = sliderGetActiveTab(amount); 491 //get com fee 492 c_fee = getArrayByTab(options.comm_fee, a_tab); 493 //get i fee 494 i_fee = getArrayByTab(options.initial_fee, a_tab); 495 //get by tab 496 discount_days = getArrayByTab(options.discount_days, a_tab); 497 if (cfee) { 498 c_multiplayer = 1; 499 } else { 500 c_multiplayer = parseFloat(getArrayByTab(options.comm_mult, a_tab)); 501 } 502 amount_left = parseInt(amount); 503 504 i = 0; 505 var start_obj = new Date(); 506 today = start_obj; 507 today30 = dateAdd(today, 30); 508 509 var arr_amount = []; 510 var arr_days = []; 511 var arr_c = []; 512 var cost_cap_left = amount_left; 513 var cost_cap_initial_repay_perc = 0.3; 514 var max = max_count; 515 if (!max) max = 12; 516 517 while (amount_left > 0) { 518 if (i == 0) { 519 withdraw = options.withdrawal_fee; 520 } else { 521 withdraw = 0; 522 } 523 var part_i = getCommissionPrc((amount_left / 100), i_fee, 4); 524 part_i = parseFloat(RoundFixed(part_i, 2)); 525 amount_left = parseFloat(RoundFixed(amount_left, 2)); 526 if (amount_left < part_i) { 527 diff_i = amount_left; 528 } else { 529 diff_i = part_i; 530 } 531 if (i >= (max_count - 1)) { 532 diff_i = amount_left; 533 } 534 if (repay_format == 'days') { 535 var total_days = (i + 1) * loan_days; 536 payment_date = dateAdd(today, total_days); 537 } else if (repay_format == 'days_month') { 538 if (i == 0) { 539 var payment_date = today30; 540 var currentDay = payment_date.getDate(); 541 } else { 542 var currentMonth = payment_date.getMonth(); 543 payment_date.setMonth(currentMonth + 1, currentDay); 544 545 if (payment_date.getMonth() > currentMonth + 1) { 546 payment_date.setDate(0); 547 } 548 } 549 } else { 550 var payment_date = dateAddMonth(today, i + 1); 551 } 552 553 if (holidays_on) { 554 //todo implemnt this 555 } 556 557 bill_date = dateAdd(payment_date, -10); 558 if (today == start_obj) { 559 dif_days = parseInt(dateDiffToday(bill_date, start_obj)); 560 } else { 561 dif_days = parseInt(dateDiffToday(bill_date, start_obj)) + 1; 562 } 563 var part_c = 0; 564 if (discount_days > 0) { 565 if (discount_days > dif_days) { 566 diff = dif_days; 567 } else { 568 diff = discount_days; 569 } 570 discount_days -= diff; 571 dif_days -= diff; 572 part_c += parseFloat(RoundFixed(diff * ((amount_left * c_fee * c_multiplayer) / 100), 2)); 573 } 574 575 if (dif_days > 0) { 576 part_c += parseFloat(RoundFixed((getCommissionPrc(amount_left / 100, c_fee * getDefaultMultiplayer(), 4) * dif_days), 2)); 577 } 578 if (cost_cap_left >= withdraw) { 579 cost_cap_left -= withdraw; 580 } 581 if (cost_cap_left >= part_c) { 582 cost_cap_left -= part_c; 583 } else if (part_c) { 584 part_c = cost_cap_left; 585 cost_cap_left = 0; 586 } 587 if (!part_c && !cost_cap_left){ 588 diff_i = parseFloat(RoundFixed((amount_left * cost_cap_initial_repay_perc), 2)); 589 } 590 591 var monthly_result = getNextAmountValid(diff_i, part_c, amount_left); 592 diff_i = monthly_result[0]; 593 part_c = monthly_result[1]; 594 595 if (max == 1) { 596 diff_i = amount_left; 597 } 598 599 t_pay = RoundFixed(parseFloat(diff_i) + parseFloat(part_c) + parseFloat(withdraw), 2); 600 601 var sub = arr_amount.push(t_pay); 602 if (options.apr_type == 'bill') { 603 arr_days.push(dateFormat(bill_date, 'yy-mm-dd')); 604 } else { 605 arr_days.push(dateFormat(payment_date, 'yy-mm-dd')); 606 } 607 arr_c.push(part_c); 608 609 start_obj = dateAdd(bill_date, 1); 610 amount_left -= diff_i; 611 amount_left = RoundFixed(parseFloat(amount_left), 2); 612 613 max--; 614 if (max == 0) { 615 break; 616 } 617 i++; 618 } 619 620 return [arr_amount, arr_days]; 621 } 622 623 function getSimpleApr(amount) { 624 data = getGrafic(amount, 12, 0); 625 return getXIRR(amount, data[0], data[1], options); 626 } 627 628 629 function sliderGetReplace(key) { 630 var replaces = { 631 JS_COMMISSION: RoundFixed(this.commission, 2), 632 //JS_COMMISSION_STANDART: this.commission_standart, 633 JS_CURRENCY: options.format_currency, 634 JS_LOAN: this.loan, 635 JS_LOAN_TOTAL: RoundFixed((this.loan + this.commission + options.withdrawal_fee), 2), /*this.next_initial_full*/ 636 //JS_LOAN_TOTAL_STANDART: RoundFixed((this.loan + this.commission_standart), 2), 637 JS_LOAN_MONTH: RoundFixed(this.next_initial_month, 2), 638 JS_RETURN_DATE: getDate(0), 639 JS_RETURN_DATE2: getDate(0), 640 JS_RETURN_GPL: this.gpl, 641 JS_RETURN_APR: this.apr, 642 JS_DISCOUNT: (100 - (1 - this.multiplayer) * 100), 643 JS_COMMISSION_TOOLTIP: this.comm_tooltip, 644 JS_GPL_TOOLTIP: this.gpl_tooltip, 645 JS_COMMISSION_DEFAULT: RoundFixed(this.default_commission, 2), 646 JS_LOAN_TOTAL_DEFAULT: RoundFixed((this.loan + this.default_commission + options.withdrawal_fee), 2), 647 JS_LOAN_MONTH_DEFAULT: RoundFixed(this.default_next_initial_month, 2), 648 JS_MAX_AMOUNT: this.sliderMax, 649 JS_MIN_AMOUNT: this.sliderMin, 650 };
651 text = sliderGetText(key); 652 $.each(replaces, function (i, j_val) { 653 text = text.replace('%' + i + '%', j_val); 654 }); 655 $.each(replaces, function (i, j_val) { 656 text = text.replace('%' + i + '%', j_val); 657 }); 658 659 return text.replace(/"/g, '"'); 660 } 661 662 function getNextAmountValid(initial, commission, amount) { 663 var min_initial = 1; 664 var min_pay = 55; 665 var diff = 0; 666 667 initial = Math.min(Math.max(initial, min_initial), amount); 668 669 if (initial + commission < min_pay) { 670 if (amount >= min_pay) { 671 diff = min_pay - (initial + commission); 672 initial += diff; 673 } else if (amount + commission <= min_pay) { 674 initial = amount; 675 } else if (commission < min_pay) { 676 initial = min_pay - commission; 677 } 678 } 679 return [initial, commission]; 680 } 681 }; 682 683})(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.