1/** 2 * This is main js file. Don't edit the file if you want to update module in future. 3 * 4 * @author Globo Software Solution JSC <[email protected]> 5 * @copyright 2015 GreenWeb Team 6 * @link http://www.globosoftware.net 7 * @license please read license in file license.txt 8 */ 9if (typeof $.uniform !== 'undefined') 10 if (typeof $.uniform.defaults !== 'undefined') { 11 if (typeof contact_fileDefaultHtml !== 'undefined') 12 $.uniform.defaults.fileDefaultHtml = contact_fileDefaultHtml; 13 if (typeof contact_fileButtonHtml !== 'undefined') 14 $.uniform.defaults.fileButtonHtml = contact_fileButtonHtml; 15 } 16var CaptchaCallback = function() { 17 if ($('.gformbuilderpro_form .g-recaptcha').length > 0) 18 $('.gformbuilderpro_form .g-recaptcha').each(function(index, el) { 19 if (!$(this).hasClass('added_grecaptcha')) { 20 if ($(this).data('sitekey') != '') { 21 grecaptcha.render(this, { 'sitekey': $(this).data('sitekey') }); 22 $(this).addClass('added_grecaptcha'); 23 } 24 } 25 }); 26}; 27 28function init_gmap() { 29 $('.google-maps').each(function() { 30 map_description = $(this).data('description'); 31 value = $(this).data('value'); 32 value_latlng = value.split(','); 33 name = $(this).data('name'); 34 label = $(this).data('label'); 35 var myOptions = { 36 zoom: 15, 37 center: new google.maps.LatLng(value_latlng[0], value_latlng[1]), 38 mapTypeId: google.maps.MapTypeId.ROADMAP 39 }; 40 map = new google.maps.Map(document.getElementById('google-maps-' + name), myOptions); 41 marker = new google.maps.Marker({ 42 map: map, 43 position: new google.maps.LatLng(value_latlng[0], value_latlng[1]) 44 }); 45 infowindow = new google.maps.InfoWindow({ 46 content: "<strong>" + label + "</strong><br/>" + map_description 47 }); 48 google.maps.event.addListener(marker, 'click', function() { 49 infowindow.open(map, marker); 50 }); 51 infowindow.open(map, marker); 52 google.maps.event.trigger(map, "resize"); 53 }); 54} 55 56function loadrecaptchav3(sitekey) { 57 grecaptcha.ready(function() { 58 grecaptcha.execute(sitekey, { action: 'gformbuilderpro' }).then(function(token) { 59 var recaptchaResponse = document.getElementById('recaptchaResponse'); 60 recaptchaResponse.value = token; 61 }); 62 }); 63} 64 65function getValuecheck(value_1) { 66 var val = ''; 67 if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('fileupload_box')) { 68 69 val = $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input').val(); 70 } else if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('select_box')) { 71 72 val = $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('select').val(); 73 } else if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('color_box')) { 74 val = $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input').val(); 75 } else if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('input_box') || 76 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('time_box') || 77 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('datepicker_box') || 78 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('slider_box') || 79 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('spinner_box')) { 80 81 val = $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input').val(); 82 } 83 if ( 84 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('checkbox_box') || 85 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('product_box') || 86 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('imagethumb_box') || 87 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('yesno_box') 88 ) { 89 if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input[type="checkbox"]').length > 0) { 90 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input[type="checkbox"]').each( 91 function() { 92 if ($(this).is(":checked")) { 93 val += $(this).val() + ','; 94 } 95 } 96 ); 97 val = val.slice(0, -1); 98 } 99 } 100 if ( 101 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('radio_box') || 102 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('colorchoose_box') || 103 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('survey_box') || 104 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('rating_box') || 105 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('product_box') || 106 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('imagethumb_box') 107 ) { 108 if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input[type="radio"]').length > 0) { 109 $('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').find('input[type="radio"]').each( 110 function() { 111 if ($(this).is(":checked")) { 112 val += $(this).val() + ','; 113 } 114 } 115 ); 116 val = val.slice(0, -1); 117 } 118 } 119 return val; 120} 121function ConnditionDisplay(gFormConditions) { 122 if (gFormConditions) { 123 gFormConditions = JSON.parse(gFormConditions); 124 $.each(gFormConditions, function(index, value) { 125 if (index > 1 && value['condition'] > 0 && value['condition_listoptions']) { 126 if (value['condition_must_match'] == '0') { 127 var condition_for = true; 128 } else { 129 var condition_for = false; 130 } 131 $.each(value['condition_listoptions'], function(index_1, value_1) { 132 if (value_1['id_field'] != '0') { 133 if ($('#gformbuilderpro_' + value_1['id_field']).length > 0) { 134 var value_check = getValuecheck(value_1); 135 var value_condition = value_1['conditionvalue']; 136 if ($('#gformbuilderpro_' + value_1['id_field'] + '> .form-group').hasClass('fileupload_box')) { 137 if (value_check != '') { 138 value_check = '1'; 139 } else { 140 value_check = '0'; 141 } 142 } 143 switch (value_1['condition']) { 144 case 'IS_EQUAL': 145 if (value_check == value_condition) { 146 if (value['condition_must_match'] == '1') { 147 condition_for = true; 148 return false; 149 } 150 } else { 151 if (value['condition_must_match'] == '0') { 152 condition_for = false; 153 return false; 154 } 155 } 156 break; 157 case 'ISNOT_EQUAL': 158 if (value_check != value_condition) { 159 if (value['condition_must_match'] == '1') { 160 condition_for = true; 161 return false; 162 } 163 } else { 164 if (value['condition_must_match'] == '0') { 165 condition_for = false; 166 return false; 167 } 168 } 169 break; 170 case 'IS_GREATER': 171 if ( parseInt(value_check) > parseInt(value_condition)) { 172 if (value['condition_must_match'] == '1') { 173 condition_for = true; 174 return false; 175 } 176 } else { 177 if (value['condition_must_match'] == '0') { 178 condition_for = false; 179 return false; 180 } 181 } 182 break; 183 case 'IS_LESS': 184 if (parseInt(value_check) < parseInt(value_condition)) { 185 if (value['condition_must_match']) { 186 condition_for = true; 187 return false; 188 } 189 } else { 190 if (value['condition_must_match'] == '0') { 191 condition_for = false; 192 return false; 193 } 194 } 195 break; 196 case 'STARTS': 197 if (value_check.startsWith(value_condition)) { 198 if (value['condition_must_match'] == '1') { 199 condition_for = true; 200 return false; 201 } 202 } else { 203 if (value['condition_must_match'] == '0') { 204 condition_for = false; 205 return false; 206 } 207 } 208 break; 209 case 'ENDS': 210 if (value_check.endsWith(value_condition)) { 211 if (value['condition_must_match'] == '1') { 212 condition_for = true; 213 return false; 214 } 215 } else { 216 if (value['condition_must_match'] == '0') { 217 condition_for = false; 218 return false; 219 } 220 } 221 break; 222 case 'IS_CONTAINS': 223 if (Array.isArray(value_check)){ 224 value_check = value_check.join(','); 225 } 226 if (value_check != null && value_check.indexOf(value_condition) >= 0 ) { 227 if (value['condition_must_match'] == '1') { 228 condition_for = true; 229 return false; 230 } 231 } else { 232 if (value['condition_must_match'] == '0') { 233 condition_for = false; 234 return false; 235 } 236 } 237 break; 238 case 'ISNOT_CONTAINS': 239 if (Array.isArray(value_check)){ 240 value_check = value_check.join(','); 241 } 242 if (value_check != null && value_check.indexOf(value_condition) < 0 ) { 243 if (value['condition_must_match'] == '1') { 244 condition_for = true; 245 return false; 246 } 247 } else { 248 if (value['condition_must_match'] == '0') { 249 condition_for = false; 250 return false; 251 } 252 } 253 break; 254 } 255 } 256 } 257 }); 258 if (value['condition_must_match'] == '1') { 259 if (value['condition_display'] == '1') { 260 if (condition_for) { 261 $('#gformbuilderpro_' + index).addClass('gformnone'); 262 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 263 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 264 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 265 $('#gformbuilderpro_' + index).find('select').removeAttr("required"); 266 $('#gformbuilderpro_' + index).find('input').removeAttr("required"); 267 } 268 } 269 } else { 270 $('#gformbuilderpro_' + index).removeClass('gformnone'); 271 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 272 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 273 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 274 $('#gformbuilderpro_' + index).find('select').attr("required", "required"); 275 $('#gformbuilderpro_' + index).find('input').attr("required", "required"); 276 } 277 } 278 } 279 } else { 280 if (condition_for) { 281 $('#gformbuilderpro_' + index).removeClass('gformnone'); 282 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 283 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 284 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 285 $('#gformbuilderpro_' + index).find('select').attr("required", "required"); 286 $('#gformbuilderpro_' + index).find('input').attr("required", "required"); 287 } 288 } 289 } else { 290 $('#gformbuilderpro_' + index).
290addClass('gformnone'); 291 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 292 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 293 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 294 $('#gformbuilderpro_' + index).find('select').removeAttr("required"); 295 $('#gformbuilderpro_' + index).find('input').removeAttr("required"); 296 } 297 } 298 } 299 } 300 } else { 301 if (value['condition_display'] == '1') { 302 if (condition_for) { 303 $('#gformbuilderpro_' + index).addClass('gformnone'); 304 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 305 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 306 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 307 $('#gformbuilderpro_' + index).find('select').removeAttr("required"); 308 $('#gformbuilderpro_' + index).find('input').removeAttr("required"); 309 } 310 } 311 } else { 312 $('#gformbuilderpro_' + index).removeClass('gformnone'); 313 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 314 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 315 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 316 $('#gformbuilderpro_' + index).find('select').attr("required", "required"); 317 $('#gformbuilderpro_' + index).find('input').attr("required", "required"); 318 } 319 } 320 } 321 } else { 322 if (condition_for) { 323 $('#gformbuilderpro_' + index).removeClass('gformnone'); 324 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 325 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 326 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 327 $('#gformbuilderpro_' + index).find('select').attr("required", "required"); 328 $('#gformbuilderpro_' + index).find('input').attr("required", "required"); 329 } 330 } 331 } else { 332 $('#gformbuilderpro_' + index).addClass('gformnone'); 333 if ($('#gformbuilderpro_' + index).find('.form-group').hasClass("input_box") 334 || $('#gformbuilderpro_' + index).find('.form-group').hasClass("select_box")) { 335 if ($('#gformbuilderpro_' + index).find('label').hasClass("required_label")) { 336 $('#gformbuilderpro_' + index).find('select').removeAttr("required"); 337 $('#gformbuilderpro_' + index).find('input').removeAttr("required"); 338 } 339 } 340 } 341 } 342 } 343 } 344 }); 345 } 346} 347function whosaleProductActive(el, number_qty ) { 348 if (el.closest('.gform_allcombin').find('.gform-combination-checkbox').length > 0) { 349 el.closest('.gform_allcombin').find('.gform-combination-checkbox').each(function(){ 350 if ($(this).is(':checked')) { 351 var qty = $(this).closest('tr').find('.variant-quantity').val(); 352 number_qty = parseInt(number_qty) + parseInt(qty); 353 } 354 }); 355 } 356 if (el.closest('.gform_card').find('.gform-discounts .gformdiscount-desc').length > 0) { 357 el.closest('.gform_card').find('.gform-discounts .gformdiscount-desc').each(function() { 358 $(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').removeClass('active'); 359 if (($(this).data('min') < number_qty && $(this).data('max') > number_qty) || ($(this).data('min') == number_qty)) { 360 $(this).addClass('active'); 361 return false; 362 } 363 }); 364 } 365} 366function getPriceWhosaleProduct (el) { 367 var formsubmit = el.closest('.gformbuilderpro_form').find('form'); 368 var id_fields = el.closest('.itemfield').attr("id").match(/gformbuilderpro_(\d*)/); 369 var id_field = id_fields[1]; 370 var formURL = formsubmit.attr("action"); 371 if (window.FormData !== undefined) { 372 var formData = new FormData(); 373 formData.append('getPriceWhosaleProduct', '1'); 374 formData.append('id_field', id_field); 375 if (el.closest('.itemfield').find('.gform_card').find('.gform_allcombin').length > 0) { 376 el.closest('.itemfield').find('.gform_card').find('.gform_allcombin').find('.gform-combination-checkbox').each(function() { 377 if ($(this).is(':checked')) { 378 var id_product = $(this).closest('.gform_card').find('.gform-checkbox').val(); 379 var name = $(this).attr('name'); 380 var value = $(this).val(); 381 var name_qty = $(this).closest('tr').find('.variant-quantity').attr('name'); 382 var value_qty = $(this).closest('tr').find('.variant-quantity').val(); 383 var name_discount = 'wholesaleboxProductDiscount['+id_product+'][value]'; 384 var value_discount = 0; 385 var name_discount_type = 'wholesaleboxProductDiscount['+id_product+'][type]'; 386 var value_discount_type = 0; 387 if ($(this).closest('.gform_card').find('.gformdiscount-desc.active').length > 0) { 388 value_discount = $(this).closest('.gform_card').find('.gformdiscount-desc.active').data('value'); 389 value_discount_type = $(this).closest('.gform_card').find('.gformdiscount-desc.active').data('type'); 390 } 391 formData.append(name, value); 392 formData.append(name_qty, value_qty); 393 formData.append(name_discount, value_discount); 394 formData.append(name_discount_type, value_discount_type); 395 } 396 }); 397 } 398 $.ajax({
399 url: formURL , 400 type: 'POST', 401 data: formData, 402 mimeType: "multipart/form-data", 403 contentType: false, 404 cache: false, 405 processData: false, 406 dataType: 'json', 407 success: function(data, textStatus, jqXHR) { 408 if (data.products) { 409 $.each(data.products,function (key,vals) { 410 if (vals) 411 $.each(vals,function (key_,val_) { 412 if ($('#wholesale-trbox-'+ key +'-'+key_).length > 0) { 413 if (val_.check_discount == 1) { 414 $('#wholesale-trbox-'+ key +'-'+key_).find('.gform_discount-price').text(val_.old_price); 415 } else { 416 $('#wholesale-trbox-'+ key +'-'+key_).find('.gform_discount-price').text(''); 417 } 418 $('#wholesale-trbox-'+ key +'-'+key_).find('.gform_total-price').text(val_.price); 419 } 420 }); 421 }); 422 if ($('#gformbuilderpro_'+ data.id_field).length > 0) { 423 $('#gformbuilderpro_'+ data.id_field).find('.gformwholesale-total').find('.gformwholesale-subtotalprice-label').text(data.totalprice); 424 } 425 } 426 }, 427 error: function(jqXHR, textStatus, errorThrown) { 428 429 } 430 }); 431 } 432} 433$(window).load(function() { 434 if ($('.gformbuilderpro_form .g-recaptcha').length > 0) { 435 var script = document.createElement("script"); 436 script.src = "https:/" + "/www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit"; 437 script.type = "text/javascript"; 438 document.getElementsByTagName("head")[0].appendChild(script); 439 } 440 if ($('#recaptchaResponse').length > 0) { 441 var sitekey = $('#recaptchaResponse').attr('data-sitekey'); 442 var script = document.createElement("script"); 443 script.src = "https:/" + "/www.google.com/recaptcha/api.js?render=" + sitekey; 444 script.type = "text/javascript"; 445 document.getElementsByTagName("head")[0].appendChild(script); 446 gv3interval = setInterval( 447 function() { 448 if (typeof grecaptcha === "undefined") {} else { 449 if ($('#recaptchaResponse').val() == '') { 450 loadrecaptchav3(sitekey); 451 clearInterval(gv3interval); 452 } 453 }; 454 }, 500); 455 } 456 457 458 if ($('.google-maps').length > 0) { 459 _gmap_key = ''; 460 $('.google-maps').each(function() { 461 gmap_key = $(this).data('gmap_key'); 462 if (gmap_key != '') { 463 _gmap_key = '&key=' + gmap_key; 464 return false; 465 } 466 }); 467 var script = document.createElement("script"); 468 script.src = "https:/" + "/maps.googleapis.com/maps/api/js?v=3.exp&callback=init_gmap" + _gmap_key; 469 script.type = "text/javascript"; 470 document.getElementsByTagName("head")[0].appendChild(script); 471 //google.maps.event.addDomListener(window, 'load', init_gmap); 472 } 473}); 474 475$(document).ready(function() { 476 if ($('.gformbuilderpro_form').length > 0) { 477 $('.gformbuilderpro_form').each(function() { 478 if ($(this).find('input[name="Conditions"]').length > 0) { 479 var gFormConditions = $(this).find('input[name="Conditions"]').val(); 480 ConnditionDisplay(gFormConditions); 481 } 482 if ($(this).find('button[name="submitForm"]').length == 0) { 483 var submitbutton = '<div class="formbuilder_group"><div class="formbuilder_column col-md-12 col-sm-12 col-xs-12"><div class="itemfield_wp"><div class="itemfield"><button type="submit" name="submitForm" id="submitForm" class="button btn btn-default button-medium"><span>Submit</span></button></div></div></div></div>'; 484 $(this).find('.gformbuilderpro_content').append(submitbutton); 485 } 486 }); 487 } 488 $('.gformbuilderpro_form .select_box select, .gformbuilderpro_form input').on('change', function() { 489 if ($(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').length > 0) { 490 var gFormConditions = $(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').val(); 491 ConnditionDisplay(gFormConditions); 492 } 493 });
494 $('.gformbuilderpro_form input[type=text]').on('change invalid', function() { 495 var textfield = $(this).get(0); 496 textfield.setCustomValidity(''); 497 if (!textfield.validity.valid) { 498 textfield.setCustomValidity($('#gformbuilderpro_formValidity').val()); 499 } 500 }); 501 if ($('.htmlinput').length > 0) { 502 tinymce.init({ selector: '.htmlinput' }); 503 } 504 if ($('.mColorPickerInput').length > 0) 505 $('.mColorPickerInput').each(function() { 506 $(this).minicolors({ 507 control: $(this).attr('data-control') || 'hue', 508 defaultValue: $(this).attr('data-defaultValue') || '', 509 format: $(this).attr('data-format') || 'hex', 510 keywords: $(this).attr('data-keywords') || '', 511 inline: $(this).attr('data-inline') === 'true', 512 letterCase: $(this).attr('data-letterCase') || 'lowercase', 513 opacity: $(this).attr('data-opacity'), 514 position: $(this).attr('data-position') || 'bottom left', 515 swatches: $(this).attr('data-swatches') ? $(this).attr('data-swatches').split('|') : [], 516 change: function(value, opacity) { 517 if (!value) return; 518 if (opacity) value += ', ' + opacity; 519 if (typeof console === 'object') { 520 //console.log(value); 521 } 522 }, 523 theme: 'bootstrap' 524 }); 525 526 }); 527 if ($(".datepicker").length > 0) { 528 $(".datepicker").datepicker({ 529 changeYear: true, 530 changeMonth: true, 531 }); 532 } 533 if ($(".time_input").length > 0) { 534 $(".time_input").each(function() { 535 rel = $(this).attr('name'); 536 time = $('.' + rel + '_hour').val() + ':' + $('.' + rel + '_minute').val(); 537 if ($('.' + rel + '_apm').length > 0) { 538 time = time + ' ' + $('.' + rel + '_apm').val(); 539 } 540 $(this).val(time); 541 }) 542 } 543 $('.time_select').change(function() { 544 rel = $(this).attr('rel'); 545 time = $('.' + rel + '_hour').val() + ':' + $('.' + rel + '_minute').val(); 546 if ($('.' + rel + '_apm').length > 0) { 547 time = time + ' ' + $('.' + rel + '_apm').val(); 548 } 549 $('input[name="' + rel + '"]').val(time); 550 }); 551 gformbuilderpro_overlay = '<div id="gformbuilderpro_overlay"><div class="container"><div class="content"><div class="circle"></div></div></div></div></div>'; 552 $('.grating').change(function() { 553 rateval = $(this).val(); 554 ratename = $(this).attr('name'); 555 for (i = 1; i <= 5; i++) { 556 if (i > rateval) { 557 $('.' + ratename + 'star' + i).removeClass('active'); 558 } else { 559 $('.' + ratename + 'star' + i).addClass('active'); 560 } 561 } 562 }); 563 $('.slider-range').each(function() { 564 $(this).slider({ 565 range: "min", 566 value: $('#' + $(this).data('id')).val(), 567 min: $('#' + $(this).data('id')).data('min'), 568 max: $('#' + $(this).data('id')).data('max'), 569 step: $('#' + $(this).data('id')).data('range'), 570 slide: function(event, ui) { 571 $('#' + $(this).data('id')).val(ui.value); 572 $('#' + $(this).data('id') + '-value').html(ui.value); 573 } 574 }); 575 }); 576 $('.slider-range-multi').each(function() { 577 valmin = $('#' + $(this).data('id')).data('valmin'); 578 valmax = $('#' + $(this).data('id')).data('valmax'); 579 $(this).slider({ 580 range: true, 581 values: [valmin, valmax], 582 min: $('#' + $(this).data('id')).data('min'), 583 max: $('#' + $(this).data('id')).data('max'), 584 step: $('#' + $(this).data('id')).data('range'), 585 slide: function(event, ui) { 586 $('#' + $(this).data('id')).val(ui.values[0] + '->' + ui.values[1]); 587 $('#' + $(this).data('id') + '-value').html(ui.values[0] + '->' + ui.values[1]); 588 } 589 }); 590 });
591 $('.spinner_plus').click(function() { 592 spinner_value = parseInt($('#' + $(this).data('id')).val()); 593 maxval = parseInt($('#' + $(this).data('id')).data('max')); 594 range = parseInt($('#' + $(this).data('id')).data('range')); 595 if (maxval > (spinner_value + range)) { 596 $('#' + $(this).data('id')).val(parseInt(spinner_value) + range); 597 } else { 598 $('#' + $(this).data('id')).val(parseInt(maxval)); 599 } 600 if ($(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').length > 0) { 601 var gFormConditions = $(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').val(); 602 ConnditionDisplay(gFormConditions); 603 } 604 }); 605 $('.spinner_sub').click(function() { 606 spinner_value = parseInt($('#' + $(this).data('id')).val()); 607 minval = parseInt($('#' + $(this).data('id')).data('min')); 608 range = parseInt($('#' + $(this).data('id')).data('range')); 609 if (minval < (spinner_value - range)) { 610 $('#' + $(this).data('id')).val(parseInt(spinner_value) - range); 611 } else { 612 $('#' + $(this).data('id')).val(parseInt(minval)); 613 } 614 if ($(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').length > 0) { 615 var gFormConditions = $(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').val(); 616 ConnditionDisplay(gFormConditions); 617 } 618 }); 619 /**/ 620 $('.wholesale_spinner_plus').click(function() { 621 var number_qty = 0; 622 spinner_value = parseInt($('#' + $(this).data('id')).val()); 623 maxval = parseInt($('#' + $(this).data('id')).data('max')); 624 range = parseInt($('#' + $(this).data('id')).data('range')); 625 if (maxval > (spinner_value + range)) { 626 $('#' + $(this).data('id')).val(parseInt(spinner_value) + range); 627 } else { 628 $('#' + $(this).data('id')).val(parseInt(maxval)); 629 } 630 $(this).closest('.gform_card').find('.gform-checkbox').prop('checked', true); 631 $(this).closest('tr').find('.gform-combination-checkbox').prop('checked', true); 632 whosaleProductActive($(this), number_qty); 633 getPriceWhosaleProduct($(this)); 634 }); 635 $('.wholesale_spinner_sub').click(function() { 636 var number_qty = 0; 637 spinner_value = parseInt($('#' + $(this).data('id')).val()); 638 minval = parseInt($('#' + $(this).data('id')).data('min')); 639 range = parseInt($('#' + $(this).data('id')).data('range')); 640 if (minval < (spinner_value - range)) { 641 $('#' + $(this).data('id')).val(parseInt(spinner_value) - range); 642 } else { 643 $('#' + $(this).data('id')).val(parseInt(minval)); 644 } 645 $(this).closest('.gform_card').find('.gform-checkbox').prop('checked', true); 646 $(this).closest('tr').find('.gform-combination-checkbox').prop('checked', true); 647 whosaleProductActive($(this), number_qty); 648 getPriceWhosaleProduct($(this)); 649 }); 650 $('.variant-quantity').change(function() { 651 var number_qty = 0; 652 $(this).closest('.gform_card').find('.gform-checkbox').prop('checked', true); 653 $(this).closest('.gform_card').find('.gform-combination-checkbox').prop('checked', true); 654 if ($(this).closest('.gform_card').find('.gform-combination-checkbox').length > 0) { 655 $(this).closest('.gform_card').find('.gform-combination-checkbox').each(function(){ 656 if ($(this).is(':checked')) { 657 var qty = $(this).closest('tr').find('.variant-quantity').val(); 658 number_qty = parseInt(number_qty) + parseInt(qty); 659 } 660 }); 661 } 662 if ($(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').length > 0) { 663 $(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').each(function() { 664 $(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').removeClass('active'); 665 if (($(this).data('min') < number_qty && $(this).data('max') > number_qty) || ($(this).data('min') == number_qty)) { 666 $(this).addClass('active'); 667 return false; 668 } 669 }); 670 } 671 getPriceWhosaleProduct($(this)); 672 673 });
674 $('.gform_card_header_left_default .gform-checkbox').change(function() { 675 var number_qty = 0; 676 if ($(this).is(':checked')) { 677 $(this).closest('.gform_card').find('.gform-combination-checkbox').prop('checked', true); 678 if ($(this).closest('.gform_card').find('.gform-combination-checkbox').length > 0) { 679 $(this).closest('.gform_card').find('.gform-combination-checkbox').each(function(){ 680 if ($(this).is(':checked')) { 681 var qty = $(this).closest('tr').find('.variant-quantity').val(); 682 number_qty = parseInt(number_qty) + parseInt(qty); 683 } 684 }); 685 } 686 if ($(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').length > 0) { 687 $(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').each(function() { 688 $(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').removeClass('active'); 689 if (($(this).data('min') < number_qty && $(this).data('max') > number_qty) || ($(this).data('min') == number_qty)) { 690 $(this).addClass('active'); 691 return false; 692 } 693 }); 694 } 695 } else { 696 $(this).closest('.gform_card').find('.gform-combination-checkbox').prop('checked', false); 697 $(this).closest('.gform_card').find('.gform-discounts .gformdiscount-desc').removeClass('active'); 698 } 699 700 getPriceWhosaleProduct($(this)); 701 }); 702 $('.gform-combination-checkbox').change(function() { 703 var number_qty = 0; 704 if ($(this).is(':checked')) { 705 $(this).closest('tr').find('.gform-combination-checkbox').prop('checked', true); 706 $(this).closest('.gform_card').find('.gform-checkbox').prop('checked', true); 707 whosaleProductActive($(this), number_qty); 708 } else { 709 var check_all_combin = false; 710 if ($(this).closest('.gform_allcombin').find('.gform-combination-checkbox').length > 0) { 711 $(this).closest('.gform_allcombin').find('.gform-combination-checkbox').each(function(){ 712 if ($(this).is(':checked')) { 713 check_all_combin = true; 714 return false; 715 } 716 }); 717 } 718 if (check_all_combin == false) { 719 $(this).closest('.gform_card').find('.gform-checkbox').prop('checked', false); 720 } 721 whosaleProductActive($(this), number_qty); 722 } 723 getPriceWhosaleProduct($(this)); 724 725 }); 726 /**/ 727 $('.onoffswitch-checkbox').change(function() { 728 if ($(this).is(':checked')) { 729 $(this).parents('.onoffswitch').find('.onoffswitch-label').addClass('onoffswitch-active'); 730 } else { 731 $(this).parents('.onoffswitch').find('.onoffswitch-label').removeClass('onoffswitch-active'); 732 } 733 if ($(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').length > 0) { 734 var gFormConditions = $(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').val(); 735 ConnditionDisplay(gFormConditions); 736 } 737 }); 738 $('.onoffswitch-checkbox').each(function() { 739 if ($(this).is(':checked')) { 740 $(this).parents('.onoffswitch').find('.onoffswitch-label').addClass('onoffswitch-active'); 741 } else { 742 $(this).parents('.onoffswitch').find('.onoffswitch-label').removeClass('onoffswitch-active'); 743 } 744 if ($(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').length > 0) { 745 var gFormConditions = $(this).closest('.gformbuilderpro_form').find('input[name="Conditions"]').val(); 746 ConnditionDisplay(gFormConditions); 747 } 748 }); 749 750 function getDoc(frame) { 751 var doc = null; 752 try { 753 if (frame.contentWindow) { 754 doc = frame.contentWindow.document; 755 } 756 } catch (err) {} 757 if (doc) { 758 return doc; 759 } 760 try { 761 doc = frame.contentDocument ? frame.contentDocument : frame.document; 762 } catch (err) { 763 doc = frame.document; 764 } 765 return doc; 766 } 767 $(".gformbuilderpro_form form").submit(function(e) { 768 if (!$(this).hasClass('form_using_ajax')) {
769 var onoffswitchextra = ''; 770 $('.onoffswitch-checkbox').each(function() { 771 if ($(this).is(':checked')) {} else { 772 onoffswitchextra += '&' + $(this).attr('name') + '=' + $(this).data('value'); 773 } 774 }); 775 if ($('#product_page_product_id').length > 0 && $('.hidden_productatt').length > 0) { 776 if ($('#idCombination').length > 0) { 777 $('.hidden_productatt').val($('#product_page_product_id').val() + '-' + $('#idCombination').val()); 778 } else { 779 if ($('#add-to-cart-or-refresh').length > 0) { 780 var productUrl = window.location.href; 781 var formSerialized = $('#add-to-cart-or-refresh').serialize(); 782 $.ajax({ 783 url: productUrl, 784 type: 'POST', 785 async: false, 786 data: (formSerialized != '' ? formSerialized + '&ajax=1&action=refresh&quantity_wanted=1' : 'ajax=1&action=refresh&quantity_wanted=1') + onoffswitchextra, 787 dataType: 'json', 788 success: function(data, textStatus, jqXHR) { 789 var idCombination = data.id_product_attribute; 790 $('.hidden_productatt').val($('#product_page_product_id').val() + '-' + idCombination); 791 } 792 }); 793 } 794 } 795 } 796 } 797 }); 798 $(document).on('click','.gformbuilderpro_form form #submitForm',function (e) { 799 var fromSubmit = $(this).closest('form'); 800 var formURL = fromSubmit.attr("action"); 801 var numbercheck = 0; 802 var hidefields =''; 803 var urlajax_cart = baseUri + '?rand=' + new Date().getTime(); 804 805 fromSubmit.find('input[name="ConditionsHide"]').val(''); 806 if (fromSubmit.find('.itemfield').hasClass('gformnone')) { 807 fromSubmit.find('.itemfield.gformnone').each(function(){ 808 var ids = $(this).attr("id").match(/gformbuilderpro_(\d*)/) 809 hidefields += ids[1] + ','; 810 }); 811 if (fromSubmit.find('input[name="ConditionsHide"]').length > 0) { 812 fromSubmit.find('input[name="ConditionsHide"]').val(hidef
812ields); 813 } 814 } 815 if (fromSubmit.find('.wholesale_box').length > 0) { 816 var id_fields= fromSubmit.find('.wholesale_box').closest('.itemfield').attr("id").match(/gformbuilderpro_(\d*)/); 817 if (fromSubmit.find('.wholesale_box').find('.gform_card').find('.gform_allcombin').length > 0) { 818 fromSubmit.find('.wholesale_box').find('.gform_card').find('.gform_allcombin').find('.gform-combination-checkbox').each(function() { 819 if ($(this).is(':checked')) { 820 821 var qty = $(this).closest('tr').find('.variant-quantity').val(); 822 var id_product = $(this).closest('.gform_card').find('.gform-checkbox').val(); 823 var idCombination = $(this).val(); 824 var static_token = fromSubmit.find('.wholesale_box').data('token'); 825 var discounts_value= 0; 826 var discounts_type= 0; 827 var discounts_tax= 0; 828 829 if ($(this).closest('.gform_card').find('.gformdiscount-desc.active').length > 0) { 830 discounts_value = $(this).closest('.gform_card').find('.gformdiscount-desc.active').data('value'); 831 discounts_type = $(this).closest('.gform_card').find('.gformdiscount-desc.active').data('type'); 832 discounts_tax = $(this).closest('.gform_card').find('.gformdiscount-desc.active').data('tax'); 833 } 834 835 if (!numbercheck) { 836 if (window.FormData !== undefined) { 837 var formData = new FormData(); 838 formData.append('deleteCartModule', '1'); 839 $.ajax({
840 url: formURL , 841 type: 'POST', 842 data: formData, 843 mimeType: "multipart/form-data", 844 contentType: false, 845 cache: false, 846 processData: false, 847 dataType: 'json', 848 success: function(data, textStatus, jqXHR) { 849 if(data) { 850 if (fromSubmit.find('.wholesale_box').hasClass('ps17')) { 851 urlajax_cart = baseUri + 'cart'; 852 $.ajax({ 853 type: 'POST', 854 headers: { "cache-control": "no-cache" }, 855 url: urlajax_cart, 856 async: true, 857 cache: false, 858 dataType: "json", 859 data: 'action=update&update=1&ajax=true&qty=' + qty + '&id_product=' + id_product + '&ipa=' + idCombination + '&token=' + static_token +'&discounts_value='+discounts_value+'&discounts_type='+discounts_type+'&discounts_tax='+discounts_tax , 860 success: function(jsonData) { 861 }, 862 error: function(XMLHttpRequest, textStatus, errorThrown) { 863 alert(XMLHttpRequest.responseText); 864 }, 865 }); 866 } else { 867 $.ajax({
868 type: 'POST', 869 headers: { "cache-control": "no-cache" }, 870 url: urlajax_cart, 871 async: true, 872 cache: false, 873 dataType: "json", 874 data: 'controller=cart&add=1&ajax=true&qty=' + qty + '&id_product=' + id_product + '&ipa=' + idCombination + '&token=' + static_token +'&discounts_value='+discounts_value+'&discounts_type='+discounts_type+'&discounts_tax='+discounts_tax, 875 success: function(jsonData) { 876 }, 877 error: function(XMLHttpRequest, textStatus, errorThrown) { 878 alert(XMLHttpRequest.responseText); 879 }, 880 }); 881 } 882 } 883 } 884 }); 885 } 886 } else { 887 if (fromSubmit.find('.wholesale_box').hasClass('ps17')) { 888 urlajax_cart = baseUri + 'cart'; 889 $.ajax({
890 type: 'POST', 891 headers: { "cache-control": "no-cache" }, 892 url: urlajax_cart, 893 async: true, 894 cache: false, 895 dataType: "json", 896 data: 'action=update&update=1&ajax=true&qty=' + qty + '&id_product=' + id_product + '&ipa=' + idCombination + '&token=' + static_token +'&discounts_value='+discounts_value+'&discounts_type='+discounts_type+'&discounts_tax='+discounts_tax , 897 success: function(jsonData) { 898 }, 899 error: function(XMLHttpRequest, textStatus, errorThrown) { 900 alert(XMLHttpRequest.responseText); 901 }, 902 }); 903 } else { 904 $.ajax({
905 type: 'POST', 906 headers: { "cache-control": "no-cache" }, 907 url: urlajax_cart, 908 async: true, 909 cache: false, 910 dataType: "json", 911 data: 'controller=cart&add=1&ajax=true&qty=' + qty + '&id_product=' + id_product + '&ipa=' + idCombination + '&token=' + static_token +'&discounts_value='+discounts_value+'&discounts_type='+discounts_type+'&discounts_tax='+discounts_tax, 912 success: function(jsonData) { 913 }, 914 error: function(XMLHttpRequest, textStatus, errorThrown) { 915 alert(XMLHttpRequest.responseText); 916 }, 917 }); 918 } 919 } 920 fromSubmit.find('.wholesale_box').find('.wholesale_box_idcart').val('1'); 921 numbercheck++; 922 } 923 }); 924 } 925 } 926 fromSubmit.submit(); 927 }); 928 $(".gformbuilderpro_form form.form_using_ajax").submit(function(e) { 929 var onoffswitchextra = ''; 930 $('.onoffswitch-checkbox').each(function() { 931 if ($(this).is(':checked')) {} else { 932 onoffswitchextra += '&' + $(this).attr('name') + '=' + $(this).data('value'); 933 } 934 }); 935 936 if ($('#product_page_product_id').length > 0 && $('.hidden_productatt').length > 0) { 937 if ($('#idCombination').length > 0) 938 $('.hidden_productatt').val($('#product_page_product_id').val() + '-' + $('#idCombination').val()); 939 else { 940 if ($('#add-to-cart-or-refresh').length > 0) { 941 var productUrl = window.location.href; 942 var formSerialized = $('#add-to-cart-or-refresh').serialize(); 943 $.ajax({
944 url: productUrl, 945 type: 'POST', 946 async: false, 947 data: (formSerialized != '' ? formSerialized + '&ajax=1&action=refresh&quantity_wanted=1' : 'ajax=1&action=refresh&quantity_wanted=1'), 948 dataType: 'json', 949 success: function(data, textStatus, jqXHR) { 950 var idCombination = data.id_product_attribute; 951 $('.hidden_productatt').val($('#product_page_product_id').val() + '-' + idCombination); 952 } 953 }); 954 } 955 } 956 } 957 var formsubmit = $(this); 958 if (typeof tinymce != "undefined") { 959 tinymce.triggerSave(); 960 } 961 /* fix missing file upload in safari */ 962 if (formsubmit.find('input[type="file"]').length > 0) 963 formsubmit.find('input[type="file"]').each(function() { 964 var vidFileLength = $(this)[0].files.length; 965 if (vidFileLength === 0) { 966 $(this).attr('data-type', 'file').attr('data-bkname', $(this).attr('name')).removeAttr('name'); 967 } 968 }) 969 var formURL = formsubmit.attr("action"); 970 $(gformbuilderpro_overlay).appendTo(formsubmit); 971 if (window.FormData !== undefined) { 972 var formData = new FormData(this); 973 $.ajax({
974 url: formURL, 975 type: 'POST', 976 data: formData, 977 mimeType: "multipart/form-data", 978 contentType: false, 979 cache: false, 980 processData: false, 981 success: function(data, textStatus, jqXHR) { 982 if (formsubmit.find('input[data-type="file"]').length > 0) 983 formsubmit.find('input[data-type="file"]').each(function() { 984 if (typeof $(this).attr('data-bkname') !== typeof undefined && $(this).attr('data-bkname') !== false) 985 $(this).removeAttr('data-type').attr('name', $(this).attr('data-bkname')).removeAttr('data-bkname'); 986 }) 987 formsubmit.find('#gformbuilderpro_overlay').remove(); 988 var result = $.parseJSON(data); 989 if (formsubmit.find('.formajaxresult').length > 0) { 990 if (result.errors == '0') { 991 formsubmit[0].reset(); 992 formsubmit.find('.formajaxresult').html('<div class="success_box">' + result.thankyou + '</div>'); 993 } else 994 formsubmit.find('.formajaxresult').html(result.thankyou); 995 } else { 996 resulthtml = ''; 997 if (result.errors == '0') { 998 formsubmit[0].reset(); 999 resulthtml = '<div class="formajaxresult"><div class="success_box">' + result.thankyou + '</div><div>'; 1000 } else 1001 resulthtml = '<div class="formajaxresult">' + result.thankyou + '<div>'; 1002 $(resulthtml).insertBefore(formsubmit.find('.gformbuilderpro_content')); 1003 } 1004 $('html,body').animate({ 1005 scrollTop: formsubmit.find('.formajaxresult').offset().top 1006 }, 1007 'slow'); 1008 if (result.autoredirect == true) { 1009 setTimeout(function() { 1010 window.location.href = result.redirect_link; 1011 }, result.timedelay); 1012 } 1013 if ($('#recaptchaResponse').length > 0) { 1014 var sitekey = $('#recaptchaResponse').attr('data-sitekey'); 1015 loadrecaptchav3(sitekey); 1016 } else 1017 if (typeof grecaptcha != "undefined" && $('.gformbuilderpro_form .g-recaptcha').length > 0) { 1018 grecaptcha.reset(); 1019 } 1020 1021 }, 1022 error: function(jqXHR, textStatus, errorThrown) { 1023 if (formsubmit.find('input[data-type="file"]').length > 0) 1024 formsubmit.find('input[data-type="file"]').each(function() { 1025 if (typeof $(this).attr('data-bkname') !== typeof undefined && $(this).attr('data-bkname') !== false) 1026 $(this).removeAttr('data-type').attr('name', $(this).attr('data-bkname')).removeAttr('data-bkname'); 1027 }) 1028 if ($('#recaptchaResponse').length > 0) { 1029 var sitekey = $('#recaptchaResponse').attr('data-sitekey'); 1030 loadrecaptchav3(sitekey); 1031 } else 1032 if (typeof grecaptcha != "undefined" && $('.gformbuilderpro_form .g-recaptcha').length > 0) { 1033 grecaptcha.reset(); 1034 } 1035 var err = eval("(" + jqXHR.responseText + ")"); 1036 alert(err.Message); 1037 1038 } 1039 }); 1040 e.preventDefault(); 1041 //e.unbind(); 1042 } else { 1043 var iframeId = 'unique' + (new Date().getTime()); 1044 var iframe = $('<iframe src="javascript:false;" name="' + iframeId + '" />'); 1045 iframe.hide(); 1046 formsubmit.attr('target', iframeId); 1047 iframe.appendTo('body'); 1048 iframe.load(function(e) { 1049 $('#gformbuilderpro_overlay').remove(); 1050 var doc = getDoc(iframe[0]); 1051 var docRoot = doc.body ? doc.body : doc.documentElement; 1052 var data = docRoot.innerHTML; 1053 var result = $.parseJSON(data); 1054 if (formsubmit.find('.formajaxresult').length > 0) { 1055 if (result.errors == '0') { 1056 formsubmit[0].reset(); 1057 formsubmit.find('.formajaxresult').html('<div class="success_box">' + result.thankyou + '</div>'); 1058 } else 1059 formsubmit.find('.formajaxresult').html(result.thankyou); 1060 } else { 1061 resulthtml = ''; 1062 if (result.errors == '0') { 1063 formsubmit[0].reset(); 1064 resulthtml = '<div class="formajaxresult"><div class="success_box">' + result.thankyou + '</div><div>'; 1065 } else 1066 resulthtml = '<div class="formajaxresult">' + result.thankyou + '<div>'; 1067 $(resulthtml).insertBefore(formsubmit.find('.gformbuilderpro_content')); 1068 } 1069 1070 $('html,body').animate({ 1071 scrollTop: formsubmit.find('.formajaxresult').offset().top 1072 }, 1073 'slow'); 1074 1075 if ($('#recaptchaResponse').length > 0) { 1076 var sitekey = $('#recaptchaResponse').attr('data-sitekey'); 1077 loadrecaptchav3(sitekey); 1078 } else 1079 if (typeof grecaptcha != "undefined" && $('.gformbuilderpro_form .g-recaptcha').length > 0) { 1080 grecaptcha.reset(); 1081 } 1082 1083 }); 1084 } 1085 });
1086 $('.color_box .mColorPickerinput').on('click', function() { 1087 id = $(this).attr('id'); 1088 if ($('#icp_' + id).length > 0) { 1089 $('#icp_' + id).click(); 1090 } 1091 }); 1092 1093 1094 /* from version 1.2.0 */ 1095 $('.gformbuilderpro_openform').fancybox({ 1096 'beforeShow': function() { 1097 if ($('.formajaxresult').length > 0) 1098 $('.formajaxresult').html(''); 1099 }, 1100 afterLoad: function() { 1101 if (typeof tinymce != "undefined") { 1102 tinymce.remove(); 1103 setTimeout(function() { tinymce.init({ selector: '.htmlinput' }); }, 500); 1104 } 1105 } 1106 }); 1107 /*form version 1.3.6*/ 1108 1109 $('.wholesale_box .icon_click_opend').on('click', function() { 1110 $(this).toggleClass('icon-minus'); 1111 $(this).closest('.gform_card').find('.gform_card_body').toggleClass('gformnone'); 1112 }); 1113})
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.