1function pcGetQueryParams(qs) { 2 qs = qs.split('+').join(' '); 3 var params = {}, 4 tokens, 5 re = /[?&]?([^=]+)=([^&]*)/g; 6 7 while (tokens = re.exec(qs)) { 8 params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); 9 } 10 return params; 11} 12 13function loadPCModaleForm() { 14 15 if(typeof pcDataParam !== 'undefined' && pcDataParam.newsletterProvider && 16 'preference-center' !== pcDataParam.newsletterProvider){ 17 return; 18 } 19 20 var query_string = document.location.search; 21 var param = pcGetQueryParams(query_string); 22 23 if(!param.hasOwnProperty('news-letter') && 24 !param.hasOwnProperty('updatenewsletter') && 25 !param.hasOwnProperty('updatepreference') && 26 !param.hasOwnProperty('unsusbcribe-newsletter')){ 27 return; 28 } 29 30 if(!param.hasOwnProperty('eea') && !param.hasOwnProperty('esp-token')){ 31 return; 32 } 33 34 param.action = 'loadPCModalForm'; 35 36 var ajax = jQuery.ajax({ 37 data: param, 38 url: '/wp-admin/admin-ajax.php', 39 type: 'GET', 40 dataType: 'html', 41 cache: false, 42 headers: { "cache-control": "no-cache" }, 43 }); 44 45 ajax.done(function(response, textStatus, jqXHR) { 46 47 var $div = jQuery('<div />').appendTo('body'); 48 $div.attr('id', 'pc-modal-wrap'); 49 $div.html(response); 50 51 }); 52} 53 54if (typeof getGRecaptchaResponseToken !== 'function') { 55 56 function getGRecaptchaResponseToken(formsSellector){ 57 58 var query_string = document.location.search; 59 var param = pcGetQueryParams(query_string); 60 let hostname = location.hostname; 61 62 if(hostname !== 'pref-center.metropolis.co.uk' || !param.hasOwnProperty('esp-token')){ 63 return; 64 } 65 66 if(window.grecaptcha){ 67 68 var site_key = '6LfzXcYhAAAAAC59txnrOBxkNUb32BrFz0vRVBys'; 69 70 grecaptcha.ready(function() { 71 grecaptcha.execute(site_key, {action: 'preference_request'}).then(function(token) { 72 73 let inputHtml = '<input type="hidden" name="g-recaptcha-token" value="' + token + '">'; 74 // add token to form 75 jQuery(formsSellector).append(inputHtml); 76 77 }); 78 }); 79 } 80 } 81} 82 83if (typeof ajaxPcForm !== 'function') { 84 85 function ajaxPcForm(){ 86 87 getGRecaptchaResponseToken(".MPCForm"); 88 89 jQuery(document).on('click', '.MFormSubmitBtn', function(event){ 90 91 getGRecaptchaResponseToken(".MPCForm"); 92 93 $this = jQuery(".MPCForm"); 94 95 var url = $this.attr('action'); 96 97 if (!url) { 98 var hostname = window.location.hostname; 99 100 if ( 101 hostname.includes('mortgagestrategy.co.uk') || 102 hostname.includes('moneymarketing.co.uk') 103 ) { 104 url = '/wordpress/wp-admin/admin-ajax.php'; 105 } else { 106 url = '/wp-admin/admin-ajax.php'; 107 } 108 } 109 110 var data = $this.serializeArray(); 111 112 // collecting unchecked checkbox data 113 // and adding it to the serialized form array 114 var i = data.length; 115 jQuery("input:checkbox:not(:checked)").each(function() { 116 data[i] = { name: 'newsletter_opt_out[]', value: jQuery(this).val() }; 117 i++; 118 }); 119 120 var wrapSt = $this.data('wrap'); 121 122 var feedbackST = $this.data('feedback'); 123 var btnSt = $this.data('submitbtn'); 124 125 var btnLabel = jQuery(btnSt).html(); 126 jQuery(btnSt).html('Processing Request .....'); 127 128 jQuery('.MBM-P-Loader').show(); 129 130 var ajax = jQuery.ajax({ 131 data: data, 132 url: url, 133 type: 'POST', 134 dataType: 'json', 135 cache: false, 136 headers: { "cache-control": "no-cache" }, 137 }); 138 139 ajax.done(function(response, textStatus, jqXHR) { 140 141 var status = (response.status)? response.status : null; 142 var message = (response.message)? response.message : ''; 143 var doAction = (response.doAction)? response.doAction : null; 144 145 jQuery(feedbackST).html(message).css({'display': 'block'});
146 147 if('hideForm' == doAction){ 148 jQuery(wrapSt).hide(); 149 jQuery("#PCFormModal .mform-container h3").hide(); 150 jQuery("#PCFormModal .mform-container .preference_msg_top").hide(); 151 } 152 153 jQuery(btnSt).html(btnLabel); 154 155 jQuery('.MBM-P-Loader').hide(); 156 }); 157 }); 158 } 159} 160 161function closePcWindow() 162{ 163 jQuery(document).on('click', '#close-pc-btn', function (event) { 164 event.preventDefault(); 165 jQuery('#PCFormModal').css({ 166 'position': 'relative', 167 'display': 'none'}).hide(); 168 jQuery('.popup_overlay').hide(); 169 }); 170} 171 172if (typeof findUsersFromPCAjaxForm !== 'function') { 173 174 function findUsersFromPCAjaxForm(){ 175 176 jQuery(document).on('submit', '.FindUsersFromPCForm', function(event){ 177 178 event.preventDefault(); 179 180 var url = jQuery(this).attr('action'); // , 181 url = (url)? url : '/wp-admin/admin-ajax.php'; 182 183 var data = jQuery(this).serializeArray(); 184 185 var wrapSt = jQuery(this).data('wrap'); 186 var feedbackST = jQuery(this).data('feedback'); 187 var btnSt = jQuery(this).data('submitbtn'); 188 189 var btnLabel = jQuery(btnSt).html(); 190 jQuery(btnSt).html('Processing Request .....'); 191 192 jQuery('.MBM-P-Loader').show(); 193 194 var ajax = jQuery.ajax({ 195 data: data, 196 url: url, 197 type: 'POST', 198 dataType: 'json', 199 cache: false, 200 headers: { "cache-control": "no-cache" }, 201 }); 202 203 ajax.done(function(response, textStatus, jqXHR) { 204 205 var status = (response.status)? response.status : null; 206 var message = (response.message)? response.message : ''; 207 var doAction = (response.doAction)? response.doAction : null; 208 209 jQuery(feedbackST).html(message).css({'display': 'block'}); 210 211 if('hideForm' == doAction){ 212 jQuery(wrapSt).hide(); 213 } 214 215 jQuery(btnSt).html(btnLabel); 216 217 jQuery('.MBM-P-Loader').hide(); 218 219 }); 220 }); 221 } 222} 223 224if (typeof loadPCNewsletterInputs !== 'function') { 225 226 function loadPCNewsletterInputs(){ 227 228 var uri_data = document.location; 229 var host = uri_data.host; 230 var pathname = uri_data.pathname; 231 232 var go_on = false; 233 if(host.indexOf('daltonsbusiness.com') !== -1 ){ 234 go_on = true; 235 } 236 237 if(!go_on){ 238 return; 239 } 240 241 if(pathname.indexOf('my-profile') == -1 ){ 242 return; 243 } 244 245 url = '/wp-admin/admin-ajax.php'; 246 247 var data = { 248 'action': 'mbm_pc_newsLettercheck' 249 }; 250 251 var feedbackEl = '.LoadPCNewsletterInputs'; 252 253 var ajax = jQuery.ajax({ 254 data: data, 255 url: url, 256 type: 'POST', 257 cache: false, 258 headers: { "cache-control": "no-cache" }, 259 }); 260 261 ajax.done(function(response) { 262 jQuery('.LoadPCNewsletterInputsWrap').css({'display': 'block'}); 263 jQuery(feedbackEl).css({'display': 'block'}).html(response); 264 265 }); 266 } 267} 268 269if (typeof mbm_accordion_tab !== 'function') { 270 271 function mbm_accordion_tab(className = 'mbm-accordion-tab'){ 272 273 let displayFirst = document.getElementById('PC-First-List-Group'); 274 275 displayFirst.style.display = 'block'; 276 277 var acc = document.getElementsByClassName(className); 278 var i; 279 280 for (i = 0; i < acc.length; i++) { 281 282 acc[i].addEventListener("click", function(event) { 283 284 event.preventDefault(); 285 286 this.classList.toggle("mbm-accordion-tab-active"); 287 var panel = this.nextElementSibling; 288 289 if (panel.style.display === 'block') { 290 panel.style.display = 'none'; 291 } else { 292 panel.style.display = 'block'; 293 } 294 295 }); 296 } 297 298 } 299} 300 301function make_accordion_tab_component(className = '.mbm-accordion-tab'){ 302 303 document.querySelector('body').addEventListener('click', event => { 304 305 if (event.target.matches(className) || event.target.closest(className)) { 306 307 var el = event.target.closest(className); 308 309 el.classList.toggle("mbm-accordion-tab-active"); 310 var panel = el.nextElementSibling; 311 312 if (panel.style.display === 'block') { 313 panel.style.display = 'none'; 314 } else { 315 panel.style.display = 'block'; 316 } 317 } 318 });
319} 320 321function appPageLoaderSpinner(){ 322 323 var query_string = document.location.search; 324 var param = pcGetQueryParams(query_string); 325 let hostname = location.hostname; 326 327 if(hostname !== 'pref-center.metropolis.co.uk' || !param.hasOwnProperty('esp-token')){ 328 return; 329 } 330 331 jQuery('body').append('<div style="" id="AppLoadingEl"><div class="mbm-loader-v1">Loading...</div></div>'); 332 333 setTimeout(function(){ 334 jQuery( "#AppLoadingEl" ).remove(); 335 }, 1200); 336} 337 338function openPcFaqWindow() 339{ 340 jQuery(document).on('click', '.PC-FAQ-Btn', function (event) { 341 event.preventDefault(); 342 jQuery('.PC-FAQ-Modal').css({'display': 'block'}); 343 jQuery('.PC-FAQ-Popup-Overlay').css({'display': 'block'}); 344 }); 345} 346 347 348 349jQuery(document).ready(function($) { 350 loadPCModaleForm(); 351 ajaxPcForm(); 352 closePcWindow(); 353 findUsersFromPCAjaxForm(); 354 loadPCNewsletterInputs(); 355 //mbm_accordion_tab('mbm-accordion-tab'); 356 make_accordion_tab_component(className = '.mbm-accordion-tab'); 357 openPcFaqWindow(); 358 359}); 360 361appPageLoaderSpinner(); 362 363 364 365 366 367 368 369 370 371 372 373
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.