1/** 2 * Ultimate Membership Pro - Login Form 3 */ 4"use strict"; 5var IhcLoginForm = { 6 7 init : function( args ){ 8 var obj = this; 9 10 // login modal 11 if ( jQuery( '.ihc-js-login-popup-data' ).length ){ 12 jQuery( '.ihc-js-login-popup-data' ).each( function(){ 13 14 // login modal 15 if ( jQuery( this ).attr('data-is_register_page') == '1' ){ 16 jQuery('.ihc-modal-trigger-login').on( 'click', function() { 17 jQuery('html, body').animate({ 18 scrollTop: jQuery( '.ihc-login-form-wrap' ).offset().top 19 }, 1000); 20 }); 21 } else if ( jQuery( this ).attr('data-is_logged') == '1' ){ 22 jQuery('.ihc-modal-trigger-login').on( 'click', function() { 23 return false; 24 }); 25 } else { 26 if ( typeof IhcLoginModal !== 'undefined' ){ 27 var triggerSelector = jQuery( this ).attr('data-trigger_selector'); 28 var preventDefault = jQuery( this ).attr('data-trigger_default'); 29 var autostart = jQuery( this ).attr('data-autoStart'); 30 IhcLoginModal.init({ 31 triggerModalSelector : triggerSelector, 32 preventDefault : preventDefault, 33 autoStart : autostart 34 }); 35 } 36 } 37 }); 38 } 39 40 // show / hide password 41 obj.showHidePassword(); 42 43 }, 44 45 checkFields : function( t, e ){ 46 var n = jQuery('#notice_' + t); 47 n.remove(); 48 var target = jQuery('#ihc_login_form [name='+t+']').parent(); 49 var v = jQuery('#ihc_login_form [name='+t+']').val(); 50 if (v==''){ 51 jQuery(target).append('<div class="ihc-login-notice" id="notice_' + t + '">' + e + '</div>'); 52 } 53 }, 54 55 showHidePassword: function(){ 56 // show - hide password 57 if ( jQuery( '.ihc-hide-login-pw' ).length > 0 ){ 58 jQuery('.ihc-hide-login-pw').each(function(index, button) { 59 jQuery(button).on( 'click', function () { 60 var pass = jQuery(button).prev(); 61 if ( 'password' === pass.attr( 'type' ) ) { 62 pass.attr( 'type', 'text' ); 63 jQuery( this ).children().removeClass( 'dashicons-visibility' ).addClass('dashicons-hidden'); 64 } else { 65 pass.attr( 'type', 'password' ); 66 jQuery( this ).children().removeClass( 'dashicons-hidden' ).addClass('dashicons-visibility'); 67 } 68 }); 69 }); 70 } 71 }, 72}; 73 74window.addEventListener( 'load', function(){ 75 76 IhcLoginForm.init(); 77 // check fields 78 if ( jQuery( '.ihc-js-login-data' ).length ){ 79 var user_field = jQuery( '.ihc-js-login-data' ).attr('data-user_field'); 80 var password_field = jQuery( '.ihc-js-login-data' ).attr('data-password_field'); 81 var error_message = jQuery( '.ihc-js-login-data' ).attr('data-error_message'); 82 jQuery( user_field ).on('blur', function(){ 83 IhcLoginForm.checkFields('log', error_message ); 84 }); 85 jQuery( password_field ).on('blur', function(){ 86 IhcLoginForm.checkFields('pwd', error_message ); 87 }); 88 jQuery('#ihc_login_form').on('submit', function(e){ 89 e.preventDefault(); 90 var u = jQuery('#ihc_login_form [name=log]').val(); 91 var p = jQuery('#ihc_login_form [name=pwd]').val(); 92 if (u!='' && p!=''){ 93 document.getElementById( 'ihc_login_form' ).submit(); 94 } else { 95 IhcLoginForm.checkFields('log', error_message ); 96 IhcLoginForm.checkFields('pwd', error_message ); 97 return false; 98 } 99 }); 100 } 101 102 103});
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.