1 2 3 4 5(function() { 6 var postUrl = 'https://www.leadershipsw.org/communication', 7 ajaxUrl = 'https://www.leadershipsw.org/communication/WidgetConfirmation', 8 widgetId = 'mn-widget-' + (+new Date), 9 prefix = 'mn-widget-comm', 10 domain = 'www.leadershipsw.org', 11 xhr = createXHR(), 12 supportsAjax = !!xhr && window.JSON, 13 supportsCrossDomain = false, // supportsAjax && 'withCredentials' in xhr, 14 widget, 15 form, 16 msg, 17 html; 18 19 html = '<div id="' + widgetId + '" class="mn-widget ' + prefix + '"><div class="mn-widget-head">Subscriptions/Groups</div><div class="mn-widget-content"><div id="' + widgetId + '-msg" class="mn-widget-msg mn-widget-msgempty"></div><form id="' + widgetId + '-form" action="' + postUrl + '" method="post" class="mn-form">'; 20 html += '<input name="RequireCompany" type="hidden" value="False" />'; 21 22 html += '<div class="mn-form-pretext">Please select the items that interest you. You will receive periodic communications from us regarding your selections.</div>'; 23 html += '<div class="mn-form-reqnote" title="Asterisk denotes a required field"><span class="mn-form-req">*</span> Required field</div>'; 24 25 // Render all form elements. 26 html += '<div class="mn-comm-contact mn-comm-section">'; 27 html += '<div class="mn-form-row mn-comm-name"><label><span class="mn-form-name">Name: <span class="mn-form-req" title="Required field">*</span></span> <span class="mn-form-field"><input id="' + widgetId + '-name" name="Name" type="text" class="mn-form-text" size="50" maxlength="100" value="" /></span></label></div>'; 28 html += '<div class="mn-form-row mn-comm-company"><label><span class="mn-form-name">Company: </span> <span class="mn-form-field"><input id="' + widgetId + '-company" name="Company" type="text" class="mn-form-text" size="50" maxlength="75" value="" /></span></label></div>'; 29 html += '<div class="mn-form-row mn-comm-email"><label><span class="mn-form-name">Email: <span class="mn-form-req" title="Required field">*</span></span> <span class="mn-form-field"><input id="' + widgetId + '-email" name="EMail" type="text" class="mn-form-text" size="50" maxlength="80" value="" /></span></label></div>'; 30 html += '<div class="mn-form-row mn-comm-phone"><label><span class="mn-form-name">Phone: </span> <span class="mn-form-field"><input id="' + widgetId + '-phone" name="Phone" type="text" class="mn-form-text" size="20" maxlength="30" value="" /></span></label></div>'; 31 html += '</div>'; 32 33 // Render group elements. 34 var groupTypes = {"":[]}, 35 selectedGroups = []; 36 37 function generateGroups(groups) { 38 var result = ''; 39 for(var i = 0; i < groups.length; i++) { 40 var group = groups[i]; 41 result += '<label><span class="mn-form-field"><input type="checkbox" class="mn-form-check" name="selectedGroups" value="' + group.GroupId + '"' + (selectedGroups.indexOf(group.GroupId)>=0 ? ' checked="checked"' : '') + '/></span><span class="mn-form-name">' + group.Name + '</span></label>'; 42 } 43 return result; 44 }; 45 46 html += '<div class="mn-comm-groups mn-comm-section">' 47 for(var name in groupTypes) { 48 var groups = groupTypes[name]; 49 if (groups.length) { 50 html += '<div class="mn-form-row">' + (name ? '<div class="mn-form-name">' + name + '</div>' : '') + '<div class="mn-form-combo mn-form-checkcombo">' + generateGroups(groups) + '</div></div>'; 51 } 52 } 53 html += '</div>'; 54 55 html += '<div id="mn-com-captcha" class="mn-com-section"><div class="mn-section-content"><div id="mn-postcomment-answer" class="mn-form-row"><div class="g-recaptcha" data-sitekey="6LcpNUMUAAAAAB5iVpO_rzGG2TK_vFp7V6SCw_4s" data-callback="onReCaptchaSuccess"></div></div></div></div>'; 56 57 html += '<div class="mn-actions"><ul><li class="mn-action-submit"><input type="submit" class="mn-button" value="Submit" /></li></ul></div></form></div></div>'; 58 59 // only add the script if it is being loaded at load time 60 if (document.readyState == "loading") { 61 document.write(html); 62 63 widget = document.getElementById(widgetId); 64 form = document.getElementById(widgetId + '-form'); 65 msg = document.getElementById(widgetId + '-msg'); 66 67 if (form.addEventListener) 68 form.addEventListener('submit', onSubmit, false); 69 else if (form.attachEvent) 70 form.attachEvent('onsubmit', onSubmit); 71 72 // Inject reCAPTCHA api.js asynchronously after the form is in the DOM. 73 // Avoids Chrome's parser-blocking intervention against document.write of cross-origin scripts. 74 var recaptchaScript = document.createElement('script'); 75 recaptchaScript.src = 'https://www.google.com/recaptcha/api.js'; 76 recaptchaScript.async = true; 77 recaptchaScript.defer = true; 78 document.head.appendChild(recaptchaScript); 79 } 80 81 function preventDefault(e) { 82 if (e = e || window.event) 83 e.preventDefault && e.preventDefault() || (e.returnValue = false); 84 }; 85 86 function stopPropagation(e) { 87 if (e = e || window.event) 88 e.stopPropagation && e.stopPropagation() || (e.cancelBubble = true); 89 }; 90 91 function createXHR() { 92 if (window.XMLHttpRequest) 93 try { return new XMLHttpRequest(); } catch (e) { } 94 95 if (window.ActiveXObject) { 96 try { return new ActiveXObject("MSXML2.XMLHTTP"); } catch (e) { } 97 try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } 98 } 99 }; 100 101 function serialize(form) { 102 var elements = form.elements, 103 rselectTextarea = /^(?:select|textarea)/i, 104 rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, 105 values = [], 106 i; 107 108 for(i = 0; i < elements.length; i++) 109 { 110 var element = elements[i]; 111 112 if (element.name && !element.disabled && (element.checked || rselectTextarea.test(element.nodeName) || rinput.test(element.type))) 113 { 114 if (element.nodeType === 1 && element.multiple) // multiple select 115 { 116 for(var j = 0; j < element.options.length; j++) 117 { 118 if (element.options[j].selected) 119 values.push(encodeURIComponent(element.name) + '=' + encodeURIComponent(element.options[j].value)); 120 } 121 } 122 else 123 { 124 values.push(encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value)); 125 } 126 } 127 } 128 129 return values.join('&'); 130 }; 131 132 function validate() 133 { 134 var invalid = [], 135 element; 136 137 element = document.getElementById(widgetId + '-name'); 138 if (!element || !element.value) 139 invalid.push('Name'); 140 141 142 element = document.getElementById(widgetId + '-email'); 143 if (!element || !element.value) 144 invalid.push('Email'); 145 146 if (invalid.length) { 147 alert('The following fields are required:\n\n' + invalid.join(', ') + '.\n'); 148 return false; 149 } 150 151 return true; 152 }; 153 154 function setMessage(type, message) 155 { 156 resetMessage(); 157 msg.className = 'mn-widget-msg mn-widget-msg' + type; 158 msg.innerHTML = message; 159 } 160 161 function success(data) 162 { 163 if (data.Success) 164 { 165 setMessage('success', 'Thank you! A confirmation email has been sent. Please check your email and click the link in the email to confirm your subscriptions.'); 166 form.style.display = 'none'; 167 } 168 else 169 { 170 error(data.ErrorMsg); 171 } 172 }; 173 174 function error(errorMsg) 175 { 176 var styledError = '<span style="color:red">' + errorMsg + '</span>' 177 setMessage('error', styledError); 178 }; 179 180 function resetMessage() 181 { 182 msg.className = 'mn-widget-msg mn-widget-msgempty'; 183 while (msg.hasChildNodes()) 184 msg.removeChild(msg.lastChild); 185 }; 186 187 function parseJSON(data) { 188 if (typeof data !== 'string' || !data) 189 return null; 190 191 // Attempt to parse using the native JSON parser first 192 if (window.JSON && window.JSON.parse) 193 return window.JSON.parse(data); 194 195 // Make sure the incoming data is actual JSON 196 // Logic borrowed from http://json.org/json2.js 197 if (/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') 198 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') 199 .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) 200 { 201 return (new Function('return ' + data))(); 202 } 203 204 throw new Error('Invalid JSON: ' + data); 205 }; 206 207 function onSubmit(e) { 208 resetMessage(); 209 preventDefault(e); 210 stopPropagation(e); 211 212 if (!validate()) 213 return; 214 215 data = serialize(form); 216 217 setMessage('sending', 'Please wait while we process your request.'); 218 219 var url = ajaxUrl + '?' + data, 220 isJsonp = !supportsAjax || (domain != window.location.host && !supportsCrossDomain); 221 222 if (isJsonp) { 223 var jsonpFuncName = 'MNI_Comm_jpc' + (+new Date); 224 225 url += '&jsonpcallback=' + jsonpFuncName; 226 url += '&X-Requested-With=XMLHttpRequest'; 227 228 window[jsonpFuncName] = function (data) { 229 success(data); 230 delete window[jsonpFuncName]; 231 }; 232 233 var firstScript = document.getElementsByTagName('script')[0], 234 script = document.createElement('script'); 235 script.async = true; 236 script.onload = script.onreadystatechange = scriptOnLoad; 237 script.src = url; 238 firstScript.parentNode.insertBefore(script, firstScript); 239 } 240 else { 241 var xhr = createXHR(); 242 xhr.open('POST', url, true); 243 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 244 xhr.setRequestHeader('Accept', 'application/json, text/javascript, */*'); 245 xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 246 xhr.onreadystatechange = function () { 247 if (this.readyState == 4) 248 { 249 if (this.status == 200) 250 success(parseJSON(this.responseText)); 251 else 252 error(); 253 } 254 }; 255 xhr.send(data); 256 } 257 }; 258 259 function scriptOnLoad() { 260 if (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') { 261 this.onload = this.onreadystatechange = null; 262 this.parentNode.removeChild(this); 263 } 264 }; 265})();
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.