1jQuery( document ).ready( function( $ ) { 2 'use strict'; 3 4 var current_path = window.location.pathname; // Current path. 5 6 // If it's the checkout page. 7 if ( -1 !== current_path.indexOf( 'checkout' ) ) { 8 // Run the interval time to check if the OTP notice link is available to click. 9 var check_otp_link_interval = setInterval( check_otp_auth_link_available, 2000 ); 10 11 function check_otp_auth_link_available() { 12 if ( $( '.phicommerce-auth-otp-notice' ).length ) { 13 clearInterval( check_otp_link_interval ); 14 window.location.href = $( '.phicommerce-auth-otp-notice' ).attr( 'href' ); 15 } 16 } 17 18 var place_order = parseInt( get_query_string_parameter_value( 'place_order' ) ); 19 20 // If the order needs to be placed. 21 if ( 1 === place_order ) { 22 $( 'span.woocommerce-terms-and-conditions-checkbox-text' ).siblings( 'input[type="checkbox"][name="terms"]' ).prop( 'checked', 'checked' ); 23 $( 'input[type="radio"][name="payment_method"][value="icicibank_payments"]' ).prop( 'checked', 'checked' ); 24 $( '#place_order' ).click(); 25 } 26 } 27 28 // Add hyphens after every 4 digits on the card number. 29 $( document ).on( 'keyup', '.phicommerce_payment_gateway #card_number', function() { 30 var this_input = $( this ); 31 // Function to add - after 4 character 32 add_after_character( /(\d{4})(?=\d)/g, '-', this_input ); 33 } ); 34 35 // Execute card payments. 36 $( document ).on( 'click', '.phicommerce_execute_card_payments', function() { 37 $( '#place_order' ).click(); 38 } ); 39 40 // Manage the tabbed content on the payment section. 41 $( document ).on( 'click', '.tab_box_title h3', function () { 42 if ( ! $( this ).closest( '.tab_box_title' ).hasClass( 'active_tab ' ) ) { 43 $( '.panel_tab_box .tab_box_title' ).removeClass( 'active_tab' ); 44 $( '.panel_tab_box .tab_box_content' ).slideUp().removeClass( 'active_content' ); 45 $( this).closest( '.tab_box_title' ).addClass( 'active_tab' ); 46 $( this ).closest( '.panel_tab_box' ).find( '.tab_box_content' ).slideDown().addClass( 'active_content' ); 47 } 48 }) 49 50 /** 51 * Check if a number is valid. 52 * 53 * @param {number} data 54 */ 55 function is_valid_number( data ) { 56 57 return ( '' === data || undefined === data || isNaN( data ) || 0 === data ) ? -1 :1; 58 } 59 60 /** 61 * Check if a string is valid. 62 * 63 * @param {string} $data 64 */ 65 function is_valid_string( data ) { 66 67 return ( '' === data || undefined === data || ! isNaN( data ) || 0 === data ) ? -1 : 1; 68 } 69 70 /** 71 * Check if a email is valid. 72 * 73 * @param {string} email 74 */ 75 function is_valid_email( email ) { 76 var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 77 78 return ( ! regex.test( email ) ) ? -1 : 1; 79 } 80 81 /** 82 * Check if a website URL is valid. 83 * 84 * @param {string} email 85 */ 86 function is_valid_url( url ) { 87 var regex = /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/; 88 89 return ( ! regex.test( url ) ) ? -1 : 1; 90 } 91 92 /** 93 * Block element. 94 * 95 * @param {string} element 96 */ 97 function block_element( element ) { 98 element.addClass( 'non-clickable' ); 99 } 100 101 /** 102 * Unblock element. 103 * 104 * @param {string} element 105 */ 106 function unblock_element( element ) { 107 element.removeClass( 'non-clickable' ); 108 } 109 110 /** 111 * Add symbols after x character 112 * 113 * @param {string} character_after 114 * @param {string} symbol_add 115 * @param {string} location 116 */ 117 function add_after_character( character_after, symbol_add, location ) { 118 var v = location.val().replace(/\D/g, ''); // Remove non-numerics 119 v = v.replace( character_after, '$1'+symbol_add ); // Add dashes every 4th digit 120 location.val(v); 121 } 122 123 /** 124 * Get query string parameter value. 125 * 126 * @param {string} string 127 * @return {string} string 128 */ 129 function get_query_string_parameter_value( param_name ) { 130 var url_string = window.location.href; 131 var url = new URL( url_string ); 132 var val = url.searchParams.get( param_name ); 133 134 return val; 135 } 136 137 /** 138 * Show the notification text. 139 * 140 * @param {string} bg_color Holds the toast background color. 141 * @param {string} icon Holds the toast icon. 142 * @param {string} heading Holds the toast heading. 143 * @param {string} message Holds the toast body message. 144 */ 145 function show_notification( bg_color, icon, heading, message ) { 146 $( '.wcpp-notification-wrapper .toast' ).removeClass( 'bg-success bg-warning bg-danger' ); 147 $( '.wcpp-notification-wrapper .toast' ).addClass( bg_color ); 148 $( '.wcpp-notification-wrapper .toast .wcpp-notification-icon' ).removeClass( 'fa-skull-crossbones fa-check-circle fa-exclamation-circle' ); 149 $( '.wcpp-notification-wrapper .toast .wcpp-notification-icon' ).addClass( icon ); 150 $( '.wcpp-notification-wrapper .toast .wcpp-notification-heading' ).text( heading ); 151 $( '.wcpp-notification-wrapper .toast .wcpp-notification-message' ).html( message ); 152 $( '.wcpp-notification-wrapper .toast' ).removeClass( 'hide' ).addClass( 'show' ); 153 154 setTimeout( function() { 155 $( '.wcpp-notification-wrapper .toast' ).removeClass( 'show' ).addClass( 'hide' ); 156 }, 10000 ); 157 } 158 159 // Show notification. 160 // show_notification( 'bg-success', 'fa-check-circle', toast_success_heading, 'Success text.' ); 161 // show_notification( 'bg-warning', 'fa-exclamation-circle', toast_notice_heading, 'Notice text.' ); 162 // show_notification( 'bg-danger', 'fa-skull-crossbones', toast_error_heading, 'Error text.' ); 163} );
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.