PageSourceSearch

https://www.investchempharma.com/wp-content/plugins/zm-ajax-login-register/assets/login.js?ver=7.0.7

js investchempharma.com collected 2026-10-08 02:15:51 UTC 5,688 bytes, 155 lines download raw bytes

1$document.ready(function( $ ){
2
3    /**
4     * We hook into the form submission and submit it via ajax.
5     * the action maps to our php function, which is added as
6     * an action, and we serialize the entire content of the form.
7     */
8    $document.on('submit', '.login_form', function( event ){
9        event.preventDefault();
10
11        var $this = $(this),
12            google_recaptcha = zMAjaxLoginRegister.recaptcha_check_login( $this ),
13            serialized_form = $this.serialize(),
14            form_fields = 'input[type="password"], input[type="text"], input[type="email"], input[type="checkbox"], input[type="submit"]',
15            data = {
16                action: 'login_submit',
17                security: $this.data('zm_alr_login_security')
18            };
19
20        $this.find( form_fields ).attr('disabled','disabled');
21
22        $.ajax({
23            global: false,
24            data: "action=login_submit&" + serialized_form + "&security=" + $this.data('zm_alr_login_security') + "&" + google_recaptcha,
25            type: "POST",
26            url: _zm_alr_settings.ajaxurl,
27            success: function( msg ){
28
29                ajax_login_register_show_message( $this, msg );
30                $this.find( form_fields ).removeAttr('disabled');
31                zMAjaxLoginRegister.reload( msg.redirect_url );
32
33            }
34        });
35    });
36
37
38    /**
39     * Our element we are attaching the 'click' event to is loaded via ajax.
40     */
41    $document.on( 'click', '.fb-login', function( event ){
42
43        event.preventDefault();
44
45        var $this = $( this );
46        var $form_obj = $this.parents('form');
47
48        /**
49         * Doc code from FB, shows fb pop-up box
50         *
51         * @url https://developers.facebook.com/docs/reference/javascript/FB.login/
52         */
53         // Better to check via?
54         // FB.api('/me/permissions', function( response ){});
55
56         // Since WordPress requires the email we cannot continue if they
57         // do not provide their email address
58        FB.login( function( response ) {
59            /**
60             * If we get a successful authorization response we handle it
61             * note the "scope" parameter.
62             */
63            var requested_scopes = ['public_profile','email','contact_email'];
64            var response_scopes = $.map( response.authResponse.grantedScopes.split(","), $.trim );
65            var diff = $( requested_scopes ).not( response_scopes ).get();
66            var granted_access = diff.length;
67
68            if ( ! granted_access ){
69
70                /**
71                 * "me" refers to the current FB user, console.log( response )
72                 * for a full list.
73                 */
74                FB.api('/me', function(response) {
75                    var fb_response = response;
76
77                    /**
78                     * Make an Ajax request to the "facebook_login" function
79                     * passing the params: username, fb_id and email.
80                     *
81                     * @note Not all users have user names, but all have email
82                     * @note Must set global to false to prevent gloabl ajax methods
83                     */
84                    $.ajax({
85                        data: {
86                            action: "facebook_login",
87                            fb_response: fb_response,
88                            security: $this.data('zm_alr_facebook_security')
89                        },
90                        global: false,
91                        type: "POST",
92                        url: _zm_alr_settings.ajaxurl,
93                        success: function( msg ){
94                            ajax_login_register_show_message( $form_obj, msg );
95                            zMAjaxLoginRegister.reload( msg.redirect_url );
96                        }
97                    });
98                });
99            } else {
100                console.log('User canceled login or did not fully authorize.');
101            }
102        },{
103            /**
104             * See the following for full list:
105             * @url https://developers.facebook.com/docs/authentication/permissions/
106             */
107            scope: 'email',
108            return_scopes: true
109        });
110    });
111
112    /**
113     * Open the dialog box based on the handle, send the AJAX request.
114     */
115    if ( _zm_alr_settings.login_handle.length ){
116
117
118        // Set the "login" text to be "logout" if the user is logged in.
119        if ( $('body.logged-in').length ){
120
121            $this = $( _zm_alr_settings.login_handle ).children('a');
122
123            $this.html( _zm_alr_settings.logout_text );
124            $this.attr( 'href', _zm_alr_settings.wp_logout_url );
125
126        }
127
128        // Open the dialog when they click on it.
129        else {
130
131            $document.on('click', _zm_alr_settings.login_handle, function( event ){
132
133                event.preventDefault();
134                zMAjaxLoginRegister.open_login();
135
136                // There's a setting to either load the container div, then have the
137                // forms load inside via AJAX, or to have them already loaded, and "hidden"
138                // via display:none.
139                if ( _zm_alr_settings.pre_load_forms === 'zm_alr_misc_pre_load_no' ){
140                    zMAjaxLoginRegister.load_login();
141                }
142
143            });
144        }
145    }
146
147    $document.on('click', '.not-a-member-handle', function( e ){
148        e.preventDefault();
149        $('#ajax-login-register-login-dialog').dialog('close');
150        zMAjaxLoginRegister.open_register();
151        if ( _zm_alr_settings.pre_load_forms === 'zm_alr_misc_pre_load_no' ){
152            zMAjaxLoginRegister.load_register();
153        }
154    });
155});

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.