PageSourceSearch

https://www.drapersonline.com/wp-content/plugins/EmapSubscriptionM…//js/EmapSubscriptionChecker.js?ver=6.8.1

js drapersonline.com collected 2026-09-24 08:28:39 UTC 4,623 bytes, 124 lines download raw bytes

1var EmapSubscriptionChecker = EmapSubscriptionChecker || null;
2
3EmapSubscriptionChecker = (function(window, document, $, undefined){
4
5	
6	/***
7	* corporate subciption checker 
8	* 
9	**/
10	function checkCorporateSubcription()
11	{ 
12		jQuery(document).ready(function($) {
13		    $("#corpSubCheckerForm").submit(function(e) {
14		        e.preventDefault();
15		        
16		        var recaptchaTokenInput = $('#mbm_param_recaptcha');
17		        var recaptchaKey = $('#mbm-g-recaptcha').attr( 'data-sitekey' );
18		         // Initialize reCAPTCHA
19            	grecaptcha.ready(function () {
20                	grecaptcha.execute(recaptchaKey, { action: 'submit' }).then(function (token) {
21	                    // Store token in hidden input field
22	                    recaptchaTokenInput.val(token);
23
24				        // Field validation
25				        var isValid = true;
26				         $("#corpSubCheckerForm input[required]").each(function() {
27		                    if (!$(this).val()) {
28		                        isValid = false;
29		                        var fieldName = $(this).attr('placeholder');
30		                        $(this).addClass('input-invalid');
31		                        $(this).next('.error-message').text(fieldName + " is required.");
32		                    } else {
33		                    	$(this).removeClass('input-invalid');
34		                        $(this).next('.error-message').text(""); // Reset error message
35		                    }
36		                });
37
38				        
39				        var emailInput = $('#mbm_param_email');
40				        var email = emailInput.val().trim().toLowerCase();
41				        var disallowedDomains = ['gmail.com', 'yahoo.com', 'hotmail.com']; // Add more domains as needed
42
43				        // Regular expression for email validation
44				        var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
45
46				        if (isValid && (!emailRegex.test(email) || disallowedDomains.some(function(domain) { return email.endsWith('@' + domain); }))) {
47				        	isValid = false;
48				            $('#mbm_param_email').next('.error-message').text("Please enter your work email address domain.");
49				        }
50				      
51				        if (isValid) {
52				            // Check reCAPTCHA token
53				           // grecaptcha.execute();
54				          	$('.waiting').show();
55				          	$('#go_to_next2').prop('disabled', true);
56					        var form_el = $("#corpSubCheckerForm").serialize();
57					        $.ajax({
58					            url: ajax_object.ajax_url,
59					            type: 'POST',
60					            data: form_el,
61					            dataType: 'json',
62					            success: function(response) {
63					            	$('.waiting').hide();
64					            	$('#go_to_next2').prop('disabled', false);
65					                recaptchaTokenInput.val('');
66					                if(response.status == 'error'){
67					                	alert(response.message);
68					                }else{
69					                	jQuery("#corporate_subcrtiption_main_section").html(response.template);
70					                }
71					                
72					            },
73					            error: function(xhr, status, error) {
74					            	$('.waiting').hide();
75					                console.error('Error submitting form.');
76					            }
77					        });
78				        }
79				    }).catch(function (error) {
80                    	alert('Error initializing reCAPTCHA: ' + error);
81                	});
82				});
83		    });
84
85		     $("#go_to_next1").click(function() {
86		     	var isStepValid = true;
87		     	if (!$("#mbm_param_company_name").val()) {
88		     		console.log('data');
89                    isStepValid = false;
90                    var fieldName = $('#mbm_param_company_name').attr('placeholder');
91                    $('#mbm_param_company_name').addClass('input-invalid');
92                    $('#mbm_param_company_name').next('.error-message').text(fieldName + " is required.");
93                } else {
94                	$('#mbm_param_company_name').removeClass('input-invalid');
95                    $('#mbm_param_company_name').next('.error-message').text(""); // Reset error message
96                }
97                 if (isStepValid) {
98			        $("#corp_sub_checker_step1").hide();
99					$('.first').removeClass('active');
100					$('.second').addClass('active');
101			        $("#corp_sub_checker_step2").show();
102			      }
103		    });
104		});
105	}
106
107
108
109	function init()
110	{
111		$(function(){
112			checkCorporateSubcription();
113			
114		});
115	}
116
117	return {
118		init: init
119	}
120
121})(window, document, jQuery);
122
123EmapSubscriptionChecker.init();
124

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.