1/** 2 * Define global variables so that the core plugin and 3rd party plugins can use them 3 * 4 */ 5 6// Paid Member Subscription submit buttons 7var pms_payment_buttons 8 9// Field wrappers 10var $pms_auto_renew_field 11 12// Checked Subscription 13var $pms_checked_subscription 14var $pms_checked_paygate 15 16// Unavailable gateways message 17var $pms_gateways_not_available 18 19// Text placeholder for the payment buttons while processing 20var pms_payment_button_loading_placeholder_text 21 22// Form object 23var $pms_form 24 25// WPPB Email Confirmation 26var is_pb_email_confirmation_on 27 28// Billing Fields 29var $pms_section_billing_details 30 31/** 32 * Core plugin 33 * 34 */ 35jQuery( function($) { 36 37 if( window.history.replaceState ) { 38 39 currentURL = window.location.href; 40 41 currentURL = pms_remove_query_arg( 'pmsscscd', currentURL ); 42 currentURL = pms_remove_query_arg( 'pmsscsmsg', currentURL ); 43 currentURL = pms_remove_query_arg( 'pms_gateway_payment_action', currentURL ); 44 currentURL = pms_remove_query_arg( 'pms_gateway_payment_id', currentURL ); 45 currentURL = pms_remove_query_arg( 'pms_wppb_custom_success_message', currentURL ); 46 47 if ( currentURL != window.location.href ) 48 window.history.replaceState( null, null, currentURL ); 49 } 50 51 52 /* 53 * Strips one query argument from a given URL string 54 * 55 */ 56 function pms_remove_query_arg( key, sourceURL ) { 57 58 var rtn = sourceURL.split("?")[0], 59 param, 60 params_arr = [], 61 queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; 62 63 if (queryString !== "") { 64 params_arr = queryString.split("&"); 65 for (var i = params_arr.length - 1; i >= 0; i -= 1) { 66 param = params_arr[i].split("=")[0]; 67 if (param === key) { 68 params_arr.splice(i, 1); 69 } 70 } 71 72 rtn = rtn + "?" + params_arr.join("&"); 73 74 } 75 76 if(rtn.split("?")[1] == "") { 77 rtn = rtn.split("?")[0]; 78 } 79 80 return rtn; 81 } 82 83 // Paid Member Subscriptions submit buttons 84 pms_payment_buttons = 'input[name=pms_register], ' 85 pms_payment_buttons += 'input[name=pms_new_subscription], ' 86 pms_payment_buttons += 'input[name=pms_change_subscription], ' 87 pms_payment_buttons += 'input[name=pms_upgrade_subscription], ' 88 pms_payment_buttons += 'input[name=pms_renew_subscription], ' 89 pms_payment_buttons += 'input[name=pms_confirm_retry_payment_subscription], ' 90 pms_payment_buttons += 'input[name=pms_update_payment_method], ' 91 pms_payment_buttons += '#pms-paypal-express-confirmation-form input[type="submit"], ' 92 93 // Profile Builder submit buttons 94 pms_payment_buttons += '.wppb-register-user input[name=register]' 95 96 // Subscription plans and payment gateway selectors 97 var subscription_plan_selector = 'input[name=subscription_plans]' 98 var paygate_selector = 'input.pms_pay_gate' 99 100 var settings_recurring = $('input[name="pms_default_recurring"]').val() 101 102 $pms_section_billing_details = $('.pms-section-billing-details') 103 is_pb_email_confirmation_on = $pms_section_billing_details.siblings('.pms-email-confirmation-payment-message').length > 0 ? true : false 104 105 // Field wrappers 106 $pms_auto_renew_field = jQuery( '.pms-subscription-plan-auto-renew' ) 107 108 // Checked Subscription 109 $pms_checked_subscription = jQuery( subscription_plan_selector + '[type=radio]' ).length > 0 ? jQuery( subscription_plan_selector + '[type=radio]:checked' ) : jQuery( subscription_plan_selector + '[type=hidden]' ) 110 $pms_checked_paygate = jQuery( paygate_selector + '[type=radio]' ).length > 0 ? jQuery( paygate_selector + '[type=radio]:checked' ) : jQuery( paygate_selector + '[type=hidden]' ) 111 112 // Unavailable gateways message 113 $pms_gateways_not_available = jQuery( '#pms-gateways-not-available' ) 114 115 pms_payment_button_loading_placeholder_text = $('#pms-submit-button-loading-placeholder-text').text() 116 117 /* 118 * Hide "automatically renew subscription" checkbox for manual payment gateway 119 * 120 */ 121 jQuery(document).ready( function() { 122 123 /** 124 * Set checked payment gateway when clicking on a payment gateway radio 125 * 126 */ 127 $( document ).on( 'click', paygate_selector, function() { 128 129 if( $(this).is(':checked') ) 130 $pms_checked_paygate = $(this) 131 132 // Show / hide extra payment gateway fields 133 if( $pms_checked_paygate.data('type') == 'extra_fields' ){ 134 $('.pms-paygate-extra-fields').hide() 135 $('.pms-paygate-extra-fields-' + $pms_checked_paygate.val() ).show() 136 } else 137 $('.pms-paygate-extra-fields' ).hide() 138 139 // Show billing fields 140 handle_billing_fields_display() 141 142 }) 143 144 145 /** 146 * Handle auto-renew checkbox and payment gateways display when clicking on a subscription plan 147 * 148 */ 149 $( document ).on( 'click', subscription_plan_selector + '[type=radio], ' + subscription_plan_selector + '[type="hidden"]', function() { 150 151 if( $(this).is(':checked') ) 152 $pms_checked_subscription = $(this) 153 154 if( typeof $pms_form == 'undefined' ) 155 $pms_form = $(this).closest('form') 156 157 handle_auto_renew_field_display() 158 handle_payment_gateways_display() 159 160 // Show billing fields 161 handle_billing_fields_display() 162 163 }) 164 165 /** Billing fields PWYW compatibility */ 166 $(document).on('change', '.pms_pwyw_pricing', handle_billing_fields_display ) 167 $(document).on('keyup', '.pms_pwyw_pricing', handle_billing_fields_display ) 168 169 /** 170 * Handle the auto renew checkbox field display in the page 171 * 172 */ 173 function handle_auto_renew_field_display() { 174 175 if ( $pms_checked_subscription.data('recurring') == 1 && $pms_checked_paygate.data('recurring') != 'undefined' ) 176 $pms_auto_renew_field.show() 177 else 178 $pms_auto_renew_field.hide() 179 180 181 if ($pms_checked_subscription.data('recurring') == 0) { 182 183 if (settings_recurring == 1) 184 $pms_auto_renew_field.show() 185 186 } 187 188 if ( ( $pms_checked_subscription.data('fixed_membership') == 'on' && $pms_checked_subscription.data('allow_renew') != 'on' ) || $pms_checked_subscription.data('recurring') == 2 || $pms_checked_subscription.data('recurring') == 3 ) { 189 $pms_auto_renew_field.hide() 190 } 191 192 if ( ( $pms_checked_subscription.data('fixed_membership') != 'on' && $pms_checked_subscription.data('duration') == 0 ) || ( $pms_checked_subscription.data('price') == 0 && !( $pms_checked_subscription.data('sign_up_fee') > 0 ) ) ) { 193 194 if ( typeof $pms_checked_subscription.data('discountedPrice') == 'undefined' ) 195 $pms_auto_renew_field.hide() 196 else if ( typeof $pms_checked_subscription.data('isFullDiscount') != 'undefined' && $pms_checked_subscription.data('isFullDiscount') == true && $pms_checked_subscription.data('discountRecurringPayments') == 1 ) 197 $pms_auto_renew_field.hide() 198 199 } 200 201 // show auto-renew checkbox for pro-rated plans that recur 202 if ( $pms_checked_subscription.data('recurring') != 'undefined' && $pms_checked_subscription.data('recurring') != 3 && $pms_checked_subscription.data('recurring') != 2 ) { 203 204 if ( $pms_checked_subscription.data('fixed_membership') != 'on' || ( $pms_checked_subscription.data('fixed_membership') == 'on' && $pms_checked_subscription.data('allow_renew') == 'on' ) ){ 205 206 if ( typeof $pms_checked_subscription.data('prorated_discount') != 'undefined' && $pms_checked_subscription.data('prorated_discount') > 0 ) 207 $pms_auto_renew_field.show() 208 209 } 210 211 } 212 213 } 214 215 216 /** 217 * Handle the payment gateways radio buttons field display in the page 218 * 219 */ 220 function handle_payment_gateways_display() { 221 222 // Before anything we display all gateways 223 $('#pms-paygates-wrapper').show() 224 $(paygate_selector).removeAttr('disabled') 225 $(paygate_selector).closest('label').show() 226 227
228 // Support for "trial" 229 if ( $.pms_plan_has_trial() ) { 230 $(paygate_selector + ':not([data-trial])').attr('disabled', true); 231 $(paygate_selector + ':not([data-trial])').closest('label').hide(); 232 233 } 234 235 236 // Support for "sign_up_fee" 237 if ( $.pms_plan_has_signup_fee() ) { 238 239 $(paygate_selector + ':not([data-sign_up_fee])').attr('disabled', true); 240 $(paygate_selector + ':not([data-sign_up_fee])').closest('label').hide(); 241 242 } 243 244 245 // Support for "recurring" 246 if ($pms_checked_subscription.data('recurring') == 2) { 247 248 $(paygate_selector + ':not([data-recurring])').attr('disabled', true); 249 $(paygate_selector + ':not([data-recurring])').closest('label').hide(); 250 251 252 } else if ($pms_checked_subscription.data('recurring') == 1) { 253 254 if ($pms_auto_renew_field.find('input[type=checkbox]').is(':checked')) { 255 $(paygate_selector + ':not([data-recurring])').attr('disabled', true); 256 $(paygate_selector + ':not([data-recurring])').closest('label').hide(); 257 } 258 259 } else if (!$pms_checked_subscription.data('recurring')) { 260 261 if (settings_recurring == 1) { 262 if ($pms_auto_renew_field.find('input[type=checkbox]').is(':checked')) { 263 $(paygate_selector + ':not([data-recurring])').attr('disabled', true); 264 $(paygate_selector + ':not([data-recurring])').closest('label').hide(); 265 } 266 } else if (settings_recurring == 2) { 267 268 $(paygate_selector + ':not([data-recurring])').attr('disabled', true); 269 $(paygate_selector + ':not([data-recurring])').closest('label').hide(); 270 271 } 272 273 } 274 275 276 // Select the first first available payment gateway by default after hiding the gateways 277 if ($(paygate_selector + ':not([disabled]):checked').length == 0) 278 $(paygate_selector + ':not([disabled])').first().trigger('click'); 279 280 281 282 if ($(paygate_selector).length > 0) { 283 284 /** 285 * Handle case where no payment gateways are available 286 * 287 */ 288 if ($(paygate_selector + ':not([disabled])').length == 0) { 289 290 // Display the "no payment gateways are available" message 291 $pms_gateways_not_available.show(); 292 293 // Hide credit card fields 294 $('.pms-paygate-extra-fields' ).hide() 295 296 // Disable submit button 297 if ($pms_checked_subscription.data('price') != 0) { 298 299 if ($pms_checked_subscription.length != 0) 300 $(pms_payment_buttons).attr('disabled', true).addClass('pms-submit-disabled'); 301 302 } 303 304 /** 305 * Handle case where payment gateways are available for selection 306 * 307 */ 308 } else { 309 310 // Hide the "no payment gateways are available" message 311 $pms_gateways_not_available.hide(); 312 313 // Show credit card fields if the selected payment gateway supports credit cards 314 if ( $(paygate_selector + ':not([disabled]):checked[data-type="extra_fields"]').length > 0 ) { 315 $('.pms-paygate-extra-fields').hide() 316 $('.pms-paygate-extra-fields-' + $(paygate_selector + ':not([disabled]):checked[data-type="extra_fields"]').val() ).show() 317 } 318 319 // Enable submit button 320 if ($pms_checked_subscription.length != 0) 321 $(pms_payment_buttons).attr('disabled', false).removeClass('pms-submit-disabled'); 322 323 } 324 325 } 326 327 328 // Hide credit card fields if it's a free plan 329 if ( $pms_checked_subscription.data('price') == 0 && !$.pms_plan_has_signup_fee() ) { 330 331 if ( $.pms_plan_is_prorated() ){ 332 333 if ( $.pms_checkout_is_recurring() ){ 334 335 if( typeof $pms_form != 'undefined' ) 336 $.pms_show_payment_fields( $pms_form ) 337 338 return 339 } 340 341 } 342 343 $('#pms-paygates-wrapper').hide() 344 $(paygate_selector).attr('disabled', true) 345 $(paygate_selector).closest('label').hide() 346 347 $('.pms-paygate-extra-fields').hide() 348 $('.pms-billing-details').hide() 349 350 } 351 352 } 353 354 /** 355 * Handle the display of recurring period information for subscription plans 356 * e.g. pro-rate scenario with free time for a subscription that needs to recur 357 * 358 */ 359 function handle_plan_recurring_duration_display() { 360 361 if ( !( $( '#pms-change-subscription-form' ).length > 0 ) ) 362 return 363 364 $( 'input[name="subscription_plans"]' ).each( function( index, plan ){ 365 366 // don't do anything for plans that do not recur or if they don't have a prorated discount 367 if ( $(plan).data('recurring') == 3 || ( typeof $(plan).data('prorated_discount') == 'undefined' || $(plan).data('prorated_discount') == 0 ) ) 368 return 369
370 // show recurring data for plans that always recur 371 if ( ( $(plan).data('recurring') == 2 || settings_recurring == 2 || $('input[name="pms_recurring"]', $pms_auto_renew_field).prop('checked') ) && $( '.pms-subscription-plan-price__recurring', $(plan).parent() ) ) 372 $( '.pms-subscription-plan-price__recurring', $(plan).parent() ).show() 373 else 374 $( '.pms-subscription-plan-price__recurring', $(plan).parent() ).hide() 375 376 }) 377 378 } 379 380 /** 381 * Show billing fields if necessary 382 */ 383 function handle_billing_fields_display(){ 384 385 if( !( $pms_section_billing_details.length > 0 ) ) 386 return 387 388 if ( $pms_checked_subscription.length > 0 && !is_pb_email_confirmation_on && ( $pms_checked_subscription.data('price') != 0 || $.pms_plan_has_signup_fee( $pms_checked_subscription ) ) ) 389 $('.pms-billing-details').attr('style', 'display: flex;'); 390 391 } 392 393 394 /** 395 * Disable the form submit button when the form is submitted 396 * 397 */ 398 jQuery(document).on( 'submit', '.pms-form', disable_form_submit_button ) 399 400 if( jQuery( '.wppb-register-user' ).length > 0 && jQuery( '.wppb-register-user .wppb-subscription-plans' ).length > 0 ) 401 jQuery(document).on('submit', '.wppb-register-user', disable_form_submit_button) 402 403 window.disable_form_submit_button = disable_form_submit_button; 404 function disable_form_submit_button( e ){ 405 406 if (jQuery(e.target).is('form')) { 407 var form = jQuery(e.target) 408 } else { 409 var form = jQuery(e) 410 } 411 412 var target_button = jQuery( 'input[type="submit"], button[type="submit"]', form ).not('#pms-apply-discount').not('input[name="pms_redirect_back"]')[0] 413 414 if ( $(target_button).hasClass('pms-submit-disabled') ) 415 return false 416 417 $(target_button).data('original-value', $(target_button).val()) 418 419 // Replace the button text with the placeholder 420 if (pms_payment_button_loading_placeholder_text.length > 0) { 421 422 $(target_button).addClass('pms-submit-disabled').val(pms_payment_button_loading_placeholder_text) 423 424 if ($(target_button).is('button')) 425 $(target_button).text(pms_payment_button_loading_placeholder_text) 426 427 } 428 429 } 430 431 432 /** 433 * Trigger a click on the checked subscription plan when checking / unchecking the 434 * auto-renew checkbox as this also takes into account whether the auto-renew field 435 * is checked, thus hiding the unneeded payment gateways 436 * 437 */ 438 $pms_auto_renew_field.click( function() { 439 440 handle_auto_renew_field_display() 441 handle_payment_gateways_display() 442 handle_plan_recurring_duration_display() 443 444 }); 445 446 447 /** 448 * Trigger a click on the selected subscription plan so that 449 * the rest of the checkout interfacte changes 450 * 451 */ 452 handle_auto_renew_field_display() 453 handle_payment_gateways_display() 454 handle_plan_recurring_duration_display() 455 handle_billing_fields_display() 456 457 /** 458 * Show the paygates inner wrapper 459 * 460 */ 461 $( '#pms-paygates-inner' ).css( 'visibility', 'visible' ); 462 463 /** 464 * Compatibility when the form is placed inside an Elementor Popup 465 */ 466 jQuery(document).on('elementor/popup/show', function () { 467 468 if ($('.pms-form', $('.elementor-popup-modal')).length > 0) { 469 handle_auto_renew_field_display() 470 handle_payment_gateways_display() 471 handle_plan_recurring_duration_display() 472 handle_billing_fields_display() 473 474 $('#pms-paygates-inner').css('visibility', 'visible'); 475 } 476 477 }) 478 479 /** 480 * WPPB Conditional Logic compatibility 481 */ 482 if ( $('.wppb-register-user').length != 0 && $('.wppb-subscription-plans').length != 0 ) { 483 484 // if there are 2 or more plans in the form, since they use the same meta name, only the LAST field from the 485 // PB Form Fields interface will have a default values selected, but we have no idea which field is displayed 486 // so we need to make sure the visible one has it's default plan selected 487 pmsHandleDefaultWPPBFormSelectedPlanOnLoad() 488 pmsHandleGatewaysDisplayRemove() 489 490 $(document).on( "wppbRemoveRequiredAttributeEvent", pmsHandleGatewaysDisplayRemove ) 491 $(document).on( "wppbAddRequiredAttributeEvent", pmsHandleGatewaysDisplayShow ) 492 493 function pmsHandleGatewaysDisplayRemove( event = '' ) { 494 495 if( $( '#pms-paygates-wrapper' ).is( ':hidden' ) ) 496 return 497 498 if( event != '' ){ 499 var element = event.target 500 501 if ( typeof $(element).attr('conditional-name') == 'undefined' || $(element).attr('conditional-name') != 'subscription_plans' ) 502 return 503 } 504 505 var visible_plans = false 506 507 $('.wppb-subscription-plans').each( function( index, item ){ 508 509 if( $( item ).is( ':visible' ) ){ 510 511 var only_free_plans = true 512 513 $( '.pms-subscription-plan input[name="subscription_plans"]', $( item ) ).each( function( index, item ){ 514 515 if( $( item ).data('price') && $( item ).data('price') > 0 ){ 516 only_free_plans = false 517 return false 518 } 519 520 }) 521 522 if( only_free_plans ) 523 visible_plans = false 524 else 525 visible_plans = true 526 527 return false 528 } 529 530 }) 531 532 if( visible_plans === false ){ 533 534 $('#pms-paygates-wrapper').hide() 535 $( paygate_selector ).attr( 'disabled', true ) 536 $( paygate_selector ).closest( 'label' ).hide() 537 538 $('.pms-paygate-extra-fields').hide() 539 $('.pms-billing-details').hide() 540 541 $('.pms-price-breakdown__holder').hide() 542 543 $('input[type="submit"], button[type="submit"]', $(element).closest( '.pms-form, .wppb-register-user' ) ).show() 544 545 } else { 546 pmsHandleDefaultWPPBFormSelectedPlanOnLoad() 547 } 548 549 } 550 551 function pmsHandleGatewaysDisplayShow(event = '') { 552 553 if (event != '') { 554 var element = event.target 555 556 if (typeof $(element).attr('conditional-name') == 'undefined' || $(element).attr('conditional-name') != 'subscription_plans') 557 return 558 } 559 560 var visible_plans = false 561 562 $('.wppb-subscription-plans').each(function (index, item) { 563 564 if ($(item).is(':visible')) { 565 566 var only_free_plans = true 567 568 $('.pms-subscription-plan', $(item)).each(function (index, plan) { 569 570 if ($('input', $(plan)).data('price') && $('input', $(plan)).data('price') > 0) { 571 only_free_plans = false 572 return false 573 } 574 575 }) 576 577 if (only_free_plans) 578 visible_plans = false 579 else 580 visible_plans = true 581 582 return false 583 } 584 585 }) 586 587 if ( visible_plans === false ) { 588 589 $('#pms-paygates-wrapper').hide() 590 $(paygate_selector).attr('disabled', true) 591 $(paygate_selector).closest('label').hide() 592 593 $('.pms-paygate-extra-fields').hide() 594 $('.pms-billing-details').hide() 595 596 $('.pms-price-breakdown__holder').hide() 597 598 $('input[type="submit"], button[type="submit"]', $(element).closest( '.pms-form, .wppb-register-user' ) ).show() 599 600 } else { 601 602 $('#pms-paygates-wrapper').show() 603 $(paygate_selector).removeAttr('disabled') 604 $(paygate_selector).closest('label').show() 605 606 $('.pms-paygate-extra-fields').show() 607 $('.pms-billing-details').attr('style', 'display: flex;'); 608 609 $('.pms-price-breakdown__holder').show() 610 611 // If PayPal Connect is selected, show the PayPal Connect extra fields 612 if ( ( $( 'input[type=radio][name=pay_gate]:checked' ).val() == 'paypal_connect' || $('input[type=hidden][name=pay_gate]').val() == 'paypal_connect' ) && 613 ( !$( 'input[type=radio][name=pay_gate]:checked' ).is(':disabled') || !$('input[type=hidden][name=pay_gate]').is(':disabled') ) 614 ){ 615 $( '.pms-paygate-extra-fields-paypal_connect' ).show() 616 $( '.wppb-register-user .form-submit input[type="submit"], .wppb-register-user.form-submit button[type="submit"]' ).last().hide() 617 } 618 619 } 620 621 } 622 623 function pmsHandleDefaultWPPBFormSelectedPlanOnLoad() { 624 625 if( !( jQuery( '#wppb-register-user' ).length > 0 ) ) 626 return 627 628 // 2 or more plans in the form 629 if( !( jQuery( '.wppb-subscription-plans').length > 1 ) ) 630 return 631 632 jQuery('.wppb-subscription-plans' ).each( function(){ 633 634 if( jQuery( this ).is( ':visible' ) ){ 635 636 jQuery( this ).find("input[name=\'subscription_plans\']").each(function (index, item) { 637 638 if ( typeof jQuery(item).data("default-selected") != "undefined" && jQuery(item).data("default-selected") == true ) { 639 jQuery(item).prop("checked", "checked") 640 jQuery(item).trigger("click") 641 } 642 643 }) 644 645 return 646 } 647 648 }) 649 650 } 651 652 } 653 654 /** 655 * On the Change Subscription form change the button name based on which plans group the user clicks 656 */ 657 if( $('#pms-change-subscription-form').length > 0 ){ 658 659 if ( $pms_checked_subscription.closest('.pms-upgrade__group').hasClass('pms-upgrade__group--upgrade') ){ 660 661 $('#pms-change-subscription-form input[name="pms_change_subscription"]').val($('#pms-change-subscription-form input[name="pms_button_name_upgrade"]').val()) 662 $('#pms-change-subscription-form input[name="form_action"]').val($('#pms-change-subscription-form input[data-name="upgrade_subscription"]').val()) 663 664 } else if ( $pms_checked_subscription.closest('.pms-upgrade__group').hasClass('pms-upgrade__group--downgrade') ){ 665 666 $('#pms-change-subscription-form input[name="pms_change_subscription"]').val($('#pms-change-subscription-form input[name="pms_button_name_downgrade"]').val()) 667 $('#pms-change-subscription-form input[name="form_action"]').val($('#pms-change-subscription-form input[data-name="downgrade_subscription"]').val()) 668 669 } 670
671 $('#pms-change-subscription-form .pms-upgrade__group--upgrade .pms-subscription-plan input').on('click', function () { 672 673 $('#pms-change-subscription-form input[name="pms_change_subscription"]').val($('#pms-change-subscription-form input[name="pms_button_name_upgrade"]').val()) 674 $('#pms-change-subscription-form input[name="form_action"]').val($('#pms-change-subscription-form input[data-name="upgrade_subscription"]').val()) 675 676 }) 677 678 $('#pms-change-subscription-form .pms-upgrade__group--downgrade .pms-subscription-plan input').on('click', function () { 679 680 $('#pms-change-subscription-form input[name="pms_change_subscription"]').val($('#pms-change-subscription-form input[name="pms_button_name_downgrade"]').val()) 681 $('#pms-change-subscription-form input[name="form_action"]').val($('#pms-change-subscription-form input[data-name="downgrade_subscription"]').val()) 682 683 }) 684 685 $('#pms-change-subscription-form .pms-upgrade__group--change .pms-subscription-plan input').on('click', function () { 686 687 $('#pms-change-subscription-form input[name="pms_change_subscription"]').val($('#pms-change-subscription-form input[name="pms_button_name_change"]').val()) 688 $('#pms-change-subscription-form input[name="form_action"]').val('') 689 690 }) 691 692 } 693 694 }) 695 696 697 /* 698 * Add field error for a given element name 699 * 700 */ 701 $.pms_add_field_error = function( error, field_name ) { 702 703 if( error == '' || error == 'undefined' || field_name == '' || field_name == 'undefined' ) 704 return false; 705 706 $field = $('[name=' + field_name + ']'); 707 $field_wrapper = $field.closest('.pms-field'); 708 709 error = '<p>' + error + '</p>'; 710 711 if( $field_wrapper.find('.pms_field-errors-wrapper').length > 0 ) 712 $field_wrapper.find('.pms_field-errors-wrapper').html( error ); 713 else 714 $field_wrapper.append('<div class="pms_field-errors-wrapper pms-is-js">' + error + '</div>'); 715 716 } 717 718 $.pms_add_general_error = function( error ){ 719 if( error == '' || error == 'undefined' ) 720 return false 721 722 var target = $('.pms-form') 723 724 target.prepend( '<div class="pms_field-errors-wrapper pms-is-js"><p>' + error + '</p></div>' ) 725 } 726 727 $.pms_add_subscription_plans_error = function( error ){ 728 if( error == '' || error == 'undefined' ) 729 return false 730 731 $('<div class="pms_field-errors-wrapper pms-is-js"><p>' + error + '</p></div>').insertBefore( '#pms-paygates-wrapper' ) 732 } 733 734 $.pms_add_recaptcha_field_error = function( error, payment_button ){ 735 736 $field_wrapper = $( '#pms-recaptcha-register-wrapper', $(payment_button).closest('form') ) 737 738 error = '<p>' + error + '</p>' 739 740 if ( $field_wrapper.find('.pms_field-errors-wrapper').length > 0 ) 741 $field_wrapper.find('.pms_field-errors-wrapper').html(error) 742 else 743 $field_wrapper.append('<div class="pms_field-errors-wrapper pms-is-js">' + error + '</div>') 744 } 745 746 /** 747 * Check if a plan has trial enabled 748 */ 749 $.pms_plan_has_trial = function( element = null ) { 750 751 if( element == null ) 752 element = $pms_checked_subscription 753 754 if (typeof element.data('trial') == 'undefined' || element.data('trial') == '0' ) 755 return false 756 757 return true 758 759 } 760 761 /** 762 * Check if a plan has sign-up fee enabled 763 */ 764 $.pms_plan_has_signup_fee = function( element = null ) { 765 766 if( element == null ) 767 element = $pms_checked_subscription 768 769 if( typeof element.data('sign_up_fee') == 'undefined' || element.data('sign_up_fee') == '0' ) 770 return false 771 772 return true 773 774 } 775 776 /** 777 * Check if a plan is prorated 778 */ 779 $.pms_plan_is_prorated = function( element = null ) { 780 781 if ( !( $('#pms-change-subscription-form').length > 0 ) ) 782 return false 783 784 if( element == null ) 785 element = $pms_checked_subscription 786 787 if ( typeof element.data('prorated_discount') != 'undefined' && element.data('prorated_discount') > 0 ) 788 return true 789 790 return false 791 792 } 793 794 /** 795 * Checks if a given/selected plan plus the current form state create a recurring checkout 796 */ 797 $.pms_checkout_is_recurring = function( element = null ) { 798 799 if( element == null ) 800 element = $pms_checked_subscription 801 802 if ( ( settings_recurring == '2' || $('input[name="pms_recurring"]', $pms_auto_renew_field).prop('checked') || element.data('recurring') == 2 ) && element.data('recurring') != 3 ) 803 return true 804 805 return false 806 807 } 808 809 /** 810 * Function to hide payment fields 811 * 812 */ 813 $.pms_hide_payment_fields = function( form ) { 814 815 if( typeof form == 'undefined' ) 816 return 817 818 if ( typeof form.pms_paygates_wrapper == 'undefined' ) 819 form.pms_paygates_wrapper = form.find('#pms-paygates-wrapper').clone() 820 821 form.find('#pms-paygates-wrapper').replaceWith('<span id="pms-paygates-wrapper">') 822 823 form.find('.pms-paygate-extra-fields').hide() 824 825 // When hiding PayPal we need to restore the register button 826 if ( form.find('.pms-paygate-extra-fields-paypal_connect').length > 0 ){ 827 if ( typeof $pms_checked_paygate != 'undefined' && $pms_checked_paygate.val() == 'paypal_connect' ){
828 form.find( 'input[type="submit"], button[type="submit"]' ).show() 829 } 830 } 831 832 if ( typeof PMS_ChosenStrings !== 'undefined' && $.fn.chosen != undefined ) { 833 form.find('#pms_billing_country').chosen('destroy') 834 form.find('#pms_billing_state').chosen('destroy') 835 } 836 837 if ( typeof form.pms_billing_details == 'undefined' ) { 838 form.pms_billing_details = form.find('.pms-billing-details').clone() 839 } 840 841 form.find('.pms-billing-details').replaceWith('<span class="pms-billing-details">') 842 843 } 844 845 /** 846 * Function to show payment fields 847 * 848 */ 849 $.pms_show_payment_fields = function( form ) { 850 851 if( typeof form == 'undefined' ) 852 return 853 854 if ( typeof form.pms_paygates_wrapper != 'undefined' ) 855 form.find('#pms-paygates-wrapper').replaceWith( form.pms_paygates_wrapper ) 856 857 if ( typeof $pms_checked_paygate != 'undefined' && $pms_checked_paygate.data('type') == 'extra_fields' ) 858 form.find('.pms-paygate-extra-fields-' + $pms_checked_paygate.val() ).show() 859 860 // When showing PayPal we need to hide the register button 861 if ( form.find('.pms-paygate-extra-fields-paypal_connect').length > 0 ){ 862 if ( typeof $pms_checked_paygate != 'undefined' && $pms_checked_paygate.val() == 'paypal_connect' ){
863 form.find( 'input[type="submit"]:not([name="pms_redirect_back"]):not([id="pms-apply-discount"]), button[type="submit"]' ).hide() 864 } 865 } 866 867 if ( typeof form.pms_billing_details != 'undefined' ) { 868 869 form.find('.pms-billing-details').replaceWith(form.pms_billing_details) 870 871 if ( typeof PMS_ChosenStrings !== 'undefined' && $.fn.chosen != undefined ) { 872 873 form.find('#pms_billing_country').chosen(PMS_ChosenStrings) 874 875 if ( $('#pms_billing_state option').length > 0 ) 876 form.find('#pms_billing_state').chosen(PMS_ChosenStrings) 877 878 } 879 880 } 881 882 } 883 884 /** 885 * Checks if a given/selected plan plus the current form state create a checkout without a payment, we call it setup_intents similar to Stripe 886 */ 887 $.pms_checkout_is_setup_intents = function () { 888 889 let selected_plan = $(subscription_plan_selector + '[type=radio]').length > 0 ? $(subscription_plan_selector + '[type=radio]:checked') : $(subscription_plan_selector + '[type=hidden]') 890 891 if ( typeof selected_plan.data('trial') != 'undefined' && selected_plan.data('trial') == '1' && !$.pms_plan_has_signup_fee( selected_plan ) ) 892 return true 893 // If a 100% discount code is used, initial amount will be 0 894 else if ( $('input[name="discount_code"]').length > 0 && $('input[name="discount_code"]').val().length > 0 && typeof selected_plan.data('price') != 'undefined' && selected_plan.data('price') == '0' ) 895 return true 896 // Pro-rated subscriptions 897 else if ($.pms_plan_is_prorated(selected_plan) && typeof selected_plan.data('price') != 'undefined' && selected_plan.data('price') == '0') 898 return true 899 900 return false 901 902 } 903 904 /** 905 * Adds validation errors to the WPPB form 906 */ 907 $.pms_form_add_wppb_validation_errors = function ( errors, current_button ) { 908 909 let scroll = false 910 911 // errors is of the form: FIELD_ID => FIELD_ERROR 912 jQuery.each(errors, function (key, value) { 913 914 let field = jQuery('#wppb-form-element-' + key) 915 916 field.addClass('wppb-field-error') 917 field.append(value) 918 919 scroll = true 920 921 }) 922 923 if ( scroll ) 924 $.pms_form_scrollTo( '.wppb-register-user', current_button ) 925 926 } 927 928 /** 929 * Adds validation errors to the Stripe credit card information 930 */ 931 $.pms_stripe_add_credit_card_error = function (error) { 932 933 if (error == '' || error == 'undefined') 934 return false 935 936 $field_wrapper = $('.pms-paygate-extra-fields-stripe_connect'); 937 938 error = '<p>' + error + '</p>' 939 940 if ($field_wrapper.find('.pms_field-errors-wrapper').length > 0) 941 $field_wrapper.find('.pms_field-errors-wrapper').html(error) 942 else 943 $field_wrapper.append('<div class="pms_field-errors-wrapper pms-is-js">' + error + '</div>') 944 945 } 946 947 $.pms_form_add_validation_errors = function (errors, payment_button) { 948 949 var scrollLocation = ''; 950 951 $.each(errors, function (index, value) { 952 953 if (value.target == 'form_general') { 954 $.pms_add_general_error(value.message) 955 956 scrollLocation = '.pms-form' 957 } else if (value.target == 'subscription_plan' || value.target == 'subscription_plans' || value.target == 'payment_gateway') { 958 $.pms_add_subscription_plans_error(value.message) 959 960 if (scrollLocation == '') 961 scrollLocation = '.pms-field-subscriptions' 962 } else if (value.target == 'credit_card') { 963 $.pms_stripe_add_credit_card_error(value.message) 964 965 if (scrollLocation == '') 966 scrollLocation = '#pms-paygates-wrapper' 967 } else if (value.target == 'recaptcha-register') { 968 969 $.pms_add_recaptcha_field_error(value.message, payment_button) 970 971 } else { 972 $.pms_add_field_error(value.message, value.target) 973 974 if (scrollLocation == '' && value.target.indexOf('pms_billing') !== -1) 975 scrollLocation = '.pms-billing-details' 976 else 977 scrollLocation = '.pms-form' 978 } 979 980 }) 981 982 if ($(payment_button).attr('name') == 'pms_update_payment_method' && scrollLocation == '#pms-paygates-wrapper') 983 scrollLocation = '#pms-stripe-connect'; 984 985 $.pms_form_scrollTo(scrollLocation, payment_button) 986 987 } 988 989 $.pms_form_reset_submit_button = function(target) { 990 991 if (!target.data || !target.data('original-value') || typeof target.data('original-value') == undefined) { 992 value = target.val() 993 } else { 994 value = target.data('original-value') 995 } 996 997 setTimeout(function () { 998 target.attr('disabled', false).removeClass('pms-submit-disabled').val(value).blur() 999 1000 if ($(target).is('button')) 1001 $(target).text(value) 1002 1003 }, 1) 1004 1005 } 1006 1007 $.pms_form_scrollTo = function( scrollLocation, payment_button ) { 1008 1009 var form = $( scrollLocation )[0] 1010 1011 if (typeof form == 'undefined') { 1012 $.pms_form_reset_submit_button( payment_button ) 1013 return 1014 } 1015 1016 var coord = form.getBoundingClientRect().top + window.scrollY 1017 var offset = -170 1018 1019 window.scrollTo({ 1020 top: coord + offset, 1021 behavior: 'smooth' 1022 }) 1023 1024 $.pms_form_reset_submit_button( payment_button ) 1025 1026 } 1027 1028 $.pms_form_remove_errors = function() { 1029 1030 $('.pms_field-errors-wrapper').remove() 1031 1032 if ($('.pms-stripe-error-message').length > 0) 1033 $('.pms-stripe-error-message').remove() 1034 1035 if ($('.wppb-register-user').length > 0) { 1036 1037 $('.wppb-form-error').remove() 1038 1039 $('.wppb-register-user .wppb-form-field').each(function () { 1040 1041 $(this).removeClass('wppb-field-error') 1042 1043 }) 1044 1045 } 1046 1047 } 1048 1049 $.pms_form_get_data = function( current_button, verify_captcha = false ) { 1050 1051 if (!current_button) 1052 return false 1053 1054 var form = $(current_button).closest('form') 1055 1056 // grab all data from the form 1057 var data = form.serializeArray().reduce(function (obj, item) { 1058 obj[item.name] = item.value 1059 return obj 1060 }, {}) 1061 1062 // setup our custom AJAX action and add the current page URL 1063 data.action = 'pms_process_checkout' 1064 data.current_page = window.location.href 1065 data.pms_nonce = $('#pms-process-checkout-nonce').val() 1066 data.form_type = $('.wppb-register-user .wppb-subscription-plans').length > 0 ? 'wppb' : $('.pms-ec-register-form').length > 0 ? 'pms_email_confirmation' : 'pms' 1067 1068 /** 1069 * Add the name of the submit button as a key to the request data 1070 * this is necessary for logged in actions like change, retry or renew subscription 1071 */ 1072 data[current_button.attr('name')] = true 1073 1074 /** 1075 * Add the form_action field from the form necessary for Change Subscription form requests 1076 */ 1077 if ($('input[name="form_action"]', form) && $('input[name="form_action"]', form).length > 0) 1078 data.form_action = $('input[name="form_action"]', form).val() 1079 1080 // add WPPB fields metadata to request if necessary 1081 if (data.form_type == 'wppb') { 1082 data.wppb_fields = $.pms_form_get_wppb_fields(current_button) 1083 } 1084 1085 // if user is logged in, set form type to current form 1086 if ($('body').hasClass('logged-in')) 1087 data.form_type = $('input[type="submit"], button[type="submit"]', form).not('#pms-apply-discount').not('input[name="pms_redirect_back"]').attr('name') 1088 1089 // This will be used to determine if the checkout involves a payment or not in case of a trial subscription 1090 if ($.pms_checkout_is_setup_intents()) 1091 data.setup_intent = true 1092 1093 if (data.pms_current_subscription) 1094 data.subscription_id = data.pms_current_subscription 1095 1096 // Recaptcha Compatibility
1097 // If reCaptcha field was not validated, don't send data to the server 1098 if (verify_captcha && typeof data['g-recaptcha-response'] != 'undefined' && data['g-recaptcha-response'] == '') { 1099 1100 if ( data.form_type == 'wppb' ) 1101 $.pms_form_add_wppb_validation_errors({ recaptcha: { field: 'recaptcha', error: '<span class="wppb-form-error">This field is required</span>' } }, current_button) 1102 else 1103 $.pms_add_recaptcha_field_error( 'Please complete the reCaptcha.', current_button ) 1104 1105 $.pms_form_reset_submit_button(current_button) 1106 1107 return false 1108 1109 } 1110 1111 return data 1112 1113 } 1114 1115 $.pms_form_get_wppb_fields = function( current_button ) { 1116 1117 var fields = {} 1118 1119 // Taken from Multi Step Forms 1120 jQuery('li.wppb-form-field', jQuery(current_button).closest('form')).each(function () { 1121 1122 if (jQuery(this).attr('class').indexOf('heading') == -1 && jQuery(this).attr('class').indexOf('wppb_billing') == -1 1123 && jQuery(this).attr('class').indexOf('wppb_shipping') == -1 && jQuery(this).attr('class').indexOf('wppb-shipping') == -1) { 1124 1125 var meta_name; 1126 1127 if (jQuery(this).hasClass('wppb-repeater') || jQuery(this).parent().attr('data-wppb-rpf-set') == 'template' || jQuery(this).hasClass('wppb-recaptcha')) { 1128 return true; 1129 } 1130 1131 if (jQuery(this).hasClass('wppb-send-credentials-checkbox')) 1132 return true; 1133 1134 /* exclude conditional required fields */ 1135 if (jQuery(this).find('[conditional-value]').length !== 0) { 1136 return true; 1137 } 1138 1139 fields[jQuery(this).attr('id')] = {}; 1140 fields[jQuery(this).attr('id')]['class'] = jQuery(this).attr('class'); 1141 1142 if (jQuery(this).hasClass('wppb-woocommerce-customer-billing-address')) { 1143 meta_name = 'woocommerce-customer-billing-address'; 1144 } else if (jQuery(this).hasClass('wppb-woocommerce-customer-shipping-address')) { 1145 meta_name = 'woocommerce-customer-shipping-address'; 1146 1147 if (!jQuery('.wppb-woocommerce-customer-billing-address #woo_different_shipping_address', jQuery(current_button).closest('form')).is(':checked')) { 1148 return true; 1149 } 1150 } else { 1151 meta_name = jQuery(this).find('label').attr('for'); 1152 1153 //fields[jQuery( this ).attr( 'id' )]['required'] = jQuery( this ).find( 'label' ).find( 'span' ).attr( 'class' ); 1154 fields[jQuery(this).attr('id')]['title'] = jQuery(this).find('label').first().text().trim(); 1155 } 1156 1157 fields[jQuery(this).attr('id')]['meta-name'] = meta_name; 1158 1159 if (jQuery(this).parent().parent().attr('data-wppb-rpf-meta-name')) { 1160 var repeater_group = jQuery(this).parent().parent(); 1161 1162 fields[jQuery(this).attr('id')]['extra_groups_count'] = jQuery(repeater_group).find('#' + jQuery(repeater_group).attr('data-wppb-rpf-meta-name') + '_extra_groups_count').val(); 1163 } 1164 1165 if (jQuery(this).hasClass('wppb-woocommerce-customer-billing-address')) { 1166 var woo_billing_fields_fields = {}; 1167 1168 jQuery('ul.wppb-woo-billing-fields li.wppb-form-field', jQuery(current_button).closest('form')).each(function () { 1169 if (!jQuery(this).hasClass('wppb_billing_heading')) { 1170 woo_billing_fields_fields[jQuery(this).find('label').attr('for')] = jQuery(this).find('label').text(); 1171 } 1172 }); 1173 1174 fields[jQuery(this).attr('id')]['fields'] = woo_billing_fields_fields; 1175 } 1176 1177 if (jQuery(this).hasClass('wppb-woocommerce-customer-shipping-address')) { 1178 var woo_shipping_fields_fields = {}; 1179 1180 jQuery('ul.wppb-woo-shipping-fields li.wppb-form-field', jQuery(current_button).closest('form')).each(function () { 1181 if (!jQuery(this).hasClass('wppb_shipping_heading')) { 1182 woo_shipping_fields_fields[jQuery(this).find('label').attr('for')] = jQuery(this).find('label').text(); 1183 } 1184 }); 1185 1186 fields[jQuery(this).attr('id')]['fields'] = woo_shipping_fields_fields; 1187 } 1188 } 1189 }) 1190 1191 return fields 1192 1193 } 1194 1195 /* 1196 * GDPR Delete button 1197 */ 1198 jQuery("#pms-delete-account").on("click", function (e) { 1199 e.preventDefault(); 1200 1201 var pmsDeleteUser = prompt(pmsGdpr.delete_text); 1202 if( pmsDeleteUser === "DELETE" ) { 1203 window.location.replace(pmsGdpr.delete_url); 1204 } 1205 else{ 1206 alert( pmsGdpr.delete_error_text ); 1207 } 1208 }) 1209 1210}) 1211 1212 1213/* 1214 * Profile Builder Compatibility 1215 * 1216 */ 1217jQuery( function($) { 1218 1219 $(document).ready( function() { 1220 1221 /** 1222 * Hide email confirmation payment message if no subscription plan is checked, or a free subscription is selected 1223 */ 1224 1225 // Handle on document ready 1226 if ( ( $('.pms-subscription-plan input[type=radio][data-price="0"]').is(':checked') || $('.pms-subscription-plan input[type=hidden]').attr( 'data-
1226price' ) == '0' || 1227 $('.pms-subscription-plan input[type=radio]').prop('checked') == false ) && !$.pms_plan_has_signup_fee() ) { 1228 1229 $('.pms-email-confirmation-payment-message').hide() 1230 } 1231 1232 if( $('.pms-subscription-plan input[type=radio]').length > 0 ) { 1233 1234 var has_paid_subscription = false 1235 1236 $('.pms-subscription-plan input[type=radio]').each( function() { 1237 if( $(this).data('price') != 0 || $.pms_plan_has_signup_fee( $(this) ) ) 1238 has_paid_subscription = true 1239 }) 1240 1241 if( !has_paid_subscription ) 1242 $('.pms-email-confirmation-payment-message').hide() 1243 1244 } 1245 1246 // Handle clicking on the subscription plans 1247 $('.pms-subscription-plan input[type=radio]').click(function(){ 1248 1249 if ( $('.pms-subscription-plan input[type=radio][data-price="0"]').is(':checked') && !$.pms_plan_has_signup_fee( $(this) ) ) 1250 $('.pms-email-confirmation-payment-message').hide() 1251 else 1252 $('.pms-email-confirmation-payment-message').show() 1253 1254 }) 1255 1256 $('.wppb-edit-user input[required]').on('invalid', function(e){ 1257 $.pms_reset_submit_button( $('.wppb-edit-user .wppb-subscription-plans input[type="submit"]').first() ) 1258 }) 1259 1260 }) 1261 1262}) 1263 1264 1265/** 1266 * Billing Fields 1267 */ 1268jQuery( function($) { 1269 1270 $(document).ready( function() { 1271 1272 // States field 1273 if( typeof PMS_States == 'undefined' || !PMS_States ) 1274 return 1275 1276 pms_handle_billing_state_field_display() 1277 1278 $(document).on( 'change', '#pms_billing_country', function() { 1279 1280 pms_handle_billing_state_field_display() 1281 1282 }) 1283 1284 if( typeof PMS_ChosenStrings !== 'undefined' && $.fn.chosen != undefined ){ 1285 $('#pms_billing_country').chosen( PMS_ChosenStrings ) 1286 1287 if( $('#pms_billing_state option').length > 0 ) 1288 $('#pms_billing_state').chosen( PMS_ChosenStrings ) 1289 } 1290 1291 // Autocomplete email address 1292 $( 'input[name=pms_billing_email], input[name=pms_billing_first_name], input[name=pms_billing_last_name]' ).each(function () { 1293 1294 if ( $(this).val() != '' ) 1295 $(this).addClass('pms-has-value') 1296 1297 }) 1298 1299 }) 1300 1301 /** 1302 * Fill up Email Address, First Name and Last Name based on what the user has type in the other fields 1303 * 1304 */ 1305 $(document).on('keyup', '#pms_user_email, .wppb-form-field input[name=email]', function () { 1306 1307 if ( $(this).closest('form').find('[name=pms_billing_email]').length == 0 ) 1308 return false 1309 1310 if ( $(this).closest('form').find('[name=pms_billing_email]').hasClass('pms-has-value') ) 1311 return false 1312 1313 $(this).closest('form').find('[name=pms_billing_email]').val( $(this).val() ) 1314 1315 }) 1316 1317 $(document).on('keyup', '#pms_first_name', function () { 1318 1319 if ( $(this).closest('form').find('[name=pms_billing_first_name]').length == 0 ) 1320 return false 1321 1322 if ( $(this).closest('form').find('[name=pms_billing_first_name]').hasClass('pms-has-value') ) 1323 return false 1324 1325 $(this).closest('form').find('[name=pms_billing_first_name]').val( $(this).val() ) 1326 1327 }) 1328 1329 $(document).on('keyup', '#pms_last_name', function () { 1330 1331 if ( $(this).closest('form').find('[name=pms_billing_last_name]').length == 0 ) 1332 return false 1333 1334 if ( $(this).closest('form').find('[name=pms_billing_last_name]').hasClass('pms-has-value') ) 1335 return false 1336 1337 $(this).closest('form').find('[name=pms_billing_last_name]').val( $(this).val() ) 1338 1339 }) 1340 1341 function pms_handle_billing_state_field_display(){ 1342 1343 var country = $('.pms-billing-details #pms_billing_country').val() 1344 1345 if( PMS_States[country] ){ 1346 1347 if( typeof PMS_ChosenStrings !== 'undefined' && $.fn.chosen != undefined ) 1348 $('.pms-billing-state__select').chosen('destroy') 1349 1350 $('.pms-billing-state__select option').remove() 1351 $('.pms-billing-state__select').append('<option value=""></option>'); 1352 1353 for( var key in PMS_States[country] ){ 1354 if( PMS_States[country].hasOwnProperty(key) ) 1355 $('.pms-billing-state__select').append('<option value="'+ key +'">'+ PMS_States[country][key] +'</option>') 1356 } 1357 1358 var prevValue = $('.pms-billing-state__input').val() 1359 1360 if( prevValue != '' ) 1361 $('.pms-billing-state__select').val( prevValue ) 1362 1363 $('.pms-billing-state__input').removeAttr('name').removeAttr('id').hide() 1364 $('.pms-billing-state__select').attr('name','pms_billing_state').attr('id','pms_billing_state').show() 1365 1366 if( typeof PMS_ChosenStrings !== 'undefined' && $.fn.chosen != undefined ) 1367 $('.pms-billing-state__select').chosen( PMS_ChosenStrings ) 1368 1369 } else { 1370 1371 if( typeof PMS_ChosenStrings !== 'undefined' && $.fn.chosen != undefined ) 1372 $('.pms-billing-state__select').chosen('destroy') 1373 1374 $('.pms-billing-state__select').removeAttr('name').removeAttr('id').hide() 1375 $('.pms-billing-state__input').attr('name','pms_billing_state').attr('id','pms_billing_state').show() 1376 1377 } 1378 1379 } 1380 1381})
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.