1 2function sandsUrlParam(name){ 3 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); 4 if (results==null) { 5 return null; 6 } 7 return decodeURI(results[1]) || 0; 8} 9 10function handleLocationSwitchForLocationIdentifer(selectedLocIdentifier = false) { 11 handleLocationSwitchForLocationIdentiferAndMaybeRedirect(selectedLocIdentifier, true); 12} 13 14function handleLocationSwitchForLocationIdentiferAndMaybeRedirect(selectedLocIdentifier, redirect = false) { 15 handleLocationSwitchForLocationIdentiferAndMaybeRedirect(selectedLocIdentifier, redirect, setcookie); 16} 17 18function handleLocationSwitchForLocationIdentiferAndMaybeRedirect(selectedLocIdentifier, redirect = false, setcookie = false) { 19 if (selectedLocIdentifier && mlccontext && mlccontext.activelocations && mlccontext.activelocations.length) { 20 var targetLocation = mlccontext.activelocations.find(function(location) { 21 return location.identifier == selectedLocIdentifier; 22 }); 23 if (targetLocation) { 24 if (setcookie) { 25 var cookieName = "event_location"; 26 var cookieValue = selectedLocIdentifier; 27 var cookiePath = "/"; 28 var expirationTime = 3600 * 1000 * 24 * 365 * 2; 29 30 var date = new Date(); 31 var dateTimeNow = date.getTime(); 32 date.setTime(dateTimeNow + expirationTime); 33 var expirationTime = date.toUTCString(); 34 document.cookie = cookieName+"="+cookieValue+"; expires="+expirationTime+"; path="+cookiePath; 35 } 36 37 if (redirect) { 38 // get language, based on that get url to redirect to 39 var theMaybeSetPLLCookieValue = $.cookie('pll_language'); 40 var windowRealPath = getPathFromURL(window.location.href); 41 if (theMaybeSetPLLCookieValue && (theMaybeSetPLLCookieValue == 'de')) { 42 if (targetLocation.buttonLink_DE) { 43 var linkHref = getPathFromURL(targetLocation.buttonLink_DE); 44 if(linkHref != windowRealPath) { 45 // window.location.replace(targetLocation.buttonLink_DE); 46 // console.log('red de'); 47 window.location.href = targetLocation.buttonLink_DE; 48 } 49 } 50 } else { 51 if (targetLocation.buttonLink) { 52 var linkHref = getPathFromURL(targetLocation.buttonLink); 53 if(linkHref != windowRealPath) { 54 // window.location.replace(targetLocation.buttonLink); 55 // console.log('red en'); 56 window.location.href = targetLocation.buttonLink; 57 } 58 } 59 } 60 } 61 } 62 } 63} 64 65function getPathFromURL(url) { 66 return new URL(url).pathname; 67} 68 69function sands_mlc_cookie_helper_for_vue() { 70 if (mlccontext && mlccontext.activelocations && mlccontext.activelocations.length) { 71 mlccontext.activelocations.forEach(function(item) { 72 var current_url = window.location.protocol + "//" + window.location.host + window.location.pathname; 73 74 if (current_url.startsWith(item.buttonLink.slice(0, -1)) || current_url.startsWith(item.buttonLink_DE.slice(0, -1))) { 75 var cookieName = "event_location"; 76 // we shall only set the cookie again if its not already set, lets check it 77 var shallWeSetTheLocationCookie = true; 78 var cookieStoredLocationIdentifier = $.cookie(cookieName); 79 if (cookieStoredLocationIdentifier && (typeof cookieStoredLocationIdentifier !== "undefined") && (cookieStoredLocationIdentifier != "")) { 80 if (cookieStoredLocationIdentifier == item.identifier) { 81 shallWeSetTheLocationCookie = false; 82 } 83 } 84 if (shallWeSetTheLocationCookie) { 85 var cookieValue = item.identifier; 86 var cookiePath = "/"; 87 var expirationTime = 3600 * 1000 * 24 * 365 * 2; 88 var now = new Date(); 89 var date = new Date(); 90 var dateTimeNow = date.getTime(); 91 date.setTime(dateTimeNow + expirationTime); 92 var expirationTime = date.toUTCString(); 93 // set location cookie and naming convention bound storage and expiry date of that location cooke for later use 94 document.cookie = cookieName+"="+cookieValue+"; expires="+expirationTime+"; path="+cookiePath;
95 document.cookie = cookieName+ "_expiry_date_" + cookieValue + "="+ expirationTime + "; expires="+expirationTime+"; path="+cookiePath; 96 document.cookie = cookieName+ "_storage_date_" + cookieValue + "="+ now.toUTCString() +"; expires="+expirationTime+"; path="+cookiePath; 97 } 98 } 99 }); 100 } 101 102 103 var maybeSubmittedURLParamForLocation = sandsUrlParam('location'); 104 if (maybeSubmittedURLParamForLocation) { 105 var selectedLocIdentifier = decodeURIComponent(maybeSubmittedURLParamForLocation); 106 handleLocationSwitchForLocationIdentifer(selectedLocIdentifier); 107 } 108 109 var maybeSubmittedURLParamForLoc = sandsUrlParam('loc'); 110 if (maybeSubmittedURLParamForLoc) { 111 var selectedLocIdentifier = decodeURIComponent(maybeSubmittedURLParamForLoc); 112 var cookieName = "event_location"; 113 var cookieValue = selectedLocIdentifier; 114 var cookiePath = "/"; 115 var expirationTime = 3600 * 1000 * 24 * 365 * 2; 116 117 var date = new Date(); 118 var dateTimeNow = date.getTime(); 119 date.setTime(dateTimeNow + expirationTime); 120 var expirationTime = date.toUTCString(); 121 document.cookie = cookieName+"="+cookieValue+"; expires="+expirationTime+"; path="+cookiePath; 122 handleLocationSwitchForLocationIdentiferAndMaybeRedirect(selectedLocIdentifier, false); 123 } 124 125 126 $(window).on('mlc_location_switched', function(event) { 127 if (event.type == 'mlc_location_switched') { 128 if (event.payload && event.payload.selected_location) { 129 var selectedLocIdentifier = event.payload.selected_location; 130 handleLocationSwitchForLocationIdentifer(selectedLocIdentifier); 131 } 132 } 133 }); 134 135 /* 136 mlc-location-dependent-block-invisible 137 mlc-location-independent-block-invisible 138 mlc-location-dependent-block-visible 139 mlc-location-independent-block-visible 140 */ 141 // check what cookie is set and switch classess accodringly 142 var cookieStoredLocationIdentifier = $.cookie("event_location"); 143 if (cookieStoredLocationIdentifier && (typeof cookieStoredLocationIdentifier !== "undefined") && (cookieStoredLocationIdentifier != "") && (cookieStoredLocationIdentifier != "all")) { 144 // we have a location so we do somtehing with location dependend things 145 $('.mlc-location-dependent-block-visible').addClass('mlc-location-dependent-block-invisible'); 146 $('.mlc-location-dependent-block-visible').removeClass('mlc-location-dependent-block-visible'); 147 $('.mlc-location-dependent-block-invisible.' +cookieStoredLocationIdentifier).addClass('mlc-location-dependent-block-visible'); 148 $('.mlc-location-dependent-block-invisible.' + cookieStoredLocationIdentifier).removeClass('mlc-location-dependent-block-invisible'); 149 // if we are on the landing page we shall redirect to location landing page, 150 // if there is no loc=all parameter 151 var homeBody = $('body.home'); 152 // are we on the landing page? 153 if (homeBody && homeBody.length) { 154 // do we have an url param? if it is all, we do nothing, if its not all we call redirect to loc home page 155 if (maybeSubmittedURLParamForLoc) { 156 var selectedLocIdentifier = decodeURIComponent(maybeSubmittedURLParamForLoc); 157 if (!selectedLocIdentifier || (selectedLocIdentifier != 'all')) { 158 handleLocationSwitchForLocationIdentifer(cookieStoredLocationIdentifier); 159 } 160 } else { 161 // whenever we detect that a user has a cookie for a location, we redirect him 162 handleLocationSwitchForLocationIdentifer(cookieStoredLocationIdentifier); 163 } 164 } 165 var mcFormInputField = $('.email--input.location-bound-styleing-background'); 166 if (mcFormInputField && mcFormInputField.length) { 167 //we add class to the input field 168 $(mcFormInputField).addClass('cookie-class ' + cookieStoredLocationIdentifier); 169 } 170 171 var membersCheckpointCard = $('.members-checkpoint-card'); 172 if (membersCheckpointCard && membersCheckpointCard.length) { 173 //we add class to the input field 174 $(membersCheckpointCard).addClass('cookie-class ' + cookieStoredLocationIdentifier); 175 } 176 177 var membersCheckpointPillsBg = $('.members-checkpoint-pills-bg'); 178 if (membersCheckpointPillsBg && membersCheckpointPillsBg.length) { 179 //we add class to the input field 180 $(membersCheckpointPillsBg).addClass('cookie-class ' + cookieStoredLocationIdentifier); 181 } 182 183 var textFields = $('.location-bound-styleing-textcolor'); 184 if (textFields && textFields.length) { 185 //we add class to the text fields 186 $(textFields).each(function(index, element){ 187 $(element).addClass('cookie-class ' + cookieStoredLocationIdentifier); 188 }); 189 } 190 } else { 191 // we do NOT have a location so we do somtehing with location dependend things 192 $('.mlc-location-independent-block-invisible').addClass('mlc-location-independent-block-visible'); 193 $('.mlc-location-independent-block-invisible').removeClass('mlc-location-independent-block-invisible'); 194 } 195 document.dispatchEvent(new Event("disturbersInitialized")); 196 197 198 //remove display none class on menue (gdlr-nav-wrapper-enhanced) 199 var invisiblenavigation = $('.gdlr-nav-wrapper-enhanced'); 200 if (invisiblenavigation && invisiblenavigation.length) { 201 $(invisiblenavigation).removeClass('gdlr-nav-wrapper-enhanced'); 202 } 203 var mcForms = $('.mc4wp-form'); 204 if (mlccontext && mlccontext.activelocations && mlccontext.activelocations.length) { 205 mlccontext.activelocations.forEach(function(item) { 206 var language = $.cookie('pll_language'); 207 208 if (language == 'de') { 209 if ( cookieStoredLocationIdentifier && cookieStoredLocationIdentifier == item.identifier) { 210 $('.gdlr-logo').find('img').attr('src', item.loc_logo_image); 211 $('.gdlr-logo').find('a').first().attr('href', item.buttonLink_DE); 212 } 213 var radioButton = '<div class="location-item"><input class="sands_mc_radio_button" name="_mc4wp_lists" aria-label="Abonnieren '+ item.city_de +' Newsletter" type="radio" value="'+ item.location_mc_list_id +'" data-language="'+ item.location_mc_language +'" data-groupid="'+ item.location_mc_group_id +'" data-editionlabel="'+ item.location_mc_editon_value +'" data-mailchimp-workflow-id="'+ item.location_mc_wf_id +'" data-mailchimp-workflow-email-id="'+ item.location_mc_wf_email_id +'" onclick="sands_mc_radio_button_action(this)" style="border-color:' + item.location_color + '"> <span class="font-16 font-sm-14" style="margin-right:2px; margin-left:0px;font-size: 20px;color:' + item.location_color + '"><strong>'+ item.city_de +'</strong></span></div>'; 214 } else { 215 if ( cookieStoredLocationIdentifier && cookieStoredLocationIdentifier == item.identifier) { 216 $('.gdlr-logo').find('img').attr('src', item.loc_logo_image_en); 217 $('.gdlr-logo').find('a').first().attr('href', item.buttonLink); 218 } 219 var radioButton = '<div class="location-item"><input class="sands_mc_radio_button" name="_mc4wp_lists" type="radio" aria-label="Subscribe to ' + item.city +' Newsletter" value="'+ item.location_mc_list_id +'" data-language="'+ item.location_mc_language +'" data-groupid="'+ item.location_mc_group_id +'" data-editionlabel="'+ item.location_mc_editon_value +'" data-mailchimp-workflow-id="'+ item.location_mc_wf_id +'" data-mailchimp-workflow-email-id="'+ item.location_mc_wf_email_id +'" onclick="sands_mc_radio_button_action(this)" style="border-color:' + item.location_color + '"> <span class="font-16 font-sm-14" style="margin-right:2px; margin-left:0px;font-size: 20px;color:' + item.location_color + '"><strong>'+ item.city +'</strong></span></div>'; 220 } 221 $(mcForms).each(function(index, form){ 222 if (!cookieStoredLocationIdentifier || (selectedLocIdentifier == 'all') || (cookieStoredLocationIdentifier == "all")) { 223 if (!$(form).find('input[type=hidden][name=_mc4wp_lists]').length) { 224 $(form).find('input[type="submit"]').prop('disabled', true); 225 $(form).find('.location-chooser').addClass('mb-5').append(radioButton); 226 227 } else { 228 var editionvalue = $(form).find('input[type=hidden][name=_mc4wp_lists]').data("edition"); 229 $(form).find("#EDITION").val(editionvalue); 230 } 231 } else { 232 if (cookieStoredLocationIdentifier == item.identifier) { 233 sands_mc_set_cookie_values(form, item); 234 } 235 } 236 if ($(form).find("input[type=hidden][name=WHITEPAPER]").length && $(form).find("input[type=hidden][name=PENDING]").length &&$(form).find("input[type=hidden][name=LEADCHANNE]").length) { 237 $(form).find("#LEADCHANNE").val($(form).find("input[type=hidden][name=LEADCHANNE]").first().val()); 238 $(form).find("#WHITEPAPER").val($(form).find("input[type=hidden][name=WHITEPAPER]").first().val()); 239 $(form).find("#PENDING").val($(form).find("input[type=hidden][name=PENDING]").first().val()); 240 } 241 }); 242 }); 243 } 244 245 // Hide the Small display if they are empty 246 var smallDisplayBlock = $('.small-display-program'); 247 if(smallDisplayBlock.length > 0){ 248 $(smallDisplayBlock).each(function(singleSmallview){ 249 //console.log($(this)); 250 var identifier = $(this).data('smallblockid'); 251 if (identifier){ 252 var rowSelector = '.small-display-program.'+ identifier; 253 if($(rowSelector).find(".gdlr-session-item-content-wrapper").length){ 254 //console.log('found kids '); 255 }else{ 256 $('.small-display-program.'+ identifier).hide(); 257 //console.log('found NOOOOOO kids '); 258 } 259 } 260 }); 261 } 262 var theMaybeSetPLLCookieValue = $.cookie('pll_language'); 263 if (theMaybeSetPLLCookieValue && (theMaybeSetPLLCookieValue == 'de')) { 264 $('.language-dependent-block-invisible-de').addClass('language-dependent-block-visible'); 265 $('.language-dependent-block-invisible-de').removeClass('language-dependent-block-invisible-de'); 266 } else { 267 $('.language-dependent-block-invisible').addClass('language-dependent-block-visible'); 268 $('.language-dependent-block-invisible').removeClass('language-dependent-block-invisible'); 269 } 270} 271 272jQuery(document).ready(function($) { 273 if (!window.sands_mlc_cookie_helper_for_vue) { 274 window.sands_mlc_cookie_helper_for_vue = sands_mlc_cookie_helper_for_vue(); 275 }; 276 setTimeout(function () { 277 sands_mlc_cookie_helper_for_vue(); 278 disableMcNlSubmitButton(); 279 }, 200); 280}); 281 282function sands_mc_radio_button_action(element) { 283 $(element).parent().parent().find("#INTEREST").val($(element).attr("data-groupid")); 284 $(element).parent().parent().find("#EDITION").val($(element).attr("data-editionlabel")); 285 if ($(element).attr("data-language") == "de" && $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_de]").length && $(element).parent().parent().parent().find("input[type=hidden][name=wf_email_id_de]").length) { 286 $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_ret_list_new_group]").val($(element).parent().parent().parent().find("input[type=hidden][name=wf_id_de]").val()); 287 $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_ret_list_new_group_email_id]").val($(element).parent().parent().parent().find("input[type=hidden][name=wf_email_id_de]").val()); 288 289 } else if ($(element).attr("data-language") == "en" && $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_en]").length && $(element).parent().parent().parent().find("input[type=hidden][name=wf_email_id_en]").length) { 290 $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_ret_list_new_group]").val($(element).parent().parent().parent().find("input[type=hidden][name=wf_id_en]").val()); 291 $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_ret_list_new_group_email_id]").val($(element).parent().parent().parent().find("input[type=hidden][name=wf_email_id_en]").val()); 292 293 } else { 294 $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_ret_list_new_group]").val($(element).attr("data-mailchimp-workflow-id")); 295 $(element).parent().parent().parent().find("input[type=hidden][name=wf_id_ret_list_new_group_email_id]").val($(element).attr("data-mailchimp-workflow-email-id")); 296 } 297 $(element).parent().parent().parent().find(':input[type="submit"]').prop('disabled', false); 298 299} 300 301function disableMcNlSubmitButton() { 302 var mcSendButton = $('.ml-send-button'); 303 if ($('.sands_mc_radio_button') && $('.sands_mc_radio_button').length) { 304 // check if we have location cookie set to all or empty 305 var cookieStoredLocationIdentifier = $.cookie("event_location"); 306 if (!cookieStoredLocationIdentifier || (cookieStoredLocationIdentifier && cookieStoredLocationIdentifier == "all")) { 307 //create empty div wrapper 308 //$('.email--input').parent().parent().after('<div class="location-missing-text-wrapper my-3 text-center"></div>'); 309 $('.ml-send-button').after('<div class="location-missing-text-wrapper my-3 text-center"></div>'); 310 // display a message if user click on mcSendButton and button is disabled 311 $(mcSendButton).click(function (event) { 312 if ($('.location--missing').length) { 313 $('.location--missing').remove(); 314 } 315 //check if one of the radio buttons is checked 316 var checked = false;
317 $('.sands_mc_radio_button').each(function() { 318 if ($(this).is(':checked')) { 319 checked = true; 320 } 321 }); 322 if (!checked) { 323 event.preventDefault(); 324 var locationChooser = $('.location-chooser'); 325 if (locationChooser) { 326 var theMaybeSetPLLCookieValue = $.cookie('pll_language'); 327 if (theMaybeSetPLLCookieValue && (theMaybeSetPLLCookieValue == 'de')) { 328 $('.location-missing-text-wrapper').append('<p class="font-24 font-weight-bold text-white location--missing"> Bitte wählen Sie eine Edition </p>'); 329 } else { 330 $('.location-missing-text-wrapper').append('<p class="font-24 font-weight-bold text-white location--missing"> Please choose a location </p>'); 331 } 332 setTimeout(() => { 333 if ($('.location--missing').length) { 334 $('.location--missing').remove(); 335 } 336 }, 4000); 337 } 338 } 339 }); 340 } 341 } 342 343} 344 345function sands_mc_set_cookie_values(element, location) { 346 $(element).find("#INTEREST").val(location.location_mc_group_id); 347 var editionField = $($(element).find("#EDITION")).first(); 348 $(editionField).val(location.location_mc_editon_value); 349 if (location.location_mc_language == "de" && $(element).find("input[type=hidden][name=wf_id_de]").length && $(element).find("input[type=hidden][name=wf_email_id_de]").length) { 350 $(element).find("input[type=hidden][name=wf_id_ret_list_new_group]").val($(element).find("input[type=hidden][name=wf_id_de]").val()); 351 $(element).find("input[type=hidden][name=wf_id_ret_list_new_group_email_id]").val($(element).find("input[type=hidden][name=wf_email_id_de]").val()); 352 353 } else if (location.location_mc_language == "en" && $(element).find("input[type=hidden][name=wf_id_en]").length && $(element).find("input[type=hidden][name=wf_email_id_en]").length) { 354 $(element).find("input[type=hidden][name=wf_id_ret_list_new_group]").val($(element).find("input[type=hidden][name=wf_id_en]").val()); 355 $(element).find("input[type=hidden][name=wf_id_ret_list_new_group_email_id]").val($(element).find("input[type=hidden][name=wf_email_id_en]").val()); 356 357 } else { 358 $(element).find("input[type=hidden][name=wf_id_ret_list_new_group]").val(location.location_mc_wf_id); 359 $(element).find("input[type=hidden][name=wf_id_ret_list_new_group_email_id]").val(location.location_mc_wf_email_id); 360 } 361 $(element).find(".mc4wp-form-fields").append('<input type="hidden" name="_mc4wp_lists" value="'+ location.location_mc_list_id +'">'); 362} 363 364 365 366 367 368/* 369 370jQuery(window).on( "load", function() { 371 console.log( "window loaded" ); 372}); 373 374 375window.addEventListener('sands-mlc-location-selected', function (e, payload) { 376 console.log('sands-mlc-location-selected fired on window'); 377 378}); 379 380*/ 381
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.