1(function ($) { 2 "use strict"; 3 $(function () { 4 var regex = { 5 phone: /^1?(\d{3})(\d{3})(\d{4})$/ 6 }; 7 8 var is_ready_to_submit = function () { 9 var form_product = $('.cart').last(); 10 if (form_product.data('tc_validator')) { 11 if (form_product.tc_valid() === true) { 12 return true; 13 } else { 14 form_product.tc_validate().form(); 15 return false; 16 } 17 } 18 return true; 19 }; 20 21 function angelleye_populate_form(frm, data) { 22 $.each(data, function(key, value){ 23 var $ctrl = $('[name='+key+']', frm); 24 if($ctrl.is('select')){ 25 $("option",$ctrl).each(function(){ 26 if (this.value==value) { this.selected=true; } 27 }); 28 } 29 else { 30 switch($ctrl.attr("type")) 31 { 32 case "text" : case "hidden": case "textarea": 33 $ctrl.val(value); 34 break; 35 case "radio" : case "checkbox": 36 $ctrl.each(function(){ 37 if($(this).attr('value') == value) { $(this).attr("checked",value); } }); 38 break; 39 } 40 } 41 }); 42 }; 43 44 $(document).ready(function () { 45 46 if( offers_for_woocommerce_js_params.angelleye_post_data !== '' ) { 47 angelleye_populate_form($('.cart'), offers_for_woocommerce_js_params.angelleye_post_data); 48 } 49 50 $('.ofwc_no_price_product').remove(); 51 52 $(".variations_form").on("hide_variation", function () { 53 if ($('.single_add_to_cart_button').hasClass('disabled')) { 54 $('.single_offer_button').addClass('disabled'); 55 } else { 56 $('.single_offer_button').removeClass('disabled'); 57 } 58 }); 59 60 $(".variations_form").on("show_variation", function () { 61 if ($('.single_add_to_cart_button').hasClass('disabled')) { 62 $('.single_offer_button').addClass('disabled'); 63 } else { 64 $('.single_offer_button').removeClass('disabled'); 65 } 66 }); 67 68 var get = []; 69 location.search.replace('?', '').split('&').forEach(function (val) { 70 var split = val.split("=", 2); 71 get[split[0]] = split[1]; 72 }); 73 74 if (get["aewcobtn"] && !($("div.woocommerce-message").length > 0)) { 75 76 if($('.tm-epo-counter').length > 0) { 77 // return false; 78 } 79 if (!$(".woocommerce-error:first").hasClass('aeofwc-woocommerce-error')) 80 { 81 // do nothing 82 } else 83 { 84 if (offers_for_woocommerce_js_params.is_product_type_variable === 'true') { 85 var variationId = $("input[name='variation_id']").val(); 86 if (variationId > 0) { 87 angelleyeOpenMakeOfferForm(false); 88 } else { 89 alert(offers_for_woocommerce_js_params.i18n_make_a_selection_text); 90 } 91 } else { 92 //var productId = $("button[name='add-to-cart']").val(); 93 if ($("input[name='add-to-cart']").val() > 0 || $("button[name='add-to-cart']").val() > 0) { 94 angelleyeOpenMakeOfferForm(false); 95 } else { 96 alert(offers_for_woocommerce_js_params.i18n_unavailable_text); 97 } 98 } 99 } 100 } 101 102 var makeOfferBtnPosition = $('#offers-for-woocommerce-a
102dd-to-cart-wrap').attr('data-ofwc-position'); 103 var makeOfferBtnhtml = $('.single_variation_wrap_angelleye.ofwc_offer_tab_form_wrap').html(); 104 105 // after price 106 if (makeOfferBtnhtml != null && makeOfferBtnhtml.length > 0) { 107 if (makeOfferBtnPosition == 'after_price') { 108 $('.product .summary .price:first').after("<div class='offers-for-woocommerce-add-to-cart-wrap ofwc-no-float'>" + makeOfferBtnhtml + ""); 109 } 110 } 111 112 $(".offers-for-woocommerce-make-offer-button-single-product").click(function () { 113 if (is_ready_to_submit() === false) { 114 return false; 115 } 116 if (offers_for_woocommerce_js_params.is_product_type_variable === 'true') { 117 if (offers_for_woocommerce_js_params.is_woo_variations_table_installed === '1') { 118 var variationId = $(this).parents("tr").find("input[name='variation_id']").val(); 119 $("input[name='offer_variations_table_variation_id']").val(variationId); 120 } else { 121 var variationId = $("input[name='variation_id']").val(); 122 } 123 124 if (variationId > 0) { 125 angelleyeOpenMakeOfferForm(true); 126 } else { 127 alert(offers_for_woocommerce_js_params.i18n_make_a_selection_text); 128 } 129 } else { 130 //var productId = $("input[name='add-to-cart']").val(); 131 if ($("input[name='add-to-cart']").val() > 0 || $("button[name='add-to-cart']").val() > 0) { 132 angelleyeOpenMakeOfferForm(true); 133 } else { 134 alert(offers_for_woocommerce_js_params.i18n_unavailable_text); 135 } 136 } 137 }); 138 139 $("#lightbox_custom_ofwc_offer_form_close_btn, #aeofwc-close-lightbox-link").on('click', function () 140 { 141 142 $("#lightbox_custom_ofwc_offer_form").removeClass('active'); 143 $("#lightbox_custom_ofwc_offer_form").hide(); 144 $("#lightbox_custom_ofwc_offer_form_close_btn").hide(); 145 }); 146 147 $('#woocommerce-make-offer-form-quantity').autoNumerics('init', 148 { 149 vMin: '0', 150 mDec: '0', 151 lZero: 'deny', 152 aForm: false, 153 aSep: offers_for_woocommerce_js_params.ofw_public_js_thousand_separator, 154 aDec: offers_for_woocommerce_js_params.ofw_public_js_decimal_separator, 155 } 156 ); 157 158 $('#woocommerce-make-offer-form-price-each').autoNumerics('init', 159 { 160 aForm: false, /* Controls if default values are formatted on page ready (load) */ 161 aSep: offers_for_woocommerce_js_params.ofw_public_js_thousand_separator, /* Thousand separator */ 162 aDec: offers_for_woocommerce_js_params.ofw_public_js_decimal_separator, /* Decimal separator */ 163 //pSign : 'p', /* Placement of the currency : p = left and s = right */ 164 vMin: '0.00', /* Enter the minimum value allowed */ 165 lZero: 'allow', /* Controls if leading zeros are allowed */ 166 wEmpty: 'sign', /* controls input display behavior. */ 167 mDec: offers_for_woocommerce_js_params.ofw_public_js_number_of_decimals, /* enter the number of decimal places - this will over ides values set by vMin & vMax */ 168 aSign: '', 169 } 170 ); 171 172 $('#woocommerce-make-offer-form-total').autoNumerics('init', 173 { 174 aForm: false, /* Controls if default values are formatted on page ready (load) */ 175 aSep: offers_for_woocommerce_js_params.ofw_public_js_thous
175and_separator, /* Thousand separator */ 176 aDec: offers_for_woocommerce_js_params.ofw_public_js_decimal_separator, /* Decimal separator */ 177 //pSign : 'p', /* Placement of the currency : p = left and s = right */ 178 lZero: 'allow', /* Controls if leading zeros are allowed */ 179 wEmpty: 'zero', /* controls input display behavior. */ 180 mDec: offers_for_woocommerce_js_params.ofw_public_js_number_of_decimals, /* enter the number of decimal places - this will over ides values set by vMin & vMax */ 181 } 182 ); 183 184 $('#woocommerce-make-offer-form').find(':submit').removeAttr('disabled', 'disabled'); 185 186 (function ($) { 187 $.fn.money_field = function (opts) { 188 var defaults = {width: null, symbol: 'dddd'}; 189 var opts = $.extend(defaults, opts); 190 return this.each(function () { 191 if (opts.width) 192 $(this).css('width', opts.width + 'px'); 193 $(this).wrap("<div class='angelleye-input-group'>").before("<span class='angelleye-input-group-addon'>" + opts.symbol + "</span>"); 194 }); 195 }; 196 })(jQuery); 197 198 /* Submit offer form */ 199 $("form[name='woocommerce-make-offer-form']").submit(function () 200 { 201 if (is_ready_to_submit() === false) { 202 return false; 203 } 204 $('.tab_custom_ofwc_offer_tab_alt_message_2').hide(); 205 var offerCheckMinValuesPassed = true; 206 207 if ($('#woocommerce-make-offer-form-price-each').autoNumerics('get') == '0') 208 { 209 $('#woocommerce-make-offer-form-price-each').autoNumerics('set', ''); 210 $('#woocommerce-make-offer-form-price-each').autoNumerics('update', 211 { 212 aForm: false, /* Controls if default values are formatted on page ready (load) */ 213 aSep: offers_for_woocommerce_js_params.ofw_public_js_thousand_separator, /* Thousand separator */ 214 aDec: offers_for_woocommerce_js_params.ofw_public_js_decimal_separator, /* Decimal separator */ 215 //pSign : 'p', /* Placement of the currency : p = left and s = right */ 216 vMin: '0.00', /* Enter the minimum value allowed */ 217 lZero: 'allow', /* Controls if leading zeros are allowed */ 218 wEmpty: 'sign', /* controls input display behavior. */ 219 mDec: offers_for_woocommerce_js_params.ofw_public_js_number_of_decimals, /* enter the number of decimal places - this will over ides values set by vMin & vMax */ 220 aSign: '', 221 } 222 ); 223 offerCheckMinValuesPassed = false; 224 } 225 226 if ($('#woocommerce-make-offer-form-quantity').autoNumerics('get') == '0') 227 { 228 $('#woocommerce-make-offer-form-quantity').autoNumerics('set', ''); 229 $('#woocommerce-make-offer-form-quantity').autoNumerics('update', 230 { 231 vMin: '0', 232 mDec: '0', 233 lZero: 'deny', 234 aForm: false, 235 aSep: offers_for_woocommerce_js_params.ofw_public_js_thousand_separator, 236 aDec: offers_for_woocommerce_js_params.ofw_public_js_decimal_separator, 237 } 238 ); 239 offerCheckMinValuesPassed = false; 240 } 241 242 if (offerCheckMinValuesPassed === false) 243 { 244 return false; 245 } 246 247 var parentOfferId = $("input[name='parent_offer_id']").val(); 248 var parentOfferUid = $("input[name='parent_offer_uid']").val(); 249 250 var offerProductId = ''; 251 var offerVariationId = ''; 252 var offerProductPrice = ''; 253 if (offers_for_woocommerce_js_params.is_woo_variations_table_installed === '1') { 254 offerVariationId = $("input[name='offer_variations_table_variation_id']").val(); 255 } 256 if ($('input[name="variation_id"]').val() && $('input[name="variation_id"]').val() !== 0) { 257 offerVariationId = $('input[name="variation_id"]').val(); 258 } 259 260 /* old WC version condition start*/ 261 if ($("input[name='add-to-cart']").val() > 0) { 262 var offerProductId = $("input[name='add-to-cart']").val(); 263 } 264 /* old WC version condition end */ 265 266 /* New WC version condition start*/ 267 if ($("button[name='add-to-cart']").val() > 0) { 268 var offerProductId = $("button[name='add-to-cart']").val(); 269 } 270 /* New WC version condition end */ 271 272 /* Recognise product type and Product price : start */ 273 var productType = $("input[name='ofwc_hidden_price_type']").val(); 274 if (productType == 'variable') { 275 var variationPrice = $('.woocommerce-variation-
275price .amount').text().replace(/ /g, ''); 276 if (variationPrice === '') { 277 offerProductPrice = jQuery('.summary .price .woocommerce-Price-amount').text(); 278 } else { 279 offerProductPrice = variationPrice; 280 } 281 } else if (productType == 'simple') { 282 offerProductPrice = $('.summary .price .amount').text(); 283 } else if (productType == 'sale_product') { 284 offerProductPrice = $('.summary .price ins').text(); 285 } else if (productType == 'grouped') { 286 offerProductPrice = $('.summary .price .amount').text(); 287 } else if (productType == 'external') { 288 offerProductPrice = $('.summary .price .amount').text(); 289 } else { 290 offerProductPrice = ''; 291 } 292 293 /* End */ 294 295 var join_our_mailing_list = "no"; 296 297 if ($("#join_our_mailing_list").length > 0) { 298 if ($('#join_our_mailing_list').attr('checked')) { 299 join_our_mailing_list = "yes"; 300 } 301 } 302 303 var offerQuantity = $("input[name='offer_quantity']").autoNumerics('get'); 304 var offerPriceEach = $("input[name='offer_price_each']").autoNumerics('get'); 305 var offerTotal = $("input[name='offer_total']").val(); 306 var offerForm = $('#woocommerce-make-offer-form'); 307 308 if (offerProductId != '') 309 { 310 // disable submit button 311 $(offerForm).find(':submit').attr('disabled', 'disabled'); 312 313 // hide error divs 314 $('#tab_custom_ofwc_offer_tab_alt_message_2').hide(); 315 $('#tab_custom_ofwc_offer_tab_alt_message_custom').hide(); 316 317 // show loader image 318 $('#offer-submit-loader').show(); 319 320 // abort any pending request 321 if (request) { 322 request.abort(); 323 } 324 325 var post_data_array = $("#woocommerce-make-offer-form").serializeArray(); 326 post_data_array.push({name: 'offer_product_id', value: offerProductId}); 327 post_data_array.push({name: 'offer_product_price', value: offerProductPrice}); 328 post_data_array.push({name: 'offer_total', value: offerTotal}); 329 post_data_array.push({name: 'offer_variation_id', value: offerVariationId}); 330 post_data_array.push({name: 'parent_offer_id', value: parentOfferId}); 331 post_data_array.push({name: 'parent_offer_uid', value: parentOfferUid}); 332 post_data_array.push({name: 'offer_quantity', value: offerQuantity}); 333 post_data_array.push({name: 'offer_price_each', value: offerPriceEach}); 334 post_data_array.push({name: 'join_our_mailing_list', value: join_our_mailing_list}); 335 var product_addon_array_js = []; 336 jQuery("div.product-addon").each(function (key, index) { 337 var group_name = jQuery.trim(jQuery(this).find('h3.addon-name').text()); 338 var input_tag = jQuery(this).find(":input[name^='addon-']"); 339 340 input_tag.each(function () { 341 if (jQuery(this).is(':checkbox') || jQuery(this).is(':radio')) { 342 if (jQuery(this).is(':checked')) { 343 var label_text = jQuery(this).closest('label').text().substr(0, jQuery(this).closest('label').text().indexOf('(')); 344 product_addon_array_js.push({position: key, group: group_name, label: jQuery.trim(label_text), value: jQuery(this).val(), price: jQuery(this).attr('data-raw-price'), type: jQuery(this).attr('type')}); 345 } 346 } 347 if (jQuery(this).is('textarea')) { 348 if (jQuery(this).val() !== '') { 349 var label_text = jQuery(this).parent().find('label').text().substr(0, jQuery(this).parent().find('label').text().indexOf('(')); 350 product_addon_array_js.push({position: key, group: group_name, label: jQuery.trim(label_text), value: jQuery(this).val(), price: jQuery(this).attr('data-raw-price'), type: "custom_textarea"}); 351 } 352 } 353 if (jQuery(this).hasClass('input-text addon addon-custom-price')) { 354 if (jQuery(this).val() !== '') { 355 var label_text = jQuery(this).parent().find('label').text(); 356 product_addon_array_js.push({position: key, group: group_name, label: jQuery.trim(label_text), value: jQuery(this).val(), price: jQuery(this).attr('data-raw-price'), type: "custom_price"}); 357 } 358 } 359 if (jQuery(this).hasClass('input-text addon addon-input_multiplier')) { 360 if (jQuery(this).val() !== '') { 361 var label_text = jQuery(this).parent().find('label').text(); 362 product_addon_array_js.push({position: key, group: group_name, label: jQuery.trim(label_text), value: jQuery(this).val(), price: jQuery(this).attr('data-raw-price'), type: "input_multiplier"}); 363 } 364 } 365 if (jQuery(this).hasClass('addon addon-select')) { 366 if (jQuery(this).val() !== '') { 367 var label_text = jQuery(this).find(":selected").text().substr(0, jQuery(this).find(":selected").text().indexOf('(')); 368 product_addon_array_js.push({position: key, group: group_name, label: jQuery.trim(label_text), value: jQuery(this).val(), price: jQuery(this).find(":selected").attr('data-raw-price'), type: "select"}); 369 } 370 } 371 if (jQuery(this).hasClass('input-text addon addon-custom')) { 372 if (jQuery(this).val() !== '') { 373 var label_text = jQuery(this).parent().find('label').text(); 374 product_addon_array_js.push({position: key, group: group_name, label: jQuery.trim(label_text), value: jQuery(this).val(), price: jQuery(this).attr('data-raw-price'), type: "custom"}); 375 } 376 } 377 }); 378 379 }); 380 if (product_addon_array_js.length > 0) { 381 var updatedPrice = jQuery(".product-addon-totals .amount").last().text(); 382 if (updatedPrice !== '') { 383 offerProductPrice = updatedPrice; 384 } 385 post_data_array.push({name: 'offer_product_price', value: offerProductPrice}); 386 } 387 388 var data = { 389 'attributes': {} 390 }; 391 392 var form = $('form.cart'); 393 var field_pairs = form.serializeArray(); 394 395 for (var i = 0; i < field_pairs.length; i++) { 396 397 if (-1 !== field_pairs[ i ].name.indexOf('attribute_')) { 398 data.attributes[ field_pairs[ i ].name ] = field_pairs[ i ].value; 399 continue; 400 } 401 402 data[ field_pairs[ i ].name ] = field_pairs[ i ].value; 403 } 404 405 jQuery('.tmcp-field').each(function(){ 406 if (jQuery(this).is(':checkbox') || jQuery(this).is(':radio')) { 407 if (jQuery(this).is(':checked')) { 408 data[ this.name ] = this.value; 409 } 410 } else { 411 data[ this.name ] = this.value; 412 } 413 }); 414 415 post_data_array.push({product_data: data}); 416 post_data_array.push({product_addon_array: product_addon_array_js}); 417 var data_make_offer = { 418 action: 'new_offer_form_submit', 419 security: offers_for_woocommerce_js_params.offers_for_woocommerce_params_nonce, 420 value: post_data_array 421 }; 422 423 // fire off the request 424 var request = $.ajax({ 425 url: offers_for_woocommerce_js_params.ajax_url, 426 type: "post", 427 dataType: 'json', 428 data: data_make_offer 429 }); 430 431 // callback handler that will be called on success 432 request.done(function (response, textStatus, jqXHR) { 433 if (200 === request.status) { 434 var myObject = JSON.parse(request.responseText); 435 var responseStatus = myObject['statusmsg']; 436 var responseStatusDetail = myObject['statusmsgDetail']; 437 438 if (responseStatus == 'failed') { 439 //console.log('failed'); 440 // Hide loader image 441 $('#offer-submit-loader').hide(); 442 // Show error message DIV 443 $('#tab_custom_ofwc_offer_tab_alt_message_2').slideToggle('fast'); 444 $(offerForm).find(':submit').removeAttr('disabled', 'disabled'); 445 }
445 else if (responseStatus == 'failed-custom') { 446 //console.log('failed-custom-msg'); 447 // Hide loader image 448 $('#offer-submit-loader').hide(); 449 // Show error message DIV 450 $('#tab_custom_ofwc_offer_tab_alt_message_custom ul #alt-message-custom').html("<strong>Error: </strong>" + responseStatusDetail); 451 $('#tab_custom_ofwc_offer_tab_alt_message_custom').slideToggle('fast'); 452 $(offerForm).find(':submit').removeAttr('disabled', 'disabled'); 453 } else if (responseStatus == 'failed-spam') { 454 //console.log('failed-custom-msg'); 455 // Hide loader image 456 $('#offer-submit-loader').hide(); 457 // Show error message DIV 458 $('#tab_custom_ofwc_offer_tab_alt_message_custom ul #alt-message-custom').html("<strong>Error: </strong>" + responseStatusDetail); 459 $('#tab_custom_ofwc_offer_tab_alt_message_custom').slideToggle('fast'); 460 $(offerForm).find(':submit').removeAttr('disabled', 'disabled'); 461 $('#tab_custom_ofwc_offer_tab_inner fieldset').hide(); 462 } else if (responseStatus == 'accepted-offer') { 463 window.location = decodeURI(myObject['redirect']); 464 } else if (responseStatus == 'payment_authorization') { 465 window.location = decodeURI(myObject['redirect']); 466 } else { 467 // SUCCESS 468 // Hide loader image 469 $('#offer-submit-loader').hide(); 470 $(offerForm).find(':submit').removeAttr('disabled', 'disabled'); 471 $('#tab_custom_ofwc_offer_tab_inner fieldset').hide(); 472 $('#tab_custom_ofwc_offer_tab_alt_message_success').slideToggle('fast'); 473 if ($('#lightbox_custom_ofwc_offer_form').length) { 474 $('#aeofwc-popup-counter-box').show(); 475 var count = 5; 476 var counter = setInterval(function () { 477 if (count <= 0) { 478 clearInterval(counter); 479 $('#aeofwc-close-lightbox-link').trigger('click'); 480 } 481 $('#aeofwc-lightbox-message-counter').html(count); 482 count -= 1; 483 }, 500); 484 } 485 486 } 487 488 } else { 489 //console.log('error received'); 490 //alert('Timeout has likely occured, please refresh this page to reinstate your session'); 491 // Hide loader image 492 $('#offer-submit-loader').hide(); 493 $('#tab_custom_ofwc_offer_tab_alt_message_2').slideToggle('fast'); 494 $(offerForm).find(':submit').removeAttr('disabled', 'disabled'); 495 } 496 }); 497 498 // callback handler that will be called on failure 499 request.fail(function (jqXHR, textStatus, errorThrown) { 500 // log the error to the console 501 // Hide loader image 502 $('#offer-submit-loader').hide(); 503 $('#tab_custom_ofwc_offer_tab_alt_message_2').slideToggle('fast'); 504 }); 505 } else 506 { 507 // Hide loader image 508 $('#offer-submit-loader').hide(); 509 $('#tab_custom_ofwc_offer_tab_alt_message_2').slideToggle('fast'); 510 } 511 return false;
512 }); 513 }); 514 515 function angelleyeOpenMakeOfferForm(is_product_page) { 516 if (is_ready_to_submit() === false) { 517 return false; 518 } 519 if ($(".offers-for-woocommerce-make-offer-button-single-product").hasClass("offers-for-woocommerce-make-offer-button-single-product-lightbox")) 520 { 521 if ($("#lightbox_custom_ofwc_offer_form").hasClass('active')) 522 { 523 $("#lightbox_custom_ofwc_offer_form").hide(); 524 $("#lightbox_custom_ofwc_offer_form").removeClass('active'); 525 $("#lightbox_custom_ofwc_offer_form_close_btn").hide(); 526 } else 527 { 528 $("#lightbox_custom_ofwc_offer_form").addClass('active'); 529 $("#lightbox_custom_ofwc_offer_form").show(); 530 $("#lightbox_custom_ofwc_offer_form_close_btn").show(); 531 } 532 533 if ($("#woocommerce-make-offer-form-quantity").attr('type') == 'hidden') 534 { 535 $("#woocommerce-make-offer-form-price-each").focus(); 536 } else 537 { 538 $("#woocommerce-make-offer-form-quantity").focus(); 539 } 540 } else 541 { 542 if ($('.woocommerce-tabs .tabs li.tab_custom_ofwc_offer_tab').length > 0) { 543 $(".woocommerce-tabs .tabs li.tab_custom_ofwc_offer_tab a").click(); 544 } 545 546 $('.tab_custom_ofwc_offer_tab').click(); 547 548 var targetTab = $(".tab_custom_ofwc_offer_tab"); 549 if ($(".tab_custom_ofwc_offer_tab").length > 0) { 550 setTimeout(function () { 551 $('html, body').animate({ 552 scrollTop: $(".tab_custom_ofwc_offer_tab").offset().top - 150 553 }, 'fast'); 554 if ($("#woocommerce-make-offer-form-quantity").attr('type') == 'hidden') 555 { 556 $("#woocommerce-make-offer-form-price-each").focus(); 557 } else 558 { 559 $("#woocommerce-make-offer-form-quantity").focus(); 560 } 561 }, 300); 562 } 563 } 564 565 return false; 566 } 567 568 $(window).load(function () { 569 if ($(".offers-for-woocommerce-make-offer-button-single-product").hasClass("offers-for-woocommerce-make-offer-button-single-product-lightbox")) 570 { 571 $("#aeofwc-close-lightbox-link").css('display', 'block'); 572 } 573 var variantDisplay = $('.single_variation_wrap').css('display'); 574 if ($('body.woocommerce.single-product #content div.product .summary ').hasClass('product-type-variable') && variantDisplay != 'block' && offers_for_woocommerce_js_params.is_woo_variations_table_installed === '0') 575 { 576 if ($(".offers-for-woocommerce-make-offer-button-single-product").hasClass("offers-for-woocommerce-make-offer-button-single-product-lightbox")) 577 { 578 $("#lightbox_custom_ofwc_offer_form").hide(); 579 $("#lightbox_custom_ofwc_offer_form").removeClass('active'); 580 $("#lightbox_custom_ofwc_offer_form_close_btn").hide(); 581 } else 582 { 583 $('#tab_custom_ofwc_offer_tab_inner').hide(); 584 } 585 } 586 }); 587 588 // offer quantity input keyup 589 $('#woocommerce-make-offer-form-quantity').keyup(function () { 590 updateTotal(); 591 }); 592 593 // offer price each input keyup 594 $('#woocommerce-make-offer-form-price-each').keyup(function () { 595 updateTotal(); 596 }); 597 598 // Update totals 599 var updateTotal = function () { 600 var input1 = $('#woocommerce-make-offer-form-quantity').autoNumerics('get'); 601 var input2 = $('#woocommerce-make-offer-form-price-each').autoNumerics('get'); 602 if (isNaN(input1) || isNaN(input2)) { 603 $('#woocommerce-make-offer-form-total').val(''); 604 } else { 605 var theTotal = (input1 * input2); 606 var currencySymbol = $('#woocommerce-make-offer-form-total').attr('data-currency-symbol'); 607 if (!currencySymbol) { 608 currencySymbol = '$'; 609 } 610 611 $('#woocommerce-make-offer-form-total').autoNumerics('set', theTotal); 612 613 $('#woocommerce-make-offer-form-total').autoNumerics('update', 614 { 615 aForm: false, /* Controls if default values are formatted on page ready (load) */ 616 aSep: offers_for_woocommerce_js_params.ofw_public_js_thous
616and_separator, /* Thousand separator */ 617 aDec: offers_for_woocommerce_js_params.ofw_public_js_decimal_separator, /* Decimal separator */ 618 //pSign : 'p', /* Placement of the currency : p = left and s = right */ 619 lZero: 'allow', /* Controls if leading zeros are allowed */ 620 wEmpty: 'zero', /* controls input display behavior. */ 621 mDec: offers_for_woocommerce_js_params.ofw_public_js_number_of_decimals, /* enter the number of decimal places - this will over ides values set by vMin & vMax */ 622 } 623 ); 624 625 } 626 }; 627 }); 628}(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.