1window.ppsettings = window.ppsettings || {}; 2window.ppsettings.imageFallback = getComputedStyle(document.documentElement).getPropertyValue("--image-fallback-path").trim().replace(/^["']|["']$/g, ""); 3var siteLanguage = "de"; 4var langObject = $("[data-language-obj]").data("language-obj"); 5if (!!langObject) { 6 siteLanguage = langObject.code; 7} 8var gaProperty = "UA-411685-51"; 9var disableStr = 'ga-disable-' + gaProperty; 10//include 1 11//****************************************** 12// browser test 13 14/** 15 * description: the default class for the overlay for all sites is "hide". 16 * if we have ie we add the class is-ie-lt-11 which overrides the hide class 17 * and shows the overlay. 18 * if the user decides to close the overlay we add the class "show-site". 19 * we do this because we still want to keep the ie11 class (in case we want to use it somewhere else). 20 */ 21 22var ua = window.navigator.userAgent; 23var msie = ua.indexOf('MSIE '); 24var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; 25if (msie > 0) { 26 // || isIE11) { 27 document.body.classList.add("is-ie-lt-11"); 28} 29function removeIncompatibleBrowserOverlay() { 30 document.body.classList.add("show-site"); 31} 32//****************************************** 33 34//first thing to do is disabling google analytics if necessary 35if (document.cookie.indexOf(disableStr + '=true') > -1) { 36 window[disableStr] = true; 37} 38window.pixelpoint = window.pixelpoint || {}; 39window.pixelpoint.ppComponents = window.pixelpoint.ppComponents || {}; 40window.pixelpoint.promises = window.pixelpoint.promises || {}; 41window.pixelpoint.settings = window.pixelpoint.settings || {}; 42$(document).foundation(); 43moment.locale('de'); 44window.pixelpoint.settings = { 45 relatedAjaxUrl: "/index.php?action=getRelatedPois&type=1732176051", 46 highlightSections: ["ubernachten", "wasser", "aktiv-natur", "essen-trinken", "wellness", "einkaufserlebnisse", "kultur", "top-angebote", "weitere-informationen", "sonstige-kategorien", "default"], 47 apiUrl: 'https://api.tmb.pixelpoint.biz/api/' 48}; 49//include 2 50window.pixelpoint.getElementDimensions = function ($element) { 51 var height = $element.height(); 52 var width = $element.width(); 53 if (height == 0) { 54 var $clone = $element.clone(); 55 if ($element.parents('.tabs-content').length) { 56 $clone.addClass("tabs-content"); 57 } 58 $clone.removeClass("collapsed"); 59 $("body").append($clone); 60 $clone.attr("style", "position: absolute !important; visibility: hidden !important; display: block !important"); 61 $clone.find("*").each(function () { 62 $(this).removeClass("collapsed"); 63 if (!$(this).is(":visible")) { 64 $(this).attr("style", "display: block !important;"); 65 } 66 }); 67 width = $clone.outerWidth(true); 68 height = $clone.outerHeight(true); 69 $clone.remove(); 70 } 71 return { 72 width: width, 73 height: height 74 }; 75}; 76//include 28 77jQuery(function () { 78 var utilities = { 79 formatPrice: function (value, simple, decimalSeparator) { 80 var numeric = parseFloat(value); 81 decimalSeparator = decimalSeparator || ","; 82 var simple = simple || false; 83 if (numeric % 1 === 0 && !simple) { 84 //whole number 85 numeric = numeric.toFixed(0); 86 numeric = numeric + ",-"; 87 } else { 88 numeric = numeric.toFixed(2); 89 numeric = numeric.toLocaleString("de-DE").replace(".", decimalSeparator); 90 //if(!simple) 91 // numeric +="-"; 92 } 93 return numeric; 94 }, 95 scrollTo: function (selectorOrOffset, ignoreHeader, additionalOffset, supressAnimation, callback) { 96 var offset = selectorOrOffset; 97 ignoreHeader = ignoreHeader || false; 98 additionalOffset = additionalOffset || 0; 99 supressAnimation = supressAnimation || false; 100 if (offset instanceof jQuery) {} 101 if (isNaN(offset)) { 102 var element = selectorOrOffset; 103 if (!(element instanceof jQuery)) var element = $(selectorOrOffset); 104 if (element.length == 0) return; 105 offset = element.offset().top; 106 offset = offset + additionalOffset; 107 if (!ignoreHeader) { 108 offset -= $(".header").height(); 109 } 110 } 111 if (!supressAnimation) { 112 $("html, body").animate({ 113 scrollTop: offset 114 }, 800, () => { 115 if (callback) { 116 callback(); 117 } 118 }); 119 } else { 120 $("html, body").scrollTop(offset); 121 if (callback) { 122 callback(); 123 } 124 } 125 }, 126 parseUrl: function (url) { 127 var splitted = url.split("?"); 128 var baseUrl = splitted[0]; 129 var queryParameters = {}; 130 if (splitted.length > 1) { 131 var queryParts = splitted[1].split("&"); 132 $.each(queryParts, function (index, value) { 133 var kvp = value.split("="); 134 if (kvp.length < 2) return true; 135 queryParameters[kvp[0]] = kvp[1]; 136 }); 137 } 138 return { 139 baseUrl: baseUrl, 140 queryParameters: queryParameters 141 }; 142 }, 143 buildUrl: function (parsedUrl) { 144 var queryParts = []; 145 $.each(parsedUrl.queryParameters, function (key, value) { 146 queryParts.push(key + "=" + value); 147 }); 148 if ($.isEmptyObject(parsedUrl.queryParameters)) { 149 return parsedUrl.baseUrl; 150 } 151 return parsedUrl.baseUrl + "?" + queryParts.join("&"); 152 }, 153 addParameterToUrl: function (url, key, parameter, encodeUrls) { 154 encodeUrls = encodeUrls || false; 155 var parsedUrl = utilities.parseUrl(url); 156 key = encodeURI(key); 157 if (!encodeUrls) parameter = encodeURI(parameter);else parameter = encodeURIComponent(parameter); 158 parsedUrl.queryParameters[key] = parameter; 159 return utilities.buildUrl(parsedUrl); 160 }, 161 removeParameterFromUrl(url, key) { 162 var parsedUrl = utilities.parseUrl(url); 163 key = encodeURI(key); 164 if (!!parsedUrl.queryParameters[key]) delete parsedUrl.queryParameters[key]; 165 return utilities.buildUrl(parsedUrl); 166 }, 167 getOverflows: function ($el) { 168 var rect = $el[0].getBoundingClientRect(); 169 var offscreen = { 170 top: 0, 171 right: 0, 172 bottom: 0, 173 left: 0 174 }; 175 if (rect.left < 0) offscreen.left = Math.abs(rect.left); 176 if (rect.top < 0) offscreen.top = Math.abs(rect.top); 177 if (rect.right > window.innerWidth) offscreen.right = Math.abs(rect.right - window.innerWidth); 178 if (rect.bottom > window.innerHeight) offscreen.bottom = Math.abs(rect.bottom - window.innerHeight); 179 return offscreen; 180 }, 181 isTouchDevice() { 182 return "ontouchstart" in window || "onmsgesturechange" in window; 183 184 /* 185 'ontouchstart' => works on most browsers 186 'onmsgesturechange' => works on IE10 with some false positives 187 */ 188 }, 189 isIE() { 190 var myNav = navigator.userAgent.toLowerCase(); 191 return myNav.indexOf("msie") != -1 ? parseInt(myNav.split("msie")[1]) : false;
192 }, 193 hasLocalStorage() { 194 if (!!window.localStorage) { 195 try { 196 localStorage.setItem("test", "test"); 197 localStorage.removeItem("test"); 198 return true; 199 } catch (e) { 200 return false; 201 } 202 } 203 return false; 204 }, 205 addUrlParameters(url, urlParameters) { 206 if (!urlParameters || $.isEmptyObject(urlParameters)) { 207 return url; 208 } 209 var parser = document.createElement("a"); 210 parser.href = url; 211 if (!parser.hash) { 212 parser.hash = "#"; 213 } 214 if (parser.hash.indexOf("?") !== -1) { 215 parser.hash += "&" + $.param(urlParameters); 216 } else { 217 parser.hash += "?" + $.param(urlParameters); 218 } 219 return parser.href; 220 }, 221 isIframe: () => { 222 try { 223 return window.self !== window.top; 224 } catch (e) { 225 return true; 226 } 227 }, 228 getMapRegion: id => { 229 var region = window.pixelpoint.domainService.get('region'); 230 var regionOnMap = window.pixelpoint.domainService.get('regionOnMap'); 231 if (!!region && !!regionOnMap) { 232 if (region == id) { 233 return regionOnMap; 234 } 235 } 236 return id; 237 }, 238 getLanguageId: () => { 239 var languageId = 0; 240 var langObject = $("[data-language-obj]").data("language-obj"); 241 if (!!langObject) { 242 languageId = langObject.id; 243 } 244 return languageId; 245 }, 246 getAjaxUrl: (urlAppend, languageId) => { 247 var languagesOnSameDomain = window.pixelpoint.domainService.get('languagesOnSameDomain'); 248 var ajaxUrlParts = []; 249 if (!languagesOnSameDomain) { 250 // if languages are running on different domains we return a language independent url 251 ajaxUrlParts = ['/index.php']; 252 } else { 253 //first we define a language if, if not given we try to take it from the document 254 if (!languageId && languageId !== 0) { 255 languageId = utilities.getLanguageId(); 256 } 257 //we check if pretty urls are defined 258 var ajaxPrettyUrls = window.pixelpoint.domainService.get('sameDomainAjaxUrls'); 259 if (!!ajaxPrettyUrls && !!ajaxPrettyUrls[languageId]) { 260 ajaxUrlParts = [ajaxPrettyUrls[languageId]]; 261 } else { 262 ajaxUrlParts = ['/index.php']; 263 } 264 } 265 if (!!urlAppend) { 266 // we replace any occurence of index.php! 267 urlAppend = urlAppend.replace('/index.php', ''); 268 if (urlAppend.length > 0 && urlAppend.charAt(0) === '?') urlAppend = urlAppend.slice(1); 269 if (!!urlAppend) ajaxUrlParts.push(urlAppend); 270 } 271 return ajaxUrlParts.join('?'); 272 }, 273 getSysPageUrl: languageId => { 274 var languagesOnSameDomain = window.pixelpoint.domainService.get('languagesOnSameDomain'); 275 var result = { 276 baseUrl: window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : ''), 277 useAjaxRenderPageId: true, 278 ajaxRenderPageId: window.pixelpoint.domainService.get("ajaxRenderPage") 279 }; 280 if (!languagesOnSameDomain) { 281 // if languages are running on different domains we return a language independent url 282 result.baseUrl = `${result.baseUrl}/index.php`; 283 } else { 284 //first we define a language if, if not given we try to take it from the document 285 if (!languageId && languageId !== 0) { 286 languageId = utilities.getLanguageId(); 287 } 288 var ajaxPrettyUrls = window.pixelpoint.domainService.get('ajaxModuleReloadPrettyUrls'); 289 if (!!ajaxPrettyUrls && !!ajaxPrettyUrls[languageId]) { 290 result.baseUrl = `${result.baseUrl}/${ajaxPrettyUrls[languageId]}`; 291 result.useAjaxRenderPageId = false; 292 } else { 293 result.baseUrl = `${result.baseUrl}/index.php`; 294 } 295 } 296 return result; 297 } 298 }; 299 window.pixelpoint.utilities = utilities; 300}); 301//include 2 302window.pixelpoint.isMobile = { 303 Android: function () { 304 return navigator.userAgent.match(/Android/i); 305 }, 306 BlackBerry: function () { 307 return navigator.userAgent.match(/BlackBerry/i); 308 }, 309 iOS: function () { 310 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 311 }, 312 Opera: function () { 313 return navigator.userAgent.match(/Opera Mini/i); 314 }, 315 Windows: function () { 316 return navigator.userAgent.match(/IEMobile/i); 317 }, 318 anyMobile: function () { 319 // device detection 320 return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
320sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4)); 321 }, 322 any: function () { 323 return this.Android() || this.BlackBerry() || this.iOS() || this.Opera() || this.Windows() || this.anyMobile(); 324 }, 325 isMobileWidth: function () { 326 if (!!window.matchMedia) { 327 var matchObject = window.matchMedia("(max-width: 959px)"); 328 if (matchObject.matches) { 329 return true; 330 } 331 } 332 return false; 333 } 334}; 335window.pixelpoint.debug = function () { 336 let localUrls = ['localhost', '192.168.1.105', '10.0.0.129']; 337 let prepend = 'debugger'; 338 let checkIfLocal = () => { 339 for (var i in localUrls) { 340 if (window.location.href.indexOf(localUrls[i]) > -1) { 341 return true; 342 } 343 } 344 return false; 345 }; 346 let dbg = { 347 write: message => { 348 if (checkIfLocal()) { 349 console.log(message); 350 } 351 }, 352 writeFromData(dataAttr, title) { 353 if (checkIfLocal()) { 354 title = title || ''; 355 dataAttr = dataAttr.replace('data-', ''); 356 if ($(`[data-${dataAttr}]`).length > 0) { 357 $(`[data-${dataAttr}]`).each((index, element) => { 358 console.log([`${prepend}: ${title}`, $(element).data(dataAttr)]); 359 }); 360 } else { 361 console.log([`${prepend}: ${title}`, 'no data attributes found']); 362 } 363 } 364 } 365 }; 366 return dbg; 367}(); 368//include 28 369jQuery(function () { 370 var defaultExpirationTime = 3600; //1 hour 371 var storageKey = "ppSession"; 372 var storageSim = { 373 storage: {}, 374 getItem(key) { 375 if (!!this.storage[key]) { 376 return this.storage[key]; 377 } 378 return null; 379 }, 380 setItem(key, value) { 381 this.storage[key] = value; 382 } 383 }; 384 if (typeof window.Storage !== "undefined") { 385 var privateFunctions = { 386 getStorage: function () { 387 if (!window.pixelpoint.utilities.hasLocalStorage()) { 388 return storageSim; 389 } 390 return window.localStorage; 391 }, 392 setLocalStorageItem: function (key, value) { 393 var stringValue = JSON.stringify(value);
394 this.getStorage().setItem(key, stringValue); 395 }, 396 getLocalStorageItem: function (key) { 397 var retrievedObject = this.getStorage().getItem(key); 398 if (retrievedObject === null) return null; 399 return JSON.parse(retrievedObject); 400 //return null; 401 }, 402 update: function () { 403 var loaded = this.getLocalStorageItem(storageKey); 404 if (loaded == null) { 405 loaded = { 406 data: {}, 407 expiration: moment().unix() 408 }; 409 } 410 loaded.expiration = moment().add(defaultExpirationTime, 'seconds').unix(); 411 this.setLocalStorageItem(storageKey, loaded); 412 }, 413 expired: function () { 414 var loaded = this.getLocalStorageItem(storageKey); 415 if (loaded != null && moment(loaded.expiration, 'X').isBefore(moment())) { 416 return true; 417 } 418 return false; 419 }, 420 clear: function () { 421 var loaded = { 422 data: {}, 423 expiration: moment().add(defaultExpirationTime, 'seconds').unix() 424 }; 425 this.setLocalStorageItem(storageKey, loaded); 426 }, 427 checkAndUpdate: function () { 428 if (this.expired()) this.clear();else this.update(); 429 }, 430 get: function (key) { 431 this.checkAndUpdate(); 432 var loaded = this.getLocalStorageItem(storageKey); 433 if (loaded == null) { 434 return null; 435 } 436 if (loaded.data.hasOwnProperty(key)) return loaded.data[key];else return null; 437 }, 438 set: function (key, value) { 439 this.checkAndUpdate(); 440 var loaded = this.getLocalStorageItem(storageKey); 441 if (loaded != null) { 442 loaded.data[key] = value; 443 this.setLocalStorageItem(storageKey, loaded); 444 } 445 } 446 }; 447 privateFunctions.checkAndUpdate(); 448 window.pixelpoint.sessionService = { 449 get: function (key) { 450 return privateFunctions.get(key); 451 }, 452 set: function (key, value) { 453 privateFunctions.set(key, value); 454 }, 455 refresh: function () { 456 privateFunctions.checkAndUpdate(); 457 } 458 }; 459 } else { 460 window.pixelpoint.sessionService = {}; 461 } 462}); 463//include 28 464jQuery(function () { 465 var sessionKey = "ppFilters"; 466 var functions = { 467 getSessionKey: function (group) { 468 group = group || null; 469 if (group == null) return sessionKey; 470 return `${sessionKey}:${group}`; 471 }, 472 get: function (key, defaultValue, group) { 473 var sessionKeyToUse = functions.getSessionKey(group); 474 defaultValue = defaultValue || null; 475 var filters = window.pixelpoint.sessionService.get(sessionKeyToUse); 476 if (!key) { 477 if (!filters) return null; 478 return filters; 479 } else { 480 if (!!filters || !filters.hasOwnProperty(key)) return defaultValue; 481 return filters[key]; 482 } 483 }, 484 set: function (key, value, group) { 485 var sessionKeyToUse = functions.getSessionKey(group); 486 var filters = window.pixelpoint.sessionService.get(sessionKeyToUse); 487 if (!filters) { 488 filters = {}; 489 filters[key] = value; 490 window.pixelpoint.sessionService.set(sessionKeyToUse, filters); 491 } else { 492 filters[key] = value; 493 window.pixelpoint.sessionService.set(sessionKeyToUse, filters); 494 } 495 }, 496 delete: function (key, group) { 497 var sessionKeyToUse = functions.getSessionKey(group); 498 var filters = window.pixelpoint.sessionService.get(sessionKeyToUse); 499 if (!!filters) delete filters[key]; 500 window.pixelpoint.sessionService.set(sessionKeyToUse, filters); 501 }, 502 clear: function (group) { 503 var sessionKeyToUse = functions.getSessionKey(group); 504 window.pixelpoint.sessionService.set(sessionKeyToUse, {}); 505 } 506 }; 507 window.pixelpoint.filterManager = functions; 508}); 509//include 28 510jQuery(function () { 511 var pubSubElement = $({}); 512 var pubSub = { 513 subscribe: function () { 514 pubSubElement.on.apply(pubSubElement, arguments); 515 return this; 516 }, 517 unsubscribe: function () { 518 pubSubElement.off.apply(pubSubElement, arguments); 519 return this; 520 }, 521 publish: function () { 522 pubSubElement.trigger.apply(pubSubElement, arguments); 523 return this; 524 }, 525 events: { 526 //availabilityReady:"availabilityReady", 527 serviceSearchReady: "serviceSearchReady", 528 cartUpdated: "cartUpdated", 529 filtersReady: "filtersReady", 530 loader: "loader", 531 checkBookmarks: "checkBookmarks", 532 cartRedirect: "cartRedirect", 533 availabilityReady: "availabilityReady", 534 slickCalendarDateSelected: "slickCalendarDateSelected", 535 slidersEventChange: "range-slider:change",
536 slidersEventEnable: "range-slider:enable", 537 slidersEventDisable: "range-slider:disable", 538 belegungChange: "belegung:change", 539 airBnBSearch: "airBnB:change", 540 switchHide: "switch:hide", 541 switchClass: "switch:class", 542 initAirBnBMap: "airBnB:init", 543 switchSetDefault: "switchSetDefault", 544 toggleOpenBefore: "toggleOpenBefore", 545 toggleOpenAfter: "toggleOpenAfter", 546 toggleCloseBefore: "toggleCloseBefore", 547 toggleCloseAfter: "toggleCloseAfter", 548 modalOpen: "lityModalOpen", 549 categoryChanged: "categoryChanged" 550 } 551 }; 552 window.pixelpoint.pubSub = pubSub; 553}); 554//include 28 555jQuery(function () { 556 var templateCache = {}; 557 var manager = { 558 loadTemplate(id) { 559 if (!templateCache[id]) { 560 var templateString = $("script#" + id).html(); 561 templateCache[id] = _.template(templateString); 562 } 563 return templateCache[id]; 564 }, 565 getTemplate(id, data) { 566 var template = manager.loadTemplate(id); 567 if (!template) return null; 568 var templateData = _.extend({}, data, { 569 utilities: window.pixelpoint.utilities 570 }); 571 var result = template(templateData); 572 result = _.isFunction(result) ? result(templateData) : result; 573 return $(result); 574 } 575 }; 576 window.pixelpoint.templateManager = manager; 577}); 578var sprintf = (str, args) => { 579 if (args.length > 0) { 580 args.reverse(); 581 while (args.length > 0) { 582 var arg = args.pop(); 583 str = str.replace("%s", arg); 584 } 585 } 586 return str; 587}; 588var translator = { 589 translate: (key, def, args) => { 590 if (!window.pixelpoint.translations || !window.pixelpoint.translations[key] || typeof window.pixelpoint.translations[key] !== "string") { 591 return !!args ? sprintf(def, args) : def; 592 } 593 var translation = window.pixelpoint.translations[key]; 594 return !!args ? sprintf(translation, args) : translation; 595 } 596}; 597window.ppt = translator; 598var settings = { 599 "www.reiseland-brandenburg.de": { 600 root: 1, 601 ajaxRenderPage: 1568, 602 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de' 603 }, 604 "test.reiseland-brandenburg.de": { 605 root: 1, 606 ajaxRenderPage: 1568, 607 resourcesBaseUrl: 'https://test.reiseland-brandenburg.de', 608 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/', 609 mapUrl: 'https://maps.reiseland-brandenburg.de/test/' 610 }, 611 "live.reiseland-brandenburg.de": { 612 root: 1, 613 ajaxRenderPage: 1568, 614 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de' 615 }, 616 "dev.tib.pixelpoint.biz": { 617 root: 2437, 618 ajaxRenderPage: 2485, 619 //2477, 620 resourcesBaseUrl: 'https://test.reiseland-brandenburg.de' 621 }, 622 "en.tib.pixelpoint.biz": { 623 root: 2437, 624 ajaxRenderPage: 2485, 625 //2477, 626 resourcesBaseUrl: 'https://test.reiseland-brandenburg.de' 627 }, 628 "live.tib.pixelpoint.biz": { 629 root: 2437, 630 ajaxRenderPage: 2485, 631 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de' 632 }, 633 "www.tagen-in-brandenburg.de": { 634 root: 2437, 635 ajaxRenderPage: 2485, 636 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de' 637 }, 638 "test.tagen-in-brandenburg.de": { 639 root: 2437, 640 ajaxRenderPage: 2485, 641 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 642 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 643 }, 644 "www.mice-brandenburg.com": { 645 root: 2437, 646 ajaxRenderPage: 2485, 647 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de' 648 }, 649 "test.mice-brandenburg.com": { 650 root: 2437, 651 ajaxRenderPage: 2485, 652 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 653 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 654 }, 655 "dev-test.reiseland-brandenburg.de": { 656 root: 2661, 657 ajaxRenderPage: 2712, 658 resourcesBaseUrl: 'https://test.reiseland-brandenburg.de', 659 mapUrl: 'https://maps-ds.reiseland-brandenburg.de/', 660 //'https://maps.dahme-seenland.de/', 661 assetFolder: 'dahme-seen/' 662 }, 663 "dev-ds.reiseland-brandenburg.de": { 664 //www.dahme-seen.de 665 root: 2661, 666 ajaxRenderPage: 2712, 667 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 668 //'https://test.reiseland-brandenburg.de', 669 mapUrl: 'https://maps-ds.reiseland-brandenburg.de/', 670 //'https://maps.dahme-seenland.de/', 671 assetFolder: 'dahme-seen/' 672 }, 673 "www.dahme-seenland.de": { 674 //www.dahme-seen.de 675 root: 2661, 676 ajaxRenderPage: 2712, 677 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 678 // 679 mapUrl: 'https://maps.dahme-seenland.de/', 680 //globalMapUrl: 'https://www.dahme-seenland.de/karte/', 681 assetFolder: 'dahme-seen/' 682 }, 683 "test.dahme-seenland.de": { 684 //www.dahme-seen.de 685 root: 2661, 686 ajaxRenderPage: 2712, 687 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 688 // 689 mapUrl: 'https://maps.dahme-seenland.de/', 690 //globalMapUrl: 'https://www.dahme-seenland.de/karte/', 691 assetFolder: 'dahme-seen/', 692 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 693 }, 694 "test-flaeming.reiseland-brandenburg.de": { 695 root: 2877, 696 ajaxRenderPage: 2886, 697 resourcesBaseUrl: 'https://maps-flaeming.reiseland-brandenburg.de/', 698 mapUrl: 'https://maps-flaeming.reiseland-brandenburg.de/', 699 assetFolder: 'flaeming/', 700 region: 12, 701 regionOnMap: 200 702 }, 703 "live-tourism.reiseland-brandenburg.de": { 704 //www.dahme-seen.de 705 root: 2947, 706 ajaxRenderPage: 3067, 707 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 708 mapUrl: 'https://www.reiseland-brandenburg.de/karte/' 709 //globalMapUrl: 'https://www.reiseland-brandenburg.de/karte/' 710 }, 711 "test-tourism.reiseland-brandenburg.de": { 712 //www.dahme-seen.de 713 root: 2947, 714 ajaxRenderPage: 3067, 715 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 716 // 717 mapUrl: 'https://www.reiseland-brandenburg.de/karte/' 718 //globalMapUrl: 'https://www.reiseland-brandenburg.de/karte/' 719 }, 720 "dev-fl.reiseland-brandenburg.de": { 721 root: 2805, 722 ajaxRenderPage: 2923, 723 resourcesBaseUrl: 'https://dev-fl.reiseland-brandenburg.de',
724 mapUrl: 'www.reiseregion-flaeming.de/karte', 725 //globalMapUrl: 'www.reiseregion-flaeming.de/karte', 726 region: 12, 727 regionOnMap: 200 728 }, 729 "www.brandenburg-tourism.com": { 730 //www.dahme-seen.de 731 root: 2947, 732 ajaxRenderPage: 3067, 733 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 734 // 735 mapUrl: 'https://maps.brandenburg-tourism.com/' 736 //globalMapUrl: 'https://maps.brandenburg-tourism.com/' 737 }, 738 "test.brandenburg-tourism.com": { 739 //www.dahme-seen.de 740 root: 2947, 741 ajaxRenderPage: 3067, 742 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 743 // 744 mapUrl: 'https://maps.brandenburg-tourism.com/', 745 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 746 //globalMapUrl: 'https://maps.brandenburg-tourism.com/' 747 }, 748 "live-flaeming.reiseland-brandenburg.de": { 749 root: 2877, 750 ajaxRenderPage: 2886, 751 resourcesBaseUrl: 'https://maps-flaeming.reiseland-brandenburg.de/', 752 mapUrl: 'https://maps-flaeming.reiseland-brandenburg.de/', 753 globalMapUrl: 'https://maps-flaeming.reiseland-brandenburg.de/', 754 assetFolder: 'flaeming/', 755 region: 12, 756 regionOnMap: 200 757 }, 758 "www.reiseregion-flaeming.de": { 759 root: 2877, 760 ajaxRenderPage: 2886, 761 resourcesBaseUrl: 'https://www.reiseregion-flaeming.de/karte/', 762 mapUrl: 'https://maps.reiseregion-flaeming.de/', 763 //globalMapUrl: 'https://wwww.reiseregion-flaeming.de/karte/', 764 assetFolder: 'flaeming/', 765 region: 12, 766 regionOnMap: 200 767 },
768 "test.reiseregion-flaeming.de": { 769 root: 2877, 770 ajaxRenderPage: 2886, 771 resourcesBaseUrl: 'https://www.reiseregion-flaeming.de/karte/', 772 mapUrl: 'https://maps.reiseregion-flaeming.de/', 773 //globalMapUrl: 'https://wwww.reiseregion-flaeming.de/karte/', 774 assetFolder: 'flaeming/', 775 region: 12, 776 regionOnMap: 200, 777 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 778 }, 779 "ruppiner-seenland.reiseland-brandenburg.de": { 780 root: 4206, 781 ajaxRenderPage: 4211, 782 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 783 mapUrl: 'https://maps-ruppiner-seenland.reiseland-brandenburg.de/', 784 globalMapUrl: 'https://ruppiner-seenland.reiseland-brandenburg.de/karte/', 785 assetFolder: 'ruppiner-seenland/', 786 contactPages: { 787 0: '/kontaktformular/', 788 1: '/en/contact-form/' 789 }, 790 languagesOnSameDomain: true, 791 region: 4, 792 regionOnMap: 4 793 }, 794 "www.ruppiner-seenland.de": { 795 root: 4206, 796 ajaxRenderPage: 4211, 797 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 798 mapUrl: 'https://www.ruppiner-seenland.de/karte/', 799 //'https://maps.ruppiner-seenland.de/', 800 globalMapUrl: 'https://www.ruppiner-seenland.reiseland.de/karte/', 801 assetFolder: 'ruppiner-seenland/', 802 contactPages: { 803 0: '/kontaktformular/', 804 1: '/en/contact-form/' 805 }, 806 languagesOnSameDomain: true, 807 region: 4, 808 regionOnMap: 4 809 }, 810 "test.ruppiner-seenland.de": { 811 root: 4206, 812 ajaxRenderPage: 4211, 813 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 814 mapUrl: 'https://www.ruppiner-seenland.de/karte/', 815 //'https://maps.ruppiner-seenland.de/', 816 globalMapUrl: 'https://www.ruppiner-seenland.reiseland.de/karte/', 817 assetFolder: 'ruppiner-seenland/', 818 contactPages: { 819 0: '/kontaktformular/', 820 1: '/en/contact-form/' 821 }, 822 languagesOnSameDomain: true, 823 region: 4, 824 regionOnMap: 4, 825 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 826 }, 827 "ruppiner-seenland.live.reiseland-brandenburg.de": { 828 root: 4206, 829 ajaxRenderPage: 4211, 830 resourcesBaseUrl: 'https://static.reiseland-brandenburg.de', 831 mapUrl: 'https://maps-ruppiner-seenland.reiseland-brandenburg.de/', 832 globalMapUrl: 'https://ruppiner-seenland.reiseland-brandenburg.de/karte/', 833 assetFolder: 'ruppiner-seenland/', 834 contactPages: { 835 0: '/kontaktformular/', 836 1: '/en/contact-form/' 837 }, 838 languagesOnSameDomain: true, 839 region: 4, 840 regionOnMap: 4 841 }, 842 "localhost": { 843 root: 1, 844 ajaxRenderPage: 1568, 845 resourcesBaseUrl: 'https://test.reiseland-brandenburg.de', 846 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 847 }, 848 "default": { 849 root: 1, 850 ajaxRenderPage: 1568, 851 resourcesBaseUrl: `${window.location.protocol}//${window.location.hostname}:${window.location.port}`, 852 //assetFolder: '' 853 assetFolder: 'brandenburg/', 854 languagesOnSameDomain: false, 855 //if true all ajax requests will explicitely include the L parameter (language stuff) 856 ajaxModuleReloadPrettyUrls: { 857 0: 'sys/sys-render-module/', 858 1: 'en/sys/sys-render-module/' 859 }, 860 sameDomainAjaxUrls: { 861 0: '/index.php', 862 1: '/en/' 863 }, 864 apiEndpoint: 'https://api.tmb.pixelpoint.biz/api/' 865 } 866}; 867var privateFunctions = { 868 get: key => { 869 if (!!settings[window.location.hostname] && Object.keys(settings[window.location.hostname]).includes(key) /* !!settings[window.location.hostname][key] */) { 870 return settings[window.location.hostname][key]; 871 } else if (!!settings.default && Object.keys(settings.default).includes(key)) { 872 return settings.default[key]; 873 } 874 return null; 875 } 876}; 877window.pixelpoint.domainService = { 878 get: privateFunctions.get 879}; 880//include 3 881jQuery(function () { 882 if (window.pixelpoint.isMobile.any() !== null) { 883 $('.main-nav').removeClass('mousehover'); // disabling mouse hover if mobile(touch) device 884 $('.menu-level-1 > a').on("touchstart", function (e) { 885 e.preventDefault(); 886 //console.log('click'); 887 if ($(this).parent().hasClass('hover')) { 888 //console.log('stripping hover'); 889 $('.menu-level-1').removeClass('hover'); 890 } else { 891 $('.menu-level-1').removeClass('hover'); 892 $(this).parent().addClass('hover'); 893 //console.log('touching hover'); 894 } 895 }); 896 $('.supersection > a').on("touchstart", function (e) { 897 e.preventDefault(); 898 setTimeout(() => { 899 $('.supersection').removeClass('hover'); 900 $(this).parent().toggleClass('hover'); 901 }, 10); 902 }); 903 } 904}); 905//include 8 906jQuery(function () { 907 // re-init components whose width/height is computed while the .showmore was still display:none (e.g. slick sliders) 908 function reinitializeShowMoreChildren(target) { 909 target.find(".slick-initialized").each(function () { 910 var exposed = $(this).data("exposed"); 911 if (!!exposed && !!exposed.reinitialize) exposed.reinitialize(); 912 }); 913 target.find(".more-wrapper").each(function () { 914 var exposed = $(this).data("show-more"); 915 if (!!exposed && !!exposed.init) exposed.init(); 916 }); 917 target.find(".calendar-display").each(function () { 918 if (!$(this).hasClass("slick-initialized")) $(this).ppCalendarDisplay(); 919 }); 920 } 921 var privateFunctions = { 922 initShowMore($this) { 923 if (Foundation.MediaQuery.current == "small" && $this.data("xs-max-rows")) { 924 var maxRowXs = parseInt($this.data("xs-max-rows")); 925 if (maxRowXs > 0) { 926 var $readMoreContent = $this; 927 var $visibleContent = $readMoreContent.prev(); 928 var visibleElementsNr = $visibleContent.find("div.item").length; 929 var $newHiddenElements = ""; 930 var $newVisibleElements = ""; 931 if (visibleElementsNr > maxRowXs) { 932 var i = 0; 933 $visibleContent.find("div.item").each(function () { 934 i++; 935 if (i > maxRowXs) { 936 $newHiddenElements += '<div class="' + $(this).attr("class") + '">' + $(this).html() + '</div>'; 937 $(this).remove(); 938 } 939 });
940 $readMoreContent.prepend($newHiddenElements); 941 } else { 942 var i = visibleElementsNr; 943 $readMoreContent.find("div.item").each(function () { 944 i++; 945 if (i <= maxRowXs) { 946 $newVisibleElements += '<div class="' + $(this).attr("class") + '">' + $(this).html() + '</div>'; 947 $(this).remove(); 948 } 949 }); 950 $visibleContent.prepend($newVisibleElements); 951 if ($readMoreContent.find("div.item").length == 0) { 952 $readMoreContent.next().hide(); 953 } 954 } 955 } 956 } 957 var dimensions = window.pixelpoint.getElementDimensions($this); 958 var multiplier = null; 959 if ($this.data("multiply-height")) { 960 multiplier = parseInt($this.data("multiply-height")); 961 if (isNaN(multiplier)) multiplier = 1; 962 dimensions.height *= multiplier; 963 } 964 if ($this.data("multiply-width")) { 965 multiplier = parseInt($this.data("multiply-width")); 966 if (isNaN(multiplier)) multiplier = 1; 967 dimensions.width *= multiplier; 968 } 969 $this.data("width", dimensions.width); 970 $this.data("height", dimensions.height); 971 if (!$this.hasClass("collapsed")) { 972 $this.css("max-height", dimensions.height); 973 } 974 }, 975 open($this) { 976 if ($this.length == 0) return; 977 if ($this.hasClass('active')) this.toggle($this); 978 }, 979 close($this) { 980 if ($this.length == 0) return; 981 if (!$this.hasClass('active')) this.toggle($this); 982 }, 983 toggle($this) { 984 $this.toggleClass('active'); 985 var id = $this.attr('data-target'); 986 var label = $this.siblings('label:first'); 987 label.toggleClass('active'); 988 if ($this.attr('buttontext')) { 989 label = $this; 990 } 991 if (label.length == 0) { 992 label = $this.find(".text[data-active]"); 993 } 994 var target = $('[data-id=' + id + ']'); 995 if (target.data("height")) { 996 if (target.hasClass("collapsed")) { 997 target.removeClass("collapsed").addClass("collapsing"); 998 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleOpenBefore, target); 999 setTimeout(function () { 1000 // the stored height comes from a detached clone and can be too small, so never go below the real content height 1001 target.removeClass("collapsing").css("max-height", Math.max(target.data("height") + 150, target.prop("scrollHeight"))); 1002 setTabIndexForElements(target, "0"); 1003 focusFirstFocusableElement(target); 1004 // width is already correct here (only max-height is still animating), no need to wait for transitionend 1005 reinitializeShowMoreChildren(target); 1006 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleOpenAfter, target); 1007 }, 10); 1008 } else { 1009 target.addClass("collapsing").removeAttr("style"); 1010 var $scrollToElement = $this.prev(); 1011 if ($this.parent().hasClass('scrollUpOnCloseReadMore')) { 1012 $scrollToElement = $this.parent(); 1013 } else if ($this.parent().parent().hasClass('scrollUpOnCloseReadMore')) { 1014 $scrollToElement = $this.parent().parent(); 1015 } else if ($this.parent().parent().parent().hasClass('scrollUpOnCloseReadMore')) { 1016 $scrollToElement = $this.parent().parent().parent(); 1017 } else {} 1018 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleCloseBefore, target); 1019 target.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function () { 1020 if ($this.hasClass("read-more-button-new")) { 1021 $("html, body").animate({ 1022 scrollTop: $scrollToElement.offset().top - $('.header-wrapper .header').height() - 30 1023 }, 800); 1024 } else { 1025 $("html, body").animate({ 1026 scrollTop: $scrollToElement.offset().top - $('.header-wrapper .header').height() - 10 1027 }, 800); 1028 } 1029 setTabIndexForElements(target, "-1"); 1030 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleCloseAfter, target); 1031 }); 1032 } 1033 } else { 1034 target.toggleClass('collapsed'); 1035 if (target.hasClass("collapsed")) { 1036 setTabIndexForElements(target, "-1"); 1037 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleCloseAfter, target); 1038 } else { 1039 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleOpenBefore, target); 1040 setTabIndexForElements(target, "0"); 1041 focusFirstFocusableElement(target); 1042 // no CSS transition happens on this branch, so the transitionend handler below never fires - reinit here instead 1043 reinitializeShowMoreChildren(target); 1044 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.toggleOpenAfter, target); 1045 } 1046 } 1047 if (label) { 1048 var active_text = label.attr('data-active'); 1049 var text = label.html(); 1050 label.html(active_text); 1051 label.attr('data-active', text); 1052 label.attr('title', active_text); 1053 } 1054 if ($this.data("default-title") && $this.data("close-title")) { 1055 var title = ""; 1056 if ($this.hasClass("active")) { 1057 title = $this.data("default-title"); 1058 } else { 1059 title = $this.data("close-title"); 1060 } 1061 $this.attr("title", title); 1062 } 1063 } 1064 }; 1065 $('.showmore').each(function () { 1066 privateFunctions.initShowMore($(this)); 1067 }); 1068 window.pixelpoint.ppComponents.showMore = { 1069 init: privateFunctions.initShowMore, 1070 open: privateFunctions.open, 1071 close: privateFunctions.close, 1072 toggle: privateFunctions.toggle 1073 }; 1074 $('body').on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', '.showmore', function (e) { 1075 var target = $(e.target); 1076 if (target.hasClass("collapsing")) { 1077 target.removeClass("collapsing").addClass("collapsed"); 1078 } 1079 reinitializeShowMoreChildren(target); 1080 }); 1081 1082 // $('button.einklappen').click(function (e) { 1083 $('body').on('click', 'button.einklappen', function (e) { 1084 e.preventDefault(); 1085 var $this = $(this); 1086 privateFunctions.toggle($this); 1087 }); 1088}); 1089 1090// Helper function to focus first focusable element 1091function focusFirstFocusableElement(container) { 1092 var focusableElements = container.find('a, button, input, textarea, select, [tabindex]:not
1092([tabindex="-1"])').filter(':visible'); 1093 if (focusableElements.length > 0) { 1094 focusableElements.first().focus(); 1095 } 1096} 1097 1098// Helper function to set tabindex for all focusable elements within a container 1099function setTabIndexForElements(container, tabIndex) { 1100 var focusableElements = container.find('a, button, input, textarea, select, [tabindex]'); 1101 focusableElements.each(function () { 1102 var element = $(this); 1103 if (element.attr('data-tabindex') !== undefined) { 1104 return; // Skip this element, preserve its custom tabindex 1105 } 1106 element.attr('tabindex', tabIndex); 1107 1108 // select2 has ah special structure, we need to hide element to make it not focusable 1109 if (element.parent().find('.select2').length > 0) { 1110 element.parent().find('.select2').each(function () { 1111 $(this).css('display', tabIndex === "-1" ? "none" : "inline-block"); 1112 }); 1113 } 1114 }); 1115} 1116//include 11 1117jQuery(function () { 1118 const setCalendarPosition = ($this, calendarContainer) => { 1119 if ($("html").hasClass("internet-explorer") || $("html").hasClass("microsoft-edge")) { 1120 var ancestor = $this.closest("#searchcontainer"); 1121 if (ancestor.length > 0) { 1122 var distanceLeft = $this.offset().left - ancestor.offset().left; 1123 var distanceRight = ancestor.offset().left + ancestor.width() - ($this.offset().left + $this.width()); 1124 if (distanceLeft > distanceRight) { 1125 calendarContainer.removeClass('set-left').addClass("set-right"); 1126 } else { 1127 calendarContainer.removeClass('set-right').addClass("set-left"); 1128 } 1129 } 1130 } else /*if (window.pixelpoint.isMobile.any())*/{ 1131 if (calendarContainer.length > 0) { 1132 var boundingRect = calendarContainer[0].getBoundingClientRect(); 1133 if (!!boundingRect) { 1134 if (boundingRect.left < 0) { 1135 calendarContainer.removeClass('set-right').addClass("set-left"); 1136 } else if (boundingRect.right > (window.innerWidth || document.documentElement.clientWidth)) { 1137 calendarContainer.removeClass('set-left').addClass("set-right"); 1138 } 1139 } 1140 } 1141 } 1142 }; 1143 window.pixelpoint.ppComponents.calendar = function ($this) { 1144 var von = $this.find("input.von"); 1145 var bis = $this.find("input.bis"); 1146 var clearDates = $this.find("input.clear-dates"); 1147 var buttonClearDates = $this.find("i.clear-dates"); 1148 var nameVon = von.attr("name"); 1149 var nameBis = bis.attr("name"); 1150 var isInitiallyDisabled = false; 1151 if ($this.is("[data-initially-disabled]")) { 1152 von.attr("name", ""); 1153 bis.attr("name", ""); 1154 isInitiallyDisabled = true; 1155 } 1156 var isPreFilled = $this.is("[data-prefilled]") || $this.hasClass("prefilled"); 1157 var forceNextDay = !$this.is("[data-disable-forced-next-day]"); 1158 var disableDefaultInput = $this.is('[data-disable-default-input]'); 1159 var hoverTextSingle = $this.data("hover-text-single") || window.ppt.translate("night.singular", "Nacht"); 1160 var hoverTextMultiple = $this.data("hover-text-multiple") || window.ppt.translate("night.plural", "Nächte"); 1161 var batchMode = $this.data("batch-mode") || false; 1162 var fixedNights = $this.data("fixed-length") + 1; 1163 var startIsToday = false; 1164 var earliestStartDate = $this.data("start-date"); 1165 if (!!earliestStartDate) earliestStartDate = moment(earliestStartDate, "DD.MM.YYYY");else { 1166 earliestStartDate = moment(); 1167 startIsToday = true; 1168 } 1169 if (earliestStartDate.isBefore(moment())) { 1170 earliestStartDate = moment(); 1171 startIsToday = true; 1172 } 1173 var showOrHideClearDates = function () { 1174 var vonVal = von.val(), 1175 bisVal = bis.val(); 1176 if (!vonVal && !bisVal) { 1177 buttonClearDates.addClass("hide"); 1178 } else { 1179 buttonClearDates.removeClass("hide"); 1180 } 1181 }; 1182 var locked = false; 1183 if (von.length == 0 || bis.length == 0) return; 1184 von.prop("readonly", true); 1185 bis.prop("readonly", true); 1186 var startDate = earliestStartDate.format('DD.MM.YYYY'); 1187 if (forceNextDay) { 1188 var currentHour = moment().hour(); 1189 if (currentHour >= 16 && startIsToday) { 1190 //it was 14 before 1191 startDate = moment().add(1, 'day').format('DD.MM.YYYY'); 1192 } 1193 } 1194 1195 //if we are in month batch mode, we need to be able to select the first day of the month 1196 if (batchMode == 'month-range') { 1197 startDate = moment(startDate, "DD.MM.YYYY").startOf('month').format('DD.MM.YYYY'); 1198 } else if (batchMode == 'week-range') { 1199 startDate = moment(startDate, "DD.MM.YYYY").startOf('week').format('DD.MM.YYYY'); 1200 } 1201 1202 //***************************we prepare everything for the mobile version *******************/ 1203 var appendContainerTo = $this; 1204 var isMobileLayer = false;
1205 if (window.pixelpoint.isMobile.isMobileWidth()) { 1206 if ($("body").find(".calendar-layer").length == 0) { 1207 $("body").append('<div class="calendar-layer hide"></div>'); 1208 $("body .calendar-layer").click(function (e) { 1209 e.preventDefault(); 1210 e.stopPropagation(); 1211 }); 1212 } 1213 appendContainerTo = $("body .calendar-layer"); 1214 isMobileLayer = true; 1215 $this.on("click touchstart", "input.von", function () { 1216 von.css({ 1217 "font-size": "16px" 1218 }); 1219 }); 1220 $this.on("click touchstart", "input.bis", function () { 1221 bis.css({ 1222 "font-size": "16px" 1223 }); 1224 }); 1225 } 1226 //***************************************************************************************** */ 1227 1228 var calendarContainer = $this.find(".calendar-container"); 1229 if (calendarContainer.length == 0) { 1230 calendarContainer = $('<div class="calendar-container"></div>'); 1231 appendContainerTo.append(calendarContainer); 1232 } 1233 1234 //******************we determine where to put the calendar******************************** */ 1235 setTimeout(() => { 1236 setCalendarPosition($this, calendarContainer); 1237 }, 200); 1238 //**************************************************************************************** */ 1239 1240 var closeButton = calendarContainer.find(".close"); 1241 if (closeButton.length == 0) { 1242 closeButton = $('<button class="close"><i class="icon-close"></i></button>'); 1243 calendarContainer.append(closeButton); 1244 } 1245 if (isMobileLayer) { 1246 var saveTranslation = window.ppt.translate('action.save', 'Speichern'); 1247 calendarContainer.append(`<a class="brandenbutton save-values">${saveTranslation}</a>`); 1248 var saveDateSelection = function (e) { 1249 e.preventDefault(); 1250 e.stopPropagation(); 1251 sharedDatePicker.data("dateRangePicker").close(); 1252 if (isMobileLayer) { 1253 calendarContainer.removeClass("open"); 1254 $(".calendar-layer").addClass("hide"); 1255 $this.removeClass('open'); 1256 } 1257 }; 1258 calendarContainer.on("click touchstart", ".save-values", saveDateSelection); 1259 calendarContainer.on("keydown", ".save-values", function (e) { 1260 if (e.key === "Enter" || e.keyCode === 13) { 1261 saveDateSelection(e); 1262 } 1263 }); 1264 } 1265 if (!isPreFilled && !disableDefaultInput) { 1266 var nightsToAdd = 1; 1267 if (!!fixedNights && fixedNights > 0) nightsToAdd = parseInt(fixedNights); 1268 var endDate = moment(startDate, 'DD.MM.YYYY'); 1269 if (forceNextDay) { 1270 endDate = endDate.add(nightsToAdd, 'days').format('DD.MM.YYYY'); 1271 } else { 1272 endDate = endDate.format('DD.MM.YYYY'); 1273 } 1274 1275 //if we are in month batch mode, we need to set the last day of the month 1276 if (batchMode == 'month-range') { 1277 endDate = moment(endDate, "DD.MM.YYYY").endOf('month').format('DD.MM.YYYY'); 1278 } else if (batchMode == 'week-range') { 1279 endDate = moment(endDate, "DD.MM.YYYY").endOf('week').format('DD.MM.YYYY'); 1280 } 1281 if (!$this.is("[data-initially-empty]") || isPreFilled) { 1282 if (!von.is(":disabled")) von.val(startDate); 1283 if (!bis.is(":disabled")) bis.val(endDate); 1284 } 1285 } 1286 var minDays = 2; 1287 if (!forceNextDay) { 1288 minDays = 1; 1289 } 1290 var bisTranslation = window.ppt.translate('to', 'bis'); 1291 var options = { 1292 autoClose: true, 1293 inline: true, 1294 minDays: minDays, 1295 //container: `#${randomId}`, 1296 container: calendarContainer, 1297 format: 'DD.MM.YYYY', 1298 separator: ` ${bisTranslation} `, 1299 getValue: function () { 1300 var start = von.val(); 1301 var end = bis.val(); 1302 return `${start} ${bisTranslation} ${end}`; 1303 }, 1304 setValue: function (s) { 1305 var splitted = s.split(` ${bisTranslation} `); 1306 if (splitted.length > 0) von.val(splitted[0]); 1307 if (splitted.length > 1) bis.val(splitted[1]); 1308 showOrHideClearDates(); 1309 }, 1310 startDate: startDate, 1311 startOfWeek: 'monday', 1312 hoveringTooltip: function (days, startTime, hoveringTime) { 1313 var nights = days - 1; 1314 if (nights == 0) return ''; 1315 return nights + ' ' + (nights == 1 ? hoverTextSingle : hoverTextMultiple); 1316 }, 1317 showTopbar: true 1318 }; 1319 if (isMobileLayer) { 1320 options.autoClose = false;
1321 } 1322 if (!!batchMode) { 1323 options.batchMode = batchMode; 1324 } 1325 if (!!fixedNights) { 1326 options.minDays = fixedNights; 1327 options.maxDays = fixedNights; 1328 } 1329 var langObject = $("[data-language-obj]").data("language-obj"); 1330 if (!!langObject && !!langObject.id == 1) { 1331 options.language = "en"; 1332 } 1333 var sharedDatePicker = von.dateRangePicker(options); 1334 var activeInput = von; 1335 var onChangeCallbacks = []; 1336 var openSharedDatePicker = function (inputElement, e) { 1337 activeInput = inputElement; 1338 1339 // Apply open state immediately when input is triggered. 1340 calendarContainer.addClass("open"); 1341 $(".calendar-layer").removeClass("hide"); 1342 $this.addClass('open'); 1343 if (sharedDatePicker.data("dateRangePicker")) { 1344 if (inputElement === bis && !!von.val()) { 1345 sharedDatePicker.data("dateRangePicker").setStart(von.val()); 1346 } 1347 sharedDatePicker.data("dateRangePicker").open(); 1348 setTimeout(function () { 1349 calendarContainer.find('.date-picker-wrapper').css('display', 'block'); 1350 }, 0); 1351 } 1352 }; 1353 var bindOpenTrigger = function (inputElement) { 1354 inputElement.off("click.sharedDatePicker touchstart.sharedDatePicker focus.sharedDatePicker keydown.sharedDatePicker"); 1355 inputElement.on("click.sharedDatePicker touchstart.sharedDatePicker focus.sharedDatePicker", function (e) { 1356 e.stopPropagation(); 1357 openSharedDatePicker(inputElement, e); 1358 }); 1359 inputElement.on("keydown.sharedDatePicker", function (e) { 1360 if (e.key === "Enter" || e.keyCode === 13) { 1361 e.preventDefault(); 1362 openSharedDatePicker(inputElement, e); 1363 } 1364 }); 1365 }; 1366 1367 // Setup bindings for one shared datepicker 1368 var setupDatePickerBindings = function (datePicker) { 1369 datePicker.off('datepicker-change.sharedDatePicker datepicker-first-date-selected.sharedDatePicker datepicker-close.sharedDatePicker datepicker-open.sharedDatePicker datepicker-opened.sharedDatePicker'); 1370 1371 // Change event 1372 datePicker.on('datepicker-change.sharedDatePicker', function (e, obj) { 1373 if (!locked) { 1374 locked = true; 1375 for (var i in onChangeCallbacks) { 1376 onChangeCallbacks[i](obj); 1377 } 1378 setTimeout(function () { 1379 locked = false; 1380 }, 100); 1381 showOrHideClearDates(); 1382 } 1383 calendarContainer.removeClass("first-date-selected"); 1384 $this.removeData("date-selection-started"); 1385 }); 1386 1387 // First date selected 1388 datePicker.on('datepicker-first-date-selected.sharedDatePicker', function (event, obj) { 1389 calendarContainer.addClass("first-date-selected"); 1390 $this.addClass("first-date-selected"); 1391 $this.data("date-selection-started", obj.date1); 1392 von.val(moment(obj.date1).format('DD.MM.YYYY')); 1393 }); 1394 1395 // Close event 1396 datePicker.on('datepicker-close.sharedDatePicker', function (e) { 1397 var selectionStartedDate = $this.data("date-selection-started"); 1398 if (!isMobileLayer) { 1399 calendarContainer.removeClass("open"); 1400 $(".calendar-layer").addClass("hide"); 1401 $this.removeClass('open'); 1402 } 1403 $this.removeClass("first-date-selected"); 1404 if (!!selectionStartedDate) { 1405 var date1 = moment(selectionStartedDate); 1406 var nightsToAdd = 1; 1407 if (!!fixedNights) nightsToAdd = fixedNights; 1408 var date2 = moment(date1).add(nightsToAdd, 'days'); 1409 von.val(date1.format('DD.MM.YYYY')); 1410 bis.val(date2.format('DD.MM.YYYY')); 1411 showOrHideClearDates(); 1412 $this.removeData("date-selection-started"); 1413 } 1414 von.css({ 1415 "font-size": "" 1416 }); 1417 bis.css({ 1418 "font-size": "" 1419 }); 1420 calendarContainer.find('.date-picker-wrapper').css('display', 'none'); 1421 }); 1422 1423 // Open event 1424 datePicker.on('datepicker-open.sharedDatePicker', function () { 1425 setCalendarPosition($this, calendarContainer); 1426 calendarContainer.addClass("open"); 1427 $(".calendar-layer").removeClass("hide"); 1428 $this.addClass('open'); 1429 var isVonInput = activeInput === von; 1430 var msgKey = isVonInput ? 'datepicker.select.nodates.error' : 'datepicker.select.noenddate.error'; 1431 var msgDefault = isVonInput ? 'Bitte wählen Sie ein "von" und "bis" Datum' : 'Bitte wählen Sie ein "bis" Datum'; 1432 var datepickerErrorTranslation = window.ppt.translate(msgKey, msgDefault); 1433 if ($(this).find('.date-picker-wrapper .top-bar .normal-top').length == 0) $(this).find('.date-picker-wrapper').prepend(`<div class="top-bar normal"><div class="normal-top">${datepickerErrorTranslation}</div></div>`);else $(this).find('.date-picker-wrapper .top-bar .normal-top').text(datepickerErrorTranslation); 1434 $(this).find('.date-picker-wrapper').css('display', 'block'); 1435 }); 1436 1437 // Opened event 1438 datePicker.on('datepicker-opened.sharedDatePicker', function () { 1439 if (activeInput === bis && !!von.val()) { 1440 $(this).data('dateRangePicker').setStart(von.val()); 1441 } 1442 var isVonInput = activeInput === von; 1443 var msgKey = isVonInput ? 'datepicker.select.nodates.error' : 'datepicker.select.noenddate.error'; 1444 var msgDefault = isVonInput ? 'Bitte wählen Sie ein "von" und bis" Datum' : 'Bitte wählen Sie ein "bis" Datum'; 1445 var datepickerErrorTranslation = window.ppt.translate(msgKey, msgDefault); 1446 var wrapper = calendarContainer.find(".calendar-container .date-picker-wrapper"); 1447 wrapper.find(".drp_top-bar").remove(); 1448 wrapper.prepend(`<div class="drp_top-bar normal"><div class="normal-top">${datepickerErrorTranslation}</div></div>`); 1449 wrapper.css('display', 'block'); 1450 }); 1451 }; 1452 setupDatePickerBindings(sharedDatePicker); 1453 bindOpenTrigger(von); 1454 bindOpenTrigger(bis); 1455 if (isMobileLayer) { 1456 $(document).unbind('click.datepicker'); 1457 } 1458 $(window).on("orientationchange", function () { 1459 if (typeof sharedDatePicker.data("dateRangePicker") !== 'undefined') { 1460 sharedDatePicker.data("dateRangePicker").destroy(); 1461 } 1462 if (window.pixelpoint.isMobile.isMobileWidth()) { 1463 options.parentEl = '.mobile-input-layer .inner-wrapper'; 1464 $(".mobile-input-layer .inner-wrapper").on("show.daterangepicker", function () { 1465 $(".mobile-input-layer").removeClass("hide"); 1466 }); 1467 } else { 1468 if (!!options.parentEl) { 1469 delete options.parentEl; 1470 } 1471 } 1472 sharedDatePicker = von.dateRangePicker(options); 1473 setupDatePickerBindings(sharedDatePicker); 1474 }); 1475 var closeDatePicker = function () { 1476 sharedDatePicker.data("dateRangePicker").close(); 1477 if (isMobileLayer) { 1478 calendarContainer.removeClass("open"); 1479 $(".calendar-layer").addClass("hide"); 1480 $this.removeClass('open'); 1481 } 1482 }; 1483 closeButton.on("click", closeDatePicker); 1484 // Add keyboard support for closing with Enter on close button 1485 closeButton.on("keydown", function (e) { 1486 if (e.key === "Enter" || e.keyCode === 13) { 1487 e.preventDefault(); 1488 closeDatePicker(); 1489 } 1490 }); 1491 // Add ESC key support - listen on document when calendar is open 1492 $(document).on("keydown.calendar-container", function (e) { 1493 if ((e.key === "Escape" || e.keyCode === 27) && calendarContainer.hasClass("open")) { 1494 e.preventDefault(); 1495 closeDatePicker(); 1496 } 1497 }); 1498 var exposedFunctions = { 1499 onChange(callback) { 1500 onChangeCallbacks.push(callback); 1501 }, 1502 activate() { 1503 if (isInitiallyDisabled) { 1504 von.attr("name", nameVon); 1505 bis.attr("name", nameBis); 1506 isInitiallyDisabled = false;
1507 } 1508 } 1509 }; 1510 var calendarId = $this.attr("id"); 1511 if (!!calendarId) { 1512 var clearDates = $(`[data-calendar-clear="calendar-1"]`); 1513 if (clearDates.length > 0) { 1514 clearDates.on("change", function (e) { 1515 if (clearDates.is(":checked")) { 1516 von.val(""); 1517 bis.val(""); 1518 von.prop("disabled", true); 1519 bis.prop("disabled", true); 1520 $this.addClass("disabled"); 1521 showOrHideClearDates(); 1522 } else { 1523 von.prop("disabled", false); 1524 bis.prop("disabled", false); 1525 $this.removeClass("disabled"); 1526 showOrHideClearDates(); 1527 } 1528 }); 1529 } 1530 } 1531 var clearDates = function () { 1532 von.val(""); 1533 bis.val(""); 1534 showOrHideClearDates(); 1535 }; 1536 buttonClearDates.on("click", clearDates); 1537 1538 // Add keyboard support for clear button 1539 buttonClearDates.on("keydown", function (e) { 1540 if (e.key === "Enter" || e.keyCode === 13) { 1541 e.preventDefault(); 1542 clearDates(); 1543 } 1544 }); 1545 showOrHideClearDates(); 1546 $this.data("exposed", exposedFunctions); 1547 }; 1548 $(".calendar").each(function () { 1549 window.pixelpoint.ppComponents.calendar($(this)); 1550 }); 1551}); 1552//include 12 1553/* 1554jQuery(function(){ 1555 function loadVideos(){ 1556 $("video").each(function(index){ 1557 $(this).get(0).load(); 1558 $(this).get(0).addEventListener("canplaythrough", function(){ 1559 this.play(); 1560 this.pause(); 1561 }); 1562 }); 1563 } 1564 1565 $('.video-wrapper').each(function(){ 1566 var video = $(this).find('video').get(0); 1567 var playButton = $(this).find('.video-controls .play').get(0); 1568 var fullscreenButton = $(this).find('.video-controls .fullscreen').get(0); 1569 1570 playButton.addEventListener("click", function() { 1571 if (video.paused == true) { 1572 // Play the video 1573 video.play(); 1574 $(playButton).css('opacity','0'); 1575 } else { 1576 // Pause the video 1577 video.pause(); 1578 $(playButton).css('opacity','1'); 1579 } 1580 }); 1581 1582 if(fullscreenButton){ 1583 fullscreenButton.addEventListener("click", function() { 1584 if (video.paused == false) { 1585 // Pause the video 1586 video.pause(); 1587 $(playButton).css('opacity','1'); 1588 } 1589 var url = ""; 1590 if($(this).parents('.video-wrapper').find('source').attr('data-highres')){ 1591 url = $(this).parents('.video-wrapper').find('source').attr('data-highres'); 1592 } 1593 else{ 1594 url = $(this).parents('.video-wrapper').find('source').attr('src'); 1595 } 1596 // console.log('url '+url); 1597 var lightbox = lity(); 1598 lightbox(url); 1599 }); 1600 } 1601 1602 }); 1603 1604 $('.videogallery .video-wrapper').each(function(){ 1605 var video = $(this).find('video').get(0); 1606 var playButton = $(this).find('.video-controls .play').get(0); 1607 1608 playButton.addEventListener("click", function() { 1609 var url = ""; 1610 if($(this).parents('.video-wrapper').find('source').attr('data-highres')){ 1611 url = $(this).parents('.video-wrapper').find('source').attr('data-highres'); 1612 } 1613 else{ 1614 url = $(this).parents('.video-wrapper').find('source').attr('src'); 1615 } 1616 // console.log('url '+url); 1617 var lightbox = lity(); 1618 lightbox(url); 1619 }); 1620 }); 1621}); 1622 //*/ 1623$(document).foundation(); 1624$("[data-full-width]").each(function () { 1625 var $this = $(this); 1626 var stickToRight = $this.is("[data-stick-right]"); 1627 if (!stickToRight) { 1628 $this.width($this.parent().width()); 1629 $(window).resize(function () { 1630 $this.width($this.parent().width()); 1631 }); 1632 } else { 1633 $this.addClass("auto-max-width"); 1634 var position = $this.parent().offset(); 1635 var widthToUse = $(window).width() - position.left; 1636 $this.width(widthToUse); 1637 $(window).resize(function () { 1638 var position = $this.parent().offset(); 1639 var widthToUse = $(window).width() - position.left; 1640 $this.width(widthToUse); 1641 }); 1642 } 1643}); 1644//include 13 1645jQuery(function () { 1646 var triggerEvent = 'hover'; 1647 if (typeof window.ontouchstart !== 'undefined') { 1648 triggerEvent = 'click'; 1649 } 1650 $('.ttip').tooltipster({ 1651 animation: 'fade', 1652 animationDuration: [250, 100], 1653 delay: 0, 1654 theme: 'tooltipster-noir', 1655 //trigger: triggerEvent, 1656 trigger: 'custom', 1657 triggerOpen: { 1658 mouseenter: true, 1659 touchstart: true 1660 }, 1661 triggerClose: { 1662 mouseleave: true, 1663 originClick: true, 1664 touchleave: true, 1665 scroll: true, 1666 tap: true 1667 }, 1668 distance: 2 1669 }); 1670 1671 // Shariff Info - Tooltip 1672 /*if($(".shariff-pp").length){ 1673 //$('.shariff-pp ul').append('<li class="ttip-blue" title="Datenschutz ist uns sehr wichtig, deswegen haben wir eine von Datenschützern akzeptierte Variante des \'Share-Buttons\' eingebaut. Mit einem Klick auf die nebenstehenden Links werden nicht sofort personenbezogene Daten wie Ihre IP-Adresse an die sozialen Netzwerk übermittelt, sondern erst nach Ihrer aktiven Anmeldung."><span class="fa fa-info"></span></div>'); 1674 var sharifTitleTranslation = window.ppt.translate("sharif.info","Datenschutz ist uns sehr wichtig, deswegen haben wir eine von Datenschützern akzeptierte Variante des \'Share-Buttons\' eingebaut. Mit einem Klick auf die nebenstehenden Links werden nicht sofort personenbezogene Daten wie Ihre IP-Adresse an die sozialen Netzwerk übermittelt, sondern erst nach Ihrer aktiven Anmeldung.");
1675 $('.shariff-pp ul').append(`<li class="ttip-blue shariff-ttip" title="${sharifTitleTranslation}"><span class="fa fa-info"></span></div>`); 1676 $('.shariff-pp ul li a').attr('rel', 'nofollow'); 1677 }*/ 1678 // 1679 1680 var themes = ['tooltipster-noir', 'tooltipster-noir-customized']; 1681 window.pixelpoint.tooltip = { 1682 init: function (elements) { 1683 elements.each(function () { 1684 if ($(this).data('tooltipster-ns')) { 1685 try { 1686 $(this).tooltipster("destroy"); 1687 if ($(this).data("original-title")) $(this).attr("title", $(this).data("original-title")); 1688 } catch (e) { 1689 $(this).removeData('tooltipster-ns'); 1690 } 1691 } 1692 var themes = ['tooltipster-noir', 'tooltipster-noir-customized']; 1693 var additionalThemes = $(this).data("tooltip-themes") || []; 1694 if ($.isArray(additionalThemes)) { 1695 themes = themes.concat(additionalThemes); 1696 } else { 1697 themes.push(additionalThemes); 1698 } 1699 var options = { 1700 animation: 'fade', 1701 animationDuration: [250, 100], 1702 delay: 0, 1703 theme: themes, 1704 trigger: triggerEvent, 1705 contentCloning: true, 1706 distance: 2 1707 }; 1708 if (!!$(this).data("tooltip-content")) { 1709 var selector = $(this).data("tooltip-content"); 1710 var content = $(selector); 1711 options.content = content; 1712 } 1713 $(this).data("original-title", $(this).attr("title")); 1714 var self = $(this); 1715 setTimeout(function () { 1716 self.tooltipster(options); 1717 }, 300); 1718 }); 1719 } 1720 }; 1721 window.pixelpoint.tooltip.init($('.ttip-blue')); 1722 /* 1723 $('.ttip-blue').each(function(){ 1724 var themes = ['tooltipster-noir', 'tooltipster-noir-customized']; 1725 var additionalThemes = $(this).data("tooltip-themes") || []; 1726 if($.isArray(additionalThemes)){ 1727 themes = themes.concat(additionalThemes); 1728 } 1729 else{ 1730 themes.push(additionalThemes); 1731 } 1732 1733 var options = { 1734 animation: 'fade', 1735 animationDuration: [250,100], 1736 delay: 0, 1737 theme: themes, 1738 trigger: triggerEvent, 1739 contentCloning: true, 1740 distance: 2 1741 } 1742 1743 if (!!$(this).data("tooltip-content")) { 1744 var selector = $(this).data("tooltip-content"); 1745 var content = $(selector); 1746 options.content = content; 1747 } 1748 $(this).tooltipster(options); 1749 }); 1750 //*/ 1751}); 1752//include 14 1753jQuery(function () { 1754 window.prompt = window.prompt || {}; 1755 window.prompt.translate = window.prompt.translate || function (str, def) { 1756 return def; 1757 }; 1758 var playerContainers = $(".youtubeFrames"); 1759 const youtubeVendor = "s30"; 1760 const youtubePlaceholderImageUrl = '/index.php?type=1732176051&action=getYoutubePreview&videoid='; 1761 //***************helper functions***************************************** 1762 /** 1763 * formats seconds for display 1764 * @param {int} totalSeconds the seconds to format 1765 * @return {string} the formatted string 1766 */ 1767 var formatSeconds = function (totalSeconds) { 1768 var hours = Math.floor(totalSeconds / 3600); 1769 totalSeconds %= 3600; 1770 var minutes = Math.floor(totalSeconds / 60); 1771 //if hours > 0, we prepend a zero to the minutes, if needed 1772 if (hours > 0) minutes = ('0' + minutes).slice(-2); 1773 var seconds = totalSeconds % 60; 1774 var result = seconds; 1775 //if minutes > 0, we prepend a zero to the seconds, if needed 1776 if (minutes > 0) seconds = ('0' + seconds).slice(-2); 1777 var textToAppend = "Sekunden"; //window.prompt.translate("seconds","Sekunden"); 1778 if (minutes > 0) { 1779 result = minutes + ":" + result; 1780 textToAppend = "Minuten"; //window.prompt.translate("minutes","Minuten"); 1781 } 1782 if (hours > 0) { 1783 result = hours + ":" + result; 1784 textToAppend = "Stunden"; //window.prompt.translate("hours","Stunden"); 1785 } 1786 return result + " " + textToAppend; 1787 }; 1788 1789 /** 1790 * format a number with comma and thousand separator 1791 * @param {decimal} x the number to format 1792 * @return {string} the formated number 1793 */ 1794 function formatNumber(x) { 1795 return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); 1796 } 1797 function YouTubeGetID(url) { 1798 url = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); 1799 return url[2] !== undefined ? url[2].split(/[^0-9a-z_\-]/i)[0] : url[0]; 1800 } 1801 1802 //************************************************************************ 1803 //*************templates************************************************** 1804 var iframeReplacement = '<div class="video-container">' + '<div class="video-player"></div><div class="video-poster"></div>' + '<div class="video-controls">' + '<div class="text-wrapper">' + '<div class="text">' + '<h4 class="capital video-title"></h4>' + '<div class="stats">' + '<div class="views icon-views video-views"></div>' + '<div class="time icon-clock video-minutes"></div>' + '</div>' + '</div>' + '</div>' + '<button class="play"><i class="icon-play"></i></button>' /*+ '<button class="fullscreen"><i class="icon-up-open-big"></i></button>'*/ + '</div>' + '</div>'; 1805 //************************************************************************ 1806 var startPlayers = function () { 1807 playerContainers.each(function (index) { 1808 var $self = $(this); 1809 var $parent = $self.parent(); 1810 var isPlaying = false;
1811 var id = $self.attr("id") || "youtubePlayer" + index; 1812 var src = $self.attr("src"); 1813 if (!src) return; 1814 var videoId = $self.data("video-id") || YouTubeGetID(src) || ""; 1815 var placeholderImage = $self.data("poster") || `${youtubePlaceholderImageUrl}${videoId}`; 1816 var title = $self.data("video-title") || ""; 1817 var durationClass = ""; 1818 var duration = $self.data("video-duration") || 0; 1819 if (duration <= 0) { 1820 durationClass = "hide"; 1821 } 1822 duration = formatSeconds(duration); 1823 var viewsClass = ""; 1824 var views = $self.data("video-views") || 0; 1825 if (views <= 0) { 1826 viewsClass = "hide"; 1827 } 1828 views = formatNumber(views); 1829 var replacement = $(iframeReplacement); 1830 $(replacement.find(".video-player").get(0)).attr("id", id); 1831 $(replacement.find(".video-poster").get(0)).css("background-image", 'url(' + placeholderImage + ')'); 1832 $parent.replaceWith(replacement); 1833 var playerOptions = { 1834 videoId: videoId, 1835 host: 'https://www.youtube-nocookie.com', 1836 playerVars: { 1837 autoplay: 0, 1838 controls: 1, 1839 modestbranding: 1, 1840 rel: 0, 1841 showinfo: 0 1842 }, 1843 events: { 1844 'onStateChange': onPlayerStateChange 1845 } 1846 }; 1847 //TPBB-1084 - always use nocookie 1848 //if(!readCookie("pp_allow_third_party_cookies")){ 1849 // playerOptions.host = 'https://www.youtube-nocookie.com'; 1850 //} 1851 1852 var player = new YT.Player(id, playerOptions); 1853 //*******************set the video information********************************* 1854 $(replacement.find(".video-title").get(0)).html(title); 1855 $(replacement.find(".video-views").get(0)).html(views).addClass(viewsClass); 1856 $(replacement.find(".video-minutes").get(0)).html(duration).addClass(durationClass); 1857 //if browser doesn't support fullscreen, hide the fullscreen button 1858 /* 1859 if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && !document.mozFullScreenEnabled && !document.msFullscreenEnabled) { 1860 $(replacement.find(".fullscreen").get(0)).hide(); 1861 } 1862 //*/ 1863 //***************************************************************************** 1864 //*******************control functions***************************************** 1865 var control = { 1866 onStartPlaying: function () { 1867 replacement.find(".video-poster").fadeOut(); //addClass("faded"); 1868 replacement.find(".video-controls").fadeOut(); //addClass("faded"); 1869 //replacement.find(".fullscreen").hide(); 1870 } 1871 /* 1872 onPausePlaying: function() { 1873 replacement.find(".video-poster").removeClass("faded"); 1874 replacement.find(".video-controls").removeClass("faded"); 1875 //replacement.find(".fullscreen").show(); 1876 }, 1877 //*/ 1878 }; 1879 //***************************************************************************** 1880 //***********************handling play click******************************************** 1881 replacement.on("click", ".play", function () { 1882 //if (!isPlaying) { 1883 player.playVideo(); 1884 control.onStartPlaying(); 1885 isPlaying = true; 1886 //} else { 1887 // player.pauseVideo(); 1888 //} 1889 }); 1890 //*****************************handling fullscreen********************************* 1891 /* 1892 replacement.on("click", ".fullscreen", function() { 1893 var playerElement = document.getElementById(id); 1894 var requestFullScreen = playerElement.requestFullScreen || playerElement.mozRequestFullScreen || playerElement.webkitRequestFullScreen; 1895 if (requestFullScreen) { 1896 if (!isPlaying) { 1897 player.playVideo(); 1898 control.onStartPlaying(); 1899 isPlaying = true; 1900 } 1901 requestFullScreen.bind(playerElement)(); 1902 } 1903 }); 1904 $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function() { 1905 if (!document.fullscreenElement) { 1906 if (!isPlaying) { 1907 control.onPausePlaying(); 1908 } 1909 } 1910 });
1911 //*/ 1912 //********************************************************************************** 1913 //*************video events**************************************************** 1914 //* 1915 function onPlayerStateChange(event) { 1916 switch 1917 /* 1918 case YT.PlayerState.ENDED: 1919 control.onPausePlaying(); 1920 isPlaying = false; 1921 break; 1922 //*/ 1923 /* 1924 case YT.PlayerState.PLAYING: 1925 control.onStartPlaying(); 1926 isPlaying = true; 1927 break; 1928 //*/ 1929 /* 1930 case YT.PlayerState.PAUSED: 1931 control.onPausePlaying(); 1932 isPlaying = false; 1933 break; 1934 //*/ 1935 (event.data) {} 1936 } 1937 1938 //*/ 1939 //***************************************************************************** 1940 }); 1941 }; 1942 var YoutubeCMPConsentGiven = function () { 1943 if (typeof __cmp === 'undefined' || !__cmp) { 1944 // no CMP running on this page at all 1945 return true; 1946 } 1947 const data = __cmp('getCMPData'); 1948 if (!data || !data.vendorConsents) { 1949 // __cmp exists but the real consentmanager script hasn't replaced the stub yet 1950 return false; 1951 } 1952 return !!data.vendorConsents[youtubeVendor]; // Youtube has the id 's30' 1953 }; 1954 var setAttribute = function (iframe, name, value) { 1955 //TPBB-1151 we check if consent was given. If not we do not include some attributes 1956 let includeAttribute = true; 1957 if (['data-poster'].includes(name)) { 1958 if (!YoutubeCMPConsentGiven()) { 1959 includeAttribute = false; 1960 } 1961 } 1962 // TPBB-1157: we have to manually block youtube 1963 if (name == 'src' && !YoutubeCMPConsentGiven()) { 1964 iframe.attr('src', 'about:blank'); 1965 iframe.attr('data-cmp-src', value); 1966 iframe.attr('data-cmp-vendor', youtubeVendor); 1967 iframe.addClass('cmplazyload'); 1968 } else if (includeAttribute) { 1969 iframe.attr(name, value); 1970 } 1971 }; 1972 var setConsentSize = function (iframe, attrs, $parent) { 1973 let widthAttr = attrs.getNamedItem('data-youtube-cmp-width') || attrs.getNamedItem('data-youtube-width') || { 1974 value: 0 1975 }; 1976 widthAttr = { 1977 value: 0 1978 }; 1979 //{value: 387}; 1980 let heightAttr = attrs.getNamedItem('data-youtube-cmp-height') || attrs.getNamedItem('data-youtube-height') || { 1981 value: 0 1982 }; 1983 //{value: 200}; 1984 if (widthAttr.value == 0) { 1985 if (!!$parent && $parent.length > 0) { 1986 widthAttr = { 1987 value: $parent.width() 1988 }; 1989 heightAttr = { 1990 value: $parent.width() * 0.56 1991 }; 1992 } 1993 } 1994 if (widthAttr.value == 0) { 1995 widthAttr = { 1996 value: 387 1997 }; 1998 heightAttr = { 1999 value: 200 2000 }; 2001 } 2002 let width = widthAttr.value; 2003 let height = heightAttr.value; 2004 if (!!window.visualViewport) { 2005 if (width > window.visualViewport.width) { 2006 width = window.visualViewport.width; 2007 height = width * 0.56; 2008 } 2009 } 2010 height = height < 300 ? 300 : height; 2011 iframe.attr('data-cmp-preview', `${width}x${height}`); 2012 }; 2013 // slack 03.01.2023: we need a timeout so a potential slider can be initialized before the cmp preview message width is determined 2014 setTimeout(() => { 2015 $(".youtube-placeholder").each((index, element) => { 2016 var iframe = $("<iframe tabindex='-1'></iframe>"); 2017 var allAttributes = element.attributes; 2018 var foundSrc = ""; 2019 $.each(allAttributes, (key, value) => { 2020 if (value.name.match(/^data-youtube-/i)) { 2021 var name = value.name.replace(/^data-youtube-/i, ""); 2022 if (name == "src") { 2023 foundSrc = value.value; 2024 } 2025 setAttribute(iframe, name, value.value); 2026 //iframe.attr(name,value.value); 2027 } 2028 }); 2029 setConsentSize(iframe, allAttributes, $(element)); 2030 $(element).after(iframe); 2031 if ($(element).closest(".videogallery").length > 0) { 2032 const overlay = $(` 2033 <button class="videoGalleryOverlay with-background" 2034 data-src="${foundSrc || iframe.attr("src")}" 2035 > 2036 <img src="${youtubePlaceholderImageUrl}${YouTubeGetID(foundSrc || iframe.attr("src"))}" data-cmp-src="${youtubePlaceholderImageUrl}${YouTubeGetID(foundSrc || iframe.attr("src"))}" data-cmp-vendor="${youtubeVendor}" class="cmplazyload background-image"/> 2037 <i class="icon-youtube"></i> 2038 </button>`); 2039 $(element).after(overlay); 2040 } 2041 }); 2042 $('.videogallery').on("click", ".videoGalleryOverlay", function () { 2043 var src = $(this).data("src"); 2044 if (src == 'undefined') { 2045 var ifr = $(this).next(); 2046 src = ifr.attr("src"); 2047 } 2048 var url = new URL(src); 2049 url.searchParams.append('autoplay', 1); 2050 src = url.toString(); 2051 var lightbox = lity(src); 2052 }); 2053 $(".youtube-placeholder").remove(); 2054 playerContainers = $(".youtubeFrames"); 2055 if (typeof YT == 'undefined' || typeof YT.Player == 'undefined') { 2056 window.onYouTubeIframeAPIReady = function () { 2057 startPlayers(); 2058 }; 2059 let iframeApiAppended = false;
2060 var appendIframeApiScript = function () { 2061 if (iframeApiAppended || !YoutubeCMPConsentGiven()) return; 2062 iframeApiAppended = true; 2063 $('body').append(`<script type="text/javascript" src="https://www.youtube.com/iframe_api" class="cmplazyload" data-cmp-vendor="${youtubeVendor}"></script>`); 2064 }; 2065 2066 // check right away (covers "no CMP at all" and "consent already known"), 2067 // and retry once the CMP actually reports a consent decision 2068 appendIframeApiScript(); 2069 if (typeof __cmp !== 'undefined' && !!__cmp) { 2070 __cmp("addEventListener", ["consent", appendIframeApiScript, true], null); 2071 } 2072 } else { 2073 startPlayers(); 2074 } 2075 }, 500); 2076}); 2077//include 16 2078 2079jQuery(function () { 2080 var privateFunctions = { 2081 setIsOpenText: function (isOpenTextElement, isOpen) { 2082 if (isOpen) { 2083 var text = isOpenTextElement.data("open-text"); 2084 if (text) { 2085 isOpenTextElement.html(text).removeClass("error-color").addClass("success-color"); 2086 } 2087 } else { 2088 var text = isOpenTextElement.data("closed-text"); 2089 if (text) { 2090 isOpenTextElement.html(text).addClass("error-color").removeClass("success-color"); 2091 } 2092 } 2093 }, 2094 setIsOpenTime: function (isOpenTimeElement, show, from, to) { 2095 if (!show) { 2096 isOpenTimeElement.hide(); 2097 } else { 2098 var format = isOpenTimeElement.data("format"); 2099 var formatted = format.replace("[0]", from).replace("[1]", to); 2100 isOpenTimeElement.html(formatted); 2101 } 2102 }, 2103 convertToDateTime: function (openingTime) { 2104 var from = moment(openingTime.from, "HH:mm"); 2105 var to = moment(openingTime.to, "HH:mm"); 2106 if (to.hour() == 0 && to.minute() == 0) to = moment("23:59", "HH:mm"); 2107 if (from.isAfter(to)) { 2108 // ZP 14.01.2020: it was subtract but then the customer noticed that opening hours like 15:00-01:00 for 2109 //example do not work so we changed it. Request came over Slack 2110 to = to.add(1, "day"); 2111 } 2112 return { 2113 from: from, 2114 to: to 2115 }; 2116 }, 2117 getClosest: function (dates) { 2118 var now = moment(); 2119 if (now.diff(dates.to) < now.diff(dates.from)) return dates.to; 2120 return dates.from; 2121 }, 2122 getCurrentlyOpenInterval: function (openingTimes) { 2123 var information = { 2124 isOpen: false, 2125 openFrom: null, 2126 openTo: null 2127 }; 2128 if (openingTimes.length == 0) return information; 2129 var now = moment(); 2130 for (var i in openingTimes) { 2131 var dates = privateFunctions.convertToDateTime(openingTimes[i]); 2132 if (now.isBetween(dates.from, dates.to) || now.isSame(dates.from) || now.isSame(dates.to)) { 2133 information.isOpen = true; 2134 information.openFrom = dates.from.format("HH:mm"); 2135 information.openTo = dates.to.format("HH:mm"); 2136 return information; 2137 } else { 2138 var closest = privateFunctions.getClosest(dates); 2139 if (information.openFrom == null) { 2140 information.openFrom = dates.from.format("HH:mm"); 2141 information.openTo = dates.to.format("HH:mm"); 2142 } else { 2143 var currentClosest = privateFunctions.getClosest({ 2144 from: information.openFrom, 2145 to: information.openTo 2146 }); 2147 if (now.diff(closest) < now.diff(currentClosest)) { 2148 information.openFrom = dates.from.format("HH:mm"); 2149 information.openTo = dates.to.format("HH:mm"); 2150 } 2151 } 2152 } 2153 } 2154 return information; 2155 } 2156 }; 2157 window.pixelpoint.initOpeningHoursText = function () { 2158 $(".is-open").each(function () { 2159 var $this = $(this); 2160 var openingHours = $this.data("opening-hours"); 2161 if (!openingHours || openingHours.length == 0) return; 2162 var currentDay = openingHours.today; 2163 var information = null; 2164 if (!!currentDay) information = privateFunctions.getCurrentlyOpenInterval(currentDay.opened); 2165 var isOpenText = $this.find(".is-open-text"); 2166 if (isOpenText.length > 0) { 2167 var isOpen = !!information && !!information.isOpen ? information.isOpen : false;
2168 privateFunctions.setIsOpenText(isOpenText, isOpen); 2169 } 2170 var isOpenTime = $this.find(".is-open-time"); 2171 if (isOpenTime.length > 0) { 2172 if (!!information) { 2173 isOpenTime.removeClass("hide"); 2174 privateFunctions.setIsOpenTime(isOpenTime, currentDay.openToday, information.openFrom, information.openTo); 2175 } else { 2176 isOpenTime.addClass("hide"); 2177 } 2178 } 2179 $this.addClass("display"); 2180 }); 2181 }; 2182 window.pixelpoint.initOpeningHoursText(); 2183 $(".openinghours-price-box").each(function () { 2184 var $this = $(this); 2185 var elementWidth = $this.width(); 2186 $this.find("h6").css("min-width", elementWidth + 'px'); 2187 $this.find(".opening-hours").css("min-width", elementWidth + 'px'); 2188 }); 2189}); 2190//include 17 2191jQuery(function () { 2192 /* 2193 var getReplacementUrl = function(width,height){ 2194 return "https://placehold.it/"+width+"x"+height+"/FFC107/000000"; 2195 }; 2196 var replaceImage = function(imgElement){ 2197 var currentSrc = imgElement.attr("src"); 2198 var matches = currentSrc.match(/w=([^&]+)&h=([^&]+)/); 2199 if(matches.length >= 3){ 2200 var width = matches[1]; 2201 var height = matches[2]; 2202 if(!isNaN(width) && !isNaN(height)){ 2203 imgElement.attr("src",getReplacementUrl(width,height)); 2204 return; 2205 } 2206 } 2207 imgElement.attr("src",getReplacementUrl(100,100)); 2208 } 2209 //*/ 2210 2211 var defaultReplacementUrl = window.pixelpoint.domainService.get('apiEndpoint') + "[type]/[id]/placeholder?first=1"; //"https://placehold.it/[width]x[height]/FFC107/000000"; 2212 var fallbackUrl = window.ppsettings.imageFallback; 2213 var errorCallbacks = {}; 2214 var privateFunctions = { 2215 getReplacementUrl: function ($element, /*width,height*/type, id) { 2216 var replacementUrl = $element.data("alternative-url"); 2217 if (!replacementUrl) { 2218 replacementUrl = defaultReplacementUrl; 2219 } 2220 return replacementUrl.replace("[type]", type).replace("[id]", id); 2221 }, 2222 getFallbackUrl: function ($element, width, height) { 2223 var replacementUrl = $element.data("alternative-url"); 2224 if (!replacementUrl) { 2225 replacementUrl = fallbackUrl; 2226 } 2227 return replacementUrl.replace("[width]", width).replace("[height]", height); 2228 }, 2229 /** 2230 * finds the dimensions from either a data attribute or from src directly. It does not get dimensions from html/css! 2231 * @param {node} $element the jquery element for which to get dimensions 2232 * @return {object} the width and height 2233 */ 2234 getDimensions: function ($element) { 2235 var width = $element.data("width"); 2236 var height = $element.data("height"); 2237 var src = $element.attr("src"); 2238 var srcWidth, srcHeight; 2239 if (!!src) { 2240 var matches = src.match(/w=([^&]+)&h=([^&]+)/); 2241 if (!!matches && !!matches.length && matches.length >= 3) { 2242 srcWidth = matches[1]; 2243 srcHeight = matches[2]; 2244 if (!isNaN(matches[1])) { 2245 srcWidth = matches[1]; 2246 } 2247 if (!isNaN(matches[2])) { 2248 srcHeight = matches[2]; 2249 } 2250 } 2251 } 2252 if (!width && !!srcWidth) { 2253 width = srcWidth; 2254 } 2255 if (!height && !!srcHeight) height = srcHeight; 2256 return { 2257 width: width, 2258 height: height 2259 }; 2260 }, 2261 getTypeAndId: function ($element) { 2262 var type = $element.data("type") || "poi"; 2263 var id = $element.data("id") || 0; 2264 var src = $element.attr("src"); 2265 var srcType, srcId; 2266 if (!!src) { 2267 let searchStr = window.pixelpoint.domainService.get('apiEndpoint').replace('https://', '//'); 2268 if (src.search(searchStr) == -1) { 2269 srcType = ""; 2270 srcId = 0; 2271 } else { 2272 var matches = src.match(/\/api\/([a-zA-Z]+\/)*asset\/([\d]+)\/thumbnail/); 2273 if (!!matches && !!matches.length && matches.length >= 2) { 2274 srcType = ""; 2275 srcId = 0; 2276 if (!!matches[1]) { 2277 srcType = matches[1].substring(0, matches.length - 1); // first match ends with a /, if not empty 2278 } 2279 if (matches.length >= 3 && !isNaN(matches[2])) { 2280 srcId = matches[2]; 2281 } 2282 } 2283 } 2284 } 2285 srcType = srcType || type; 2286 srcId = id; //srcId || id; //the id in the url is from the image!!!!!!! 2287 2288 return { 2289 type: srcType, 2290 id: srcId 2291 }; 2292 }, 2293 replaceWithAlternative: function ($element) { 2294 var dimensions = this.getDimensions($element); 2295 var replacementUrl = null; 2296 if (!!dimensions.width && !!dimensions.height) replacementUrl = this.getFallbackUrl($element, dimensions.width, dimensions.height);else replacementUrl = this.getFallbackUrl($element, 500, 500); 2297 privateFunctions.replaceImageUrl($element, replacementUrl, true); 2298 }, 2299 replaceImage: function ($element) { 2300 var dimensions = this.getDimensions($element); 2301 var typeAndId = this.getTypeAndId($element); 2302 var replacementUrl; 2303 var fallbackUsed = false;
2304 if (typeAndId.id == 0) { 2305 if (!!dimensions.width && !!dimensions.height) replacementUrl = this.getFallbackUrl($element, dimensions.width, dimensions.height);else replacementUrl = this.getFallbackUrl($element, 500, 500); 2306 fallbackUsed = true; 2307 } else { 2308 replacementUrl = this.getReplacementUrl($element, typeAndId.type, typeAndId.id); 2309 } 2310 privateFunctions.replaceImageUrl($element, replacementUrl, fallbackUsed); 2311 }, 2312 replaceImageUrl: function ($element, replacementUrl, fallbackUsed) { 2313 var containImage = $element.data("contain"); 2314 $element.attr("src", replacementUrl); 2315 var $centerCropped = $element.closest(".center-cropped"); 2316 if ($centerCropped.length > 0) { 2317 //$centerCropped.css("background-image", 'url(' + replacementUrl + ')'); 2318 //$centerCropped.css({"background-image":"url(" + replacementUrl + ")", "background-color":"hsla(0,0%,79%,0.1)"}); // $medium-gray 2319 // remove Background https://ticket.pixelpoint.at/issues/30139#note-76 2320 /* 2321 $centerCropped.css({ 2322 "background-image": "url(" + replacementUrl + ")", 2323 "background-color": "#E9EEF2" 2324 }); 2325 */ 2326 $centerCropped.css({ 2327 "background-image": "url(" + replacementUrl + ")" 2328 }); 2329 // END 2330 if (!!containImage || !!fallbackUsed) { 2331 $centerCropped.addClass("contained"); 2332 } 2333 } 2334 var $backgroundDce = $element.closest(".background"); 2335 if ($backgroundDce.length > 0) { 2336 //$backgroundDce.css("background-image", 'url(' + replacementUrl + ')'); 2337 //$backgroundDce.css({"background-image":"url(" + replacementUrl + ")", "background-color":"hsla(0,0%,79%,0.1)"}); // $medium-gray
2338 // remove Background https://ticket.pixelpoint.at/issues/30139#note-76 2339 /*$backgroundDce.css({ 2340 "background-image": "url(" + replacementUrl + ")", 2341 "background-color": "#E9EEF2" 2342 });*/ 2343 $backgroundDce.css({ 2344 "background-image": "url(" + replacementUrl + ")" 2345 }); 2346 // END 2347 if (!!containImage || !!fallbackUsed) { 2348 $backgroundDce.addClass("contained"); 2349 } 2350 } 2351 var $dceImageWrapper = $element.closest(".dceimagewrapper"); 2352 if ($dceImageWrapper.length > 0) { 2353 $dceImageWrapper.css("display", "block"); 2354 } 2355 } 2356 }; 2357 2358 //*****************we hide some images******************************************* 2359 2360 //******************************************************************************* 2361 //* 2362 2363 function testImages(element) { 2364 return; 2365 element.find("img").addBack("img").each(function () { 2366 if (this.complete) { 2367 if (typeof this.naturalWidth == "undefined" || this.naturalWidth == 0 || $(this).hasClass("image-load-error")) { 2368 $(this).removeClass("image-load-error"); 2369 var self = this; 2370 var img = new Image(); 2371 img.onerror = function () { 2372 if ($(self).is("[data-hide-on-error]")) { 2373 $(self).css({ 2374 opacity: 0 2375 }); 2376 return; 2377 } 2378 var errorCallback = $(self).data("image-error-callback"); 2379 if (errorCallback) { 2380 if (!!errorCallbacks[errorCallback]) { 2381 _.each(errorCallbacks, callback => { 2382 callback($(self)); 2383 }); 2384 } else { 2385 privateFunctions.replaceImage($(self)); 2386 } 2387 } else { 2388 privateFunctions.replaceImage($(self)); 2389 } 2390 }; 2391 img.src = this.src; 2392 } 2393 } 2394 }); 2395 } 2396 function initializeImageErrors(element) { 2397 return; 2398 element.find("img").addBack("img").each(function () { 2399 $(this).on("error", function (e) { 2400 var $img = $(e.target); 2401 if ($img.is("[data-hide-on-error]")) { 2402 $img.css({ 2403 opacity: 0 2404 }); 2405 return; 2406 } 2407 var errorCallback = $img.data("image-error-callback"); 2408 var defaultCallback = $img => { 2409 $img.off("error").one("error", function (e) { 2410 privateFunctions.replaceWithAlternative($img); 2411 }); 2412 privateFunctions.replaceImage($img); 2413 }; 2414 if (errorCallback) { 2415 if (!!errorCallbacks[errorCallback]) { 2416 _.each(errorCallbacks, callback => { 2417 callback($img); 2418 }); 2419 } else { 2420 defaultCallback($img); 2421 } 2422 } else { 2423 defaultCallback($img); 2424 } 2425 }); 2426 }); 2427 testImages(element); 2428 } 2429 window.executeAfterConsentExists(() => { 2430 initializeImageErrors($("body")); 2431 }); 2432 $("body").on("lazyLoadError", function (e, __, image, imageSource) { 2433 return; 2434 if (image.is("[data-hide-on-error]")) { 2435 image.css({ 2436 opacity: 0 2437 }); 2438 return; 2439 } 2440 2441 //************************************* */ 2442 var errorCallback = image.data("image-error-callback"); 2443 var defaultCallback = $img => { 2444 $img.off("error").one("error", function (e) { 2445 privateFunctions.replaceWithAlternative($img); 2446 }); 2447 privateFunctions.replaceImage($img); 2448 }; 2449 if (errorCallback) { 2450 if (!!errorCallbacks[errorCallback]) { 2451 _.each(errorCallbacks[errorCallback], callback => { 2452 callback(image); 2453 }); 2454 } else { 2455 defaultCallback(image); 2456 } 2457 } else { 2458 defaultCallback(image); 2459 } 2460 //************************************* */ 2461 }); 2462 window.pixelpoint.images = { 2463 initializeErrors: initializeImageErrors, 2464 testImages: testImages, 2465 registerCallback: function (name, callback) { 2466 if (!errorCallbacks[name]) { 2467 errorCallbacks[name] = []; 2468 } 2469 errorCallbacks[name].push(callback); 2470 }, 2471 deleteCallbacks: function (name) { 2472 if (!!errorCallbacks[name]) { 2473 errorCallbacks[name] = []; 2474 } 2475 } 2476 }; 2477}); 2478$(function () { 2479 if (window.self != window.top) { 2480 $(document.body).addClass("in-iframe"); 2481 } 2482}); 2483window.readCookie = window.readCookie || function (k) { 2484 return (document.cookie.match('(^|; )' + k + '=([^;]*)') || 0)[2]; 2485}; 2486window.setCookie = window.setCookie || function (e, o, i) { 2487 var t = ""; 2488 if (i) { 2489 var n = new Date();
2490 n.setTime(n.getTime() + 24 * i * 60 * 60 * 1e3), t = "; expires=" + n.toUTCString(); 2491 } 2492 document.cookie = e + "=" + (o || "") + t + "; path=/"; 2493}; 2494window.eraseCookie = window.eraseCookie || function (e) { 2495 document.cookie = e + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;'; 2496}; 2497window.executeAfterConsentExists = callback => { 2498 if (typeof __cmp !== 'undefined' && !!__cmp) { 2499 let data = __cmp('getCMPData'); 2500 if (!data) { 2501 __cmp("addEventListener", ["consent", () => { 2502 setTimeout(() => { 2503 callback(); 2504 }, 400); 2505 }, true], null); 2506 } else { 2507 // the consent event does not always trigger? Anyways, here's wonderwall: 2508 let counter = 1000; 2509 let consentCheckInterval = setInterval(() => { 2510 let cmpData = __cmp('getCMPData'); 2511 let vendorConsentLength = !!cmpData && !!cmpData.vendorConsents ? Object.keys(cmpData.vendorConsents).length : 0; 2512 counter--; 2513 // give up after ~150s so this doesn't poll forever when no consent decision ever appears 2514 if (vendorConsentLength > 0 || counter <= 0) { 2515 callback(); 2516 clearInterval(consentCheckInterval); 2517 } 2518 }, 150); 2519 } 2520 } else { 2521 setTimeout(() => { 2522 callback(); 2523 }, 400); 2524 } 2525}; 2526jQuery(function () { 2527 $(document).ready(function (event) { 2528 // a small fix because IE does not support window.location.origin 2529 if (!window.location.origin) { 2530 // Some browsers (mainly IE) does not have this property, so we need to build it manually... 2531 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); 2532 } 2533 2534 //$("iframe").attr("src","about:blank"); 2535 2536 // display offer badge in header slider 2537 var $isHOB = $("#hide-offer-badge"); 2538 if ($isHOB.length) { 2539 var HOBcontent = $(this).find("#hide-offer-badge").html(); 2540 $("div#display-offer-badge").append(HOBcontent); 2541 } 2542 var $headerSocials = $("#header-socials"); 2543 if ($headerSocials.length && $headerSocials.is(":visible") && $headerSocials.is(":empty")) { 2544 var footerSocialsContent = $(".footer .footer-social ul.socials").html(); 2545 $headerSocials.append("<ul class='socials'>" + footerSocialsContent + "</ul>"); 2546 } 2547 2548 /*var $staticSocials = $("#fixedShareButton"); 2549 var $staticSocialsPopup = $("#fixedShareButtons-popup"); 2550 $staticSocials.click(function (e) { 2551 e.preventDefault(); 2552 if ( 2553 $staticSocials.length && 2554 $staticSocials.is(":visible") && 2555 !$staticSocialsPopup.is(":empty") 2556 ) { 2557 $staticSocialsPopup.toggleClass("open"); 2558 } 2559 });*/ 2560 2561 var $staticContact = $("#fixedContactButton"); 2562 var $staticContactPopup = $("#fixedShareContact-popup"); 2563 $staticContact.click(function (e) { 2564 e.preventDefault(); 2565 if ($staticContact.length && $staticContact.is(":visible") && !$staticContactPopup.is(":empty")) { 2566 $staticContactPopup.toggleClass("open"); 2567 } 2568 }); 2569 var $staticContactSmall = $("#fixedContactButton-small"); 2570 var $staticContactPopupSmall = $("#fixedShareContact-popup-small"); 2571 $staticContactSmall.click(function (e) { 2572 e.preventDefault(); 2573 if ($staticContactSmall.length && $staticContactSmall.is(":visible") && !$staticContactPopupSmall.is(":empty")) { 2574 $staticContactPopupSmall.toggleClass("open"); 2575 } 2576 }); 2577 2578 //********************some SEO stuff****************************** */ 2579 if (!!sessionStorage) { 2580 let fromAirBnB = sessionStorage.getItem("fromAirBnB"); 2581 2582 //first we check if we are on a detail page 2583 if ($(".detailpage-header").length > 0) { 2584 if (!!fromAirBnB) {
2585 window.pixelpoint.tagManager.event("cameFromAirBnB", { 2586 eventname: "cameFromAirBnB" 2587 }); 2588 } 2589 } 2590 2591 //on each site we remove the flag 2592 sessionStorage.removeItem("fromAirBnB"); 2593 } 2594 $("body").on("click", "a", function () { 2595 if ($(".rbnb-wrapper").length > 0 || $(".external-map-wrapper").length > 0) { 2596 if ($(this).closest(".rbnb-wrapper").length > 0 || $(this).closest(".external-map-wrapper").length > 0) sessionStorage.setItem("fromAirBnB", true); 2597 } 2598 }); 2599 //**************************************************************** */ 2600 2601 checkForItemWithBanderole(); 2602 }); 2603 dedectAndroidVersion(); 2604 2605 //$("body").append("<a id='scrollToTopButton' title='nach oben'><i class='icon-arrow-big-up'></a>"); 2606 2607 var appendButtonHeight = $(window).height(); 2608 var appendButtonHeightBottomButtons = $(window).height() * 0.5; 2609 if ($(window).width() <= 480) { 2610 appendButtonHeight = $(window).height() * 1.3; 2611 } 2612 if (Foundation.MediaQuery.current == "small") { 2613 $("#bottom-button-wrapper").hide(); 2614 } 2615 var iScrollPos = 0; 2616 var scrollingGetParam = new RegExp("[?&]" + "testScrollingMenu" + "=([^&#]*)").exec(window.location.href); 2617 var scrolled = false; 2618 $(window).scroll(function () { 2619 scrolled = true; 2620 }); 2621 setInterval(function () { 2622 if (scrolled) { 2623 scrolled = false; 2624 if (Foundation.MediaQuery.current == "small") { 2625 if ($(this).scrollTop() > appendButtonHeightBottomButtons) { 2626 //$('#scrollToTopButton').fadeIn(); 2627 $("#bottom-button-wrapper").fadeIn(); 2628 } else { 2629 //$('#scrollToTopButton').fadeOut(); 2630 $("#bottom-button-wrapper").fadeOut(); 2631 setTimeout(function () { 2632 $(".fixed-button-popup").removeClass("open"); 2633 }, 250); 2634 } 2635 } else { 2636 if ($(this).scrollTop() > appendButtonHeight) { 2637 $("#scrollToTopButton").fadeIn(); 2638 } else { 2639 $("#scrollToTopButton").fadeOut(); 2640 setTimeout(function () { 2641 $(".fixed-button-popup").removeClass("open"); 2642 }, 250); 2643 } 2644 } 2645 2646 // scroll effect on Large Screens 2647 if (Foundation.MediaQuery.current == "large") { 2648 var headerHeight = $(".header-wrapper > .header > .row").height(); 2649 //var headerPositionNew = headerHeight + 18; 2650 var headerPositionNew = headerHeight + 2; 2651 var iCurScrollPos = $(this).scrollTop(); 2652 2653 // ZP 08.05.2020 2654 /** 2655 * this change was made as part of the ticket 1069. The customer requestet that the full header is 2656 * only shown when the user scrollt to the top of the page 2657 */ 2658 if (iCurScrollPos == 0) { 2659 $(".header-wrapper .header").css("top", "auto"); 2660 } else { 2661 $(".header-wrapper .header").css("top", "-" + headerPositionNew + "px"); 2662 } 2663 } else { 2664 $(".header-wrapper .header").css("top", "auto"); 2665 $(".header-wrapper .header > .row").removeAttr("style"); 2666 } 2667 // scroll effect on Large Screens - END 2668 } 2669 }, 100); 2670 2671 //Click event to scroll to top 2672 $("#scrollToTopButton").click(function () { 2673 $("html, body").animate({ 2674 scrollTop: 0 2675 }, 800); 2676 // reset focus to first visible link of page 2677 document.activeElement.blur(); 2678 $(".header a:visible").first().focus(); 2679 return false; 2680 }); 2681 $("#scrollDownButton").click(function () { 2682 $("html, body").animate({ 2683 scrollTop: $(".dce-header").height() + 10 // +$(".dce-header").offset().top 2684 }, 800); 2685 return false; 2686 }); 2687 if ($("#sidebar-chatbox").length != 0) { 2688 var title = $("#sidebar-chatbox").find("h4").text(); 2689 var telLink = $("#sidebar-chatbox a.phone-number").attr("href"); 2690 $("#bottom-contact-box h6").text(title); 2691 $("#bottom-contact-box a.contact-phone").attr("href", telLink); 2692 } else { 2693 $("#bottom-button-wrapper").addClass("no-contact-box"); 2694 $("#bottom-contact-box").addClass("hide"); 2695 $("#fixedChatButton").addClass("hide"); 2696 } 2697 2698 // remove first big letter, when char is a number 2699 $(".tx-dce-pi1 .verticapital-blue, .tx-dce-pi1 .capital-blue, .tx-dce-pi1 .capital-white, .tx-dce-pi1 .capital, .supermenu .capital, .supermenu .capital-white").each(function () { 2700 var $this = $(this); 2701 var headlineText = $.trim($this.text()); 2702 var firstLetter = headlineText.charAt(0); 2703 if (!isNaN(firstLetter)) { 2704 $this.addClass("no-big-captial"); 2705 } 2706 }); 2707 2708 // smooth scrolling to anchor links on the actual page 2709 $("a.internal-link").click(function () { 2710 var href = $.attr(this, "href"); 2711 if (href.indexOf("#") > -1) { 2712 var hrefArray = href.split("#"); 2713 var targetId = hrefArray[1]; 2714 if ($("#" + targetId).length != 0) { 2715 event.preventDefault(); 2716 var headerHeight = $(".header-wrapper .header").height() + 20; 2717 $("html, body").animate({ 2718 scrollTop: $("#" + targetId).offset().top - headerHeight 2719 }, 500); 2720 } 2721 } 2722 }); 2723 var privateFunctions = { 2724 getHeight(element) { 2725 if (element.is(":visible") && element.height() > 0) { 2726 return element.outerHeight(true); 2727 } 2728 var previousCss = element.attr("style"); 2729 element.addClass("no-transition"); 2730 element.css({ 2731 //position: 'absolute', 2732 visibility: "hidden", 2733 //display: 'block', 2734 "max-height": "none" 2735 }); 2736 var height = element.outerHeight(true); 2737 element.attr("style", previousCss ? previousCss : ""); 2738 element.removeClass("no-transition"); 2739 return height; 2740 } 2741 }; 2742 2743 // not used ? - UPDATE: used on prices :S 2744 initPriceReadMore(); 2745 $(".show-more-content").each(function () { 2746 var $this = $(this); 2747 if ($this.is(":empty")) { 2748 $this.parent().hide(); 2749 } 2750 }); 2751 $(window).on('load', function () { 2752 $(".show-more").each(function () { 2753 var $this = $(this); 2754 $this.find("[data-max-height]").each(function () { 2755 var height = privateFunctions.getHeight($(this)); 2756 $(this).data("height", height); 2757 }); 2758 $this.find(".show-more-arrow").on("click", function (e) { 2759 if (!$this.hasClass("multi-level")) { 2760 $this.toggleClass("open"); 2761 $this.find("[data-max-height]").each(function () { 2762 if ($this.hasClass("open")) $(this).css("max-height", $(this).data("height"));else $(this).css("max-height", ""); 2763 }); 2764 } else { 2765 if ($this.hasClass("open")) { 2766 $this.find("[data-max-height]").css("max-height", "").removeClass("is-open"); 2767 $this.removeClass("open").removeClass("visible"); 2768 } else { 2769 $this.addClass("visible"); 2770 $this.find("[data-max-height]").each(function () { 2771 if ($(this).hasClass("is-open")) { 2772 return true; 2773 } 2774 $(this).addClass("is-open").css("max-height", $(this).data("height")); 2775 return false;
2776 }); 2777 if ($this.find("[data-max-height]").not(".is-open").length == 0) { 2778 $this.addClass("open"); 2779 } 2780 } 2781 } 2782 }); 2783 }); 2784 }); 2785 // not used ? - END 2786 2787 /* 2788 $('.swipebox').swipebox({ 2789 removeBarsOnMobile: false, 2790 hideBarsDelay: 0, 2791 loopAtEnd: false 2792 }); 2793 //*/ 2794 2795 // FIX: jQuery 3.x compatibility 2796 $(document).on('click', '.swipebox:not(.slick-slide .swipebox)', function (e) { 2797 e.preventDefault(); 2798 var $this = $(this); 2799 var images = [{ 2800 href: $this.attr('href'), 2801 title: $this.attr('title') || '' 2802 }]; 2803 $.swipebox(images, { 2804 removeBarsOnMobile: false, 2805 hideBarsDelay: 0, 2806 loopAtEnd: false 2807 }); 2808 }); 2809 $("body").on("click", ".slick-slider .swipebox, .slick-slider .hover-display", function (e) { 2810 e.preventDefault(); 2811 var swipeGallery = $(e.target).closest(".slick-slider"); 2812 if (swipeGallery.length == 0) return; 2813 var images = []; 2814 swipeGallery.find(".slick-slide").not(".slick-cloned").find(".swipebox").each(function () { 2815 images.push({ 2816 href: $(this).attr("href") 2817 }); 2818 }); 2819 $.swipebox(images, { 2820 removeBarsOnMobile: false, 2821 hideBarsDelay: 0, 2822 loopAtEnd: false 2823 }); 2824 }); 2825 2826 /* 2827 $('.swipebox').each(function(){ 2828 var $this = $(this); 2829 if($this.closest(".slick-initialized").length == 0){ 2830 $this.swipebox({ 2831 removeBarsOnMobile: false, 2832 hideBarsDelay: 0, 2833 loopAtEnd: false 2834 }); 2835 } 2836 else{ 2837 $this.closest(".slick-initialized").on("click",".swipebox",function(e){ 2838 e.preventDefault(); 2839 var swipeGallery = $(e.target).closest(".slick-initialized"); 2840 if(swipeGallery.length == 0) 2841 return; 2842 var images = []; 2843 swipeGallery.find(".slick-slide").not(".slick-cloned").find(".swipebox").each(function(){ 2844 images.push({href:$(this).attr("href")}); 2845 }); 2846 $.swipebox(images,{ 2847 removeBarsOnMobile: false, 2848 hideBarsDelay: 0, 2849 loopAtEnd: false 2850 }); 2851 }); 2852 } 2853 }); 2854 //*/ 2855 2856 /* 2857 $(".swipe-gallery").on("click",".swipebox",function(e){ 2858 e.preventDefault(); 2859 var swipeGallery = $(e.target).closest(".swipe-gallery"); 2860 if(swipeGallery.length == 0) 2861 return; 2862 var images = []; 2863 swipeGallery.find(".slick-slide").not(".slick-cloned").find(".swipebox").each(function(){ 2864 images.push({href:$(this).attr("href")}); 2865 }); 2866 $.swipebox(images,{ 2867 removeBarsOnMobile: false, 2868 hideBarsDelay: 0, 2869 loopAtEnd: false 2870 }); 2871 }); 2872 //*/ 2873 2874 $(document.body).on("click touchend", "#swipebox-slider .current img", function (e) { 2875 return false; 2876 }); 2877 $(document.body).on("click touchend", "#swipebox-slider .current", function (e) { 2878 //$('#swipebox-close').trigger('click'); 2879 return false; 2880 }); 2881 $(document).on("lity:open", function (event, instance) { 2882 $("body").addClass("modalOpen"); 2883 }); 2884 $(document).on("lity:close", function (event, instance) { 2885 $("body").removeClass("modalOpen"); 2886 }); 2887 $(".tabs-title").on("click", "a", function (e) { 2888 var parentModule = $(e.target).closest("[data-tag-event-click='moduleClicked']"); 2889 if (parentModule.length > 0) parentModule.click(); 2890 }); 2891 $(".pp-form-element.current-date").each(function () { 2892 var currentDate = moment().format("DD.MM.YYYY"); 2893 $(this).val(currentDate).after($(`<label class="current-date-display">${currentDate}</label>`)); 2894 }); 2895 if ($(window).width() < 640) { 2896 $(".tabMobileAccordion").on("click", ".accordion-title", function () { 2897 var $clickedElem = $(this); 2898 setTimeout(function () { 2899 //$('html,body').animate({scrollTop: $('.is-active').offset().top - $('.header-wrapper .header').height() - 5}, 800); 2900 $("html,body").animate({ 2901 scrollTop: $clickedElem.offset().top - $(".header-wrapper .header").height() - 5 2902 }, 800); 2903 }, 250); //Adjust to match slideSpeed 2904 }); 2905 } 2906 2907 /* ********* tag manager stuff ******************* */ 2908 $("#sidebar-chatbox").on("click", ".brandenbutton.brandenbutton-blue", function (e) { 2909 var targetText = $(e.target).closest(".brandenbutton.brandenbutton-blue").text(); 2910 var targetClickText = $(e.target).closest(".brandenbutton.brandenbutton-blue").find("a").attr("onclick"); 2911 if (_.includes(targetText, "Insidertipps")) window.pixelpoint.tagManager.event
2911("insiderClick", { 2912 eventname: "insiderClick" 2913 });else if (_.includes(targetClickText, "Insidertipps")) window.pixelpoint.tagManager.event("insiderClick", { 2914 eventname: "insiderClick" 2915 }); 2916 }); 2917 $(".openinghours-price-box").on("click", ".einklappen", function (e) { 2918 var target = $(e.target).closest(".einklappen"); 2919 var isClosed = target.hasClass("active"); 2920 var text = ""; 2921 if (isClosed) { 2922 text = target.find(".text1").text(); 2923 } else { 2924 text = target.find(".text2").text(); 2925 } 2926 window.pixelpoint.tagManager.event("Mehr Infos anzeigen", { 2927 eventname: "Mehr Infos anzeigen", 2928 NameMehrInfos: text, 2929 OffenMehrInfos: !isClosed //this event fires before the box is opened 2930 }); 2931 }); 2932 $(".openinghours-price-box").on("click", ".arrow-open", function (e) { 2933 var target = $(e.target).closest(".arrow-open"); 2934 var isClosed = !target.closest(".transparent-gradient").hasClass("open"); 2935 var text = ""; 2936 if (isClosed) { 2937 text = target.find(".text2").text(); 2938 } else { 2939 text = target.find(".text1").text(); 2940 }
2941 window.pixelpoint.tagManager.event("Mehr Infos anzeigen", { 2942 eventname: "Mehr Infos anzeigen", 2943 NameMehrInfos: text, 2944 OffenMehrInfos: isClosed // this event fires after the box is opened. So it needs to be the inverse 2945 }); 2946 }); 2947 $("body").on("click", ".overlaykarte .lity-close", function () { 2948 window.pixelpoint.tagManager.event("Karte-SchlieÃen-Klick", { 2949 eventname: "Karte-SchlieÃen-Klick" 2950 }); 2951 }); 2952 /* *********************************************** */ 2953 2954 //---------------------*/ 2955 if ($("#ppcarto > div[data-pp-interchange]").length > 0) { 2956 var interchangeData = $("#ppcarto > div[data-pp-interchange]").data("pp-interchange"); 2957 var mapInterchange = null; 2958 $("#ppcarto > div[data-pp-interchange]").on("replaced.zf.interchange", function () { 2959 if (mapInterchange == null) return; 2960 var match; 2961 for (var i in mapInterchange.rules) { 2962 if (mapInterchange.rules.hasOwnProperty(i)) { 2963 var rule = mapInterchange.rules[i]; 2964 if (window.matchMedia(rule.query).matches) { 2965 match = rule; 2966 } 2967 } 2968 } 2969 if (match) { 2970 if (mapInterchange.currentPath === match.path) return; 2971 if (match.path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) { 2972 $("#ppcarto > div[data-pp-interchange]").css({ 2973 "background-image": "url(" + match.path + ")" 2974 }); 2975 } 2976 } 2977 }); 2978 $("#ppcarto > div[data-pp-interchange]").attr("data-interchange", interchangeData).data("interchange", interchangeData); 2979 mapInterchange = new Foundation.Interchange($("#ppcarto > div[data-pp-interchange]"), {}); 2980 } 2981 /* 2982 $(".extbase-debugger").hide(); 2983 if($(".extbase-debugger").length > 0 && !$(".extbase-debugger").is(":visible")){ 2984 setTimeout(function () { 2985 console.log("reinit"); 2986 $( window ).trigger('orientationchange'); 2987 }, 250); 2988 } 2989 */ 2990 2991 $(document).on("invalid.zf.abide", function (ev, elem) { 2992 $(ev.target).closest("form").removeClass("valid").addClass("invalid"); 2993 }) 2994 // field element is valid 2995 .on("valid.zf.abide", function (ev, elem) { 2996 $(ev.target).closest("form").removeClass("invalid").addClass("valid"); 2997 }); 2998 $(".checkbox-helper").each(function (e) { 2999 var container = $(this); 3000 var label = container.find("label"); 3001 var checkboxId = label.attr("for"); 3002 label.attr("for", ""); 3003 label.addClass("clickable"); 3004 var onClickFunc = _.debounce(function () { 3005 $(`#${checkboxId}`).prop("checked", !$(`#${checkboxId}`).prop("checked")); 3006 }, 200); 3007 container.on("click touchstart", "label", function () { 3008 onClickFunc(); 3009 }); 3010 }); 3011 3012 /* ********* TPBB - Scrolling internal Page Links ******************* */ 3013 setTimeout(function () { 3014 if (location.hash) { 3015 /* we need to scroll to the top of the window first, because the browser will always jump to the anchor first before JavaScript is ready, thanks Stack Overflow: http://stackoverflow.com/a/3659116 */ 3016 // window.scrollTo(0, 0); 3017 var target = location.hash.split('#'); 3018 //smoothScrollTo($('#' + target[1])); 3019 if ($('#' + target[1]).has("[data-accordion]")) { 3020 // is scrolled when open accordion 3021 var $firstAccordionItem = $('#' + target[1]).find("[data-accordion-item]:first-of-type"); 3022 if ($firstAccordionItem.find("a.accordion-title").length) { 3023 $firstAccordionItem.find("a.accordion-title").trigger('click'); 3024 } 3025 } else { 3026 window.pixelpoint.utilities.scrollTo($('#' + target[1]), false, 0); 3027 } 3028 } 3029 }, 20); 3030 3031 // taken from: https://css-tricks.com/snippets/jquery/smooth-scrolling/ 3032 $('a[href*="#"]:not([role="tab"])').click(function (event) { 3033 if (this.hash != "#" && this.hash != "" && !$(this).hasClass("open-in-modal")) { 3034 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 3035 event.preventDefault(); 3036 //smoothScrollTo($(this.hash)); 3037 window.pixelpoint.utilities.scrollTo($(this.hash), false, 0); 3038 return false;
3039 } 3040 } 3041 }); 3042 3043 // own accordion (no foundation) 3044 $('.accordion-comfort-barrierfree.accordion .accordion-title[data-accordion-trigger]').on('click', function () { 3045 var $accordion = $(this).closest('.accordion'); 3046 var $accordionContent = $(this).next('.accordion-content'); 3047 3048 // Close all other open items in this accordion 3049 $accordion.find('.accordion-content').each(function () { 3050 if (this !== $accordionContent[0] && $(this).attr('aria-hidden') === 'false') { 3051 $(this).attr('aria-hidden', 'true'); 3052 $(this).prev('.accordion-title').attr('aria-expanded', 'false'); 3053 $(this).parent().removeClass('is-active'); 3054 } 3055 }); 3056 3057 // Toggle the clicked item 3058 var isOpen = $accordionContent.attr('aria-hidden') === 'false'; 3059 $(this).attr('aria-expanded', !isOpen); 3060 $(this).parent().toggleClass('is-active', !isOpen); 3061 $accordionContent.attr('aria-hidden', isOpen ? 'true' : 'false'); 3062 }); 3063 3064 //see function description below 3065 injectZeroWidthSpace(); 3066 3067 //******************** Web Share API ****************************** */ 3068 $("a.web-share").on("click", function (e) { 3069 e.preventDefault(); 3070 if (navigator.share) {
3071 window.pixelpoint.tagManager.event("Social-Media-Teilen", { 3072 eventname: "Social-Media-Teilen" 3073 }); 3074 navigator.share({ 3075 title: $(this).attr("data-title"), 3076 url: $(this).attr("data-url") 3077 }).then(() => { 3078 // TPBB-1149 last few comments 3079 window.pixelpoint.tagManager.event("Social-Media-Teilen-Erfolg", { 3080 eventname: "Social-Media-Teilen" 3081 }); 3082 console.log('Thanks for sharing!'); 3083 }).catch(e => { 3084 window.pixelpoint.tagManager.event("Social-Media-Teilen-Abbruch", { 3085 eventname: "Social-Media-Teilen" 3086 }); 3087 console.error(e); 3088 }); 3089 } else {} 3090 }); 3091 //**************************************************************** */ 3092}); 3093function smoothScrollTo(target) { 3094 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 3095 if (target.length) { 3096 var fixedHeaderHeight = 0; 3097 if ($(".header-wrapper .header .main-nav").is(":visible")) { 3098 fixedHeaderHeight = $(".header-wrapper .header .main-nav").height(); 3099 } else if ($(".header-wrapper .header .header-row").is(":visible")) { 3100 fixedHeaderHeight = $(".header-wrapper .header .header-row").height(); 3101 } 3102 $('html,body').animate({ 3103 scrollTop: target.offset().top - fixedHeaderHeight 3104 }, 1000); 3105 } 3106} 3107function dedectAndroidVersion() { 3108 var navU = navigator.userAgent; 3109 3110 // Android Mobile 3111 var isAndroidMobile = navU.indexOf("Android") > -1 && navU.indexOf("Mozilla/5.0") > -1 && navU.indexOf("AppleWebKit") > -1; 3112 3113 // Apple webkit 3114 var regExAppleWebKit = new RegExp(/AppleWebKit\/([\d.]+)/); 3115 var resultAppleWebKitRegEx = regExAppleWebKit.exec(navU); 3116 var appleWebKitVersion = resultAppleWebKitRegEx === null ? null : parseFloat(regExAppleWebKit.exec(navU)[1]); 3117 3118 // Chrome 3119 var regExChrome = new RegExp(/Chrome\/([\d.]+)/); 3120 var resultChromeRegEx = regExChrome.exec(navU); 3121 var chromeVersion = resultChromeRegEx === null ? null : parseFloat(regExChrome.exec(navU)[1]); 3122 3123 // Native Android Browser 3124 var isAndroidBrowser = isAndroidMobile && appleWebKitVersion !== null && appleWebKitVersion < 537 || chromeVersion !== null && chromeVersion < 37; 3125 3126 // ie 3127 var msie = navU.indexOf("MSIE "); 3128 if (isAndroidBrowser) { 3129 $("html").addClass("native-android-browser"); 3130 } else if (/Edge\/\d./i.test(navigator.userAgent)) { 3131 $("html").addClass("microsoft-edge"); 3132 } else if (msie > 0 || !!navU.match(/Trident.*rv\:11\./)) { 3133 $("html").addClass("internet-explorer"); 3134 } else if (navU.match(/(iPod|iPhone|iPad)/)) { 3135 $("html").addClass("ios-device"); 3136 } else {} 3137 if (navU.indexOf("Android") > -1) { 3138 //&& ua.indexOf("Mobile"); 3139 $("html").addClass("android-device"); 3140 } 3141} 3142function changeButtonText(elem, buttonTextOrig, buttonText) { 3143 /* 3144 var $elem = $(elem); 3145 if (!!$elem.hasClass('clicked')) { 3146 $elem.removeClass("clicked"); 3147 return true; 3148 } else { 3149 event.preventDefault(); 3150 elem.innerHTML = buttonText; 3151 setTimeout(function () { 3152 $elem.addClass("clicked"); 3153 $elem.click(); 3154 elem.innerHTML = buttonTextOrig; 3155 }, 150); 3156 } 3157 //*/ 3158 //* 3159 if (!(window.pixelpoint.isMobile.any() && elem.target == "_blank")) { 3160 event.preventDefault(); 3161 elem.innerHTML = buttonText; 3162 if (elem.target == "_blank") { 3163 setTimeout(function () { 3164 window.open(elem.href, "_blank"); 3165 elem.innerHTML = buttonTextOrig; 3166 }, 150); 3167 } else { 3168 setTimeout(function () { 3169 location.href = elem.href; 3170 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 3171 elem.innerHTML = buttonTextOrig; 3172 } 3173 }, 150); 3174 } 3175 } 3176 //*/ 3177} 3178function equalHeight(group, parentElem) { 3179 if (group.length) { 3180 var tallest = 0; 3181 if (!group.hasClass("slick-slide")) { 3182 group.removeAttr("style"); 3183 } 3184 if (parentElem) { 3185 if (parseFloat(group.parent().css("width")) != parseFloat(group.css("width")) || group.parent().width() != group.width()) { 3186 group.each(function () { 3187 var thisHeight = $(this).height(); 3188 if (thisHeight > tallest) { 3189 tallest = thisHeight; 3190 } 3191 }); 3192 group.each(function () { 3193 this.style.setProperty('height', `${tallest}px`, 'important'); 3194 }); 3195 } 3196 } else { 3197 group.each(function () { 3198 var thisHeight = $(this).height(); 3199 if (thisHeight > tallest) { 3200 tallest = thisHeight; 3201 } 3202 }); 3203 //group.height(tallest); 3204 group.css('cssText', `height:${tallest}px !important;`); 3205 } 3206 } 3207} 3208function initPriceReadMore() { 3209 var treshold = 20; 3210 $(".arrow-open").each(function () { 3211 var $this = $(this); 3212 var transparentGradient = $this.closest(".transparent-gradient"); 3213 if (transparentGradient.length == 0) return; 3214 transparentGradient.addClass("active"); 3215 var difference = transparentGradient.get(0).scrollHeight - transparentGradient.height(); 3216 if (difference < treshold) { 3217 transparentGradient.addClass("open"); 3218 $this.hide(); 3219 $this.parent().css("padding-bottom", "0"); 3220 return; 3221 } 3222 $this.off("click").on("click", function (e) { 3223 if (transparentGradient.hasClass("open")) { 3224 var $scrollToElement = $this.prev(); 3225 if ($this.parent().hasClass("scrollUpOnCloseReadMore")) { 3226 $scrollToElement = $this.parent(); 3227 } else if ($this.parent().parent().hasClass("scrollUpOnCloseReadMore")) { 3228 $scrollToElement = $this.parent().parent(); 3229 } else if ($this.parent().parent().parent().hasClass("scrollUpOnCloseReadMore")) { 3230 $scrollToElement = $this.parent().parent().parent(); 3231 } else {} 3232 $("html, body").animate({ 3233 scrollTop: $scrollToElement.offset().top - $(".header-wrapper .header").height() - 10 3234 }, 800); 3235 $(this).attr("title", $(this).find(".text2").first().text()); 3236 } else { 3237 $(this).attr("title", $(this).find(".text1").first().text()); 3238 } 3239 transparentGradient.toggleClass("open"); 3240 }); 3241 }); 3242 3243 /* **************************************************************************** */ 3244 //here we do everything that needs to be done if the user supresses cookies 3245 if (!readCookie("pp_allow_third_party_cookies")) { 3246 /* 3247 $("[data-lity]").each(function () { 3248 var href = $(this).attr("href"); 3249 if (href.includes("www.youtube.com")) { 3250 href = href.replace("www.youtube.com", "www.youtube-nocookie.com"); 3251 $(this).attr("href", href); 3252 } 3253 else if (href.includes("youtube.com")) { 3254 href = href.replace("youtube.com", "www.youtube-nocookie.com"); 3255 $(this).attr("href", href); 3256 } 3257 }); 3258 //*/ 3259 /* 3260 $(document).on("lity:open", function(event, instance) { 3261 var href = instance.opener().attr("href") || ""; 3262 if(href.indexOf("youtube.com") !== -1){ 3263 $(".lity-youtube").remove(); 3264 window.open(href,"_blank"); 3265 } 3266 }); 3267 //*/ 3268 } 3269 /* **************************************************************************** */ 3270} 3271function checkForItemWithBanderole() { 3272 $(".item-banderole").each(function () { 3273 var $this = $(this); 3274 var $thisParentTeaser = $this.parent().parent(); 3275 3276 //$thisParents.find(".item.teaser").addClass("item-with-banderole"); 3277 if ($thisParentTeaser.hasClass("item") && $thisParentTeaser.hasClass("teaser")) { 3278 $thisParentTeaser.addClass("item-with-banderole"); 3279 } 3280 }); 3281} 3282 3283/** 3284 * this function has one purpose, taking specific elements and injecting their inner text with zero width space characters. 3285 * We do this to enable breaking text on specific characters 3286 * function was made by me (ZP) and I am aware that polluting the global namespace is bad practice 3287 */ 3288function injectZeroWidthSpace() { 3289 let charactersToBreak = ["/", "\\", "-", "_", "(", "[", "<", ")", "]", ">"]; 3290 let zeroWidthSpace = "\u200b"; 3291 let selectors = ["table.price-table td.position"];
3292 selectors.forEach(selector => { 3293 $(selector).each(function () { 3294 let replaceRecursive = function (elem) { 3295 if (elem[0].nodeType === 3) { 3296 let contents = elem.text(); 3297 charactersToBreak.forEach(char => { 3298 contents = contents.replaceAll(char, `${char}${zeroWidthSpace}`); 3299 }); 3300 elem[0].nodeValue = contents; 3301 } else { 3302 elem.contents().each(function () { 3303 replaceRecursive($(this)); 3304 }); 3305 } 3306 }; 3307 replaceRecursive($(this)); 3308 }); 3309 }); 3310} 3311//include 21 3312jQuery(function () { 3313 var idCounter = 1; 3314 var privateFunctions = { 3315 getOrAssignId: function ($element) { 3316 var id = $element.attr("id"); 3317 if (!id) { 3318 id = "weather-icon-" + idCounter; 3319 idCounter++; 3320 $element.attr("id", id); 3321 } 3322 return id; 3323 } 3324 }; 3325 var skyconOptions = { 3326 monochrome: false, 3327 colors: { 3328 cloud: "#22759f", 3329 rain: "#22759f", 3330 sun: "#FFCC00" 3331 } 3332 }; 3333 var initIcons = function ($this) { 3334 var skycons = new Skycons(skyconOptions); 3335 var id = privateFunctions.getOrAssignId($this); 3336 var weather = $this.data("icon"); 3337 if (!weather) return; 3338 weather = weather.replace('night', 'day'); 3339 skycons.add(id, weather); 3340 $this.on("mouseover", function () { 3341 skycons.play(); 3342 }); 3343 $this.on("mouseout", function () { 3344 skycons.pause(); 3345 }); 3346 }; 3347 $("canvas.weather-icon").each(function () { 3348 var $this = $(this); 3349 initIcons($this); 3350 /* 3351 var skycons = new Skycons(skyconOptions); 3352 var id = privateFunctions.getOrAssignId($this); 3353 var weather = $this.data("icon"); 3354 if(!weather) 3355 return; 3356 skycons.add(id,weather); 3357 $this.on("mouseover",function(){ 3358 skycons.play(); 3359 }); 3360 $this.on("mouseout",function(){ 3361 skycons.pause(); 3362 }); 3363 */ 3364 }); 3365 window.pixelpoint.ppComponents.skyCons = { 3366 init: initIcons 3367 }; 3368}); 3369//include 16 3370 3371jQuery(function () { 3372 var privateFunctions = { 3373 getDateFromTwoParts: function (from_date, from_time) { 3374 if (!from_date && !from_time) return null; 3375 var fromDate = moment(from_date).startOf("day"); 3376 var fromTime = !!from_time ? moment(from_time).utc() : null; 3377 if (!!fromTime) { 3378 fromDate.hour(fromTime.hour()); 3379 fromDate.minute(fromTime.minute()); 3380 fromDate.second(fromTime.second()); 3381 } 3382 return fromDate; 3383 }, 3384 formatDate(momentDate, displayTime) { 3385 var content = momentDate.format("DD.MM.YYYY"); 3386 if (!!displayTime) { 3387 content = momentDate.format("DD.MM.YYYY, HH:mm [Uhr]"); 3388 } 3389 return content; 3390 } 3391 }; 3392 $(".event-list").each(function () { 3393 var $this = $(this); 3394 var eventListData = $this.data("event-list"); 3395 if (!eventListData) return; 3396 var eventsTable = $this.closest(".event-list-container").find(".event-list-table"); 3397 eventsTable.html(""); 3398 var closestDate = null; 3399 var toAppend = []; 3400 var indexOfClosest = -1; 3401 $.each(eventListData.events, function (index, value) { 3402 var from = privateFunctions.getDateFromTwoParts(value.from_date, value.from_time); 3403 var to = privateFunctions.getDateFromTwoParts(value.to_date, value.to_time); 3404 3405 /*var content = privateFunctions.formatDate(from, !!value.from_time); 3406 if (value.SpansMultipleDays) { 3407 content += " - " + privateFunctions.formatDate(to, !!value.to_time); 3408 }*/ 3409 3410 // TPBB-944 3411 var content = ""; 3412 if (value.SpansMultipleDays) { 3413 content = privateFunctions.formatDate(from, !!value.from_time); 3414 if (to && to.format("HH:mm") != "00:00") { 3415 content += " - " + privateFunctions.formatDate(to, !!value.to_time); 3416 } 3417 } else { 3418 if (to && to.format("HH:mm") != "00:00") { 3419 content = privateFunctions.formatDate(from, !!value.from_time).replace("Uhr", ""); 3420 content += "- " + to.format("HH:mm [Uhr]"); 3421 } else { 3422 content = privateFunctions.formatDate(from, !!value.from_time); 3423 } 3424 } 3425 var greyOut = false; 3426 if (moment().diff(to) > 0) { 3427 greyOut = true; 3428 } 3429 var row = $('<tr><td><span></span></td></tr>'); 3430 row.find('span').text(content); 3431 if (greyOut) row.find('span').addClass("greyedOut"); 3432 if (!greyOut) 3433 //only dates, that are in the future 3434 toAppend.push(row); //eventsTable.append(row); 3435
3436 //**************we find the closest date********************* 3437 if (!closestDate) { 3438 closestDate = { 3439 from: from, 3440 useFromTime: !!value.from_time, 3441 to: to, 3442 useToTime: !!value.to_time, 3443 SpansMultipleDays: value.SpansMultipleDays 3444 }; 3445 indexOfClosest = toAppend.length - 1; 3446 } else if (moment().diff(from) >= 0 && moment().diff(to) <= 0) 3447 //from is in the past, to is in the future 3448 { 3449 closestDate = { 3450 from: from, 3451 useFromTime: !!value.from_time, 3452 to: to, 3453 useToTime: !!value.to_time, 3454 SpansMultipleDays: value.SpansMultipleDays 3455 }; 3456 indexOfClosest = toAppend.length - 1; 3457 } else if (moment().diff(from) <= 0 && Math.abs(moment().diff(closestDate.from)) > Math.abs(moment().diff(from))) { 3458 closestDate = { 3459 from: from, 3460 useFromTime: !!value.from_time, 3461 to: to, 3462 useToTime: !!value.to_time, 3463 SpansMultipleDays: value.SpansMultipleDays 3464 }; 3465 indexOfClosest = toAppend.length - 1; 3466 } 3467 //*********************************************************** 3468 }); 3469 $.each(toAppend, function (index, row) { 3470 if (indexOfClosest != index) { 3471 eventsTable.append(row); 3472 } 3473 }); 3474 3475 /* 3476 if(!!closestDate){ 3477 $this.html(""); 3478 var content = privateFunctions.formatDate(closestDate.from,closestDate.useFromTime); 3479 if(closestDate.SpansMultipleDays) 3480 content += " - "+privateFunctions.formatDate(closestDate.to,closestDate.useToTime); 3481 var greyOut = false; 3482 if(moment().diff(closestDate.to) > 0){ 3483 greyOut = true; 3484 } 3485 var span = $('<span></span>'); 3486 span.text(content); 3487 if(greyOut) 3488 span.addClass("greyedOut"); 3489 $this.append(span); 3490 } 3491 */ 3492 }); 3493}); 3494//include 21 3495jQuery(function () { 3496 var transitionEndEvents = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend"; 3497 var tresholdiE = 0; 3498 if ($("html").hasClass("microsoft-edge") || $("html").hasClass("internet-explorer")) { 3499 tresholdiE = 5; 3500 } 3501 var treshold = 70 + tresholdiE; 3502 if ($(window).width() < 640) { 3503 treshold = 50 + tresholdiE; 3504 } 3505 3506 /* 3507 if(Foundation.MediaQuery.current != 'small' && $(".content article.contentbar").length > 0 && $(".content article.sidebar").length > 0){ 3508 var $contentHeight = $(".content article.contentbar").outerHeight(); 3509 var $sidebarHeight = $(".content article.sidebar").outerHeight(); 3510 if($contentHeight <= $sidebarHeight){ 3511 $(".content article.contentbar .more-wrapper").each(function () { 3512 //$(this).css("max-height","none"); 3513 //$(this).attr("data-strict","data-strict"); 3514 treshold = 10000; 3515 }); 3516 } 3517 } 3518 */ 3519 3520 if (disableReadMore() == true) { 3521 //treshold = 10000; 3522 } 3523 $(".more-wrapper").each(function () { 3524 addReadMoreButtons($(this), transitionEndEvents, treshold); 3525 }); 3526 var beforeMediaQuery = Foundation.MediaQuery.current; 3527 $(window).on("orientationchange resize", function () { 3528 if (beforeMediaQuery != Foundation.MediaQuery.current) { 3529 beforeMediaQuery = Foundation.MediaQuery.current; 3530 if ($(window).width() < 640) { 3531 treshold = 50 + tresholdiE; 3532 } else { 3533 //treshold = 50; 3534 treshold = 70 + tresholdiE; 3535 } 3536 if (disableReadMore() == true) { 3537 //treshold = 10000; 3538 } 3539 $(".more-wrapper").each(function () { 3540 $(this).removeClass('active'); 3541 $(this).removeAttr('style'); 3542 addReadMoreButtons($(this), transitionEndEvents, treshold); 3543 }); 3544 } 3545 }); 3546 3547 // hide content which is for tomorrow 3548 $("[class^='show-on-date-'], [class*=' show-on-date-']").each(function () { 3549 var $this = $(this); 3550 var elemDateRes = $this.attr("class").split("show-on-date-"); 3551 var elemShowDate = elemDateRes[1]; 3552 var today = $.datepicker.formatDate('yy-mm-dd', new Date()); 3553 if (elemShowDate == today) { 3554 $this.show(); 3555 } else { 3556 $this.hide(); 3557 } 3558 }); 3559}); 3560var calculateElementsBasedOnOffset = function ($this, fixedPoint, gradientOverlay, treshold) { 3561 treshold = treshold || 0; 3562 var offset = fixedPoint.offset(); 3563 var fromTop = offset.top + treshold; 3564}; 3565function addReadMoreButtons($this, transitionEndEvents, treshold) { 3566 var callbacks = { 3567 "open": [], 3568 "close": [], 3569 "toggle": [], 3570 "openEnd": [], 3571 "closeEnd": [], 3572 "toggleEnd": [] 3573 }; 3574 var runCallbacks = function (eventName, args) { 3575 if (!callbacks[eventName]) return; 3576 var args = args || {}; 3577 $.each(callbacks[eventName], function (index, callback) { 3578 callback(args); 3579 }); 3580 }; 3581 var onOpenClick = function (e) { 3582 // read-more toggles also sit inside search forms, where a submit would trigger the search 3583 e.preventDefault(); 3584 var $target = $this; 3585 if (e.target && $(e.target).closest(".more-wrapper").length > 0) { 3586 $target = $(e.target).closest(".more-wrapper"); 3587 } 3588 $target.toggleClass("open"); 3589 if ($target.hasClass("open")) { 3590 $target.css("max-height", $target.get(0).scrollHeight); 3591 $target.find(".button-open").attr("title", $target.find(".hide:not(img)").first().text()); 3592
3593 //************parents********************** 3594 $target.parents('.more-wrapper.active.open').css('max-height', 'none'); 3595 //***************************************** 3596 3597 $target.one(transitionEndEvents, function () { 3598 runCallbacks("openEnd"); 3599 $target.parents('.more-wrapper.active.open').each(function () { 3600 $(this).css('max-height', $(this).get(0).scrollHeight); 3601 }); 3602 if ($(".sticky").length > 0) { 3603 $('.sticky').foundation('_calc', true); 3604 } 3605 }); 3606 runCallbacks("open"); 3607 window.pixelpoint.tagManager.event('einAusKlappenClick', { 3608 'eventName': 'ausklappen' 3609 }); 3610 } else { 3611 $target.css("max-height", ""); 3612 if ($target.data().hasOwnProperty("dynamicHeightValue")) { 3613 $target.css("max-height", $target.data("dynamicHeightValue")); 3614 } 3615 $target.find(".button-open").attr("title", $target.find(".show:not(img)").first().text()); 3616 var checkboxGroup = $target.closest(".checkbox-group"); 3617 if (checkboxGroup.length == 0) { 3618 var $scrollToElement = $target; 3619 if ($target.parent().hasClass('scrollUpOnCloseReadMore')) { 3620 $scrollToElement = $target.parent(); 3621 } else if ($target.parent().parent().hasClass('scrollUpOnCloseReadMore')) { 3622 $scrollToElement = $target.parent().parent(); 3623 } else if ($target.parent().parent().parent().hasClass('scrollUpOnCloseReadMore')) { 3624 $scrollToElement = $target.parent().parent().parent(); 3625 } else if ($target.parent().parent().parent().parent().hasClass('scrollUpOnCloseReadMore')) { 3626 $scrollToElement = $target.parent().parent().parent().parent(); 3627 } else {} 3628 if ($(window).width() < 640) { 3629 $("html, body").animate({ 3630 scrollTop: $scrollToElement.offset().top - $('.header-wrapper .header').height() - 5 3631 }, 800); 3632 } else { 3633 //$("html, body").animate({scrollTop: $scrollToElement.offset().top + $('.header-wrapper .header').height() - 50}, 800); 3634 $("html, body").animate({ 3635 scrollTop: $scrollToElement.offset().top - $('.header-wrapper .header').height() - 10 3636 }, 800); 3637 } 3638 } 3639 $target.one(transitionEndEvents, function () { 3640 runCallbacks("closeEnd"); 3641 }); 3642 runCallbacks("close");
3643 window.pixelpoint.tagManager.event('einAusKlappenClick', { 3644 'eventName': 'einklappen' 3645 }); 3646 } 3647 $(".sticky").each(function () { 3648 try { 3649 $(this).foundation('_calc', true); 3650 } catch (err) {} 3651 }); 3652 runCallbacks("toggle"); 3653 $target.one(transitionEndEvents, function () { 3654 runCallbacks("toggleEnd"); 3655 }); 3656 }; 3657 var exposed = { 3658 init: function () { 3659 if (!$this.is("[data-disable-read-more]")) { 3660 // $this.data().hasOwnProperty("disableReadMore") 3661 if ($this.data().hasOwnProperty("dynamicHeightValue")) { 3662 // works only in combination with the data-strict attribute 3663 var dynamicHeightVal = $this.data("dynamicHeightValue"); 3664 $this.css('max-height', parseInt(dynamicHeightVal)); 3665 } 3666 setTimeout(() => { 3667 // +1px to avoid rounding errors 3668 if ($this.get(0).scrollHeight > $this.height() + 1) { 3669 var difference = $this.get(0).scrollHeight - $this.height(); 3670 var isStrict = $this.is("[data-strict]"); 3671 var isVierspalterImageCard = isStrict && $this.hasClass("content-with-img") && $this.closest(".dce-vierspalter").length > 0; 3672 3673 // Prevent false positives from tiny layout deltas on vierspalter image cards. 3674 if (!isStrict || isVierspalterImageCard) { 3675 if (difference <= treshold) { 3676 //$this.css("max-height", $this.get(0).scrollHeight); 3677 $this.css("max-height", $this.get(0).scrollHeight + 10); 3678 return; 3679 } 3680 } else if ($("html").hasClass("microsoft-edge") || $("html").hasClass("internet-explorer")) { 3681 if ($this.get(0).scrollHeight <= $this.height() + 5) { 3682 return; 3683 } 3684 } 3685 $this.addClass("active"); 3686 3687 // with these 2 lines the click is triggerd twice in db-convention-programme slider 3688 //$this.find(">.arrow-open .button-open").off("click", onOpenClick); 3689 //$this.find(">.arrow-open .button-open").on("click", onOpenClick); 3690 $this.find(">.arrow-open .button-open").off("click").on("click", onOpenClick); 3691 $this.find(">.arrow-open .button-open").each(function (index, element) { 3692 if ($(element).hasClass("open")) { 3693 $(element).find(".button-open").attr("title", $(element).find(".hide:not(img)").first().text()); 3694 } else { 3695 $(element).find(".button-open").attr("title", $(element).find(".show:not(img)").first().text()); 3696 } 3697 }); 3698 } else { 3699 if ($this.is("[data-always-active]")) { 3700 $this.addClass("active"); 3701 //$this.find(">.arrow-open .button-open").off("click", onOpenClick); 3702 //$this.find(">.arrow-open .button-open").on("click", onOpenClick); 3703 $this.find(">.arrow-open .button-open").off("click").on("click", onOpenClick); 3704 $this.find(">.arrow-open .button-open").each(function (index, element) { 3705 if ($(element).hasClass("open")) { 3706 $(element).find(".button-open").attr("title", $(element).find(".hide").first().text()); 3707 } else { 3708 $(element).find(".button-open").attr("title", $(element).find(".hide").first().text()); 3709 } 3710 }); 3711 } else if ($this.data().hasOwnProperty("dynamicHeightValue")) { 3712 $this.css('max-height', 'none'); 3713 } else {} 3714 } 3715 }, 150); 3716 } 3717 }, 3718 on: function (eventName, callback) { 3719 if (!callbacks[eventName]) return; 3720 callbacks[eventName].push(callback); 3721 }, 3722 off: function (eventName, callback) { 3723 if (!callbacks[eventName]) return; 3724 var index = callbacks[eventName].indexOf(callback); 3725 if (index > -1) callbacks[eventName].splice(index, 1); 3726 }, 3727 open: function (triggerEvent) { 3728 triggerEvent = triggerEvent || false; 3729 if ($this.hasClass("open")) return; 3730 $this.addClass("open"); 3731 $this.css("max-height", $this.get(0).scrollHeight); 3732 if (triggerEvent) runCallbacks("open"); 3733 }, 3734 close: function (triggerEvent) { 3735 triggerEvent = triggerEvent || false; 3736 if (!$this.hasClass("open")) return; 3737 $this.removeClass("open"); 3738 $this.css("max-height", ""); 3739 if ($this.data().hasOwnProperty("dynamicHeightValue")) { 3740 $this.css("max-height", $this.data("dynamicHeightValue")); 3741 } 3742 if (triggerEvent) runCallbacks("close"); 3743 } 3744 }; 3745 $this.data("show-more", exposed); 3746 exposed.init(); 3747} 3748function disableReadMore() { 3749 if (Foundation.MediaQuery.current != 'small' && $(".content article.contentbar").length > 0 && $(".content article.sidebar").length > 0) { 3750 var $firstMoreWrapper = $(".content article.contentbar .more-wrapper").first(); 3751 var maxHeight = $firstMoreWrapper.css("max-height"); 3752 $(".content article.contentbar .more-wrapper").css("max-height", "none"); 3753 var $contentHeight = $(".content article.contentbar").outerHeight() - 100; 3754 var $sidebarHeight = $(".content article.sidebar").outerHeight(); 3755 if ($firstMoreWrapper.hasClass("detailpage-no-gallery") && $contentHeight + 100 > $sidebarHeight) { 3756 var newMaxHeight = $sidebarHeight - 250; 3757 if (newMaxHeight < 450) { 3758 newMaxHeight = 450; 3759 } 3760 $(".content article.contentbar .more-wrapper").css("max-height", newMaxHeight + "px"); 3761 } else { 3762 $(".content article.contentbar .more-wrapper").css("max-height", maxHeight); 3763 } 3764 if ($contentHeight <= $sidebarHeight) { 3765 return true; 3766 } 3767 } 3768 return false;
3769} 3770window.ppComponents = window.ppComponents || {}; 3771window.ppComponents.common = window.ppComponents.common || {}; 3772window.ppComponents.common.showMore = function ($element) { 3773 var transitionEndEvents = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend"; 3774 var tresholdiE = 0; 3775 if ($("html").hasClass("microsoft-edge") || $("html").hasClass("internet-explorer")) { 3776 tresholdiE = 5; 3777 } 3778 var treshold = 70 + tresholdiE; 3779 if ($(window).width() < 640) { 3780 treshold = 50 + tresholdiE; 3781 } 3782 $element.each(function () { 3783 if ($(this).hasClass("active")) { 3784 return; 3785 } 3786 var $this = $(this); 3787 addReadMoreButtons($this, transitionEndEvents, treshold); 3788 }); 3789}; 3790//include 26 3791jQuery(function () { 3792 //* 3793 $('.tabs-container').on('change.zf.tabs', function (event, tab) { 3794 /* 3795 var tabContentSelector = tab.find("a").attr("href"); 3796 if(!!tabContentSelector){ 3797 $(tabContentSelector).foundation(); 3798 } 3799 //*/ 3800 Foundation.reInit('equalizer'); 3801 }); 3802 //*/ 3803}); 3804//include 11 3805jQuery(function () { 3806 var kidsSingular = window.ppt.translate("kid.singular", "Kind"); 3807 var kidsPlural = window.ppt.translate("kid.plural", "Kinder"); 3808 var adultsSingular = window.ppt.translate("adult.singular", "Erwachsener"); 3809 var adultsPlural = window.ppt.translate("adult.plural", "Erwachsene"); 3810 var guestsSingular = "Gast"; 3811 var guestsPlural = "Gäste"; 3812 var adultsAbbr = window.ppt.translate("search.belegung.adult.short", "Erw."); //"Erw."; 3813 var kidsAbbr = window.ppt.translate("search.belegung.kids.short", "Kind."); //"Kind."; 3814 var privateFunctions = { 3815 checkAndSetPosition(selector) { 3816 selector.css({ 3817 top: "", 3818 left: "" 3819 }); 3820 var overflows = window.pixelpoint.utilities.getOverflows(selector); 3821 if (overflows.left > 0) { 3822 var offset = selector.offset(); //always need to update 3823 selector.offset({ 3824 top: offset.top, 3825 left: offset.left + overflows.left 3826 }); 3827 } else if (overflows.right > 0) { 3828 var offset = selector.offset(); 3829 selector.offset({ 3830 top: offset.top, 3831 left: offset.left - overflows.right 3832 }); 3833 } 3834 if (overflows.top > 0) { 3835 var offset = selector.offset(); 3836 selector.offset({ 3837 top: offset.top + overflows.top, 3838 left: offset.left 3839 }); 3840 } else if (overflows.bottom > 0) { 3841 var offset = selector.offset(); 3842 selector.offset({ 3843 top: offset.top - overflows.bottom, 3844 left: offset.left 3845 }); 3846 } 3847 }, 3848 parseInt(number) { 3849 var result = parseInt(number); 3850 if (isNaN(result)) return 0; 3851 return result; 3852 }, 3853 getSelector(picker, selector) { 3854 var element = picker.find(selector); 3855 if (element.length == 0) { 3856 var pickerId = picker.attr("id"); 3857 if (!!pickerId) { 3858 element = $(`.visitor-picker-layer#for-${pickerId}`).find(selector); 3859 } 3860 } 3861 return element; 3862 }, 3863 getAdultsCount(picker) { 3864 var adultInputName = picker.data("adult-input-name"); 3865 return privateFunctions.parseInt(privateFunctions.getSelector(picker, `input[name='${adultInputName}']`).val()); 3866 }, 3867 getKidsCount(picker) { 3868 var kidsInputName = picker.data("children-input-name"); 3869 return privateFunctions.parseInt(privateFunctions.getSelector(picker, `input[name='${kidsInputName}']`).val()); 3870 }, 3871 getMaxKidsCount(picker) { 3872 return privateFunctions.parseInt(picker.data("max-children-count")); 3873 }, 3874 get(picker) { 3875 var adults = privateFunctions.getAdultsCount(picker); 3876 var kids = privateFunctions.getKidsCount(picker); 3877 var ages = privateFunctions.getKidsAges(picker); 3878 return { 3879 kids: kids, 3880 adults: adults, 3881 ages: ages 3882 }; 3883 }, 3884 setAdultsCount(picker, val) { 3885 if (val < 0) { 3886 val = 0; 3887 } 3888 if (val > 10) { 3889 val = 10; 3890 } 3891 var adultInputName = picker.data("adult-input-name"); 3892 privateFunctions.getSelector(picker, `input[name='${adultInputName}']`).val(val); 3893 }, 3894 setKidsAgesDisplay(picker, val) { 3895 val = val || 0; 3896 privateFunctions.getSelector(picker, ".kidsAge .input").removeClass("hide"); 3897 if (val < 4) { 3898 privateFunctions.getSelector(picker, ".kidsAge .input.kid4").addClass("hide"); 3899 privateFunctions.getSelector(picker, ".kidsAge .input.kid4 input").val(""); 3900 } 3901 if (val < 3) { 3902 privateFunctions.getSelector(picker, ".kidsAge .input.kid3").addClass("hide"); 3903 privateFunctions.getSelector(picker, ".kidsAge .input.kid3 input").val(""); 3904 } 3905 if (val < 2) { 3906 privateFunctions.getSelector(picker, ".kidsAge .input.kid2").addClass("hide"); 3907 privateFunctions.getSelector(picker, ".kidsAge .input.kid2 input").val(""); 3908 } 3909 if (val < 1) { 3910 privateFunctions.getSelector(picker, ".kidsAge .input.kid1").addClass("hide"); 3911 privateFunctions.getSelector(picker, ".kidsAge .input.kid1 input").val(""); 3912 } 3913 }, 3914 setKidsCount(picker, val) { 3915 var kidsInputName = picker.data("children-input-name"); 3916 privateFunctions.getSelector(picker, `input[name='${kidsInputName}']`).val(val); 3917 privateFunctions.setKidsAgesDisplay(picker, val); 3918 }, 3919 setKidsAges(picker, val) { 3920 var kidsCount = 0; 3921 if (!!val.kid1 || val.kid1 === 0) { 3922 privateFunctions.getSelector(picker, ".kidsAge .input.kid1 input").val(val.kid1); 3923 kidsCount++; 3924 } 3925 if (!!val.kid2 || val.kid2 === 0) { 3926 privateFunctions.getSelector(picker, ".kidsAge .input.kid2 input").val(val.kid2); 3927 kidsCount++; 3928 } 3929 if (!!val.kid3 || val.kid3 === 0) { 3930 privateFunctions.getSelector(picker, ".kidsAge .input.kid3 input").val(val.kid3); 3931 kidsCount++; 3932 } 3933 if (!!val.kid4 || val.kid4 === 0) { 3934 privateFunctions.getSelector(picker, ".kidsAge .input.kid4 input").val(val.kid4); 3935 kidsCount++; 3936 } 3937 var setKidsCount = privateFunctions.getKidsCount(picker); 3938 if (setKidsCount > kidsCount) { 3939 privateFunctions.setKidsCount(picker, kidsCount); 3940 } 3941 }, 3942 getKidsAges(picker, val) { 3943 var ages = {}; 3944 ages.kid1 = privateFunctions.getSelector(picker, ".kidsAge .input.kid1 input").val(); 3945 ages.kid2 = privateFunctions.getSelector(picker, ".kidsAge .input.kid2 input").val(); 3946 ages.kid3 = privateFunctions.getSelector(picker, ".kidsAge .input.kid3 input").val(); 3947 ages.kid4 = privateFunctions.getSelector(picker, ".kidsAge .input.kid4 input").val(); 3948 return ages; 3949 }, 3950 isCleared(picker) { 3951 var adultInputName = picker.data("adult-input-name"); 3952 var kidsInputName = picker.data("children-input-name"); 3953 var adults = privateFunctions.getSelector(picker, `input[name='${adultInputName}']`).val(); 3954 var kids = privateFunctions.getSelector(picker, `input[name='${kidsInputName}']`).val(); 3955 if (adults === "" && kids !== "") { 3956 privateFunctions.getSelector(picker, `input[name='${adultInputName}']`).val(0); 3957 } else if (adults !== "" && kids === "") { 3958 privateFunctions.getSelector(picker, `input[name='${kidsInputName}']`).val(0); 3959 } 3960 adults = privateFunctions.getSelector(picker, `input[name='${adultInputName}']`).val(); 3961 kids = privateFunctions.getSelector(picker, `input[name='${kidsInputName}']`).val(); 3962 return adults === "" || kids === ""; 3963 }, 3964 update(picker, supressEvent) { 3965 supressEvent = supressEvent || false; 3966 if (privateFunctions.isCleared(picker)) { 3967 var placeholder = picker.data("placeholder") || "Anzahl"; 3968 privateFunctions.getSelector(picker, ">span").html(placeholder); 3969 privateFunctions.getSelector(picker, ">span").removeClass("filled"); 3970 privateFunctions.getSelector(picker, ".clear").hide(); 3971 var kidsCount = privateFunctions.getKidsCount(picker); 3972 var adultsCount = privateFunctions.getAdultsCount(picker); 3973 var guestsCount = kidsCount + adultsCount; 3974 var kidsAppend = kidsCount == 1 ? kidsSingular : kidsPlural; 3975 var kidsAbbrevOrFull = kidsCount == 1 ? kidsSingular : kidsAbbr; 3976 var adultsAppend = adultsCount == 1 ? adultsSingular : adultsPlural; 3977 var guestsAppend = guestsCount == 1 ? guestsSingular : guestsPlural; 3978 privateFunctions.getSelector(picker, ".selector .adults span").text(`${adultsCount} ${adultsAppend}`); 3979 privateFunctions.getSelector(picker, ".selector .children span").text(`${kidsCount} ${kidsAppend}`); 3980 privateFunctions.setKidsAgesDisplay(picker, 0); 3981 } else { 3982 var kidsCount = privateFunctions.getKidsCount(picker); 3983 var adultsCount = privateFunctions.getAdultsCount(picker); 3984 var guestsCount = kidsCount + adultsCount; 3985 var kidsAppend = kidsCount == 1 ? kidsSingular : kidsPlural; 3986 var kidsAbbrevOrFull = kidsCount == 1 ? kidsSingular : kidsAbbr; 3987 var adultsAppend = adultsCount == 1 ? adultsSingular : adultsPlural; 3988 var guestsAppend = guestsCount == 1 ? guestsSingular : guestsPlural; 3989 //picker.find(">span").text(`${guestsCount} ${guestsAppend}`); 3990 privateFunctions.getSelector(picker, ">span").html(`<span class="adultsDisplay">${adultsCount} ${adultsAbbr}</span><span class="kidsDisplay">${kidsCount} ${kidsAbbrevOrFull}</span>`); 3991 privateFunctions.getSelector(picker, ">span").addClass("filled"); 3992 privateFunctions.getSelector(picker, ".selector .adults span").text(`${adultsCount} ${adultsAppend}`); 3993 privateFunctions.getSelector(picker, ".selector .children span").text(`${kidsCount} ${kidsAppend}`); 3994 privateFunctions.getSelector(picker, ".clear").show(); 3995 } 3996 if (!supressEvent) { 3997 var eventsPostfix = picker.data("events-postfix") || null; 3998 if (!!eventsPostfix) { 3999 var visitors = privateFunctions.get(picker); 4000 window.pixelpoint.pubSub.publish(`${window.pixelpoint.pubSub.events.belegungChange}:inverse:${eventsPostfix}`, [visitors]); 4001 } 4002 } 4003 }, 4004 toggleDisable(disableOrEnable, picker) { 4005 if (!!disableOrEnable) { 4006 privateFunctions.getSelector(picker, "input").prop("disabled", true); 4007 picker.data("is-disabled", true); 4008 picker.removeClass("active"); 4009 } else { 4010 privateFunctions.getSelector(picker, "input").prop("disabled", false); 4011 picker.data("is-disabled", false); 4012 } 4013 }, 4014 validate(picker, showErrors, forceOpen) {
4015 var valid = true; 4016 if (picker.data("is-disabled") == true) { 4017 return valid; 4018 } 4019 picker.removeClass("invalid"); 4020 $(`.visitor-picker-layer`).removeClass("invalid"); 4021 showErrors = showErrors || false; 4022 forceOpen = forceOpen || false; 4023 var kids = privateFunctions.getKidsCount(picker); 4024 var ages = privateFunctions.getKidsAges(picker); 4025 var numberOfKidsSet = 0; 4026 if (ages.kid1 !== undefined && !isNaN(parseInt(ages.kid1))) { 4027 numberOfKidsSet++; 4028 } 4029 if (ages.kid2 !== undefined && !isNaN(parseInt(ages.kid2))) { 4030 numberOfKidsSet++; 4031 } 4032 if (ages.kid3 !== undefined && !isNaN(parseInt(ages.kid3))) { 4033 numberOfKidsSet++; 4034 } 4035 if (ages.kid4 !== undefined && !isNaN(parseInt(ages.kid4))) { 4036 numberOfKidsSet++; 4037 } 4038 if (numberOfKidsSet < kids) { 4039 valid = false; 4040 if (showErrors) { 4041 picker.addClass("invalid"); 4042 if (forceOpen) picker.addClass("active"); 4043 if ($(`.visitor-picker-layer`).length > 0) { 4044 var pickerId = picker.attr("id"); 4045 if (!!pickerId) { 4046 $(`.visitor-picker-layer#for-${pickerId}`).addClass("invalid"); 4047 } 4048 } 4049 } 4050 } 4051 return valid; 4052 }, 4053 clear($this) { 4054 var adultInputName = $this.data("adult-input-name"); 4055 var kidsInputName = $this.data("children-input-name"); 4056 privateFunctions.getSelector($this, `input[name='${adultInputName}']`).val(""); 4057 privateFunctions.getSelector($this, `input[name='${kidsInputName}']`).val(""); 4058 privateFunctions.update($this); 4059 }, 4060 init($this) { 4061 //var $this = $(this); 4062 var adultInputName = $this.data("adult-input-name") || "numberOfAdults"; 4063 var kidsInputName = $this.data("children-input-name") || "numberOfChildren"; 4064 var kid1InputName = $this.data("kid-a-input-name") || "kid1"; 4065 var kid2InputName = $this.data("kid-b-input-name") || "kid2"; 4066 var kid3InputName = $this.data("kid-c-input-name") || "kid3"; 4067 var kid4InputName = $this.data("kid-d-input-name") || "kid4"; 4068 var maxKidsCount = $this.data("max-children-count") || 4; 4069 var maxAdultsCount = $this.data("max-adults-count") || -1; 4070 var placeholder = $this.data("placeholder") || "Anzahl"; 4071 var eventsPostfix = $this.data("events-postfix") || null; 4072 var disabled = $this.is("[data-disabled]"); 4073 var elementId = $this.attr("id"); 4074 if (!elementId) { 4075 elementId = Math.random().toString(36).substring(5); 4076 $this.attr("id", elementId); 4077 } 4078 var initialChildrenCount = $this.data("num-of-children") || 0; 4079 var initialAdultCount = $this.data("num-of-adults") || 2; 4080 if (maxAdultsCount > -1 && initialAdultCount > maxAdultsCount) initialAdultCount = maxAdultsCount; 4081 var initialKid1Age = $this.data("kid-a-age") !== undefined ? $this.data("kid-a-age") : ""; 4082 var initialKid2Age = $this.data("kid-b-age") !== undefined ? $this.data("kid-b-age") : ""; 4083 var initialKid3Age = $this.data("kid-c-age") !== undefined ? $this.data("kid-c-age") : ""; 4084 var initialKid4Age = $this.data("kid-d-age") !== undefined ? $this.data("kid-d-age") : ""; 4085 if (initialChildrenCount > maxKidsCount) initialChildrenCount = maxKidsCount; 4086 var hideClear = false; 4087 if ($this.is("[data-supress-default-values]")) { 4088 initialChildrenCount = ""; 4089 initialAdultCount = ""; 4090 hideClear = true; 4091 } 4092 var removeTitle = $this.data("remove-title"); 4093 var closeTitle = $this.data("close-title"); 4094 var adultTranslation = window.ppt.translate("adult.plural", "Erwachsene"); 4095 var kidsTranslation = window.ppt.translate("kid.plural", "Kinder"); 4096 var kidsAgeTranslation1 = window.ppt.translate("kids.age", "Alter %s. Kind:", [1]); 4097 var kidsAgeTranslation2 = window.ppt.translate("kids.age", "Alter %s. Kind:", [2]); 4098 var kidsAgeTranslation3 = window.ppt.translate("kids.age", "Alter %s. Kind:", [3]); 4099 var kidsAgeTranslation4 = window.ppt.translate("kids.age", "Alter %s. Kind:", [4]); 4100 var YearShortTranslation = window.ppt.translate("search.belegung.year.long", "J."); 4101 $this.data("adult-input-name", adultInputName); 4102 $this.data("children-input-name", kidsInputName); 4103 $this.data("max-children-count", 4); 4104 $this.html(` 4105 <input type="hidden" name="${adultInputName}" value="${initialAdultCount}" /> 4106 <input type="hidden" name="${kidsInputName}" value="${initialChildrenCount}" />
4107 <span>${placeholder}</span> 4108 <div class="selector"> 4109 <div class="selector-part row adults"> 4110 <div class="columns large-6 small-6 no-padding"> 4111 <span>0 ${adultTranslation}</span> 4112 </div> 4113 <div class="columns large-6 small-6 no-padding text-right"> 4114 <button class="button decrease">-</button> 4115 <button class="button increase">+</button> 4116 </div> 4117 </div> 4118 <div class="selector-part row children"> 4119 <div class="columns large-6 small-6 no-padding"> 4120 <span>0 ${kidsTranslation}</span> 4121 </div> 4122 <div class="columns large-6 small-6 no-padding text-right"> 4123 <button class="button decrease">-</button> 4124 <button class="button increase">+</button> 4125 </div> 4126 </div> 4127 <div class="selector-part row child-ages"> 4128 <div class ="columns large-12 small-12 kidsAge"> 4129 <div class ="input hide kid1"> 4130 <label for="${elementId}-kid-1">${kidsAgeTranslation1} </label> 4131 <input id="${elementId}-kid-1" type="number" min="0" max="17" name="${kid1InputName}" value="${initialKid1Age}" /> ${YearShortTranslation} 4132 </div> 4133 <div class ="input hide kid2"> 4134 <label for="${elementId}-kid-2">${kidsAgeTranslation2} </label> 4135 <input id="${elementId}-kid-2" type="number" min="0" max="17" name="${kid2InputName}" value="${initialKid2Age}" /> ${YearShortTranslation} 4136 </div> 4137 <div class ="input hide kid3"> 4138 <label for="${elementId}-kid-3">${kidsAgeTranslation3} </label> 4139 <input id="${elementId}-kid-3" type="number" min="0" max="17" name="${kid3InputName}" value="${initialKid3Age}" /> ${YearShortTranslation} 4140 </div> 4141 <div class ="input hide kid4"> 4142 <label for="${elementId}-kid-4">${kidsAgeTranslation4} </label> 4143 <input id="${elementId}-kid-4" type="number" min="0" max="17" name="${kid4InputName}" value="${initialKid4Age}" /> ${YearShortTranslation} 4144 </div> 4145 </div> 4146 </div> 4147 <button class="close-selector"><i class="icon-close" title="` + closeTitle + `"></i></button> 4148 </div> 4149 <button class="clear"><i class="icon-close" title="` + removeTitle + `"></i></button> 4150 `); 4151 var selector = $this.find(".selector"); 4152 if ($("body").find(`.visitor-picker-layer#for-${elementId}`).length == 0) { 4153 $("body").append(`<div id="for-${elementId}" class="visitor-picker-layer hide"></div>`); 4154 $("body .visitor-picker-layer").click(function (e) { 4155 e.preventDefault(); 4156 e.stopPropagation(); 4157 }); 4158 } 4159 var selectorIsGlobal = false; 4160 if (window.pixelpoint.isMobile.isMobileWidth()) { 4161 $(`body .visitor-picker-layer#for-${elementId}`).append(selector); 4162 var saveTranslation = window.ppt.translate('action.save', 'Speichern'); 4163 selector.append(`<a class="brandenbutton save-values">${saveTranslation}</a>`); 4164 selector.on("click touchstart", ".save-values", function (e) { 4165 e.preventDefault(); 4166 e.stopPropagation(); 4167 if (privateFunctions.validate($this, true)) { 4168 $(`.visitor-picker-layer#for-${elementId}`).addClass("hide"); 4169 } 4170 }); 4171 selectorIsGlobal = true; 4172 } 4173 if (!!hideClear) { 4174 privateFunctions.getSelector($this, ".clear").hide(); 4175 } 4176 $this.addClass("initialized"); 4177 var activatePicker = function (e) { 4178 e.preventDefault(); 4179 if ($this.data("is-disabled") == true) { 4180 return; 4181 } 4182 $this.addClass("active"); 4183 if (selectorIsGlobal) { 4184 $(`.visitor-picker-layer#for-${elementId}`).removeClass("hide"); 4185 } else { 4186 privateFunctions.checkAndSetPosition($this.find(".selector")); 4187 } 4188 }; 4189 $this.on("click", activatePicker); 4190 $this.on("keydown", function (e) { 4191 if (e.key === "Enter" || e.keyCode === 13) { 4192 activatePicker(e); 4193 } 4194 }); 4195 var increaseAdults = function (e) { 4196 e.preventDefault(); 4197 var adults = privateFunctions.getAdultsCount($this); 4198 adults++; 4199 if (maxAdultsCount > -1 && adults > maxAdultsCount) adults = maxAdultsCount; 4200 privateFunctions.setAdultsCount($this, adults); 4201 privateFunctions.update($this); 4202 }; 4203 var decreaseAdults = function (e) { 4204 e.preventDefault(); 4205 var adults = privateFunctions.getAdultsCount($this); 4206 adults--; 4207 if (adults < 0) adults = 0; 4208 privateFunctions.setAdultsCount($this, adults); 4209 privateFunctions.update($this); 4210 }; 4211 var increaseChildren = function (e) { 4212 e.preventDefault(); 4213 var kids = privateFunctions.getKidsCount($this); 4214 kids++; 4215 if (kids > privateFunctions.getMaxKidsCount($this)) kids = 4; 4216 privateFunctions.setKidsCount($this, kids); 4217 privateFunctions.update($this); 4218 }; 4219 var decreaseChildren = function (e) { 4220 e.preventDefault(); 4221 var kids = privateFunctions.getKidsCount($this); 4222 kids--; 4223 if (kids < 0) kids = 0; 4224 privateFunctions.setKidsCount($this, kids); 4225 privateFunctions.update($this); 4226 }; 4227 selector.on("click", ".adults .increase", increaseAdults);
4228 selector.on("keydown", ".adults .increase", function (e) { 4229 if (e.key === "Enter" || e.keyCode === 13) { 4230 increaseAdults(e); 4231 } 4232 }); 4233 selector.on("click", ".adults .decrease", decreaseAdults); 4234 selector.on("keydown", ".adults .decrease", function (e) { 4235 if (e.key === "Enter" || e.keyCode === 13) { 4236 decreaseAdults(e); 4237 } 4238 }); 4239 selector.on("click", ".children .increase", increaseChildren); 4240 selector.on("keydown", ".children .increase", function (e) { 4241 if (e.key === "Enter" || e.keyCode === 13) { 4242 increaseChildren(e); 4243 } 4244 }); 4245 selector.on("click", ".children .decrease", decreaseChildren); 4246 selector.on("keydown", ".children .decrease", function (e) { 4247 if (e.key === "Enter" || e.keyCode === 13) { 4248 decreaseChildren(e); 4249 } 4250 }); 4251 var clearPicker = function (e) { 4252 e.preventDefault(); 4253 privateFunctions.clear($this); 4254 }; 4255 $this.on("click", ".clear", clearPicker); 4256 $this.on("keydown", ".clear", function (e) { 4257 if (e.key === "Enter" || e.keyCode === 13) { 4258 clearPicker(e); 4259 } 4260 }); 4261 var closeSelector = selector.find(".close-selector"); 4262 $(document).on("mouseup touchend", function (e) { 4263 if (!selector.is(e.target) && !$.contains(selector[0], e.target)) { 4264 if (privateFunctions.validate($this, true)) { 4265 $this.removeClass("active"); 4266 if (selectorIsGlobal) { 4267 $(`.visitor-picker-layer#for-${elementId}`).addClass("hide"); 4268 } 4269 } 4270 } 4271 }); 4272 var closePicker = function (e) { 4273 e.preventDefault(); 4274 e.stopPropagation(); 4275 $this.removeClass("active"); 4276 if (selectorIsGlobal) { 4277 $(`.visitor-picker-layer#for-${elementId}`).addClass("hide"); 4278 } 4279 }; 4280 selector.find(".close-selector").on("click", closePicker); 4281 selector.find(".close-selector").on("keydown", function (e) { 4282 if (e.key === "Enter" || e.keyCode === 13) { 4283 closePicker(e); 4284 } 4285 }); 4286 // Add ESC key listener specifically for this picker's selector 4287 selector.on("keydown", function (e) { 4288 if (e.key === "Escape" || e.keyCode === 27) { 4289 closePicker(e); 4290 } 4291 }); 4292 var exposedFunctions = { 4293 set(data, supressEvent) { 4294 privateFunctions.setKidsCount($this, data.kids); 4295 privateFunctions.setAdultsCount($this, data.adults); 4296 privateFunctions.setKidsAges($this, data.ages); 4297 privateFunctions.update($this, supressEvent); 4298 }, 4299 get() { 4300 return privateFunctions.get($this); 4301 }, 4302 disable() { 4303 privateFunctions.toggleDisable(true, $this); 4304 }, 4305 enable() { 4306 privateFunctions.toggleDisable(false, $this); 4307 }, 4308 valid(forceOpen) { 4309 return privateFunctions.validate($this, true, forceOpen); 4310 }, 4311 reset() { 4312 privateFunctions.clear($this); 4313 } 4314 }; 4315 $this.data("form-element-functions", exposedFunctions).attr("data-form-element-functions-added", true); 4316 if (initialAdultCount > 0 || initialChildrenCount > 0) { 4317 privateFunctions.setKidsCount($this, initialChildrenCount); 4318 privateFunctions.setAdultsCount($this, initialAdultCount); 4319 privateFunctions.update($this); 4320 } 4321 if (!!eventsPostfix) { 4322 window.pixelpoint.pubSub.subscribe(`${window.pixelpoint.pubSub.events.belegungChange}:${eventsPostfix}`, function (e, visitors) { 4323 exposedFunctions.set(visitors, true); 4324 }); 4325 $this.find(".kidsAge input").on("change", function () { 4326 var visitors = privateFunctions.get($this); 4327 window.pixelpoint.pubSub.publish(`${window.pixelpoint.pubSub.events.belegungChange}:inverse:${eventsPostfix}`, [visitors]); 4328 }); 4329 } 4330 if (!!disabled) { 4331 privateFunctions.toggleDisable(true, $this); 4332 $this.closest(".control").addClass("disabled"); 4333 } 4334 } 4335 }; 4336 window.pixelpoint.ppComponents.visitorPicker = function ($this) { 4337 privateFunctions.init($this); 4338 }; 4339 $(".visitor-picker").each(function () { 4340 window.pixelpoint.ppComponents.visitorPicker($(this)); 4341 }); 4342}); 4343//include 8 4344jQuery(function () { 4345 var counter = 1; 4346 var privateFunctions = { 4347 getBoundingClientRect(el) { 4348 return el[0].getBoundingClientRect(); 4349 }, 4350 isElementPartiallyInViewport(el) { 4351 var rect = this.getBoundingClientRect(el); 4352 var topOutside = rect.top < 0 && rect.bottom < 0 || rect.top > $(window).height() && rect.bottom > $(window).height(); 4353 var leftOutside = rect.left < 0 && rect.right < 0 || rect.left > $(window).width() && rect.right > $(window).width(); 4354 return !topOutside && !leftOutside; 4355 }, 4356 isElementCompletelyInViewport(el) { 4357 var rect = this.getBoundingClientRect(el); 4358 return rect.top >= 0 && rect.left >= 0 && rect.bottom <= $(window).height() && rect.right <= $(window).width(); 4359 }, 4360 getHeaderHeight() { 4361 var header = $(".off-canvas-content .header-wrapper .header"); 4362 if (header.length == 0) return 0; 4363 return header.height(); 4364 }, 4365 positionLogo($this) { 4366 var logoWrapper = $this.find('.loader-image-wrapper'); 4367 if (logoWrapper.length == 0) return; 4368 if (this.isElementCompletelyInViewport(logoWrapper)) return; 4369 if (!this.isElementPartiallyInViewport($this)) return; 4370 var top = 0; 4371 var boundingRect = this.getBoundingClientRect($this);
4372 var td = boundingRect.top <= 0 ? -1 * boundingRect.top : 0; 4373 var bu = boundingRect.bottom >= $(window).height() ? boundingRect.bottom - $(window).height() : 0; 4374 top = td + 0.5 * ($this.height() - td - bu); 4375 logoWrapper.css("top", `${top}px`); 4376 } 4377 }; 4378 window.pixelpoint.ppComponents.loader = function ($this) { 4379 //var $this = $(this); 4380 4381 if ($this.hasClass("loader-initialized")) return; 4382 var name = $this.data("name"); 4383 if (!name) { 4384 name = `loader-${counter}`; 4385 $this.attr("data-name", name).data("name", name); 4386 counter++; 4387 } 4388 var id = $this.attr("id"); 4389 if (!id) { 4390 id = name; 4391 $this.attr("id", id); 4392 } 4393 4394 /* 4395 $this.html(`<div class="loader-image-wrapper"><i class="icon-logo"></i></div>`); 4396 $this.on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',function(e) { 4397 $this.parent().removeClass("animation-show").removeClass("animation-hide"); 4398 }); 4399 //*/ 4400 var tmbLoaderSrc = getComputedStyle(document.documentElement).getPropertyValue("--tmb-loader-path").trim().replace(/^["']|["']$/g, ""); 4401 $this.html(`<div class="loader-image-wrapper"><img alt="Brandenburg Loader" src="${tmbLoaderSrc}" /></div>`); 4402 $this.addClass("hidden"); 4403 var exposed = { 4404 show() { 4405 $this.removeClass("hidden"); 4406 $this.parent().addClass("loader-shown"); 4407 privateFunctions.positionLogo($this); 4408 $(document).on("scroll.loader", () => { 4409 privateFunctions.positionLogo($this); 4410 }); 4411 $(window).on("orientationchange.loader", function () { 4412 privateFunctions.positionLogo($this); 4413 }); 4414 $this.parent().addClass("animation-show"); 4415 }, 4416 hide() { 4417 $this.addClass("hidden"); 4418 $this.parent().removeClass("loader-shown"); 4419 $this.parent().addClass("animation-hide"); 4420 $(document).off("scroll.loader", () => { 4421 privateFunctions.positionLogo($this); 4422 }); 4423 $(window).off("orientationchange.loader", function () { 4424 privateFunctions.positionLogo($this); 4425 }); 4426 } 4427 }; 4428 $this.data("exposed", exposed); 4429 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.loader + `:${name}:show`, exposed.show); 4430 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.loader + `:${name}:hide`, exposed.hide); 4431 $this.addClass("loader-initialized"); 4432 }; 4433 $(".loader[data-loader]").each(function () { 4434 window.pixelpoint.ppComponents.loader($(this)); 4435 }); 4436}); 4437//include 8 4438jQuery(function () { 4439 var setupInitiallyDisabledElements = function (selectors, enableOrDisable, clickCallback) { 4440 for (var i in selectors) { 4441 var selector = selectors[i]; 4442 $(`[data-to-disable='${selector}']`).each(function () { 4443 var element = $(this); 4444 if (element.is(":disabled")) { 4445 if (!!element.is("[data-activate-on-click]")) { 4446 if (!!clickCallback) { 4447 var overlay = $('<div class="pp-click-overlay"></div>'); 4448 overlay.css({ 4449 'position': 'absolute', 4450 'top': 0, 4451 'left': 0, 4452 'right': 0, 4453 'bottom': 0, 4454 'z-index': 999 4455 }); 4456 element.parent().append(overlay); 4457 overlay.on("click.disabler", function (e) { 4458 clickCallback(); 4459 setTimeout(function () { 4460 element.click(); 4461 }, 50); 4462 }); 4463 } 4464 } 4465 } 4466 }); 4467 } 4468 }; 4469 var enableOrDisableElements = function (selectors, enableOrDisable, clickCallback) { 4470 //true - enable, false - disable 4471 for (var i in selectors) { 4472 var selector = selectors[i]; 4473 $(`[data-to-disable='${selector}']`).each(function () { 4474 var element = $(this); 4475 element.off("click.disabler"); 4476 element.parent().find(".pp-click-overlay").remove(); 4477 if (!!enableOrDisable) { 4478 //if (element.hasClass("select2-hidden-accessible")) { 4479 // element.select2("enable"); 4480 //} 4481 //else { 4482 var formFunctions = element.data("form-element-functions"); 4483 if (!!formFunctions && !!formFunctions.enable) formFunctions.enable();else element.prop("disabled", false); 4484 //} 4485 element.closest("[data-add-disabled-class]").removeClass("disabled"); 4486 } else { 4487 //if (element.hasClass("select2-hidden-accessible")) { 4488 // element.select2("disable"); 4489 //} 4490 //else { 4491 var formFunctions = element.data("form-element-functions"); 4492 if (!!formFunctions && !!formFunctions.disable) { 4493 formFunctions.disable(); 4494 if (!!element.is("[data-clear-on-disable]")) { 4495 if (!!formFunctions.clear) { 4496 formFunctions.clear(); 4497 } 4498 } 4499 if (!!element.is("[data-activate-on-click]")) { 4500 if (!!clickCallback) {
4501 var overlay = $('<div class="pp-click-overlay"></div>'); 4502 overlay.css({ 4503 'position': 'absolute', 4504 'top': 0, 4505 'left': 0, 4506 'right': 0, 4507 'bottom': 0, 4508 'z-index': 999 4509 }); 4510 element.parent().append(overlay); 4511 overlay.on("click.disabler", function (e) { 4512 clickCallback(); 4513 setTimeout(function () { 4514 element.click(); 4515 }, 50); 4516 }); 4517 } 4518 } 4519 } else { 4520 element.prop("disabled", true); 4521 if (!!element.is("[data-clear-on-disable]")) { 4522 element.val(""); 4523 } 4524 if (!!element.is("[data-activate-on-click]")) { 4525 if (!!clickCallback) { 4526 var overlay = $('<div class="pp-click-overlay"></div>'); 4527 overlay.css({ 4528 'position': 'absolute', 4529 'top': 0, 4530 'left': 0, 4531 'right': 0, 4532 'bottom': 0, 4533 'z-index': 999 4534 }); 4535 element.parent().append(overlay); 4536 overlay.on("click.disabler", function (e) { 4537 clickCallback(); 4538 setTimeout(function () { 4539 element.click(); 4540 }, 50); 4541 }); 4542 } 4543 } 4544 } 4545 //} 4546 element.closest("[data-add-disabled-class]").addClass("disabled"); 4547 } 4548 }); 4549 if (!!enableOrDisable) { 4550 window.pixelpoint.pubSub.publish(`on:disabler:${selector}:enable`, []); 4551 } else { 4552 window.pixelpoint.pubSub.publish(`on:disabler:${selector}:disable`, []); 4553 } 4554 } 4555 }; 4556 window.pixelpoint.ppComponents.disabler = function ($this) { 4557 //var $this = $(this); 4558 var elementsToDisable = $this.data("disabler"); 4559 var disableOnValue = $this.is("[data-disable-on-value]"); 4560 if (!elementsToDisable) return; 4561 var toDisableArray = elementsToDisable.split(","); 4562 if ($this.is("[type='checkbox']") || $this.is("[type='radio']")) { 4563 setupInitiallyDisabledElements(toDisableArray, disableOnValue, function () { 4564 if ($this.is(":checked")) $this.prop('checked', false).trigger("change"); 4565 }); 4566 } 4567 $this.on("change", function () { 4568 if ($this.is("[type='checkbox']") || $this.is("[type='radio']")) { 4569 if ($this.is(":checked")) { 4570 enableOrDisableElements(toDisableArray, disableOnValue, function () { 4571 if ($this.is(":checked")) $this.prop('checked', false).trigger("change"); 4572 }); 4573 } else { 4574 enableOrDisableElements(toDisableArray, !disableOnValue, function () { 4575 if ($this.is(":checked")) $this.prop('checked', false).trigger("change"); 4576 }); 4577 } 4578 } else { 4579 var value = $this.val(); 4580 if (!value) { 4581 enableOrDisableElements(toDisableArray, !disableOnValue); 4582 } else { 4583 enableOrDisableElements(toDisableArray, disableOnValue); 4584 } 4585 } 4586 }); 4587 }; 4588 $("[data-disabler]").each(function () { 4589 window.pixelpoint.ppComponents.disabler($(this)); 4590 }); 4591}); 4592//include 8 4593jQuery(function () { 4594 var checkAll = function (elements) { 4595 elements.each(function () { 4596 var $this = $(this); 4597 var checkAll = $this.data("checkbox-checkall"); 4598 if (!checkAll) return; 4599 $this.on('change', function () { 4600 var state = $this.is(":checked"); 4601 $(`[data-checkbox-checkall='${checkAll}']`).prop('checked', state); 4602 }); 4603 }); 4604 }; 4605 window.ppComponents = window.ppComponents || {}; 4606 window.ppComponents.common = window.ppComponents.common || {}; 4607 window.ppComponents.common.checkAll = checkAll; 4608 checkAll($('[data-checkbox-checkall]')); 4609}); 4610//include 8 4611jQuery(function () { 4612 var dataTagName = /^(tag-data-|tagData)/i; 4613 var dataEventName = /^(tag-event-|tagEvent)/i; 4614 var dataEventData = /^(tag-evt-data-|tagEvtData)/i; 4615 var privateFunctions = { 4616 pushData(name, value) { 4617 if (typeof dataLayer == 'undefined' || !dataLayer) return; 4618 var pushObject = {}; 4619 if (!!name) { 4620 pushObject[name] = value; 4621 dataLayer.push(pushObject); 4622 } else { 4623 dataLayer.push(value); 4624 } 4625 }, 4626 pushEvent(name) { 4627 if (typeof dataLayer == 'undefined' || !dataLayer) return; 4628 if ($.type(name) === "string") { 4629 name = { 4630 'event': name 4631 }; 4632 } 4633 dataLayer.push(name); 4634 }, 4635 bootstrap() { 4636 if (!!readCookie("ga-disable-UA-411685-51")) { 4637 return; 4638 } 4639 $("[data-google-tag]").each(function () { 4640 var $this = $(this); 4641 if ($this.data("tags-bootstrapped") == true) return; 4642 //********************************************* 4643 var allDataAttributes = $this.data(); 4644 var groupedTagData = {}; 4645 var groupData = $this.is('[data-tag-group-data]'); 4646 $.each(allDataAttributes, function (key, value) { 4647 if (key.match(dataTagName)) { 4648 var name = key.replace(dataTagName, ""); 4649 if (name == "Event") { 4650 name = name.toLowerCase(); 4651 } 4652 if (!!groupData) { 4653 if (name.toLowerCase() == "event") { 4654 groupedTagData["non_interaction"] = true; 4655 } 4656 groupedTagData[name] = value; 4657 } else { 4658 if (name.toLowerCase() == "event") { 4659 var tagData = {}; 4660 tagData[name] = value; 4661 tagData["non_interaction"] = true; 4662 privateFunctions.pushData(null, tagData); 4663 } else { 4664 privateFunctions.pushData(name, value); 4665 } 4666 } 4667 } else if (key.match(dataEventName)) { 4668 var eventName = key.replace(dataEventName, "").toLowerCase(); 4669 var eventData = {}; 4670 $.each(allDataAttributes, function (key2, value2) { 4671 if (key2.match(dataEventData)) { 4672 var eventDataName = key2.replace(dataEventData, "").toLowerCase(); 4673 eventData[eventDataName] = value2; 4674 } 4675 }); 4676 eventData['event'] = value; 4677 if (eventName == "click") { 4678 eventName = "click touchend"; 4679 } 4680 $this.on(eventName, function () { 4681 privateFunctions.pushEvent(eventData); 4682 }); 4683 } 4684 }); 4685 if (!$.isEmptyObject(groupedTagData)) { 4686 privateFunctions.pushData(null, groupedTagData); 4687 } 4688 //********************************************* 4689 $this.data("tags-bootstrapped", true); 4690 }); 4691 } 4692 }; 4693 4694 //******************************************************* 4695 // mounting everything together ************************* 4696 //******************************************************* 4697 privateFunctions.bootstrap(); 4698 setTimeout(function () { 4699 privateFunctions.bootstrap(); // damn hacks 4700 }, 500); 4701 //******************************************************* 4702 //******************************************************* 4703 4704 var external = { 4705 data(name, value) { 4706 privateFunctions.pushData(name, value); 4707 }, 4708 event(name, data) { 4709 data = data || {}; 4710 data['event'] = name; 4711 privateFunctions.pushEvent(data); 4712 }, 4713 update() { 4714 privateFunctions.bootstrap(); 4715 } 4716 }; 4717 window.pixelpoint.tagManager = external; 4718}); 4719//include 8 4720jQuery(function () { 4721 window.pixelpoint.loader = { 4722 show() { 4723 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + ':global-loader:show'); 4724 }, 4725 hide() { 4726 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + ':global-loader:hide'); 4727 } 4728 }; 4729 $("body").on("click", "[data-display-global-loader]", function () { 4730 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + ':global-loader:show'); 4731 }); 4732}); 4733//include 8 4734jQuery(function () { 4735 $("body").on("click", "[data-scroll-to]", function (e) { 4736 e.preventDefault(); 4737 var selector = $(e.target).data("scroll-to") || $(this).data("scroll-to"); 4738 if (!selector) { 4739 return; 4740 } 4741 var additionalOffset = $(e.target).data("offset") || $(this).data("offset") || 0; 4742 window.pixelpoint.utilities.scrollTo(selector, false, additionalOffset); 4743 }); 4744 var initialScrollTos = $("[data-initial-scroll-to]"); 4745 if (initialScrollTos.length > 0) { 4746 var additionalOffset = initialScrollTos.first().data("offset") || 0; 4747 window.pixelpoint.utilities.scrollTo(initialScrollTos.first(), false, additionalOffset); 4748 } 4749 4750 //****************we link the paginations********************************************************** 4751 $("body").on("click", "ul.result-pagination a", function () { 4752 var parent = $(this).closest(".tx-dce-pi1");
4753 window.pixelpoint.utilities.scrollTo(parent, false, 0); 4754 }); 4755 /* 4756 $("ul.result-pagination").on("click","a",function(){ 4757 var parent = $(this).closest(".tx-dce-pi1"); 4758 window.pixelpoint.utilities.scrollTo(parent,false,0); 4759 }); 4760 //*/ 4761 //************************************************************************************************* 4762}); 4763//include 8 4764jQuery(function () { 4765 window.pixelpoint = window.pixelpoint || {}; 4766 window.pixelpoint.ga = { 4767 disable: function () { 4768 if (!window.pixelpoint.utilities.isIframe()) { 4769 document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/'; 4770 //window[disableStr] = true; 4771 } else { 4772 window.parent.postMessage({ 4773 event_id: "deactivateAnalytics" 4774 }, "*"); 4775 } 4776 }, 4777 enable: function () { 4778 window.eraseCookie(disableStr); 4779 } 4780 }; 4781 $("body").on("click", ".deactivate-google-analytics", function (e) { 4782 e.preventDefault(); 4783 window.pixelpoint.ga.disable(); 4784 window.pixelpoint.modal.open("Sie haben Google Analytics erfolgreich deaktiviert"); 4785 }); 4786}); 4787//include 8 4788jQuery(function () { 4789 var breadcrumbs = $("ul.breadcrumbs"); 4790 var breadcrumbsSessionKey = "breadcrumbs."; 4791 var setPositions = function () { 4792 if (breadcrumbs.length > 0) { 4793 var breadcrumbsParts = breadcrumbs.find(" > li.bread"); 4794 breadcrumbsParts.each(function (index) { 4795 var meta = $(this).find('meta[itemprop="position"]'); 4796 if (meta.length > 0) { 4797 meta.attr("content", index + 1); 4798 } 4799 }); 4800 } 4801 }; 4802 if (breadcrumbs.length == 0 || !window.pixelpoint.utilities.hasLocalStorage()) { 4803 setPositions(); 4804 return; 4805 } 4806 var privateFunctions = { 4807 getReferrer() { 4808 var referrer = document.referrer; 4809 if (!referrer) return null; 4810 referrer = this.parseUrl(referrer); 4811 if (!!referrer && referrer.pathname == window.location.pathname) return null; 4812 return referrer; 4813 }, 4814 parseUrl: function (url) { 4815 if (!url) { 4816 return null; 4817 } 4818 var parser = document.createElement('a'); 4819 parser.href = url; 4820 return { 4821 'href': parser.href, 4822 'protocol': parser.protocol, 4823 'hostname': parser.hostname, 4824 'port': parser.port, 4825 'pathname': parser.pathname, 4826 'search': parser.search, 4827 'hash': parser.hash, 4828 'host': parser.host 4829 }; 4830 }, 4831 getBreadcrumbsData: function () { 4832 var breadcrumbsDataContainer = $("body").find(".breadcrumbs-data"); //breadcrumbs.find(".breadcrumbs-data"); 4833 if (breadcrumbsDataContainer.length == 0) return {}; 4834 var type = breadcrumbsDataContainer.data("pageType") || "static"; 4835 var pageId = breadcrumbsDataContainer.data("pageId") || 0; 4836 var title = breadcrumbsDataContainer.data("pageTitle") || ""; 4837 var original = breadcrumbsDataContainer.find("ul").html() || ""; 4838 original = original.replace(/data-structured-/g, ''); 4839 4840 //breadcrumbsDataContainer.remove(); 4841 4842 return { 4843 'type': type, 4844 'id': pageId, 4845 'title': title, 4846 'original': original 4847 }; 4848 }, 4849 saveBreadcrumbs(breadcrumbs, current) { 4850 var breadcrumbsHtml = breadcrumbs; 4851 if (typeof breadcrumbs != "string") { 4852 var breadcrumbsClone = breadcrumbs.clone(); 4853 breadcrumbsClone.find(".breadcrumbs-data").remove(); 4854 breadcrumbsHtml = breadcrumbsClone.html(); 4855 breadcrumbsHtml = breadcrumbsHtml.replace(/data-structured-/g, ''); 4856 } 4857 var key = breadcrumbsSessionKey + current.pathname; 4858 window.sessionStorage.setItem(key, breadcrumbsHtml); 4859 }, 4860 loadBreadcrumbs(referrer) { 4861 if (!referrer || !referrer.pathname) return null; 4862 var key = breadcrumbsSessionKey + referrer.pathname; 4863 return window.sessionStorage.getItem(key); 4864 }, 4865 getCurrentBreadcrumbPart(breadcrumbs, current) { 4866 var breadcrumbsObject = breadcrumbs; 4867 if (typeof breadcrumbsObject == "string") { 4868 breadcrumbsObject = $(breadcrumbsObject); 4869 } else if (breadcrumbsObject instanceof jQuery) { 4870 breadcrumbsObject = breadcrumbsObject.clone(); 4871 } 4872 breadcrumbsObject = $('<div>').append(breadcrumbsObject); 4873 var lastNode = breadcrumbsObject.find('li.bread').last(); 4874 if (!!current && !!current.href && lastNode.find("a").length == 0) { 4875 var text = lastNode.text(); 4876 lastNode.wrapInner(`<a href="${current.href}" target="_self" title="${text}"></a>`); 4877 } 4878 return $('<div>').append(lastNode).html(); 4879 }, 4880 addLinkToLastElement(breadcrumbsHtml, current) { 4881 var breadcrumbsObject = breadcrumbsHtml; 4882 if (typeof breadcrumbsObject == "string") { 4883 breadcrumbsObject = $(breadcrumbsObject); 4884 } else if (breadcrumbsObject instanceof jQuery) { 4885 breadcrumbsObject = breadcrumbsObject.clone(); 4886 } 4887 breadcrumbsObject = $('<div>').append(breadcrumbsObject); 4888 var lastNode = breadcrumbsObject.find("li").last('li.bread'); 4889 if (!!current && !!current.href && lastNode.find("a").length == 0) { 4890 var text = lastNode.text(); 4891 lastNode.wrapInner(`<a href="${current.href}" target="_self" title="${text}"></a>`); 4892 } 4893 //return $('<div>').append(breadcrumbsObject).html(); 4894 return breadcrumbsObject.html(); 4895 } 4896 }; 4897 4898 //********************************************** */ 4899 var referrer = privateFunctions.getReferrer(); 4900 var current = document.location; 4901 var breadcrumbsData = privateFunctions.getBreadcrumbsData(); 4902 if (!!breadcrumbsData.type) { 4903 switch (breadcrumbsData.type) { 4904 case 'static': 4905 privateFunctions.saveBreadcrumbs(breadcrumbs, current); 4906 break; 4907 case 'detail': 4908 case 'dynamic': 4909 var breadcrumbsFromReferrer = privateFunctions.loadBreadcrumbs(referrer); 4910 if (!!referrer) breadcrumbsFromReferrer = privateFunctions.addLinkToLastElement(breadcrumbsFromReferrer, referrer); 4911 if (!!breadcrumbsFromReferrer) { 4912 var breadcrumbPart = privateFunctions.getCurrentBreadcrumbPart(breadcrumbs); 4913 var newBreadcrumbs = breadcrumbsFromReferrer + breadcrumbPart; 4914 var breadcrumbPartWithLink = privateFunctions.getCurrentBreadcrumbPart(breadcrumbs, current); 4915 var newBreadcrumbsWithLink = breadcrumbsFromReferrer + breadcrumbPartWithLink; 4916 privateFunctions.saveBreadcrumbs(newBreadcrumbsWithLink, current); 4917 breadcrumbs.html(newBreadcrumbs).addClass("dynamic"); 4918 } else { 4919 var newBreadcrumbs = breadcrumbsData.original; 4920 var newBreadcrumbsWithLink = privateFunctions.addLinkToLastElement(newBreadcrumbs, current); 4921 privateFunctions.saveBreadcrumbs(newBreadcrumbsWithLink, current); 4922 breadcrumbs.html(newBreadcrumbs).addClass("dynamic"); 4923 } 4924 break; 4925 } 4926 } 4927 setPositions(); 4928 //********************************************** */ 4929}); 4930//include 8 4931jQuery(function () { 4932 if (!window.pixelpoint.utilities.hasLocalStorage()) return; 4933 var queueSize = 10; 4934 var namespace = "ppHistory"; 4935 var privateFunctions = { 4936 setItem(key, data) { 4937 var stringified = JSON.stringify(data); 4938 window.sessionStorage.setItem(key, stringified); 4939 }, 4940 getItem(key) { 4941 var data = window.sessionStorage.getItem(key); 4942 if (data !== null) return JSON.parse(data); 4943 }, 4944 // queue handling 4945 push(data) { 4946 var queue = privateFunctions.getItem(namespace); 4947 if (!queue || !$.isArray(queue)) queue = []; 4948 if (queue.length > 0 && queue[queue.length - 1] == data) return; 4949 if (queue.length > queueSize) queue.shift(); 4950 queue.push(data); 4951 privateFunctions.setItem(namespace, queue); 4952 }, 4953 pop() { 4954 var queue = privateFunctions.getItem(namespace); 4955 if (!queue) return null; 4956 var result = queue.shift(); 4957 privateFunctions.setItem(namespace, queue); 4958 return result; 4959 }, 4960 getLastInserted() { 4961 var queue = privateFunctions.getItem(namespace); 4962 if (!queue) return null; 4963 return queue[queue.length - 1]; 4964 }, 4965 getAt(index) { 4966 var queue = privateFunctions.getItem(namespace); 4967 if (!queue) return null; 4968 if (index < 0) index = queue.length - 1 + index; 4969 if (index > queue.length - 1) return null; 4970 return queue[index]; 4971 }, 4972 size() { 4973 var queue = privateFunctions.getItem(namespace); 4974 if (!queue) return 0; 4975 return queue.length; 4976 }, 4977 getAll() { 4978 var queue = privateFunctions.getItem(namespace); 4979 return queue; 4980 }, 4981 // -------------- 4982 4983 saveCurrentPage() { 4984 var currentPage = window.location.href; 4985 privateFunctions.push(currentPage); 4986 }, 4987 getLastPage() { 4988 return privateFunctions.getLastInserted(); 4989 }, 4990 getBeforeLastPage() { 4991 return privateFunctions.getAt(-1); 4992 }, 4993 getHistory() { 4994 return privateFunctions.getAll(); 4995 } 4996 }; 4997 4998 //some logic to make the history work + to expose some functions 4999 privateFunctions.saveCurrentPage(); 5000 window.pixelpoint.history = { 5001 getLastVisited() { 5002 return privateFunctions.getBeforeLastPage(); 5003 }, 5004 getHistory() { 5005 return privateFunctions.getHistory(); 5006 }, 5007 getCurrent() { 5008 return privateFunctions.getLastPage(); 5009 }, 5010 visitorCameBack() { 5011 /* 5012 var visitedBefore = privateFunctions.getAt(-2); 5013 var current = privateFunctions.getLastPage(); 5014 if (visitedBefore != null && visitedBefore == current) 5015 return true; 5016 return false;
5017 */ 5018 var history = privateFunctions.getHistory(); 5019 for (var i = 0; i < history.length - 2; i++) { 5020 if (history[i] == history[history.length - 1]) return true; 5021 } 5022 return false; 5023 } 5024 }; 5025}); 5026(function ($, window) { 5027 // build content for zielgruppenblog 5028 var $isZGB = $('#isZGB'); 5029 if ($isZGB.length) { 5030 $("div.slider-wrapper").addClass("border-bottom"); 5031 var daycontent = []; 5032 var daylist = []; 5033 $('.day').each(function () { 5034 var istitle = $(this).find('.daytitle .d-title').html(); 5035 if (istitle) { 5036 var temp_day_content = []; 5037 var temp_day_list = []; 5038 $(this).find('.daysection').each(function () { 5039 var title = $(this).find('.d-title').html(); 5040 var text = $(this).find('.d-text').html(); 5041 temp_day_content.push([title, text]); 5042 }); 5043 daycontent.push(temp_day_content); 5044 $(this).find('.daytitle').each(function () { 5045 daylist.push($(this).find('.d-title').html()); 5046 }); 5047 } 5048 }); 5049 if (daycontent.length > 0 && daylist.length > 0) { 5050 setDaysParts(daycontent, daylist); 5051 } 5052 5053 /* 5054 // change Slider Header to ZGB Header 5055 var zgbHeader = $('#zgb-headline').html(); 5056 if (zgbHeader != "") { 5057 if ($('.dce-header .headline.capital').length) { 5058 $('.dce-header .headline.capital').each(function () { 5059 $(this).html(zgbHeader); 5060 }); 5061 } 5062 else { 5063 $('.dce-header .slick-slide .teaser-box').prepend("<div class='headline capital'>" + zgbHeader + "</div>"); 5064 } 5065 } 5066 */ 5067 5068 var stickyPosition = $(".header-wrapper .header").height(); 5069 5070 // scroll effect on Large Screens 5071 if (Foundation.MediaQuery.current == "large") { 5072 var stickyPositionNew = $('.header-wrapper .header .main-nav').height() + 12; 5073 stickyPosition = stickyPositionNew; 5074 } 5075 // scroll effect on Large Screens - END 5076 5077 var emSize = parseFloat($("body").css("font-size")); 5078 var emPosition = stickyPosition / emSize - 0.5; 5079 var container = $("#blogHeader").closest(".tx-dce-pi1"); 5080 if (container.length == 0) { 5081 $("#blogHeader .day-section .row").attr("data-margin-top", emPosition); //.foundation(); 5082 $("#blogHeader .day-section .row").attr("data-sticky", "true").foundation(); 5083 } else { 5084 var id = container.attr("id"); 5085 if (!id) id = "blog-days-container"; 5086 container.attr("id", id); 5087 $("#blogHeader .day-section .row").attr("data-margin-top", emPosition); 5088 $("#blogHeader .day-section .row").attr("data-top-anchor", id + ":top"); 5089 $("#blogHeader .day-section .row").attr("data-btm-anchor", id + ":bottom"); //.foundation(); 5090 $("#blogHeader .day-section .row").attr("data-sticky", "true").foundation(); 5091 $("#blogHeader .day-section .row").on('sticky.zf.stuckto:top', function () { 5092 $("#blogHeader .day-section .row").show(); 5093 }); 5094 $("#blogHeader .day-section .row").on('sticky.zf.unstuckfrom:bottom', function () { 5095 $("#blogHeader .day-section .row").hide(); 5096 }); 5097 } 5098 } 5099})(jQuery, window); 5100function setDaysParts(daycontent, daylist) { 5101 $("#days-wrap").empty(); 5102 $("#days-wrap").append('<div id="days-act" class="selection"></div><div id="days-list"></div>'); 5103 $("#day-parts-wrap").empty(); 5104 $("#day-parts-wrap").append('<div id="day-parts-act" class="selection"></div><div id="day-parts-list"></div>'); 5105 for (var i = 0; i < daylist.length; i++) { 5106 if (daylist[i]) { 5107 $("#days-list").append('<button class="list-buttons days-list days-list-' + i + '" data-day="' + i + '" title="' + daylist[i] + '">' + daylist[i] + '</button>'); 5108 } 5109 } 5110 setday(0, daycontent[0], daylist[0], daylist); 5111 setNavigation(daycontent, 0, 0, daylist, 0); 5112 5113 //$('#days-wrap button').click(function () { 5114 $('#days-wrap').on('click', 'button', function () { 5115 var day = $(this); 5116 setNavigation(daycontent, parseInt(day.attr('data-day')), 0, daylist, "-"); 5117 reinitExternalMap(); 5118 reinitSocialMedia(); 5119 }); 5120 $('#day-parts-wrap').on('click', 'button', function () { 5121 var part = $(this); 5122 setNavigation(daycontent, parseInt(part.attr('data-day')), parseInt(part.attr('data-part')), daylist, parseInt(part.attr('data-day')));
5123 reinitExternalMap(); 5124 reinitSocialMedia(); 5125 }); 5126 $('button.day-section-navigation').click(function () { 5127 var $this = $(this); 5128 var dayToGo = parseInt($this.attr('data-day')); 5129 var dayPartToGo = parseInt($this.attr('data-part')); 5130 var actualDay = parseInt($("#days-list button.active").attr('data-day')); 5131 setNavigation(daycontent, dayToGo, dayPartToGo, daylist, actualDay); 5132 reinitExternalMap(); 5133 reinitSocialMedia(); 5134 var $scrollTo = $('.content-section'); 5135 var headerTop = $('.header').css('top') || 0; 5136 headerTop = parseInt(headerTop); 5137 var addValue = -($('.header').height() + headerTop + $('.zielgruppenblog-post .blog-header .day-section .sticky.is-stuck').height() + 50); 5138 if ($(window).width() < 640) { 5139 addValue = addValue + 25; 5140 } 5141 $("html,body").animate({ 5142 scrollTop: $scrollTo.offset().top + addValue, 5143 scrollLeft: 0 5144 }, 300, function () { 5145 if (Foundation.MediaQuery.current == "large") { 5146 setTimeout(function () { 5147 var headerHeight = $(".header-wrapper > .header > .row").height(); 5148 var headerPositionNew = headerHeight + 18; 5149 $(".header-wrapper .header").removeAttr('style'); 5150 $(".header-wrapper .header").css("top", "-" + headerPositionNew + "px"); 5151 }, 150); 5152 } 5153 }); 5154 }); 5155} 5156function setNavigation(daycontent, dayToGo, dayPartToGo, daylist, actualDay) { 5157 var nextDayNr = ""; 5158 var nextDayPartNr = ""; 5159 var prevDayNr = ""; 5160 var prevDayPartNr = ""; 5161 5162 // check for next day/part 5163 if (daycontent[dayToGo][dayPartToGo + 1] !== undefined) { 5164 nextDayNr = dayToGo; 5165 nextDayPartNr = dayPartToGo + 1; 5166 } else { 5167 if (daycontent[dayToGo + 1] !== undefined) { 5168 nextDayNr = dayToGo + 1; 5169 } else { 5170 nextDayNr = 0; 5171 } 5172 nextDayPartNr = 0; 5173 } 5174 $("#day-section-next button").attr('data-day', nextDayNr); 5175 $("#day-section-next button").attr('data-part', nextDayPartNr); 5176 5177 // END - next 5178 5179 // check for prev day/part 5180 if (daycontent[dayToGo][dayPartToGo - 1] !== undefined) { 5181 prevDayNr = dayToGo; 5182 prevDayPartNr = dayPartToGo - 1; 5183 } else { 5184 var prevDay = []; 5185 if (daycontent[dayToGo - 1] !== undefined) { 5186 prevDayNr = dayToGo - 1; 5187 prevDay = daycontent[prevDayNr]; 5188 } else { 5189 prevDayNr = daycontent.length - 1; 5190 prevDay = daycontent[prevDayNr]; 5191 } 5192 prevDayPartNr = prevDay.length - 1; 5193 } 5194 $("#day-section-prev button").attr('data-day', prevDayNr); 5195 $("#day-section-prev button").attr('data-part', prevDayPartNr); 5196 // END - prev 5197 5198 if (actualDay == dayToGo) { 5199 setpart(dayToGo, dayPartToGo, daycontent[dayToGo]); 5200 } else { 5201 setday(dayToGo, daycontent[dayToGo], daylist[dayToGo], daylist); 5202 setpart(dayToGo, dayPartToGo, daycontent[dayToGo]); 5203 } 5204} 5205function setday(day, dayarr, dayname, daylist) { 5206 $("#days-act").empty(); 5207 $("#day-parts-list").empty(); 5208 $("#days-sections-content").empty(); 5209 for (var i = 0; i < dayarr.length; i++) { 5210 $("#day-parts-list").append('<button class="list-buttons days-section days-section-' + i + '" data-part="' + i + '" data-day="' + day + '" title="' + dayarr[i][0] + '">' + dayarr[i][0] + '</button>'); 5211 } 5212 $("#days-act").append(dayname); 5213 $("#days-sections-content").append($(dayarr[0][1]).hide().fadeIn(800)); 5214 $("#day-parts-act").empty(); 5215 $("#day-parts-act").append(dayarr[0][0]); 5216 for (var i = 0; i < daylist.length; i++) { 5217 $("button.days-list[data-day=" + i + "]").removeClass("active"); 5218 } 5219 $("button.days-list[data-day=" + day + "]").addClass("active"); 5220 $("button.days-section[data-part='0']").addClass("active"); 5221 addContentJsFunctions(); 5222} 5223function setpart(day, part, dayarr) { 5224 $("#day-parts-act").empty(); 5225 $("#day-parts-act").append(dayarr[part][0]); 5226 $("#days-sections-content").empty(); 5227 $("#days-sections-content").append($(dayarr[part][1]).hide().fadeIn(800)); 5228 for (var i = 0; i < dayarr.length; i++) { 5229 $("button.days-section[data-part=" + i + "]").removeClass("active"); 5230 } 5231 $("button.days-section[data-part=" + part + "]").addClass("active"); 5232 addContentJsFunctions(); 5233} 5234function addContentJsFunctions() { 5235 var transitionEndEvents = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend"; 5236 var treshold = 70; 5237 $("#days-sections-content .more-wrapper").each(function () {
5238 addReadMoreButtons($(this), transitionEndEvents, treshold); 5239 }); 5240 5241 // reinit Sliders 5242 setTimeout(function () { 5243 // reinit Image Errors 5244 window.pixelpoint.images.initializeErrors($("#days-sections-content")); 5245 window.ppComponents.sliders.main.init($("#days-sections-content").find(".main-slider")); 5246 }, 200); 5247} 5248function reinitExternalMap() { 5249 setTimeout(function () { 5250 if ($(".external-map-wrapper").length > 0) { 5251 $(".external-map-wrapper").each(function (index, element) { 5252 if ($(element).is(":visible")) { 5253 window.externalMap.init($(element), true); 5254 } 5255 }); 5256 setTimeout(function () { 5257 $(window).trigger('load.zf.sticky'); 5258 }, 500); 5259 } 5260 }, 500); 5261} 5262function reinitSocialMedia() { 5263 setTimeout(function () { 5264 if (!!window.instgrm && !!window.instgrm.Embeds && !!window.instgrm.Embeds.process) { 5265 window.instgrm.Embeds.process(); 5266 } 5267 }, 500); 5268} 5269//include 8 5270jQuery(function () { 5271 var ratingWrapper = $(".rating-wrapper"); 5272 if (ratingWrapper.length == 0) { 5273 return; 5274 } 5275 var privateFunctions = { 5276 updateHearts(average_rating) { 5277 var itemHearts = $('.item.hearts'); 5278 if (itemHearts.length == 0) return; 5279 var hearts = itemHearts.find("li.heart"); 5280 hearts.removeClass('active').removeClass("half"); 5281 hearts.each(function () { 5282 var heart = $(this); 5283 var index = hearts.index(heart); 5284 if (index < average_rating) { 5285 heart.addClass("active"); 5286 if (index + 0.5 > average_rating) { 5287 heart.addClass("half"); 5288 } 5289 } 5290 }); 5291 }, 5292 updateTooltip(average_rating) { 5293 var tooltip = $(".rating-wrapper .tooltipstered"); 5294 var content = ""; 5295 var von = window.ppt.translate('von', 'von'); 5296 if (tooltip.length == 0) { 5297 return; 5298 } 5299 if (tooltip.hasClass("tooltipstered")) { 5300 try { 5301 content = tooltip.tooltipster("content"); //do we even need this? 5302 } catch (e) { 5303 window.pixelpoint.tooltip.init(tooltip); 5304 } 5305 setTimeout(function () { 5306 content = `${average_rating} ${von} 5`; 5307 tooltip.tooltipster("content", content); 5308 }, 100); 5309 } else { 5310 content = tooltip.attr("title"); //do we even need this? 5311 content = `${average_rating} ${von} 5`; 5312 tooltip.attr("title", content); 5313 } 5314 }, 5315 updateNumberOfRatings(rating_count) { 5316 var tooltip = $(".rating-wrapper .tooltipstered"); 5317 if (tooltip.length == 0) { 5318 return; 5319 } 5320 var bewertungenTranslate = window.ppt.translate('rating.plural', 'Bewertungen'); 5321 tooltip.text(`${rating_count} ${bewertungenTranslate}`); 5322 }, 5323 updatePopup(ratings) { 5324 var ratingCount = [0, 0, 0, 0, 0]; 5325 if (!ratings) return; 5326 $.each(ratings, function (i, rating) { 5327 var index = rating.value - 1; 5328 if (index >= 0 && index < ratingCount.length) ratingCount[index] += 1; 5329 }); 5330 $(".rating-tooltip .legend .ratings-row").each(function (index) { 5331 if (index < ratingCount.length) { 5332 $(this).find(".ratings-count").text(ratingCount[index]); 5333 } 5334 }); 5335 } 5336 }; 5337 var ppId = ratingWrapper.data("poi-id"); 5338 var ppType = ratingWrapper.data("poi-type") || "poi"; 5339 if (!ppId) { 5340 return; 5341 } 5342 $.ajax({ 5343 url: window.pixelpoint.utilities.getAjaxUrl(`/index.php?action=getRatings&type=1732176051`), 5344 method: 'POST', 5345 data: { 5346 pp_id: ppId,
5347 pp_type: ppType 5348 }, 5349 success: function (data) { 5350 if (!!data.average_rating) { 5351 privateFunctions.updateHearts(data.average_rating); 5352 privateFunctions.updateTooltip(data.average_rating); 5353 } 5354 if (!!data.rating_count) { 5355 privateFunctions.updateNumberOfRatings(data.rating_count); 5356 } 5357 if (!!data.ratings) { 5358 privateFunctions.updatePopup(data.ratings); 5359 } 5360 } 5361 }); 5362}); 5363//include 8 5364jQuery(function () { 5365 var weatherModules = $("[data-weather-update]"); 5366 if (weatherModules.length == 0) { 5367 return; 5368 } 5369 var todayTranslation = window.ppt.translate("today", "Heute"); 5370 var weatherPromises = {}; 5371 weatherModules.each(function () { 5372 var $this = $(this); 5373 var weather_id = $this.data("weather-id"); 5374 var weather_tab = $this.data("weather-tab"); 5375 if (!weather_id) return; 5376 if (!weather_tab) weather_tab = "poi"; 5377 var weather_key = `${weather_id}_${weather_tab}`; 5378 if (!weatherModules[weather_key]) { 5379 weatherModules[weather_key] = $.ajax({ 5380 url: window.pixelpoint.utilities.getAjaxUrl(`/index.php?action=getWeather&type=1732176051`), 5381 method: 'POST', 5382 dataType: "json", 5383 data: { 5384 'weather_id': weather_id, 5385 'weather_tab': weather_tab 5386 } 5387 }); 5388 } 5389 weatherModules[weather_key].done(function (data) { 5390 if (!data) { 5391 return; 5392 } 5393 var langObject = $("[data-language-obj]").data("language-obj") || { 5394 "id": 0, 5395 "code": "de" 5396 }; 5397 var today = moment().locale(langObject.code).format('DD. MM.'); 5398 var tomorrow = moment().add(1, 'day').locale(langObject.code).format(`dddd`); 5399 var overtomorrow = moment().add(2, 'day').locale(langObject.code).format(`dddd`); 5400 $this.find("h4.capital-blue span").text(`${todayTranslation}, ${today}`); 5401 $this.find(".row.today .weather-icon").html(`<canvas class="weather-icon today" width="65" height="65" data-icon="${data.today.icon}"></canvas>`); 5402 //$this.find(".row.today .weather-icon").data("icon",data.today.icon); 5403 $this.find(".row.today .weather-info .temperature.big .min").text(data.today.temperatureMin); 5404 $this.find(".row.today .weather-info .temperature.big .max").text(data.today.temperatureMax); 5405 $this.find(".row.today .weather-info .temperature.big .min").text(data.today.temperatureMin); 5406 var shortSummary = data.today.summary; 5407 if (data.today.summary.length > 40) { 5408 shortSummary = data.today.summary.substring(0, 40) + '...'; 5409 } 5410 $this.find(".row.today .weather-info .switch-on-hover .show-on-normal").text(shortSummary); 5411 $this.find(".row.today .weather-info .switch-on-hover .show-on-hover").text(data.today.summary); 5412 var dayList = $this.find(".wetter-box > ul"); 5413 dayList.html(""); 5414 dayList.append(`<li class="day"> 5415 <div class="text">${tomorrow}</div> 5416 <canvas class="weather-icon tomorrow" width="65" height="65" data-icon="${data.tomorrow.icon}"></canvas> 5417 <div class="temperature small"> 5418 <span class="min">${data.tomorrow.temperatureMin}</span> 5419 <span class="max">${data.tomorrow.temperatureMax}</span> 5420 </div> 5421 </li>`); 5422 dayList.append(`<li class="day"> 5423 <div class="text">${overtomorrow}</div> 5424 <canvas class="weather-icon after-tomorrow" width="65" height="65" data-icon="${data.afterTomorrow.icon}"></canvas> 5425 <div class="temperature small"> 5426 <span class="min">${data.afterTomorrow.temperatureMin}</span> 5427 <span class="max">${data.afterTomorrow.temperatureMax}</span> 5428 </div> 5429 </li>`); 5430 $this.find(".weather-icon").each(function () { 5431 window.pixelpoint.ppComponents.skyCons.init($(this)); 5432 }); 5433 }); 5434 }); 5435}); 5436jQuery(function () { 5437 var broshuresList = $(".broshures-list"); 5438 var broshuresOrderForm = $(".order-broshures"); 5439 if (broshuresList.length == 0) return; 5440 $(window).on("load", function () { 5441 equalHeight($(".broshures-list .tabgallery .tabs-content .tabs-panel .list .broshure"), true); 5442 }); 5443 $(window).on("orientationchange resize", function () { 5444 equalHeight($(".broshures-list .tabgallery .tabs-content .tabs-panel .list .broshure"), true); 5445 }); 5446 $('.broshures-list ul.tabs').on('change.zf.tabs', function (event, tab) { 5447 equalHeight($(".broshures-list .tabgallery .tabs-content .tabs-panel .list .broshure"), true); 5448 }); 5449 var container = $(".dce-werbevarianten"); 5450 if (container.length == 0) return; 5451 var cid = container.data("cid"); 5452 var pid = container.data("pid"); 5453 if (!cid || !pid) return; 5454 var domainReloadParameters = window.pixelpoint.utilities.getSysPageUrl(); 5455 var endpoint = ''; 5456 if (domainReloadParameters.useAjaxRenderPageId) { 5457 endpoint = `${domainReloadParameters.baseUrl}?id=${domainReloadParameters.ajaxRenderPageId}&cid=${cid}&pid=${pid}&no_cache=1`; 5458 } else { 5459 endpoint = `${domainReloadParameters.baseUrl}?cid=${cid}&pid=${pid}&no_cache=1`; 5460 } 5461 $.get(endpoint).done(response => { 5462 var box = $(response).find('.broshure-box'); 5463 if (box.length > 0) { 5464 var broshureBox = container.find(".broshure-box"); 5465 broshureBox.html(box.html()); 5466 window.ppComponents.sliders.sliderBox.init(broshureBox); 5467 } 5468 }); 5469}); 5470jQuery(function () { 5471 var text = window.ppt.translate('cookieconsent.description', 'Um die Nutzung der Webseite für Sie optimal zu gestalten und sie fortlaufend verbessern zu können, verwenden wir Cookies. In unserer <a aria-label="learn more about cookies" role="button" tabindex="0" class="cc-link" href="/datenschutzerklaerung/" target="_blank">Datenschutzerklärung</a>
5471 erfahren Sie mehr über die Verwendung und den Zweck der Cookies.'); 5472 var acceptText = window.ppt.translate('cookieconsent.accept', 'Akzeptieren'); 5473 var declineText = window.ppt.translate('cookieconsent.decline', 'Nicht akzeptieren'); 5474 var template = `<div role="dialog" aria-live="polite" aria-label="cookieconsent" aria-describedby="cookieconsent:desc" class="row cc-window cc-banner cc-type-info cc-theme-block cc-bottom cc-color-override--2052982713 " style=""> 5475 <!--googleoff: all--> 5476 <span id="cookieconsent:desc" class="cc-message columns large-8 medium-12"> 5477 ${text} 5478 </span> 5479 <div class="cc-compliance columns large-4 medium-12"> 5480 <a aria-label="dismiss cookie message" role="button" tabindex="0" class="cc-btn cc-not-accept">${declineText}</a> 5481 <a aria-label="dismiss cookie message" role="button" tabindex="0" class="cc-btn cc-dismiss">${acceptText}</a> 5482 </div> 5483 <!--googleon: all--> 5484 </div>`; 5485 var privateFunctions = { 5486 setCookie(name, value, days) { 5487 if (window.pixelpoint.utilities.isIframe()) { 5488 window.parent.postMessage({ 5489 event_id: "setCookie", 5490 data: { 5491 name: name, 5492 value: value, 5493 days: days 5494 } 5495 }, "*"); 5496 } else { 5497 window.setCookie(name, value, days); 5498 } 5499 }, 5500 eraseCookie(name) { 5501 if (window.pixelpoint.utilities.isIframe()) { 5502 window.parent.postMessage({ 5503 event_id: "eraseCookie", 5504 data: { 5505 name: name 5506 } 5507 }, "*"); 5508 } else { 5509 window.eraseCookie(name); 5510 } 5511 }, 5512 readCookie(name) { 5513 if (window.pixelpoint.utilities.isIframe()) { 5514 return window.location.href.indexOf(`${name}=1`) !== -1 ? 1 : 0; 5515 } else { 5516 return readCookie(name); 5517 } 5518 }, 5519 reloadWindow() { 5520 if (window.pixelpoint.utilities.isIframe()) { 5521 window.parent.postMessage({ 5522 event_id: "reloadWindow" 5523 }, "*"); 5524 } else { 5525 window.location.reload(); 5526 } 5527 } 5528 }; 5529 //* 5530 if (!privateFunctions.readCookie("pp_cookie_consent_set") && !window.pixelpoint.utilities.isIframe() && !window.cmp_id) { 5531 $("body").append(template); 5532 $("body").on("click touchstart", ".cc-compliance .cc-dismiss", function () {
5533 window.pixelpoint.tagManager.event("accepting cookies", {}); 5534 $(".cc-window").fadeOut(); 5535 privateFunctions.setCookie("pp_cookie_consent_set", "1", 365); 5536 var analyticsCookieAllowed = privateFunctions.readCookie("pp_allow_analytics_cookies") || 1; 5537 var thirdPartyCookieAllowed = privateFunctions.readCookie("pp_allow_third_party_cookies") || 1; 5538 var anythingChanged = false; 5539 if (!privateFunctions.readCookie("pp_allow_analytics_cookies") || !privateFunctions.readCookie("pp_allow_third_party_cookies")) { 5540 anythingChanged = true; 5541 } 5542 privateFunctions.setCookie("pp_allow_analytics_cookies", analyticsCookieAllowed, 365); 5543 privateFunctions.setCookie("pp_allow_third_party_cookies", thirdPartyCookieAllowed, 365); 5544 window.pixelpoint.ga.enable(); 5545 window.pixelpoint.tagManager.event("Cookies wurden akzeptiert"); 5546 5547 //console.log(dataLayer); 5548 5549 if (anythingChanged) { 5550 setTimeout(function () { 5551 privateFunctions.reloadWindow(); 5552 }, 500); 5553 } 5554 }); 5555 $("body").on("click touchstart", ".cc-compliance .cc-not-accept", function () { 5556 //if the visitor does not agree with cookies we have to delete the cookies 5557
5558 window.pixelpoint.tagManager.event("not accepting cookies", {}); 5559 var anythingChanged = false; 5560 $(".cc-window").fadeOut(); 5561 //window.setCookie("pp_cookie_consent_set", "1", 365); 5562 if (!!readCookie("pp_allow_analytics_cookies") || !!readCookie("pp_allow_third_party_cookies")) { 5563 anythingChanged = true; 5564 } 5565 eraseCookie("pp_allow_analytics_cookies"); 5566 eraseCookie("pp_allow_third_party_cookies"); 5567 window.pixelpoint.tagManager.event("Cookies wurden nicht akzeptiert"); 5568 window.pixelpoint.ga.disable(); 5569 //if (anythingChanged) { 5570 privateFunctions.reloadWindow(); 5571 //} 5572 }); 5573 } 5574 $("body").on("click touchstart", "#save-analytics-cookies", function (e) { 5575 e.preventDefault(); 5576 var allowCookies = $("#cc-analytics-cookies").is(":checked"); 5577 if (allowCookies) { 5578 privateFunctions.setCookie("pp_allow_analytics_cookies", "1", 365); 5579 window.pixelpoint.ga.enable(); 5580 window.pixelpoint.modal.open("Sie haben diese Cookies erfolgreich aktiviert"); 5581 } else { 5582 privateFunctions.eraseCookie("pp_allow_analytics_cookies"); 5583 window.pixelpoint.ga.disable(); 5584 window.pixelpoint.modal.open("Sie haben diese Cookies erfolgreich deaktiviert"); 5585 }
5586 window.pixelpoint.tagManager.event("changed analytics cookies", { 5587 "allow": allowCookies 5588 }); 5589 }); 5590 $("body").on("click touchstart", "#save-third-party-cookies", function (e) { 5591 e.preventDefault(); 5592 var allowCookies = $("#cc-third-party-cookies").is(":checked"); 5593 if (allowCookies) { 5594 privateFunctions.setCookie("pp_allow_third_party_cookies", "1", 365); 5595 window.pixelpoint.modal.open("Sie haben diese Cookies erfolgreich aktiviert"); 5596 } else { 5597 privateFunctions.eraseCookie("pp_allow_third_party_cookies"); 5598 document.cookie = 'pp_allow_third_party_cookies=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;'; 5599 window.pixelpoint.modal.open("Sie haben diese Cookies erfolgreich deaktiviert"); 5600 } 5601 window.pixelpoint.tagManager.event("changed third-party cookies", { 5602 "allow": allowCookies 5603 }); 5604 }); 5605 if ($("#cc-analytics-cookies").length > 0) { 5606 if (!privateFunctions.readCookie("pp_allow_analytics_cookies")) { 5607 $("#cc-analytics-cookies").prop("checked", false); 5608 } else { 5609 $("#cc-analytics-cookies").prop("checked", true); 5610 } 5611 } 5612 if ($("#cc-third-party-cookies").length > 0) { 5613 if (!privateFunctions.readCookie("pp_allow_third_party_cookies")) { 5614 $("#cc-third-party-cookies").prop("checked", false); 5615 } else { 5616 $("#cc-third-party-cookies").prop("checked", true); 5617 } 5618 } 5619 //*/ 5620}); 5621jQuery(function () { 5622 //*******************************helper functions************************ 5623 function setPopupClosed(storageItem) { 5624 localStorage.setItem(storageItem, new Date().toString()); 5625 } 5626 function getPopupClosed(storageItem) { 5627 if (!localStorage.getItem(storageItem)) return false; 5628 const wasClosedOn = new Date(localStorage.getItem(storageItem)); 5629 if (wasClosedOn.toString() === 'Invalid Date') return false; 5630 5631 //set it for two days 5632 const twoDaysAgo = 48 * 60 * 60 * 1000; 5633 if (new Date() - wasClosedOn > twoDaysAgo) { 5634 localStorage.removeItem(storageItem); 5635 return false; 5636 } 5637 return true; 5638 } 5639 //*********************************************************************** 5640 5641 $(document).ready(function (event) { 5642 if ($.trim($('#popup-content > div').html()).length > 0) { 5643 $('#popup-content').find(".main-slider.slick-slider.slick-initialized").slick('unslick'); 5644 if (!getPopupClosed("popupclosed")) { 5645 var popUpContent = "<div class='modal'>" + $("#popup-content").html() + "</div>"; 5646 var instance = lity(popUpContent); 5647 var element = instance.element(); 5648 element.addClass("popup-lity"); 5649 element.find(".lity-close").attr("title", "Fenster schlieÃen"); 5650 window.pixelpoint.images.initializeErrors($(".popup-lity")); 5651 setTimeout(function () { 5652 window.ppComponents.sliders.main.init($(".popup-lity").find(".main-slider")); 5653 }, 100); 5654 } 5655 } 5656 if ($(".dce-popup.small").length > 0) { 5657 if (!getPopupClosed("popupsmallclosed")) { 5658 $('#popup-small-content').removeClass("hide"); 5659 $(".dce-popup.small").each(function () { 5660 let $popup = $(this); 5661 let openAfter = $popup.attr("data-open-after"); 5662 openAfter = parseFloat(openAfter.replace(",", ".")); 5663 window.setTimeout(function () { 5664 $popup.addClass("show-popup");
5665 window.pixelpoint.tagManager.event('advertismentPopupDisplayed', { 5666 'action': 'popupDisplayed' 5667 }); 5668 window.setTimeout(function () { 5669 $popup.find(".close-button").css("aspect-ratio", "1/1"); 5670 }, 2000); 5671 }, openAfter * 1000); 5672 }); 5673 } else { 5674 $('#popup-small-content').addClass("hide"); 5675 } 5676 } 5677 }); 5678 5679 // set session var when close lity 5680 $(document).on('lity:close', function (event, instance) { 5681 var elem = instance.element(); 5682 if (elem.hasClass("popup-lity")) { 5683 setPopupClosed("popupclosed"); 5684 } 5685 }); 5686 $(document).on('click', '.popup-lity .brandenbutton', event => { 5687 setPopupClosed("popupclosed"); 5688 }); 5689 $(document).on('click', '.dce-popup.small .brandenbutton', event => { 5690 let $elem = $(event.target); 5691 if ($elem.hasClass("brandenbutton close-button") || $elem.parent().hasClass("brandenbutton close-button")) { 5692 $elem.closest(".dce-popup").removeClass("show-popup"); 5693 $elem.closest(".dce-popup").addClass("hide-popup"); 5694 } 5695 setPopupClosed("popupsmallclosed"); 5696 }); 5697}); 5698//include 11 5699jQuery(function () { 5700 var distanceAirportLabel = window.ppt.translate("distances.airport", "Flughafen BER â Berlin Brandenburg"); 5701 //var distanceAirportTegelLabel = window.ppt.translate("distances.airport.tegen", "Flughafen Berlin-Tegel"); 5702 var distanceBerlinCenterLabel = window.ppt.translate("distances.berlinmitte", "Berlin-Mitte"); 5703 var distanceFreewayLabel = window.ppt.translate("distances.freeway", "Autobahnanschluss"); 5704 var distanceStationLabel = window.ppt.translate("distances.station", "Nächster Bahnhof"); 5705 var placeholderText = window.ppt.translate("distances.placeholder", "Entfernung"); 5706 var placeholderFilledText = window.ppt.translate("distances.placeholder.filled", "Entfernung eingegeben"); 5707 var privateFunctions = { 5708 checkAndSetPosition(selector) { 5709 selector.css({ 5710 top: "", 5711 left: "" 5712 }); 5713 var overflows = window.pixelpoint.utilities.getOverflows(selector); 5714 var offset = 0; 5715 if (overflows.left > 0) { 5716 offset = selector.offset(); //always need to update 5717 selector.offset({ 5718 top: offset.top, 5719 left: offset.left + overflows.left 5720 }); 5721 } else if (overflows.right > 0) { 5722 offset = selector.offset(); 5723 selector.offset({ 5724 top: offset.top, 5725 left: offset.left - overflows.right 5726 }); 5727 } 5728 if (overflows.top > 0) { 5729 offset = selector.offset(); 5730 selector.offset({ 5731 top: offset.top + overflows.top, 5732 left: offset.left 5733 }); 5734 } else if (overflows.bottom > 0) { 5735 offset = selector.offset(); 5736 selector.offset({ 5737 top: offset.top - overflows.bottom, 5738 left: offset.left 5739 }); 5740 } 5741 }, 5742 parseInt(number) { 5743 var result = parseInt(number); 5744 if (isNaN(result)) return 0; 5745 return result; 5746 }, 5747 getSelector(picker, selector) { 5748 var element = picker.find(selector); 5749 if (element.length == 0) { 5750 var pickerId = picker.attr("id"); 5751 if (!!pickerId) { 5752 element = $(`.distance-picker-layer#for-${pickerId}`).find(selector); 5753 } 5754 } 5755 return element; 5756 }, 5757 getDistance(picker, name) { 5758 return privateFunctions.parseInt(privateFunctions.getSelector(picker, `input[name='${name}']`).val()); 5759 }, 5760 getAirportDistance(picker) { 5761 var inputName = picker.data("airport-input-name"); 5762 return privateFunctions.getDistance(picker, inputName); 5763 }, 5764 /* 5765 getAirportTegelDistance(picker) { 5766 var inputName = picker.data("airport-tegel-input-name"); 5767 return privateFunctions.getDistance(picker, inputName); 5768 }, 5769 //*/ 5770 getBerlinMitteDistance(picker) { 5771 var inputName = picker.data("berlin-mitte-input-name"); 5772 return privateFunctions.getDistance(picker, inputName); 5773 }, 5774 getFreewayDistance(picker) { 5775 var inputName = picker.data("freeway-input-name"); 5776 return privateFunctions.getDistance(picker, inputName); 5777 }, 5778 getStationDistance(picker) { 5779 var inputName = picker.data("station-input-name"); 5780 return privateFunctions.getDistance(picker, inputName); 5781 }, 5782 getActiveDistance(picker) { 5783 var inputName = picker.data("active-distance"); 5784 var value = privateFunctions.getDistance(picker, inputName); 5785 return { 5786 name: inputName, 5787 value: value 5788 }; 5789 }, 5790 deactivateAll(picker) { 5791 privateFunctions.getSelector(picker, `.selector-part`).removeClass("selected").find("input").val("0").prop("disabled", true); 5792 }, 5793 setActiveDistance(picker, inputName) { 5794 privateFunctions.deactivateAll(picker); 5795 privateFunctions.getSelector(picker, `input[data-input='${inputName}']`).prop("disabled", false).closest(".selector-part").addClass("selected"); 5796 picker.data("active-distance", inputName); 5797 privateFunctions.update(picker); 5798 }, 5799 get(picker) {
5800 //* 5801 var distanceAirport = privateFunctions.getAirportDistance(picker); 5802 //var distanceAirportTegel = privateFunctions.getAirportTegelDistance(picker); 5803 var distanceBerlinMitte = privateFunctions.getBerlinMitteDistance(picker); 5804 var distanceFreeway = privateFunctions.getFreewayDistance(picker); 5805 var distanceStation = privateFunctions.getStationDistance(picker); 5806 return { 5807 airport: distanceAirport, 5808 //airportTegel: distanceAirportTegel, 5809 berlinMitte: distanceBerlinMitte, 5810 freeway: distanceFreeway, 5811 station: distanceStation 5812 }; 5813 //*/ 5814 //return privateFunctions.getActiveDistance(picker); 5815 }, 5816 setDistance(picker, name, val) { 5817 if (val < 0) { 5818 val = 0; 5819 } 5820 if (val > 10) { 5821 val = 10; 5822 } 5823 privateFunctions.getSelector(picker, `input[data-input='${name}']`).val(val); 5824 }, 5825 setAirportDistance(picker, val) { 5826 var inputName = picker.data("airport-input-name"); 5827 return privateFunctions.setDistance(picker, inputName, val); 5828 }, 5829 /* 5830 setAirportTegelDistance(picker, val) { 5831 var inputName = picker.data("airport-tegel-input-name"); 5832 return privateFunctions.setDistance(picker, inputName, val); 5833 }, 5834 */ 5835 setBerlinMitteDistance(picker, val) { 5836 var inputName = picker.data("berlin-mitte-input-name"); 5837 return privateFunctions.setDistance(picker, inputName, val); 5838 }, 5839 setFreewayDistance(picker, val) { 5840 var inputName = picker.data("freeway-input-name"); 5841 return privateFunctions.setDistance(picker, inputName, val); 5842 }, 5843 setStationDistance(picker, val) { 5844 var inputName = picker.data("station-input-name"); 5845 return privateFunctions.setDistance(picker, inputName, val); 5846 }, 5847 isCleared(picker) { 5848 var distanceAirport = privateFunctions.getAirportDistance(picker); 5849 //var distanceAirportTegel = privateFunctions.getAirportTegelDistance(picker); 5850 var distanceBerlinMitte = privateFunctions.getBerlinMitteDistance(picker); 5851 var distanceFreeway = privateFunctions.getFreewayDistance(picker); 5852 var distanceStation = privateFunctions.getStationDistance(picker); 5853 return distanceAirport === "" && 5854 // distanceAirportTegel === "" && 5855 distanceBerlinMitte === "" && distanceFreeway === "" && distanceStation === ""; 5856 }, 5857 toggleDisable(disableOrEnable, picker) { 5858 if (!!disableOrEnable) { 5859 privateFunctions.getSelector(picker, "input").prop("disabled", true); 5860 picker.data("is-disabled", true); 5861 picker.removeClass("active"); 5862 } else { 5863 privateFunctions.getSelector(picker, "input").prop("disabled", false); 5864 picker.data("is-disabled", false); 5865 } 5866 }, 5867 validate(picker, showErrors, forceOpen) { 5868 var valid = true; 5869 if (picker.data("is-disabled") == true) { 5870 return valid; 5871 } 5872 picker.removeClass("invalid"); 5873 $(`.distance-picker-layer`).removeClass("invalid"); 5874 showErrors = showErrors || false; 5875 forceOpen = forceOpen || false; 5876 var distanceAirport = privateFunctions.getAirportDistance(picker); 5877 //var distanceAirportTegel = privateFunctions.getAirportTegelDistance(picker); 5878 var distanceBerlinMitte = privateFunctions.getBerlinMitteDistance(picker); 5879 var distanceFreeway = privateFunctions.getFreewayDistance(picker); 5880 var distanceStation = privateFunctions.getStationDistance(picker); 5881 if (isNaN(distanceAirport) || 5882 //isNaN(distanceAirportTegel) || 5883 isNaN(distanceBerlinMitte) || isNaN(distanceFreeway) || isNaN(distanceStation)) { 5884 valid = false; 5885 if (showErrors) { 5886 picker.addClass("invalid"); 5887 if (forceOpen) picker.addClass("active"); 5888 if ($(`.distance-picker-layer`).length > 0) { 5889 var pickerId = picker.attr("id"); 5890 if (!!pickerId) { 5891 $(`.distance-picker-layer#for-${pickerId}`).addClass("invalid"); 5892 } 5893 } 5894 } 5895 } 5896 return valid; 5897 }, 5898 clear($this) { 5899 privateFunctions.setAirportDistance($this, ""); 5900 //privateFunctions.setAirportTegelDistance($this, ""); 5901 privateFunctions.setBerlinMitteDistance($this, ""); 5902 privateFunctions.setFreewayDistance($this, ""); 5903 privateFunctions.setStationDistance($this, ""); 5904 }, 5905 update($this) { 5906 var placeholder = $this.data("placeholder") || placeholderText; 5907 var placeholderFilled = $this.data("placeholder-filled") || placeholderFilledText; 5908 var data = privateFunctions.get($this); 5909 var isEmpty = true; 5910 for (var i in data) { 5911 if (data[i] > 0) { 5912 isEmpty = false;
5913 } 5914 } 5915 if (isEmpty) { 5916 $this.find(">span").text(placeholder); 5917 } else { 5918 $this.find(">span").text(placeholderFilled); 5919 } 5920 }, 5921 init($this) { 5922 var distanceAirportInputName = $this.data("airport-input-name") || "airport"; 5923 //var distanceAirportTegelInputName = $this.data("airport-tegel-input-name") || "airportTegel"; 5924 var distanceBerlinMitteInputName = $this.data("berlin-mitte-input-name") || "berlinMitte"; 5925 var distanceFreewayInputName = $this.data("freeway-input-name") || "freeway"; 5926 var distanceStationInputName = $this.data("station-input-name") || "station"; 5927 $this.data("airport-input-name", distanceAirportInputName); 5928 //$this.data("airport-tegel-input-name", distanceAirportTegelInputName); 5929 $this.data("berlin-mitte-input-name", distanceBerlinMitteInputName); 5930 $this.data("freeway-input-name", distanceFreewayInputName); 5931 $this.data("station-input-name", distanceStationInputName); 5932 var maxDistanceAirport = $this.data("max-airport-input") || 9999; 5933 //var maxDistanceAirportTegel = $this.data("max-airport-tegel-input") || 9999; 5934 var maxDistanceBerlinMitte = $this.data("max-berlin-mitte-input") || 9999; 5935 var maxDistanceFreeway = $this.data("max-freeway-input") || 9999; 5936 var maxDistanceStation = $this.data("max-station-input") || 9999; 5937 var initialDistanceAirport = $this.data("initial-airport-value") || 0; 5938 //var initialDistanceAirportTegel = $this.data("initial-airport-tegel-value") || 0; 5939 var initialDistanceBerlinMitte = $this.data("initial-berlin-mitte-value") || 0; 5940 var initialDistanceFreeway = $this.data("initial-freeway-value") || 0; 5941 var initialDistanceStation = $this.data("initial-station-value") || 0; 5942 var eventsPostfix = $this.data("events-postfix") || null; 5943 var disabled = $this.is("[data-disabled]"); 5944 var placeholder = $this.data("placeholder") || placeholderText; 5945 var placeholderFilled = $this.data("placeholder-filled") || placeholderFilledText; 5946 var elementId = $this.attr("id"); 5947 if (!elementId) { 5948 elementId = Math.random().toString(36).substring(5); 5949 $this.attr("id", elementId); 5950 } 5951 if (maxDistanceAirport > -1 && initialDistanceAirport > maxDistanceAirport) initialDistanceAirport = maxDistanceAirport; 5952 /* 5953 if (maxDistanceAirportTegel > -1 && initialDistanceAirportTegel > maxDistanceAirportTegel) 5954 initialDistanceAirportTegel = maxDistanceAirportTegel; 5955 */ 5956 if (maxDistanceBerlinMitte > -1 && initialDistanceBerlinMitte > maxDistanceBerlinMitte) initialDistanceBerlinMitte = maxDistanceBerlinMitte; 5957 if (maxDistanceFreeway > -1 && initialDistanceFreeway > maxDistanceFreeway) initialDistanceFreeway = maxDistanceFreeway; 5958 if (maxDistanceStation > -1 && initialDistanceStation > maxDistanceStation) initialDistanceStation = maxDistanceStation; 5959 var closeTitle = $this.data("close-title"); 5960 var removeTitle = $this.data("remove-title"); 5961 var layerClasses = $this.data("layer-classes") || ""; 5962 var labelClasses = $this.data("label-classes") || "columns small-7"; 5963 var inputClasses = $this.data("input-classes") || "columns small-5"; 5964 var usedPlaceholder = placeholder; 5965 if (!!initialDistanceStation || !!initialDistanceFreeway || initialDistanceBerlinMitte || 5966 // initialDistanceAirportTegel || 5967 initialDistanceAirport) { 5968 usedPlaceholder = placeholderFilled; 5969 } 5970 $this.html(` 5971 <input type="hidden" name="${distanceAirportInputName}" value="${initialDistanceAirport}" /> 5972 5973 <input type="hidden" name="${distanceBerlinMitteInputName}" value="${initialDistanceBerlinMitte}" /> 5974 <input type="hidden" name="${distanceFreewayInputName}" value="${initialDistanceFreeway}" /> 5975 <input type="hidden" name="${distanceStationInputName}" value="${initialDistanceStation}" /> 5976 <span>${usedPlaceholder}</span> 5977 <button class="clear"> 5978 <i class="icon-close" title="${removeTitle}"></i> 5979 </button> 5980 <div class="selector ${layerClasses}"> 5981 <div class="selector-part row"> 5982 <!-- <i>✔</i> --> 5983 <div class="${labelClasses}">${distanceAirportLabel}</div> 5984 <div class="${inputClasses}"> 5985 <input type="number" min="0" max="${maxDistanceAirport}" data-input="${distanceAirportInputName}" value="${initialDistanceAirport}" />
5986 <span>km</span> 5987 </div> 5988 </div> 5989 <div class="selector-part row"> 5990 <!-- <i>✔</i> --> 5991 <div class="${labelClasses}">${distanceBerlinCenterLabel}</div> 5992 <div class="${inputClasses}"> 5993 <input type="number" min="0" max="${maxDistanceBerlinMitte}" data-input="${distanceBerlinMitteInputName}" value="${initialDistanceBerlinMitte}" /> 5994 <span>km</span> 5995 </div> 5996 </div> 5997 <div class="selector-part row"> 5998 <!-- <i>✔</i> --> 5999 <div class="${labelClasses}">${distanceFreewayLabel}</div> 6000 <div class="${inputClasses}"> 6001 <input type="number" min="0" max="${maxDistanceFreeway}" data-input="${distanceFreewayInputName}" value="${initialDistanceFreeway}" /> 6002 <span>km</span> 6003 </div> 6004 </div> 6005 <div class="selector-part row"> 6006 <!-- <i>✔</i> --> 6007 <div class="${labelClasses}">${distanceStationLabel}</div> 6008 <div class="${inputClasses}"> 6009 <input type="number" min="0" max="${maxDistanceStation}" data-input="${distanceStationInputName}" value="${initialDistanceStation}" /> 6010 <span>km</span> 6011 </div> 6012 </div> 6013 <button class="close-selector"> 6014 <i class="icon-close" title="${closeTitle}"></i> 6015 </button> 6016 </div> 6017 `); 6018 var selector = $this.find(".selector"); 6019 selector.on("change", "input[type='number']", function (e) { 6020 var inputToChange = $(this).data("input"); 6021 if (!!inputToChange) { 6022 privateFunctions.getSelector($this, `input[name='${inputToChange}']`).val($(this).val()); 6023 privateFunctions.update($this); 6024 } 6025 }); 6026 if ($("body").find(`.distance-picker-layer#for-${elementId}`).length == 0) { 6027 $("body").append(`<div id="for-${elementId}" class="distance-picker-layer hide ${layerClasses}"></div>`); 6028 $("body .distance-picker-layer").click(function (e) { 6029 e.preventDefault(); 6030 e.stopPropagation(); 6031 }); 6032 } 6033 var selectorIsGlobal = false; 6034 if (window.pixelpoint.isMobile.isMobileWidth()) { 6035 $(`body .distance-picker-layer#for-${elementId}`).append(selector); 6036 var saveTranslation = window.ppt.translate('save', 'Speichern'); 6037 selector.append(`<a class="brandenbutton save-values">${saveTranslation}</a>`); 6038 selector.on("click touchstart", ".save-values", function (e) { 6039 e.preventDefault(); 6040 e.stopPropagation(); 6041 if (privateFunctions.validate($this, true)) { 6042 $(`.distance-picker-layer#for-${elementId}`).addClass("hide"); 6043 } 6044 }); 6045 selectorIsGlobal = true; 6046 } 6047 $this.addClass("initialized"); 6048 var activatePicker = function (e) { 6049 e.preventDefault(); 6050 if ($this.data("is-disabled") == true) { 6051 return; 6052 } 6053 $this.addClass("active"); 6054 if (selectorIsGlobal) { 6055 $(`.distance-picker-layer#for-${elementId}`).removeClass("hide"); 6056 } else { 6057 privateFunctions.checkAndSetPosition($this.find(".selector")); 6058 } 6059 }; 6060 $this.on("click", activatePicker); 6061 $this.on("keydown", function (e) { 6062 if (e.key === "Enter" || e.keyCode === 13) { 6063 activatePicker(e); 6064 } 6065 }); 6066 $this.on("click", ".clear", function (e) { 6067 e.preventDefault(); 6068 privateFunctions.clear($this); 6069 }); 6070 $(document).on("mouseup touchend", function (e) { 6071 if (!selector.is(e.target) && !$.contains(selector[0], e.target)) { 6072 if (privateFunctions.validate($this, true)) { 6073 $this.removeClass("active"); 6074 if (selectorIsGlobal) { 6075 $(`.distance-picker-layer#for-${elementId}`).addClass("hide"); 6076 } 6077 } 6078 } 6079 }); 6080 var closePicker = function (e) { 6081 e.preventDefault(); 6082 e.stopPropagation(); 6083 $this.removeClass("active"); 6084 if (selectorIsGlobal) { 6085 $(`.distance-picker-layer#for-${elementId}`).addClass("hide"); 6086 } 6087 }; 6088 selector.find(".close-selector").on("click", closePicker); 6089 selector.find(".close-selector").on("keydown", function (e) { 6090 if (e.key === "Enter" || e.keyCode === 13) { 6091 closePicker(e); 6092 } 6093 }); 6094 // Add ESC key listener specifically for this picker's selector
6095 selector.on("keydown", function (e) { 6096 if (e.key === "Escape" || e.keyCode === 27) { 6097 closePicker(e); 6098 } 6099 }); 6100 var exposedFunctions = { 6101 set(data, supressEvent) { 6102 privateFunctions.setAirportDistance($this, data.airport); 6103 //privateFunctions.setAirportTegelDistance($this, data.airportTegel); 6104 privateFunctions.setBerlinMitteDistance($this, data.berlinMitte); 6105 privateFunctions.setFreewayDistance($this, data.freeway); 6106 privateFunctions.setStationDistance($this, data.station); 6107 }, 6108 get() { 6109 return privateFunctions.get($this); 6110 }, 6111 disable() { 6112 privateFunctions.toggleDisable(true, $this); 6113 }, 6114 enable() { 6115 privateFunctions.toggleDisable(false, $this); 6116 }, 6117 valid(forceOpen) { 6118 return privateFunctions.validate($this, true, forceOpen); 6119 }, 6120 reset() { 6121 privateFunctions.clear($this); 6122 } 6123 }; 6124 $this.data("form-element-functions", exposedFunctions).attr("data-form-element-functions-added", true); 6125 if (!!disabled) { 6126 privateFunctions.toggleDisable(true, $this); 6127 $this.closest(".control").addClass("disabled"); 6128 } 6129 6130 // privateFunctions.setActiveDistance($this, distanceAirportInputName); 6131 } 6132 }; 6133 window.pixelpoint.ppComponents.distancePicker = function ($this) { 6134 privateFunctions.init($this); 6135 }; 6136 $(".distance-picker").each(function () { 6137 window.pixelpoint.ppComponents.distancePicker($(this)); 6138 }); 6139}); 6140//include 9 6141jQuery(function () { 6142 //* 6143 $('.map-expander .ausklappen').click(function (e) { 6144 $(this).toggleClass('active'); 6145 // var id = $(this).attr('data-target'); 6146 var maprow = $(this).parent().parent().siblings('.row-map:first'); 6147 maprow.toggleClass('active'); 6148 var label = $(this).siblings('label:first'); 6149 label.toggleClass('active'); 6150 maprow.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function (event) { 6151 if (window.ppcartoMedium && window.ppcartoMedium.$refs && window.ppcartoMedium.$refs.ppcm) { 6152 //setTimeout(function () { 6153 window.ppcartoMedium.$refs.ppcm.resize(); 6154 //}, 200); 6155 } 6156 }); 6157 if (label) { 6158 var active_text = label.attr('data-active'); 6159 var text = label.html(); 6160 label.html(active_text); 6161 label.attr('data-active', text); 6162 $(this).attr("title", active_text); 6163 } 6164 6165 // refreshing map to center it again 6166 //var map = $(this).parent().parent().parent().find('iframe')[0]; 6167 //map.src = map.src; 6168 }); 6169 //*/ 6170}); 6171//include 9 6172jQuery(function () { 6173 var overlayClass = 'overlaykarte'; 6174 var mapUrl = window.pixelpoint.domainService.get("mapUrl"); 6175 if (!mapUrl) { 6176 mapUrl = 'https://maps.reiseland-brandenburg.de/'; 6177 } 6178 if (window.location.host == 'localhost:3000') { 6179 // mapUrl += "testLocal/"; 6180 //mapUrl = 'https://localhost:3003/'; 6181 //mapUrl = 'https://maps.reiseland-brandenburg.de/testLocal/'; 6182 } 6183 6184 //var mapUrl = 'https://maps.reiseland-brandenburg.de/test.html'; 6185 var links = { 6186 'default': `${mapUrl}`, 6187 'location': `${mapUrl}#/?location=%id%`, 6188 'region': `${mapUrl}#/?region=region:%id%`, 6189 'excursion': { 6190 'default': `${mapUrl}#/excursion`, 6191 'add': `${mapUrl}#/excursion?id=%id%`, 6192 'location': `${mapUrl}#/excursion?location=%id%`, 6193 'region': `${mapUrl}#/excursion?region=region:%id%`, 6194 'aquaticsdistrict': `${mapUrl}#/excursion?region=aquaticsdistrict:%id%`, 6195 'nationallandscapes': `${mapUrl}#/excursion?region=nationallandscapes:%id%`, 6196 'excursions': `${mapUrl}#/excursion?region=excursions:%id%` 6197 }, 6198 'directions': { 6199 'default': `${mapUrl}#/excursion?route_locate=true&route_%type%=%id%&route_type=%transport%&supress_explanation=1`, 6200 'defaulttarget': `${mapUrl}#/excursion?route_locate=true&route_target=%target%&route_type=%transport%&supress_explanation=1`, 6201 'address': `${mapUrl}#/excursion?route_address=%address%&route_%type%=%id%&route_type=%transport%&supress_explanation=1`, 6202 'addresses': `${mapUrl}#/excursion?route_address=%address%&route_target=%target%&route_type=%transport%&supress_explanation=1` 6203 } 6204 }; 6205 var lityInstance = null; 6206 var dataPrependString = "mapProperty"; 6207 var privateFunctions = { 6208 parse(type, attributes) { 6209 var link = type.split('.').reduce((o, i) => o[i], links); 6210 return link.replace(/%\w+%/g, function (all) { 6211 var key = all.replace(/%/g, ''); 6212 return attributes[key] || all; 6213 }); 6214 }, 6215 close() { 6216 if (lityInstance != null) { 6217 lityInstance.close(); 6218 lityInstance = null; 6219 } 6220 }, 6221 open(type, attributes) { 6222 type = type || ""; 6223 attributes = attributes || {}; 6224 var link = this.parse(type, attributes); 6225 if (!link) return; 6226 var urlParameters = {}; 6227 if (!readCookie("pp_allow_third_party_cookies")) { 6228 urlParameters.pp_allow_thirdparty_cookies = 1; 6229 } 6230 if (!readCookie("pp_allow_analytics_cookies")) { 6231 urlParameters.pp_allow_analytics_cookies = 1; 6232 } 6233 link = window.pixelpoint.utilities.addUrlParameters(link, urlParameters); 6234 this.close(); 6235 lityInstance = lity(`<div class="lity-iframe-container" style="max-height: 100vh"><iframe frameborder="0" allowfullscreen="" src="${link}" allow="geolocation *"></iframe></div>`); //lity(link); 6236 lityInstance.element().removeClass("lity-inline").addClass("lity-iframe").addClass(overlayClass); 6237 //lityInstance.element().find("iframe").attr("allow",'geolocation *'); 6238 //lityInstance.element().find("iframe").contentWindow.location.reload(); 6239 }, 6240 openInNewTab(type, attributes) { 6241 type = type || ""; 6242 attributes = attributes || {}; 6243 var link = this.parse(type, attributes); 6244 if (!link) return; 6245 this.close(); 6246 window.open(link, '_blank'); 6247 } 6248 }; 6249 $("[data-open-map]").click(function (e) { 6250 var type = $(this).data('open-map') || null; 6251 if (!type) { 6252 e.preventDefault(); 6253 return; 6254 } 6255 var attributes = {}; 6256 var storedData = $(this).data(); 6257 for (var key in storedData) { 6258 if (storedData.hasOwnProperty(key)) { 6259 //important, so we do not access the prototype. Do not access the prototype here or bad thinks will happen! 6260 6261 if (key.indexOf(dataPrependString) == 0) { 6262 var propertyName = key.replace(dataPrependString, ""); 6263 if (!!propertyName) { 6264 propertyName = propertyName.charAt(0).toLowerCase() + propertyName.slice(1); 6265 attributes[propertyName] = storedData[key]; 6266 } 6267 } 6268 } 6269 } 6270 var regions = [{ 6271 id: 2, 6272 linkDe: "/orte-regionen/urlaubsregionen/spreewald/", 6273 linkEn: "" 6274 }, {
6275 id: 3, 6276 linkDe: "/orte-regionen/urlaubsregionen/prignitz/", 6277 linkEn: "" 6278 }, { 6279 id: 4, 6280 linkDe: "/orte-regionen/urlaubsregionen/ruppiner-seenland/", 6281 linkEn: "" 6282 }, { 6283 id: 5, 6284 linkDe: "/orte-regionen/urlaubsregionen/potsdam/", 6285 linkEn: "" 6286 }, { 6287 id: 6, 6288 linkDe: "/orte-regionen/urlaubsregionen/lausitzer-seenland/", 6289 linkEn: "" 6290 }, { 6291 id: 7, 6292 linkDe: "/orte-regionen/urlaubsregionen/seenland-oder-spree/", 6293 linkEn: "" 6294 }, { 6295 id: 10, 6296 linkDe: "/orte-regionen/urlaubsregionen/barnimer-land/", 6297 linkEn: "" 6298 }, { 6299 id: 11, 6300 linkDe: "/orte-regionen/urlaubsregionen/dahme-seenland/", 6301 linkEn: "" 6302 }, { 6303 id: 12, 6304 linkDe: "/orte-regionen/urlaubsregionen/flaeming/", 6305 linkEn: "" 6306 }, { 6307 id: 13, 6308 linkDe: "/orte-regionen/urlaubsregionen/havelland/", 6309 linkEn: "" 6310 }, { 6311 id: 14, 6312 linkDe: "/orte-regionen/urlaubsregionen/elbe-elster-land/", 6313 linkEn: "" 6314 }, { 6315 id: 16, 6316 linkDe: "/orte-regionen/urlaubsregionen/uckermark/", 6317 linkEn: "" 6318 }]; 6319 var regionId = attributes.id; 6320 var region = regions.filter(function (r) { 6321 return r.id == regionId; 6322 }); 6323 var langObject = $("[data-language-obj]").data("language-obj"); 6324 var languageKey = "linkDe"; 6325 if (!!langObject && !!langObject.id == 1) { 6326 languageKey = "linkEn"; 6327 } 6328 var link = ''; 6329 if (region.length == 1) { 6330 link = region[0][languageKey]; 6331 } 6332 6333 // triggers are buttons or divs as well, so never rely on an anchor's default navigation 6334 e.preventDefault(); 6335 var executeDefault = function () { 6336 if (!window.pixelpoint.isMobile.any()) { 6337 privateFunctions.open(type, attributes); 6338 } else { 6339 privateFunctions.openInNewTab(type, attributes); 6340 } 6341 }; 6342 var ignoreRegionLinks = $(this).is('[data-ignore-region-links]'); 6343 if (!!link && !ignoreRegionLinks) { 6344 $.ajax({ 6345 url: link, 6346 type: 'HEAD', 6347 success: function () { 6348 window.open(link, '_blank'); 6349 }, 6350 error: executeDefault, 6351 async: false 6352 }); 6353 } else { 6354 executeDefault(); 6355 } 6356 }); 6357 window.pixelpoint.map = { 6358 open(type, attrs) { 6359 //25.01.2021 - from now on we open the map every time in a new tab 6360 privateFunctions.openInNewTab(type, attrs); 6361 /* 6362 if (window.pixelpoint.isMobile.any()) { 6363 privateFunctions.openInNewTab(type, attrs); 6364 } else { 6365 privateFunctions.open(type, attrs); 6366 } 6367 //*/ 6368 }, 6369 close() { 6370 privateFunctions.close(); 6371 }, 6372 root() { 6373 return mapUrl; 6374 }, 6375 getLink(type, attrs) { 6376 type = type || ""; 6377 attrs = attrs || {}; 6378 var link = privateFunctions.parse(type, attrs); 6379 if (!link) return ''; 6380 return link; 6381 } 6382 }; 6383 6384 //hack for the global map 6385 $('.controls .icon-map-2-after').click(function (e) { 6386 if (!!$('.controls .icon-map-2-after').tooltipster) { 6387 $('.controls .icon-map-2-after').tooltipster('close'); 6388 } 6389 }); 6390 // ---------------------- 6391}); 6392//include 9 6393jQuery(function () { 6394 var mapFunctions = { 6395 mapObject() { 6396 var airBnB = null; 6397 if (typeof ppcartoAirbnb != "undefined" && !!ppcartoAirbnb && !!ppcartoAirbnb.$refs && !!ppcartoAirbnb.$refs.airbnb) { 6398 airBnB = ppcartoAirbnb.$refs.airbnb; 6399 } else if (typeof ppcartoStatic != "undefined" && !!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static) { 6400 airBnB = ppcartoStatic.$refs.static; 6401 } 6402 return airBnB; 6403 }, 6404 getMapType() { 6405 if (typeof ppcartoAirbnb != "undefined" && !!ppcartoAirbnb && !!ppcartoAirbnb.$refs && !!ppcartoAirbnb.$refs.airbnb) { 6406 return "airbnb"; 6407 } else if (typeof ppcartoStatic != "undefined" && !!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static) { 6408 return "static"; 6409 } 6410 return "undefined"; 6411 }, 6412 removeBBox() { 6413 var mapObject = mapFunctions.mapObject(); 6414 if (!!mapObject.filter && !!mapObject.filter.bbox) { 6415 delete mapObject.filter.bbox; 6416 } 6417 }, 6418 getBBox() { 6419 var mapObject = mapFunctions.mapObject(); 6420 if (!mapObject || !mapObject.bbox) return null; 6421 return mapObject.bbox(); 6422 }, 6423 reloadData() { 6424 var mapObject = mapFunctions.mapObject(); 6425 if (!!mapObject) { 6426 mapObject.init = true; 6427 //mapObject.getData(); 6428 } 6429 }, 6430 clearRegionFromAirBnB() { 6431 var airBnB = mapFunctions.mapObject(); 6432 if (!airBnB || !airBnB.clearRegion) return; 6433 airBnB.clearRegion(); 6434 }, 6435 regionToAirBnB(id, type) { 6436 if (!id) return; 6437 type = type || 'region'; 6438 var airBnB = mapFunctions.mapObject(); 6439 if (!airBnB) return; 6440 airBnB.setRegion({ 6441 type: type, 6442 id: window.pixelpoint.utilities.getMapRegion(id) //id 6443 }); 6444 }, 6445 setFilters(type, filters, changeMapSection, removeBBox) { 6446 changeMapSection = changeMapSection || false; 6447 removeBBox = removeBBox || false; 6448 type = type || 'poi'; 6449 var manuallyReloadData = false;
6450 var airbnb = mapFunctions.mapObject(); 6451 if (!airbnb) return; 6452 airbnb.type = type; 6453 airbnb.filter = filters; 6454 if (!!removeBBox) { 6455 mapFunctions.removeBBox(); 6456 manuallyReloadData = true; 6457 } 6458 if (!!changeMapSection) { 6459 manuallyReloadData = true; 6460 } 6461 if (!!manuallyReloadData && false) mapFunctions.reloadData(); 6462 }, 6463 setOffset(offset) { 6464 offset = offset || 0; 6465 var airBnB = mapFunctions.mapObject(); 6466 if (!airBnB) return; 6467 airBnB.offset = offset; 6468 }, 6469 changeBBox(zoom, coordinates, callback) { 6470 var airBnB = mapFunctions.mapObject(); 6471 if (!airBnB) return; 6472 var viewArguments = {}; 6473 if (!!zoom && zoom > 0) { 6474 viewArguments.zoom = zoom; 6475 } 6476 if (!!coordinates && coordinates.length >= 2 && coordinates[0] > 0 && coordinates[1] > 0) { 6477 viewArguments.coordinates = coordinates; 6478 } 6479 if (!viewArguments) return; 6480 var isAirBnB = mapFunctions.getMapType() == "airbnb"; 6481 airBnB.$once("moveend", function () { 6482 if (!!callback) { 6483 callback(); 6484 } 6485 }); 6486 if (!!isAirBnB) { 6487 airBnB.$nextTick(function () { 6488 airBnB.init = false; 6489 airBnB.changeView(viewArguments); 6490 }); 6491 } else { 6492 setTimeout(function () { 6493 airBnB.$nextTick(function () { 6494 airBnB.init = false; 6495 airBnB.changeView(viewArguments); 6496 }); 6497 }, 100); 6498 } 6499 }, 6500 onMoveEnd(callback) { 6501 var map = mapFunctions.mapObject(); 6502 if (!!map && !!callback) { 6503 map.$on("moveend", function (data) { 6504 callback(data); 6505 }); 6506 } 6507 }, 6508 onHighlightOver(callback) { 6509 var map = mapFunctions.mapObject(); 6510 if (!!map && !!callback) { 6511 map.$on("highlightover", function (data) { 6512 callback(data); 6513 }); 6514 } 6515 }, 6516 onHighlightOut(callback) { 6517 var map = mapFunctions.mapObject(); 6518 if (!!map && !!callback) { 6519 map.$on("highlightout", function (data) { 6520 callback(data); 6521 }); 6522 } 6523 }, 6524 focusItem(id) { 6525 var map = mapFunctions.mapObject(); 6526 if (!!map) { 6527 map.focusItem(id); 6528 } 6529 }, 6530 watchOnChange(callback) { 6531 var map = mapFunctions.mapObject(); 6532 if (!map || !callback) return null; 6533 return map.$watch('geojson.features', function () { 6534 callback(map.features); 6535 }); 6536 }, 6537 getFeatures() { 6538 var map = mapFunctions.mapObject(); 6539 if (!map) return null; 6540 if (!!map.geojson && !!map.geojson.features && map.geojson.features.length > 0) return map.geojson.features; 6541 return map.features; 6542 }, 6543 clearLayers() { 6544 var map = mapFunctions.mapObject(); 6545 if (!map || !map.config || !map.config.layers) return false; 6546 map.config.layers = []; 6547 return true; 6548 }, 6549 addToLayer(type, id, limit) { 6550 var map = mapFunctions.mapObject(); 6551 limit = limit || 25; 6552 if (!map || !map.config || !map.config) return false; 6553 if (!map.config.layers) { 6554 map.config.layers = []; 6555 } 6556 var added = false; 6557 for (var i in map.config.layers) { 6558 if (map.config.layers[i].type == type) { 6559 if (!map.config.layers[i].filter) map.config.layers[i].filter = { 6560 limit: limit, 6561 external_id: [] 6562 }; 6563 if (!map.config.layers[i].filter.external_id) { 6564 map.config.layers[i].filter.external_id = []; 6565 } 6566 map.config.layers[i].filter.external_id.push(id); 6567 added = true; 6568 break; 6569 } 6570 } 6571 if (!added) { 6572 map.config.layers.push({ 6573 type: type, 6574 filter: { 6575 limit: limit, 6576 external_id: [id] 6577 } 6578 }); 6579 } 6580 return true; 6581 } 6582 }; 6583 window.pixelpoint.airBnB = mapFunctions; 6584}); 6585$(function () { 6586 if (!$("div[id^='ppcarto']").length && !$("div[class^='ppcarto']").length) { 6587 return; 6588 } 6589 const enableCSS = () => { 6590 $('#ppcarto-css').removeAttr('disabled'); 6591 }; 6592 const getCachedScript = (url, options) => { 6593 // Allow user to set any option except for dataType, cache, and url 6594 options = $.extend(options || {}, { 6595 dataType: "script", 6596 cache: true, 6597 url: url 6598 }); 6599 // Use $.ajax() since it is more flexible than $.getScript 6600 // Return the jqXHR object so we can chain callbacks 6601 return $.ajax(options); 6602 }; 6603 6604 // ******* helper function to load a script *************** 6605 const loadScript = src => { 6606 const isLoaded = $.Deferred(); 6607 getCachedScript(src).done(() => {
6608 if (isLoaded.state() == "pending") { 6609 isLoaded.resolve(); 6610 } 6611 }).fail((jqxhr, settings, exception) => { 6612 if (isLoaded.state() == "pending") { 6613 isLoaded.reject(exception); 6614 } 6615 }); 6616 if ($(`script[data-cmp-src^='${src}']`).length > 0) { 6617 isLoaded.resolve(); 6618 } 6619 return isLoaded.promise(); 6620 }; 6621 const vueLoaded = () => { 6622 let timer = 0; 6623 const isLoaded = $.Deferred(); 6624 let checker = setInterval(() => { 6625 timer++; 6626 if (!!window.Vue) { 6627 clearInterval(checker); 6628 isLoaded.resolve(); 6629 } else if (timer > 100) { 6630 clearInterval(checker); 6631 isLoaded.reject(); 6632 } 6633 }, 50); 6634 return isLoaded.promise(); 6635 }; 6636 // ******************************************************** 6637 6638 var ppcartoLoaded = $.Deferred(); 6639 var initialize = () => { 6640 var librariesToLoad = null; 6641 var scriptsToLoad = []; 6642 var scriptRoot = `${window.pixelpoint.map.root()}js`; 6643 //var scriptRoot = `https://localhost:3002/js`; 6644 //* 6645 if (window.location.href.indexOf("localhost") > -1) { 6646 scriptRoot = `https://localhost:3003/js`; 6647 //scriptRoot = `${window.pixelpoint.map.root()}test/js`; 6648 //scriptRoot = `https://10.0.0.129:3003/js`; 6649 } else if (window.location.href.indexOf("192.168.1.105") > -1) { 6650 scriptRoot = `https://192.168.1.105:3003/js`; 6651 //scriptRoot = `https://10.0.0.129:3003/js`; 6652 } else if (window.location.href.indexOf("10.0.0.129") > -1) { 6653 scriptRoot = `https://10.0.0.129:3003/js`; 6654 //scriptRoot = `https://10.0.0.129:3003/js`; 6655 } 6656 //*/ 6657 if ($("#ppcarto").length > 0 || $("#ppcarto-medium").length > 0) { 6658 librariesToLoad = `${scriptRoot}/ppcarto.light.lib-min.js`; 6659 scriptsToLoad.push(`${scriptRoot}/ppcarto.small_medium-min.js`); 6660 } 6661 if ($("#ppcarto-airbnb").length > 0 || $(".ppcarto-airbnb").length > 0) { 6662 librariesToLoad = `${scriptRoot}/ppcarto.medium.lib-min.js`; 6663 scriptsToLoad.push(`${scriptRoot}/ppcarto.airbnb-min.js`); 6664 } 6665 if ($("#ppcarto-static").length > 0 || $(".ppcarto-static").length > 0) { 6666 librariesToLoad = `${scriptRoot}/ppcarto.medium.lib-min.js`; 6667 scriptsToLoad.push(`${scriptRoot}/ppcarto.static-min.js`); 6668 } 6669 if (!!librariesToLoad) {
6670 //* 6671 loadScript(librariesToLoad).done(function () { 6672 enableCSS(); 6673 var defers = []; 6674 vueLoaded().done(() => { 6675 $.each(scriptsToLoad, function (i, script) { 6676 defers.push(loadScript(script)); 6677 }); 6678 $.when.apply($, defers).then(function () { 6679 window.ppcartoScriptsLoaded = true; 6680 ppcartoLoaded.resolve(); 6681 }); 6682 }).fail(() => { 6683 console.log("Error while checking for vue"); 6684 }); 6685 }).fail(function (jqxhr, settings, exception) { 6686 console.log("error while loading"); 6687 }); 6688 //*/ 6689 } 6690 }; 6691 6692 // â Always wait 5 seconds before executing initialize (debounced) 6693 const INITIALIZE_DELAY_MS = 2000; 6694 let initializeTimeoutId = null; 6695 const initializeDelayed = () => { 6696 if (initializeTimeoutId) clearTimeout(initializeTimeoutId); 6697 initializeTimeoutId = setTimeout(() => { 6698 initializeTimeoutId = null; 6699 initialize(); 6700 }, INITIALIZE_DELAY_MS); 6701 }; 6702 if (typeof __cmp !== 'undefined' && !!__cmp) { 6703 __cmp("addEventListener", ["consent", () => { 6704 initializeDelayed(); 6705 }, true], null); 6706 } else { 6707 initializeDelayed(); 6708 } 6709 initializeDelayed(); 6710 window.pixelpoint.map.async = { 6711 checkMedium: function () { 6712 var defer = $.Deferred(); 6713 if (!!window.pixelpoint.map.promises && !!window.pixelpoint.map.promises.mediumMapLoaded && window.pixelpoint.map.promises.mediumMapLoaded.state() == "resolved") { 6714 defer.resolve(); 6715 } else { 6716 var newScriptToLoad = ""; 6717 var newLibrariesToLoad = ""; 6718 if ($("#ppcarto").length > 0 || $("#ppcarto-medium").length > 0) { 6719 newLibrariesToLoad = `${scriptRoot}/ppcarto.light.lib-min.js`; 6720 newScriptToLoad = `${scriptRoot}/ppcarto.small_medium-min.js`; 6721 if (!!newLibrariesToLoad) { 6722 getCachedScript(newLibrariesToLoad).done(function () { 6723 getCachedScript(newScriptToLoad).done(function () { 6724 defer.resolve(); 6725 }).fail(function () { 6726 defer.reject(); 6727 }); 6728 }).fail(function (jqxhr, settings, exception) { 6729 console.log("error while loading"); 6730 defer.reject(); 6731 }); 6732 } 6733 } 6734 } 6735 return defer.promise(); 6736 } 6737 }; 6738 window.pixelpoint.map.scriptsLoaded = function (callback) { 6739 //console.log("callback added to scriptsLoaded"); 6740 $.when(ppcartoLoaded).then(function () { 6741 vueLoaded().done(() => { 6742 callback(); 6743 }).fail(() => { 6744 console.log("error calling callback"); 6745 }); 6746 }); 6747 }; 6748}); 6749//include 9 6750jQuery(function () { 6751 $(".open-map-link").each((index, element) => { 6752 var url = $(element).attr('href'); 6753 var className = $(element).data('open-map-class'); 6754 if (!url) return; 6755 $(element).on("click", e => { 6756 var urlParameters = {}; 6757 if (!!readCookie("pp_allow_third_party_cookies")) { 6758 urlParameters.pp_allow_third_party_cookies = 1; 6759 } 6760 if (!!readCookie("pp_allow_analytics_cookies")) { 6761 urlParameters.pp_allow_analytics_cookies = 1; 6762 } 6763 url = window.pixelpoint.utilities.addUrlParameters(url, urlParameters); 6764 6765 //25.01.2021 - from now on we open the map every time in a new tab 6766 /* 6767 if (!window.pixelpoint.isMobile.any()) { 6768 e.preventDefault(); 6769 var instance = lity(url); 6770 var title = $(element).data("close-button-title") || "Karte schlieÃen"; 6771 instance.element().attr("title", title); 6772 instance.element().find("iframe").attr("allow","geolocation"); 6773 if (!!className) 6774 instance.element().addClass(className); 6775 } 6776 //*/ 6777 }); 6778 }); 6779}); 6780jQuery(function () { 6781 //currently not used, but can be if needed 6782 6783 var iframeSelector = ".lity-iframe.overlaykarte iframe"; 6784 var eventBindings = {}; 6785 window.pixelpoint.mapCommunications = { 6786 on: function (key, action) { 6787 eventBindings[key] = action; 6788 }, 6789 off: function (key) { 6790 if (!!eventBindings[key]) { 6791 delete eventBindings[key]; 6792 } 6793 }, 6794 trigger: function (key, data) { 6795 var iframe = $(iframeSelector); 6796 if (iframe.length > 0) { 6797 iframe.contentWindow.postMessage({ 6798 key: key, 6799 data: data 6800 }, "*"); 6801 } 6802 } 6803 }; 6804 window.onmessage = function (e) { 6805 if (!!e.data && !!e.data.key && !!eventBindings[e.data.key]) { 6806 var data = e.data.data || {}; 6807 eventBindings[e.data.key](e.data.data); 6808 } 6809 }; 6810 window.pixelpoint.mapCommunications.on("cookies.allowed", function () { 6811 var cookiesAllowed = "yes"; 6812 if (!!readCookie("pp_supress_cookies")) { 6813 cookiesAllowed = "no"; 6814 } 6815 window.pixelpoint.mapCommunications.trigger("cookies.allowed", { 6816 "allowed": cookiesAllowed 6817 }); 6818 }); 6819}); 6820jQuery(function () { 6821 let triggerElements = $(".slide-to-map"); 6822 let action = _.debounce(() => { 6823 window.pixelpoint.utilities.scrollTo(".dce-map-related-offers", null, 0, false, () => { 6824 $(".init-medium-map").first().click(); 6825 }); 6826 }, 100); 6827 triggerElements.on("click", event => { 6828 action(); 6829 }); 6830}); 6831//include 4 6832jQuery(function () { 6833 window.ppComponents = window.ppComponents || {}; 6834 window.ppComponents.sliders = window.ppComponents.sliders || {}; 6835 6836 // Common configuration variables 6837 var defaultPrevText = "Rückwärts klicken"; 6838 var defaultNextText = "Vorwärts klicken"; 6839 6840 // Helper function to generate arrow HTML 6841 function createArrows(prevText, nextText) { 6842 return { 6843 prevArrow: '<button class="prev" title="' + prevText + '" aria-label="' + prevText + '"><i aria-label="' + prevText + '" class="icon-arrow-big-left"></i></button>', 6844 nextArrow: '<button class="next" title="' + nextText + '" aria-label="' + nextText + '"><i aria-label="' + nextText + '" class="icon-arrow-big-right"></i></button>' 6845 }; 6846 } 6847 6848 // Common slider base options 6849 var baseSliderOptions = { 6850 lazyLoad: 'ondemand', 6851 autoplaySpeed: 1800, 6852 cssEase: 'ease-in-out', 6853 slidesToScroll: 1 6854 }; 6855 6856 // Common responsive breakpoints 6857 var commonBreakpoints = { 6858 mobile: 480, 6859 tablet: 768, 6860 tabletLarge: 840, 6861 desktop: 960, 6862 desktopLarge: 1440 6863 }; 6864 6865 // Helper function to restore custom accessibility attributes for all elements in slider 6866 function restoreCustomAccessibilityAttributes($slider) { 6867 // remove slide tabindex its enought if the slide content is focusable 6868 $slider.find(".slick-slide[tabindex='0']").each(function () { 6869 var $element = $(this); 6870 $element.removeAttr("tabindex"); 6871 }); 6872 6873 // Find all elements with custom accessibility attributes within the slider 6874 $slider.find('[data-tabindex], [data-aria-hidden]').each(function () { 6875 var $element = $(this); 6876 // Restore custom tabindex / aria-hidden if special data-attributes exists 6877 if ($element.attr('data-tabindex') !== undefined) { 6878 $element.attr('tabindex', $element.attr('data-tabindex')); 6879 } 6880 if ($element.attr('data-aria-hidden') !== undefined) { 6881 $element.attr('aria-hidden', $element.attr('data-aria-hidden')); 6882 } 6883 }); 6884 } 6885 6886 // Global event handlers for all slick sliders to restore custom accessibility attributes 6887 $(document).on('init afterChange', '.slick-slider', function (event, slick) { 6888 var $slider = $(this); 6889 setTimeout(function () { 6890 restoreCustomAccessibilityAttributes($slider); 6891 }, 50); 6892 }); 6893 6894 // Helper function to initialize sliders with reinitialize capability 6895 function initializeSlider($element, options) { 6896 $element.slick(options); 6897 $element.data("exposed", { 6898 reinitialize() { 6899 $element.slick('unslick'); 6900 $element.slick(options); 6901 } 6902 }); 6903 } 6904 6905 // Main slider initialization 6906 $('.main-slider.slick-slider').each(function () { 6907 var $this = $(this); 6908 var prevText = $this.data("prev-text") || defaultPrevText; 6909 var nextText = $this.data("next-text") || defaultNextText; 6910 var arrows = createArrows(prevText, nextText); 6911 var options = $.extend({}, baseSliderOptions, { 6912 slide: ".item", 6913 slidesToShow: 1, 6914 dots: $this.data("dots") !== undefined ? $this.data("dots") : false, 6915 arrows: $this.data("arrows") !== undefined ? $this.data("arrows") : false, 6916 autoplay: $this.data("autoplay") !== undefined ? $this.data("autoplay") : false, 6917 autoplaySpeed: $this.data("autoplay") !== undefined ? $this.data("autoplaySpeed") : 3000 6918 }, arrows); 6919 initializeSlider($this, options); 6920 }); 6921 window.ppComponents.sliders.main = { 6922 init: function (element) { 6923 var prevText = element.data("prev-text") || defaultPrevText; 6924 var nextText = element.data("next-text") || defaultNextText; 6925 var arrows = createArrows(prevText, nextText); 6926 var options = $.extend({}, baseSliderOptions, { 6927 slide: ".item", 6928 slidesToShow: 1, 6929 dots: $this.data("dots") !== undefined ? $this.data("dots") : false, 6930 arrows: $this.data("arrows") !== undefined ? $this.data("arrows") : false, 6931 autoplay: $this.data("autoplay") !== undefined ? $this.data("autoplay") : false, 6932 autoplaySpeed: $this.data("autoplay") !== undefined ? $this.data("autoplaySpeed") : 3000 6933 }, arrows); 6934 if (element.hasClass("slick-initialized")) element.slick('unslick'); 6935 element.slick(options); 6936 } 6937 }; 6938 6939 // Helper function for read-more initialization 6940 function initItemsReadMore($slider) { 6941 return function () { 6942 setTimeout(function () { 6943 $slider.find(".more-wrapper").each(function () { 6944 var exposed = $slider.data("show-more"); 6945 if (!!exposed && !!exposed.init) { 6946 exposed.init(); 6947 } else {
6948 window.ppComponents.common.showMore($(this)); 6949 } 6950 }); 6951 }); 6952 }; 6953 } 6954 window.ppComponents.sliders.offersGallery = { 6955 init: function (element) { 6956 var $this = element; 6957 var itemCount = $this.find(".item").length; 6958 var centerMode = itemCount > 3 && !$this.hasClass("no-center-mode"); 6959 var initialSlide = centerMode ? 1 : 0; 6960 var prevText = $this.data("prev-text") || defaultPrevText; 6961 var nextText = $this.data("next-text") || defaultNextText; 6962 var arrows = createArrows(prevText, nextText); 6963 var centerPadding = $this.hasClass("less-center-padding") ? "1px" : "35px"; 6964 var centerPadding2 = $this.hasClass("less-center-padding") ? "1px" : "30px"; 6965 $this.on('init', initItemsReadMore($this)); 6966 var options = $.extend({}, baseSliderOptions, { 6967 slide: ".item", 6968 centerMode: centerMode, 6969 initialSlide: initialSlide, 6970 centerPadding: centerPadding, 6971 slidesToShow: 3, 6972 responsive: [{ 6973 breakpoint: commonBreakpoints.desktop, 6974 settings: { 6975 centerPadding: centerPadding2 6976 } 6977 }, { 6978 breakpoint: commonBreakpoints.tabletLarge, 6979 settings: { 6980 centerMode: false, 6981 slidesToShow: 2, 6982 initialSlide: 0 6983 } 6984 }, { 6985 breakpoint: 640, 6986 settings: { 6987 centerPadding: '0', 6988 centerMode: false, 6989 slidesToShow: 1, 6990 initialSlide: 0 6991 } 6992 }] 6993 }, arrows); 6994 $this.slick(options); 6995 } 6996 }; 6997 $('.offers-gallery.slick-slider').each(function () { 6998 window.ppComponents.sliders.offersGallery.init($(this)); 6999 }); 7000 7001 // Video gallery slider initialization 7002 $('.videogallery.slick-slider').each(function () { 7003 var $this = $(this); 7004 var itemCount = $this.find(".item").length; 7005 var centerMode = itemCount > 4; 7006 var initialSlide = centerMode ? 1 : 0; 7007 var slidesToShow = centerMode ? 4 : itemCount; 7008 var prevText = $this.data("prev-text") || defaultPrevText; 7009 var nextText = $this.data("next-text") || defaultNextText; 7010 var arrows = createArrows(prevText, nextText); 7011 var options = $.extend({}, baseSliderOptions, { 7012 slide: ".item", 7013 centerMode: false, 7014 // Always false for video gallery 7015 initialSlide: 0, 7016 // Always 0 for video gallery 7017 centerPadding: '35px', 7018 slidesToShow: slidesToShow, 7019 responsive: [{ 7020 breakpoint: commonBreakpoints.desktopLarge, 7021 settings: { 7022 slidesToShow: 3, 7023 centerMode: centerMode, 7024 initialSlide: initialSlide 7025 } 7026 }, { 7027 breakpoint: commonBreakpoints.desktop, 7028 settings: { 7029 centerPadding: '30px' 7030 } 7031 }, { 7032 breakpoint: commonBreakpoints.tablet, 7033 settings: { 7034 centerPadding: '25px', 7035 slidesToShow: 2, 7036 centerMode: false, 7037 initialSlide: 0 7038 } 7039 }, { 7040 breakpoint: commonBreakpoints.mobile, 7041 settings: { 7042 centerPadding: '0', 7043 slidesToShow: 1, 7044 centerMode: false, 7045 initialSlide: 0 7046 } 7047 }] 7048 }, arrows); 7049 $this.slick(options); 7050 }); 7051 7052 // Slider box configuration 7053 var $sliderBoxSlider = $('.slider-box > .slider'); 7054 var prevText = $sliderBoxSlider.data("prev-text") || defaultPrevText; 7055 var nextText = $sliderBoxSlider.data("next-text") || defaultNextText; 7056 var arrows = createArrows(prevText, nextText); 7057 var boxOptions = $.extend({}, baseSliderOptions, { 7058 slide: "div", 7059 centerMode: false, 7060 centerPadding: '35px', 7061 slidesToShow: 1, 7062 responsive: [{ 7063 breakpoint: commonBreakpoints.tablet, 7064 settings: { 7065 arrows: true, 7066 centerPadding: '0' 7067 } 7068 }] 7069 }, arrows); 7070 $sliderBoxSlider.slick(boxOptions); 7071 7072 // Prospekte box image height adjustment 7073 $('.slider-box.prospekte-box > .slider').each(function () { 7074 var elem = $(this); 7075 var activeSlide = elem.find('div.slick-slide.slick-current.slick-active'); 7076 var imgHeight = activeSlide.width() * 53 / 84; 7077 elem.find('div.slick-slide img').css("height", imgHeight + "px"); 7078 setTimeout(function () { 7079 var newImgHeight = activeSlide.find("img").height(); 7080 if (newImgHeight < imgHeight) { 7081 elem.find('div.slick-slide img').css("height", newImgHeight + "px"); 7082 } 7083 }, 500); 7084 }); 7085 window.ppComponents.sliders.sliderBox = { 7086 init: function (element) { 7087 var slider = element.find('> .slider'); 7088 if (slider.length > 0) { 7089 if (slider.hasClass("slick-initialized")) { 7090 slider.slick('unslick'); 7091 } 7092 slider.slick(boxOptions); 7093 } 7094 } 7095 }; 7096 7097 // Adaptive width slider with configurable slides count 7098 $('.adaptWidthSlider.slick-slider').each(function () { 7099 var $this = $(this); 7100 var hasElementsToShow = $this.hasClass("elements-to-show-1") || $this.hasClass("elements-to-show-2") || $this.hasClass("elements-to-show-3") || $this.hasClass("elements-to-show-4"); 7101 if (hasElementsToShow && $this.hasClass("slick-initialized")) { 7102 $this.slick('unslick'); 7103 } 7104 if (hasElementsToShow && !$this.hasClass("slick-initialized")) { 7105 // Extract slides count from class name 7106 var slidesNr = 1; 7107 var slidesTabletNr = 2; 7108 if ($this.hasClass("elements-to-show-1")) { 7109 slidesNr = 1; 7110 slidesTabletNr = 1; 7111 } else if ($this.hasClass("elements-to-show-2")) { 7112 slidesNr = 2; 7113 } else if ($this.hasClass("elements-to-show-3")) { 7114 slidesNr = 3; 7115 } else if ($this.hasClass("elements-to-show-4")) { 7116 slidesNr = 4; 7117 } 7118 var prevText = $this.data("prev-text") || defaultPrevText; 7119 var nextText = $this.data("next-text") || defaultNextText; 7120 var arrows = createArrows(prevText, nextText); 7121 var options = $.extend({}, baseSliderOptions, { 7122 slide: ".item", 7123 centerMode: false, 7124 centerPadding: '35px', 7125 slidesToShow: slidesNr, 7126 responsive: [{ 7127 breakpoint: commonBreakpoints.tablet, 7128 settings: { 7129 centerMode: false, 7130 centerPadding: '0', 7131 slidesToShow: slidesTabletNr 7132 } 7133 }, { 7134 breakpoint: commonBreakpoints.mobile, 7135 settings: { 7136 centerMode: false, 7137 slidesToShow: 1 7138 } 7139 }] 7140 }, arrows); 7141 $this.slick(options); 7142 } 7143 }); 7144 7145 // General slider with configurable parameters 7146 $('.general-slider.slick-slider').each(function () { 7147 var $this = $(this); 7148 var itemCount = $this.find('>.item').length; 7149 var showSliderCount = $this.data('slider-shown') || 1; 7150 var showSliderCountResponsive = showSliderCount >= 2 ? 2 : 1; 7151 7152 // Determine center mode and initial slide 7153 var centerMode = false;
7154 var initialSlide = 0; 7155 if (showSliderCount != 1 && itemCount > 3) { 7156 centerMode = true; 7157 initialSlide = 1; 7158 } 7159 var prevText = $this.data("prev-text") || defaultPrevText; 7160 var nextText = $this.data("next-text") || defaultNextText; 7161 var arrows = createArrows(prevText, nextText); 7162 var options = $.extend({}, baseSliderOptions, { 7163 slide: ".item", 7164 centerMode: centerMode, 7165 initialSlide: initialSlide, 7166 slidesToShow: showSliderCount, 7167 arrows: itemCount > 1, 7168 responsive: [{ 7169 breakpoint: commonBreakpoints.desktop, 7170 settings: { 7171 centerPadding: '30px' 7172 } 7173 }, { 7174 breakpoint: commonBreakpoints.tabletLarge, 7175 settings: { 7176 centerMode: false, 7177 slidesToShow: showSliderCountResponsive, 7178 initialSlide: 0 7179 } 7180 }, { 7181 breakpoint: commonBreakpoints.tablet, 7182 settings: { 7183 centerMode: false, 7184 centerPadding: '20px', 7185 slidesToShow: showSliderCountResponsive, 7186 initialSlide: 0 7187 } 7188 }, { 7189 breakpoint: commonBreakpoints.mobile, 7190 settings: { 7191 centerMode: false, 7192 centerPadding: '0', 7193 slidesToShow: 1, 7194 initialSlide: 0 7195 } 7196 }] 7197 }, arrows); 7198 initializeSlider($this, options); 7199 }); 7200 7201 // Helper function for slider resize handling 7202 function handleSliderResize($slider, $subslider) { 7203 if ($slider && $slider.hasClass('slick-initialized')) { 7204 $slider.slick('resize'); 7205 } 7206 if ($subslider && $subslider.hasClass('slick-initialized')) { 7207 $subslider.slick('resize'); 7208 } 7209 } 7210 7211 // Angebot wrapper slider helper functions (from 03angebotWrapperSlider.js) 7212 function initAngebotRightContent() { 7213 $(".angebot-wrapper .angebot .info").each(function () { 7214 var $this = $(this); 7215 $this.addClass("activated"); 7216 var showMoreWrapper = $this.find(".show-more-wrapper"); 7217 var additionalInfo = $this.find(".additional-info"); 7218 initAngebotRightContentHeight($this); 7219 setTimeout(function () { 7220 var threshold = 20; 7221 if ($this.height() < showMoreWrapper.height()) { 7222 additionalInfo.removeClass("hide"); 7223 } else { 7224 if (showMoreWrapper.height() + threshold < showMoreWrapper[0].scrollHeight) { 7225 additionalInfo.removeClass("hide"); 7226 } else { 7227 var padding = $(window).width() >= 640 ? "1.25rem" : "0.8rem"; 7228 additionalInfo.parent().css("padding-bottom", padding); 7229 } 7230 } 7231 }, 100); 7232 setTimeout(function () { 7233 initAngebotRightContentHeight($this); 7234 }, 500); 7235 $this.on("click", ".additional-info", function (e) { 7236 var sliderWrapper = $(e.target).closest(".slick-slider"); 7237 if (sliderWrapper.length > 0 && sliderWrapper.hasClass("sliding")) return; 7238 $this.toggleClass("open"); 7239 7240 // Tag manager event (if available) 7241 if (window.pixelpoint && window.pixelpoint.tagManager) {
7242 window.pixelpoint.tagManager.event("Click auf weitere Informationen", { 7243 "open": $this.hasClass("open") ? window.ppt ? window.ppt.translate("expand", "ausklappen") : "ausklappen" : window.ppt ? window.ppt.translate("collapse", "einklappen") : "einklappen" 7244 }); 7245 } 7246 if ($(window).width() >= 640) { 7247 if ($this.parent().find('.button-open').is(':visible')) { 7248 $this.parent().find('.button-open').click(); 7249 } else { 7250 setRightTextHeight($this); 7251 } 7252 } else { 7253 setRightTextHeight($this); 7254 } 7255 }); 7256 if ($(window).width() < 640) { 7257 $this.find('div.showmore').addClass('collapsed'); 7258 var prices = $this.find('div.prices'); 7259 if (prices.hasClass("addOpen")) { 7260 prices.addClass('transparent-gradient open'); 7261 } else { 7262 prices.addClass('transparent-gradient'); 7263 if (window.initPriceReadMore) { 7264 window.initPriceReadMore(); 7265 } 7266 } 7267 } 7268 }); 7269 } 7270 function initAngebotRightContentHeight($this) { 7271 var columnText = $this.parent().find('.text-col'); 7272 var columnTextHeight = columnText.outerHeight(); 7273 var columnPicture = $this.parent().find('.picture'); 7274 var columnPictureHeight = columnPicture.outerHeight(); 7275 var usedInfoHeight = 0; 7276 if ($(window).width() <= 960 && columnText.outerWidth() == columnPicture.outerWidth()) { 7277 usedInfoHeight = columnPictureHeight + columnTextHeight; 7278 } else if (columnTextHeight > columnPictureHeight) { 7279 usedInfoHeight = columnTextHeight; 7280 } else { 7281 usedInfoHeight = columnPictureHeight; 7282 } 7283 if ($(window).width() >= 640) { 7284 $this.css({ 7285 "max-height": usedInfoHeight, 7286 "height": usedInfoHeight, 7287 "min-height": usedInfoHeight 7288 }); 7289 } 7290 } 7291 function setRightTextHeight($this) { 7292 var angebotTextHeight = $this.parent().find('.text-col').outerHeight(); 7293 var heightInfo = 0; 7294 var maxHeightInfo = 0; 7295 var minHeightInfo = parseInt($this.css('min-height')); 7296 $this.removeAttr("style"); 7297 if ($this.hasClass("open")) { 7298 heightInfo = $(window).width() >= 640 && $this.height() <= angebotTextHeight ? angebotTextHeight : 'auto'; 7299 maxHeightInfo = 'none'; 7300 } else { 7301 maxHeightInfo = minHeightInfo; 7302 } 7303 $this.css({ 7304 "height": heightInfo, 7305 "max-height": maxHeightInfo, 7306 "min-height": minHeightInfo 7307 }); 7308 } 7309 7310 // Angebot wrapper slider initialization (from 03angebotWrapperSlider.js) 7311 const initializeAngebotSlider = () => { 7312 // re-query the live DOM here instead of using a selector captured at DOM-ready 7313 var $angebotSlider = $('.angebot-wrapper > .slick-slider'); 7314 if (!$angebotSlider.length) return; 7315 var prevText = $angebotSlider.data("prev-text") || defaultPrevText; 7316 var nextText = $angebotSlider.data("next-text") || defaultNextText; 7317 var arrows = createArrows(prevText, nextText); 7318 var angebotOptions = $.extend({}, baseSliderOptions, { 7319 slide: ".angebot", 7320 centerMode: false, 7321 centerPadding: '30px', 7322 slidesToShow: 1, 7323 autoplay: false, 7324 init: function (event, slick) { 7325 // Add overlay divs 7326 $(event.target).find(">div.slick-list").append('<div class="hide-slide left"></div><div class="hide-slide right"></div>').addClass("overflow-content"); 7327 } 7328 }, arrows); 7329 $angebotSlider.not('.slick-initialized').slick(angebotOptions); 7330 7331 // Set min-height for mobile 7332 if ($(window).width() < 640) { 7333 var stHeight = $('.angebot-wrapper .slick-slider .slick-track').height(); 7334 $('.angebot-wrapper .slick-slider .slick-slide').css('min-height', stHeight + 'px'); 7335 } 7336 initAngebotRightContent(); 7337 7338 // Show more wrapper event handlers 7339 $(".angebot-wrapper .angebot .more-wrapper").each(function () { 7340 var $this = $(this); 7341 var angebot = $this.closest(".angebot"); 7342 var info = angebot.find(".info"); 7343 var showMore = $this.data("show-more"); 7344 if (showMore && $(window).width() >= 640) { 7345 showMore.on("toggle", function () { 7346 info.toggleClass("open", $this.hasClass('open')); 7347 setRightTextHeight(info); 7348 }); 7349 showMore.on("toggleEnd", function () { 7350 setRightTextHeight(info); 7351 }); 7352 } 7353 }); 7354 7355 // Resize handler 7356 $(window).on("orientationchange resize", initAngebotRightContent); 7357 7358 // Slider event handlers 7359 $angebotSlider.on('beforeChange', function (event, slick, currentSlide, nextSlide) { 7360 $(event.target).addClass("sliding"); 7361 $(event.target).find("div.angebot .info").removeClass("open"); 7362 }); 7363 $angebotSlider.on('afterChange', function (event, slick, currentSlide, nextSlide) { 7364 var element = $(event.target); 7365 element.removeClass("sliding"); 7366 var showMore = element.find('div.slick-current').find(".offer-content"); 7367 var showMoreApi = showMore.data("show-more"); 7368 if (showMoreApi && showMoreApi.init) { 7369 showMoreApi.init(); 7370 } 7371 }); 7372 }; 7373 7374 // Initialize angebot slider on window load 7375 $(window).on("load", initializeAngebotSlider); 7376 7377 // Content slider initialization (from 04contentSlider.js) 7378 const initializeContentSliders = () => { 7379 // re-query the live DOM here - same reasoning as initializeAngebotSlider above 7380 var $contentSlider = $('.content-slider > .slick-slider'); 7381 var $contentSubslider = $('.content-sub-slider > .slick-slider'); 7382 if (!$contentSlider.length && !$contentSubslider.length) return; 7383 7384 // Main content slider 7385 var prevText = $contentSlider.data("prev-text") || defaultPrevText; 7386 var nextText = $contentSlider.data("next-text") || defaultNextText; 7387 var arrows = createArrows(prevText, nextText); 7388 var contentOptions = $.extend({}, baseSliderOptions, { 7389 slide: "div", 7390 centerMode: false, 7391 centerPadding: '35px', 7392 slidesToShow: 1, 7393 autoplay: false, 7394 asNavFor: '.content-sub-slider > .slick-slider', 7395 responsive: [{ 7396 breakpoint: commonBreakpoints.tablet, 7397 settings: { 7398 centerMode: false, 7399 centerPadding: '0px', 7400 slidesToShow: 1 7401 } 7402 }, { 7403 breakpoint: commonBreakpoints.mobile, 7404 settings: { 7405 centerMode: false, 7406 centerPadding: '0px', 7407 slidesToShow: 1 7408 } 7409 }] 7410 }, arrows); 7411 7412 // Sub-slider options 7413 var subsliderOptions = $.extend({}, baseSliderOptions, { 7414 slide: "div", 7415 centerMode: false, 7416 centerPadding: '35px',
7417 arrows: false, 7418 asNavFor: '.content-slider > .slick-slider', 7419 slidesToShow: 3, 7420 autoplay: false 7421 }); 7422 $contentSlider.not('.slick-initialized').slick(contentOptions); 7423 $contentSubslider.not('.slick-initialized').slick(subsliderOptions); 7424 7425 // Sub-slider click handler 7426 $contentSubslider.on('click', 'div.item', function () { 7427 var index = $(this).data('slick-index'); 7428 var actualSliderItems = $(this).parent().find("div.item").length; 7429 if (actualSliderItems > 4) { 7430 $contentSubslider.slick('slickGoTo', index + 1); 7431 } else { 7432 $contentSlider.slick('slickGoTo', index); 7433 } 7434 }); 7435 7436 // Resize handlers 7437 $(window).on('resize orientationchange', function () { 7438 handleSliderResize($contentSlider, $contentSubslider); 7439 }); 7440 }; 7441 7442 // Initialize content sliders on window load 7443 $(window).on("load", initializeContentSliders); 7444}); 7445//include 5 7446 7447var orderSlides = null; // don't ask 7448jQuery(function () { 7449 var beforeMediaQuery = Foundation.MediaQuery.current; 7450 var elemWrapperAcc = ".tabMobileAccordion"; 7451 var elemContentAcc = ".accordion-item"; 7452 var elemContentActiveAcc = ".is-active .accordion-content"; 7453 7454 //------we set up the deferred object, if it does not already exist-------- 7455 window.pixelpoint = window.pixelpoint || {}; 7456 window.pixelpoint.map = window.pixelpoint.map || {}; 7457 window.pixelpoint.map.promises = window.pixelpoint.map.promises || {}; 7458 window.pixelpoint.map.promises.mediumMapLoaded = window.pixelpoint.map.promises.mediumMapLoaded || $.Deferred(); 7459 //------------------------------------------------------------------------- 7460 7461 orderSlides = function (container, featureGroups, tabName) { 7462 //* 7463 tabName = tabName || null; 7464 container.find(".tabs-title").each(function () { 7465 var tabTitle = $(this); 7466 var key = tabTitle.data("ppcarto-switch"); 7467 if (!!tabName && tabName != key) return true; 7468 var tabId = tabTitle.find("a").attr("href"); 7469 var tab = $(tabId); 7470 if (tab.length > 0) { 7471 var features = featureGroups[key]; 7472 if (!!features) features = features.features; 7473 if (!!features) { 7474 var newOrder = []; 7475 for (var i in features) { 7476 var poiId = features[i].id; 7477 var tile = tab.find(`>.item[data-poi-id='${poiId}']`); 7478 if (tile.length > 0) { 7479 tile.attr("data-element-index", i).data("element-index", i); 7480 tile.find("p.number").text(parseInt(i) + 1); 7481 newOrder.push(tile); 7482 } 7483 } 7484 for (var i in newOrder) { 7485 tab.append(newOrder[i]); 7486 } 7487 } 7488 } 7489 }); 7490 //*/ 7491 }; 7492 var initWrapper = function () { 7493 $(".tabgallery-wrapper").each(function () { 7494 var $this = $(this); 7495 var wrapperId = "#" + $(this).attr("id"); 7496 var elemWrapper = wrapperId + ".tabgallery-wrapper .tabgallery"; 7497 var elemContent = ".tabs-panel"; 7498 var elemContentActive = elemContent + ".is-active"; 7499 if ($(wrapperId + " [id^=gallery-tabs]").hasClass("tabMobileAccordion")) { 7500 if (Foundation.MediaQuery.current == "small") { 7501 elemWrapper = wrapperId + " " + elemWrapperAcc; 7502 elemContent = elemContentAcc; 7503 elemContentActive = elemContent + elemContentActiveAcc; 7504 } 7505 } 7506 7507 /* 7508 * 11.03.2020 ZP: changes for ticket TPBB-1072. 7509 * the map will load on demand now 7510 * */ 7511 initSlickOnTabGallery(elemWrapper, elemContentActive); 7512 if ($("#ppcarto-medium").length > 0) { 7513 $(".init-medium-map").on("click", e => { 7514 $.when(window.pixelpoint.map.promises.mediumMapLoaded).then(function () { 7515 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + `:related-pois-whole-loader:show`); 7516 window.ppcartoMedium.$refs.ppcm.$on("relatedLoaded", function (data) { 7517 $(".map-expander").removeClass("inactive"); 7518 let panels = $(elemWrapper).find(".tabs-panel").map((index, el) => { 7519 return $(el).attr("id"); 7520 }); 7521 let allComplete = $.Deferred(); 7522 let parts = []; 7523 panels.map((index, panel) => { 7524 //intentionally, if there are no panels the loader won't be shown 7525 let slider = $(`${elemWrapper} #${panel}`); 7526 if (!slider.hasClass("all-loaded")) { 7527 let done = $.Deferred(); 7528 loadAllElements(elemWrapper, `#${panel}`).done(function (data) { 7529 allComplete.then(() => { 7530 populateMissingData(elemWrapper, `#${panel}`, data, false); 7531 }); 7532 done.resolve(); 7533 }); 7534 parts.push(done.promise()); 7535 } 7536 }); 7537 $.when.apply($, parts).then(() => { 7538 allComplete.resolve(); 7539 }); 7540 allComplete.then(() => { 7541 orderSlides($this, data.featureGroups); 7542 ppcartoTabGalleryInit(elemWrapper, elemContent); 7543 setTimeout(() => { 7544 let activeTab = $(".tabgallery-wrapper .tabs-title.is-active"); 7545 if (activeTab.length > 0) { 7546 ppcartoTabGalleryChange(activeTab); 7547 activeTab.find("> a").click(); 7548 setTimeout(() => { 7549 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + `:related-pois-whole-loader:hide`); 7550 }, 200); 7551 } 7552 }, 50); 7553 }); 7554 }); 7555 }); 7556 }); 7557 } 7558 }); 7559 $(".tabmosaic-wrapper").each(function () { 7560 if ($(this).hasClass("mobile-mosaic-to-slick-slider")) { 7561 var wrapperId = "#" + $(this).attr("id"); 7562 var elemWrapper = wrapperId + ".tabmosaic-wrapper .tabmosaic";
7563 var elemContent = ".tabs-panel"; 7564 var elemContentActive = elemContent + ".is-active .mosaic-slick-slider"; 7565 if (Foundation.MediaQuery.current == "small") { 7566 if ($(wrapperId + " [id^=gallery-tabs]").hasClass("tabMobileAccordion")) { 7567 elemWrapper = wrapperId + " " + elemWrapperAcc; 7568 elemContent = elemContentAcc; 7569 elemContentActive = elemContent + elemContentActiveAcc + " .mosaic-slick-slider"; 7570 } 7571 initSlickOnTabMosaic(elemWrapper, elemContentActive); 7572 } else if ($(this).hasClass("medium-mosaic-to-slider") && Foundation.MediaQuery.current == "medium") { 7573 initSlickOnTabMosaic(elemWrapper, elemContentActive); 7574 } else {} 7575 } 7576 }); 7577 }; 7578 7579 // #31628 7580 $(window).on("load", function () { 7581 initWrapper(); 7582 }); 7583 var clickHandler = function (e) { 7584 e.preventDefault(); 7585 let $target = $(this); 7586 let contentId = ""; 7587 7588 // Since we're binding to the <a> element, $(this) should be the link 7589 if ($target.is("a")) { 7590 contentId = $target.attr("href"); 7591 // Pass the parent .tabs-title to titleClickEvent, not the link itself 7592 titleClickEvent($target.parent()); 7593 } else { 7594 // Fallback: if somehow bound to parent, find the link 7595 let $link = $target.find("a").first(); 7596 if ($link.length > 0) { 7597 contentId = $link.attr("href"); 7598 titleClickEvent($target); 7599 } 7600 } 7601 7602 // add class to parent before slick initialises 7603 if (contentId && $(contentId).length > 0 && !$(contentId).hasClass("slick-initialized")) { 7604 $(contentId).closest(".tabs-content").addClass("fixed-height"); 7605 } 7606 }; 7607 7608 // Event handler for both click and keyboard events 7609 var tabEventHandler = function (e) { 7610 if (e.type === 'click' || e.type === 'keydown' && (e.key === 'Enter' || e.key === ' ')) { 7611 clickHandler.call(this, e); 7612 } 7613 }; 7614 7615 // Initial event binding 7616 $("[id^=gallery-tabs] .tabs-title > a, [id^=gallery-tabs] .accordion-title > a").on('click keydown', tabEventHandler); 7617 window.ppComponents.sliders.tabGallery = { 7618 init: function (force) { 7619 if (beforeMediaQuery != Foundation.MediaQuery.current || !!force) { 7620 beforeMediaQuery = Foundation.MediaQuery.current; 7621 $(".tabmosaic-wrapper").each(function () { 7622 var $this = $(this); 7623 var wrapperId = "#" + $this.attr("id"); 7624 var elemWrapper = wrapperId + ".tabmosaic-wrapper .tabmosaic"; 7625 var elemContent = ".tabs-panel"; 7626 var elemContentActive = elemContent + ".is-active .mosaic-slick-slider"; 7627 if ($(wrapperId + " [id^=gallery-tabs]").hasClass("tabMobileAccordion")) { 7628 elemWrapper = wrapperId + " " + elemWrapperAcc; 7629 elemContent = elemContentAcc; 7630 elemContentActive = elemContent + elemContentActiveAcc + " .mosaic-slick-slider"; 7631 } 7632 setTimeout(function () { 7633 $(wrapperId + " .slick-initialized").each(function () { 7634 $(this).slick("unslick"); 7635 }); 7636 $(wrapperId + " .more-wrapper").each(function () { 7637 $(this).removeClass("active"); 7638 $(this).removeAttr("style"); 7639 addReadMoreButtons($(this), "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 50); 7640 }); 7641 if ($this.hasClass("mobile-mosaic-to-slick-slider")) { 7642 if (Foundation.MediaQuery.current == "small") { 7643 initSlickOnTabMosaic(elemWrapper, elemContentActive); 7644 } else if ($this.hasClass("medium-mosaic-to-slider") && Foundation.MediaQuery.current == "medium") { 7645 initSlickOnTabMosaic(elemWrapper, elemContentActive); 7646 } else {} 7647 } 7648 }, 200); 7649 }); 7650 $(".tabgallery-wrapper").each(function () { 7651 var $this = $(this); 7652 var wrapperId = "#" + $this.attr("id"); 7653 var elemWrapper = wrapperId + ".tabgallery-wrapper .tabgallery"; 7654 var elemContent = ".tabs-panel"; 7655 var elemContentActive = elemContent + ".is-active"; 7656 if ($(wrapperId + " [id^=gallery-tabs]").hasClass("tabMobileAccordion")) { 7657 if (Foundation.MediaQuery.current == "small") { 7658 elemWrapper = wrapperId + " " + elemWrapperAcc; 7659 elemContent = elemContentAcc; 7660 elemContentActive = elemContent + elemContentActiveAcc; 7661 } 7662 } 7663 setTimeout(function () { 7664 $(wrapperId + " .slick-initialized").each(function () { 7665 $(this).slick("unslick"); 7666 }); 7667 initSlickOnTabGallery(elemWrapper, elemContentActive); 7668 }, 200); 7669 }); 7670 $("[id^=gallery-tabs] .tabs-title > a, [id^=gallery-tabs] .accordion-title > a").off('click keydown'); 7671 setTimeout(function () { 7672 $("[id^=gallery-tabs] .tabs-title > a, [id^=gallery-tabs] .accordion-title > a").on('click keydown', tabEventHandler); 7673 }, 200); 7674 } 7675 }, 7676 initWrapper: initWrapper, 7677 initTabClickEvents: function () { 7678 $("[id^=gallery-tabs] .tabs-title > a, [id^=gallery-tabs] .accordion-title > a").on('click keydown', tabEventHandler); 7679 } 7680 }; 7681 $(window).on("orientationchange resize", window.ppComponents.sliders.tabGallery.init); 7682}); 7683function loadAllElements(elemWrapper, elemId) { 7684 var deferred = $.Deferred(); 7685 var slider = null; 7686 if (elemWrapper && elemId) { 7687 slider = $(elemWrapper + " " + elemId); 7688 } else if (elemWrapper instanceof jQuery) { 7689 slider = elemWrapper; 7690 } else if (!!elemWrapper) { 7691 slider = $(elemWrapper); 7692 } 7693 if (!!slider) { 7694 var type = slider.data("type"); 7695 var id = slider.data("id"); 7696 if (!type || !id) { 7697 deferred.reject(); 7698 return deferred; 7699 } 7700 var tab = slider.data("ppcarto-hover"); 7701 7702 // getting the latitude and longitude, if existing --- 7703 var lat = null, 7704 lon = null; 7705 var container = slider.closest(".tabgallery-wrapper.related-offers"); 7706 if (container.length > 0) { 7707 lat = container.data("lat") || null; 7708 lon = container.data("lon") || null; 7709 } 7710 // --------------------------------------------------- 7711 7712 var parameters = {
7713 pp_type: type, 7714 pp_id: id 7715 }; 7716 if (!!tab) parameters["pp_tab"] = tab; 7717 if (!!lat && !!lon) { 7718 parameters["lat"] = lat; 7719 parameters["lon"] = lon; 7720 } 7721 var relatedAjaxUrl = window.pixelpoint.utilities.getAjaxUrl(window.pixelpoint.settings.relatedAjaxUrl); 7722 $.get(`${relatedAjaxUrl}`, parameters, null, 'json').done(function (data) { 7723 deferred.resolve(data.data); 7724 }).fail(function () { 7725 deferred.reject(); 7726 }); 7727 } else { 7728 deferred.reject(); 7729 } 7730 return deferred; 7731} 7732function initSlickOnTabGallery(elemWrapper, elemId, currentSlide) { 7733 currentSlide = typeof currentSlide == "undefined" ? -1 : currentSlide; 7734 var slider = null; 7735 if (!!elemWrapper && !!elemId) { 7736 slider = $(elemWrapper + " " + elemId); 7737 } else if (elemWrapper instanceof jQuery) { 7738 slider = elemWrapper; 7739 } else if (!!elemWrapper) { 7740 slider = $(elemWrapper); 7741 } 7742 if (!!slider) { 7743 var centerPadding = "-15px", 7744 infinite = true; 7745 if (slider.find(".item").length <= 6) { 7746 var centerPadding = "0", 7747 infinite = false; 7748 } 7749 var centerPaddingTest = $(elemWrapper).width() / 4; 7750 var prevText = slider.data("prev-text"); 7751 var nextText = slider.data("next-text"); 7752 if (slider.find(".item").length <= 6) { 7753 slider.addClass("all-loaded"); 7754 } 7755 7756 /** 7757 * ZP change 26.03.2020: remove class from parent after slider initialises 7758 */ 7759 slider.on("init", () => { 7760 slider.closest(".tabs-content").removeClass("fixed-height"); 7761 }); 7762 slider.slick({ 7763 slide: ".item", 7764 infinite: infinite, 7765 lazyLoad: "ondemand", 7766 centerPadding: centerPadding, 7767 swipeToSlide: true, 7768 prevArrow: '<button class="prev" title=" ' + prevText + ' "><i aria-label=" ' + prevText + ' " class="icon-arrow-big-left"></i></button>', 7769 nextArrow: '<button class="next" title=" ' + nextText + ' "><i aria-label=" ' + nextText + ' " class="icon-arrow-big-right"></i></button>', 7770 slidesToShow: 6, 7771 slidesToScroll: 1, 7772 centerMode: slider.find(".item").length >= 6 ? false : true, 7773 initialSlide: slider.find(".item").length >= 6 ? 0 : 3, 7774 responsive: [{ 7775 breakpoint: 1100, 7776 settings: { 7777 slidesToShow: 4, 7778 centerMode: slider.find(".item").length >= 4 ? false : true, 7779 initialSlide: slider.find(".item").length >= 4 ? 0 : 2 7780 } 7781 }, { 7782 breakpoint: 800, 7783 settings: { 7784 centerPadding: "-5px", 7785 slidesToShow: 3, 7786 centerMode: true, 7787 initialSlide: 1 7788 } 7789 }, { 7790 breakpoint: 639, 7791 settings: { 7792 slidesToShow: 2, 7793 initialSlide: 0, 7794 centerMode: false 7795 } 7796 }, { 7797 breakpoint: 520, 7798 settings: { 7799 centerPadding: centerPaddingTest + "px", 7800 slidesToShow: 1, 7801 centerMode: true 7802 } 7803 }, { 7804 breakpoint: 300, 7805 settings: { 7806 centerPadding: centerPaddingTest - 50 + "px" 7807 } 7808 }] 7809 }); 7810 slider.off("beforeChange").on("beforeChange", function (event, slick, currentSlide, nextSlide) { 7811 if (!slider.hasClass("all-loaded")) { 7812 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + `:related-pois-loader:show`); 7813 loadAllElements(elemWrapper, elemId).done(function (data) { 7814 populateMissingData(elemWrapper, elemId, data, true); 7815 }); 7816 } 7817 }); 7818 equalHeight(slider.find(".item"), true); 7819 } 7820} 7821function buildTemplateData(element, index) { 7822 var item = element; 7823 var isEvent = false; 7824 if (!!element && !!element.event) { 7825 item = element.event; 7826 isEvent = true; 7827 } else if (!!element && typeof element.event_dates != "undefined") { 7828 isEvent = true; 7829 } 7830 var data = {}; 7831 data.formatted_date_html = ""; 7832 if (!element.htmlFortmattedTime && !element.formattedFrom && !element.spansMultipleDays && element.closest_event_date && isEvent) { 7833 element = element.closest_event_date; 7834 //data.isFullWidth = ""; 7835 element.number = parseInt(index) + 1; 7836 data.formatted_date_html = ""; 7837 if (element.from_date) { 7838 var e_date = new Date(element.from_date); 7839 var e_date_d = ("0" + e_date.getDate()).slice(-2); 7840 var e_date_m = ("0" + parseInt(e_date.getMonth() + 1)).slice(-2); 7841 } 7842 var e_from_time_t = ""; 7843 if (element.from_time) { 7844 var e_from_time = new Date(element.from_time); 7845 e_from_time_t = ("0" + e_from_time.getHours()).slice(-2) + ":" + ("0" + e_from_time.getMinutes()).slice(-2); 7846 } 7847 var e_to_time_t = ""; 7848 if (element.to_time) { 7849 var e_to_time = new Date(element.to_time); 7850 e_to_time_t = ("0" + e_to_time.getHours()).slice(-2) + ":" + ("0" + e_to_time.getMinutes()).slice(-2); 7851 } 7852 data.formatted_date_html = '<div class="date date-2-cols"><div class="date-col"><div class="startDate">' + e_date_d + '.' + e_date_m + '.<i>2023</i></div></div><div class="time"><i class="icon-clock"></i>' + e_from_time_t + '<i> ' + e_to_time_t + '</i></div></div>'; 7853 } 7854 data.isFullWidth = ""; 7855 if (!!element.from_time) { 7856 data.isFullWidth = "fullwidth"; 7857 } 7858 if (!!element.to_time) { 7859 data.isFullWidth = "fullwidth"; 7860 } 7861 7862 // -------- colorClass -------------------------- 7863 data.colorClass = "default"; 7864 if (!!item.sections && !!item.sections.length) { 7865 for (var i in item.sections) { 7866 if (window.pixelpoint.settings.highlightSections.indexOf(item.sections[i]) > -1) { 7867 data.colorClass = item.sections[i]; 7868 break; 7869 } 7870 } 7871 } 7872 // ---------------------------------------------- 7873 // -------- relatedElement ---------------------- 7874 data.relatedElement = element; 7875 // ---------------------------------------------- 7876 // -------- relatedElementIterator -------------- 7877 data.relatedElementIterator = { 7878 index: index 7879 }; 7880 // ---------------------------------------------- 7881 // -------- imgUrl & imgAlt && imgAlternative --- 7882 7883 var assetType = ""; 7884 var replacementType = "poi"; 7885 if (isEvent) { 7886 assetType = "event/"; 7887 replacementType = "event";
7888 } 7889 if (!!item.image && !!item.image.id) data.imgUrl = `${window.pixelpoint.domainService.get('apiEndpoint')}${assetType}asset/${item.image.id}/thumbnail/173/103.jpg`;else data.imgUrl = `${window.pixelpoint.settings.apiUrl}${replacementType}/${item.id}/placeholder.jpg?second=1`; 7890 if (!!item.image && !!item.image.alt) data.imgAlt = item.image.alt;else { 7891 if (!!item.data && !!item.data.name) data.imgAlt = item.data.name;else if (!!item.name) data.imgAlt = item.name;else data.imgAlt = item.title; 7892 } 7893 data.imgAlternative = `${window.pixelpoint.settings.apiUrl}${replacementType}/${item.id}/placeholder.jpg?third=1`; 7894 // ---------------------------------------------- 7895 // -------- infoClass --------------------------- 7896 data.infoClass = ""; 7897 if (!!element.distance || !!element.openinghours) { 7898 data.infoClass = "withBottomInfo"; 7899 } 7900 // ---------------------------------------------- 7901 // -------- elementLink && elementTitle --------- 7902 data.elementLink = element.elementLink; 7903 if (!data.elementLink && !!element.slug) data.elementLink = element.slug; 7904 data.elementTitle = ""; 7905 if (!!item.data && !!item.data.name) { 7906 data.elementTitle = item.data.name; 7907 } else if (!!item.name) { 7908 data.elementTitle = item.name; 7909 } else if (!!item.title) { 7910 data.elementTitle = item.title; 7911 } 7912 data.croppedElementTitle = data.elementTitle; 7913 if (data.croppedElementTitle.length > 35) { 7914 data.croppedElementTitle = data.croppedElementTitle.replace(/^(.{35}
7914[^\s]*).*/, "$1"); 7915 if (data.croppedElementTitle.length > 35) { 7916 var lastIndex = data.croppedElementTitle.lastIndexOf(" "); 7917 data.croppedElementTitle = data.croppedElementTitle.substring(0, lastIndex); 7918 } 7919 data.croppedElementTitle = data.croppedElementTitle + "..."; 7920 } 7921 // ---------------------------------------------- 7922 // -------- categories -------------------------- 7923 data.categories = ""; 7924 if (!!item.categories && item.categories.length > 0) data.categories = _.map(item.categories.slice(0, 3), category => { 7925 return category.name; 7926 }).join(", "); 7927 if (data.categories.length > 25) { 7928 data.categories = data.categories.substring(0, 25) + "..."; 7929 } 7930 // ---------------------------------------------- 7931 // -------- regionPlace ------------------------- 7932 data.regionPlace = ""; 7933 var location = ""; 7934 if (!!item.location) { 7935 location = item.location.name; 7936 } 7937 data.regionPlace = location; 7938 7939 // ---------------------------------------------- 7940 // -------- distance ---------------------------- 7941 data.distance = element.distance || 0; 7942 // ---------------------------------------------- 7943 // -------- openinghoursJson -------------------- 7944 data.openingHoursJson = ""; 7945 if (!(!item.openingHoursJson || item.openingHoursJson.length == 0)) { 7946 data.openingHoursJson = JSON.stringify(item.openingHoursJson); 7947 } 7948 // ---------------------------------------------- 7949 // -------- eventTime --------------------------- 7950 data.eventTime = ""; 7951 if (isEvent) { 7952 if (!!element.htmlFortmattedTime) { 7953 data.eventTime = element.htmlFortmattedTime; 7954 } else { 7955 if (!!element.formattedFrom) data.eventTime = element.formattedFrom; 7956 if (!!element.spansMultipleDays) data.eventTime += " - " + element.formattedTo; 7957 } 7958 } 7959 // ---------------------------------------------- 7960 return data; 7961} 7962function populateMissingData(elemWrapper, elemId, data, tabOrMosaic, preserveLoader) { 7963 if (data.length == 0) return; 7964 var slider = null; 7965 if (!!elemWrapper && !!elemId) { 7966 slider = $(elemWrapper + " " + elemId); 7967 } else if (elemWrapper instanceof jQuery) { 7968 slider = elemWrapper; 7969 } else if (!!elemWrapper) { 7970 slider = $(elemWrapper); 7971 } 7972 var currentSlide = -1; 7973 if (slider.hasClass("slick-initialized")) { 7974 currentSlide = slider.slick("slickCurrentSlide"); 7975 slider.slick("unslick"); 7976 } 7977 var template = _.template($("#related-items-template").html()); 7978 slider.html(""); 7979 for (var i in data) { 7980 var parameters = buildTemplateData(data[i], i); 7981 var html = template(parameters); 7982 slider.append(html); 7983 } 7984 var tabName = slider.data("ppcartoHover"); 7985 if (typeof window.ppcartoMedium != "undefined") { 7986 orderSlides($(elemWrapper).closest(".tabgallery-wrapper.related-offers"), window.ppcartoMedium.$refs.ppcm.featureGroups, tabName); 7987 } 7988 slider.addClass("all-loaded"); 7989 window.pixelpoint.initOpeningHoursText(); 7990 if (!!tabOrMosaic) reinitSlickSliderOnTabGallery(slider, null, currentSlide);else reinitSlickOnTabMosaic(slider, null, currentSlide); 7991 equalHeight(slider.find(".item"), true); 7992 window.pixelpoint.images.initializeErrors(slider); 7993 if (!preserveLoader) window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + `:related-pois-loader:hide`); 7994} 7995function reinitSlickSliderOnTabGallery(elemWrapper, elemId, currentSlide) { 7996 var slider = null; 7997 if (!!elemWrapper && !!elemId) { 7998 slider = $(elemWrapper + " " + elemId); 7999 } else if (elemWrapper instanceof jQuery) { 8000 slider = elemWrapper; 8001 } else if (!!elemWrapper) { 8002 slider = $(elemWrapper); 8003 } 8004 8005 /** 8006 * ZP change 26.03.2020: add class to parent before slick initialises 8007 */ 8008 slider.closest(".tabs-content").addClass("fixed-height"); 8009 if (slider.hasClass("slick-initialized")) { 8010 slider.slick("unslick"); 8011 } 8012 currentSlide = typeof currentSlide == "undefined" ? -1 : currentSlide; 8013 initSlickOnTabGallery(elemWrapper, elemId, currentSlide); 8014} 8015function initSlickOnTabMosaic(elemWrapper, elemId, currentSlide) { 8016 var slider = null; 8017 if (!!elemWrapper && !!elemId) { 8018 slider = $(elemWrapper + " " + elemId); 8019 } else if (elemWrapper instanceof jQuery) { 8020 slider = elemWrapper; 8021 } else if (!!elemWrapper) { 8022 slider = $(elemWrapper); 8023 } 8024 if (!!slider) {
8025 var centerMode = slider.find(".item").length > 3; 8026 var prevText = slider.data("prev-text"); 8027 var nextText = slider.data("next-text"); 8028 currentSlide = typeof currentSlide == "undefined" ? -1 : currentSlide; 8029 if (slider.find(".item").length <= 6) { 8030 slider.addClass("all-loaded"); 8031 } 8032 slider.not('.slick-initialized').slick({ 8033 slide: ".item", 8034 centerMode: centerMode, 8035 centerPadding: "35px", 8036 prevArrow: '<button class="prev" title=" ' + prevText + ' "><i aria-label=" ' + prevText + ' " class="icon-arrow-big-left"></i></button>', 8037 nextArrow: '<button class="next" title=" ' + nextText + ' "><i aria-label=" ' + nextText + ' " class="icon-arrow-big-right"></i></button>', 8038 slidesToShow: 3, 8039 slidesToScroll: 1, 8040 initialSlide: currentSlide > -1 ? currentSlide : 1, 8041 //autoplay: true, 8042 autoplaySpeed: 1800, 8043 cssEase: "ease-in-out", 8044 responsive: [{ 8045 breakpoint: 960, 8046 settings: { 8047 centerPadding: "30px", 8048 centerMode: false, 8049 slidesToShow: 2 8050 } 8051 }, { 8052 breakpoint: 640, 8053 settings: { 8054 centerPadding: "0px", 8055 slidesToShow: 1 8056 } 8057 }] 8058 }); 8059 slider.off("beforeChange").on("beforeChange", function (event, slick, currentSlide, nextSlide) { 8060 if (!slider.hasClass("all-loaded")) { 8061 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + `:related-pois-loader:show`); 8062 loadAllElements(elemWrapper, elemId).done(function (data) { 8063 populateMissingData(elemWrapper, elemId, data, false); 8064 }); 8065 } 8066 }); 8067 equalHeight(slider.find(".item"), true); 8068 } 8069} 8070function reinitSlickOnTabMosaic(elemWrapper, elemId, currentSlide) { 8071 var slider = null; 8072 if (!!elemWrapper && !!elemId) { 8073 slider = $(elemWrapper + " " + elemId); 8074 } else if (elemWrapper instanceof jQuery) { 8075 slider = elemWrapper; 8076 } else if (!!elemWrapper) { 8077 slider = $(elemWrapper); 8078 } 8079 if (slider.hasClass("slick-initialized")) { 8080 slider.slick("unslick"); 8081 } 8082 currentSlide = typeof currentSlide == "undefined" ? -1 : currentSlide; 8083 initSlickOnTabMosaic(elemWrapper, elemId, currentSlide); 8084} 8085function resetSliderOnClick($thisClickedElem, elemtype, id, elemWrapper, elemContent) { 8086 $(elemWrapper + " " + id).css("opacity", 0); 8087 $(id).parent().find(elemContent).each(function () { 8088 if ($thisClickedElem.hasClass("slick-initialized")) { 8089 $thisClickedElem.slick("unslick"); 8090 } 8091 }); 8092 setTimeout(function () { 8093 if ($(elemWrapper + " " + id).hasClass("slick-initialized")) { 8094 $(elemWrapper + " " + id).slick("unslick"); 8095 } 8096 8097 /** 8098 * ZP change 26.03.2020: add class to parent before slick initialises 8099 */ 8100 8101 if (elemtype == "tabgallery") { 8102 $(elemWrapper + " " + id).closest(".tabs-content").addClass("fixed-height"); 8103 initSlickOnTabGallery(elemWrapper, id); 8104 } else if (elemtype == "tabmosaic") { 8105 initSlickOnTabMosaic(elemWrapper, id); 8106 } else {} 8107 $(elemWrapper + " " + id).css("opacity", 1); 8108 }, 300); 8109} 8110function titleClickEvent($thisClickedElem) { 8111 if ($("#ppcarto-medium").length > 0) { 8112 ppcartoTabGalleryChange($thisClickedElem); 8113 } 8114 if ($thisClickedElem.data("ppcarto-switch") == "event" || $thisClickedElem.parent().data("ppcarto-switch") == "event") { 8115 $(".dce-map-related-offers .event-more-button").first().removeClass("hide"); 8116 } else { 8117 $(".dce-map-related-offers .event-more-button").first().addClass("hide"); 8118 } 8119 var id = ""; 8120 if ($thisClickedElem.is("a")) { 8121 id = $thisClickedElem.attr("href"); 8122 } else { 8123 id = $thisClickedElem.children("a:first").attr("href"); 8124 } 8125 var idSplit = id.split("-"); 8126 var wrapperId = "#c" + idSplit[1]; 8127 var elemtypeClick, elemWrapperClick; 8128 var elemContentClick = ".tabs-panel"; 8129 $(wrapperId + " .more-wrapper").each(function () { 8130 var exposed = $(this).data("show-more"); 8131 if (!!exposed && !!exposed.close) exposed.close(); 8132 }); 8133 setTimeout(function () { 8134 window.ppComponents.common.showMore($(id + " .more-wrapper")); 8135 }, 500); 8136 if ($(".tabgallery-wrapper " + id).length > 0) { 8137 elemtypeClick = "tabgallery"; 8138 elemWrapperClick = wrapperId + ".tabgallery-wrapper .tabgallery"; 8139 if ($thisClickedElem.hasClass("accordion-title")) { 8140 elemWrapperClick = wrapperId + " " + ".tabMobileAccordion"; 8141 elemContentClick = ".accordion-item"; 8142 } 8143 resetSliderOnClick($thisClickedElem, elemtypeClick, id, elemWrapperClick, elemContentClick); 8144 } else if ($(".tabmosaic-wrapper " + id).length > 0) { 8145 elemtypeClick = "tabmosaic"; 8146 elemWrapperClick = wrapperId + ".tabmosaic-wrapper .tabmosaic"; 8147 if ($thisClickedElem.hasClass("accordion-title")) { 8148 elemWrapperClick = wrapperId + " " + ".tabMobileAccordion"; 8149 elemContentClick = ".accordion-item"; 8150 } 8151 if ($(wrapperId).hasClass("mobile-mosaic-to-slick-slider")) { 8152 if (Foundation.MediaQuery.current == "small") { 8153 id = id + " .mosaic-slick-slider"; 8154 resetSliderOnClick($thisClickedElem, elemtypeClick, id, elemWrapperClick, elemContentClick); 8155 } else if ($(wrapperId).hasClass("medium-mosaic-to-slider") && Foundation.MediaQuery.current == "medium") { 8156 id = id + " .mosaic-slick-slider"; 8157 resetSliderOnClick($thisClickedElem, elemtypeClick, id, elemWrapperClick, elemContentClick); 8158 } else {} 8159 } 8160 window.pixelpoint.lazy.init($(".tabmosaic-wrapper " + id).find(".lazy")); 8161 window.pixelpoint.lazy.initInterchange($(".tabmosaic-wrapper " + id).find("[data-lazy-interchange]")); 8162 } else {} 8163} 8164function getEventId(url) { 8165 return fetch(url).then(response => { 8166 if (!response.ok) { 8167 throw new Error(`HTTP error! status: ${response.status}`); 8168 } 8169 return response.json(); // Parse the JSON from the response 8170 }).catch(error => { 8171 console.error('Error loading JSON:', error); 8172 throw error; 8173 }); 8174} 8175function ppcartoTabGalleryInit(elemWrapper, elemContent) { 8176 $(elemWrapper + " " + elemContent + "[data-ppcarto-hover]").on("click", ".item", function (e) { 8177 var hoveredItem = $(e.target); 8178 var layer = hoveredItem.closest("[data-ppcarto-hover]").data("ppcarto-hover"); 8179 if (!!layer) { 8180 var itemId = hoveredItem.closest(".item").data("poi-id"); 8181 if (!!itemId) { 8182 if (!!ppcartoMedium && !!ppcartoMedium.$refs && !!ppcartoMedium.$refs.ppcm) { 8183 if (layer == "default") layer = "angebote"; 8184 ppcartoMedium.$refs.ppcm.focusItem(layer, itemId); 8185 } 8186 } 8187 } 8188 }); 8189 var popupTileTimeout = null; 8190 var moveToElement = function (data) { 8191 if (!data) return; 8192 var layer = data.layer; 8193 var id = data.id; 8194 if (!layer || !id) { 8195 return; 8196 }
8197 var tab = $(`[data-ppcarto-switch='${layer}']`); 8198 if (tab.length == 0) return; 8199 if (!tab.hasClass("is-active")) { 8200 tab.click(); 8201 } 8202 if (!!popupTileTimeout) clearTimeout(popupTileTimeout); 8203 popupTileTimeout = setTimeout(function () { 8204 var tabContent = $(`[data-ppcarto-hover="${layer}"]`); 8205 if (tabContent.length > 0) { 8206 var gotoSlide = function () { 8207 if (tabContent.hasClass("slick-initialized")) { 8208 var slide = tabContent.find(`[data-poi-id='${id}']`); 8209 if (slide.length > 0) { 8210 var slideId = slide.data("element-index"); 8211 slide.index($(".mySlick").slick.$slides); 8212 tabContent.slick("slickGoTo", slideId); 8213 setTimeout(() => { 8214 slide.addClass("map-hover"); 8215 }, 100); 8216 } 8217 } 8218 }; 8219 if (!tabContent.hasClass("all-loaded")) { 8220 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.loader + `:related-pois-loader:show`); 8221 loadAllElements(tabContent).done(function (data) { 8222 var isTabGallery = tabContent.closest(".tabgallery-wrapper").length > 0; 8223 populateMissingData(tabContent, null, data, isTabGallery); 8224 gotoSlide(); 8225 }); 8226 } else { 8227 gotoSlide(); 8228 } 8229 } 8230 popupTileTimeout = null; 8231 }, 300); 8232 }; 8233 if (!!window.ppcartoMedium && !!window.ppcartoMedium.$refs && !!window.ppcartoMedium.$refs.ppcm) { 8234 window.ppcartoMedium.$refs.ppcm.$on("highlightover", function (data) { 8235 moveToElement(data); 8236 }); 8237 window.ppcartoMedium.$refs.ppcm.$on("highlightout", function (data) { 8238 $(".item.map-hover").removeClass("map-hover"); 8239 }); 8240 let activeTab = $(".tabgallery-wrapper li.tabs-title.is-active"); 8241 if (activeTab.length > 0) { 8242 var ppcartoSwitch = activeTab.data("ppcarto-switch"); 8243 window.ppcartoMedium.$refs.ppcm.activeLayer = ppcartoSwitch; 8244 } 8245 } 8246} 8247function ppcartoTabGalleryChange($this) { 8248 //we change the map 8249 var ppcartoSwitch = $this.data("ppcarto-switch"); 8250 if ($this.is("a")) { 8251 ppcartoSwitch = $this.parent().data("ppcarto-switch"); 8252 } 8253 if (!!ppcartoSwitch) { 8254 if (typeof ppcartoMedium != "undefined" && !!ppcartoMedium.$refs && !!ppcartoMedium.$refs.ppcm) { 8255 ppcartoMedium.$refs.ppcm.switchLayer(ppcartoSwitch); 8256 var tabContent = $(`[data-ppcarto-hover="event"]`); 8257 if (tabContent.length > 0) { 8258 tabContent.each(function () { 8259 $(this).find('[data-poi-id]').each(function () { 8260 var eventDateId = $(this).data('poi-id'); 8261 var eventDateJson = `${window.pixelpoint.settings.apiUrl}eventdate/${eventDateId}`; 8262 getEventId(eventDateJson).then(data => { 8263 $(this).attr('data-poi-id', data.event_date.event_id); 8264 }).catch(error => { 8265 console.error('Error in fetching JSON:', error); 8266 }); 8267 }); 8268 }); 8269 } 8270 } 8271 } 8272} 8273//include 6 8274jQuery(function () { 8275 /* 8276 $('button.star').click(function(e){ 8277 $(this).children('i').toggleClass('icon-star-full'); 8278 }); 8279 */ 8280}); 8281//include 7 8282 8283// this has been taken from pixel3/typo3_base, it might be better to include it globally outside the scope of this crappy build suite 8284(function (w) { 8285 w.pixel3A11y = {}; 8286 w.pixel3A11y.focusableElements = ['[tabindex]', '[contenteditable=""]', '[contenteditable="true"]', 'a[href]', 'area[href]', 'audio', 'button', 'embed', 'form', 'iframe', 'input:not([type="hidden"])', 'label', 'link', 'object', 'select', 'summary', 'textarea', 'video'].join(','); 8287 w.pixel3A11y.toggleTabIndex = function (dis, en = []) { 8288 dis.forEach(e => { 8289 const els = Array.from(e.querySelectorAll(w.pixel3A11y.focusableElements)); 8290 if (e.matches(w.pixel3A11y.focusableElements)) { 8291 els.push(e); 8292 } 8293 els.forEach(el => { 8294 if (!el.hasAttribute('data-internal-tab-index')) { 8295 el.setAttribute('data-internal-tab-index', el.tabIndex); 8296 } 8297 el.tabIndex = '-1'; 8298 }); 8299 }); 8300 en.forEach(e => { 8301 const els = Array.from(e.querySelectorAll('[data-internal-tab-index]')); 8302 if (e.hasAttribute('data-internal-tab-index')) { 8303 els.push(e); 8304 }
8305 els.forEach(el => { 8306 el.tabIndex = el.getAttribute('data-internal-tab-index'); 8307 }); 8308 }); 8309 }; 8310})(window); 8311jQuery(function () { 8312 // use an observer to automatically toggle the tabindex whenever the aria-expanded attribute on a main-level link changes 8313 const tabIndexObserver = new MutationObserver(function (mutations) { 8314 const disable = []; 8315 const enable = []; 8316 mutations.forEach(mutation => { 8317 if (mutation.target.getAttribute('aria-expanded') === 'false') { 8318 disable.push(mutation.target.parentElement.querySelector('.supermenu')); 8319 } else { 8320 enable.push(mutation.target.parentElement.querySelector('.supermenu')); 8321 } 8322 }); 8323 window.pixel3A11y.toggleTabIndex(disable, enable); 8324 }); 8325 const mainLevelLinks = Array.from(document.querySelectorAll('.main-nav .menu-level-1 > a[aria-expanded]')); 8326 const mainLevelLinksWithSupermenu = mainLevelLinks.filter(link => { 8327 return link.closest('.menu-level-1').querySelector('.supermenu') !== null; 8328 }); 8329 mainLevelLinksWithSupermenu.forEach(mainLevelLink => { 8330 tabIndexObserver.observe(mainLevelLink, { 8331 attributes: true, 8332 attributeFilter: ['aria-expanded'] 8333 }); 8334 }); 8335 // invoke tabindex toggle once statically to assure a correct initial dom state 8336 window.pixel3A11y.toggleTabIndex(mainLevelLinksWithSupermenu.map(link => link.parentElement.querySelector('.supermenu'))); 8337 var clickEventType = document.ontouchstart !== null ? 'click' : 'touchstart'; 8338 $("#offCanvas .mobile-nav").on(clickEventType, ".menu-level-1 > i, .menu-level-1 > a", function (e) { 8339 var $this = $(this).closest(".menu-level-1"); 8340 var secondClick = $this.hasClass('active'); 8341 if ($(e.target) == $this.closest(".menu-level-1").find("> i") || $(e.target) == $this.closest(".menu-level-1").find("> a")) { 8342 alert("here 2"); 8343 } 8344 $this.find('> a').click(function (e) { 8345 e.preventDefault(); 8346 }); 8347 var target = $(e.target); 8348 if (!secondClick) { 8349 // remove active class from each other li's 8350 if ($('#offCanvas .mobile-nav .menu-level-1.active').length > 0) { 8351 $('#offCanvas .mobile-nav .menu-level-1').each(function () { 8352 if ($(this).hasClass('active')) { 8353 $(this).removeClass('active'); 8354 } 8355 }); 8356 } 8357 // END 8358 8359 $this.toggleClass('active'); 8360 8361 /* 8362 setTimeout(function(){ 8363 //var scrollTo = $("#offCanvas.is-open").offset().top - $("#offCanvas .mobile-nav .menu-level-1.active").offset().top; 8364 //var scrollTo = $("#offCanvas .mobile-nav .menu-level-1.active").offset().top - $("#offCanvas.is-open").height(); 8365 var scrollTo = $("#offCanvas.is-open").offset().top - $("#offCanvas .mobile-nav .menu-level-1.active").offset().top; 8366 console.log("OffCanvas Height " + $("#offCanvas.is-open").height()); 8367 console.log("OffCanvas Offset Top " + $("#offCanvas.is-open").offset().top); 8368 console.log("Menu Item Height " + $("#offCanvas .mobile-nav .menu-level-1.active").height()); 8369 console.log("Menu Item Offset Top " + $("#offCanvas .mobile-nav .menu-level-1.active").offset().top); 8370 console.log("ScrollTo " + scrollTo); 8371 console.log("-----"); 8372 $("#offCanvas.is-open").animate({scrollTop: scrollTo}, 800); 8373 }, 500); 8374 */ 8375 } else { 8376 // trigger link on secondClick 8377 if (target.closest('a').length) { 8378 var href = e.target.href; 8379 var linkTarget = e.target.target; 8380 if (linkTarget == "_blank") { 8381 window.open(href, linkTarget); 8382 } else { 8383 window.location = href; 8384 } 8385 } 8386 if (target.closest('i.icon-right-open-big').length) { 8387 $this.removeClass('active'); 8388 } 8389 // END 8390 } 8391 }); 8392 setMenuClickEvent(); 8393 menuListingHeight(); 8394 $(window).on("orientationchange resize", function () { 8395 setMenuClickEvent(); 8396 menuListingHeight(); 8397 }); 8398 $('.supermenu > .close').click(function (e) { 8399 var supermenu = $(this).parents('.supermenu:first'); 8400 // supermenu.addClass('collapsed'); // hide 8401 $('.menu-level-1').removeClass('hover'); 8402 $('.menu-level-1').removeClass('open-menu'); 8403 $('.menu-level-1 > a').attr("aria-expanded", 'false'); 8404 supermenu.removeClass('hover'); // hide 8405 //supermenu.css('display','none'); // remove class for regular use 8406 supermenu.removeAttr("style"); 8407 8408 /* 8409 setTimeout(function(){ 8410 // supermenu.removeClass('collapsed'); // remove class for regular use 8411 supermenu.css('display','block'); // remove class for regular use 8412 }, 400); 8413 */ 8414 }); 8415}); 8416$(document).ready(function () { 8417 headerOptions(); 8418 $(".supersection").on("mouseover touchstart", function () { 8419 var $supersectionUl = $(this).parent(); 8420 $supersectionUl.find(".supersection").removeClass("hover"); 8421 $supersectionUl.find(".supersection > a[aria-expanded]").attr("aria-expanded", "false"); 8422 $(this).addClass("hover"); 8423 $(this).find("[aria-expanded='false']").attr("aria-expanded", "true"); 8424 8425 // @todo this might be removed, i cant find any place where .lazymenu is used 8426 $(this).find('.lazymenus').Lazy({ 8427 bind: "event", 8428 delay: 0, 8429 onError: function (element) { 8430 element.trigger("error"); 8431 }, 8432 afterLoad: function (element) { 8433 if (element.parent().hasClass("center-cropped")) { 8434 var imageSrc = element.attr('src'); 8435 element.parent().css("background-image", `url(${imageSrc})`); 8436 } 8437 } 8438 }); 8439 }); 8440 $(".supersection > a[aria-expanded]").on('keydown', function (e) { 8441 if (e.key !== "Enter") { 8442 // not our concern 8443 return; 8444 } 8445 if (this.getAttribute('aria-expanded') === 'true') { 8446 // already opened: default behaviour - follow link 8447 return; 8448 } 8449 // custom behaviour - open next level 8450 e.preventDefault(); 8451 $(this).closest('.supersection').trigger('mouseover'); 8452 }); 8453 $(".supersection a").on("touchstart", function (e) { 8454 e.preventDefault(); 8455 var supersection = $(e.target).closest(".supersection"); 8456 var childContainer = supersection.find(">div.container"); 8457 if (supersection.hasClass("hover") || childContainer.length == 0) { 8458 var a = $(e.target).closest("a"); 8459 var href = a.attr("href"); 8460 if (!!href && href.charAt(0) != "/") href = "/" + href; 8461 if (!!href) window.location.href = href; 8462 } 8463 }); 8464 8465 // @todo this is not okay, the correct should be generated in the backend 8466 $(document).on('click', '.region-map svg g path', function (e) { 8467 if (!!$(this).parent().attr("class") && $(this).parent().attr("class").split(" ")[2] == "region") { 8468 var pageid = $(this).parent().attr("class").split(" ")[0]; 8469 if (!!$(this).closest(".content").find("[data-page-uid='" + pageid + "']")) { 8470 var pagelink = $(this).closest(".content").find("[data-page-uid='" + pageid + "']").attr('href'); 8471 if (pagelink != "undefined" && pagelink != '' && typeof pagelink != 'undefined') { 8472 if (pagelink.charAt(0) != '/') { 8473 pagelink = "/" + pagelink; 8474 } 8475 var newLink = window.location.protocol + "//" + window.location.host; 8476 newLink = newLink + pagelink.replace(newLink, ""); 8477 window.location.replace(newLink); 8478 } else { 8479 window.location.href = "/index.php?id=" + pageid; 8480 } 8481 } else { 8482 window.location.href = "/index.php?id=" + pageid; 8483 } 8484 } 8485 }); 8486 $(document).on('mouseenter', '.region-map svg g path', function (e) { 8487 if (!!$(this).parent().attr("class") && $(this).parent().attr("class").split(" ")[2] == "region") { 8488 $(".regionlisting li ." + $(this).parent().attr("class").split(" ")[0]).css('color', '#7ACDF3'); 8489 var newTitle = $(".regionlisting li ." + $(this).parent().attr("class").split(" ")[0]).attr("title"); 8490 var regionMap = $(this).closest("figure.region-map"); 8491 regionMap.data("old-title", regionMap.attr("title")).attr("title", newTitle); 8492 } 8493 }); 8494 $(document).on('mouseleave', '.region-map svg g path', function (e) { 8495 if (!!$(this).parent().attr("class") && $(this).parent().attr("class").split(" ")[2] == "region") { 8496 $(".regionlisting li ." + $(this).parent().attr("class").split(" ")[0]).css('color', 'inherit'); 8497 //var regionMap = $(this).closest("figure.region-map"); 8498 //regionMap.attr("title", regionMap.data("old-title")); 8499 } 8500 }); 8501 $(".regionlisting li a").mouseenter(function (e) { 8502 $("svg ." + $(this).attr("class") + " path").addClass('svghover'); 8503 }); 8504 $(".regionlisting li a").mouseleave(function (e) { 8505 $("svg ." + $(this).attr("class") + " path").removeClass('svghover'); 8506 }); 8507 $(".ortelisting li a").mouseenter(function (e) { 8508 $("svg ." + $(this).attr("class")).show(); 8509 }); 8510 $(".ortelisting li a").mouseleave(function (e) { 8511 $("svg ." + $(this).attr("class")).hide(); 8512 }); 8513}); 8514function headerOptions() { 8515 $(".header-wrapper .header").css("position", "fixed"); 8516 var $headerRow = $(".header-wrapper .header .header-row"); 8517 $(".header-wrapper").css("padding-bottom", $(".header-wrapper .header").height()); 8518 if ($headerRow.hasClass("layout-2")) { 8519 $(".header-wrapper").css("padding-bottom", $(".header-wrapper .header").height() - 1); 8520 var iScrollPos = 0; 8521 var scrolled = false;
8522 $(window).scroll(function () { 8523 scrolled = true; 8524 }); 8525 setInterval(function () { 8526 if (scrolled) { 8527 scrolled = false; 8528 if (Foundation.MediaQuery.current != "large") { 8529 var headerRowHeight = $headerRow.height(); 8530 var iCurScrollPos = $(this).scrollTop(); 8531 if (iCurScrollPos > iScrollPos) { 8532 // scroll down 8533 if (iCurScrollPos > headerRowHeight) { 8534 $headerRow.addClass("scrolling"); 8535 } 8536 } else { 8537 // scroll up 8538 if (iCurScrollPos < headerRowHeight) { 8539 $headerRow.removeClass("scrolling"); 8540 $(".header-wrapper").css("padding-bottom", $(".header-wrapper .header").height() - 1); 8541 } 8542 } 8543 iScrollPos = iCurScrollPos; 8544 } else { 8545 $headerRow.removeClass("scrolling"); 8546 } 8547 } 8548 }, 100); 8549 } 8550 $(window).on("orientationchange resize", function () { 8551 if ($headerRow.hasClass("layout-2")) { 8552 $(".header-wrapper").css("padding-bottom", $(".header-wrapper .header").height() - 1); 8553 } else { 8554 $(".header-wrapper").css("padding-bottom", $(".header-wrapper .header").height()); 8555 } 8556 }); 8557} 8558function setMenuClickEvent() { 8559 if (!$(".header button.control.hamburger").is(":visible")) { 8560 var windowHeight = $(window).height(); 8561 var navHeight = $(".header-wrapper > .header").height(); 8562 var supermenuHeight = windowHeight - navHeight; 8563 $('.main-nav .menu-level-1 > a').off("click touchstart").on("click touchstart", function (e) { 8564 if ($(this).parent().find(".supermenu").length > 0) { 8565 e.preventDefault(); 8566 var menuClicked = $('.main-nav').data("menu-clicked") || false; 8567 if (!menuClicked) { 8568 var getMenuSvgPath = function (name) { 8569 return getComputedStyle(document.documentElement).getPropertyValue("--svg-" + name).trim().replace(/^["']|["']$/g, ""); 8570 }; 8571 $.get(getMenuSvgPath("ausflugsregionen"), function (data) { 8572 $("#ausflugsregionen").html(new XMLSerializer().serializeToString(data.documentElement)); 8573 }); 8574 $.get(getMenuSvgPath("urlaubsregionen"), function (data) { 8575 $("#urlaubsregionen").html(new XMLSerializer().serializeToString(data.documentElement)); 8576 }); 8577 $.get(getMenuSvgPath("toporte"), function (data) { 8578 $("#toporte").html(new XMLSerializer().serializeToString(data.documentElement)); 8579 }); 8580 $.get(getMenuSvgPath("wasserreviere"), function (data) { 8581 $("#wasserreviere").html(new XMLSerializer().serializeToString(data.documentElement)); 8582 }); 8583 $.get(getMenuSvgPath("nationalenaturlandschaften"), function (data) { 8584 $("#nationalenaturlandschaften").html(new XMLSerializer().serializeToString(data.documentElement)); 8585 }); 8586 $('.main-nav').data("menu-clicked", true); 8587 } 8588 var $thisLinkItem = $(this); 8589 var $thisListItem = $(this).parent(); 8590 $('.main-nav .menu-level-1 > a[aria-expanded]').attr("aria-expanded", "false"); 8591 $thisLinkItem.attr("aria-expanded", "true"); 8592 if ($thisListItem.hasClass("open-menu")) { 8593 var link = $(this); 8594 var target = link.attr("target"); 8595 var href = $thisLinkItem.attr("href"); 8596 if (!!href && href.charAt(0) != "/") href = "/" + href; 8597 if ($.trim(target).length > 0) { 8598 window.open(href, target); 8599 } else { 8600 window.location = href; //$thisLinkItem.attr("href"); 8601 } 8602 } else { 8603 $('.main-nav .menu-level-1').removeClass("open-menu hover"); 8604 $('.main-nav .menu-level-1 .supermenu').removeClass("hover"); 8605 $('.main-nav .menu-level-1 .supermenu').css("min-height", "0"); 8606 $('.main-nav .menu-level-1 .supermenu .supersection').removeClass("hover"); 8607 $('.main-nav .menu-level-1 .supermenu .supersection > a[aria-expanded]').attr("aria-expanded", "false"); 8608 $thisListItem.addClass("open-menu hover"); 8609 $thisListItem.find(".supermenu").addClass("hover");
8610 if ($thisListItem.hasClass("only-thumbnails-menu")) { 8611 // @todo this might be removed, not mention of lazymenu in sourcecode 8612 $thisListItem.find('.lazymenus').Lazy({ 8613 bind: "event", 8614 delay: 0, 8615 onError: function (element) { 8616 element.trigger("error"); 8617 }, 8618 afterLoad: function (element) { 8619 if (element.parent().hasClass("center-cropped")) { 8620 var imageSrc = element.attr('src'); 8621 element.parent().css("background-image", `url(${imageSrc})`); 8622 } 8623 } 8624 }); 8625 } else { 8626 var $menuSuperRowUl = $thisListItem.find('.supermenu > .super-row > ul'); 8627 var tallestSuperRowUl = 0; 8628 $menuSuperRowUl.each(function () { 8629 var thisHeight = $(this).outerHeight(true); 8630 if (thisHeight > tallestSuperRowUl) { 8631 tallestSuperRowUl = thisHeight; 8632 } 8633 }); 8634 var $menuElem = $thisListItem.find('.supermenu > .super-row > ul > li.supersection > .container .content'); 8635 var tallestSupersectionContent = 0; 8636 $menuElem.each(function () { 8637 var thisHeight = $(this).outerHeight(true); 8638 if (thisHeight > tallestSupersectionContent) { 8639 tallestSupersectionContent = thisHeight; 8640 } 8641 }); 8642 var supermenuPadding = $thisListItem.find(".supermenu").outerHeight(true) - $thisListItem.find(".supermenu").height(); 8643 var listItemSupermenuMinHeight = ""; 8644 if (supermenuHeight < supermenuPadding + tallestSupersectionContent) { 8645 if (supermenuHeight > tallestSuperRowUl) { 8646 listItemSupermenuMinHeight = supermenuHeight; 8647 } else { 8648 listItemSupermenuMinHeight = tallestSuperRowUl; 8649 } 8650 } else { 8651 if (supermenuPadding + tallestSupersectionContent > supermenuPadding + tallestSuperRowUl) { 8652 listItemSupermenuMinHeight = supermenuPadding + tallestSupersectionContent; 8653 } else { 8654 listItemSupermenuMinHeight = supermenuPadding + tallestSuperRowUl; 8655 } 8656 } 8657 listItemSupermenuMinHeight = listItemSupermenuMinHeight + 30; // 30 = padding-top 8658 $thisListItem.find(".supermenu").css("min-height", listItemSupermenuMinHeight + "px"); 8659 $thisListItem.find(".supermenu .supersection").first().addClass("hover"); 8660 var $parentMenuElem = $thisListItem.find('.supermenu > .super-row > ul'); 8661 var parentMenuElemHeight = $parentMenuElem.height(); 8662 $parentMenuElem.find('li.supersection > .container .content > ul').css("min-height", parentMenuElemHeight); 8663 } 8664 } 8665 } 8666 // @todo this might be removed, no mention of lazymenu in source code 8667 $('.supermenu .supersection.hover .lazymenus').Lazy({ 8668 bind: "event", 8669 delay: 0, 8670 onError: function (element) { 8671 element.trigger("error"); 8672 }, 8673 afterLoad: function (element) { 8674 if (element.parent().hasClass("center-cropped")) { 8675 var imageSrc = element.attr('src'); 8676 element.parent().css("background-image", `url(${imageSrc})`); 8677 } 8678 } 8679 }); 8680 }); 8681 8682 // close supermenus when the user clicked outside the menu or esc is pressed with opened menu 8683 $(document).on('closemainmenu', function () { 8684 $('.supermenu.hover > .close').click(); 8685 }); 8686 if (!$(document).data("menu-close-click-initialised")) { 8687 $(document).on('click', function (e) { 8688 if (!e.target.matches('.main-nav .menu-level-1 > a[aria-expanded]') && !e.target.closest('.supermenu')) { 8689 $(document).trigger("closemainmenu"); 8690 } 8691 }); 8692 $(document).on('keydown', function (e) { 8693 if (e.key === "Escape") { 8694 $(document).trigger("closemainmenu"); 8695 } 8696 }); 8697 $(document).data('menu-close-click-initialised', true); 8698 } 8699 } else { 8700 $('.main-nav .menu-level-1').removeClass("open-menu hover"); 8701 $('.main-nav .menu-level-1 .supermenu').removeClass("hover"); 8702 $('.main-nav .menu-level-1 .supermenu').css("min-height", "0"); 8703 $('.main-nav .menu-level-1 .supermenu .supersection').removeClass("hover"); 8704 $('.main-nav .menu-level-1 .supermenu .supersection > a[aria-expanded]').attr("aria-expanded", "false"); 8705 } 8706} 8707function menuListingHeight() { 8708 $('.main-nav > ul > li.menu-level-1 > .supermenu > .super-row > ul > li.supersection > .container .content .columns.large-4.listing').height('auto'); 8709} 8710//include 10 8711jQuery(function () { 8712 window.ppComponents = window.ppComponents || {}; 8713 window.ppComponents.select2 = window.ppComponents.select2 || {}; 8714 window.ppComponents.select2.initialize = function (elements) { 8715 elements.each(function () { 8716 var placeholdertext = $(this).attr('placeholder') || $(this).data('placeholder'); 8717 var cssClass = $(this).data('dropdown-css-class') || "";
8718 var containerCssClass = $(this).data("container-css-class") || ""; 8719 var allowClear = $(this).data('allow-clear') || false; 8720 var closeOnSelect = $(this).data('close-select') == 'disabled' ? false : true; 8721 if (!placeholdertext) { 8722 var emptyOption = $(this).find("option[value='']"); 8723 if (emptyOption.length > 0) { 8724 placeholdertext = emptyOption.text(); 8725 } else { 8726 placeholdertext = " "; 8727 } 8728 } 8729 var placeholder = { 8730 id: "", 8731 text: placeholdertext 8732 }; 8733 $(this).select2({ 8734 placeholder: placeholder, 8735 closeOnSelect: closeOnSelect, 8736 minimumResultsForSearch: Infinity, 8737 // preventing the searchbox 8738 dropdownCssClass: cssClass, 8739 containerCssClass: containerCssClass 8740 }); 8741 var $this = $(this); 8742 if (!!cssClass) { 8743 $(this).off("select2:open").on("select2:open", function () { 8744 $this.data('select2').$dropdown.addClass(cssClass); 8745 $this.data('select2').$dropdown.addClass(containerCssClass); 8746 }); 8747 $(this).off("select2:closing").on("select2:closing", function () { 8748 $this.data('select2').$dropdown.removeClass(cssClass); 8749 $this.data('select2').$dropdown.removeClass(containerCssClass); // was a misunderstanding but I do not want to remove it yet 8750 }); 8751 } 8752 8753 // not used? 8754 /*var enableResizableText = $this.is("[data-resizable-text]"); 8755 $this.off("select2:select").on("select2:select", function (e) { 8756 if (enableResizableText) { 8757 var selectionWrapper = $this.parent().find(".selection"); 8758 var rendered = selectionWrapper.find(".select2-selection__rendered"); 8759 rendered.css("font-size", ""); 8760 var parentWidth = selectionWrapper.width(), 8761 parentHeight = selectionWrapper.height(), 8762 width = rendered.width(), 8763 height = rendered.height(); 8764 var computedStyle = window.getComputedStyle($this[0]); 8765 var fontsize = computedStyle.getPropertyValue('font-size'); 8766 fontsize = parseFloat(fontsize); 8767 while (width > (parentWidth - 25) || height > parentHeight) { 8768 fontsize *= 0.95; 8769 rendered.css("font-size", fontsize + "px"); 8770 width = rendered.width(); 8771 height = rendered.height(); 8772 } 8773 } 8774 });*/ 8775 }); 8776 }; 8777 window.ppComponents.select2.initialize($('.select2')); 8778 if (!window.pixelpoint.isMobile.any()) { 8779 $('body').on("select2:open", ".month-select.hoversupport", function (e) { 8780 $(this).parents('.menu-level-1,.supersection').removeClass('hover').addClass('hover'); 8781 }); 8782 $('body').on("select2:close", ".month-select.hoversupport", function (e) { 8783 var that = $(this); 8784 setTimeout(function (e) { 8785 $(that).parents('.menu-level-1,.supersection').removeClass('hover'); 8786 }, 100); 8787 }); 8788 } 8789 $(window).on("orientationchange", function () { 8790 $(".month-select.select2-hidden-accessible").each(function () { 8791 var self = $(this); 8792 self.select2("destroy"); 8793 setTimeout(function () { 8794 window.ppComponents.select2months.initialize(self); 8795 }, 50); 8796 }); 8797 }); 8798}); 8799jQuery(function () { 8800 var delayRequest = 500; 8801 window.ppComponents.autocomplete = { 8802 initialize(elements) { 8803 elements.each(function () { 8804 var $this = $(this); 8805 var suggestionEndpoint = $this.data("endpoint"); 8806 if (!suggestionEndpoint) return; 8807 var useEmptyTemplate = !$this.is("[data-no-empty-template]"); 8808 var noResultsTranslation = window.ppt.translate('autocomplete.noresults', 'Kein Suchergebnis'); 8809 var emptyTemplate = `<div class="empty-message"> 8810 ${noResultsTranslation} 8811 </div>`; 8812 if (!useEmptyTemplate) emptyTemplate = ''; 8813 var autosubmit = $this.is("[data-autosubmit]"); 8814 var engine = new Bloodhound({ 8815 queryTokenizer: Bloodhound.tokenizers.whitespace, 8816 datumTokenizer: Bloodhound.tokenizers.whitespace, 8817 remote: { 8818 url: suggestionEndpoint, 8819 cache: false, 8820 wildcard: '%Q%' 8821 } 8822 }); 8823 $this.data("bloodhoundEngine", engine); 8824 $this.typeahead(null, { 8825 name: 'Suchen', 8826 display: 'word', 8827 source: engine, 8828 templates: { 8829 empty: emptyTemplate, 8830 suggestion: function (data) { 8831 if (!data || data.length == 0) { 8832 return emptyTemplate; 8833 } 8834 var word = data.word; 8835 var searchQuery = $this.val(); 8836 word = word.replace(new RegExp(searchQuery, 'gi'), `<strong>$&</strong>`); 8837 return `<div>${word} <i>(${data.count})</i></div>`; 8838 } 8839 } 8840 }); 8841 8842 //**********a hack****** 8843 $(".twitter-typeahead input").each(function () { 8844 var placeholder = $(this).data("placeholder") || ""; 8845 if (!!placeholder) { 8846 $(this).attr("aria-label", placeholder); 8847 } 8848 }); 8849 //********************** 8850 8851 if (!!autosubmit) { 8852 $this.bind('typeahead:select', function (ev, suggestion) { 8853 $this.closest("form").submit(); 8854 }); 8855 } 8856 }); 8857 } 8858 }; 8859 window.ppComponents.autocomplete.initialize($("input[data-autocomplete]")); 8860}); 8861//include 10 8862jQuery(function () { 8863 window.pixelpoint.ppComponents.orderBy = function ($this) { 8864 $this.find('.order-element').each(function () { 8865 const orderValue = $(this).data('order-value'); 8866 const states = { 8867 asc: { 8868 direction: 'ASC', 8869 title: $(this).data('title-asc'),
8870 next: 'desc' 8871 }, 8872 desc: { 8873 direction: 'DESC', 8874 title: $(this).data('title-desc'), 8875 next: 'neutral' 8876 }, 8877 neutral: { 8878 direction: '', 8879 title: $(this).attr('title'), 8880 next: 'asc' 8881 } 8882 }; 8883 const toStateObject = state => { 8884 if (!state) { 8885 return states.asc; 8886 } 8887 if (typeof state === 'string' || state instanceof String) { 8888 var stateKey = state.toLowerCase(); 8889 return !!states[stateKey] ? states[stateKey] : states.asc; 8890 } else { 8891 if (typeof state === 'object' && !Array.isArray(state) && state !== null && state.hasOwnProperty('direction')) { 8892 return state; 8893 } else { 8894 return states.asc; 8895 } 8896 } 8897 }; 8898 $(this).on('click', function () { 8899 const orderDirection = toStateObject($(this).data('order-direction')); 8900 const nextOrderDirection = states[orderDirection.next || 'desc']; 8901 $this.find('.filters_order').val(orderValue); 8902 $this.find('.filters_order_direction').val(orderDirection); 8903 $this.find('.filters_order').val(orderValue); 8904 $this.find('.filters_order_direction').val(orderDirection.direction); 8905 $this.find('.order-element').removeClass('active'); 8906 $(this).data('order-direction', nextOrderDirection); 8907 $(this).removeClass('ASC DESC').addClass(orderDirection.direction); 8908 !!orderDirection.direction && $(this).addClass('active'); 8909 $(this).attr('title', orderDirection.title); 8910 $this.closest('form').submit(); 8911 }); 8912 }); 8913 }; 8914 $('[data-order-by]').each(function () { 8915 window.pixelpoint.ppComponents.orderBy($(this)); 8916 }); 8917}); 8918/** 8919 * Logic behind the calender. We have an Availability stream. 8920 */ 8921$(function () { 8922 moment.locale('de'); 8923 var slider = function (element) { 8924 this.el = element; 8925 }; 8926 slider.prototype = { 8927 run: function (command, options) { 8928 switch (command) { 8929 case "init": 8930 this.updateData(options); 8931 this.init(); 8932 break; 8933 case "moveTo": 8934 this.moveToMonth(options); 8935 break; 8936 case "reinitSlider": 8937 if (this.el.hasClass("slick-initialized")) { 8938 this.el.slick('unslick'); 8939 } 8940 this.createSlider(); 8941 break; 8942 default: 8943 break; 8944 } 8945 }, 8946 createSlider: function () { 8947 if (!this.el.hasClass("slick-initialized") && this.el.is(":visible")) { 8948 var defer = $.Deferred(); 8949 var promise = defer.promise(); 8950 this.el.slick({ 8951 slide: ".month", 8952 slidesToShow: 1, 8953 slidesToScroll: 1, 8954 //autoplay: true, 8955 autoplaySpeed: 1800, 8956 cssEase: 'ease-in-out', 8957 prevArrow: '<button class="prev"><i class="icon-arrow-big-left"></i></button>', 8958 nextArrow: '<button class="next"><i class="icon-arrow-big-right"></i></button>', 8959 infinite: false, 8960 adaptiveHeight: true 8961 }); 8962 this.el.on("init", function () { 8963 defer.resolve(); 8964 }); 8965 var $this = this; 8966 this.el.on('beforeChange', function (event, slick, currentSlide, nextSlide) { 8967 if ($this.lastCreatedMonth < nextSlide + 1) { 8968 for (var i = $this.lastCreatedMonth + 1; i <= nextSlide + 1; i++) { 8969 var month = $this.getCurrentMonth(); 8970 month.add(i, "months"); 8971 $this.createMonth(month, i); 8972 $this.lastCreatedMonth += 1; 8973 } 8974 } 8975 }); 8976 if (!!this.currentSlide || this.currentSlide === 0) { 8977 if (!this.currentSlide > 0) { 8978 for (var i = 0; i <= this.currentSlide + 1; i++) { 8979 if (i > this.lastCreatedMonth) { 8980 var month = this.getCurrentMonth(); 8981 month.add(this.lastCreatedMonth + 1, "months"); 8982 this.createMonth(month, i); 8983 this.lastCreatedMonth += 1; 8984 } 8985 } 8986 } 8987 this.el.slick("slickGoTo", this.currentSlide, true); 8988 } 8989 8990 //var $this = this; 8991 8992 this.el.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) { 8993 //currentSlide is undefined on init -- set it to 0 in this case (currentSlide is 0 based) 8994 var i = currentSlide ? currentSlide : 0; // + 1; 8995 $this.currentSlide = i; 8996 }); 8997 } 8998 var predefinedMonth = this.el.data("month"); 8999 if (!!predefinedMonth && !this.currentSlide && this.currentSlide !== 0) { 9000 var $this = this; 9001 if (!!promise) { 9002 promise.then(function () { 9003 setTimeout(function () { 9004 $this.moveToMonth({ 9005 month: predefinedMonth, 9006 supressAnimation: true 9007 }); 9008 }, 100); 9009 }); 9010 } 9011 } 9012 var moreWrapper = this.el.closest(".more-wrapper").data("show-more"); 9013 if (!!moreWrapper && !!moreWrapper.init) moreWrapper.init(); 9014 }, 9015 init: function () { 9016 if (this.el.hasClass("slick-initialized")) { 9017 this.el.slick('unslick'); 9018 } 9019 var $this = this; 9020 setTimeout(function () {
9021 $this.createCalendar(); 9022 $this.createSlider(); 9023 var moveTo = $this.el.data('move-to-date'); 9024 if (!!moveTo) { 9025 setTimeout(function () { 9026 $this.moveToMonth({ 9027 "month": moveTo, 9028 supressAnimation: true 9029 }); 9030 }, 100); 9031 } 9032 }, 100); 9033 }, 9034 // @obsolete 9035 parseAvailability: function (availabilityString) { 9036 var splitted = availabilityString.split("-"); 9037 var result = ""; 9038 $.each(splitted, function (index, value) { 9039 if (parseInt(value) > 0) result += "1";else result += "0"; 9040 }); 9041 return result; 9042 }, 9043 updateData: function (options) { 9044 if (options.startDate) this.startDate = moment(options.startDate, "YYYY-MM-DDZZ");else if (this.el.data("startDate")) this.startDate = moment(this.el.data("startDate"), "YYYY-MM-DDZZ"); 9045 if (options.availabilityString) { 9046 this.availability = options.availabilityString; //this.parseAvailability(options.availabilityString); 9047 } else if (this.el.data("availabilityString")) { 9048 this.availability = this.el.data("availabilityString"); //this.parseAvailability(this.el.data("availabilityString")); 9049 } 9050 if (options.arrivalDeparture) this.arrivalDeparture = options.arrivalDeparture;else if (this.el.data("arrivalDeparture")) this.arrivalDeparture = this.el.data("arrivalDeparture"); 9051 if (!this.arrivalDeparture) { 9052 this.arrivalDeparture = { 9053 "monday": { 9054 "arrival": true, 9055 "departure": true 9056 }, 9057 "tuesday": { 9058 "arrival": true, 9059 "departure": true 9060 }, 9061 "wednesday": { 9062 "arrival": true, 9063 "departure": true 9064 }, 9065 "thursday": { 9066 "arrival": true, 9067 "departure": true 9068 }, 9069 "friday": { 9070 "arrival": true, 9071 "departure": true 9072 }, 9073 "saturday": { 9074 "arrival": true, 9075 "departure": true 9076 }, 9077 "sunday": { 9078 "arrival": true, 9079 "departure": true 9080 } 9081 }; 9082 } 9083 }, 9084 createCalendar: function () { 9085 if (this.initialized) { 9086 return; 9087 } 9088 this.el.html(""); 9089 var month = this.getCurrentMonth(); 9090 var endMonth = this.getLastMonth(); 9091 var index = 0; 9092 this.createMonth(month, 0); 9093 month = this.increaseMonth(month); 9094 this.createMonth(month, 1); 9095 this.lastCreatedMonth = 1; 9096 this.monthMap = {}; 9097 month = this.getCurrentMonth(); 9098 index = 0; 9099 do { 9100 var monthKey = 'month-' + month.format('MM-YYYY'); 9101 this.monthMap[monthKey] = index; 9102 month = this.increaseMonth(month); 9103 index++; 9104 } while (!this.equalMonths(month, endMonth)); 9105 9106 /* 9107 do { 9108 this.createMonth(month,index); 9109 month = this.increaseMonth(month); 9110 index++; 9111 } while (!this.equalMonths(month, endMonth)); 9112 //*/ 9113 this.initialized = true; 9114 }, 9115 getCurrentMonth: function () { 9116 return moment().date(1); 9117 }, 9118 getLastMonth: function () { 9119 var numberOfDays = this.availability.length; 9120 return moment().add(numberOfDays, 'days').date(1); 9121 }, 9122 createMonth: function (month, index) { 9123 var self = this; 9124 var langObject = $("[data-language-obj]").data("language-obj") || { 9125 "id": 0, 9126 "code": "de" 9127 }; 9128 var first = moment(month.date(1)).locale(langObject.code); 9129 var daysInMonth = month.daysInMonth(); 9130 //create wrapper 9131 var monthId = first.format('MM-YYYY'); 9132 var wrapper = $('<div class="month">').data("index", index).addClass(`month-${monthId}`); 9133 if (this.el.hasClass("slick-initialized")) { 9134 this.el.slick('slickAdd', wrapper[0]); 9135 } else { 9136 this.el.append(wrapper); 9137 } 9138 var name = $('<div class="name">').html(first.format('MMMM YYYY')); 9139 wrapper.append(name); 9140 var translations = { 9141 M: window.ppt.translate('date.monday.short', 'M'), 9142 D: window.ppt.translate('date.tuesday.short', 'D'), 9143 Mi: window.ppt.translate('date.wednesday.short', 'M'),
9144 Do: window.ppt.translate('date.thursday.short', 'D'), 9145 F: window.ppt.translate('date.friday.short', 'F'), 9146 S: window.ppt.translate('date.saturday.short', 'S'), 9147 So: window.ppt.translate('date.sunday.short', 'S') 9148 }; 9149 9150 // 9151 var table = $(`<table class="days"><thead><tr><th>${translations.M}</th><th>${translations.D}</th><th>${translations.Mi}</th><th>${translations.Do}</th><th>${translations.F}</th><th>${translations.S}</th><th>${translations.So}</th></tr></thead><tbody></tbody></table>`); 9152 wrapper.append(table); 9153 var tableContent = table.find("tbody"); 9154 var row = $('<tr>'); 9155 tableContent.append(row); 9156 //first we add empty places if needed 9157 var dayOfWeek = first.day(); //day of week from 0 - Sunday to 6 - saturday 9158 dayOfWeek = (dayOfWeek + 6) % 7; //day of week from 0 - monday to 6 - sunday 9159 for (var i = 0; i < dayOfWeek; i++) row.append('<td>'); 9160 // 9161 for (var i = 1; i <= daysInMonth; i++) { 9162 var cell = $('<td>'); 9163 var dayWrapper = $('<div class="day-wrapper">').html('<span>' + i + '</span>'); 9164 var day = moment(first).add(i - 1, 'day').format("DD.MM.YYYY"); 9165 dayWrapper.attr("data-date", day).data("date", day); 9166 if (!this.hasPassed(month, i)) { 9167 var isOnDemand = this.el.data("on-demand") || 0; 9168 if (!this.isAvailableOnDay(month, i)) { 9169 //cell.addClass("white"); 9170 //dayWrapper.addClass("top-red bottom-red"); 9171 cell.attr("title", window.ppt.translate("not_available", "nicht Verfügbar")); 9172 /* 9173 if(this.isAvailableOnDay(month,i,1)){ 9174 if (this.allowedArrival(month, i)) { 9175 dayWrapper.attr("data-arrival", 1).data("arrival", 1); 9176 cell.addClass("white"); 9177 cell.attr("title","möglicher Anreisetag"); 9178 dayWrapper.addClass("bottom-green"); 9179 } 9180 } 9181 else 9182 //*/ 9183 if (this.isAvailableOnDay(month, i, -1)) { 9184 var title = isOnDemand == 1 ? window.ppt.translate("on_demand.possible_departure", "auf Anfrage, möglicher Abreisetag") : window.ppt.translate("possible_departure", "möglicher Abreisetag"); 9185 9186 //if (this.allowedDeparture(month, i)) { // we ignore the departure and/or arrival! 9187 dayWrapper.attr("data-departure", 1).data("departure", 1); 9188 cell.addClass("white"); 9189 cell.attr("title", title); 9190 dayWrapper.addClass("top-green"); 9191 //} 9192 } 9193 } else { 9194 var title = isOnDemand == 1 ? window.ppt.translate("on_demand.possible_arrival", "auf Anfrage, möglicher Anreisetag") : window.ppt.translate("possible_arrival", "möglicher Anreisetag"); 9195 if (!this.allowedArrival(month, i)) { 9196 title = isOnDemand == 1 ? window.ppt.translate("on_demand.no_options", "auf Anfrage, kein Anreisetag") : window.ppt.translate("no_options", "kein Anreisetag"); 9197 } 9198 9199 //if (this.allowedArrival(month, i)) { 9200 dayWrapper.attr("data-arrival", 1).data("arrival", 1); 9201 cell.addClass("white"); 9202 dayWrapper.addClass("bottom-green"); 9203 cell.attr("title", title); 9204 //} 9205 if (this.isAvailableOnDay(month, i, -1) && !this.hasPassed(month, i, -1)) { 9206 //if (this.allowedDeparture(month, i)) { 9207 dayWrapper.attr("data-departure", 1).data("departure", 1); 9208 cell.addClass("white"); 9209 dayWrapper.addClass("top-green"); 9210 //} 9211 } 9212 } 9213 } 9214 cell.append(dayWrapper); 9215 row.append(cell); 9216 if (row.find('td').length == 7) { 9217 row = $('<tr>'); 9218 tableContent.append(row); 9219 } 9220 } 9221 while (row.find('td').length < 7) row.append('<td></td>'); 9222 table.on("click", ".day-wrapper", function (e) { 9223 var dayWrapper = $(e.target).closest(".day-wrapper"); 9224 self.setDate(dayWrapper); 9225 }); 9226 /* 9227 table.on("mouseenter", ".day-wrapper", function (e) { 9228 var calendarDisplay = table.closest(".calendar-display"); 9229 if (!calendarDisplay.hasClass("selection-started")) 9230 return; 9231 calendarDisplay.find(".day-wrapper.hovered").removeClass("hovered"); 9232 var startDay = calendarDisplay.data("selected-start"); 9233 var startMoment = moment(startDay,"DD.MM.YYYY"); 9234 if(!startMoment.isValid()) 9235 return; 9236 9237 var target = $(e.target).closest(".day-wrapper"); 9238 var endDay = target.data("date"); 9239 var endMoment = moment(endDay,"DD.MM.YYYY"); 9240 if(!endMoment.isValid()) 9241 return; 9242 if(endMoment.isBefore(startMoment)){ 9243 var tmp = startMoment; 9244 startMoment = endMoment; 9245 endMoment = tmp; 9246 } 9247 for(var m = moment(startMoment);m.isBefore(endMoment) || m.isSame(endMoment);m.add(1,'days')){ 9248 var currentDate = m.format("DD.MM.YYYY"); 9249 calendarDisplay.find(`.day-wrapper[data-date='${currentDate}']`).addClass("hovered"); 9250 } 9251 }); 9252 table.on("mouseleave", function (e) { 9253 if (!table.closest(".calendar-display").hasClass("selection-started")) 9254 return; 9255 table.find(".day-wrapper.hovered").removeClass("hovered"); 9256 });
9257 //*/ 9258 }, 9259 increaseMonth: function (month) { 9260 return month.add(1, "months"); 9261 }, 9262 equalMonths: function (a, b) { 9263 return a.format("MM-YYYY") == b.format("MM-YYYY"); 9264 }, 9265 hasPassed: function (month, day, offset) { 9266 var date = moment(month).date(day); 9267 offset = offset || 0; 9268 date.add(offset, 'days'); 9269 return moment().isAfter(date, 'day'); // || moment().isSame(date, 'day')); 9270 }, 9271 isAvailableOnDay: function (month, day, offset) { 9272 if (!this.availabilityArray) this.availabilityArray = this.availability.split(''); 9273 offset = offset || 0; 9274 var date = moment(month).date(day); 9275 if (!this.startDate) return false; 9276 var difference = date.diff(this.startDate, "days") + offset; 9277 if (difference < 0) difference = 0; 9278 if (difference >= this.availability.length) return false; 9279 var availability = this.availabilityArray[difference]; // this.availability.charAt(difference); 9280 if (parseInt(availability) > 0) return true; 9281 return false; 9282 }, 9283 allowedArrival: function (month, day) { 9284 var date = moment(month).date(day); 9285 var dayOfWeek = date.locale("en").format("dddd").toLowerCase(); 9286 if (this.arrivalDeparture[dayOfWeek] && this.arrivalDeparture[dayOfWeek].arrival) return true; 9287 return false; 9288 }, 9289 allowedDeparture: function (month, day) { 9290 var date = moment(month).date(day); 9291 var dayOfWeek = date.locale("en").format("dddd").toLowerCase(); 9292 if (this.arrivalDeparture[dayOfWeek] && this.arrivalDeparture[dayOfWeek].departure) return true; 9293 return false; 9294 }, 9295 setDate: function (dayWrapper) { 9296 var calendarDisplay = dayWrapper.closest(".calendar-display"); 9297 if (calendarDisplay.data("selected-start")) { 9298 if (dayWrapper.data("departure") == 1) { 9299 var start = calendarDisplay.data("selected-start"); 9300 var end = dayWrapper.data("date"); 9301 var supressScroll = calendarDisplay.is("[data-supress-scroll]"); 9302 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.slickCalendarDateSelected, [{ 9303 start: start, 9304 end: end, 9305 supressScroll: supressScroll 9306 }]); 9307 calendarDisplay.removeData("selected-start"); 9308 calendarDisplay.removeClass("selection-started"); 9309 calendarDisplay.find(".day-wrapper").removeClass("selected-start"); 9310 } 9311 } else { 9312 if (dayWrapper.data("arrival") == 1) { 9313 var start = dayWrapper.data("date"); 9314 calendarDisplay.data("selected-start", start); 9315 calendarDisplay.addClass("selection-started"); 9316 dayWrapper.addClass("selected-start"); 9317 } 9318 } 9319 }, 9320 moveToMonth: function (options) { 9321 var index = 0; 9322 if (!!options.month) { 9323 var month = this.el.find(`.month-${options.month}`); 9324 if (month.length != 0) { 9325 index = month.data("index"); 9326 } else if (!!this.monthMap && !!this.monthMap[`month-${options.month}`]) { 9327 index = this.monthMap[`month-${options.month}`]; 9328 } else { 9329 return; 9330 } 9331 } else if (!!options.index || options.index === 0) { 9332 index = options.index; 9333 } else { 9334 return; 9335 } 9336 var supressAnimation = options.supressAnimation || false; 9337 if (this.lastCreatedMonth < index + 1) { 9338 for (var i = this.lastCreatedMonth + 1; i <= index + 1; i++) { 9339 var month = this.getCurrentMonth(); 9340 month.add(i, "months"); 9341 this.createMonth(month, i); 9342 this.lastCreatedMonth += 1; 9343 } 9344 } 9345 if (this.el.hasClass("slick-initialized")) { 9346 this.el.slick("slickGoTo", index, supressAnimation); 9347 this.currentSlide = index; 9348 } 9349 } 9350 }; 9351 $.fn.ppCalendarDisplay = function (command, options) { 9352 command = command || "init"; 9353 options = options || {}; 9354 var defaults = {}; 9355 var opts = $.extend({}, defaults, options); 9356 return this.each(function () { 9357 var $this = $(this); 9358 var ppSlider = $this.data("ppSlider"); 9359 if (!ppSlider) { 9360 var ppSlider = new slider($this); 9361 $this.data("ppSlider", ppSlider); 9362 } 9363 ppSlider.run(command, options); 9364 }); 9365 }; 9366 $(window).on('load', function () { 9367 $(".calendar-display").ppCalendarDisplay(); 9368 }); 9369 $(window).click(function (e) { 9370 var activeCalendar = $(".calendar-display.selection-started"); 9371 if (activeCalendar.length == 0) return; 9372 var target = $(e.target); 9373 if (activeCalendar.has(target).length == 0) { 9374 activeCalendar.removeData("selected-start"); 9375 activeCalendar.removeClass("selection-started"); 9376 activeCalendar.find(".day-wrapper").removeClass("selected-start"); 9377 } 9378 }); 9379}); 9380$(function () { 9381 var privateFunctions = { 9382 getTextInput: function (name, id, classes, defaultValue) { 9383 return `<input type="text" name="${name}" class="${classes}" ${!!id ? 'id="' + id + '"' : ''} ${!!defaultValue ? 'value="' + defaultValue + '"' : ''} />`; 9384 }, 9385 getTextAreaInput: function (name, id, classes, defaultValue) { 9386 return `<textarea name="${name}" class="${classes}" ${!!id ? 'id="' + id + '"' : ''}>${defaultValue}</textarea>`; 9387 } 9388 }; 9389}); 9390jQuery(function () { 9391 var defaultDelay = 250; 9392 window.pixelpoint = window.pixelpoint || {}; 9393 window.pixelpoint.map = window.pixelpoint.map || {}; 9394 window.pixelpoint.map.promises = window.pixelpoint.map.promises || {}; 9395 window.pixelpoint.map.promises.airBnBMapLoaded = window.pixelpoint.map.promises.airBnBMapLoaded || $.Deferred(); 9396 window.ppComponents = window.ppComponents || {}; 9397 window.ppComponents.select2 = window.ppComponents.select2 || {}; 9398 window.ppComponents.select2.initializeRemote = function (elements) { 9399 elements.each(function () { 9400 var $this = $(this); 9401 9402 // Avoid binding Select2 remote logic multiple times on the same element. 9403 if ($this.hasClass('select2-hidden-accessible')) { 9404 return; 9405 } 9406 var remoteUrl = $this.data("src"); 9407 var asArray = $this.data("as-array"); 9408 var useNameInValue = $this.is("[data-name-in-value]"); 9409 var useExternalIdInValue = $this.is("[data-external-id-in-value]"); 9410 var appendToValue = $this.data("append-to-value"); 9411 var cssClass = $this.data("dropdown-css-class") || "";
9412 var containerCssClass = $this.data("container-css-class") || ""; 9413 //var enableResizableText = $this.is("[data-resizable-text]"); 9414 var allowClear = $this.data('allow-clear') || false; 9415 var alternativeUrl = $this.data('alternative-src') || false; 9416 var useAlternative = false; 9417 var useAlternativeWhenNotIn = $this.data('use-alternative-when') || false; 9418 var useCustomTransportFunction = !!$this.data('custom-transport-function') || false; 9419 var customTransportFunction = $this.data('custom-transport-function') || null; 9420 var lang = "de"; 9421 var langObject = $("[data-language-obj]").data("language-obj"); 9422 if (!!langObject) { 9423 lang = langObject.code; 9424 } 9425 let addCssContainerClass = $this => { 9426 if (!!containerCssClass) { 9427 $this.data('select2').$dropdown.addClass(containerCssClass); 9428 } 9429 }; 9430 var closeOnSelect = true; 9431 if ($this.data('close-select') == 'disabled') { 9432 closeOnSelect = false; 9433 } 9434 var closestForm = $(this).closest("form"); 9435 var isLocationTree = $this.hasClass('locationTree'); 9436 var supressLocationTreeFilter = $this.is('[data-supress-location-tree-filter]'); 9437 if (isLocationTree && $this.is('[multiple]')) { 9438 // we add the location button 9439 $this.parent().addClass("withGeolocation"); 9440 var onTargetClick = function () { 9441 window.pixelpoint.geoTool.geocode().done(function (data) { 9442 if ($this.hasClass('select2-hidden-accessible')) { 9443 if (!!data && !!data.locations && !!data.locations[0]) { 9444 $this.html(`<option value="${data.locations[0].id}:${data.locations[0].name}:location" selected>${data.locations[0].name}</option>`); 9445 $this.select2('data', { 9446 id: `${data.locations[0].id}:${data.locations[0].name}:location`, 9447 text: data.locations[0].name 9448 }); 9449 $this.trigger('change'); 9450 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.airBnBSearch, {}); 9451 } else { 9452 window.pixelpoint.modal.open(window.ppt.translate("geolocation.error", "Leider konnte Ihre Position nicht ermittelt werden. Bitte wählen Sie ihren Ort manuell aus."), window.ppt.translate("geolocation.error.title", "Fehler beim ermitteln Ihes Ortes!")); 9453 } 9454 } 9455 }).fail(function () { 9456 window.pixelpoint.modal.open(window.ppt.translate("geolocation.error", "Leider konnte Ihre Position nicht ermittelt werden. Bitte wählen Sie ihren Ort manuell aus."), window.ppt.translate("geolocation.error.title", "Fehler beim ermitteln Ihes Ortes!")); 9457 }); 9458 }; 9459 var searchAroundTranslation = window.ppt.translate("geolocation.search.area", "In der Umgebung suchen"); 9460 var icon = $(`<i class="icon-target" title="${searchAroundTranslation}"></i>`).insertAfter($this).on("click", function (e) { 9461 onTargetClick(); 9462 }); 9463 window.pixelpoint.tooltip.init(icon); 9464 9465 //var map = window.pixelpoint.airBnB.mapObject(); 9466 9467 window.pixelpoint.map.promises.airBnBMapLoaded.then(map => { 9468 if (map != null) { 9469 map.$on("geoSearch", function () { 9470 onTargetClick(); 9471 }); 9472 } 9473 }); 9474 } 9475 if (!window.ppComponents.select2.customTransportFunctions) window.ppComponents.select2.customTransportFunctions = {}; 9476 if (!window.ppComponents.select2.customTransportFunctions.form) { 9477 window.ppComponents.select2.customTransportFunctions.form = function (params, success, failure) { 9478 var form = closestForm; 9479 if (form.length == 0) failure(); 9480 var data = form.serialize(); 9481 $.ajax({ 9482 url: params.url, 9483 type: "POST", 9484 data: data, 9485 success: success, 9486 error: failure 9487 }); 9488 }; 9489 } 9490 $this.off("select2:select").on("select2:select", function (e) { 9491 // not used 9492 /*if (enableResizableText) { 9493 var selectionWrapper = $this.parent().find(".selection"); 9494 var rendered = selectionWrapper.find(".select2-selection__rendered"); 9495 rendered.css("font-size", ""); 9496 var parentWidth = selectionWrapper.width(), 9497 parentHeight = selectionWrapper.height(), 9498 width = rendered.width(), 9499 height = rendered.height(); 9500 var computedStyle = window.getComputedStyle($this[0]); 9501 var fontsize = computedStyle.getPropertyValue('font-size'); 9502 fontsize = parseFloat(fontsize); 9503 while (width > (parentWidth - 25) || height > parentHeight) { 9504 fontsize *= 0.95; 9505 rendered.css("font-size", fontsize + "px"); 9506 width = rendered.width(); 9507 height = rendered.height(); 9508 } 9509 }*/ 9510 9511 if (!closeOnSelect && isLocationTree && !supressLocationTreeFilter) { 9512 $this.data('select2').trigger('query'); 9513 } 9514 }); 9515 if (window.pixelpoint.utilities.isTouchDevice()) { 9516 $this.off("select2:open").on("select2:open", function () { 9517 var searchField = $('.select2-container.select2-container--open').find('.select2-search__field'); 9518 var parent = searchField.closest(".select2-selection"); 9519 setTimeout(() => { 9520 if (!searchField.val()) searchField.blur().off("click").on("click", function (e) {}); 9521 }, 10); 9522 addCssContainerClass($this); 9523 }); 9524 } 9525 if (!remoteUrl) { 9526 $this.select2({ 9527 closeOnSelect: closeOnSelect, 9528 language: lang 9529 }); 9530 return; 9531 } 9532 var getUrl = function () { 9533 if (useAlternative) return alternativeUrl; 9534 return remoteUrl; 9535 }; 9536 if (isLocationTree && !supressLocationTreeFilter) { 9537 var spaceUnits = ["region", "aqua", "national", "excursion", "location"]; 9538 getUrl = function () { 9539 var url = remoteUrl; 9540 if (useAlternative) url = alternativeUrl; 9541 var currentValues = $this.val(); 9542 if (!!currentValues) { 9543 if (currentValues.constructor == Array) { 9544 $.each(currentValues, function (index, currentValue) { 9545 var parameters = currentValue.split(":"); 9546 if (parameters.length == 3 && $.inArray(parameters[2], spaceUnits) >= 0) { 9547 var id = parameters[0]; 9548 var type = parameters[2]; 9549 var parsedUrl = window.pixelpoint.utilities.parseUrl(url); 9550 parsedUrl.queryParameters[type] = id; 9551 url = window.pixelpoint.utilities.buildUrl(parsedUrl); 9552 return false;
9553 } 9554 }); 9555 } else { 9556 var parameters = currentValues.split(":"); 9557 if (parameters.length == 3 && $.inArray(parameters[2], spaceUnits) >= 0) { 9558 var id = parameters[0]; 9559 var type = parameters[2]; 9560 var parsedUrl = window.pixelpoint.utilities.parseUrl(url); 9561 parsedUrl.queryParameters[type] = id; 9562 url = window.pixelpoint.utilities.buildUrl(parsedUrl); 9563 } 9564 } 9565 } 9566 return url; 9567 }; 9568 } 9569 var ajaxOptions = { 9570 url: getUrl(), 9571 delay: defaultDelay, 9572 dataType: 'json', 9573 data: function (params) { 9574 return { 9575 q: params.term, 9576 page: params.page 9577 }; 9578 }, 9579 processResults: function (data, params) { 9580 if (typeof data === "string") { 9581 try { 9582 data = JSON.parse(data); 9583 } catch (error) { 9584 console.error("Failed to parse JSON:", error); 9585 } 9586 } 9587 9588 // parse the results into the format expected by Select2 9589 // since we are using custom formatting functions we do not need to 9590 // alter the remote JSON data, except to indicate that infinite 9591 // scrolling can be used 9592 params.page = params.page || 1; 9593 var limit = data.limit || 30; 9594 return { 9595 results: _.map(data.items, function (item) { 9596 var id = ""; 9597 if (!!item.children) { 9598 var children = _.map(item.children, function (child) { 9599 id = child.id; 9600 if (!!useNameInValue) { 9601 id = child.id + ":" + child.name; 9602 } 9603 if (!!useExternalIdInValue && !!child.external_id) { 9604 id += `:${child.external_id}`; 9605 } 9606 if (!!appendToValue && !!child[appendToValue]) { 9607 id += ":" + child[appendToValue]; 9608 } 9609 var result = { 9610 id: id, 9611 text: child.name 9612 }; 9613 if (!!child.coordinates) result.coordinates = child.coordinates; 9614 return result; 9615 }); 9616 if (!!item.id) { 9617 id = item.id; 9618 if (!!useNameInValue) { 9619 id = item.id + ":" + item.name; 9620 } 9621 if (!!useExternalIdInValue && !!item.external_id) { 9622 id += `:${item.external_id}`; 9623 } 9624 if (!!appendToValue && !!item[appendToValue]) { 9625 id += ":" + item[appendToValue]; 9626 } 9627 return { 9628 id: id, 9629 children: children, 9630 text: item.name 9631 }; 9632 } else { 9633 return { 9634 children: children, 9635 text: item.name 9636 }; 9637 } 9638 } 9639 id = item.id; 9640 if (!!useNameInValue) { 9641 id = item.id + ":" + item.name; 9642 } 9643 if (!!useExternalIdInValue && !!item.external_id) { 9644 id += `:${item.external_id}`; 9645 } 9646 var result = { 9647 id: id, 9648 text: item.name 9649 }; 9650 if (!!item.coordinates) result.coordinates = item.coordinates; 9651 return result; 9652 }), 9653 pagination: { 9654 more: params.page * limit < data.total_count 9655 } 9656 }; 9657 } 9658 }; 9659 if (useCustomTransportFunction) { 9660 var customTransport = window.ppComponents.select2.customTransportFunctions[customTransportFunction] || null; 9661 if (!!customTransport) ajaxOptions.transport = customTransport; 9662 } 9663 var closeOnSelect = true; 9664 if ($this.data('close-on-select') == 'disabled') { 9665 closeOnSelect = false; 9666 } 9667 $this.select2({ 9668 minimumInputLength: 0, 9669 closeOnSelect: closeOnSelect, 9670 ajax: ajaxOptions, 9671 dropdownCssClass: cssClass, 9672 containerCssClass: containerCssClass, 9673 language: lang 9674 }); 9675 if (!!containerCssClass) { 9676 $this.on("select2:open", () => { 9677 addCssContainerClass($this); 9678 }); 9679 } 9680 if ($this.find("option:selected").length > 0) { 9681 var values = []; 9682 $this.find("option:selected").each(function () { 9683 values.push($(this).val()); 9684 }); 9685 values = _.uniq(values); 9686 if (values.length == 1) { 9687 $this.val(values[0]).trigger("change"); 9688 $this.val(values).trigger("change"); 9689 } else if (values.length > 1) { 9690 $this.val(values).trigger("change"); 9691 $this.val(values).trigger("change"); 9692 } 9693 } 9694 if (isLocationTree && $this.is('[multiple]')) { 9695 var select2Dom = $this.parent().find(".select2-selection__rendered"); 9696 if (select2Dom.length > 0 && $("[data-soft-search]").data("soft-search") == 1) { 9697 select2Dom.on("click", ".select2-selection__choice__remove", function () { 9698 if (select2Dom.find(".select2-selection__choice").length == 1) { 9699 $(".brandenbutton.search-button").data("ignore-bbox", "1").attr("data-ignore-bbox", "1"); 9700 var valuesToRestore = $this.data("restore"); 9701 if (!!valuesToRestore) { 9702 $this.val(valuesToRestore); 9703 } 9704 } 9705 }); 9706 } 9707 } 9708 var exposedFunctions = { 9709 set(data) { 9710 if (!data) return; 9711 var html = ''; 9712 if (data instanceof Array) { 9713 $.each(data, function (index, element) {
9714 html += `<option selected value=${element.id}>${element.text}</option>`; 9715 }); 9716 } else { 9717 html = `<option selected value=${data.id}>${data.text}</option>`; 9718 } 9719 $this.html(html); 9720 $this.select2('data', data); 9721 }, 9722 get() { 9723 var data = $this.select2('data'); 9724 var result = null; 9725 if (data instanceof Array) { 9726 result = _.map(data, function (element) { 9727 return { 9728 id: element.id, 9729 text: element.text 9730 }; 9731 }); 9732 result = _.filter(result, function (r) { 9733 return r.id != ''; 9734 }); 9735 } else { 9736 if (data.id != '') { 9737 result = { 9738 id: data.id, 9739 text: data.text 9740 }; 9741 if (asArray) { 9742 result = [result]; 9743 } 9744 } 9745 } 9746 return result; 9747 } 9748 }; 9749 if (!!alternativeUrl && !!useAlternativeWhenNotIn && !useAlternative) { 9750 $this.on('change', function (evt) { 9751 var selected = exposedFunctions.get(); 9752 useAlternative = true; 9753 $.each(selected, function (index, value) { 9754 if (value.id == useAlternativeWhenNotIn) { 9755 useAlternative = false; 9756 } 9757 }); 9758 }); 9759 } 9760 $this.data("form-element-functions", exposedFunctions); 9761 }); 9762 }; 9763 $(window).on("orientationchange", function () { 9764 $("select.autocomplete.select2-hidden-accessible").each(function () { 9765 var self = $(this); 9766 self.select2("destroy"); 9767 setTimeout(function () { 9768 window.ppComponents.select2.initializeRemote(self); 9769 }, 50); 9770 }); 9771 }); 9772 window.ppComponents.select2.initializeRemote($("select.autocomplete")); 9773}); 9774jQuery(function () { 9775 var privateFunctions = { 9776 splitValues(input) { 9777 if (!input) return []; 9778 if (!(typeof input == "string")) { 9779 input = input + ""; 9780 } 9781 var splittedInput = input.split(","); 9782 var result = []; 9783 for (var i in splittedInput) { 9784 if (isNaN(i)) continue; 9785 if (typeof splittedInput[i] === 'undefined') continue; 9786 result.push(parseInt(splittedInput[i])); 9787 if (result.length >= 2) return result; 9788 } 9789 return result; 9790 }, 9791 joinValues(input, wNumbFormatter) { 9792 if (!input) return ""; 9793 if (!!wNumbFormatter) { 9794 input = _.map(input, function (element) { 9795 return wNumbFormatter.from(element); 9796 }); 9797 } 9798 return input.join(","); 9799 }, 9800 initSliders(elements) { 9801 elements.each(function () { 9802 var $this = $(this); 9803 var eventsPostfix = $this.data('events-postfix') || null; 9804 var inputName = $this.data('input-name') || 'price'; 9805 $this.data('input-name', inputName); 9806 var checkboxLabel = $this.data('checkbox-label') || 'Aktivieren'; 9807 if ($this.is("[data-no-checkbox-label]")) { 9808 checkboxLabel = ''; 9809 } 9810 var min = parseInt($this.data("min")) || 0, 9811 max = parseInt($this.data("max")) || 100, 9812 disabled = $this.is("[data-disabled]"), 9813 initial = $this.data("initial") || ($this.is("[data-single]") ? "0" : "0,0"), 9814 format = $this.data("format") || { 9815 decimals: 0, 9816 prefix: '⬠', 9817 postfix: ',-' 9818 }; 9819 var step = parseInt($this.data("step")) || 1; 9820 var initialDisabled = false; 9821 if (!$this.data("initial") || $this.is("[data-initially-off]")) { 9822 initialDisabled = true; 9823 } 9824 if (isNaN(initial) && !/([\d\.])+,([\d\.])+/.test(initial)) { 9825 initial = $this.is("[data-single]") ? "0" : "0,0"; 9826 } 9827 var checkboxContainer = $this.data('checkbox-container') || null; 9828 var initialValues = privateFunctions.splitValues(initial); 9829 var initialValue = initialValues.length > 1 ? "0,0" : "0"; 9830 var secondLabelAdditionalClasses = initialValues.length == 1 ? "hide" : ""; 9831 if (!!$this.is("[data-single]")) { 9832 initialValue = "0"; 9833 secondLabelAdditionalClasses = "hide"; 9834 if (initialValues.length > 1) { 9835 initialValues = [initialValues[1]]; 9836 } 9837 } 9838 var hideSecondLabel = initialValues.length == 1; 9839 var checkboxTemplate = ''; 9840 var labelCountClass = ''; 9841 var checkBoxColClass = '', 9842 sliderColClass = ''; 9843 if (hideSecondLabel) { 9844 labelCountClass = 'one-value';
9845 checkBoxColClass = 'small-4'; 9846 sliderColClass = 'small-8'; 9847 } else { 9848 labelCountClass = 'two-values'; 9849 checkBoxColClass = 'small-5'; 9850 sliderColClass = 'small-7'; 9851 } 9852 9853 /* 9854 if($this.hasClass("range-slider-small")){ 9855 checkboxTemplate = `<div class ="columns large-3 tablet-3 medium-3 ${checkBoxColClass} range-slider-small-label"> 9856 <div class ="control checkbox no-icon no-shadow"> 9857 <input type="checkbox" id="activate-${inputName}" ${initialDisabled ? '' : 'checked'} /> 9858 <label for="activate-${inputName}">${checkboxLabel}</label> 9859 </div> 9860 </div>`; 9861 } 9862 else { 9863 checkboxTemplate = `<div class ="columns small-12 no-padding slider-label"> 9864 <div class ="control checkbox no-icon no-shadow"> 9865 <input type="checkbox" id="activate-${inputName}" ${initialDisabled ? '' : 'checked'} /> 9866 <label for="activate-${inputName}">${checkboxLabel}</label> 9867 </div> 9868 </div>`; 9869 } 9870 if(!!checkboxContainer){ 9871 checkboxTemplate = ''; 9872 $(checkboxContainer).append(`<div class ="control checkbox no-icon no-shadow"> 9873 <input type="checkbox" id="activate-${inputName}" ${initialDisabled ? '' : 'checked'} /> 9874 <label for="activate-${inputName}">${checkboxLabel}</label> 9875 </div>`); 9876 } 9877 //*/ 9878 9879 var label1SizeClasses = '', 9880 label2SizeClasses = '', 9881 sliderSizeClasses = '', 9882 sliderWrapperAdditionalClass = ''; 9883 if ($this.hasClass("range-slider-small")) { 9884 if (hideSecondLabel) { 9885 secondLabelAdditionalClasses = "hide"; 9886 /*label1SizeClasses = 'medium-3 small-6'; 9887 label2SizeClasses = 'hide'; 9888 sliderSizeClasses = 'medium-6 small-6'; 9889 if($this.is('[data-wider-portrait]')){ 9890 label1SizeClasses = 'medium-portrait-3 medium-landscape-4 small-6'; 9891 } 9892 */ 9893 } else { 9894 /*label1SizeClasses = 'medium-3 small-6'; 9895 label2SizeClasses = 'medium-3 small-12'; 9896 sliderSizeClasses = 'medium-6 small-6';*/ 9897 } 9898 var colClasses = "large-9 tablet-9 medium-9 " + sliderColClass; 9899 if ($this.hasClass("range-slider-tour")) { 9900 colClasses = "small-12 no-padding"; 9901 } 9902 var template = `<div class="row no-margin"> 9903 ${checkboxTemplate} 9904 <div class="columns ${colClasses} range-slider-small-content"> 9905 <div class="row ${labelCountClass}"> 9906 <div class="columns"> 9907 <label class="value-1"></label> 9908 </div> 9909 <div class="slider-col columns"> 9910 <label class="slider"></label> 9911 </div> 9912 <div class="columns ${secondLabelAdditionalClasses}"> 9913 <label class ="value-2"></label> 9914 </div> 9915 </div> 9916 </div> 9917 <input type="hidden" name="${inputName}" value="${initialValue}" /> 9918 </div>`; 9919 } else { 9920 if (hideSecondLabel) { 9921 secondLabelAdditionalClasses = "hide"; 9922 /*label1SizeClasses = 'large-4 medium-4 small-12'; 9923 label2SizeClasses = 'hide'; 9924 sliderSizeClasses = 'large-8 medium-8 small-12';*/ 9925 sliderWrapperAdditionalClass = 'no-padding-right'; 9926 } else { 9927 /*label1SizeClasses = 'large-2 medium-3 small-12'; 9928 label2SizeClasses = 'large-2 medium-3 small-12 medium-push-6 large-push-8'; 9929 sliderSizeClasses = 'large-8 medium-6 small-12 medium-pull-3 large-pull-2';*/ 9930 } 9931 var template = `<div class="row no-margin"> 9932 ${checkboxTemplate} 9933 9934 <div class="${labelCountClass} range-slider-small-content"> 9935 <div class="columns"> 9936 <label class="value-1"></label> 9937 </div> 9938 <div class="columns ${secondLabelAdditionalClasses}" style="min-height:50px;min-width:50px;"> 9939 <label class ="value-2"></label> 9940 </div> 9941 <div class="slider-col columns ${sliderWrapperAdditionalClass}"> 9942 <label class="slider"></label> 9943 </div> 9944 </div> 9945 9946 <input type="hidden" name="${inputName}" value="${initialValue}" /> 9947 </div>`; 9948 9949 /* 9950 var template = `<div class="row no-margin"> 9951 ${checkboxTemplate} 9952 <div class="columns no-padding label-1-wrapper"> 9953 <label class="value-1"></label> 9954 </div> 9955 <div class="columns ${label2SizeClasses} no-padding label-2-wrapper" style="min-height:50px;min-width:50px;"> 9956 <label class ="value-2 ${secondLabelAdditionalClasses}"></label> 9957 </div> 9958 <div class="columns ${sliderSizeClasses} slider-wrapper ${sliderWrapperAdditionalClass}"> 9959 <label class="slider"></label> 9960 </div> 9961 <input type="hidden" name="${inputName}" value="${initialValue}" /> 9962 </div>`; 9963 */ 9964 } 9965 $this.html(template); 9966 var $sliderElement = $this.find(".slider"); 9967 var sliderElement = $sliderElement[0]; 9968 var value1Label = $this.find(".value-1"); 9969 var value2Label = $this.find(".value-2"); 9970 var inputElement = $this.find("input[type='hidden']"); 9971 9972 /* 9973 var activateCheckbox = null; 9974 if(!!checkboxContainer){ 9975 activateCheckbox = $(checkboxContainer).find(`input[type='checkbox']`); 9976 } 9977 else{ 9978 activateCheckbox = $this.find("input[type='checkbox']"); 9979 } 9980 //*/ 9981 9982 if (!!initialDisabled) { 9983 //sliderElement.setAttribute('disabled', true); 9984 inputElement.prop('disabled', true); 9985 } else { 9986 //sliderElement.removeAttribute('disabled'); 9987 inputElement.prop('disabled', false); 9988 } 9989 9990 //* 9991 $sliderElement.on("click touchstart", function () { 9992 console.log("it is comming in here..."); 9993 if (inputElement.is(':disabled')) { 9994 //sliderElement.removeAttribute('disabled'); 9995 inputElement.prop('disabled', false); 9996 inputElement.removeAttr('disabled'); 9997 if (!!eventsPostfix) { 9998 var eventName = `${window.pixelpoint.pubSub.events.slidersEventEnable}:${eventsPostfix}`; 9999 window.pixelpoint.pubSub.publish(eventName); 10000 } 10001 } 10002 }); 10003 //*/ 10004 10005 var wNumbFormatter = wNumb(format); 10006 noUiSlider.create(sliderElement, { 10007 start: initialValues, 10008 connect: true, 10009 range: { 10010 'min': min, 10011 'max': max 10012 }, 10013 step: step, 10014 format: wNumbFormatter 10015 });
10016 var updateValue = function () { 10017 var values = sliderElement.noUiSlider.get(); 10018 if (!$.isArray(values)) values = [values]; 10019 if (values.length > 0) { 10020 value1Label.text(values[0]); 10021 if (values.length > 1) { 10022 value2Label.text(values[1]); 10023 } 10024 var value = privateFunctions.joinValues(values, wNumbFormatter); 10025 inputElement.val(value); 10026 if (!!eventsPostfix) { 10027 var eventName = `${window.pixelpoint.pubSub.events.slidersEventChange}:${eventsPostfix}`; 10028 window.pixelpoint.pubSub.publish(eventName, [value]); 10029 } 10030 } 10031 }; 10032 sliderElement.noUiSlider.on('update', function () { 10033 updateValue(); 10034 }); 10035 if (initialValues.length > 1 && initialValues[1] > min) { 10036 value2Label.text(wNumbFormatter.to(initialValues[1])); 10037 } else { 10038 value2Label.text(wNumbFormatter.to(max)); 10039 } 10040 var exposedFunctions = { 10041 reset() { 10042 sliderElement.noUiSlider.set([0, 0]); 10043 //activateCheckbox.prop("checked",false).change(); 10044 } 10045 }; 10046 $this.data("form-element-functions", exposedFunctions).attr("data-form-element-functions-added", true); 10047 10048 /* 10049 activateCheckbox.on('change', function () { 10050 var activated = activateCheckbox.is(":checked"); 10051 if (!activated) { 10052 inputElement.val(''); 10053 sliderElement.setAttribute('disabled', true); 10054 inputElement.prop('disabled', true); 10055 if(!!eventsPostfix){ 10056 var eventName = `${window.pixelpoint.pubSub.events.slidersEventDisable}:${eventsPostfix}`; 10057 window.pixelpoint.pubSub.publish(eventName); 10058 } 10059 } 10060 else { 10061 sliderElement.removeAttribute('disabled'); 10062 inputElement.prop('disabled', false); 10063 if(!!eventsPostfix){ 10064 var eventName = `${window.pixelpoint.pubSub.events.slidersEventEnable}:${eventsPostfix}`; 10065 window.pixelpoint.pubSub.publish(eventName); 10066 } 10067 updateValue(); 10068 } 10069 }); 10070 //*/ 10071 10072 if (!!disabled) { 10073 //activateCheckbox.prop("disabled", true); 10074 sliderElement.setAttribute('disabled', true); 10075 inputElement.prop('disabled', true); 10076 } 10077 var toDisableEvent = $this.data("to-disable"); 10078 if (!!toDisableEvent) { 10079 window.pixelpoint.pubSub.subscribe(`on:disabler:${toDisableEvent}:disable`, function () { 10080 //activateCheckbox.prop("disabled", true); 10081 sliderElement.setAttribute('disabled', true); 10082 inputElement.prop('disabled', true); 10083 if (!!eventsPostfix) { 10084 var eventName = `${window.pixelpoint.pubSub.events.slidersEventDisable}:${eventsPostfix}`; 10085 window.pixelpoint.pubSub.publish(eventName); 10086 } 10087 }); 10088 window.pixelpoint.pubSub.subscribe(`on:disabler:${toDisableEvent}:enable`, function () { 10089 //activateCheckbox.prop("disabled", false); 10090 //if(activateCheckbox.is(":checked")){ 10091 sliderElement.removeAttribute('disabled'); 10092 //inputElement.prop('disabled', false); 10093 if (!inputElement.is(":disabled")) { 10094 if (!!eventsPostfix) { 10095 var eventName = `${window.pixelpoint.pubSub.events.slidersEventEnable}:${eventsPostfix}`; 10096 window.pixelpoint.pubSub.publish(eventName); 10097 } 10098 } 10099 //} 10100 }); 10101 } 10102 }); 10103 } 10104 }; 10105 window.ppComponents = window.ppComponents || {}; 10106 window.ppComponents.common = window.ppComponents.common || {}; 10107 window.ppComponents.common.sliders = privateFunctions.initSliders; 10108 privateFunctions.initSliders($(".range-slider")); 10109}); 10110//include 10 10111jQuery(function () { 10112 var privateFunctions = { 10113 getGroupContainer(group) { 10114 var groupContainer = group; 10115 var groupContainerSelector = group.data("group-container") || null; 10116 if (!!groupContainerSelector) { 10117 groupContainer = $(groupContainerSelector); 10118 } 10119 return groupContainer; 10120 }, 10121 showHideTourLength() { 10122 window.pixelpoint.searchform.showHideTourLength(); 10123 }, 10124 showHideTitle() { 10125 var headline = $(".group-names-headline"); 10126 if ($(".group-names-container > li").length > 0) { 10127 headline.removeClass("hide"); 10128 headline.closest(".element-wrapper").removeClass("hide"); 10129 } else { 10130 headline.addClass("hide"); 10131 headline.closest(".element-wrapper").addClass("hide"); 10132 } 10133 }, 10134 recalculateGroupIndices(group) { 10135 var index = 0; 10136 var groupContainer = this.getGroupContainer(group); 10137 groupContainer.find(".groups section").each(function () { 10138 $(this).find("[name]").each(function () { 10139 var name = $(this).attr("name"); 10140 name = name.replace(/\[\d+\]/, `[${index}]`); 10141 $(this).attr("name", name); 10142 }); 10143 index++; 10144 }); 10145 if (groupContainer.find(".groups section").length == 0) groupContainer.find(".groups").hide(); 10146 }, 10147 bindGroupEvents(group, $this) { 10148 var groupContainer = this.getGroupContainer(group); 10149 group.on("click", ".remove-group", function (e) { 10150 e.preventDefault(); 10151 e.stopPropagation(); 10152 var nameContainer = $(e.target).closest("li");
10153 var groupId = nameContainer.data("group-id"); 10154 if (!groupId) return; 10155 //var a = $(e.target).closest(".dropdown-group-container") 10156 var a = privateFunctions.getGroupContainer(group); 10157 var b = a.find(`.groups section[data-group-id='${groupId}']`); 10158 b.remove(); 10159 nameContainer.remove(); 10160 privateFunctions.recalculateGroupIndices(group); 10161 privateFunctions.showHideTourLength(); 10162 privateFunctions.showHideTitle(); 10163 privateFunctions.showHideFilterIcon(group); 10164 privateFunctions.addHideShowIcon(group); 10165 let groups = $(".group-names-container li"); 10166 let allIds = []; 10167 groups.each((index, el) => { 10168 let id = $(el).data('group-id'); 10169 if (!!id && id != groupId) { 10170 allIds.push(id); 10171 } 10172 }); 10173 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.categoryChanged, [allIds]); 10174 }); 10175 groupContainer.on("click", ".close-group", function (e) { 10176 e.preventDefault(); 10177 groupContainer.find(".groups").hide(); 10178 groupContainer.parent().find(".group-names-container li.active").removeClass("active"); 10179 }); 10180 group.on("click", ".group-names-container li", function () { 10181 var $this = $(this); 10182 10183 //******************************************************** */ 10184 if ($this.hasClass("active")) { 10185 groupContainer.find(".groups").hide(); 10186 $this.removeClass("active"); 10187 return; 10188 } 10189 groupContainer.find(".groups").show(); 10190 var searchHeight = group.closest(".search").height(); 10191 var searchOffset = group.closest(".search").offset().top; 10192 var groupOffset = groupContainer.find(".groups").offset().top; 10193 var realHeight = searchHeight - (groupOffset - searchOffset); 10194 groupContainer.find(".groups").css("max-height", realHeight); 10195 //******************************************************** */ 10196 10197 var groupId = $this.data("group-id"); 10198 if (!groupId) return; 10199 group.find(".group-names-container [data-group-id]").removeClass("active"); 10200 $this.addClass("active"); 10201 groupContainer.find(".groups section").removeClass("active"); 10202 groupContainer.find(`.groups section[data-group-id='${groupId}'] .control .brandenbutton.search-button`).closest('.control').addClass("ignore"); 10203 var controlsCount = groupContainer.find(`.groups section[data-group-id='${groupId}'] .control`).not(".ignore").length; 10204 if (controlsCount == 0) { 10205 groupContainer.find(".groups").css("height", 0); 10206 return; 10207 } else { 10208 groupContainer.find(".groups").css("height", ''); 10209 } 10210 groupContainer.find(`.groups section[data-group-id='${groupId}']`).addClass("active"); 10211 groupContainer.find(".more-wrapper").each(function () { 10212 var showMore = $(this).data("show-more"); 10213 if (!!showMore.init) showMore.init(); 10214 }); 10215 }); 10216 groupContainer.on("click", ".reset-group", function (e) { 10217 e.preventDefault(); 10218 var container = $(e.target).closest('section[data-group-id]'); 10219 container.find(".control").each(function () { 10220 var formFunctionsElement = $(this).find("[data-form-element-functions-added]"); 10221 if (formFunctionsElement.length > 0) { 10222 var formFunctions = formFunctionsElement.data("form-element-functions"); 10223 if (!!formFunctions.reset) formFunctions.reset(); 10224 } else { 10225 $(this).find("input[type='text']").each(function () { 10226 $(this).val(function () { 10227 return this.defaultValue; 10228 }); 10229 }); 10230 $(this).find("input[type='select']").each(function () { 10231 $(this).val('').change(); 10232 }); 10233 $(this).find("input[type='checkbox']").each(function () { 10234 $(this).prop('checked', false); 10235 }); 10236 $(this).find("input[type='radio']").each(function () { 10237 $(this).prop('checked', false); 10238 }); 10239 } 10240 }); 10241 }); 10242 }, 10243 addGroupElement($this, group, parent, templateUrl) { 10244 if (!parent || !parent.name) { 10245 return; 10246 } 10247 var groupContainer = privateFunctions.getGroupContainer(group); 10248 var alreadyIncluded = false;
10249 group.find(".group-names-container [data-group-id]").each(function () { 10250 var groupId = $(this).data("group-id"); 10251 if (groupId == parent.id) { 10252 alreadyIncluded = true; 10253 return false; 10254 } 10255 }); 10256 if (alreadyIncluded) { 10257 return; 10258 } 10259 var onlyHeader = $this.is("[data-only-header]"); 10260 var headerHiddenName = $this.data("header-hidden-name"); 10261 var dataExternalId = ""; 10262 if (!!parent.externalId) { 10263 dataExternalId = `data-external-id="${parent.externalId}"`; 10264 } 10265 if (!!onlyHeader) { 10266 var controlsCount = groupContainer.find(`.groups section[data-group-id='${parent.id}'] .control`).length; 10267 group.find(".group-names-container li.active").removeClass("active"); 10268 var deleteCategoryTranslation = window.ppt.translate("search.remove.category", "Kategorie löschen"); 10269 var showCategoryFilterTranslation = window.ppt.translate("search.filter.show", "Filter für Kategorie anzeigen"); 10270 group.find(".group-names-container").append(` 10271 <li data-group-id="${parent.id}" ${dataExternalId}> 10272 <span class="filter-content"> 10273 <i class="remove-group" title="${deleteCategoryTranslation}">â</i> 10274 <span class="ttip-blue tooltipstered" title="${showCategoryFilterTranslation}"> 10275 <span class="filter-name-group"> 10276 <span class="filter-name"> ${parent.name}</span> 10277 <i class="icon-filter"></i> 10278 </span> 10279 </span> 10280 </span> 10281 <input type="hidden" name="${headerHiddenName}" value="${parent.id}" /> 10282 </li>`); 10283 10284 //window.pixelpoint.tooltip.init(group.find(".group-names-container li")); 10285 window.pixelpoint.tooltip.init(group.find(".group-names-container li span")); 10286 group.parent().parent().parent().find("button.search-button").html(window.ppt.translate("button.now.searchagain", "Erneut suchen!")); 10287 privateFunctions.addHideShowIcon(group, true); 10288 return; 10289 } 10290 var index = group.data("count"); 10291 if (!index) { 10292 index = 0; 10293 } 10294 var loader = groupContainer.find('.loader[data-loader]'); 10295 var loaderFunctions = loader.data("exposed"); 10296 if (!!loaderFunctions) loaderFunctions.show(); 10297 var url = templateUrl; 10298 url = url.replace("[[parent.id]]", parent.id); 10299 url = url.replace("[[parent.name]]", parent.name); 10300 url = url.replace("[[index]]", index); 10301 $.ajax({ 10302 type: 'GET', 10303 url: url, 10304 dataType: 'html', 10305 data: {} 10306 }).done(function (response) { 10307 if (!response) return; 10308 var $response = $(response); 10309 group.find(".group-names-container li.active").removeClass("active"); 10310 var deleteCategoryTranslation = window.ppt.translate("search.remove.category", "Kategorie löschen"); 10311 var showCategoryFilterTranslation = window.ppt.translate("search.filter.show", "Filter für Kategorie anzeigen"); 10312 group.find(".group-names-container").append(` 10313 <li class="active" data-group-id="${parent.id}" ${dataExternalId}> 10314 <span class="filter-content"> 10315 <i class="remove-group" title="${deleteCategoryTranslation}">â</i> 10316 <span class="ttip-blue tooltipstered" title="${showCategoryFilterTranslation}"> 10317 <span class="filter-name-group"> 10318 <span class="filter-name"> ${parent.name}</span> 10319 <i class="icon-filter"></i> 10320 </span> 10321 </span> 10322 </span> 10323 <input type="hidden" name="${headerHiddenName}" value="${parent.id}" /> 10324 </li>`); 10325 window.pixelpoint.tooltip.init(group.find(".group-names-container li span")); 10326 group.parent().parent().parent().find("button.search-button").html(window.ppt.translate("button.now.searchagain", "Erneut suchen!")); 10327 groupContainer.find(".groups section.active").removeClass("active"); 10328 groupContainer.find(".groups").append($response); 10329 groupContainer.find(`.groups [data-group-id="${parent.id}"]`).addClass("active"); 10330 groupContainer.find(`.groups section[data-group-id='${parent.id}'] .control .brandenbutton.search-button`).closest('.control').addClass("ignore"); 10331 var controlsCount = groupContainer.find(`.groups section[data-group-id='${parent.id}'] .control`).not(".ignore").length;
10332 if (controlsCount == 0) { 10333 groupContainer.find(".groups").css("height", 0); 10334 return; 10335 } else { 10336 groupContainer.find(".groups").css("height", ''); 10337 } 10338 index += 1; 10339 group.data("count", index); 10340 groupContainer.find(".groups").show(); 10341 var searchHeight = group.closest(".search").height(); 10342 var searchOffset = group.closest(".search").offset().top; 10343 var groupOffset = groupContainer.find(".groups").offset().top; 10344 var realHeight = searchHeight - (groupOffset - searchOffset); 10345 groupContainer.find(".groups").css("max-height", realHeight); 10346 window.ppComponents.select2.initialize($response.find('select.select2')); 10347 window.ppComponents.select2.initializeRemote($response.find('select.autocomplete')); 10348 window.ppComponents.common.showMore($response.find('.more-wrapper')); 10349 window.ppComponents.common.sliders($response.find(".range-slider")); 10350 window.ppComponents.radioGroup.init($response.find("[data-radio-group]")); 10351 privateFunctions.recalculateGroupIndices(group); 10352 privateFunctions.showHideTourLength(); 10353 privateFunctions.showHideTitle(); 10354 privateFunctions.showHideFilterIcon(group); 10355 privateFunctions.addHideShowIcon(group, true); 10356 }).always(function () { 10357 if (!!loaderFunctions) loaderFunctions.hide(); 10358 }); 10359 }, 10360 showHideFilterIcon(group) { 10361 group.find(".group-names-container li").each(function () { 10362 var groupContainer = privateFunctions.getGroupContainer(group); 10363 var groupId = $(this).data("group-id"); 10364 if (!groupId) { 10365 $(this).find(".icon-filter").addClass("hide"); 10366 return; 10367 } 10368 groupContainer.find(`.groups section[data-group-id='${groupId}'] .control .brandenbutton.search-button`).closest('.control').addClass("ignore"); 10369 var controlsCount = groupContainer.find(`.groups section[data-group-id='${groupId}'] .control`).not(".ignore").length; 10370 if (controlsCount == 0) { 10371 $(this).find(".icon-filter").addClass("hide"); 10372 } else { 10373 $(this).find(".icon-filter").removeClass("hide"); 10374 } 10375 }); 10376 }, 10377 addHideShowIcon(group, initiallyOpen) { 10378 var groupContainer = privateFunctions.getGroupContainer(group); 10379 var count = $(".group-names-container li[data-group-id]").length; 10380 var list = group.find('ul.group-names-container'); 10381 initiallyOpen = initiallyOpen || false; 10382 if (count > 6) { 10383 if (list.hasClass("showmore")) { 10384 if (initiallyOpen) { 10385 window.ppComponents.showMore.open(group.find("button.einklappen")); 10386 } 10387 return; 10388 } 10389 if (!initiallyOpen) list.addClass("showmore collapsed");else list.addClass("showmore"); 10390 var id = group.data("input-group"); 10391 list.data("id", id).attr("data-id", id); 10392 if (group.find("button.einklappen").length == 0) { 10393 var active = 'active'; 10394 if (!!initiallyOpen) active = ''; 10395 var showFilterTranslation = window.ppt.translate("filter.show", "Kategorienauswahl und Filter anzeigen"); 10396 //var filterTranslation = window.ppt.translate("filter","Kategorienauswahl & Filter"); 10397 var filterTranslation = window.ppt.translate("filter.open", "aufklappen"); 10398 var einklappenTranslation = window.ppt.translate("filter.collapse", "einklappen"); 10399 group.append(`<button class="einklappen ${active}" data-target="${id}" title="${showFilterTranslation}" aria-label="${showFilterTranslation}" data-close-title="${einklappenTranslation}" data-default-title="${showFilterTranslation}"> 10400 <div class="text"> 10401 <span class="text1">${filterTranslation}</span> 10402 <span class="text2">${einklappenTranslation}</span> 10403 </div> 10404 <i class="icon-down-open-big" data-active="icon-up-open-big"></i> 10405 </button>`); 10406 } else { 10407 group.find("button.einklappen").removeClass("hide"); 10408 if (!initiallyOpen) { 10409 group.find("button.einklappen").addClass("active"); 10410 } else { 10411 group.find("button.einklappen").removeClass("active"); 10412 } 10413 }
10414 window.ppComponents.common.showMore(list); // showMore.init(list); 10415 } else { 10416 if (!list.hasClass("showmore")) return; 10417 list.removeClass("showmore"); 10418 group.find("button.einklappen").addClass("hide"); 10419 } 10420 } 10421 }; 10422 window.pixelpoint.ppComponents.groupExtension = function ($this) { 10423 //var $this = $(this); 10424 var groupName = $this.data("group-selector"); 10425 if (!groupName) return; 10426 var group = $(`[data-input-group='${groupName}']`); 10427 if (group.length == 0) return; 10428 var groupContainerParent = privateFunctions.getGroupContainer(group); 10429 var groupNames = group.find(".group-names-container"); 10430 var groupContainer = groupContainerParent.find(".groups"); 10431 if (groupNames.length == 0 || groupContainer.length == 0) return; 10432 var templateUrl = group.data("template-url"); 10433 if (!templateUrl) return; 10434 privateFunctions.bindGroupEvents(group, $this); 10435 privateFunctions.showHideFilterIcon(group); 10436 privateFunctions.addHideShowIcon(group); 10437 if (!$this.is('[data-supress-group-creation]')) { 10438 if ($this.hasClass("select2-hidden-accessible")) { 10439 $this.on("select2:select", function (e) { 10440 var data = $this.select2("data"); 10441 if (!!data) { 10442 let allIds = []; 10443 for (var i in data) { 10444 var currentId = data[i].id; 10445 var parts = currentId.split(":"); 10446 currentId = parts[0]; 10447 allIds.push(currentId); 10448 var currentExternalId = parts.length > 1 ? parts[1] : ""; 10449 var parent = { 10450 id: currentId, 10451 externalId: currentExternalId, 10452 name: data[i].text 10453 }; 10454 privateFunctions.addGroupElement($this, group, parent, templateUrl); 10455 } 10456 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.categoryChanged, [allIds]); 10457 } 10458 $this.val([]).trigger('change'); 10459 }); 10460 } else { 10461 $this.on("change", function () { 10462 var parents = []; 10463 $this.find(":selected").each(function () { 10464 parents.push({ 10465 id: $(this).val(), 10466 name: $(this).text() 10467 }); 10468 }); 10469 for (var i in parents) { 10470 privateFunctions.addGroupElement($this, group, parents[i], templateUrl); 10471 } 10472 $this.prop("selectedIndex", 0); 10473 }); 10474 } 10475 } 10476 }; 10477 $("[data-group-selector]").each(function () { 10478 window.pixelpoint.ppComponents.groupExtension($(this)); 10479 }); 10480}); 10481//include 10 10482jQuery(function () { 10483 var privateFunctions = { 10484 /* 10485 alreadyRated(id) { 10486 if (!id) 10487 return false; 10488 var rating = window.pixelpoint.sessionService.get("rating-" + id); 10489 return !!rating; 10490 }, 10491 sendRating(id, rating, callback) { 10492 if (!id) 10493 return; 10494 //here we send the rating, probably some ajax call 10495 window.pixelpoint.sessionService.set("rating-" + id, rating); 10496 if (!!callback) 10497 callback(); 10498 } 10499 //*/ 10500 sendRating(pp_id, pp_type, rating, callback) { 10501 var ratingEndpoint = window.pixelpoint.utilities.getAjaxUrl(`/index.php?type=1732176051&action=rate`); 10502 $.ajax({ 10503 url: ratingEndpoint, 10504 type: "POST", 10505 data: { 10506 "pp_id": pp_id, 10507 "pp_type": pp_type, 10508 "value": rating 10509 }, 10510 success: function (data) { 10511 if (!!callback) callback(data.success); 10512 }, 10513 error: function () { 10514 if (!!callback) callback(false); 10515 } 10516 }); 10517 } 10518 }; 10519 $("[data-ratings]").each(function () { 10520 var $this = $(this); 10521 var parent = $this.closest(".rate"); 10522 var lityInstance = null; 10523 $this.find(".heart").on("mouseover", function () { 10524 if (parent.hasClass("inactive")) { 10525 return; 10526 } 10527 $(this).prevAll().addClass("hovered"); 10528 $(this).addClass("hovered"); 10529 }); 10530 $this.find(".heart").on("mouseleave", function () { 10531 if (parent.hasClass("inactive")) { 10532 return; 10533 } 10534 $this.find(".heart").removeClass("hovered"); 10535 }); 10536 10537 //the cancel action will be the same on every click 10538 parent.find(".rating-confirm .cancel").on("click touchstart", function () { 10539 if (lityInstance != null) { 10540 lityInstance.close(); 10541 lityInstance = null; 10542 } 10543 }); 10544 $this.find(".heart").on("click touchstart", function () { 10545 if (parent.hasClass("inactive")) { 10546 return; 10547 } 10548 var rating = $this.find(".heart.hovered").length; 10549 if (rating == 0) { 10550 rating = $(this).closest(".heart").index() + 1; 10551 } 10552 var pp_id = $this.data("pp-id"); 10553 var pp_type = $this.data("pp-type"); 10554 if (!rating || !pp_id || !pp_type) return; 10555 var heart = $(this); 10556 if (parent.find(".rating-confirm .confirm-message .rate-count").length == 0) { 10557 let currentText = parent.find(".rating-confirm .confirm-message").text(); 10558 currentText = currentText.replace("%s", rating); 10559 parent.find(".rating-confirm .confirm-message").text(currentText); 10560 } else { 10561 parent.find(".rating-confirm .confirm-message .rate-count").text(rating); 10562 } 10563 parent.find(".rating-confirm .confirm").off("click touchstart").on("click touchstart", function () { 10564 heart.prevAll().addClass("hovered"); 10565 heart.addClass("hovered"); 10566 privateFunctions.sendRating(pp_id, pp_type, rating, function (success) { 10567 if (success) { 10568 parent.addClass("inactive"); 10569 } 10570 window.pixelpoint.modal.open(window.ppt.translate("rating.success", "Vielen Dank für Ihre Bewertung. Diese wird in den kommenden Stunden auch für andere Nutzer sichtbar."), window.ppt.translate("rating.success.title", "Ihre Bewertung wurde abgegeben")); 10571 }); 10572 if (lityInstance != null) { 10573 lityInstance.close(); 10574 lityInstance = null; 10575 } 10576 }); 10577 lityInstance = lity(".rating-confirm", { 10578 esc: false, 10579 template: '<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>' 10580 }); 10581 }); 10582 }); 10583 $(".rating-wrapper .item.bewertung").on("click", evt => { 10584 let idSelector = $(evt.target).closest("a").attr("href"); 10585 if ($(idSelector).length > 0) lity($(idSelector)); 10586 }); 10587}); 10588//include 10 10589jQuery(function () { 10590 var privateFunctions = { 10591 disable(component) { 10592 component.find("select").each(function () { 10593 $(this).prop("disabled", true); 10594 }); 10595 component.data("disabled", true); 10596 component.addClass("hide"); 10597 }, 10598 enable(component) { 10599 component.removeClass("hide"); 10600 component.data("disabled", false); 10601 component.find("select").each(function () { 10602 $(this).prop("disabled", false); 10603 }); 10604 }, 10605 change(component, number) { 10606 var disabled = component.data("disabled"); 10607 if (!!disabled) return; 10608 component.find(".control").addClass("hide"); 10609 component.find("select").prop("disabled", true); 10610 for (var i = 1; i <= number; i++) { 10611 var control = component.find(`.belegung-row-${i}`); 10612 if (control.length > 0) { 10613 control.removeClass("hide"); 10614 control.find("select").prop("disabled", false); 10615 } 10616 } 10617 }, 10618 get(component) { 10619 var result = []; 10620 component.find(".control").each(function () { 10621 var $this = $(this); 10622 var adults = $this.find("select.adults-select").val(); 10623 var kid1 = $this.find("select.kid1-select").val(); 10624 var kid2 = $this.find("select.kid2-select").val(); 10625 var kid3 = $this.find("select.kid3-select").val(); 10626 var kid4 = $this.find("select.kid4-select").val(); 10627 var kids = 0; 10628 var ages = {}; 10629 var agesArray = []; 10630 if (!isNaN(kid1) && kid1 != "" && kid1 >= 0) { 10631 //ages.kid1 = kid1; 10632 agesArray.push(kid1); 10633 //kids++; 10634 } 10635 if (!isNaN(kid2) && kid2 != "" && kid2 >= 0) { 10636 //ages.kid2 = kid2; 10637 agesArray.push(kid2); 10638 //kids++; 10639 } 10640 if (!isNaN(kid3) && kid3 != "" && kid3 >= 0) { 10641 //ages.kid3 = kid3; 10642 agesArray.push(kid3); 10643 //kids++; 10644 } 10645 if (!isNaN(kid4) && kid4 != "" && kid4 >= 0) { 10646 //ages.kid4 = kid4; 10647 agesArray.push(kid4); 10648 //kids++; 10649 } 10650 kids = agesArray.length; 10651 $.each(agesArray, function (index, age) { 10652 ages['kid' + (index + 1)] = age; 10653 }); 10654 result.push({ 10655 'adults': adults, 10656 'kids': kids, 10657 'ages': ages 10658 }); 10659 }); 10660 return result; 10661 }, 10662 set(component, index, visitors) { 10663 var control = component.find(`.control.belegung-row-${index}`); 10664 if (control.length == 0) return; 10665 component.data("suppress-change-event", true); 10666 if (!!visitors && !!visitors.adults) { 10667 control.find("select.adults-select").val(visitors.adults).trigger("change"); 10668 } else { 10669 control.find("select.adults-select").val("").trigger("change"); 10670 } 10671 if (!!visitors && !!visitors.ages && visitors.ages.hasOwnProperty('kid1') && !isNaN(visitors.ages.kid1)) { 10672 control.find("select.kid1-select").val(visitors.ages.kid1).trigger("change"); 10673 } else { 10674 control.find("select.kid1-select").val("").trigger("change"); 10675 } 10676 if (!!visitors && !!visitors.ages && visitors.ages.hasOwnProperty('kid2') && !isNaN(visitors.ages.kid2)) { 10677 control.find("select.kid2-select").val(visitors.ages.kid2).trigger("change"); 10678 } else { 10679 control.find("select.kid2-select").val("").trigger("change"); 10680 } 10681 if (!!visitors && !!visitors.ages && visitors.ages.hasOwnProperty('kid3') && !isNaN(visitors.ages.kid3)) { 10682 control.find("select.kid3-select").val(visitors.ages.kid3).trigger("change"); 10683 } else { 10684 control.find("select.kid3-select").val("").trigger("change"); 10685 } 10686 if (!!visitors && !!visitors.ages && visitors.ages.hasOwnProperty('kid4') && !isNaN(visitors.ages.kid4)) { 10687 control.find("select.kid4-select").val(visitors.ages.kid4).trigger("change"); 10688 } else { 10689 control.find("select.kid4-select").val("").trigger("change"); 10690 } 10691 component.data("suppress-change-event", false); 10692 } 10693 }; 10694 window.pixelpoint.ppComponents.belegung = function ($this) { 10695 //var $this = $(this); 10696 var eventsPostfix = $this.data("events-postfix"); 10697 if (!eventsPostfix) return; 10698 $this.on("change", ".belegung-row-1 select", function () { 10699 if (!!$this.data("suppress-change-event")) { 10700 return; 10701 } 10702 if (!!$this.data("disabled")) return; 10703 var visitors = privateFunctions.get($this); 10704 if (visitors.length == 0) return; 10705 window.pixelpoint.pubSub.publish(`${window.pixelpoint.pubSub.events.belegungChange}:${eventsPostfix}`, [visitors[0]]); 10706 }); 10707 window.pixelpoint.pubSub.subscribe(`${window.pixelpoint.pubSub.events.slidersEventEnable}:${eventsPostfix}`, function () { 10708 privateFunctions.enable($this); 10709 }); 10710 window.pixelpoint.pubSub.subscribe(`${window.pixelpoint.pubSub.events.slidersEventDisable}:${eventsPostfix}`, function () { 10711 privateFunctions.disable($this); 10712 }); 10713 window.pixelpoint.pubSub.subscribe(`${window.pixelpoint.pubSub.events.slidersEventChange}:${eventsPostfix}`, function (e, value) { 10714 privateFunctions.change($this, value); 10715 }); 10716 window.pixelpoint.pubSub.subscribe(`${window.pixelpoint.pubSub.events.belegungChange}:inverse:${eventsPostfix}`, function (e, visitors) { 10717 privateFunctions.set($this, 1, visitors); 10718 }); 10719 }; 10720 $(".belegung-component").each(function () { 10721 window.pixelpoint.ppComponents.belegung($(this)); 10722 }); 10723}); 10724//include 4 10725jQuery(function () { 10726 var template = `<div class="modal"> 10727 <div class="row"> 10728 <div class="columns large-12"> 10729 <% if(!!title){ %> 10730 <h2 class="capital-blue"><%= title %></h2> 10731 <% } %> 10732 <% if(!!message){ %> 10733 <p><%= message %></p> 10734 <% } %> 10735 </div> 10736 </div> 10737 </div>`; 10738 var lityInstance = null; 10739 var compiled = _.template(template); 10740 var privateFunctions = { 10741 open(message, title) { 10742 title = title || null; 10743 var html = compiled({ 10744 message: message, 10745 title: title 10746 }); 10747 if (typeof html == "function") html = html({ 10748 message: message, 10749 title: title 10750 }); 10751 if (lityInstance != null) { 10752 lityInstance.close(); 10753 } 10754 lityInstance = lity(html); 10755 return lityInstance; 10756 }, 10757 close() { 10758 if (lityInstance != null) { 10759 lityInstance.close(); 10760 lityInstance = null; 10761 } 10762 } 10763 }; 10764 window.pixelpoint.modal = { 10765 open: privateFunctions.open, 10766 close: privateFunctions.close 10767 }; 10768}); 10769//include 4 10770jQuery(function () { 10771 window.pixelpoint.ppComponents.quickClear = function ($this) { 10772 //var $this = $(this); 10773 var clearButton = $(`<i class="clear-input top-left">Ã</i>`); 10774 if (!$this.val()) { 10775 clearButton.addClass("hide"); 10776 } 10777 $this.parent().append(clearButton); 10778 $this.on("change keyup", function () { 10779 if ($this.val()) { 10780 clearButton.removeClass("hide"); 10781 } else { 10782 clearButton.addClass("hide"); 10783 } 10784 }); 10785 clearButton.on("click", function () { 10786 $this.val("").change(); 10787 }); 10788 }; 10789 $("[data-quick-clear]").each(function () { 10790 window.pixelpoint.ppComponents.quickClear($(this)); 10791 }); 10792}); 10793//include 10 10794jQuery(function () { 10795 window.ppComponents = window.ppComponents || {}; 10796 window.ppComponents.select2months = window.ppComponents.select2months || {}; 10797 var monthShortcuts = { 10798 'januar': window.ppt.translate('date.january.short', 'Jan'), 10799 'februar': window.ppt.translate('date.february.short', 'Feb'), 10800 'march': window.ppt.translate('date.march.short', 'Mar'), 10801 'april': window.ppt.translate('date.april.short', 'Apr'), 10802 'may': window.ppt.translate('date.may.short', 'Mai'),
10803 'june': window.ppt.translate('date.june.short', 'Jun'), 10804 'july': window.ppt.translate('date.july.short', 'Jul'), 10805 'august': window.ppt.translate('date.august.short', 'Aug'), 10806 'september': window.ppt.translate('date.september.short', 'Sep'), 10807 'october': window.ppt.translate('date.october.short', 'Okt'), 10808 'november': window.ppt.translate('date.november.short', 'Nov'), 10809 'dezember': window.ppt.translate('date.dezember.short', 'Dez') 10810 }; 10811 var privateFunctions = { 10812 updateSelection(data, adapter) { 10813 adapter.clear(); 10814 if (data.length === 0) { 10815 return; 10816 } 10817 var $selections = []; 10818 for (var d = 0; d < data.length; d++) { 10819 var selection = data[d]; 10820 var $selection = adapter.selectionContainer(); 10821 var formatted = adapter.display(selection, $selection); 10822 $selection.append(formatted); 10823 $selection.prop('title', selection.title || selection.text); 10824 $selection.data('data', selection); 10825 $selections.push($selection); 10826 } 10827 var $rendered = adapter.$selection.find('.select2-selection__rendered'); 10828 Utils.appendMany($rendered, $selections); 10829 } 10830 }; 10831 10832 //********************************************************************************** */ 10833 //********************************************************************************** */ 10834 10835 $.fn.select2.amd.define('select2/selection/customSelection', ['select2/selection/multiple', 'select2/utils'], function (Multiple, Utils) { 10836 function CustomMultiple($element, options) { 10837 CustomMultiple.__super__.constructor.call(this, $element, options); 10838 } 10839 Utils.Extend(CustomMultiple, Multiple); 10840 CustomMultiple.prototype.selectionContainer = function () { 10841 var $container = $('<li class="select2-selection__choice months">' + '</li>'); 10842 return $container; 10843 }; 10844 10845 //small helper function 10846 var isInDataArray = function (data, id) { 10847 var isInData = false; 10848 $.each(data, function (i, d) { 10849 if (d.id == id) { 10850 isInData = true; 10851 return false; 10852 } 10853 }); 10854 return isInData; 10855 }; 10856 CustomMultiple.prototype.createPlaceholder = function () { 10857 var placeholder = this.$element.data("placeholder") || this.$element.attr("placeholder"); 10858 var $placeholder = `<span class="select2-selection__placeholder months" title="${placeholder}">${placeholder}</span>`; 10859 this.$selection.closest('.select2-container').addClass("no-padding"); 10860 return $placeholder; 10861 }; 10862 CustomMultiple.prototype.createCloseButton = function () { 10863 var $closeButton = $('<a href="#" class="close-button">×</a>'); 10864 var self = this; 10865 $closeButton.on("click", function (e) { 10866 e.preventDefault(); 10867 self.clear(); 10868 self.$element.val("").change(); 10869 $closeButton.hide(); 10870 self.$selection.find('.select2-selection__rendered').append(self.createPlaceholder()); 10871 }); 10872 return $closeButton; 10873 }; 10874 CustomMultiple.prototype.update = function (data) { 10875 this.clear(); 10876 var $rendered = this.$selection.find('.select2-selection__rendered'); 10877 var $container = this.$selection.closest('.select2-container'); 10878 $container.removeClass("no-padding"); 10879 if (data.length === 0) { 10880 $rendered.append(this.createPlaceholder()); 10881 $container.find(".close-button").hide(); 10882 return; 10883 } 10884 if ($container.find(".close-button").length == 0) { 10885 $container.append(this.createCloseButton()); 10886 } 10887 $container.find(".close-button").show(); 10888 var $selections = []; 10889 10890 //*----------------------------- 10891 var included = [{ 10892 id: 'januar', 10893 included: false 10894 }, { 10895 id: 'februar', 10896 included: false 10897 }, { 10898 id: 'march', 10899 included: false 10900 }, { 10901 id: 'april', 10902 included: false 10903 }, { 10904 id: 'may', 10905 included: false 10906 }, { 10907 id: 'june', 10908 included: false 10909 }, { 10910 id: 'july', 10911 included: false 10912 }, { 10913 id: 'august', 10914 included: false 10915 }, { 10916 id: 'september',
10917 included: false 10918 }, { 10919 id: 'october', 10920 included: false 10921 }, { 10922 id: 'november', 10923 included: false 10924 }, { 10925 id: 'dezember', 10926 included: false 10927 }]; 10928 var results = []; 10929 var selections = []; 10930 for (var m = 0; m < included.length; m++) { 10931 if (included[m].included) continue; 10932 if (!isInDataArray(data, included[m].id)) { 10933 continue; 10934 } 10935 var result = monthShortcuts[included[m].id]; 10936 included[m].included = true; 10937 selections.push({ 10938 id: included[m].id, 10939 text: included[m].id 10940 }); 10941 var monthToIndex = m; 10942 for (var i = m; i < included.length; i++) { 10943 if (!isInDataArray(data, included[i].id)) break; 10944 monthToIndex = i; 10945 } 10946 if (monthToIndex > m + 1) { 10947 for (var i = m + 1; i <= monthToIndex; i++) { 10948 included[i].included = true; 10949 selections.push({ 10950 id: included[i].id, 10951 text: included[i].id 10952 }); 10953 } 10954 result += "-" + monthShortcuts[included[monthToIndex].id]; 10955 } 10956 results.push(result); 10957 } 10958 var displayString = results.join(", "); 10959 var $selection = this.selectionContainer(); 10960 var selection = { 10961 text: displayString, 10962 id: displayString 10963 }; 10964 var formatted = this.display(selection, $selection); 10965 $selection.append(formatted); 10966 $selection.data('data', selections); 10967 $selections.push($selection); 10968 //----------------------------- */ 10969 10970 Utils.appendMany($rendered, $selections); 10971 }; 10972 return CustomMultiple; 10973 }); 10974 var customSelect = $.fn.select2.amd.require('select2/selection/customSelection'); 10975 //********************************************************************************** */ 10976 /********************************************************************************** */ 10977 10978 window.ppComponents.select2months.initialize = function (elements) { 10979 elements.each(function () { 10980 var placeholdertext = $(this).attr('placeholder'); 10981 var cssClass = $(this).data('dropdown-css-class') || ""; 10982 var allowClear = $(this).data('allow-clear') || false; 10983 var $this = $(this); 10984 if (!placeholdertext) { 10985 var emptyOption = $(this).find("option[value='']"); 10986 if (emptyOption.length > 0) { 10987 placeholdertext = emptyOption.text(); 10988 } else { 10989 placeholdertext = ""; 10990 } 10991 } 10992 var placeholder = { 10993 id: "", 10994 text: placeholdertext 10995 }; 10996 $this.select2({ 10997 placeholder: placeholder, 10998 selectOnClose: false, 10999 selectionAdapter: customSelect, 11000 minimumResultsForSearch: Infinity, 11001 // preventing the searchbox 11002 dropdownCssClass: cssClass 11003 }); 11004 11005 //var $this = $(this); 11006 11007 /*var enableResizableText = $this.is("[data-resizable-text]"); 11008 $this.off("select2:select").on("select2:select", function (e) { 11009 if (enableResizableText) { 11010 var selectionWrapper = $this.parent().find(".selection"); 11011 var rendered = selectionWrapper.find(".select2-selection__rendered"); 11012 rendered.css("font-size", ""); 11013 var parentWidth = selectionWrapper.width(), 11014 parentHeight = selectionWrapper.height(), 11015 width = rendered.width(), 11016 height = rendered.height(); 11017 var computedStyle = window.getComputedStyle($this[0]); 11018 var fontsize = computedStyle.getPropertyValue('font-size'); 11019 fontsize = parseFloat(fontsize); 11020 while (width > (parentWidth - 25) || height > parentHeight) { 11021 fontsize *= 0.95; 11022 rendered.css("font-size", fontsize + "px"); 11023 width = rendered.width(); 11024 height = rendered.height(); 11025 } 11026 } 11027 });*/ 11028 }); 11029 }; 11030 window.ppComponents.select2months.initialize($('.month-select')); 11031 if (!window.pixelpoint.isMobile.any()) { 11032 $('body').on("select2:open", ".select2.hoversupport", function (e) { 11033 $(this).parents('.menu-level-1,.supersection').removeClass('hover').addClass('hover'); 11034 }); 11035 $('body').on("select2:close", ".select2.hoversupport", function (e) { 11036 var that = $(this); 11037 setTimeout(function (e) { 11038 $(that).parents('.menu-level-1,.supersection').removeClass('hover'); 11039 }, 100); 11040 }); 11041 } 11042 $(window).on("orientationchange", function () { 11043 $(".month-select.select2-hidden-accessible").each(function () { 11044 var self = $(this); 11045 self.select2("destroy"); 11046 setTimeout(function () { 11047 window.ppComponents.select2months.initialize(self); 11048 }, 50); 11049 }); 11050 }); 11051}); 11052//include 9
11053jQuery(function () { 11054 var endpoint = window.pixelpoint.domainService.get('apiEndpoint') + "search/meta/%Q%"; 11055 var delay = 250; 11056 var allowed = ['regions', 'locations', 'aquaticsdistrict', 'nationallandscapes', 'excursions']; 11057 var translations = { 11058 'default': window.ppt.translate('default', 'Default'), 11059 'regions': window.ppt.translate('regions', 'Regionen'), 11060 'locations': window.ppt.translate('locations', 'Orte'), 11061 'pois': window.ppt.translate('pois', 'Pois'), 11062 'aquaticsdistrict': window.ppt.translate('watersportregions', 'Wassersportreviere'), 11063 'nationallandscapes': window.ppt.translate('nationallandscapes', 'Nationale Naturlandschaften'), 11064 'excursions': window.ppt.translate('excursionregions', 'Ausflugsregionen') 11065 }; 11066 var mapTypeMappings = { 11067 'default': 'excursion.default', 11068 'regions': 'excursion.region', 11069 'locations': 'excursion.location', 11070 'pois': 'excursion.add', 11071 'aquaticsdistrict': 'excursion.aquaticsdistrict', 11072 'nationallandscapes': 'excursion.nationallandscapes', 11073 'excursions': 'excursion.excursions' 11074 }; 11075 var privateFunctions = { 11076 init(element) { 11077 if (element.hasClass("trip-initialised")) { 11078 return; 11079 } 11080 element.addClass("trip-initialised"); 11081 var selectElement = element.find("[data-trip-select]"); 11082 var triggerButton = element.find("[data-trip-add]"); 11083 triggerButton.attr("target", "_blank"); 11084 var cssClass = selectElement.data("dropdown-css-class") || ""; 11085 if (selectElement.length == 0 || triggerButton.length == null) { 11086 return; 11087 } 11088 11089 //************************************************************************************** */ 11090 var dataSources = []; 11091 $.each(allowed, function (index, single) { 11092 var engine = new Bloodhound({ 11093 queryTokenizer: Bloodhound.tokenizers.whitespace, 11094 datumTokenizer: Bloodhound.tokenizers.whitespace, 11095 remote: { 11096 url: endpoint, 11097 cache: false, 11098 wildcard: '%Q%', 11099 transform(data) { 11100 if (!!data[single]) { 11101 return _.map(data[single], function (item, name) { 11102 item.group = single; 11103 return item; 11104 }); 11105 } 11106 return []; 11107 } 11108 } 11109 }); 11110 var translation = translations[single]; 11111 dataSources.push({ 11112 name: single, 11113 display: 'name', 11114 source: engine, 11115 limit: 100, 11116 templates: { 11117 header: `<h3>${translation}</h3>`, 11118 suggestion: function (data) { 11119 var word = data.name; 11120 var searchQuery = selectElement.val(); 11121 word = word.replace(new RegExp(searchQuery, 'gi'), `<strong>$&</strong>`); 11122 return `<div>${word}</div>`; 11123 } 11124 } 11125 }); 11126 }); 11127 selectElement.typeahead(null, dataSources); 11128 selectElement.bind('typeahead:selected', function (obj, selected) { 11129 selectElement.data('selected-id', selected.group + ":" + selected.id); 11130 selectElement.data('last-selected-name', selected.name); 11131 }); 11132 selectElement.on("blur", function () { 11133 var currentValue = selectElement.val(); 11134 if (!currentValue) return; 11135 var lastSelectedName = selectElement.data('last-selected-name'); 11136 if (lastSelectedName != currentValue) selectElement.val(""); 11137 }); 11138 triggerButton.off("click touchstart").on("click touchstart", function (e) { 11139 var value = selectElement.data("selected-id"); 11140 var type = ""; 11141 var id = 0; 11142 if (!!value) { 11143 var [type, id] = value.split(":"); 11144 } 11145 if (!type) type = "default"; 11146 11147 //**** tag manager stuff ***********/ 11148 var translation = translations[type] || type; 11149 var locationName = selectElement.data('last-selected-name');
11150 window.pixelpoint.tagManager.event("PlanTrip", { 11151 type: translation, 11152 name: locationName 11153 }); 11154 11155 //**** ***************** ***********/ 11156 11157 type = mapTypeMappings[type]; 11158 var options = {}; 11159 if (!!id) { 11160 options = { 11161 id: id 11162 }; 11163 } 11164 if (window.pixelpoint.isMobile.any()) { 11165 var link = window.pixelpoint.map.getLink(type, options); 11166 triggerButton.attr("href", link); 11167 } else { 11168 e.preventDefault(); 11169 window.pixelpoint.map.open(type, options); 11170 } 11171 }); 11172 } 11173 }; 11174 window.pixelpoint.map = window.pixelpoint.map || {}; 11175 window.pixelpoint.map.trip = { 11176 init(elements) { 11177 elements.each(function () { 11178 privateFunctions.init($(this)); 11179 }); 11180 } 11181 }; 11182 window.pixelpoint.map.trip.init($("[data-select-trip-start]")); 11183 11184 //**********a hack****** 11185 $(".twitter-typeahead input").each(function () { 11186 var placeholder = $(this).data("placeholder") || ""; 11187 if (!!placeholder) { 11188 $(this).attr("aria-label", placeholder); 11189 } 11190 }); 11191 //********************** 11192}); 11193//include 9 11194//console.log("WTF"); 11195jQuery(function () { 11196 var container = $(".anreiseplanner-box"); 11197 if (container.length == 0) return; 11198 var privateFunctions = { 11199 getDirections(id, type, transport, address, e, $this, target) { 11200 var argts = { 11201 id: id, 11202 type: type, 11203 transport: transport 11204 }; 11205 var maplink = 'directions.default'; 11206 if (!!target) { 11207 argts.target = target; 11208 maplink = 'directions.defaulttarget'; 11209 if (!!address) { 11210 argts.address = address; 11211 maplink = 'directions.addresses'; 11212 } 11213 } else { 11214 if (!!address) { 11215 argts.address = address; 11216 maplink = 'directions.address'; 11217 } 11218 } 11219 if (!window.pixelpoint.isMobile.any()) { 11220 e.preventDefault(); 11221 window.pixelpoint.map.open(maplink, argts); 11222 } else { 11223 var link = window.pixelpoint.map.getLink(maplink, argts); 11224 if (!!link) { 11225 $this.attr("href", link); 11226 } 11227 } 11228 } 11229 }; 11230 container.each(function () { 11231 var $this = $(this); 11232 var id = $this.data('id'); 11233 var type = $this.data('type') || 'poi'; 11234 if (!id) return; 11235 var input = $this.find("input.address-input"); 11236 var targetInput = $this.find('input.target-input'); 11237 var targetAddress = targetInput.length > 0 ? targetInput.val() : null; 11238 $this.on("click", ".brandenbutton", function (e) { 11239 $(this).attr("target", "_blank"); 11240 var address = input.val(); 11241 var transport = $this.find('input[name="transportation"]:checked').val() || 'car'; 11242 privateFunctions.getDirections(id, type, transport, address, e, $(this), targetAddress); 11243 }); 11244 }); 11245}); 11246//include 9 11247jQuery(function () { 11248 var select = $(".meta-select"); 11249 if (select.length == 0) return; 11250 var placeholder = select.attr("placeholder") || ""; 11251 var selectData = []; 11252 select.find("option").each(function () { 11253 var isSelected = $(this).attr("value") == select.val(); 11254 var data = { 11255 id: $(this).attr("value"), 11256 active: isSelected, 11257 count: $(this).data("count"), 11258 text: $(this).text() 11259 }; 11260 selectData.push(data); 11261 }); 11262 select.select2({ 11263 data: selectData, 11264 placeholder: placeholder, 11265 minimumResultsForSearch: Infinity, 11266 templateResult: function (element) { 11267 return $('<p class="meta-selection"><span>' + element.text + '</span><i>(' + element.count + ')</i></p>'); 11268 }, 11269 templateSelection: function (element) { 11270 return $('<p class="meta-selection selected"><span>' + element.text + '</span><i>(' + element.count + ')</i></p>'); 11271 } 11272 }); 11273 select.on("change", function (e) { 11274 window.location.href = select.val(); 11275 }); 11276}); 11277//include 4 11278jQuery(function () { 11279 // Hide CTA when empty 11280 if ($("#offer-badge-video-header").length == 1 && $(".dce-header .video-cta-content").length != 4) { 11281 var $active = $(".dce-header .custom-video-switcher a.active"); 11282 var activeId = $active.attr("id").split("-link"); 11283 activeId = activeId[0]; 11284 if ($("#" + activeId + "-cta").length == 0) { 11285 $("#offer-badge-video-header").hide(); 11286 } 11287 } 11288 11289 // Click Custom Video Switcher 11290 $('.dce-header .custom-video-switcher a').click(function (e) { 11291 e.preventDefault(); 11292 var beforeSeason = $(".dce-header .custom-video-switcher a.active").attr("id").split("-link"); 11293 beforeSeason = beforeSeason[0]; 11294 var $this = $(this); 11295 var itemSeason = $this.attr("id").split("-link"); 11296 itemSeason = itemSeason[0]; 11297 setTimeout(function () { 11298 $this.tooltipster('hide'); 11299 }, 100); 11300 if (beforeSeason != itemSeason) { 11301 // remove active-class on before Season 11302 $("#" + beforeSeason + "-link").removeClass("active"); 11303 $("#" + beforeSeason + "-cta").removeClass("active"); 11304 $("#" + beforeSeason + "-li").removeClass("active"); 11305 if ($("#" + beforeSeason + "-li .video-loader").length > 0) { 11306 $("#" + beforeSeason + "-li .video-loader").hide(); 11307 } 11308 11309 // add active-class on new season 11310 $("#" + itemSeason + "-link").addClass("active"); 11311 $("#" + itemSeason + "-cta").addClass("active"); 11312 $("#" + itemSeason + "-li").addClass("active"); 11313 11314 // show/hide cta 11315 if ($("#" + itemSeason + "-cta").length == 0) { 11316 $("#offer-badge-video-header").hide(); 11317 } else { 11318 if (!$("#offer-badge-video-header").is(":visible")) { 11319 $("#offer-badge-video-header").fadeIn(800); 11320 } 11321 } 11322 11323 // play/pause Video 11324 if ($("#" + beforeSeason + "-li").find("video").length > 0) { 11325 var videoStatus = "pause"; 11326 var beforeVideoId = $("#" + beforeSeason + "-li").find("video").attr("id"); 11327 var beforeVideo = document.getElementById(beforeVideoId); 11328 if (beforeVideo.paused) { 11329 videoStatus = "pause"; 11330 } else { 11331 videoStatus = "play"; 11332 beforeVideo.pause(); 11333 } 11334 if (videoStatus == "play") { 11335 playPauseVideo(document.getElementById(itemSeason)); 11336 } else { 11337 $("#" + itemSeason + "-li .icon-play").show(); 11338 $("#" + itemSeason + "-li .teaser-box").show(); 11339 } 11340 var videoId = $("#" + itemSeason + "-li").find("video").attr("id"); 11341 var video = document.getElementById(videoId); 11342 } 11343 } 11344 }); 11345 $('.dce-header .video-wrapper').click(function (e) { 11346 var videoId = $(this).find(">.header-video").attr("id"); 11347 playPauseVideo(document.getElementById(videoId)); 11348 }); 11349}); 11350function playPauseVideo($video) { 11351 if ($video.paused) { 11352 $(".dce-header .video.active .video-loader").show(); 11353 if ($video.readyState >= $video.HAVE_FUTURE_DATA) { 11354 $(".dce-header .video.active .video-loader").hide(); 11355 } else { 11356 $video.addEventListener('canplay', function () { 11357 // playing, oncanplaythrough, oncanplay 11358 $(".dce-header .video.active .video-loader").hide(); 11359 }, false); 11360 } 11361 $video.play();
11362 window.pixelpoint.tagManager.event("Header-Video spielbeginn", {}); 11363 var endedEventFunction = function () { 11364 $video.currentTime = 0; 11365 $video.pause(); 11366 $(".dce-header .video.active .video-wrapper .icon-play").show(); 11367 $(".dce-header .video.active .teaser-box").show(); 11368 window.pixelpoint.tagManager.event("Header-Video abgespielt", {}); 11369 }; 11370 11371 //$video.removeEventListener('ended',endedEventFunction,true); 11372 //$video.addEventListener('ended', endedEventFunction); 11373 $video.onended = endedEventFunction; 11374 11375 //$('.dce-header .video-wrapper .icon-play').hide(); 11376 $(".dce-header .video.active .video-wrapper .icon-play").hide(); 11377 $(".dce-header .video.active .teaser-box").hide(); 11378 } else { 11379 $video.pause(); 11380 window.pixelpoint.tagManager.event("Header-Video pause", {}); 11381 $(".dce-header .video.active .video-loader").hide(); 11382 11383 //$('.dce-header .video-wrapper .icon-play').show(); 11384 $(".dce-header .video.active .video-wrapper .icon-play").show(); 11385 $(".dce-header .video.active .teaser-box").show(); 11386 } 11387} 11388//include 4 11389jQuery(function () { 11390 var privateFunctions = { 11391 geocode: function () { 11392 return $.Deferred(function (defer) { 11393 navigator.geolocation.getCurrentPosition(function (position) { 11394 var reverseGeocode = function (lat, lon, lang) { 11395 lang = lang || "de"; 11396 var url = "https://geocoder.pixelmap.at/reverse?lat=" + lat + "&lon=" + lon + "&lang=" + lang; 11397 11398 // Bearer Token (not sure if itâs needed) 11399 var bearerToken = "8912e7771f167257c8a4a01ebac3ce13"; 11400 return new Promise(function (resolve, reject) { 11401 fetch(url, { 11402 method: "GET", 11403 headers: { 11404 "Authorization": "Bearer " + bearerToken, 11405 "Content-Type": "application/json" 11406 } 11407 }).then(function (response) { 11408 if (!response.ok) { 11409 throw new Error("HTTP error! Status: " + response.status); 11410 } 11411 return response.json(); 11412 }).then(function (data) { 11413 if (data.features && data.features.length > 0) { 11414 resolve(data.features[0].properties); 11415 } else { 11416 reject("No location data found"); 11417 } 11418 }).catch(function (error) { 11419 console.error("Error fetching reverse geocode data:", error); 11420 reject(error); 11421 }); 11422 }); 11423 }; 11424 reverseGeocode(position.coords.latitude, position.coords.longitude).then(function (locality) { 11425 if (locality && locality.city) { 11426 var place = locality.city; 11427 var apiUrl = window.pixelpoint.domainService.get('apiEndpoint'); 11428 $.ajax({ 11429 url: apiUrl + "location/suggest?q=" + place, 11430 method: "GET" 11431 }).done(function (data) { 11432 defer.resolve(data); 11433 }).fail(defer.reject).always(defer.always); 11434 } 11435 }).catch(function (error) { 11436 console.error("Error processing location:", error); 11437 }); 11438 }, function (error) { 11439 defer.reject(); 11440 console.log("Leider konnte Ihre Position nicht ermittelt werden. Bitte überprüfen Sie Ihre Sicherheitseinstellungen und versuchen Sie es erneut.", "Fehler beim Ermitteln Ihrer Position!"); 11441 }); 11442 }); 11443 } 11444 }; 11445 window.pixelpoint.geoTool = { 11446 geocode: privateFunctions.geocode 11447 }; 11448}); 11449//include 4 11450jQuery(function () { 11451 var privateFunctions = { 11452 handleHide: function (element, selectedValue) { 11453 var switchHide = element.data('switch-hide'); 11454 if (!!switchHide) { 11455 if (switchHide == selectedValue) { 11456 element.addClass('hide'); 11457 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.switchHide, [{ 11458 hide: true, 11459 element: element 11460 }]); 11461 } else { 11462 element.removeClass('hide'); 11463 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.switchHide, [{ 11464 hide: false, 11465 element: element 11466 }]); 11467 } 11468 } 11469 }, 11470 handleSwitchClass: function (element, selectedValue) { 11471 var switchClass = element.data('switch-class'); 11472 if (!!switchClass) { 11473 $.each(switchClass, function (i, value) { 11474 element.removeClass(value); 11475 }); 11476 var newClass = switchClass[selectedValue]; 11477 if (!!newClass) { 11478 element.addClass(newClass); 11479 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.switchClass, [{ 11480 class: newClass, 11481 element: element 11482 }]); 11483 } 11484 } 11485 }, 11486 triggerChange(id, alternativeText, newValue, alternativeTitle) { 11487 var $this = $(`[data-switch-trigger="${id}"]`); 11488 var values = $this.data('values'); 11489 var formName = $this.data('form-name'); 11490 if (!id || !values) return; 11491 var key = `ppSwitch:${window.location.href}`; 11492 var stringified = JSON.stringify({ 11493 id: id, 11494 alternativeText: alternativeText, 11495 newValue: newValue, 11496 alternativeTitle: alternativeTitle 11497 }); 11498 window.sessionStorage.setItem(key, stringified); 11499 var switches = $(`[data-switch='${id}']`); 11500 if (!!alternativeText) { 11501 var oldText = $this.text(); 11502 if (oldText != alternativeText) { 11503 $this.text(alternativeText); 11504 $this.data('alternative-text', oldText); 11505 } 11506 } 11507 if (!!alternativeTitle) { 11508 var oldTitle = $this.attr('title'); 11509 if (oldTitle != alternativeTitle) { 11510 $this.attr('title', alternativeTitle); 11511 $this.data('alternative-title', oldTitle); 11512 } 11513 } 11514 $this.data('selected-value', newValue); 11515 if (!!formName) ; 11516 { 11517 var form = $(`[name='${formName}']`); 11518 if (form.length > 0) { 11519 var hiddenSwitchValue = form.find("input[type='hidden'][name='switchValue']"); 11520 if (hiddenSwitchValue.length == 0) { 11521 hiddenSwitchValue = $(`<input type="hidden" name="switchValue" value="${newValue}" />`).appendTo(form); 11522 } else { 11523 hiddenSwitchValue.val(newValue); 11524 } 11525 } 11526 } 11527 var changed = false;
11528 switches.each(function () { 11529 privateFunctions.handleHide($(this), newValue); 11530 privateFunctions.handleSwitchClass($(this), newValue); 11531 changed = true; 11532 }); 11533 //* 11534 if (!!changed) { 11535 setTimeout(function () { 11536 var stickies = $(`.sticky`).each(function () { 11537 try { 11538 $(this).foundation('_calc', true); 11539 } catch (err) {} 11540 }); 11541 }, 100); 11542 } 11543 //*/ 11544 $(".map-container.sticky-container.visibleMap").attr("style", ""); 11545 } 11546 }; 11547 $("[data-switch-trigger]").each(function () { 11548 var $this = $(this); 11549 var id = $this.data('switch-trigger'); 11550 var values = $this.data('values'); 11551 if (!id || !values) return; 11552 var initialValue = $this.data('initial-value') || values[0]; 11553 var defaultValue = $this.data('default-value') || values[0]; 11554 var defaultText = $this.data('default-text') || $(`[data-switch-trigger="${id}"]`).text(); 11555 var defaultTitle = $this.data('default-title') || values[0]; 11556 $this.data('selected-value', initialValue); 11557 var formName = $this.data('form-name'); 11558 var triggerInitial = $this.is("[data-trigger-initial]"); 11559 var triggerChange = function () { 11560 var alternativeText = $this.data('alternative-text'); 11561 var alternativeTitle = $this.data('alternative-title'); 11562 var oldValue = $this.data('selected-value'); 11563 var otherValues = values.filter(function (v) { 11564 return v != oldValue; 11565 }); 11566 var newValue = otherValues[0]; 11567 privateFunctions.triggerChange(id, alternativeText, newValue, alternativeTitle); 11568 }; 11569 var setDefaultChange = function () { 11570 privateFunctions.triggerChange(id, defaultText, defaultValue, defaultTitle); 11571 }; 11572 $this.on("click", function () { 11573 triggerChange(); 11574 }); 11575 11576 //* 11577 if (triggerInitial) { 11578 setTimeout(function () { 11579 triggerChange(); 11580 }, 100); 11581 } 11582 //*/ 11583 11584 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.switchSetDefault + ":" + id, setDefaultChange); 11585 var key = `ppSwitch:${window.location.href}`; 11586 var savedData = window.sessionStorage.getItem(key); 11587 if (!!savedData) { 11588 savedData = JSON.parse(savedData); 11589 privateFunctions.triggerChange(savedData.id, savedData.alternativeText, savedData.newValue, savedData.alternativeTitle); 11590 } 11591 }); 11592}); 11593//include 4 11594jQuery(function () { 11595 var privateFunctions = { 11596 getRandom: function () { 11597 var d = new Date(); 11598 var t = d.getTime(); 11599 return t + "" + Math.floor(Math.random() * 100); 11600 }, 11601 initialize: function (elements) { 11602 if (!elements || elements.length == 0) { 11603 return; 11604 } 11605 elements.each(function () { 11606 var element = $(this); 11607 if (!element.hasClass("busted")) { 11608 var link = element.attr("href"); 11609 if (!!link) { 11610 var parser = document.createElement('a'); 11611 parser.href = link; 11612 var d = new Date(); 11613 var t = d.getTime(); 11614 var random = parser.hash = "#" + privateFunctions.getRandom(); 11615 element.attr("href", parser.href); 11616 } 11617 element.addClass("busted"); 11618 } 11619 }); 11620 } 11621 }; 11622 window.pixelpoint.ppComponents.cacheBust = { 11623 init: privateFunctions.initialize 11624 }; 11625 window.pixelpoint.ppComponents.cacheBust.init($("[data-cache-bust]")); 11626}); 11627//include 4 11628jQuery(function () { 11629 // add-class-overlaykarte 11630 $("body").on("click ", ".open-in-modal", function (e) { 11631 var element = $(e.target).closest(".open-in-modal"); 11632 var href = element.attr("href"); 11633 var classesToAdd = []; 11634 var allClasses = element.attr('class').split(/\s+/); 11635 $.each(allClasses, function (index, item) { 11636 if (item.startsWith("add-class-")) { 11637 classesToAdd.push(item.replace("add-class-", "")); 11638 } 11639 }); 11640 var forceModal = element.hasClass("force-modal"); 11641 if (!!href) { 11642 if (window.pixelpoint.isMobile.any() && !forceModal) { 11643 element.attr("target", "_blank"); 11644 } else { 11645 e.preventDefault(); 11646 var instance = lity(href);
11647 if (!!classesToAdd) { 11648 for (var i = 0; i < classesToAdd.length; i++) { 11649 instance.element().addClass(classesToAdd[i]); 11650 } 11651 } 11652 //instance.element().addClass('overlaykarte'); 11653 element.data("modal-instance", instance); 11654 } 11655 } 11656 }); 11657}); 11658//include 4 11659jQuery(function () { 11660 var privateFunctions = { 11661 generateReloadUrl: (cid, pid, additionalParams) => { 11662 var domainReloadParameters = window.pixelpoint.utilities.getSysPageUrl(); 11663 var parsed = window.pixelpoint.utilities.parseUrl(window.location.href); 11664 parsed.baseUrl = domainReloadParameters.baseUrl; //`${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`;//window.location.origin; 11665 11666 additionalParams = additionalParams || []; 11667 $.each(additionalParams, (index, param) => { 11668 parsed.queryParameters[index] = param; 11669 }); 11670 if (domainReloadParameters.useAjaxRenderPageId) parsed.queryParameters.id = domainReloadParameters.ajaxRenderPageId; 11671 //parsed.queryParameters.id = window.pixelpoint.domainService.get("ajaxRenderPage");//1568; 11672 parsed.queryParameters.cid = cid; 11673 parsed.queryParameters.pid = pid; 11674 parsed.queryParameters.no_cache = 1; 11675 var offCanvasWrapper = $(".off-canvas-wrapper"); 11676 var language = offCanvasWrapper.data("lang") || 0; 11677 if (!!language) { 11678 parsed.queryParameters.L = language; 11679 } 11680 if (!!parsed.queryParameters['cHash']) delete parsed.queryParameters['cHash']; 11681 return window.pixelpoint.utilities.buildUrl(parsed); 11682 }, 11683 loader: $element => { 11684 let loader = $element.find('.loader[data-loader]'); 11685 if (loader.length == 0) { 11686 let cid = $element.data("cid"); 11687 let pid = $element.data("pid"); 11688 loader = $(`<div class="loader absolute hidden" data-loader data-name="module-${cid}-${pid}-loader"></div>`).appendTo($element); 11689 window.pixelpoint.ppComponents.loader(loader); 11690 } 11691 if (!loader.data("exposed")) { 11692 window.pixelpoint.ppComponents.loader(loader); 11693 } 11694 return loader; 11695 }, 11696 showLoader: $element => { 11697 privateFunctions.loader($element).data("exposed").show(); 11698 }, 11699 hideLoader: $element => { 11700 privateFunctions.loader($element).data("exposed").hide(); 11701 }, 11702 initializeComponents: $element => { 11703 window.pixelpoint.images.initializeErrors($element); 11704 $element.find('.offers-gallery.slick-slider').each(function () { 11705 if (!$(this).hasClass("slick-initialized")) { 11706 console.log("Offers slider will be initialized after module reload..."); 11707 window.ppComponents.sliders.offersGallery.init($(this)); 11708 } 11709 }); 11710 $element.find("[data-responsive-accordion-tabs]").each(function () { 11711 new Foundation.ResponsiveAccordionTabs($(this), {}); 11712 }); 11713 if ($element.find("img.lazy").length > 0) { 11714 window.pixelpoint.lazy.init($element.find("img.lazy")); 11715 } 11716 window.pixelpoint.lazy.initInterchange($element.find("[data-lazy-interchange]")); 11717 $element.find(".more-wrapper").each(function () { 11718 window.ppComponents.common.showMore($(this)); 11719 }); 11720 window.pixelpoint.initOpeningHoursText(); 11721 if ($element.find(".tabgallery-wrapper").length > 0) { 11722 window.pixelpoint.map.async.checkMedium().done(function () { 11723 if ($element.find("ppcarto-map-medium").length > 0) { 11724 window.ppcartoMedium = new Vue({ 11725 el: '#ppcarto-medium' 11726 }); 11727 window.pixelpoint.map.promises.mediumMapLoaded.resolve(); 11728 } 11729 window.ppComponents.sliders.tabGallery.initTabClickEvents(); 11730 window.ppComponents.sliders.tabGallery.initWrapper(); 11731 //window.ppComponents.sliders.tabGallery.init(true); 11732 }); 11733 } 11734 $element.find(".tabs-container, .tabs").on("change.zf.tabs", function (event, tab) { 11735 var tabId = tab.find("a").attr("href"); 11736 var tabPanel = $(tabId); 11737 if (tabPanel.length > 0) { 11738 window.pixelpoint.lazy.init(tabPanel.find(".lazy")); 11739 window.pixelpoint.lazy.initInterchange(tabPanel.find("[data-lazy-interchange]")); 11740 } 11741 }); 11742 }, 11743 reload: (elements, hideLoader, cback) => { 11744 elements.each((index, element) => { 11745 let $element = $(element); 11746 let cid = $element.data("cid"); 11747 let pid = $element.data("pid"); 11748 if (!cid || !pid) return true; 11749 hideLoader = hideLoader || false; 11750 var additionalParams = $element.data("get-params") || {}; 11751 let url = privateFunctions.generateReloadUrl(cid, pid, additionalParams); 11752 if ($element.css("position") == 'static') { 11753 $element.css({ 11754 "position": "relative" 11755 }); 11756 } 11757 if (!hideLoader) { 11758 privateFunctions.showLoader($element); 11759 } 11760 if (!cback) { 11761 cback = function (data, localcid, $localElement) { 11762 var parsedContent = $('<output>').append($.parseHTML(data)); 11763 var loadedElement = parsedContent.find(`[data-cid='${localcid}']`); 11764 $localElement.html(loadedElement.html()); 11765 privateFunctions.initializeComponents($localElement); 11766 11767 /* 11768 $element.find(".lazy").each(function(){ 11769 if($(this).data("src")){ 11770 var newSrc = $(this).data("src"); 11771 $(this).attr("src",newSrc); 11772 } 11773 }); 11774 */ 11775 }; 11776 } 11777 var localCid = cid; 11778 var $localElement = $element; 11779 $.ajax({ 11780 url: url 11781 }).done(data => { 11782 cback(data, localCid, $localElement); 11783 }).always(function () { 11784 if (!hideLoader) { 11785 privateFunctions.hideLoader($localElement); 11786 } 11787 checkForItemWithBanderole(); 11788 let $childrenWithShowMore = $localElement.find('.showmore'); 11789 if ($childrenWithShowMore.length > 0) { 11790 $childrenWithShowMore.each(function () { 11791 window.pixelpoint.ppComponents.showMore.init($(this)); 11792 }); 11793 } 11794 }); 11795 }); 11796 } 11797 }; 11798 window.pixelpoint.ppComponents.module = { 11799 reload: privateFunctions.reload 11800 }; 11801 window.pixelpoint.ppComponents.module.reload($("[data-reload-module]"), false, null); 11802}); 11803//include 4 11804jQuery(function () { 11805 var privateFunctions = { 11806 reloadIfEmpty(elements) { 11807 elements.each(function () { 11808 var element = $(this); 11809 var cid = element.data("cid"); 11810 var pid = element.data("pid"); 11811 var checkFor = element.data("check-for"); 11812 if (!cid || !pid) { 11813 return; 11814 } 11815 var isEmpty = false;
11816 if (!!checkFor) { 11817 if (element.find(checkFor).length == 0) { 11818 isEmpty = true; 11819 } 11820 } else { 11821 if (!$.trim(element.html())) { 11822 isEmpty = true; 11823 } 11824 } 11825 if (isEmpty) { 11826 window.pixelpoint.ppComponents.module.reload(element); 11827 } 11828 }); 11829 } 11830 }; 11831 window.pixelpoint.ppComponents.module.reloadIfEmpty = privateFunctions.reloadIfEmpty; 11832 window.pixelpoint.ppComponents.module.reloadIfEmpty($("[data-reload-if-empty]")); 11833}); 11834jQuery(function () { 11835 var effectTime = 500; 11836 var threshold = 0; 11837 if (window.pixelpoint.isMobile.any()) { 11838 effectTime = 0; 11839 threshold = 300; 11840 } 11841 window.pixelpoint.lazy = { 11842 init: function (elements, delay, force) { 11843 // , forceLoad 11844 delay = delay || 0; 11845 elements.each(function () { 11846 var element = $(this); 11847 if (!element.hasClass("lazy-initialized")) { 11848 if (!force) { 11849 if (element.parent().hasClass("center-cropped")) { 11850 if (!element.parent().is(":visible")) { 11851 return; 11852 } 11853 } else { 11854 if (!element.is(":visible")) { 11855 return; 11856 } 11857 } 11858 } 11859 var options = { 11860 effect: "fadeIn", 11861 effectTime: effectTime, 11862 threshold: threshold, 11863 onError: function (element) { 11864 //window.pixelpoint.images.initializeErrors(element); 11865 element.trigger("error"); 11866 //var imageSrc = element.attr("src"); 11867 //var dataSrc = element.data("src"); 11868 //console.log("element " + dataSrc + " error"); 11869 }, 11870 afterLoad: function (element) { 11871 //var imageSrc = element.attr("src"); 11872 //console.log("element " + imageSrc + " afterLoad"); 11873 if (element.parent().hasClass("center-cropped")) { 11874 var imageSrc = element.attr("src"); 11875 element.parent().css("background-image", `url(${imageSrc})`); 11876 } 11877 } /*, 11878 beforeLoad: function (element) { 11879 var imageSrc = element.attr("src"); 11880 console.log("element " + imageSrc + " beforeLoad"); 11881 }*/ 11882 }; 11883 if (delay > 0) { 11884 options.delay = delay; 11885 } 11886 11887 // #31628 11888 //window.executeAfterConsentExists(() => { 11889 element.Lazy(options); 11890 element.each(function () { 11891 if (!$(this).data("src")) { 11892 $(this).trigger("error"); 11893 } 11894 }); 11895 element.addClass("lazy-initialized"); 11896 //}) 11897 } 11898 }); 11899 }, 11900 initInterchange(elements) { 11901 elements.each(function () { 11902 if (!$(this).is("[data-lazy-interchange]")) { 11903 return; 11904 } 11905 if ($(this).is(":visible")) { 11906 var interchangeData = $(this).data("lazy-interchange"); 11907 $(this).attr("data-interchange", interchangeData).data("interchange", interchangeData).removeAttr("data-lazy-interchange"); 11908 $(this).one("replaced.zf.interchange", function () { 11909 var backgroundImage = $(this).css("background-image"); 11910 if (!!backgroundImage) { 11911 var regex = /url\(\"(.*)\"\)/gi; 11912 var matches = regex.exec(backgroundImage); 11913 if (matches != null && matches.length > 1) { 11914 var src = matches[1]; 11915 var innerImg = $(this).find("img.hide.lazy"); 11916 if (innerImg.length > 0) { 11917 var img = new Image(); 11918 img.onerror = function () { 11919 innerImg.trigger("error").off("error"); 11920 }; 11921 img.src = src; 11922 } 11923 } 11924 } 11925 //console.log($(this).css("background-image")); 11926 }); 11927 new Foundation.Interchange($(this)); 11928 } 11929 }); 11930 } 11931 }; 11932 11933 /*************************************************************************************** */ 11934 /*************************************************************************************** */ 11935 11936 const initLazies = () => { 11937 window.pixelpoint.lazy.init($(".lazy"), 100); 11938 window.pixelpoint.lazy.initInterchange($("[data-lazy-interchange]").not(".slick-slider [data-lazy-interchange]")); 11939 }; 11940 11941 // #31628 11942 //$(window).on("load", function() { 11943 // initLazies(); 11944 //}); 11945 11946 if (typeof __cmp !== 'undefined' && !!__cmp) { 11947 __cmp("addEventListener", ["consent", () => { 11948 initLazies(); 11949 }, true], null); 11950 } else { 11951 initLazies(); 11952 } 11953 $(".tabs-container, .tabs").on("change.zf.tabs", function (event, tab) { 11954 var tabId = tab.find("a").attr("href"); 11955 var tabPanel = $(tabId); 11956 if (tabPanel.length > 0) { 11957 window.pixelpoint.lazy.initInterchange(tabPanel.find("[data-lazy-interchange]")); 11958 } 11959 }); 11960 $("body").on("lazyLoaded", ".slick-initialized", function (e, slick, image, imageSource) { 11961 if (image.parent().hasClass("center-cropped")) { 11962 imageSource = image.attr("src"); //get source 11963 var parent = $(image).parent(".center-cropped"); 11964 parent.css("background-image", 'url("' + imageSource + '")'); //replace with background instead 11965 //image.attr('src',''); // remove source 11966 } 11967 if (image.parent().is("[data-lazy-interchange]")) { 11968 window.pixelpoint.lazy.initInterchange(image.parent()); 11969 } 11970 if (image.is("[data-lazy-interchange]")) { 11971 window.pixelpoint.lazy.initInterchange(image); 11972 } 11973 $(this).slick('setPosition'); 11974 }); 11975 $(".slickslider-full-width").on("lazyLoaded", function (e, slick, image, imageSource) { 11976 imageSource = image.attr("src"); //get source 11977 parentSlide = $(image).parent(".slick-slide.slick-current"); 11978 parentSlide.css("background-image", 'url("' + imageSource + '")'); //replace with background instead 11979 image.attr("src", ""); // remove source 11980 11981 if (image.parent().is("[data-lazy-interchange]")) { 11982 window.pixelpoint.lazy.initInterchange(image.parent()); 11983 } 11984 if (image.is("[data-lazy-interchange]")) { 11985 window.pixelpoint.lazy.initInterchange(image); 11986 } 11987 $(this).slick('setPosition'); 11988 }); 11989 11990 // on tab change load all lazy images of new tab 11991 $(".tabs-container, .tabs").on("change.zf.tabs", function (event, tab) { 11992 var tabId = tab.find("a").attr("href"); 11993 var tabPanel = $(tabId); 11994 if (tabPanel.length > 0) { 11995 window.pixelpoint.lazy.init(tabPanel.find(".lazy")); 11996 window.pixelpoint.lazy.initInterchange(tabPanel.find("[data-lazy-interchange]")); 11997 } 11998 }); 11999 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.toggleOpenAfter, function (e, container) { 12000 window.pixelpoint.lazy.init($(container).find(".lazy"), 100, true); 12001 window.pixelpoint.lazy.initInterchange($(container).find("[data-lazy-interchange]")); 12002 }); 12003}); 12004//include 9
12005jQuery(function () { 12006 $(".tabmosaic.paginationUsed").each((index, element) => { 12007 var $element = $(element); 12008 var parent = $element.closest(".tabmosaic-wrapper"); 12009 if (parent.length == 0) { 12010 return; 12011 } 12012 window.pixelpoint.ppComponents.module.reload(parent); 12013 parent.on("click", ".result-pagination li a", function (e) { 12014 e.preventDefault(); 12015 var $this = $(this); 12016 var href = $this.attr("href"); 12017 var parsed = window.pixelpoint.utilities.parseUrl(href); 12018 var page = parsed.queryParameters.page || 1; 12019 var getParams = parent.data("get-params") || {}; 12020 getParams.page = page; 12021 parent.data("get-params", getParams); 12022 window.pixelpoint.ppComponents.module.reload(parent); 12023 }); 12024 }); 12025}); 12026//include 9 12027jQuery(function () { 12028 $(".dce-themen_slider.paginationUsed").each((index, element) => { 12029 var $element = $(element); 12030 var loading = false; 12031 // On before slide change 12032 $element.on('beforeChange', function (event, slick, currentSlide, nextSlide) { 12033 var id = $element.attr("id"); 12034 var length = slick.$slides.length; 12035 if (nextSlide > length - 6) { 12036 if (loading == true) { 12037 return; 12038 } 12039 var page = $element.data("page") || 2; 12040 loading = true; 12041 var getParams = $element.data("get-params") || {}; 12042 getParams.page = page; 12043 $element.data("get-params", getParams); 12044 window.pixelpoint.ppComponents.module.reload($element, true, function (data) { 12045 var parsedContent = $('<output>').append($.parseHTML(data)); 12046 var newSlides = parsedContent.find(`#${id} div.item`); 12047 if (newSlides.length > 0) { 12048 newSlides.each(function () { 12049 slick.addSlide(this.outerHTML); 12050 }); 12051 page++; 12052 $element.data("page", page); 12053 } 12054 loading = false; 12055 }); 12056 } 12057 }); 12058 }); 12059}); 12060jQuery(function () { 12061 var clickEventType = document.ontouchstart !== null ? 'click' : 'touchstart'; 12062 $(document).on('mouseenter', '.regionen-map-container [class^="region-"], .regionen-map-container [class^="city-"]', function (e) { 12063 if ($(this).attr("class")) { 12064 var cUid = $(this).closest(".regionen-map-container").attr("id"); 12065 var classArray = $(this).attr("class").split(" "); 12066 if ($("#" + cUid + " .city_circles ." + classArray[0]).length) { 12067 moveUp($("#" + cUid + " .city_circles ." + classArray[0])); 12068 setTimeout(function () { 12069 $("#" + cUid + " ." + classArray[0]).addClass("active"); 12070 }, 10); 12071 } else { 12072 $("#" + cUid + " ." + classArray[0]).addClass("active"); 12073 } 12074 if ($("#" + cUid + ".regionen-map-container .region_list li." + classArray[0] + " a").length == 0) { 12075 $("#" + cUid + " ." + classArray[0]).css("cursor", "default"); 12076 } 12077 } 12078 }); 12079 $(document).on('mouseleave', '.regionen-map-container [class^="region-"], .regionen-map-container [class^="city-"]', function (e) { 12080 if ($(this).attr("class")) { 12081 var cUid = $(this).closest(".regionen-map-container").attr("id"); 12082 var classArray = $(this).attr("class").split(" "); 12083 $("#" + cUid + '.regionen-map-container .clicked').removeClass("clicked"); 12084 $("#" + cUid + " ." + classArray[0]).removeClass("active"); 12085 } 12086 }); 12087 $(document).on(clickEventType, '.regionen-map-container svg [class^="region-"], .regionen-map-container svg [class^="city-"]', function (e) { 12088 e.preventDefault(); 12089 if ($(this).attr("class")) { 12090 var cUid = $(this).closest(".regionen-map-container").attr("id"); 12091 var classArray = $(this).attr("class").split(" "); 12092 if (window.pixelpoint.utilities.isTouchDevice()) { 12093 if ($("#" + cUid + " ." + classArray[0]).hasClass("clicked")) { 12094 $("#" + cUid + ".regionen-map-container .region_list li." + classArray[0] + " a")[0].click(); 12095 } 12096 $("#" + cUid + '.regionen-map-container .clicked').removeClass("clicked"); 12097 $("#" + cUid + " ." + classArray[0]).addClass("clicked"); 12098 } else { 12099 $("#" + cUid + ".regionen-map-container .region_list li." + classArray[0] + " a")[0].click(); 12100 } 12101 } 12102 }); 12103}); 12104function moveUp(thisObject) { 12105 //thisObject.appendTo(thisObject.parents('svg>g.city_circles')); 12106 thisObject.appendTo(thisObject.parent()); 12107} 12108jQuery(function () { 12109 var kidsSingular = window.ppt.translate("kid", "Kind"); 12110 var kidsPlural = window.ppt.translate("kids", "Kinder"); 12111 $(".kids-picker-section").on("change", ".kids-count", function (e) { 12112 var $this = $(this); 12113 privateFunctions.timedChangeAmount($this); 12114 }); 12115 $(".kids-picker-section").on("click", ".kids-count-button.increase", function (e) { 12116 e.preventDefault(); 12117 var $this = $(this); 12118 var input = $this.parent().find(".kids-count"); 12119 var currentString = input.val(); 12120 currentString = currentString.split(" "); 12121 var current = currentString[0]; 12122 if (isNaN(current)) { 12123 return; 12124 } 12125 current = parseInt(current); 12126 if (current >= 9) { 12127 return; 12128 } 12129 current += 1; 12130 var $pickerSection = $(this).parent().parent(); 12131 if (current == 1) { 12132 input.val(current + " " + kidsSingular); 12133 } else { 12134 input.val(current + " " + kidsPlural); 12135 } 12136 for (var i = 1; i <= current; i++) { 12137 $pickerSection.find("#kids-age-container-" + i).removeClass("hide"); 12138 } 12139 }); 12140 $(".kids-picker-section").on("click", ".kids-count-button.decrease", function (e) { 12141 e.preventDefault(); 12142 var $this = $(this); 12143 var input = $this.parent().find(".kids-count"); 12144 var currentString = input.val(); 12145 currentString = currentString.split(" "); 12146 var current = currentString[0]; 12147 if (isNaN(current)) { 12148 return; 12149 } 12150 current = parseInt(current); 12151 if (current <= 1) { 12152 return; 12153 } 12154 current -= 1; 12155 var $pickerSection = $(this).parent().parent(); 12156 if (current == 1) { 12157 input.val(current + " " + kidsSingular); 12158 } else { 12159 input.val(current + " " + kidsPlural); 12160 } 12161 for (var i = 9; i > current; i--) { 12162 $pickerSection.find("#kids-age-container-" + i).addClass("hide"); 12163 } 12164 }); 12165 $('#familypass-newsletter').click(function () { 12166 var $this = $(this); 12167 if ($(this).prop("checked") == true) { 12168 console.log("Checkbox is checked."); 12169 $("#email-familypass-newsletter").attr("required", true); 12170 $("#email-familypass-newsletter").next(".icon-asterisk").removeClass("hide"); 12171 } else if ($(this).prop("checked") == false) { 12172 console.log("Checkbox is unchecked."); 12173 $("#email-familypass-newsletter").attr("required", false); 12174 $("#email-familypass-newsletter").next(".icon-asterisk").addClass("hide"); 12175 12176 // remove invalid status 12177 $("#email-familypass-newsletter").removeClass("is-invalid-input"); 12178 $("#email-familypass-newsletter").removeAttr("data-invalid"); 12179 } 12180 }); 12181}); 12182jQuery(function () { 12183 $("[data-hide-on-category]").each((index, item) => { 12184 const categoryId = $(item).data('category-to-hide-from'); 12185 if (!!categoryId) { 12186 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.categoryChanged, (e, data) => { 12187 let hideMe = false;
12188 let ids = []; 12189 $('.group-names-container input[type="hidden"]').each((index, item) => { 12190 ids.push($(item).val()); 12191 }); 12192 ids = ids.concat(data).map(x => parseInt(x)); 12193 ids = [...new Set(ids)]; 12194 if (ids.length == 1 && ids[0] == categoryId) { 12195 hideMe = true; 12196 } 12197 if (hideMe) { 12198 $(item).addClass("hide"); 12199 } else { 12200 $(item).removeClass("hide"); 12201 } 12202 }); 12203 } 12204 }); 12205}); 12206//include 10 12207jQuery(function () { 12208 $("body").on("click", ".open-barrierfree-filters", function (event) { 12209 event.preventDefault(); 12210 $(".barrierfree-filter-group").toggle(); 12211 window.ppComponents.common.showMore($(".barrierfree-filter-group .more-wrapper:not(.active)")); 12212 }); 12213 $("body").on("click", ".barrierfree-filter-group .close-group", function (event) { 12214 event.preventDefault(); 12215 $(".barrierfree-filter-group").toggle(); 12216 window.ppComponents.common.showMore($(".barrierfree-filter-group .more-wrapper:not(.active)")); 12217 }); 12218 $("body").on("click", ".barrierfree-filter-group .reset-group", function (e) { 12219 e.preventDefault(); 12220 var container = $(e.target).closest('.barrierfree-filter-group'); 12221 container.find('input[type="checkbox"]').each(function () { 12222 var defaultChecked = $(this).data("default") == "checked"; 12223 if (!!defaultChecked) { 12224 this.checked = true; 12225 } else { 12226 this.checked = false; 12227 } 12228 }); 12229 }); 12230}); 12231jQuery(function () { 12232 window.ppComponents.radioGroup = { 12233 init: $items => { 12234 $items.each((index, item) => { 12235 let $item = $(item); 12236 if ($item.data('radio-group-initialized')) return; 12237 let group = $item.data('radio-group'); 12238 if (!group) return; 12239 $item.on('change', function () { 12240 $(`[data-radio-group='${group}']`).prop('checked', false); 12241 $item.prop('checked', true); 12242 }); 12243 $item.data('radio-group-initialized', true); 12244 }); 12245 } 12246 }; 12247 $("[data-radio-group]").each((index, item) => { 12248 let $item = $(item); 12249 window.ppComponents.radioGroup.init($item); 12250 }); 12251}); 12252jQuery(function () { 12253 if ($(".dynamic-topic-link").length) { 12254 $('.dynamic-topic-link .categories-content i').click(function (e) { 12255 var $this = $(this); 12256 var $thisDce = $this.parent().parent(); 12257 if ($this.data('ctaToShow')) { 12258 var buttonToShow = $this.data('ctaToShow'); 12259 // remove quotes from string 12260 buttonToShow = buttonToShow.replace(/"|'/g, ''); 12261 $thisDce.find("a.brandenbutton").each(function () { 12262 if ($(this).data('ctaId') == buttonToShow) { 12263 $(this).fadeIn(); 12264 } else { 12265 $(this).hide(); 12266 } 12267 }); 12268 } 12269 }); 12270 } 12271}); 12272//include 9 12273jQuery(function () { 12274 window.forDebugging = false; 12275 12276 /** 12277 * the filters container 12278 * @type {jQuery|HTMLElement} 12279 */ 12280 var filtersContainer = $(".rbnb-wrapper .search > .filters-container"); 12281 /** 12282 * the search results container 12283 * @type {jQuery|HTMLElement} 12284 */ 12285 var searchResultsContainer = $(".rbnb-wrapper .search-results .inner-wrapper"); 12286 /** 12287 * the module wrapper 12288 * @type {jQuery|HTMLElement} 12289 */ 12290 var wrapper = $(".rbnb-wrapper"); 12291 /** 12292 * defines if it is an airbnb or external map 12293 * @type {boolean} 12294 */ 12295 var isAirBnB = true; 12296 /** 12297 * the geojson data of the loaded list 12298 * @type {Array} 12299 */ 12300 var geojsonData = []; 12301 12302 /** 12303 * the url to get the filters from session 12304 * @type {string} 12305 */ 12306 var sessionRequestUrl = window.pixelpoint.utilities.getAjaxUrl(`/index.php?action=sessionFilters&type=1732176051`); 12307 /** 12308 * the button to switch to list view and back to map view 12309 * @type {jQuery|HTMLElement} 12310 */ 12311 var switchToMapButton = $(".brandenbutton.switch-to-map"); 12312 /** 12313 * will be triggered after the map has loaded 12314 */ 12315 var mapLoadedDefer = $.Deferred(); 12316 /** 12317 * will be triggered after the session filters are loaded 12318 * @type {null} 12319 */ 12320 var sessionFiltersDeferred = null; 12321 /** 12322 * the bounding box of the map 12323 * @type {null} 12324 */ 12325 var boundingBox = null; 12326 /** 12327 * tells us if the map should be updated on the next movement or not 12328 * @type {boolean} 12329 */ 12330 var supressMapUpdate = false;
12331 /** 12332 * the last used locations in the filter 12333 * @type {Array} 12334 */ 12335 var lastUsedLocations = []; 12336 12337 /** 12338 * ZP 08.09.2022 - this variable will be set to true after a direct user interaction with the map 12339 * when set to true, the boundingbox will be again used. Otherwise all searhes (except for soft search) 12340 * will be made without bounding box 12341 */ 12342 var lockedAfterUserInteraction = false; 12343 12344 /** 12345 * the dce id 12346 */ 12347 var cid = wrapper.data("cid"); 12348 /** 12349 * the page id 12350 */ 12351 var pid = wrapper.data("pid"); 12352 /** 12353 * tells us if the initial request was a GET or POST request. If it was a POST the results will not be reloaded 12354 */ 12355 var requestType = wrapper.data('request'); 12356 /** 12357 * tells us if the DCE is an AirBnB or external map 12358 * @type {boolean} 12359 */ 12360 var isAirBnbOrExternalMap = false; 12361 12362 // if we did not find airBnB specific containers, this might be an external map 12363 if (filtersContainer.length == 0 || searchResultsContainer.length == 0) { 12364 return; // we have a separate js for the external map now 12365 } 12366 12367 /** 12368 * we have an AirBnB 12369 */ 12370 if ($("#rbnb-wrapper-id").length || $("#external-map-wrapper-id").length) { 12371 isAirBnbOrExternalMap = true; 12372 initStickyAirBnBelements(); 12373 } 12374 /** 12375 * we have the search site 12376 */else if ($("#search-wrapper-id").length) {} else {} 12377 /** 12378 * the form element 12379 */ 12380 var form = filtersContainer.find("form"); 12381 /** 12382 * the loader 12383 */ 12384 var loaderFunctions = wrapper.find(".search-results .loader[data-loader]").data("exposed"); 12385 12386 //deferred objects and simmilar- 12387 /** 12388 * the Ajax Request Deferred object 12389 * @type {null} 12390 */ 12391 var ajaxRequest = null; 12392 /** 12393 * the deferred that signalises when the map stopped moving 12394 * @type {null} 12395 */ 12396 var moveEndTimeout = null; 12397 //------------------------------ 12398 /** 12399 * ignoring all airbnb events 12400 * @type {boolean} 12401 */ 12402 var ignoreAirBnBEvent = true; 12403 /** 12404 * tells us if we change the map section on new data load or not 12405 * @type {boolean} 12406 */ 12407 var changeMapSection = false; 12408 /** 12409 * tells us if we move to the AirBnB DCE after a new search or not 12410 * @type {boolean} 12411 */
12412 var supressSliding = true; 12413 12414 //*************** a few helper functions to manipulate the form *****************************/ 12415 window.pixelpoint = window.pixelpoint || {}; 12416 window.pixelpoint.searchform = { 12417 /** 12418 * shows or hides the tour length slider element 12419 */ 12420 showHideTourLength() { 12421 if ($(".tour-length-input").length > 0) { 12422 if ($(".showontour").length > 0) { 12423 $(".showontour").removeClass("hide"); 12424 $(".showontour").each((index, element) => { 12425 $(element).removeClass("hide"); 12426 var eventsPostfix = $(element).find(".range-slider").data("events-postfix"); 12427 var sliderEnableEvent = `${window.pixelpoint.pubSub.events.slidersEventEnable}:${eventsPostfix}`, 12428 sliderDisableEvent = `${window.pixelpoint.pubSub.events.slidersEventDisable}:${eventsPostfix}`, 12429 sliderChangeEvent = `${window.pixelpoint.pubSub.events.slidersEventChange}:${eventsPostfix}`; 12430 var sliderValueElement = $(element).find(".range-slider input[type='hidden']"); 12431 if (sliderValueElement.length > 0 && !sliderValueElement.is(":disabled") && sliderValueElement.val() != "0,0") { 12432 $(".tour-length-input").val(sliderValueElement.val()); 12433 $(".tour-length-input").prop("disabled", false); 12434 } 12435 window.pixelpoint.pubSub.unsubscribe(sliderEnableEvent).unsubscribe(sliderDisableEvent).unsubscribe(sliderChangeEvent).subscribe(sliderEnableEvent, function (e) { 12436 $(".tour-length-input").prop("disabled", false); 12437 }).subscribe(sliderDisableEvent, function (e) { 12438 $(".tour-length-input").prop("disabled", true); 12439 }).subscribe(sliderChangeEvent, function (e, value) { 12440 $(".tour-length-input").val(value); 12441 if (value != '0,0') { 12442 $(".tour-length-input").prop("disabled", false); 12443 } else { 12444 $(".tour-length-input").prop("disabled", true); 12445 } 12446 }); 12447 }); 12448 } 12449 } else { 12450 $(".showontour").addClass("hide"); 12451 } 12452 } 12453 }; 12454 //***************************************************************************************** */ 12455 12456 /** 12457 * map functions 12458 * @type {{mapObject(): *, getMapType(): (string), removeBBox(): void, isSearchOnMoveActive(): *, isSearchSupressed(): *}} 12459 */ 12460 var mapFunctions = { 12461 /** 12462 * gets the AirBnB map object 12463 */ 12464 mapObject() { 12465 var airBnB = null; 12466 if (typeof ppcartoAirbnb != "undefined" && !!ppcartoAirbnb && !!ppcartoAirbnb.$refs && !!ppcartoAirbnb.$refs.airbnb) { 12467 airBnB = ppcartoAirbnb.$refs.airbnb; 12468 } else if (typeof ppcartoStatic != "undefined" && !!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static) { 12469 airBnB = ppcartoStatic.$refs.static; 12470 } 12471 return airBnB; 12472 }, 12473 /** 12474 * gets the map type, airbnb, static or undefined if the type could not be determined 12475 */ 12476 getMapType() { 12477 if (typeof ppcartoAirbnb != "undefined" && !!ppcartoAirbnb && !!ppcartoAirbnb.$refs && !!ppcartoAirbnb.$refs.airbnb) { 12478 return "airbnb"; 12479 } else if (typeof ppcartoStatic != "undefined" && !!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static) { 12480 return "static"; 12481 } 12482 return "undefined"; 12483 }, 12484 /** 12485 * removes the bbox from the filters saved in the airbnb object 12486 */ 12487 removeBBox() { 12488 var mapObject = mapFunctions.mapObject(); 12489 if (!!mapObject.filter && !!mapObject.filter.bbox) { 12490 delete mapObject.filter.bbox; 12491 } 12492 }, 12493 /** 12494 * do we make a new search when the map moves or not 12495 */ 12496 isSearchOnMoveActive() { 12497 var mapObject = mapFunctions.mapObject(); 12498 return mapObject.triggerSearchOnMove || false; 12499 }, 12500 /** 12501 * tells us if the search is supressed or not 12502 */ 12503 isSearchSupressed() { 12504 var mapObject = mapFunctions.mapObject(); 12505 return mapObject.supressSearch || false; 12506 }, 12507 changeBBox(bbox, convertToArray) { 12508 if (!bbox) return bbox; 12509 let splittedBox = null; 12510 if (_.isString(bbox)) splittedBox = bbox.split(",");else if (_.isArray(bbox) && !!bbox[0] && !!bbox[0][0] && !!bbox[0][1] && !!bbox[1] && !!bbox[1][0] && !!bbox[1][1]) { 12511 splittedBox = _.flatten(bbox); 12512 } 12513 if (splittedBox != null && splittedBox.length >= 4) { 12514 if (parseFloat(splittedBox[0]) > parseFloat(splittedBox[1])) { 12515 let tmp = splittedBox[0]; 12516 splittedBox[0] = splittedBox[1]; 12517 splittedBox[1] = tmp; 12518 } 12519 if (parseFloat(splittedBox[2]) > parseFloat(splittedBox[3])) { 12520 let tmp = splittedBox[2]; 12521 splittedBox[2] = splittedBox[3]; 12522 splittedBox[3] = tmp; 12523 } 12524 // we switch the 2nd and 4th coordinate 12525 if (parseFloat(splittedBox[1]) > parseFloat(splittedBox[3])) { 12526 let tmp = splittedBox[1]; 12527 splittedBox[1] = splittedBox[3]; 12528 splittedBox[3] = tmp; 12529 } 12530 //end 12531 if (convertToArray) { 12532 bbox = [[splittedBox[0], splittedBox[1]], [splittedBox[2], splittedBox[3]]]; 12533 } else { 12534 bbox = splittedBox.join(","); 12535 } 12536 } 12537 return bbox; 12538 }, 12539 getBBox() { 12540 var mapObject = mapFunctions.mapObject(); 12541 let bbox = '0,0,0,0'; 12542 if (mapObject && mapObject.bbox) { 12543 bbox = mapObject.bbox(); 12544 bbox = mapFunctions.changeBBox(bbox); 12545 } 12546 return bbox; 12547 } 12548 }; 12549 //******************************************************************************************** 12550 /** 12551 * private functions 12552 * *************************************************************************************** 12553 * *************************************************************************************** 12554 */ 12555 var privateFunctions = { 12556 removePageParameter(url) { 12557 if (!url) return url; 12558 let parsedUrl = window.pixelpoint.utilities.parseUrl(url); 12559 if (parsedUrl.queryParameters.hasOwnProperty('page')) delete parsedUrl.queryParameters.page; 12560 return window.pixelpoint.utilities.buildUrl(parsedUrl); 12561 }, 12562 collectPoiData($html = null) { 12563 geojsonData = []; 12564 var $elements = null; 12565 if ($html == null) { 12566 $elements = wrapper.find("[data-geojson]"); 12567 } else { 12568 $elements = $html.find("[data-geojson]"); 12569 } 12570 $elements.each(function () { 12571 var geojson = $(this).data('geojson'); 12572 if (!!geojson) { 12573 geojsonData.push(geojson); 12574 } 12575 }); 12576 }, 12577 populateMissingElements() {
12578 //* 12579 if ($("ul.result-pagination").length > 0) { 12580 wrapper.closest(".search-wrapper").find(".rbnb-pagination-wrapper").each(function () { 12581 $(this).html('').append($("ul.result-pagination").first().clone()); 12582 }); 12583 } 12584 //*/ 12585 if ($(".result-count").length > 0) { 12586 $(".rbnb-count-wrapper").each(function () { 12587 $(this).html($(".result-count").html()); 12588 }); 12589 } else { 12590 $(".rbnb-count-wrapper").each(function () { 12591 $(this).html(""); 12592 }); 12593 } 12594 if ($(".group-names-container li").length > 0) { 12595 $(".rbnb-categories-wrapper").off("click").on("click", "li.group-category", function (e) { 12596 var icon = $(e.target).closest("li.group-category"); 12597 var groupId = icon.data("group-icon"); 12598 if (!!groupId) { 12599 var group = $(`li[data-group-id='${groupId}']`); 12600 if (group.length > 0) { 12601 var groupContainer = group.closest(".group-names-container"); 12602 if (groupContainer.length > 0) { 12603 if (groupContainer.hasClass("collapsed")) { 12604 var collapseId = groupContainer.data("id"); 12605 $(`[data-target='${collapseId}']`).click(); 12606 } 12607 var scrollPosition = groupContainer.offset().top - privateFunctions.getHeaderHeight() - 10; 12608 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 12609 $('html,body').animate({ 12610 scrollTop: scrollPosition 12611 }, 500); 12612 } 12613 } 12614 } 12615 }); 12616 $(".rbnb-categories-wrapper").each(function () { 12617 var $this = $(this); 12618 var numberOfCategories = $(".group-names-container li").length; 12619 if (numberOfCategories <= 4) { 12620 $this.addClass("with-" + numberOfCategories + "-icons"); 12621 } else { 12622 $this.addClass("with-more-icons"); 12623 } 12624 var ul = $('<ul></ul>'); 12625 $this.html('').append(ul); 12626 $(".group-names-container li").each(function (index) { 12627 if (numberOfCategories > 4) { 12628 var externalId = null; 12629 var group = null; 12630 if (index < 1 || index > numberOfCategories - 2) { 12631 externalId = $(this).data("external-id"); 12632 group = $(this).data("group-id"); 12633 if (!!externalId) { 12634 ul.append(`<li class="group-category" data-group-icon="${group}"><i class="bb-icon-${externalId} ttip-blue tooltipstered"></i></li>`); 12635 } 12636 } else if ($this.find(".three-dots").length == 0) { 12637 ul.append('<li class="three-dots">...</li>'); 12638 } 12639 } else { 12640 externalId = $(this).data("external-id"); 12641 group = $(this).data("group-id"); 12642 if (!!externalId) { 12643 ul.append(`<li class="group-category" data-group-icon="${group}"><i class="bb-icon-${externalId} ttip-blue tooltipstered"></i></li>`); 12644 } 12645 } 12646 }); 12647 }); 12648 } 12649 }, 12650 switchToDefaultView() { 12651 if (switchToMapButton.length == 0) return; 12652 var id = switchToMapButton.data('switch-trigger'); 12653 if (!id) return; 12654 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.switchSetDefault + ":" + id); 12655 }, 12656 addBBox(data, bbox) { 12657 if (!bbox) return data; 12658 if (!bbox[0] || !bbox[0][0] || !bbox[0][1] || !bbox[1] || !bbox[1][0] || !bbox[1][1]) return data; //bbox malformed 12659 bbox = mapFunctions.changeBBox(bbox, true); 12660 for (var i = 0; i < 2; i++) { 12661 for (var j = 0; j < 2; j++) { 12662 var obj = { 12663 'name': `filters[bbox][${i}][${j}]`, 12664 'value': bbox[i][j] 12665 }; 12666 data.push(obj); 12667 } 12668 } 12669 return data; 12670 }, 12671 loadSessionFilters() { 12672 if (!sessionFiltersDeferred) { 12673 sessionFiltersDeferred = $.Deferred(function (defer) { 12674 $.ajax(sessionRequestUrl, { 12675 method: "POST", 12676 data: JSON.stringify({ 12677 keys: ['AirBnB', cid], 12678 url: window.location.href 12679 }), 12680 contentType: "application/json; charset=utf-8" 12681 }).done(function (data, textStatus, request) { 12682 defer.resolve(data); 12683 }).fail(defer.reject).always(defer.always); 12684 }).promise(); 12685 } 12686 }, 12687 getHeaderHeight() { 12688 return $(".header-wrapper .header").outerHeight(); 12689 }, 12690 getRealWindowHeight() { 12691 return $(window).height() - privateFunctions.getHeaderHeight(); 12692 }, 12693 getRealScrollPosition(scrollPosition) { 12694 var bottomModulePosition = wrapper.offset().top + wrapper.height(); 12695 if (bottomModulePosition - scrollPosition < privateFunctions.getRealWindowHeight()) { 12696 return bottomModulePosition - $(window).height(); 12697 } 12698 return scrollPosition; 12699 }, 12700 clearDefaultTextValue() { 12701 //clears the default text value. Since the preset text value must not be visible, we have to set it each time. This function 12702 //the default text value. It is called on clicko on the button 12703 var input = wrapper.find("input[name='filters[q]']"); 12704 if (!input.data('saved-default-value')) input.data('saved-default-value', input.data('default-value')); 12705 input.data('default-value', ''); 12706 }, 12707 restoreDefaultValue() { 12708 var input = wrapper.find("input[name='filters[q]']"); 12709 if (!!input.data('saved-default-value')) input.data('default-value', input.data('saved-default-value')); 12710 }, 12711 setDefaultValue(data) { 12712 //sets the default value since we need to use it in some cases (if the map moves for example) 12713 var defaultValue = wrapper.find("input[name='filters[q]']").data('default-value'); 12714 if (!!defaultValue) { 12715 $.each(data, function (index, element) { 12716 if (element.name == "filters[q]") { 12717 element.value = defaultValue; 12718 } 12719 }); 12720 } 12721 return data; 12722 }, 12723 moveToElement(data) { 12724 var id = data.id || 0; 12725 if (!id) { 12726 return; 12727 } 12728 var searchResultItem = $(`.search-result-item[data-id='${id}']`); 12729 if (searchResultItem.length == 0) { 12730 return searchResultItem; 12731 } 12732 var headerHeight = $(".header-wrapper .header").height() || 0; 12733 var offset = searchResultItem.offset(); 12734 var topOffset = offset.top; 12735 var bottomOffset = offset.top + searchResultItem.height(); 12736 if (topOffset < $(window).scrollTop() + headerHeight || bottomOffset > $(window).scrollTop() + $(window).height()) { 12737 // Not in view so scroll to it 12738 var scrollPosition = topOffset - headerHeight - 10; 12739 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 12740 $('html,body').animate({ 12741 scrollTop: scrollPosition 12742 }, 500); 12743 } 12744 return searchResultItem; 12745 }, 12746 afterAllImagesLoaded($container) { 12747 var d = $.Deferred(); 12748 var imgs = $container.find("img"); 12749 imgs.one("load.allimages error.allimages", function () { 12750 imgs = imgs.not(this); 12751 if (imgs.length == 0) { 12752 d.resolve(); 12753 } 12754 }); 12755 var complete = imgs.filter(function () { 12756 return this.complete; 12757 }); 12758 complete.off(".allimages"); 12759 imgs = imgs.not(complete); 12760 complete = undefined; 12761 if (imgs.length == 0) { 12762 d.resolve(); 12763 } 12764 return d.promise(); 12765 }, 12766 setResultItemHeight() { 12767 var equalHeighElem = $("#search-wrapper-id .search-result-item"); 12768 setTimeout(function () { 12769 equalHeight(equalHeighElem, true); 12770 initStickyAirBnBelements(); 12771 $('.map-wrapper.sticky').foundation('_calc', true); 12772 }, 100); 12773 }, 12774 validateForm(displayErrors) { 12775 displayErrors = displayErrors || false;
12776 form.find(".invalid").removeClass("invalid"); 12777 var valid = true; 12778 var visitorPicker = form.find(".visitor-picker"); 12779 var distancePicker = form.find(".distance-picker"); 12780 if (visitorPicker.length > 0) { 12781 var formFunctions = visitorPicker.data("form-element-functions"); 12782 if (!!formFunctions.get) { 12783 var visitors = formFunctions.get(); 12784 if (!!visitors.kids && visitors.kids > 0) { 12785 if (visitorPicker.is("[data-to-disable]")) { 12786 var von = form.find(".calendar input.von").val(); 12787 var bis = form.find(".calendar input.bis").val(); 12788 if (!von || !bis) { 12789 valid = false; 12790 if (displayErrors) { 12791 form.find(".calendar").closest(".element-wrapper").addClass("invalid"); 12792 } 12793 } 12794 } 12795 } 12796 } 12797 if (!!formFunctions.valid) { 12798 if (!formFunctions.valid(true)) { 12799 valid = false; 12800 } 12801 } 12802 } 12803 if (distancePicker.length > 0) { 12804 var distanceFormFunctions = distancePicker.data("form-element-functions"); 12805 if (!!distanceFormFunctions.valid) { 12806 if (!distanceFormFunctions.valid(true)) { 12807 valid = false; 12808 } 12809 } 12810 } 12811 return valid; 12812 }, 12813 generateFormAction(url, bbox, switchValue) { 12814 if (!cid || !pid) { 12815 return url; 12816 } 12817 bbox = bbox || null; 12818 switchValue = switchValue || null; 12819 var domainReloadParameters = window.pixelpoint.utilities.getSysPageUrl(); 12820 var parsed = window.pixelpoint.utilities.parseUrl(url); 12821 parsed.baseUrl = domainReloadParameters.baseUrl; //window.location.origin; 12822 if (domainReloadParameters.useAjaxRenderPageId) parsed.queryParameters.id = domainReloadParameters.ajaxRenderPageId; 12823 //parsed.queryParameters.id = window.pixelpoint.domainService.get("ajaxRenderPage");//1568; 12824 parsed.queryParameters.cid = cid; 12825 parsed.queryParameters.pid = pid; 12826 parsed.queryParameters.no_cache = 1; 12827 if ($("a.search-in-area").length > 0 && $(".locationTree").parent().find(".select2 .select2-selection__choice").length > 0) { 12828 parsed.queryParameters.searchingInArea = 1; 12829 } 12830 if (!!switchValue) { 12831 parsed.queryParameters.switchValue = switchValue; 12832 } else { 12833 if ($('[name="switchValue"]').length > 0) { 12834 parsed.queryParameters.switchValue = $('[name="switchValue"]').val(); 12835 } else { 12836 // the hidden switchValue field only gets created once the switch is triggered 12837 // Before that we fall back to the switch button's initial/selected value so the very first reload already carries it. 12838 var initialSwitchValue = $(".show-map-wrapper .switch-to-map").data('selected-value') || $(".show-map-wrapper .switch-to-map").data('initial-value'); 12839 if (!!initialSwitchValue) { 12840 parsed.queryParameters.switchValue = initialSwitchValue; 12841 } 12842 } 12843 } 12844 if (!!parsed.queryParameters.cHash) { 12845 delete parsed.queryParameters.cHash; 12846 } 12847 if (!!bbox) { 12848 if ($.isArray(bbox)) bbox = bbox.join(); 12849 parsed.queryParameters.bbox = bbox; 12850 } 12851 return window.pixelpoint.utilities.buildUrl(parsed); 12852 }, 12853 /** 12854 * ************************************************************************** 12855 * ************************************************************************** 12856 */ 12857 12858 makeSearch(url, method, parameters) { 12859 var finished = $.Deferred(); 12860 parameters = parameters || ""; 12861 ajaxRequest = $.ajax({ 12862 type: method, 12863 url: url, 12864 data: parameters, 12865 success: function (data) { 12866 var $data = $(data); 12867 privateFunctions.collectPoiData($data); 12868 finished.resolve({ 12869 raw: data, 12870 obj: $data 12871 }); 12872 } 12873 }); 12874 return finished.promise(); 12875 }, 12876 /** 12877 * ************************************************************************** 12878 * ************************************************************************** 12879 */ 12880 // isMapUserInteractionEvent - tells us if the search was triggered by a user initiated map move event 12881 submitForm(callback, isMapUserInteractionEvent, softSearchEnabled) { 12882 console.log(isMapUserInteractionEvent ? "%cSearch was triggered by map user interaction" : "%c Search not triggered by map", "color: red; background: green;"); 12883 if (form.length == 0) return; 12884 var url = form.attr('action'); 12885 if (!url) { 12886 url = window.location.href; 12887 } 12888 var switchToMap = $(".show-map-wrapper .switch-to-map"); 12889 if (switchToMap.length > 0) { 12890 var currentValue = switchToMap.data('selected-value') || switchToMap.data('initial-value'); 12891 url = privateFunctions.generateFormAction(url, null, currentValue); 12892 } else { 12893 url = privateFunctions.generateFormAction(url); 12894 } 12895 var method = form.attr('method'); 12896 if (!!loaderFunctions) { 12897 loaderFunctions.show(); 12898 } 12899 var bbox = boundingBox; 12900 var selectedRegionId = null; 12901 var selectedRegionType = ""; 12902 privateFunctions.clearRegionFromAirBnB(); 12903 var data = form.serializeArray(); 12904 $.each(data, function (index, element) {
12905 // we get the first selected region (if there is any) 12906 if (selectedRegionId == null) { 12907 if (element.name == 'filters[locationTree][]') { 12908 if (element.value.indexOf(":region") > -1) { 12909 let splitted = element.value.split(":"); 12910 selectedRegionId = splitted[0]; 12911 selectedRegionType = 'region'; 12912 } else if (element.value.indexOf(":aqua") > -1) { 12913 let splitted = element.value.split(":"); 12914 selectedRegionId = splitted[0]; 12915 selectedRegionType = 'aquaticsdistrict'; 12916 } else if (element.value.indexOf(":national") > -1) { 12917 let splitted = element.value.split(":"); 12918 selectedRegionId = splitted[0]; 12919 selectedRegionType = 'nationallandscape'; 12920 } else if (element.value.indexOf(":excursion") > -1) { 12921 let splitted = element.value.split(":"); 12922 selectedRegionId = splitted[0]; 12923 selectedRegionType = 'excursion'; 12924 } 12925 } 12926 } 12927 if (element.name == 'filters[q]') { 12928 if (!element.value) { 12929 var defaultData = $(`[name='filters[q]']`).data('default-value'); 12930 if (!!defaultData) element.value = defaultData; 12931 } 12932 } 12933 }); 12934 12935 //set the default value, if it exists 12936 data = privateFunctions.setDefaultValue(data); 12937 12938 /* 12939 * if active user inteaction, we activate the bounding box again and 12940 * use it until we got a location search (location, region, district) 12941 * */ 12942 12943 //ZP 02-09-2022 it is checked based on the map move event: 12944 // if the search was a consequence of the mapmove event and the event was user interaction triggered we add the bounding box, 12945 // otherwise not 12946 // also, we keep track of whether softsearch is enabled or not. Softsearch still requires a boundingbox 12947 if (isMapUserInteractionEvent) { 12948 lockedAfterUserInteraction = true; 12949 } 12950 if (lockedAfterUserInteraction || softSearchEnabled) { 12951 //add the geojson data, if existing 12952 if (!!bbox && $.isArray(bbox)) { 12953 data = privateFunctions.addBBox(data, bbox); 12954 } else if (!!bbox && $.type(bbox) === "string") { 12955 data.push({ 12956 name: "filters[bbox]", 12957 value: bbox 12958 }); 12959 } 12960 } else { 12961 data = data.filter(x => x.name !== "filters[bbox]"); 12962 } 12963 if (!!ajaxRequest) { 12964 ajaxRequest.abort(); 12965 } 12966 form.find(".groups").hide(); 12967 12968 //*************************** 12969 privateFunctions.makeSearch(url, method, data).then(function (data) { 12970 var results = data.obj.find(".search-results .inner-wrapper").html(); 12971 if (!results) results = ''; 12972 searchResultsContainer.html(results); 12973 window.pixelpoint.debug.writeFromData('json-filters', 'The json filters'); 12974 window.pixelpoint.images.initializeErrors(searchResultsContainer); 12975 privateFunctions.populateMissingElements(); 12976 12977 //privateFunctions.initializeSliders(); 12978 window.pixelpoint.tooltip.init(searchResultsContainer.find('.ttip-blue')); 12979 window.pixelpoint.initOpeningHoursText(); 12980 $('.map-wrapper.sticky').foundation('_calc', true); 12981 if (!!loaderFunctions) { 12982 privateFunctions.afterAllImagesLoaded(searchResultsContainer).then(function () { 12983 privateFunctions.setResultItemHeight(); 12984 loaderFunctions.hide(); 12985 }); 12986 } 12987 var itemCount = $(".result-list .search-result-item").length; 12988 if (!supressSliding) { 12989 if (itemCount > 0) { 12990 let scrollPosition = $(".search-results").offset().top - $(".header-wrapper .header").height(); 12991 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 12992 $('html, body').animate({ 12993 scrollTop: scrollPosition 12994 }, 500); 12995 } else { 12996 let scrollPosition = $(".filters-container").offset().top - $(".header-wrapper .header").height(); 12997 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 12998 $('html, body').animate({ 12999 scrollTop: scrollPosition 13000 }, 500); 13001 }
13002 supressSliding = true; 13003 } 13004 //ZP 21.05.2020: not sure if we still need the "ignoreAirBnB" variable 13005 13006 if (!supressMapUpdate && !!isAirBnB) { 13007 ignoreAirBnBEvent = true; 13008 13009 //because sometimes the map does not trigger the event after moving (have to find out the reason yet), 13010 //we have to make sure, the "ignoreAirBnBEvent" variable is set to false after a period of time 13011 setTimeout(function () { 13012 ignoreAirBnBEvent = false; 13013 }, 2000); 13014 } else { 13015 supressMapUpdate = false; 13016 } 13017 if (selectedRegionId != null) { 13018 changeMapSection = true; 13019 } 13020 privateFunctions.calculateOffset(); 13021 privateFunctions.dataToAirBnB(); 13022 if (selectedRegionId != null) { 13023 privateFunctions.regionToAirBnB(selectedRegionId, selectedRegionType); 13024 } 13025 privateFunctions.checkDistanceOrdering(); 13026 ajaxRequest = null; 13027 13028 // do everything for mobile 13029 if (isAirBnbOrExternalMap && $('#airbnb-buttons').is(':visible')) { 13030 followingEementInContainer($('#airbnb-buttons'), $('#search-results-for-sticky-buttons')); 13031 } 13032 if (!!callback) callback(); 13033 }); 13034 }, 13035 clearRegionFromAirBnB() { 13036 var airBnB = mapFunctions.mapObject(); 13037 if (!airBnB || !airBnB.clearRegion) return; 13038 airBnB.clearRegion(); 13039 }, 13040 regionToAirBnB(id, type) { 13041 if (!id) return; 13042 type = type || 'region'; 13043 var airBnB = mapFunctions.mapObject(); 13044 if (!airBnB) return; 13045 airBnB.setRegion({ 13046 type: type, 13047 id: window.pixelpoint.utilities.getMapRegion(id) //id 13048 }); 13049 }, 13050 //ZP 18.05.2020 TPBB-1069: the customer wants the bounding box for all found pois, 13051 // not just those on the first page 13052 wholeBoundingBoxToAirBnB(bboxString) { 13053 let airBnB = mapFunctions.mapObject(); 13054 if (!airBnB) return; 13055 airBnB.setAdditionalBoundingBox(bboxString); 13056 }, 13057 wholeBoundingBoxClear() { 13058 let airBnB = mapFunctions.mapObject(); 13059 if (!airBnB) return; 13060 airBnB.setAdditionalBoundingBox(null); 13061 }, 13062 //end 13063 checkDistanceOrdering() { 13064 var resultListWrapper = searchResultsContainer.find(".result-list-wrapper"); 13065 if (resultListWrapper.length > 0) { 13066 var filters = resultListWrapper.data("jsonFilters"); 13067 if (!!filters && !!filters.location) { 13068 $(".order-distance").removeClass("hide"); 13069 $(".orderby-wrapper").addClass("with-distance-filter"); 13070 return; 13071 } 13072 } 13073 $(".order-distance").addClass("hide"); 13074 $(".orderby-wrapper").removeClass("with-distance-filter"); 13075 if ($("hidden.filters_order").length > 0 && $("hidden.filters_order").val() == "distance") { 13076 $("hidden.filters_order").val(""); 13077 } 13078 }, 13079 dataToAirBnB() { 13080 var airBnB = mapFunctions.mapObject(); 13081 if (!airBnB) return; 13082 var type = searchResultsContainer.find(".result-list-wrapper").data("jsonEndpoint"); 13083 if (!type) type = "poi"; 13084 if (!!changeMapSection) { 13085 airBnB.init = true; 13086 airBnB.zoom = null; 13087 airBnB.coordinates = []; 13088 changeMapSection = false; 13089 } 13090 13091 //ZP 18.05.2020 TPBB-1069: the customer wants the bounding box for all found pois, 13092 // not just those on the first page 13093 let bboxString = searchResultsContainer.find(".result-list-wrapper").data('whole-boundingbox'); 13094 if (!!bboxString) { 13095 privateFunctions.wholeBoundingBoxToAirBnB(bboxString); 13096 } else { 13097 privateFunctions.wholeBoundingBoxClear(); 13098 } 13099 airBnB.type = type; 13100 airBnB.geojson = { 13101 "type": "FeatureCollection", 13102 "features": geojsonData 13103 }; 13104 }, 13105 calculateOffset() { 13106 var airBnB = mapFunctions.mapObject(); 13107 if (!airBnB) return; 13108 if (!$(".rbnb-wrapper").is(".fullsize")) { 13109 airBnB.offset = 0; 13110 return; 13111 } 13112 if ($('#airbnb-buttons').is(':visible')) { 13113 airBnB.offset = 0; 13114 return; 13115 } 13116 var searchContainer = $(".rbnb-wrapper .search"); 13117 if (searchContainer.length == 0) return; 13118 var offset = searchContainer.offset().left + searchContainer.outerWidth(); 13119 if (searchContainer.hasClass("switch-big")) { 13120 offset = offset / 2; 13121 } 13122 airBnB.offset = offset; 13123 }, 13124 initialSetBBox() { 13125 var mapWrapper = $(".map-internal-wrapper"); 13126 privateFunctions.calculateOffset(); 13127 var zoom = mapWrapper.data("initial-zoom"); 13128 var longitude = mapWrapper.data("initial-longitude"); 13129 var latitude = mapWrapper.data("initial-latitude"); 13130 var reloadModule = function () { 13131 if (!!isAirBnB) { 13132 //privateFunctions.filtersToAirBnB(); //@deprecated 13133 if (requestType == 'GET' || requestType == 'HEAD') { 13134 supressMapUpdate = false;
13135 privateFunctions.reloadModule(); 13136 } else { 13137 privateFunctions.submitForm(); 13138 } 13139 } else { 13140 privateFunctions.reloadModule(); 13141 } 13142 }; 13143 if (zoom > 0 || zoom > 0 && longitude > 0 && latitude > 0) { 13144 sessionFiltersDeferred.done(function (data) { 13145 if (!data) { 13146 //----------------------------------- 13147 var viewArguments = { 13148 animate: false 13149 }; 13150 if (zoom > 0) viewArguments.zoom = zoom; 13151 if (longitude > 0 && latitude > 0) viewArguments.coordinates = [longitude, latitude]; 13152 if (!!isAirBnB) { 13153 mapFunctions.mapObject().$once("moveend", function (data) { 13154 var bbox = mapFunctions.getBBox(); //mapFunctions.mapObject().bbox(); 13155 boundingBox = bbox; 13156 supressMapUpdate = true; 13157 if (requestType == 'POST') { 13158 privateFunctions.submitForm(); 13159 } else { 13160 supressMapUpdate = false; 13161 //ZP 02.09.2022 - we do not want to use the boundingbox if the event was trigerred programatically 13162 !!data.isUserInteractionEvent ? privateFunctions.reloadModule(bbox, null, true) : privateFunctions.reloadModule(null, null, true); 13163 } 13164 // ZP 18.05.2020 - TPBB-1069(not part of ticket, problem was just referenced here): 13165 // if map was moved we can not move the map again when we send the results to the map 13166 mapFunctions.mapObject().fixMapPosition = true; 13167 }); 13168 } 13169 if (!!isAirBnB) { 13170 mapFunctions.mapObject().$nextTick(function () { 13171 mapFunctions.mapObject().init = false; 13172 mapFunctions.mapObject().changeView(viewArguments); 13173 }); 13174 mapFunctions.mapObject().fixMapPosition = true; 13175 privateFunctions.submitForm(null, true, false); 13176 } else { 13177 reloadModule(); 13178 } 13179 //----------------------------------- 13180 } else { 13181 reloadModule(); 13182 } 13183 }); 13184 } else { 13185 reloadModule(); 13186 } 13187 }, 13188 switchFilters(filtersHtml) { 13189 if (!filtersHtml) return; 13190 if (!filtersContainer || filtersContainer.length == 0) return; 13191 var filterForm = filtersContainer.find('.filter-form'); 13192 filterForm.html(""); 13193 filterForm.append($(filtersHtml)); 13194 filterForm.find(".calendar").each(function () { 13195 window.pixelpoint.ppComponents.calendar($(this)); 13196 }); 13197 filterForm.find(".visitor-picker").each(function () { 13198 window.pixelpoint.ppComponents.visitorPicker($(this)); 13199 }); 13200 filterForm.find(".distance-picker").each(function () { 13201 window.pixelpoint.ppComponents.distancePicker($(this)); 13202 }); 13203 filterForm.find("[data-quick-clear]").each(function () { 13204 window.pixelpoint.ppComponents.quickClear($(this)); 13205 }); 13206 filterForm.find(".belegung-component").each(function () { 13207 window.pixelpoint.ppComponents.belegung($(this)); 13208 }); 13209 filterForm.find("[data-disabler]").each(function () { 13210 window.pixelpoint.ppComponents.disabler($(this)); 13211 }); 13212 var marginInPx = $('.header-wrapper .header').height(); 13213 13214 // scroll effect on Large Screens 13215 if (Foundation.MediaQuery.current == "large") { 13216 //var marginInPxNew = $('.header-wrapper .header .main-nav').height() + 12; 13217 var marginInPxNew = $('.header-wrapper .header .main-nav').height() - 2; 13218 marginInPx = marginInPxNew; 13219 } 13220 // scroll effect on Large Screens - END 13221 13222 var marginInEm = marginInPx / parseFloat($("body").css("font-size")); 13223 if (filterForm.find("[data-order-by]").length > 0) { 13224 setTimeout(function () { 13225 var sticky = new Foundation.Sticky(filterForm.find("[data-order-by]"), { 13226 topAnchor: 'orderbywrapper:top', 13227 btmAnchor: 'rbnb-wrapper-id:bottom', 13228 marginTop: marginInEm 13229 }); 13230 $(window).trigger("load.zf.sticky"); 13231 }, 50); 13232 filterForm.find("[data-order-by]").each(function () { 13233 window.pixelpoint.ppComponents.orderBy($(this)); 13234 }); 13235 } else { 13236 if (filterForm.find(".order-by").length > 0) { 13237 setTimeout(function () { 13238 var sticky = new Foundation.Sticky(filterForm.find(".order-by"), { 13239 topAnchor: 'orderbywrapper:top', 13240 btmAnchor: 'rbnb-wrapper-id:bottom', 13241 marginTop: marginInEm 13242 }); 13243 $(window).trigger("load.zf.sticky"); 13244 }, 50); 13245 } 13246 }
13247 window.ppComponents.common.sliders(filterForm.find(".range-slider")); 13248 window.ppComponents.select2.initialize(filterForm.find('.select2')); 13249 window.ppComponents.select2.initializeRemote(filterForm.find("select.autocomplete")); 13250 filterForm.find("[data-group-selector]").each(function () { 13251 window.pixelpoint.ppComponents.groupExtension($(this)); 13252 }); 13253 filterForm.find(".loader[data-loader]").each(function () { 13254 window.pixelpoint.ppComponents.loader($(this)); 13255 }); 13256 window.ppComponents.common.showMore(filterForm.find(".more-wrapper")); 13257 privateFunctions.checkAndHideExpandButton(); 13258 window.pixelpoint.searchform.showHideTourLength(); 13259 }, 13260 reloadModule(boundingBox, callback, keepMapSection, switchValue) { 13261 switchValue = switchValue || null; 13262 var url = privateFunctions.generateFormAction(window.location.href, boundingBox, switchValue); 13263 keepMapSection = keepMapSection || false; 13264 if (!!loaderFunctions) { 13265 loaderFunctions.show(); 13266 } 13267 privateFunctions.makeSearch(url, 'GET').then(function (data) { 13268 var results = data.obj.find(".search-results .inner-wrapper").html(); 13269 var filtersHtml = $(data).find(".search > .filters-container .filter-form").html(); 13270 if (!results) results = ''; 13271 searchResultsContainer.html(results); 13272 window.pixelpoint.debug.writeFromData('json-filters', 'The json filters'); 13273 window.pixelpoint.images.initializeErrors(searchResultsContainer); 13274 if (!!isAirBnB) { 13275 if (!filtersHtml) filtersHtml = ''; 13276 privateFunctions.switchFilters(filtersHtml); 13277 } 13278 privateFunctions.populateMissingElements(); 13279 13280 //privateFunctions.initializeSliders(); 13281 window.pixelpoint.tooltip.init(searchResultsContainer.find('.ttip-blue')); 13282 window.pixelpoint.initOpeningHoursText(); 13283 $('.map-wrapper.sticky').foundation('_calc', true); 13284 if (!!loaderFunctions) { 13285 privateFunctions.afterAllImagesLoaded(searchResultsContainer).then(function () { 13286 privateFunctions.setResultItemHeight(); 13287 loaderFunctions.hide(); 13288 }); 13289 } 13290 var itemCount = $(".result-list .search-result-item").length; 13291 /* 13292 if (!supressSliding) { 13293 if (itemCount > 0) { 13294 let scrollPosition = $(".search-results").offset().top - $(".header-wrapper .header").height(); 13295 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 13296 $('html, body').animate({ 13297 scrollTop: scrollPosition 13298 }, 500); 13299 } else { 13300 let scrollPosition = $(".filters-container").offset().top - $(".header-wrapper .header").height(); 13301 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 13302 $('html, body').animate({ 13303 scrollTop: scrollPosition 13304 }, 500); 13305 } 13306 } else {
13307 supressSliding = false; 13308 } 13309 //*/ 13310 13311 if (!supressMapUpdate && !!isAirBnB) { 13312 ignoreAirBnBEvent = true; 13313 if (!keepMapSection) changeMapSection = true; // if reloading the module, we always change the map section 13314 13315 //because sometimes the map does not trigger the event after moving (have to find out the reason yet), 13316 //we have to make sure, the "ignoreAirBnBEvent" variable is set to false after a period of time 13317 setTimeout(function () { 13318 ignoreAirBnBEvent = false; 13319 }, 2000); 13320 13321 //privateFunctions.filtersToAirBnB(); 13322 privateFunctions.calculateOffset(); 13323 privateFunctions.dataToAirBnB(); 13324 } else { 13325 supressMapUpdate = false; 13326 } 13327 ajaxRequest = null; 13328 13329 // do everything for mobile 13330 if (isAirBnbOrExternalMap && $('#airbnb-buttons').is(':visible')) { 13331 followingEementInContainer($('#airbnb-buttons'), $('#search-results-for-sticky-buttons')); 13332 } 13333 if (!!callback) callback(); 13334 }); 13335 }, 13336 scrollToModule() { 13337 //scrolls to the module if, and only if, it was a click back from a detail site 13338 var currentPage = window.location.href; 13339 var key = `airBnBKeepPositionOnBack:${currentPage}`; 13340 //var key2 = `airBnBKeepPosition`; 13341 var keepPositionOnBack = window.sessionStorage.getItem(key); 13342 //var keepPosition = window.sessionStorage.getItem(key2); 13343 if (!!keepPositionOnBack) { 13344 if (window.pixelpoint.history.visitorCameBack()) { 13345 window.sessionStorage.removeItem(key); 13346 //window.sessionStorage.removeItem(key2); 13347 window.pixelpoint.utilities.scrollTo($(".search-results"), false, 0, true); 13348 } 13349 } 13350 }, 13351 collectFormData(formName) { 13352 formName = formName || 'poi'; 13353 //collecting form data for tag manager 13354 var categoryInput = $(".rbnb-wrapper [name='filters[categories][]']"); 13355 var tagInput = $(".rbnb-wrapper select[name='filters[categories][0][tags][]']"); 13356 var locationTreeInput = $(".rbnb-wrapper [name='filters[locationTree][]']"); 13357 var result = { 13358 "Regionen": null, 13359 "Orte": null, 13360 "nationale Naturlandschaften": null, 13361 "Ausflugsregionen": null, 13362 "Wassersportreviere": null, 13363 "Kategorien": null, 13364 "Unterkunftsarten": null 13365 }; 13366 var nameMap = { 13367 'region': 'Regionen', 13368 'location': 'Orte', 13369 'aqua': 'Wassersportreviere', 13370 'national': 'nationale Naturlandschaften', 13371 'excursion': 'Ausflugsregionen' 13372 }; 13373 13374 //******* first the categories */ 13375 var selections = null; 13376 var key = null; 13377 if (tagInput.length == 0) { 13378 if (categoryInput.length > 0) { 13379 selections = categoryInput.val(); 13380 } 13381 if (!selections) { 13382 var groups = $(".groups-outer-wrapper .groups section[data-group-id]"); 13383 if (groups.length > 0) { 13384 selections = []; 13385 groups.each(function () { 13386 var categoryInput = $(this).find("input[type='hidden'][name^='filters[categories]']").filter("[name$='[category]']"); 13387 if (categoryInput.length > 0) { 13388 var categoryValue = categoryInput.val(); 13389 selections.push(categoryValue); 13390 } 13391 }); 13392 } 13393 } 13394 if (!!selections) { 13395 key = 'Kategorien'; 13396 if (formName == 'accomodation') key = 'Unterkunftsarten'; 13397 if (!result[key]) result[key] = []; 13398 $.each(selections, function (i, selection) { 13399 var parts = selection.split(":"); 13400 if (!!parts) { 13401 if (parts.length > 1) { 13402 result[key].push(parts[1]); 13403 } else { 13404 result[key].push(parts[0]); 13405 } 13406 } 13407 }); 13408 } 13409 } 13410 //**********then the tags */ 13411 selections = null; 13412 if (tagInput.length > 0) { 13413 if (tagInput.hasClass("select2-hidden-accessible")) selections = tagInput.select2('data').map(function (x) { 13414 return `${x.id}:${x.text}`; 13415 });else selections = tagInput.val(); 13416 } 13417 if (!!selections) { 13418 key = 'Kategorien'; 13419 if (formName == 'accomodation') key = 'Unterkunftsarten'; 13420 if (!result[key]) result[key] = []; 13421 $.each(selections, function (i, selection) { 13422 var parts = selection.split(":");
13423 if (!!parts) { 13424 if (parts.length > 1) { 13425 result[key].push(parts[1]); 13426 } else { 13427 result[key].push(parts[0]); 13428 } 13429 } 13430 }); 13431 } 13432 if (locationTreeInput.length > 0) { 13433 selections = locationTreeInput.val(); 13434 if (!!selections) { 13435 if (!$.isArray(selections)) selections = [selections]; 13436 $.each(selections, function (i, selection) { 13437 var parts = selection.split(':'); 13438 if (parts.length >= 3) { 13439 var locationType = nameMap[parts[2]] || null; 13440 if (!!locationType) { 13441 if (!result[locationType]) result[locationType] = []; 13442 result[locationType].push(parts[1]); 13443 } 13444 } 13445 }); 13446 } 13447 } 13448 return { 13449 "Regionen": result.Regionen != null ? result.Regionen.join(',') : null, 13450 "Orte": result.Orte != null ? result.Orte.join(',') : null, 13451 "nationale Naturlandschaften": result['nationale Naturlandschaften'] != null ? result['nationale Naturlandschaften'].join(',') : null, 13452 "Ausflugsregionen": result.Ausflugsregionen != null ? result.Ausflugsregionen.join(',') : null, 13453 "Wassersportreviere": result.Wassersportreviere != null ? result.Wassersportreviere.join(',') : null, 13454 "Kategorien": result.Kategorien != null ? result.Kategorien.join(',') : null, 13455 "Unterkunftsarten": result.Unterkunftsarten != null ? result.Unterkunftsarten.join(',') : null 13456 }; 13457 }, 13458 checkAndHideExpandButton() { 13459 $(".filter-form").each((index, filterForm) => { 13460 let $filterForm = $(filterForm); 13461 let expandButton = $filterForm.find(".subtitle-aufklapbar"); 13462 let fineFilters = $filterForm.find(".fine-search"); 13463 let collapsed = fineFilters.hasClass("collapsed"); 13464 fineFilters.removeClass("collapsed"); 13465 if (fineFilters.height() == 0) { 13466 expandButton.hide(); 13467 } else { 13468 expandButton.show(); 13469 } 13470 if (!!collapsed) { 13471 fineFilters.addClass("collapsed"); 13472 setTimeout(function () { 13473 setTabIndexForElements(fineFilters, "-1"); 13474 }, 100); 13475 } else { 13476 setTimeout(function () { 13477 setTabIndexForElements(fineFilters, "0"); 13478 }, 100); 13479 } 13480 }); 13481 } 13482 }; 13483 /** 13484 * end private functions 13485 * ******************************************************************************************* 13486 * ******************************************************************************************* 13487 */ 13488 13489 //we load the filters right away 13490 privateFunctions.loadSessionFilters(); 13491 13492 /** 13493 * pagination click event 13494 */ 13495 wrapper.on("click", ".pagination li > a", function (e) { 13496 e.preventDefault(); 13497 if ($(this).hasClass("disabled")) return;
13498 supressSliding = false; 13499 var url = $(this).attr("href"); 13500 form.attr("action", url); 13501 privateFunctions.submitForm(); 13502 }); 13503 13504 //***************************************************************************** 13505 //****** TPBB-1035 ************************************************************ 13506 /** 13507 * click on button "search in area". 13508 * This button does nothing more than to zoom out. 13509 */ 13510 wrapper.on("click", ".search-in-area", function (e) { 13511 e.preventDefault(); 13512 if ($(this).hasClass("disabled")) return; 13513 var mapObject = mapFunctions.mapObject(); 13514 if (!!mapObject && !!mapObject.zoomOut) { 13515 //ZP 27.09.2022 - the "search nearby" feature should be treated as a user-map interaction event since it 13516 //uses the Boundingbox and the user clearly wants to search in a specific area 13517 mapObject.zoomOut(true, true); 13518 } 13519 }); 13520 //***************************************************************************** 13521 13522 //the search via button is a separate function since we use it on multiple locations 13523 var triggerSearch = function (supressChangeSection, allowAutomaticSliding) { 13524 $("[name='filters[productcode][]']").each(function () { 13525 if (!$(this).is('[data-preserve]')) $(this).remove(); 13526 }); 13527 var searchInsideList = $("[name='searchInsideList']"); 13528 if (searchInsideList.length > 0) { 13529 searchInsideList = searchInsideList.val() == "1"; 13530 } else { 13531 searchInsideList = false; 13532 } 13533 if (!searchInsideList) { 13534 $("[name='filters[external_id][]']").each(function () { 13535 $(this).remove(); 13536 }); 13537 } 13538 //*/ 13539 13540 $("[name='filters[related_to]']").remove(); 13541 if ($(".bis").length > 0) { 13542 if ($(".bis").is(":disabled") || $(".bis").val() == "") { 13543 $("[data-input-name='filters[price]']").closest(".control").parent().addClass("hide").prop("disabled", true); 13544 if ($("[data-input-name='filters[price]']").length > 0) { 13545 $("[name='filters[q]']").closest(".control").parent().removeClass("hide").prop("disabled", false); 13546 } 13547 } else { 13548 $("[data-input-name='filters[price]']").closest(".control").parent().removeClass("hide").prop("disabled", false); 13549 if ($("[data-input-name='filters[price]']").length > 0) { 13550 $("[name='filters[q]']").closest(".control").parent().addClass("hide").prop("disabled", true); 13551 } 13552 } 13553 } 13554 var q = wrapper.find("input[name='filters[q]']").val(); 13555 if (!!q) { 13556 privateFunctions.clearDefaultTextValue(); 13557 } else { 13558 privateFunctions.restoreDefaultValue(); 13559 } 13560 13561 //************** trigger tag manager event *********************** */ 13562 var event = "AirBnB:daten"; 13563 var formName = filtersContainer.find(".brandenbutton.search-button").closest("form[name='search']").data("form-name"); 13564 var data = privateFunctions.collectFormData(formName);
13565 window.pixelpoint.tagManager.event(event, data); 13566 var calendar = form.find(".calendar"); 13567 if (calendar.length > 0) { 13568 var dataExposed = calendar.data("exposed"); 13569 if (!!dataExposed && !!dataExposed.activate) { 13570 dataExposed.activate(); 13571 } 13572 } 13573 supressSliding = !allowAutomaticSliding; 13574 if (!supressChangeSection) changeMapSection = true; 13575 form.attr("action", ""); 13576 form.submit(); 13577 }; 13578 13579 /*** 13580 * on search button click. 13581 */ 13582 filtersContainer.on("click", ".brandenbutton.search-button", function (e) { 13583 e.preventDefault(); 13584 var currentSizeValue = $(".show-map-wrapper .switch-to-map").data('selected-value') || switchToMap.data('initial-value'); 13585 var isMapHidden = currentSizeValue == "big"; 13586 form.find("input[name='filters[additional_external_id][]']").not(".keep").remove(); 13587 var supressChangeSection = true; 13588 var data = form.serializeArray(); 13589 var usedLocations = []; 13590 $.each(data, function (index, element) { 13591 if (element.name == 'filters[locationTree][]' || element.name == 'filters[districts][]') { 13592 let splitted = element.value.split(":"); 13593 usedLocations.push(splitted[0]); 13594 } 13595 }); 13596 var mapObject = mapFunctions.mapObject(); 13597 if (usedLocations.length == 0) { 13598 //we have no locations 13599 // ZP 23.12.2021: we check the window width so that the bounding box does not mess up the result count 13600 if (!!mapObject && !isMapHidden && $(window).width() >= 960) boundingBox = mapFunctions.getBBox(); //mapObject.bbox(true); 13601 else { 13602 supressChangeSection = false; 13603 boundingBox = null; 13604 } 13605 } else if (lastUsedLocations.length > 0 && usedLocations.sort().join(",") == lastUsedLocations.sort().join(",")) { 13606 //we have the same locations as before 13607 if (!!mapObject && !isMapHidden) boundingBox = mapFunctions.getBBox(); //mapObject.bbox(true); 13608 else { 13609 supressChangeSection = false; 13610 boundingBox = null; 13611 } 13612 } else { 13613 supressChangeSection = false; 13614 boundingBox = null; 13615 //ZP 08.09.2022 - check variable definition for detailed description 13616 lockedAfterUserInteraction = false; 13617 } 13618 if ($(".brandenbutton.search-button").data("ignore-bbox") == 1) { 13619 boundingBox = null; 13620 supressChangeSection = false; 13621 $(".brandenbutton.search-button").removeData("ignore-bbox").removeAttr("data-ignore-bbox"); 13622 } 13623 lastUsedLocations = usedLocations; 13624 triggerSearch(supressChangeSection, true); 13625 }); 13626 13627 /*** 13628 * subscribing to an event, that only gets triggered if the bullseye icon next to the location input gets clicked 13629 * it gets triggered if the browser can successfully determine the user location 13630 */ 13631 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.airBnBSearch, function () { 13632 triggerSearch(); 13633 }); 13634 13635 /*** 13636 * the submit event. We handle the submit of the form manually. 13637 */ 13638 form.submit(function (e) { 13639 e.preventDefault(); 13640 if (privateFunctions.validateForm(true)) { 13641 //if we have a soft search and the location has not changed we keep the bounding 13642 //box (ZP 22.12.2022, TPBB-1143, comment from 6. Dezember 2022) 13643 //debugger 13644 let isSoftSearchAndLocationChanged = $("[data-soft-search]").data("soft-search") == 1; 13645 if (isSoftSearchAndLocationChanged) { 13646 const locationValue = $("select.locationTree").val(); 13647 if (!locationValue && !!$("select.locationTree").data('soft-search-last-location')) { 13648 //the location did not change 13649 isSoftSearchAndLocationChanged = true; 13650 } else { 13651 isSoftSearchAndLocationChanged = false; 13652 } 13653 } 13654 privateFunctions.submitForm(null, false, isSoftSearchAndLocationChanged); 13655 } 13656 }); 13657 13658 /*** 13659 * if any form input data has been changed we change the text of the submit button 13660 */ 13661 $('body').on("change", ".filter-form :input", function () { 13662 $(this).closest("form").find(".main-filters >.row >.float-right button.search-button").html(window.ppt.translate("button.now.searchagain", "Erneut suchen!")); 13663 }); 13664 13665 /*** 13666 * after everything has been loaded we make magic. 13667 * this is the part of the code that prevents us to have an effective asynchronous load. Maybe we can do 13668 * something about this some day 13669 */ 13670 var onWindowLoaded = function () { 13671 /*** 13672 * do everything for mobile 13673 */ 13674 if (isAirBnbOrExternalMap && $('#airbnb-buttons').is(':visible')) { 13675 followingEementInContainer($('#airbnb-buttons'), $('#search-results-for-sticky-buttons')); 13676 privateFunctions.switchToDefaultView(); 13677 if ($('.toMap', $('#airbnb-buttons')).is(":visible")) { 13678 if ($("#search-wrapper-id > .map-parent-container").length) { 13679 $("#search-wrapper-id > .map-parent-container").removeClass('map-is-visible map-is-hidden').addClass('map-is-hidden'); 13680 } 13681 $("#rbnb-wrapper-id .map-container .map-wrapper").removeClass('map-is-visible map-is-hidden').addClass('map-is-hidden'); 13682 } else { 13683 if ($("#search-wrapper-id > .map-parent-container").length) { 13684 $("#search-wrapper-id > .map-parent-container").removeClass('map-is-visible map-is-hidden').addClass('map-is-visible'); 13685 } 13686 $("#rbnb-wrapper-id .map-container .map-wrapper").removeClass('map-is-visible map-is-hidden').addClass('map-is-visible'); 13687 } 13688 $('body').on("click", "#changeView", function () { 13689 changeAirBnbView($(this), false); 13690 }); 13691 $('body').on("click", "#toFilter", function () { 13692 scrollToFilter(); 13693 }); 13694 } 13695 13696 /*** 13697 * after the map has been loaded 13698 */ 13699 mapLoadedDefer.done(function () { 13700 /** 13701 * if we have a predefined region we set the map to that region 13702 */ 13703 //TODO 13704 13705 /*** 13706 * we set the initial bbox. If none has been set we reload the module anyways. 13707 * If the rrequest was a GET request we literally reload the module. 13708 * if the request was a POST request we submit the form again 13709 */ 13710 privateFunctions.initialSetBBox(true); 13711 var map = mapFunctions.mapObject(); 13712 13713 /*** 13714 * only if we have a map object (airbnb) 13715 */ 13716 if (!!map) { 13717 /*** 13718 * common code wrapped in a function so we can use it multiple times below 13719 */ 13720 var onSearchTriggered = function (data) { 13721 //a small hack to make debugging easier 13722 if (!!window.forDebugging) return; 13723 13724 //if we do not have a bbox we do not ignore the airbnb event 13725 //if (!data.bbox) { 13726 // ignoreAirBnBEvent = false;
13727 // return; 13728 //} 13729 13730 if (!!moveEndTimeout) { 13731 clearTimeout(moveEndTimeout); 13732 } 13733 moveEndTimeout = setTimeout(function () { 13734 if (!!ignoreAirBnBEvent) { 13735 ignoreAirBnBEvent = false; 13736 return; 13737 } 13738 const isSoftSearch = $("[data-soft-search]").data("soft-search") == 1; 13739 if (isSoftSearch) { 13740 $("select.locationTree").data('soft-search-last-location', $("select.locationTree").val()).val(""); //.trigger("change"); // we need the location to still be displayed 13741 } 13742 /* 13743 Slack Change 28.06.2022: 13744 if the map is hidden we have to ignore the boundingbox! 13745 */ 13746 if (wrapper.find(".search-wrapper.hiddenMap").length > 0) { 13747 mapFunctions.removeBBox(); 13748 } else { 13749 boundingBox = mapFunctions.changeBBox(data.bbox); 13750 } 13751 //ZP 05.09.2022 - we need the softsearch parameter. If softsearch is enabled we still need the boundingbox. 13752 // right now we only use it here since this is the point where a map movement may trigger 13753 // a search and thus this is the only? place where soft-search is relevant. Other calls refer to manual search and simmilar. There we avoid the boundingbox 13754 // even if soft-search is anabled. 13755 privateFunctions.submitForm(null, !!data.isUserInteractionEvent, !!isSoftSearch); 13756 }, 300); 13757 }; 13758 13759 //* 13760 map.$on("moveend", function (data) { 13761 if (mapFunctions.isSearchOnMoveActive() && !mapFunctions.isSearchSupressed()) { 13762 //ZP 12.05.2020: 13763 // we set the page to 1 to avoid misleading results. If you move the map 13764 // or zoom in you get less results. If you are on the last page you get "no results" 13765 // which is misleading 13766 form.attr("action", privateFunctions.removePageParameter(form.attr("action"))); 13767 // end 13768 13769 // ZP 18.05.2020 - TPBB-1069(not part of ticket, problem was just referenced here): 13770 // if map was moved we can not move the map again when we send the results to the map 13771 mapFunctions.mapObject().fixMapPosition = true; 13772 setTimeout(() => { 13773 mapFunctions.mapObject().fixMapPosition = false; 13774 }, 5000); 13775 onSearchTriggered(data); 13776 } 13777 }); 13778 map.$on("searchtrigerred", function (data) { 13779 onSearchTriggered(data); 13780 }); 13781 //*/ 13782 map.$on("highlightover", function (data) { 13783 if (!!window.forDebugging) return; 13784 if (!$('#airbnb-buttons').is(':visible')) { 13785 var id = data.id || 0; 13786 var item = $(`.search-result-item[data-id='${id}']`); 13787 item.addClass("map-hover"); 13788 } 13789 }); 13790 map.$on("highlightout", function (data) { 13791 if (!!window.forDebugging) return; 13792 $(".search-result-item").removeClass("map-hover"); 13793 }); 13794 wrapper.find(".search").on("mouseover", ".search-result-item", function () { 13795 var id = $(this).data("id"); 13796 if (!id) { 13797 return; 13798 } 13799 mapFunctions.mapObject().focusItem(id); 13800 if (!!mapFunctions.mapObject().focusTour) mapFunctions.mapObject().focusTour(id); 13801 }); 13802 wrapper.find(".search").on("mouseout", ".search-result-item", function () { 13803 var id = $(this).data("id"); 13804 if (!id) { 13805 return; 13806 } 13807 if (!!mapFunctions.mapObject().unfocusTour) mapFunctions.mapObject().unfocusTour(id); 13808 }); 13809 } 13810 }); 13811 setTimeout(function () { 13812 privateFunctions.scrollToModule(); 13813 }, 250); 13814 var map = mapFunctions.mapObject(); 13815 if (!!map) { 13816 //privateFunctions.filtersToAirBnB(); 13817 privateFunctions.calculateOffset(); 13818 privateFunctions.dataToAirBnB(); 13819 mapLoadedDefer.resolve(); 13820 } else { 13821 var switchToMap = $(".show-map-wrapper .switch-to-map"); 13822 var currentValue = switchToMap.data('selected-value') || switchToMap.data('initial-value'); 13823 if (switchToMap.length == 0 || currentValue == 'small') { 13824 window.pixelpoint.map.scriptsLoaded(function () { 13825 if (typeof Vue !== 'undefined') { 13826 window.ppcartoAirbnb = new Vue({ 13827 el: '#ppcarto-airbnb' 13828 }); 13829 } 13830 let interval1 = setInterval(() => { 13831 let mapObject = mapFunctions.mapObject(); 13832 if (!!mapObject) { 13833 clearInterval(interval1); 13834 privateFunctions.calculateOffset(); 13835 privateFunctions.dataToAirBnB(); 13836 mapLoadedDefer.resolve(); 13837 } 13838 }, 200); 13839 }); 13840 } else { 13841 //switchToMap.one("click", function () { 13842 $(document).ready(() => { 13843 let componentReadyInterval = setInterval(() => { 13844 // Check if Vue is defined before accessing its properties 13845 if (typeof Vue !== 'undefined' && Vue.options && Vue.options.components) { 13846 let componentExists = 'ppcarto-airbnb' in Vue.options.components; 13847 if (componentExists) { 13848 clearInterval(componentReadyInterval); 13849 window.ppcartoAirbnb = new Vue({ 13850 el: '#ppcarto-airbnb' 13851 }); 13852 } 13853 } 13854 }, 200); 13855 }); 13856 let interval2 = setInterval(() => { 13857 let mapObject = mapFunctions.mapObject(); 13858 if (!!mapObject) { 13859 clearInterval(interval2); 13860 privateFunctions.calculateOffset(); 13861 privateFunctions.dataToAirBnB(); 13862 mapLoadedDefer.resolve(); 13863 } 13864 }, 200); 13865 13866 //}); 13867 13868 $('#airbnb-buttons').one("click", function () { 13869 switchToMap.click(); 13870 }); 13871 } 13872 } 13873 var switchToMap = $(".show-map-wrapper .switch-to-map"); 13874 var curValue = switchToMap.data('selected-value') || switchToMap.data('initial-value'); 13875 if (switchToMap.length == 0 || curValue == 'big') { 13876 switchToMap.one("click", function () { 13877 setTimeout(function () { 13878 //privateFunctions.filtersToAirBnB(); 13879 privateFunctions.calculateOffset(); 13880 }, 200); 13881 }); 13882 } 13883 13884 //****** we hide the expand button if necessary */ 13885 privateFunctions.checkAndHideExpandButton(); 13886 //********************************************* */ 13887 privateFunctions.populateMissingElements(); 13888 }; 13889 if (document.readyState === "complete") { 13890 onWindowLoaded(); 13891 } else { 13892 $(window).on("load", onWindowLoaded); 13893 } 13894 $(window).on("orientationchange resize", function () { 13895 if (!!window.forDebugging) { 13896 return; 13897 } 13898 if (isAirBnB) { 13899 privateFunctions.calculateOffset(); 13900 } 13901 13902 // do everything for mobile 13903 if (isAirBnbOrExternalMap && $('#airbnb-buttons').is(':visible')) { 13904 followingEementInContainer($('#airbnb-buttons'), $('#search-results-for-sticky-buttons')); 13905 privateFunctions.switchToDefaultView(); 13906 } 13907 privateFunctions.setResultItemHeight(); 13908 }); 13909 wrapper.on("click", ".einklappen.row-collapse", function () { 13910 $('.map-wrapper.sticky').foundation('_calc', true); 13911 }); 13912 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.toggleCloseAfter, function () { 13913 $('.map-wrapper.sticky').foundation('_calc', true); 13914 }); 13915 13916 //small tag manager snippet****************** 13917 wrapper.on("click", function (e) { 13918 var event = "AirBnB:click"; 13919 var data = { 13920 clickOnMap: false, 13921 AirBnBFilterClick: false 13922 }; 13923 var target = $(e.target); 13924 if (target.closest(".search-wrapper .search").length == 0) { 13925 data.clickOnMap = true; 13926 } 13927 if (target.closest("form[name='search']").length > 0) { 13928 data.AirBnBFilterClick = target.closest("form[name='search']").data("form-name") || true; 13929 }
13930 window.pixelpoint.tagManager.event(event, data); 13931 }); 13932 13933 //some navigational stuff 13934 wrapper.on("click", ".search-result-item a", function (e) { 13935 if (!!window.sessionStorage) { 13936 var currentPage = window.location.href; 13937 window.sessionStorage.setItem(`airBnBKeepPositionOnBack:${currentPage}`, 1); 13938 window.sessionStorage.setItem(`comesFromAirBnB`, moment().unix()); 13939 } 13940 }); 13941 window.pixelpoint.searchform.showHideTourLength(); 13942}); 13943function initStickyAirBnBelements() { 13944 var marginInPx = $('.header-wrapper .header').height(); 13945 13946 // scroll effect on Large Screens 13947 if (Foundation.MediaQuery.current == "large") { 13948 var marginInPxNew = $('.header-wrapper .header .main-nav').height() - 2; 13949 marginInPx = marginInPxNew; 13950 } 13951 // scroll effect on Large Screens - END 13952 13953 var marginInEm = marginInPx / parseFloat($("body").css("font-size")); 13954 var moduleId = "#rbnb-wrapper-id"; 13955 if ($("#external-map-wrapper-id").length) { 13956 moduleId = "#external-map-wrapper-id"; 13957 } 13958 $(moduleId + ' .sticky').attr('data-margin-top', marginInEm).data('margin-top', marginInEm); 13959 if ($(moduleId + ' .sticky').attr('data-sticky')) { 13960 $('.map-wrapper.sticky').foundation('_calc', true); 13961 } else { 13962 $(moduleId + ' .sticky').attr('data-sticky', 'true').foundation(); 13963 } 13964 var ieSearchWrapperHeight = $(window).height() - marginInPx; 13965 $(".internet-explorer .external-map-wrapper .search-wrapper, .internet-explorer .global-search .search-wrapper, .internet-explorer .rbnb-wrapper .search-wrapper").css("max-height", ieSearchWrapperHeight + "px"); 13966} 13967var intervalFollingElementInContainer = setInterval(function () {}, 100); 13968function followingEementInContainer($elem, $container) { 13969 clearInterval(intervalFollingElementInContainer); 13970 var $window = $(window); 13971 var scrolled = false; 13972 $window.scroll(function () { 13973 scrolled = true; 13974 }); 13975 intervalFollingElementInContainer = setInterval(function () { 13976 if (scrolled) { 13977 var containerTop = $container.offset().top; 13978 var containerBottom = containerTop + $container.outerHeight(); 13979 var viewportTop = $window.scrollTop(); 13980 var viewportBottom = viewportTop + $window.height(); 13981 if (containerTop < viewportBottom && viewportBottom < containerBottom) { 13982 $elem.css({ 13983 opacity: 1, 13984 position: 'fixed', 13985 bottom: 0 13986 }); 13987 } else { 13988 $elem.css({ 13989 opacity: 1, 13990 position: 'absolute', 13991 bottom: 0 13992 }); 13993 } 13994 scrolled = false; 13995 } 13996 }, 100); 13997} 13998function changeAirBnbView($this, scrollToFilter) { 13999 var shownButtonTextClass = '.toMap'; 14000 var hiddenButtonTextClass = '.toList'; 14001 var mapZindex = 10; 14002 var resultsZindex = 100; 14003 let mobileDisplayClass = 'map-is-hidden'; 14004 var resultsMaxHeight = 'none'; 14005 var $followElem = $('#search-results-for-sticky-buttons'); 14006 var airBnbWrapperHeight = 'auto'; 14007 var $buttonFollowingElem = $('#search-results-for-sticky-buttons'); 14008 var moduleId = "#rbnb-wrapper-id"; 14009 if ($("#external-map-wrapper-id").length) { 14010 moduleId = "#external-map-wrapper-id"; 14011 } 14012 if ($('.toMap', $this).is(":visible")) { 14013 shownButtonTextClass = '.toList'; 14014 hiddenButtonTextClass = '.toMap'; 14015 mobileDisplayClass = 'map-is-visible'; 14016 mapZindex = 101; 14017 resultsZindex = 10; 14018 resultsMaxHeight = $(moduleId + " .map-container .map-wrapper").height() + 'px'; 14019 $followElem = $(moduleId + ' .map-container .map-wrapper'); 14020 airBnbWrapperHeight = resultsMaxHeight; 14021 $buttonFollowingElem = $('#search-wrapper-id'); 14022 } else {} 14023 $(hiddenButtonTextClass, $this).hide(); 14024 $(shownButtonTextClass, $this).show(); 14025 if ($("#search-wrapper-id > .map-parent-container").length) { 14026 $("#search-wrapper-id > .map-parent-container").css('z-index', mapZindex).removeClass('map-is-visible map-is-hidden').addClass(mobileDisplayClass); 14027 } 14028 $("#rbnb-wrapper-id .map-container .map-wrapper").css('z-index', mapZindex).removeClass('map-is-visible map-is-hidden').addClass(mobileDisplayClass); 14029 $("#search-wrapper-id > .search").css({ 14030 'z-index': resultsZindex, 14031 'max-height': resultsMaxHeight 14032 }); 14033 $('#rbnb-wrapper-id').height(airBnbWrapperHeight); 14034 $this.removeClass("ui-btn-active"); 14035 followingEementInContainer($('#airbnb-buttons'), $buttonFollowingElem); 14036 if (scrollToFilter) { 14037 setTimeout(() => { 14038 $("html, body").animate({ 14039 scrollTop: $("#search-wrapper-id").offset().top - $('.header-wrapper .header').height() 14040 }, 800); 14041 }, 200); 14042 } else { 14043 setTimeout(() => { 14044 $("html, body").animate({ 14045 scrollTop: $followElem.offset().top - $('.header-wrapper .header').height() 14046 }, 800); 14047 }, 200); 14048 } 14049} 14050function scrollToFilter() { 14051 if ($('#changeView .toMap').is(":visible")) { 14052 $("html, body").animate({ 14053 scrollTop: $("#search-wrapper-id").offset().top - $('.header-wrapper .header').height() 14054 }, 800); 14055 } else if ($('#changeView .toList').is(":visible")) { 14056 changeAirBnbView($('#changeView'), true); 14057 } 14058} 14059jQuery(function () { 14060 /* 14061 Whole Wrapper 14062 #external-map-wrapper-{contentObject.uid} 14063 .external-map-wrapper 14064 Search Wrapper 14065 #search-wrapper-{contentObject.uid} 14066 .search-wrapper 14067 Search Results 14068 .search-results 14069 Map Wrapper 14070 .map-wrapper .ppcarto-airbnb 14071 or 14072 .map-wrapper .ppcarto-static 14073 .airbnb-change-view-buttons button.changeView 14074 */ 14075 14076 window.forDebugging = false;
14077 14078 /** 14079 * the geojson data of the loaded list 14080 * @type {Array} 14081 */ 14082 var geojsonData = []; 14083 var sessionRequestUrl = window.pixelpoint.utilities.getAjaxUrl(`/index.php?action=sessionFilters&type=1732176051`); 14084 var mapFunctions = { 14085 mapObject($wrapper) { 14086 var staticWrapper = $wrapper.find(".ppcarto-static"); 14087 var map = staticWrapper.data("ppcarto-static") || null; 14088 if (!!map && !!map.$refs && !!map.$refs.static) return map.$refs.static; 14089 if (staticWrapper.length == 0) { 14090 staticWrapper = $wrapper.find(".ppcarto-airbnb"); 14091 map = staticWrapper.data("ppcarto-airbnb") || null; 14092 if (!!map && !!map.$refs && !!map.$refs.airbnb) return map.$refs.airbnb; 14093 } 14094 return null; 14095 }, 14096 getMapType() { 14097 return "static"; 14098 }, 14099 removeBBox($wrapper) { 14100 var mapObject = mapFunctions.mapObject($wrapper); 14101 if (!!mapObject.filter && !!mapObject.filter.bbox) { 14102 delete mapObject.filter.bbox; 14103 } 14104 }, 14105 reloadData($wrapper) { 14106 var mapObject = mapFunctions.mapObject($wrapper); 14107 if (!!mapObject) { 14108 mapObject.init = true; 14109 mapObject.getData(); 14110 } 14111 }, 14112 isSearchOnMoveActive($wrapper) { 14113 var mapObject = mapFunctions.mapObject($wrapper); 14114 return mapObject.triggerSearchOnMove || false; 14115 }, 14116 isSearchSupressed($wrapper) { 14117 var mapObject = mapFunctions.mapObject($wrapper); 14118 return mapObject.supressSearch || false; 14119 }, 14120 changeBBox(bbox) { 14121 if (!bbox) return bbox; 14122 let splittedBox = bbox.split(","); 14123 if (splittedBox.length >= 4) { 14124 if (parseFloat(splittedBox[0]) > parseFloat(splittedBox[1])) { 14125 let tmp = splittedBox[0]; 14126 splittedBox[0] = splittedBox[1]; 14127 splittedBox[1] = tmp; 14128 } 14129 if (parseFloat(splittedBox[2]) > parseFloat(splittedBox[3])) { 14130 let tmp = splittedBox[2]; 14131 splittedBox[2] = splittedBox[3]; 14132 splittedBox[3] = tmp; 14133 } 14134 14135 // we switch the 2nd and 4th coordinate 14136 if (parseFloat(splittedBox[1]) > parseFloat(splittedBox[3])) { 14137 let tmp = splittedBox[1]; 14138 splittedBox[1] = splittedBox[3]; 14139 splittedBox[3] = tmp; 14140 } 14141 //end 14142 14143 bbox = splittedBox.join(","); 14144 } 14145 return bbox; 14146 }, 14147 getBBox($wrapper) { 14148 var mapObject = mapFunctions.mapObject($wrapper); 14149 let bbox = '0,0,0,0'; 14150 if (mapObject && mapObject.bbox) { 14151 bbox = mapObject.bbox(); 14152 bbox = mapFunctions.changeBBox(bbox); 14153 } 14154 return bbox; 14155 } 14156 }; 14157 var privateFunctions = { 14158 collectPoiData($html = null) { 14159 geojsonData = []; 14160 var $elements = null; 14161 if ($html == null) { 14162 $elements = wrapper.find("[data-geojson]"); 14163 } else { 14164 $elements = $html.find("[data-geojson]"); 14165 } 14166 $elements.each(function () { 14167 var geojson = $(this).data('geojson'); 14168 if (!!geojson) { 14169 geojsonData.push(geojson); 14170 } 14171 }); 14172 }, 14173 switchToDefaultView($wrapper) { 14174 var switchToMap = $wrapper.find(".show-map-wrapper .switch-to-map"); 14175 if (switchToMap.length == 0) return; 14176 var id = switchToMap.data('switch-trigger'); 14177 if (!id) return; 14178 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.switchSetDefault + ":" + id); 14179 }, 14180 addBBox(data, bbox) { 14181 if (!bbox) return data; 14182 if (!bbox[0] || !bbox[0][0] || !bbox[0][1] || !bbox[1] || !bbox[1][0] || !bbox[1][1]) return data; //bbox malformed 14183 for (var i = 0; i < 2; i++) { 14184 for (var j = 0; j < 2; j++) { 14185 var obj = { 14186 'name': `filters[bbox][${i}][${j}]`, 14187 'value': bbox[i][j] 14188 }; 14189 data.push(obj); 14190 } 14191 } 14192 return data; 14193 }, 14194 loadSessionFilters(sessionFiltersDeferred, cid) { 14195 if (!sessionFiltersDeferred) { 14196 sessionFiltersDeferred = $.Deferred(function (defer) { 14197 $.ajax(sessionRequestUrl, { 14198 method: "POST", 14199 data: JSON.stringify({ 14200 keys: ['AirBnB', cid], 14201 url: window.location.href 14202 }), 14203 contentType: "application/json; charset=utf-8" 14204 }).done(function (data, textStatus, request) { 14205 defer.resolve(data); 14206 }).fail(defer.reject).always(defer.always); 14207 }).promise(); 14208 } 14209 return sessionFiltersDeferred; 14210 }, 14211 getStickyElementHeight($blogHeader, outer) { 14212 if (typeof outer === 'undefined') { 14213 outer = true; 14214 } 14215 var addAnchored = false;
14216 var removeIsStuck = false; 14217 if ($blogHeader.hasClass("is-anchored")) { 14218 $blogHeader.removeClass("is-anchored"); 14219 addAnchored = true; 14220 } 14221 if (!$blogHeader.hasClass("is-stuck")) { 14222 $blogHeader.addClass("is-stuck"); 14223 removeIsStuck = true; 14224 } 14225 var result = 0; 14226 if (!!outer) { 14227 result = $blogHeader.outerHeight(); 14228 } else { 14229 result = $blogHeader.height(); 14230 } 14231 if (addAnchored) { 14232 $blogHeader.addClass("is-anchored"); 14233 } 14234 if (removeIsStuck) { 14235 $blogHeader.removeClass("is-stuck"); 14236 } 14237 return result; 14238 }, 14239 getHeaderHeight($wrapper, outer) { 14240 if (typeof outer === 'undefined') { 14241 outer = true; 14242 } 14243 var result = 0; 14244 var $blogHeader = $wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky"); 14245 var $blogHeaderStuck = $wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky.is-stuck"); 14246 if (!!outer) { 14247 if (!!$wrapper && $blogHeaderStuck.length > 0) { 14248 result = $(".header-wrapper .header").outerHeight() + $blogHeaderStuck.outerHeight(); 14249 } else if (!!$wrapper && $blogHeader.length > 0) { 14250 result = $(".header-wrapper .header").outerHeight() + privateFunctions.getStickyElementHeight($blogHeader, true); 14251 } 14252 } else { 14253 if (!!$wrapper && $blogHeaderStuck.length > 0) { 14254 result = $(".header-wrapper .header").height() + $blogHeaderStuck.height(); 14255 } else if (!!$wrapper && $blogHeader.length > 0) { 14256 result = $(".header-wrapper .header").height() + privateFunctions.getStickyElementHeight($blogHeader, false); 14257 } 14258 } 14259 return result; 14260 }, 14261 getRealWindowHeight($wrapper) { 14262 return $(window).height() - privateFunctions.getHeaderHeight($wrapper); 14263 }, 14264 getRealScrollPosition(scrollPosition, $wrapper) { 14265 var bottomModulePosition = $wrapper.offset().top + $wrapper.height(); 14266 if (bottomModulePosition - scrollPosition < privateFunctions.getRealWindowHeight($wrapper)) { 14267 return bottomModulePosition - $(window).height(); 14268 } 14269 return scrollPosition; 14270 }, 14271 clearDefaultTextValue($wrapper) { 14272 //clears the default text value. Since the preset text value must not be visible, we have to set it each time. This function 14273 //the default text value. It is called on clicko on the button 14274 var input = $wrapper.find("input[name='filters[q]']"); 14275 if (!input.data('saved-default-value')) input.data('saved-default-value', input.data('default-value')); 14276 input.data('default-value', ''); 14277 }, 14278 restoreDefaultValue($wrapper) { 14279 var input = $wrapper.find("input[name='filters[q]']"); 14280 if (!!input.data('saved-default-value')) input.data('default-value', input.data('saved-default-value')); 14281 }, 14282 setDefaultValue(data, $wrapper) { 14283 //sets the default value since we need to use it in some cases (if the map moves for example) 14284 var defaultValue = $wrapper.find("input[name='filters[q]']").data('default-value'); 14285 if (!!defaultValue) { 14286 $.each(data, function (index, element) { 14287 if (element.name == "filters[q]") { 14288 element.value = defaultValue; 14289 } 14290 }); 14291 } 14292 return data; 14293 }, 14294 moveToElement(data) { 14295 var id = data.id || 0; 14296 if (!id) { 14297 return; 14298 } 14299 var searchResultItem = $(`.search-result-item[data-id='${id}']`); //that's ok 14300 14301 if (searchResultItem.length == 0) { 14302 return searchResultItem; 14303 } 14304 var headerHeight = $(".header-wrapper .header").height() || 0; 14305 var offset = searchResultItem.offset(); 14306 var topOffset = offset.top; 14307 var bottomOffset = offset.top + searchResultItem.height(); 14308 if (topOffset < $(window).scrollTop() + headerHeight || bottomOffset > $(window).scrollTop() + $(window).height()) { 14309 // Not in view so scroll to it 14310 var scrollPosition = topOffset - headerHeight - 10; 14311 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition); 14312 $('html,body').animate({ 14313 scrollTop: scrollPosition 14314 }, 500); 14315 } 14316 return searchResultItem; 14317 }, 14318 afterAllImagesLoaded($container) { 14319 var d = $.Deferred(); 14320 var imgs = $container.find("img"); 14321 imgs.one("load.allimages error.allimages", function () { 14322 imgs = imgs.not(this); 14323 if (imgs.length == 0) { 14324 d.resolve(); 14325 } 14326 }); 14327 var complete = imgs.filter(function () { 14328 return this.complete; 14329 }); 14330 complete.off(".allimages"); 14331 imgs = imgs.not(complete); 14332 complete = undefined; 14333 if (imgs.length == 0) { 14334 d.resolve(); 14335 } 14336 return d.promise(); 14337 }, 14338 setResultItemHeight($wrapper) { 14339 var equalHeighElem = $wrapper.find(".search-wrapper .search-result-item"); 14340 setTimeout(function () { 14341 equalHeight(equalHeighElem, true); 14342 initStickyMapElements($wrapper); 14343 }, 300); 14344 }, 14345 validateForm(displayErrors, form) { 14346 displayErrors = displayErrors || false;
14347 form.find(".invalid").removeClass("invalid"); 14348 var valid = true; 14349 var visitorPicker = form.find(".visitor-picker"); 14350 if (visitorPicker.length > 0) { 14351 var formFunctions = visitorPicker.data("form-element-functions"); 14352 if (!!formFunctions.get) { 14353 var visitors = formFunctions.get(); 14354 if (!!visitors.kids && visitors.kids > 0) { 14355 if (visitorPicker.is("[data-to-disable]")) { 14356 var von = form.find(".calendar input.von").val(); 14357 var bis = form.find(".calendar input.bis").val(); 14358 if (!von || !bis) { 14359 valid = false; 14360 if (displayErrors) { 14361 form.find(".calendar").closest(".element-wrapper").addClass("invalid"); 14362 } 14363 } 14364 } 14365 } 14366 } 14367 if (!!formFunctions.valid) { 14368 if (!formFunctions.valid(true)) { 14369 valid = false; 14370 } 14371 } 14372 } 14373 return valid; 14374 }, 14375 generateFormAction(url, bbox, switchValue, $wrapper) { 14376 var cid = $wrapper.data("cid"); 14377 var pid = $wrapper.data("pid"); 14378 if (!cid || !pid) { 14379 return url; 14380 } 14381 bbox = bbox || null; 14382 switchValue = switchValue || null; 14383 var domainReloadParameters = window.pixelpoint.utilities.getSysPageUrl(); 14384 var parsed = window.pixelpoint.utilities.parseUrl(url); 14385 parsed.baseUrl = domainReloadParameters.baseUrl; //window.location.origin; 14386 if (domainReloadParameters.useAjaxRenderPageId) parsed.queryParameters['id'] = domainReloadParameters.ajaxRenderPageId; 14387 //parsed.queryParameters.id = window.pixelpoint.domainService.get("ajaxRenderPage");//1568; 14388 parsed.queryParameters.cid = cid; 14389 parsed.queryParameters.pid = pid; 14390 parsed.queryParameters.no_cache = 1; 14391 if (!!switchValue) { 14392 parsed.queryParameters.switchValue = switchValue; 14393 } else { 14394 if ($wrapper.find('[name="switchValue"]').length > 0) { 14395 parsed.queryParameters.switchValue = $wrapper.find('[name="switchValue"]').val(); 14396 } 14397 } 14398 if (!!parsed.queryParameters.cHash) { 14399 delete parsed.queryParameters.cHash; 14400 } 14401 if (!!bbox) { 14402 if ($.isArray(bbox)) bbox = bbox.join(); 14403 parsed.queryParameters.bbox = bbox; 14404 } 14405 return window.pixelpoint.utilities.buildUrl(parsed); 14406 }, 14407 submitForm(callback, $wrapper) { 14408 var form = $wrapper.find(".search > .filters-container form"); 14409 var loaderFunctions = $wrapper.find(".search-results .loader[data-loader]").data("exposed"); 14410 if (form.length == 0) return; 14411 var url = form.attr('action'); 14412 if (!url) { 14413 url = window.location.href; 14414 } 14415 var switchToMap = $wrapper.find(".show-map-wrapper .switch-to-map"); 14416 if (switchToMap.length > 0) { 14417 var currentValue = switchToMap.data('selected-value') || switchToMap.data('initial-value'); 14418 url = privateFunctions.generateFormAction(url, null, currentValue, $wrapper); 14419 } else { 14420 url = privateFunctions.generateFormAction(url, null, null, $wrapper); 14421 } 14422 var method = form.attr('method'); 14423 if (!!loaderFunctions) { 14424 loaderFunctions.show(); 14425 } 14426 var bbox = $wrapper.ppcommon("boundingBox"); 14427 bbox = mapFunctions.changeBBox(bbox); 14428 var selectedRegionId = null; 14429 var selectedRegionType = ""; 14430 //var zoomToCoordinates = []; //@deprecated 14431 14432 privateFunctions.clearRegionFromAirBnB($wrapper); 14433 var data = form.serializeArray(); 14434 $.each(data, function (index, element) { 14435 // we get the first selected region (if there is any) 14436 if (selectedRegionId == null) { 14437 if (element.name == 'filters[locationTree][]') { 14438 if (element.value.indexOf(":region") > -1) { 14439 let splitted = element.value.split(":"); 14440 selectedRegionId = splitted[0]; 14441 selectedRegionType = 'region'; 14442 } else if (element.value.indexOf(":aqua") > -1) { 14443 let splitted = element.value.split(":"); 14444 selectedRegionId = splitted[0]; 14445 selectedRegionType = 'aquaticsdistrict'; 14446 } else if (element.value.indexOf(":national") > -1) { 14447 let splitted = element.value.split(":"); 14448 selectedRegionId = splitted[0]; 14449 selectedRegionType = 'nationallandscape'; 14450 } else if (element.value.indexOf(":excursion") > -1) { 14451 let splitted = element.value.split(":"); 14452 selectedRegionId = splitted[0]; 14453 selectedRegionType = 'excursion'; 14454 } 14455 } 14456 } 14457 if (element.name == 'filters[q]') { 14458 if (!element.value) { 14459 var defaultData = $wrapper.find(`[name='filters[q]']`).data('default-value'); 14460 if (!!defaultData) element.value = defaultData; 14461 } 14462 } 14463 }); 14464 14465 //set the default value, if it exists 14466 data = privateFunctions.setDefaultValue(data, $wrapper); 14467 14468 //add the geojson data, if existing 14469 if (!!bbox && $.isArray(bbox)) { 14470 data = privateFunctions.addBBox(data, bbox); 14471 } else if (!!bbox && $.type(bbox) === "string") { 14472 data.push({ 14473 name: "filters[bbox]", 14474 value: bbox 14475 }); 14476 } 14477 var dataToSend = $.param(data); 14478 if (!!$wrapper.ppcommon("ajaxRequest")) { 14479 $wrapper.ppcommon("ajaxRequest").abort(); 14480 } 14481 form.find(".groups").hide(); 14482 var searchResultsContainer = $wrapper.find(".search-results .inner-wrapper"); 14483 var cid = $wrapper.data("cid"); 14484 var ajaxRequest = $.ajax({ 14485 type: method, 14486 url: url, 14487 data: data, 14488 success: function (data) { 14489 var results = $(data).find(`[data-cid='${cid}'] .search-results .inner-wrapper`).html(); 14490 if (!results) results = ''; 14491 searchResultsContainer.html(results); 14492 14493 //privateFunctions.initializeSliders(); 14494 window.pixelpoint.tooltip.init(searchResultsContainer.find('.tt
14494ip-blue')); 14495 window.pixelpoint.initOpeningHoursText(); 14496 $wrapper.find('.map-wrapper.sticky').foundation('_calc', true); 14497 if (!!loaderFunctions) { 14498 privateFunctions.afterAllImagesLoaded(searchResultsContainer).then(function () { 14499 privateFunctions.setResultItemHeight($wrapper); 14500 loaderFunctions.hide(); 14501 }); 14502 } 14503 var itemCount = $wrapper.find(".result-list .search-result-item").length; 14504 if (!$wrapper.ppcommon("supressSliding")) { 14505 if (itemCount > 0) { 14506 let scrollPosition = $wrapper.find(".search-results").offset().top - $wrapper.find(".header-wrapper .header").height(); 14507 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition, $wrapper); 14508 $('html, body').animate({ 14509 scrollTop: scrollPosition 14510 }, 500); 14511 } else { 14512 let scrollPosition = $wrapper.find(".filters-container").offset().top - $wrapper.find(".header-wrapper .header").height(); 14513 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition, $wrapper); 14514 $('html, body').animate({ 14515 scrollTop: scrollPosition 14516 }, 500); 14517 } 14518 } else {
14519 $wrapper.ppcommon("supressSliding", false); 14520 } 14521 if (!$wrapper.ppcommon("supressMapUpdate") && !!privateFunctions.isAirBnB($wrapper)) { 14522 $wrapper.ppcommon("ignoreAirBnBEvent", true); 14523 14524 //because sometimes the map does not trigger the event after moving (have to find out the reason yet), 14525 //we have to make sure, the "ignoreAirBnBEvent" variable is set to false after a period of time 14526 setTimeout(function () { 14527 $wrapper.ppcommon("ignoreAirBnBEvent", false); 14528 }, 2000); 14529 14530 //privateFunctions.filtersToAirBnB($wrapper); 14531 privateFunctions.dataToAirBnB($wrapper); 14532 privateFunctions.calculateOffset($wrapper); 14533 } else { 14534 $wrapper.ppcommon("supressMapUpdate", false); 14535 } 14536 if (selectedRegionId != null) { 14537 privateFunctions.regionToAirBnB(selectedRegionId, selectedRegionType, $wrapper); 14538 } 14539 $wrapper.ppcommon("ajaxRequest", null); 14540 14541 // do everything for mobile 14542 if ($wrapper.ppcommon('isAirBnbOrExternalMap') && $wrapper.find('.airbnb-change-view-buttons').is(':visible')) { 14543 followingElementsInContainer($wrapper.find('.airbnb-change-view-buttons'), $wrapper.find('.search-results')); 14544 } 14545 if (!!callback) callback(); 14546 } 14547 }); 14548 $wrapper.ppcommon("ajaxRequest", ajaxRequest); 14549 }, 14550 clearRegionFromAirBnB($wrapper) { 14551 var airBnB = mapFunctions.mapObject($wrapper); 14552 if (!airBnB || !airBnB.clearRegion) return; 14553 airBnB.clearRegion(); 14554 }, 14555 regionToAirBnB(id, type, $wrapper) { 14556 if (!id) return; 14557 type = type || 'region'; 14558 var airBnB = mapFunctions.mapObject($wrapper); 14559 if (!airBnB) return; 14560 airBnB.setRegion({ 14561 type: type, 14562 id: window.pixelpoint.utilities.getMapRegion(id) //id 14563 }); 14564 }, 14565 filtersToAirBnB($wrapper) { 14566 var airBnB = mapFunctions.mapObject($wrapper); 14567 if (!airBnB) return; 14568 var searchResultsContainer = $wrapper.find(".search-results .inner-wrapper"); 14569 var resultListWrapper = searchResultsContainer.find(".result-list-wrapper"); 14570 if (resultListWrapper.length > 0) { 14571 var filters = resultListWrapper.data("jsonFilters"); 14572 if (!!filters) { 14573 var type = resultListWrapper.data("jsonEndpoint"); 14574 if (!type) type = "poi"; 14575 if (!!$wrapper.ppcommon("changeMapSection")) { 14576 airBnB.init = true; 14577 airBnB.zoom = null; 14578 airBnB.coordinates = []; 14579 $wrapper.ppcommon("changeMapSection", false); 14580 } 14581 airBnB.type = type; 14582 airBnB.filter = filters; 14583 14584 /* 14585 privateFunctions.mapObject().$nextTick(function () { 14586 airBnB.init = false; 14587 airBnB.$nextTick(function () { 14588 if (!!changeMapSection) { 14589 airBnB.init = true; 14590 changeMapSection = false; 14591 } 14592 airBnB.type = type; 14593 airBnB.filter = filters; 14594 }); 14595 }); 14596 //*/ 14597 } 14598 } 14599 }, 14600 dataToAirBnB($wrapper) { 14601 var airBnB = mapFunctions.mapObject($wrapper); 14602 if (!airBnB) return; 14603 privateFunctions.collectPoiData($wrapper); 14604 var type = $wrapper.find(".result-list-wrapper").data("jsonEndpoint"); 14605 if (!type) type = "poi"; 14606 //if (!!changeMapSection) { 14607 airBnB.init = true; 14608 airBnB.zoom = null; 14609 airBnB.coordinates = []; 14610 // changeMapSection = false; 14611 //} 14612 airBnB.type = type; 14613 airBnB.geojson = { 14614 "type": "FeatureCollection", 14615 "features": geojsonData 14616 }; 14617 }, 14618 calculateOffset($wrapper) { 14619 var airBnB = mapFunctions.mapObject($wrapper); 14620 if (!airBnB) return; 14621 if (!$wrapper.find(".rbnb-wrapper").is(".fullsize")) { 14622 airBnB.offset = 0; 14623 return; 14624 } 14625 if ($wrapper.find('.airbnb-change-view-buttons').is(':visible')) { 14626 airBnB.offset = 0; 14627 return; 14628 } 14629 var searchContainer = $wrapper.find(".rbnb-wrapper .search"); 14630 if (searchContainer.length == 0) return; 14631 var offset = searchContainer.offset().left + searchContainer.outerWidth(); 14632 if (searchContainer.hasClass("switch-big")) { 14633 offset = offset / 2; 14634 } 14635 airBnB.offset = offset; 14636 }, 14637 initialSetBBox($wrapper, sessionFiltersDeferred) { 14638 var mapWrapper = $wrapper.find(".map-internal-wrapper"); 14639 privateFunctions.calculateOffset($wrapper); 14640 var zoom = mapWrapper.data("initial-zoom"); 14641 var longitude = mapWrapper.data("initial-longitude"); 14642 var latitude = mapWrapper.data("initial-latitude"); 14643 var reloadModule = function () { 14644 if (!!privateFunctions.isAirBnB($wrapper)) { 14645 //privateFunctions.filtersToAirBnB(); //@deprecated 14646 var requestType = $wrapper.data('request'); 14647 if (requestType == 'GET') { 14648 $wrapper.ppcommon("supressMapUpdate", false); 14649 privateFunctions.reloadModule(null, null, false, null, $wrapper); 14650 } else 14651 //privateFunctions.filtersToAirBnB($wrapper); 14652 privateFunctions.dataToAirBnB($wrapper); 14653 } else { 14654 privateFunctions.reloadModule(null, null, false, null, $wrapper); 14655 } 14656 }; 14657 if (zoom > 0 || longitude > 0 && latitude > 0) { 14658 sessionFiltersDeferred.done(function (data) { 14659 if (!data) { 14660 //----------------------------------- 14661 var viewArguments = {}; 14662 if (zoom > 0) viewArguments.zoom = zoom; 14663 if (longitude > 0 && latitude > 0) viewArguments.coordinates = [latitude, longitude]; 14664 if (!!privateFunctions.isAirBnB($wrapper)) { 14665 mapFunctions.mapObject($wrapper).$once("moveend", function () { 14666 var bbox = mapFunctions.getBBox($wrapper); //mapFunctions.mapObject($wrapper).bbox(); 14667 14668 $wrapper.ppcommon("boundingBox", bbox); 14669 $wrapper.ppcommon("supressMapUpdate", true); 14670 var requestType = $wrapper.data('request'); 14671 /* //@deprecated 14672 privateFunctions.filtersToAirBnB();
14673 privateFunctions.submitForm(); 14674 //*/ 14675 if (requestType == 'POST') { 14676 privateFunctions.submitForm(null, $wrapper); 14677 } else { 14678 $wrapper.ppcommon("supressMapUpdate", false); 14679 privateFunctions.reloadModule(bbox, null, true, null, $wrapper); 14680 } 14681 }); 14682 } 14683 if (!!privateFunctions.isAirBnB($wrapper)) { 14684 mapFunctions.mapObject($wrapper).$nextTick(function () { 14685 mapFunctions.mapObject($wrapper).init = false; 14686 mapFunctions.mapObject($wrapper).changeView(viewArguments); 14687 }); 14688 } else { 14689 reloadModule(null, null, false, null, $wrapper); 14690 } 14691 //----------------------------------- 14692 } else { 14693 reloadModule(null, null, false, null, $wrapper); 14694 } 14695 }); 14696 } else { 14697 reloadModule(null, null, false, null, $wrapper); 14698 } 14699 }, 14700 switchFilters(filtersHtml, $wrapper) { 14701 if (!filtersHtml) return; 14702 var filtersContainer = $wrapper.find(".search > .filters-container"); 14703 if (!filtersContainer || filtersContainer.length == 0) return; 14704 var filterForm = filtersContainer.find('.filter-form'); 14705 filterForm.html(""); 14706 filterForm.append($(filtersHtml)); 14707 filterForm.find(".calendar").each(function () { 14708 window.pixelpoint.ppComponents.calendar($(this)); 14709 }); 14710 filterForm.find(".visitor-picker").each(function () { 14711 window.pixelpoint.ppComponents.visitorPicker($(this)); 14712 }); 14713 filterForm.find("[data-quick-clear]").each(function () { 14714 window.pixelpoint.ppComponents.quickClear($(this)); 14715 }); 14716 filterForm.find(".belegung-component").each(function () { 14717 window.pixelpoint.ppComponents.belegung($(this)); 14718 }); 14719 filterForm.find("[data-disabler]").each(function () { 14720 window.pixelpoint.ppComponents.disabler($(this)); 14721 }); 14722 var marginInPx = privateFunctions.getHeaderHeight($wrapper, false); //$('.header-wrapper .header').height(); 14723 14724 // scroll effect on Large Screens 14725 if (Foundation.MediaQuery.current == "large") { 14726 //var marginInPxNew = $('.header-wrapper .header .main-nav').height() + 12; 14727 var marginInPxNew = $('.header-wrapper .header .main-nav').height() - 2; 14728 marginInPx = marginInPxNew; 14729 } 14730 // scroll effect on Large Screens - END 14731 14732 var marginInEm = marginInPx / parseFloat($("body").css("font-size")); 14733 if (filterForm.find("[data-order-by]").length > 0) { 14734 setTimeout(function () { 14735 var sticky = new Foundation.Sticky(filterForm.find("[data-order-by]"), { 14736 topAnchor: 'orderbywrapper:top', 14737 btmAnchor: 'rbnb-wrapper-id:bottom', 14738 marginTop: marginInEm 14739 }); 14740 $(window).trigger("load.zf.sticky"); 14741 }, 50); 14742 filterForm.find("[data-order-by]").each(function () { 14743 window.pixelpoint.ppComponents.orderBy($(this)); 14744 }); 14745 } else { 14746 if (filterForm.find(".order-by").length > 0) { 14747 setTimeout(function () { 14748 var sticky = new Foundation.Sticky(filterForm.find(".order-by"), { 14749 topAnchor: 'orderbywrapper:top', 14750 btmAnchor: 'rbnb-wrapper-id:bottom', 14751 marginTop: marginInEm 14752 }); 14753 $(window).trigger("load.zf.sticky"); 14754 }, 50); 14755 } 14756 } 14757 window.ppComponents.common.sliders(filterForm.find(".range-slider")); 14758 window.ppComponents.select2.initialize(filterForm.find('.select2')); 14759 window.ppComponents.select2.initializeRemote(filterForm.find("select.autocomplete")); 14760 filterForm.find("[data-group-selector]").each(function () { 14761 window.pixelpoint.ppComponents.groupExtension($(this)); 14762 }); 14763 filterForm.find(".loader[data-loader]").each(function () { 14764 window.pixelpoint.ppComponents.loader($(this)); 14765 }); 14766 window.ppComponents.common.showMore(filterForm.find(".more-wrapper")); 14767 privateFunctions.checkAndHideExpandButton($wrapper); 14768 }, 14769 reloadModule(boundingBox, callback, keepMapSection, switchValue, $wrapper) { 14770 if ($wrapper.find(".map-internal-wrapper").data('supress-module-reload')) return; 14771 switchValue = switchValue || null; 14772 var loaderFunctions = $wrapper.find(".search-results .loader[data-loader]").data("exposed"); 14773 var url = privateFunctions.generateFormAction(window.location.href, boundingBox, switchValue, $wrapper); 14774 keepMapSection = keepMapSection || false; 14775 if (!!loaderFunctions) { 14776 loaderFunctions.show(); 14777 } 14778 var searchResultsContainer = $wrapper.find(".search-results .inner-wrapper"); 14779 var cid = $wrapper.data("cid"); 14780 var pid = $wrapper.data("pid"); 14781 var ajaxRequest = $.ajax({ 14782 type: 'GET', 14783 url: url, 14784 success: function (data) { 14785 var results = $(data).find(`[data-cid='${cid}'] .search-results .inner-wrapper`).html(); 14786 var filtersHtml = $(data).find(`[data-cid='${cid}'] .search > .filters-container .filter-form`).html(); 14787 if (!results) results = ''; 14788 searchResultsContainer.html(results); 14789 if (!!privateFunctions.isAirBnB($wrapper)) { 14790 if (!filtersHtml) filtersHtml = ''; 14791 privateFunctions.switchFilters(filtersHtml, $wrapper); 14792 } 14793 14794 //privateFunctions.initializeSliders(); 14795 window.pixelpoint.tooltip.init(searchResultsContainer.find('.tt
14795ip-blue')); 14796 window.pixelpoint.initOpeningHoursText(); 14797 window.pixelpoint.images.initializeErrors(searchResultsContainer); 14798 //$wrapper.find('.map-wrapper.sticky').foundation('_calc', true); 14799 14800 privateFunctions.afterAllImagesLoaded(searchResultsContainer).then(function () { 14801 privateFunctions.setResultItemHeight($wrapper); 14802 if (!!loaderFunctions) { 14803 loaderFunctions.hide(); 14804 } 14805 }); 14806 var itemCount = $wrapper.find(".result-list .search-result-item").length; 14807 if (!$wrapper.ppcommon("supressSliding")) { 14808 if (itemCount > 0) { 14809 let scrollPosition = $wrapper.find(".search-results").offset().top - $(".header-wrapper .header").height(); 14810 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition, $wrapper); 14811 $('html, body').animate({ 14812 scrollTop: scrollPosition 14813 }, 500); 14814 } else { 14815 let scrollPosition = $wrapper.find(".filters-container").offset().top - $(".header-wrapper .header").height(); 14816 scrollPosition = privateFunctions.getRealScrollPosition(scrollPosition, $wrapper); 14817 $('html, body').animate({ 14818 scrollTop: scrollPosition 14819 }, 500); 14820 } 14821 } else {
14822 $wrapper.ppcommon("supressSliding", false); 14823 } 14824 if (!$wrapper.ppcommon("supressMapUpdate") && !!privateFunctions.isAirBnB($wrapper)) { 14825 $wrapper.ppcommon("ignoreAirBnBEvent", true); 14826 if (!keepMapSection) $wrapper.ppcommon("changeMapSection", true); // if reloading the module, we always change the map section 14827 14828 //because sometimes the map does not trigger the event after moving (have to find out the reason yet), 14829 //we have to make sure, the "ignoreAirBnBEvent" variable is set to false after a period of time 14830 setTimeout(function () { 14831 $wrapper.ppcommon("ignoreAirBnBEvent", false); 14832 }, 2000); 14833 14834 //privateFunctions.filtersToAirBnB($wrapper); 14835 privateFunctions.dataToAirBnB($wrapper); 14836 privateFunctions.calculateOffset($wrapper); 14837 } else { 14838 $wrapper.ppcommon("supressMapUpdate", false); 14839 } 14840 $wrapper.ppcommon("ajaxRequest", null); 14841 14842 // do everything for mobile 14843 if ($wrapper.ppcommon('isAirBnbOrExternalMap') && $wrapper.find('.airbnb-change-view-buttons').is(':visible')) { 14844 followingElementsInContainer($wrapper.find('.airbnb-change-view-buttons'), $wrapper.find('.search-results')); 14845 } 14846 if (!!callback) callback(); 14847 } 14848 }); 14849 $wrapper.ppcommon("ajaxRequest", ajaxRequest); 14850 }, 14851 /** 14852 * The below function has to be completely rewritten or omitted, sinde it will be dificult to scroll to a module if there are several on the site 14853 * 14854 */ 14855 14856 scrollToModule() { 14857 //scrolls to the module if, and only if, it was a click back from a detail site 14858 var currentPage = window.location.href; 14859 var key = `airBnBKeepPositionOnBack:${currentPage}`; 14860 //var key2 = `airBnBKeepPosition`; 14861 var keepPositionOnBack = window.sessionStorage.getItem(key); 14862 //var keepPosition = window.sessionStorage.getItem(key2); 14863 if (!!keepPositionOnBack) { 14864 if (window.pixelpoint.history.visitorCameBack()) { 14865 window.sessionStorage.removeItem(key); 14866 //window.sessionStorage.removeItem(key2); 14867 window.pixelpoint.utilities.scrollTo($(".search-results"), false, 0, true); 14868 } 14869 } 14870 }, 14871 collectFormData(formName, $wrapper) { 14872 formName = formName || 'poi'; 14873 //collecting form data for tag manager 14874 var categoryInput = $wrapper.find(".rbnb-wrapper [name='filters[categories][]']"); 14875 var tagInput = $wrapper.find(".rbnb-wrapper select[name='filters[categories][0][tags][]']"); 14876 var locationTreeInput = $wrapper.find(".rbnb-wrapper [name='filters[locationTree][]']"); 14877 var result = { 14878 "Regionen": null, 14879 "Orte": null, 14880 "nationale Naturlandschaften": null, 14881 "Ausflugsregionen": null, 14882 "Wassersportreviere": null, 14883 "Kategorien": null, 14884 "Unterkunftsarten": null 14885 }; 14886 var nameMap = { 14887 'region': 'Regionen', 14888 'location': 'Orte', 14889 'aqua': 'Wassersportreviere', 14890 'national': 'nationale Naturlandschaften', 14891 'excursion': 'Ausflugsregionen' 14892 }; 14893 14894 //******* first the categories */ 14895 var selections = null; 14896 var key = null; 14897 if (tagInput.length == 0) { 14898 if (categoryInput.length > 0) { 14899 selections = categoryInput.val(); 14900 } 14901 if (!selections) { 14902 var groups = $wrapper.find(".groups-outer-wrapper .groups section[data-group-id]"); 14903 if (groups.length > 0) { 14904 selections = []; 14905 groups.each(function () { 14906 var categoryInput = $(this).find("input[type='hidden'][name^='filters[categories]']").filter("[name$='[category]']"); 14907 if (categoryInput.length > 0) { 14908 var categoryValue = categoryInput.val(); 14909 selections.push(categoryValue); 14910 } 14911 }); 14912 } 14913 } 14914 if (!!selections) { 14915 key = 'Kategorien'; 14916 if (formName == 'accomodation') key = 'Unterkunftsarten'; 14917 if (!result[key]) result[key] = []; 14918 $.each(selections, function (i, selection) { 14919 var parts = selection.split(":");
14920 if (!!parts) { 14921 if (parts.length > 1) { 14922 result[key].push(parts[1]); 14923 } else { 14924 result[key].push(parts[0]); 14925 } 14926 } 14927 }); 14928 } 14929 } 14930 //**********then the tags */ 14931 selections = null; 14932 if (tagInput.length > 0) { 14933 if (tagInput.hasClass("select2-hidden-accessible")) selections = tagInput.select2('data').map(function (x) { 14934 return `${x.id}:${x.text}`; 14935 });else selections = tagInput.val(); 14936 } 14937 if (!!selections) { 14938 key = 'Kategorien'; 14939 if (formName == 'accomodation') key = 'Unterkunftsarten'; 14940 if (!result[key]) result[key] = []; 14941 $.each(selections, function (i, selection) { 14942 var parts = selection.split(":"); 14943 if (!!parts) { 14944 if (parts.length > 1) { 14945 result[key].push(parts[1]); 14946 } else { 14947 result[key].push(parts[0]); 14948 } 14949 } 14950 }); 14951 } 14952 if (locationTreeInput.length > 0) { 14953 selections = locationTreeInput.val(); 14954 if (!!selections) { 14955 if (!$.isArray(selections)) selections = [selections]; 14956 $.each(selections, function (i, selection) { 14957 var parts = selection.split(':'); 14958 if (parts.length >= 3) { 14959 var locationType = nameMap[parts[2]] || null; 14960 if (!!locationType) { 14961 if (!result[locationType]) result[locationType] = []; 14962 result[locationType].push(parts[1]); 14963 } 14964 } 14965 }); 14966 } 14967 } 14968 return { 14969 "Regionen": result.Regionen != null ? result.Regionen.join(',') : null, 14970 "Orte": result.Orte != null ? result.Orte.join(',') : null, 14971 "nationale Naturlandschaften": result['nationale Naturlandschaften'] != null ? result['nationale Naturlandschaften'].join(',') : null, 14972 "Ausflugsregionen": result.Ausflugsregionen != null ? result.Ausflugsregionen.join(',') : null, 14973 "Wassersportreviere": result.Wassersportreviere != null ? result.Wassersportreviere.join(',') : null, 14974 "Kategorien": result.Kategorien != null ? result.Kategorien.join(',') : null, 14975 "Unterkunftsarten": result.Unterkunftsarten != null ? result.Unterkunftsarten.join(',') : null 14976 }; 14977 }, 14978 checkAndHideExpandButton($wrapper) { 14979 $wrapper.find(".filter-form").each((index, filterForm) => { 14980 let $filterForm = $(filterForm); 14981 let expandButton = $filterForm.find(".subtitle-aufklapbar"); 14982 let fineFilters = $filterForm.find(".fine-search"); 14983 let collapsed = fineFilters.hasClass("collapsed"); 14984 fineFilters.removeClass("collapsed"); 14985 if (fineFilters.height() == 0) { 14986 expandButton.hide(); 14987 } else { 14988 expandButton.show(); 14989 } 14990 if (!!collapsed) fineFilters.addClass("collapsed"); 14991 }); 14992 }, 14993 isAirBnB($wrapper) { 14994 return $wrapper.data("filters-used") == 1 ? true : false; 14995 } 14996 }; 14997 window.externalMap = window.externalMap || {}; 14998 window.externalMap.privateFunctions = privateFunctions; //do not judge me! 14999 //-------------------- END FUNCTIONS --------------------------------------------------------------------------- 15000 15001 //-----some helper functions cause I am too lazy to write a long-ass definition each time----------- 15002 $.fn.ppcommon = $.fn.ppcommon || function (key, value) { 15003 var commonData = this.data("static-common"); 15004 if (!commonData) return value; 15005 if (typeof value !== "undefined") { 15006 commonData[key] = value; 15007 this.data("static-common", commonData); 15008 return commonData[key]; 15009 } else { 15010 var result = commonData[key] || null; 15011 return result; 15012 } 15013 }; 15014 //-------------------------------------------------------------------------------------------------- 15015 15016 var init = ($wrapper, skipWindowLoad) => { 15017 var filtersContainer = $wrapper.find(".search > .filters-container"); 15018 var searchResultsContainer = $wrapper.find(".search-results .inner-wrapper"); 15019 skipWindowLoad = skipWindowLoad || false; 15020 if (filtersContainer.length == 0 || searchResultsContainer.length == 0) { 15021 return; 15022 } 15023 var isAirBnB = privateFunctions.isAirBnB($wrapper); 15024 15025 //var switchToMapButton = $wrapper.find(".brandenbutton.switch-to-map"); 15026 15027 var mapLoadedDefer = $.Deferred(); 15028 var sessionFiltersDeferred = null; 15029 15030 //var justZoomed = false; //@deprecated 15031 15032 // the Dce Id (cid) and Page Id (pid) for the AirBnB Module 15033 var cid = $wrapper.data("cid"); 15034 var pid = $wrapper.data("pid"); 15035 var requestType = $wrapper.data('request'); 15036 var moduleData = { 15037 ajaxRequest: null, 15038 ignoreAirBnBEvent: true, 15039 changeMapSection: false, 15040 supressMapUpdate: false,
15041 supressSliding: true, 15042 boundingBox: null, 15043 isAirBnbOrExternalMap: false 15044 }; 15045 $wrapper.data("static-common", moduleData); 15046 $wrapper.ppcommon('isAirBnbOrExternalMap', false); 15047 if ($wrapper.length) { 15048 $wrapper.ppcommon('isAirBnbOrExternalMap', true); 15049 setTimeout(function () { 15050 privateFunctions.setResultItemHeight($wrapper); 15051 }, 200); 15052 } 15053 var form = filtersContainer.find("form"); 15054 var loaderFunctions = $wrapper.find(".search-results .loader[data-loader]").data("exposed"); 15055 15056 //deferred objects and simmilar- 15057 var moveEndTimeout = null; 15058 //------------------------------ 15059 15060 //we load the filters right away 15061 sessionFiltersDeferred = privateFunctions.loadSessionFilters(sessionFiltersDeferred, cid); 15062 searchResultsContainer.on("click", ".pagination li > a", function (e) { 15063 e.preventDefault(); 15064 if ($(this).hasClass("disabled")) return; 15065 $wrapper.ppcommon("supressSliding", false); 15066 var url = $(this).attr("href"); 15067 form.attr("action", url); 15068 form.submit(); 15069 }); 15070 15071 //the search via button is a separate function since we use it on multiple locations 15072 var triggerSearch = function () { 15073 $wrapper.find("[name='filters[productcode][]']").each(function () { 15074 if (!$(this).is('[data-preserve]')) $(this).remove(); 15075 }); 15076 $wrapper.find("[name='filters[external_id][]']").each(function () { 15077 $(this).remove(); 15078 }); 15079 $wrapper.find("[name='filters[related_to]']").remove(); 15080 $wrapper.find("[data-input-name='filters[price]']").closest(".control.no-icon").removeClass("hide"); 15081 var q = $wrapper.find("input[name='filters[q]']").val(); 15082 if (!!q) { 15083 privateFunctions.clearDefaultTextValue(); 15084 } else { 15085 privateFunctions.restoreDefaultValue(); 15086 } 15087 $wrapper.ppcommon("boundingBox", null); 15088 15089 //************** trigger tag manager event *********************** */ 15090 var event = "AirBnB:daten"; 15091 var formName = filtersContainer.find(".brandenbutton.search-button").closest("form[name='search']").data("form-name"); 15092 var data = privateFunctions.collectFormData(formName);
15093 window.pixelpoint.tagManager.event(event, data); 15094 $wrapper.ppcommon("changeMapSection", true); 15095 form.attr("action", ""); 15096 form.submit(); 15097 }; 15098 filtersContainer.on("click", ".brandenbutton.search-button", function (e) { 15099 e.preventDefault(); 15100 triggerSearch(); 15101 }); 15102 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.airBnBSearch, function () { 15103 triggerSearch(); 15104 }); 15105 form.submit(function (e) { 15106 e.preventDefault(); 15107 if (privateFunctions.validateForm(true, form)) { 15108 privateFunctions.submitForm(null, $wrapper); 15109 } 15110 }); 15111 var onExternalMapLoad = () => { 15112 // do everything for mobile 15113 if ($wrapper.ppcommon('isAirBnbOrExternalMap') && $wrapper.find(".airbnb-change-view-buttons").is(':visible')) { 15114 followingElementsInContainer($wrapper.find(".airbnb-change-view-buttons"), $wrapper.find('.search-results')); 15115 privateFunctions.switchToDefaultView($wrapper); 15116 $wrapper.on("click", ".changeView", function () { 15117 changeMapView($wrapper, $(this), false); 15118 }); 15119 $wrapper.on("click", ".toFilter", function () { 15120 scrollToMapFilter($wrapper); 15121 }); 15122 } 15123 mapLoadedDefer.done(function () { 15124 privateFunctions.initialSetBBox($wrapper, sessionFiltersDeferred); 15125 var map = mapFunctions.mapObject($wrapper); 15126 if (!!map) { 15127 var onSearchTriggered = function (data) { 15128 if (!!window.forDebugging) return; 15129 if (!data.bbox) { 15130 $wrapper.ppcommon("ignoreAirBnBEvent", false); 15131 return; 15132 } 15133 if (!!moveEndTimeout) { 15134 clearTimeout(moveEndTimeout); 15135 } 15136 moveEndTimeout = setTimeout(function () { 15137 if (!!$wrapper.ppcommon("ignoreAirBnBEvent")) { 15138 $wrapper.ppcommon("ignoreAirBnBEvent", false); 15139 return; 15140 } 15141 $wrapper.ppcommon("boundingBox", data.bbox); 15142 privateFunctions.submitForm(() => { 15143 let mapObject = mapFunctions.mapObject($wrapper); 15144 if (!!mapObject) { 15145 /* 15146 ZP 10.02.2022: we set a timeout to set supressMap to false. I did not want 15147 to do that in the airbnb application since I do not know if there 15148 would be any sideeffects 15149 */ 15150 setTimeout(() => { 15151 mapObject.supressSearch = false; 15152 }, 600); 15153 } 15154 }, $wrapper); 15155 }, 300); 15156 }; 15157 15158 //* 15159 const onMapMoveEnd = function (data) { 15160 if (mapFunctions.isSearchOnMoveActive($wrapper) && !mapFunctions.isSearchSupressed($wrapper)) { 15161 let mapObject = mapFunctions.mapObject($wrapper); 15162 if (!!mapObject) { 15163 mapObject.fixMapPosition = true; 15164 } 15165 onSearchTriggered(data); 15166 } 15167 }; 15168 map.$off("moveend", onMapMoveEnd).$on("moveend", onMapMoveEnd); 15169 const onMapSearchTriggered = function (data) { 15170 onSearchTriggered(data); 15171 }; 15172 map.$off("searchtrigerred", onMapSearchTriggered).$on("searchtrigerred", onMapSearchTriggered); 15173 //*/ 15174 const onMapHighlightOver = function (data) { 15175 if (!!window.forDebugging) return; 15176 if (!$wrapper.find(".airbnb-change-view-buttons").is(':visible')) { 15177 var id = data.id || 0; 15178 var item = $wrapper.find(`.search-result-item[data-id='${id}']`); 15179 item.addClass("map-hover"); 15180 } 15181 }; 15182 map.$off("highlightover", onMapHighlightOver).$on("highlightover", onMapHighlightOver); 15183 const onMapHighlightOut = function (data) { 15184 if (!!window.forDebugging) return; 15185 $wrapper.find(".search-result-item").removeClass("map-hover"); 15186 }; 15187 map.$off("highlightout", onMapHighlightOut).$on("highlightout", onMapHighlightOut); 15188 // I removed the find(.search) 15189 //$wrapper.find(".search").on("mouseover", ".search-result-item", mouseOverSearchResult); 15190 //$wrapper.find(".search").on("mouseout", ".search-result-item", mouseOutSearchResult); 15191 $wrapper.on("mouseover", ".search-result-item", function () { 15192 var id = $(this).data("id"); 15193 if (!id) { 15194 return; 15195 } 15196 mapFunctions.mapObject($wrapper).focusItem(id); 15197 if (!!mapFunctions.mapObject($wrapper).focusTour) mapFunctions.mapObject($wrapper).focusTour(id); 15198 }); 15199 $wrapper.on("mouseout", ".search-result-item", function () { 15200 var id = $(this).data("id"); 15201 if (!id) { 15202 return; 15203 } 15204 if (!!mapFunctions.mapObject($wrapper).unfocusTour) mapFunctions.mapObject($wrapper).unfocusTour(id); 15205 }); 15206 } 15207 }); 15208 setTimeout(function () { 15209 privateFunctions.scrollToModule(); 15210 }, 250); 15211 var map = mapFunctions.mapObject($wrapper); 15212 if (!!map) { 15213 //privateFunctions.filtersToAirBnB($wrapper); 15214 privateFunctions.dataToAirBnB($wrapper); 15215 privateFunctions.calculateOffset($wrapper); 15216 mapLoadedDefer.resolve(); 15217 } else { 15218 window.pixelpoint.map.scriptsLoaded(function () { 15219 var element = $(`#${$wrapper.attr("id")} .ppcarto-airbnb`); 15220 if (element.length > 0) { 15221 if (!$(element).data("ppcarto-airbnb")) { 15222 var id = element.attr("id") || null; 15223 if (!id) { 15224 id = `ppcarto-airbnb-${$wrapper.attr("id")}`; 15225 element.attr("id", id); 15226 } 15227 var ppcartoAirbnb = new Vue({ 15228 el: `#${id}` 15229 }); 15230 $(`#${id}`).data("ppcarto-airbnb", ppcartoAirbnb); 15231 } 15232 setTimeout(function () { 15233 //privateFunctions.filtersToAirBnB($wrapper); 15234 privateFunctions.dataToAirBnB($wrapper); 15235 privateFunctions.calculateOffset($wrapper); 15236 mapLoadedDefer.resolve(); 15237 }, 100); 15238 } 15239 }); 15240 } 15241
15242 //****** we hide the expand button if necessary */ 15243 privateFunctions.checkAndHideExpandButton($wrapper); 15244 //********************************************* */ 15245 }; 15246 if (!skipWindowLoad) { 15247 $(window).on("load", onExternalMapLoad); 15248 } else { 15249 setTimeout(function () { 15250 onExternalMapLoad(); 15251 }, 50); 15252 } 15253 $(window).on("orientationchange resize", function () { 15254 if (!!window.forDebugging) { 15255 return; 15256 } 15257 if (privateFunctions.isAirBnB($wrapper)) { 15258 $wrapper.ppcommon("supressSliding", true); 15259 privateFunctions.calculateOffset($wrapper); 15260 } 15261 15262 // do everything for mobile 15263 if ($wrapper.ppcommon('isAirBnbOrExternalMap') && $wrapper.find(".airbnb-change-view-buttons").is(':visible')) { 15264 followingElementsInContainer($wrapper.find(".airbnb-change-view-buttons"), $wrapper.find('.search-results')); 15265 privateFunctions.switchToDefaultView($wrapper); 15266 } 15267 privateFunctions.setResultItemHeight($wrapper); 15268 }); 15269 $wrapper.on("click", ".einklappen.row-collapse", function () { 15270 $('.map-wrapper.sticky').foundation('_calc', true); 15271 }); 15272 15273 //small tag manager snippet****************** 15274 $wrapper.on("click", function (e) { 15275 var event = "AirBnB:click"; 15276 var data = { 15277 clickOnMap: false, 15278 AirBnBFilterClick: false 15279 }; 15280 var target = $(e.target); 15281 if (target.closest(".search-wrapper .search").length == 0) { 15282 data.clickOnMap = true; 15283 } 15284 if (target.closest("form[name='search']").length > 0) { 15285 data.AirBnBFilterClick = target.closest("form[name='search']").data("form-name") || true; 15286 }
15287 window.pixelpoint.tagManager.event(event, data); 15288 }); 15289 15290 //some navigational stuff 15291 $wrapper.on("click", ".search-result-item a", function (e) { 15292 if (!!window.sessionStorage) { 15293 var currentPage = window.location.href; 15294 window.sessionStorage.setItem(`airBnBKeepPositionOnBack:${currentPage}`, 1); 15295 } 15296 }); 15297 15298 //------------------------------------------------------------ 15299 const triggerScriptsLoaded = function () { 15300 $(".ppcarto-static").each((index, element) => { 15301 if ($(element).data("ppcarto-static")) return; 15302 var $element = $(element); 15303 var id = $element.attr("id"); 15304 if (!id) { 15305 id = `ppcarto-static-${index}`; 15306 $element.attr("id", id); 15307 } 15308 var ppcartoStatic = new Vue({ 15309 el: `#${id}` 15310 }); 15311 $(`#${id}`).data("ppcarto-static", ppcartoStatic); 15312 }); 15313 }; 15314 if (window.ppcartoScriptsLoaded) { 15315 triggerScriptsLoaded(); 15316 } else { 15317 window.pixelpoint.map.scriptsLoaded(() => { 15318 triggerScriptsLoaded(); 15319 }); 15320 } 15321 //------------------------------------------------------------ 15322 }; 15323 window.externalMap.init = init; 15324 15325 //----------------------------------------------------------------------------------------------- 15326 $(".external-map-wrapper").not(".tabbed-external-maps").each(function (index, element) { 15327 if ($(element).is(":visible")) { 15328 window.externalMap.init($(element)); 15329 } 15330 }); 15331 15332 // we take care of the accordions 15333 if ($(".accordion-with-map").length > 0) { 15334 $(".accordion-with-map").on("down.zf.accordion", function (event, element) { 15335 if (!$(element).data("map-initialised")) { 15336 window.externalMap.init($(element), true); 15337 $(element).data("map-initialised", "1"); 15338 } 15339 15340 //ZP 07.02.2022: this is important so that the height gets calculated correctly 15341 $(element).find('.search-result-item').css({ 15342 "height": "auto" 15343 }); 15344 15345 //we also adjust the heights of the items 15346 let maxHeight = 0; 15347 $(element).find('.search-result-item').each((index, el) => { 15348 let height = $(el).height(); 15349 if (height > maxHeight) maxHeight = height; 15350 }); 15351 $(element).find('.search-result-item').each((index, el) => { 15352 $(el).css('cssText', `height:${maxHeight}px !important;`); 15353 }); 15354 const offsetTop = 77; 15355 const listHeight = $(element).find(".result-list").height(); 15356 const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0) - offsetTop; 15357 const heightToSet = listHeight < vh ? listHeight : vh; 15358 $(element).find(".map-wrapper.map-internal-wrapper").height(`${heightToSet}px`); 15359 $(element).find(".map-wrapper.map-internal-wrapper").width($(element).find(".map-parent-container").width()); 15360 $(element).find(".map-parent-container").height(`${listHeight}px`); 15361 if (mapFunctions.mapObject($(element))) mapFunctions.mapObject($(element)).map.resize(); 15362 15363 // we make the map sticky 15364 if (heightToSet < listHeight) { 15365 const parentContainer = $(element).find(".map-parent-container"); 15366 const internalWrapper = $(element).find(".map-wrapper.map-internal-wrapper"); 15367 $(window).scroll(function () { 15368 const topPosition = parentContainer.offset().top - $(window).scrollTop(); 15369 const bottomPosition = parentContainer.offset().top + parentContainer.height() - ($(window).scrollTop() + $(window).height()); 15370 if (topPosition <= offsetTop) { 15371 internalWrapper.addClass("stick"); 15372 } 15373 if (bottomPosition <= 0) { 15374 internalWrapper.removeClass("stick").addClass("stick-down"); 15375 } 15376 if (topPosition > offsetTop && bottomPosition > 0) { 15377 internalWrapper.removeClass("stick").removeClass("stick-down"); 15378 } 15379 }); 15380 } 15381 // end 15382 }); 15383 $(".accordion-with-map").on("click", ".changeView", function () { 15384 $(this).closest(".accordion-content").find(".search-results").toggleClass("show-map"); 15385 $([document.documentElement, document.body]).animate({ 15386 scrollTop: $(this).closest(".accordion-item").find(".accordion-title").offset().top - 77 15387 }, 200); 15388 }); 15389 } 15390}); 15391function initStickyMapElements($wrapper) { 15392 var marginInPx = window.externalMap.privateFunctions.getHeaderHeight($wrapper, false); //$('.header-wrapper .header').height(); 15393 15394 // scroll effect on Large Screens 15395 if (Foundation.MediaQuery.current == "large") { 15396 var marginInPxNew = $('.header-wrapper .header .main-nav').height(); // + 12; 15397 //var marginInPxNew = $('.header-wrapper .header .main-nav').height() - 2; 15398 15399 /******************************************************************** */ 15400 /******************************************************************* */ 15401 //we update the damn sticky (I so f*cking hate that thing) 15402 var stickyPosition = $(".header-wrapper .header").height(); 15403 15404 // scroll effect on Large Screens 15405 if (Foundation.MediaQuery.current == "large") { 15406 var stickyPositionNew = $('.header-wrapper .header .main-nav').height() + 12; 15407 stickyPosition = stickyPositionNew; 15408 } 15409 // scroll effect on Large Screens - END 15410 if ($("#blogHeader .day-section").length > 0) { 15411 var blogHeaderOffset = $("#blogHeader .day-section").offset(); 15412 var daySectionOffset = $("#blogHeader .day-section").offset().top; 15413 var scrollOffset = window.pageYOffset + stickyPosition; 15414 if (daySectionOffset < scrollOffset) { 15415 $("#blogHeader .day-section .row").foundation('_setSticky'); 15416 } 15417 } 15418 //end 15419 /******************************************************************** */ 15420 /******************************************************************* */ 15421 15422 if (!!$wrapper && $wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky.is-stuck").length > 0) { 15423 marginInPxNew += window.externalMap.privateFunctions.getStickyElementHeight($wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky"), false); //$wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky").height(); 15424 } else if (!!$wrapper && $wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky").length > 0) { 15425 marginInPxNew += window.externalMap.privateFunctions.getStickyElementHeight($wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky"), false); //$wrapper.closest("#blog-days-container").find("#blogHeader .day-section .row.sticky").height(); 15426 } else {} 15427 marginInPx = marginInPxNew; 15428 } 15429 // scroll effect on Large Screens - END 15430 15431 var marginInEm = marginInPx / parseFloat($("body").css("font-size")); 15432 var moduleId = "#" + $wrapper.attr("id"); 15433 $(moduleId + ' .sticky').attr('data-margin-top', marginInEm).data('margin-top', marginInEm); 15434 if ($(moduleId + ' .sticky').attr('data-sticky')) { 15435 $wrapper.find('.map-wrapper.sticky').foundation('_calc', true); 15436 } else { 15437 $(moduleId + ' .sticky').attr('data-sticky', 'true').foundation(); 15438 $(window).trigger("load.zf.sticky"); 15439 } 15440 if ($("html").hasClass("internet-explorer")) { 15441 if (!$wrapper.find(".changeView").is(":visible")) {
15442 var ieSearchWrapperHeight = $(window).height() - marginInPx; 15443 if (ieSearchWrapperHeight < $wrapper.find(".map-container").height()) { 15444 ieSearchWrapperHeight = $wrapper.find(".map-container").height(); 15445 } 15446 $wrapper.find(".search-wrapper").css("max-height", ieSearchWrapperHeight + "px"); 15447 } 15448 } 15449 15450 //var ieSearchWrapperHeight = $(window).height() - marginInPx; 15451 //$(".internet-explorer .external-map-wrapper .search-wrapper, .internet-explorer .global-search .search-wrapper, .internet-explorer .rbnb-wrapper .search-wrapper").css("max-height", ieSearchWrapperHeight+"px"); 15452} 15453var intervalFollingElementInContainerMap = setInterval(function () {}, 100); 15454function followingElementsInContainer($elem, $container) { 15455 clearInterval(intervalFollingElementInContainerMap); 15456 var $window = $(window); 15457 var scrolled = false; 15458 $window.scroll(function () { 15459 scrolled = true; 15460 }); 15461 intervalFollingElementInContainerMap = setInterval(function () { 15462 if (scrolled) { 15463 var offset = !!$container && !!$container.offset ? $container.offset() : undefined; 15464 var outerHeight = !!$container && !!$container.outerHeight ? $container.outerHeight() : 0; 15465 var containerTop = !!offset && !!offset.top ? offset.top : 0; 15466 var containerBottom = containerTop + outerHeight; 15467 var viewportTop = $window.scrollTop(); 15468 var viewportBottom = viewportTop + $window.height(); 15469 if (containerTop < viewportBottom && viewportBottom < containerBottom) { 15470 $elem.css({ 15471 opacity: 1, 15472 position: 'fixed', 15473 bottom: 0 15474 }); 15475 } else { 15476 $elem.css({ 15477 opacity: 1, 15478 position: 'absolute', 15479 bottom: 0 15480 }); 15481 } 15482 scrolled = false; 15483 } 15484 }, 100); 15485} 15486function changeMapView($wrapper, $button, scrollToFilter) { 15487 var shownButtonTextClass = '.toMap'; 15488 var hiddenButtonTextClass = '.toList'; 15489 var mapZindex = 10; 15490 //var resultsZindex = 100; 15491 var resultsZindex = 20; 15492 var resultsMaxHeight = 'none'; 15493 var $followElem = $wrapper.find('.search-results'); 15494 var airBnbWrapperHeight = 'auto'; 15495 var $buttonFollowingElem = $wrapper.find('.search-results'); 15496 if ($('.toMap', $button).is(":visible")) { 15497 shownButtonTextClass = '.toList'; 15498 hiddenButtonTextClass = '.toMap'; 15499 15500 //mapZindex = 101; 15501 mapZindex = 21; 15502 resultsZindex = 10; 15503 resultsMaxHeight = $wrapper.find(".map-container .map-wrapper").height() + 'px'; 15504 $followElem = $wrapper.find(' .map-container .map-wrapper'); 15505 airBnbWrapperHeight = resultsMaxHeight; 15506 $buttonFollowingElem = $wrapper.find('.search-wrapper'); 15507 } 15508 $(hiddenButtonTextClass, $button).hide(); 15509 $(shownButtonTextClass, $button).show(); 15510 if ($wrapper.find('.search-wrapper > .map-parent-container').length) { 15511 $wrapper.find('.search-wrapper > .map-parent-container').css('z-index', mapZindex); 15512 } 15513 $wrapper.find(".rbnb-wrapper .map-container .map-wrapper").css('z-index', mapZindex); 15514 $wrapper.find('.search-wrapper > .search').css({ 15515 'z-index': resultsZindex, 15516 'max-height': resultsMaxHeight 15517 }); 15518 $wrapper.find(".rbnb-wrapper").height(airBnbWrapperHeight); 15519 $button.removeClass("ui-btn-active"); 15520 if (hiddenButtonTextClass == ".toList") { 15521 window.externalMap.privateFunctions.setResultItemHeight($wrapper); 15522 } 15523 15524 //followingElementsInContainer($wrapper.find('.airbnb-buttons'), $buttonFollowingElem); 15525 followingElementsInContainer($wrapper.find('.airbnb-change-view-buttons'), $buttonFollowingElem); 15526 if (scrollToFilter) { 15527 $("html, body").animate({ 15528 scrollTop: $wrapper.find('.search-wrapper').offset().top - window.externalMap.privateFunctions.getHeaderHeight($button, false) 15529 }, 800); 15530 } else { 15531 $("html, body").animate({ 15532 scrollTop: $followElem.offset().top - window.externalMap.privateFunctions.getHeaderHeight($button, false) 15533 }, 800); 15534 } 15535} 15536function scrollToMapFilter($wrapper) { 15537 var $searchWrapper = $wrapper.find(".search-wrapper"); 15538 var $buttonElem = $wrapper.find(".changeView"); 15539 if ($('.toMap', $buttonElem).is(":visible")) { 15540 $("html, body").animate({
15541 scrollTop: $searchWrapper.offset().top - window.externalMap.privateFunctions.getHeaderHeight($searchWrapper, false) 15542 }, 800); 15543 } else if ($('.toList', $buttonElem).is(":visible")) { 15544 changeMapView($wrapper, $buttonElem, true); 15545 } 15546} 15547//include 9 15548 15549/* 15550some description what this module is suppoised to do. This is for future reference so I will not do some stupid shit cause I forgot... 15551On the page there are multiple forms, that have the same input elements/filters. A User usually wants to browse the site and keep the values he already put in 15552(for example dates). This module keeps the filters in local storage and prepopulates them when the use opens a page. The filters are being kept for an hour or so. 15553Rules to consider: 15554 15555* Values from local storage should only be used to prepopulate the filters. Never should they be used to make a request directly 15556(Except for the Availabilitysearch, but that's another story) 15557 15558* Prefer POST Values. If a POST value is set do not use the value from local storage 15559 15560*/ 15561 15562jQuery(function () { 15563 var privateFunctions = { 15564 saveFilters(container) { 15565 var group = container.data("filters"); 15566 group = group || null; 15567 container.find("[data-filter-input]").each(function () { 15568 var name = $(this).data("filter-name"); 15569 if (!name) name = $(this).attr("name"); 15570 var value, 15571 setValue = false, 15572 formElementFunctions = $(this).data("form-element-functions"); 15573 if (!!formElementFunctions) { 15574 value = formElementFunctions.get(); 15575 setValue = true; 15576 } else { 15577 if ($(this).is(":checkbox") || $(this).is(":radio")) { 15578 if ($(this).is(":checked")) { 15579 value = $(this).val(); 15580 setValue = true; 15581 } 15582 } else { 15583 value = $(this).val(); 15584 setValue = true; 15585 } 15586 } 15587 if (setValue) { 15588 window.pixelpoint.filterManager.set(name, value, group); 15589 } 15590 }); 15591 }, 15592 loadFilters(container) { 15593 var group = container.data("filters"); 15594 group = group || null; 15595 var savedFilters = window.pixelpoint.filterManager.get(null, null, group); 15596 container.find("[data-filter-input]").each(function () { 15597 var ignoreFilter = $(this).is("[data-ignore-filter]"); 15598 if (!!ignoreFilter) return true; //we ignore the filter. If for example we already set the value via POST... 15599 15600 var name = $(this).data("filter-name"); 15601 if (!name) name = $(this).attr("name"); 15602 var formElementFunctions = $(this).data("form-element-functions"); 15603 if (!!savedFilters && !!savedFilters[name]) { 15604 if (!!formElementFunctions) formElementFunctions.set(savedFilters[name]);else { 15605 if ($(this).is(":checkbox") || $(this).is(":radio")) { 15606 var value = savedFilters[name]; 15607 if ($(this).val() == value) $(this).prop("checked", true); 15608 } else { 15609 $(this).val(savedFilters[name]); 15610 if ($(this).data('select2')) { 15611 $(this).trigger("change"); 15612 } 15613 } 15614 } 15615 } 15616 }); 15617 } 15618 }; 15619 $("[data-filters]").each(function () { 15620 var $this = $(this); 15621 if (!$this.is("[data-supress-save]")) { 15622 $this.find("form").addBack("form").on("submit", function (e) { 15623 privateFunctions.saveFilters($this); 15624 }); 15625 } 15626 if (!$this.is("[data-supress-load]")) privateFunctions.loadFilters($this); 15627 }); 15628}); 15629//include 9 15630 15631jQuery(function () { 15632 var privateFunctions = {}; 15633 $("[data-dynamic-filters]").each(function () { 15634 var $this = $(this); 15635 var containerName = $this.data("dynamic-filters"); 15636 if (!containerName) return; 15637 var container = $(`[data-dynamic-filters-container='${containerName}']`); 15638 if (container.length == 0) return; 15639 }); 15640}); 15641//include 9 15642 15643jQuery(function () { 15644 var privateFunctions = { 15645 checkSuperior(container) { 15646 var superior_checkbox = container.find(".superior_star input[type='checkbox']"); 15647 var superior_checked = false; 15648 container.find(".checkbox-wrapper input.is_superior").each(function () { 15649 if ($(this).is(":checked")) superior_checked = true; 15650 }); 15651 if (!!superior_checked) { 15652 superior_checkbox.prop("checked", true); 15653 } else { 15654 superior_checkbox.prop("checked", false); 15655 } 15656 }, 15657 init() { 15658 $(".stars-checkbox-group").each(function () { 15659 var $this = $(this); 15660 if ($this.data("stars-initialized") == "1") return; 15661 var superior_checkbox = $this.find(".superior_star input[type='checkbox']"); 15662 $this.find(".checkbox-wrapper input[type='checkbox']").on("change", function () { 15663 privateFunctions.checkSuperior($this); 15664 }); 15665 $this.data("stars-initialized", "1"); 15666 }); 15667 } 15668 }; 15669 privateFunctions.init(); 15670 window.ppComponents.starsGroup = { 15671 init: function () { 15672 privateFunctions.init(); 15673 } 15674 }; 15675}); 15676jQuery(function () {
15677 var searchWrapper = $("#search-wrapper-id"); 15678 var clickTimeout = null; 15679 15680 //var scrollTimeout = null; 15681 var resizeTimeout = null; 15682 var elemsHeight = $(".header").height() + $(".breadcrumbs-cont").height() + $(".result-header").height(); //+ $(".result-pagination").height(); 15683 var globalSearchHeight = $(window).height() - elemsHeight; 15684 var privateFunctions = { 15685 mapExists: function () { 15686 return $("#search-rbnb-map").length > 0; 15687 }, 15688 calcStickyMap: function () { 15689 var marginInPx = $('.header-wrapper .header').height(); 15690 15691 // scroll effect on Large Screens 15692 if (Foundation.MediaQuery.current == "large") { 15693 var marginInPxNew = $('.header-wrapper .header .main-nav').height() + 12; 15694 marginInPx = marginInPxNew; 15695 } 15696 // scroll effect on Large Screens - END 15697 15698 var marginInEm = marginInPx / parseFloat($("body").css("font-size")); 15699 var moduleId = "#search-rbnb-map"; 15700 $(`${moduleId} .sticky`).attr('data-margin-top', marginInEm).data('margin-top', marginInEm); 15701 $(`${moduleId} .sticky`).css('height', `calc(100vh - ${marginInPx}px)`); 15702 $(`${moduleId} .sticky`).css('min-height', `calc(100vh - ${marginInPx}px)`); 15703 if ($(`${moduleId} .sticky`).attr('data-sticky')) { 15704 $(`${moduleId} .sticky`).data('zfPlugin').options.marginTop = marginInEm; 15705 $(`${moduleId} .sticky`).foundation('_calc', true, 100); // 100 is just a random number, I do not know why it only works 100% of the time, if a number is provided 15706 } else { 15707 $(`${moduleId} .sticky`).attr('data-sticky', 'true').foundation(); 15708 } 15709 if (!!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static && !!ppcartoStatic.$refs.static.map) { 15710 ppcartoStatic.$refs.static.map._onResize(); 15711 } 15712 }, 15713 resizeMap: function () { 15714 var scrollTop = $(window).scrollTop(); 15715 var marginInPx = $('.header-wrapper .header').height(); 15716 15717 // scroll effect on Large Screens 15718 if (Foundation.MediaQuery.current == "large") { 15719 var marginInPxNew = $('.header-wrapper .header .main-nav').height() + 12; 15720 marginInPx = marginInPxNew; 15721 } 15722 // scroll effect on Large Screens - END 15723 15724 scrollTop = $(window).scrollTop() + marginInPx; 15725 var mapTop = $("#search-rbnb-map").offset().top; 15726 var currentHeight = $(`#search-rbnb-map .sticky`).height(); 15727 var height = 0; //just so we initialize the variable 15728 15729 if (mapTop <= scrollTop) { 15730 $(`#search-rbnb-map .sticky`).css('height', `calc(100vh - ${marginInPx}px)`); 15731 $(`#search-rbnb-map .sticky`).css('min-height', `calc(100vh - ${marginInPx}px)`); 15732 height = $(`#search-rbnb-map .sticky`).height(); 15733 if (currentHeight != height) { 15734 if (!!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static && !!ppcartoStatic.$refs.static.map) { 15735 ppcartoStatic.$refs.static.map._onResize(); 15736 } 15737 } 15738 return; 15739 } 15740 var bottomTop = $(window).scrollTop() + $(window).height(); 15741 height = bottomTop - mapTop; 15742 $(`#search-rbnb-map .sticky`).css('height', `${height}px`); 15743 $(`#search-rbnb-map .sticky`).css('min-height', `${height}px`); 15744 if (currentHeight != height) { 15745 if (!!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static && !!ppcartoStatic.$refs.static.map) { 15746 ppcartoStatic.$refs.static.map._onResize(); 15747 } 15748 } 15749 }, 15750 mapGlobalSearchExists: function () { 15751 return $("#global-search-rbnb-map").length > 0; 15752 }, 15753 calcGlobalSearchMap: function () { 15754 if (typeof ppcartoStatic !== 'undefined' && !!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static && !!ppcartoStatic.$refs.static.map) { 15755 ppcartoStatic.$refs.static.map.resize(); //._onResize(); 15756 } 15757 } 15758 }; 15759 $(window).on("load", function () { 15760 //equalHeight($("#search-wrapper-id .search-result-item"), true); 15761 15762 $(".search-wrapper").each(function () { 15763 var $this = $(this); 15764 if ($this.is(":visible")) { 15765 equalHeight($this.find(".search-result-item"), true); 15766 } 15767 }); 15768 if (privateFunctions.mapExists()) { 15769 privateFunctions.calcStickyMap(); 15770 privateFunctions.resizeMap(); 15771 } else if (privateFunctions.mapGlobalSearchExists()) { 15772 let hasClass = $(".global-search-rbnb-map-wrapper").hasClass("in-foreground"); 15773 let minHeight = $(".global-search-rbnb-map-wrapper").addClass("in-foreground").css('min-height'); 15774 minHeight = parseInt(minHeight); 15775 if (!hasClass) $(".global-search-rbnb-map-wrapper").removeClass("in-foreground"); 15776 if (!!minHeight && globalSearchHeight < minHeight) globalSearchHeight = minHeight; 15777 $(".global-search-rbnb-map-wrapper").height(globalSearchHeight); 15778 privateFunctions.calcGlobalSearchMap(); 15779 } else {} 15780 }); 15781 $(window).on("orientationchange resize", function () { 15782 if (!!resizeTimeout) { 15783 clearTimeout(resizeTimeout); 15784 } 15785 resizeTimeout = setTimeout(function () { 15786 //equalHeight($("#search-wrapper-id .search-result-item"), true); 15787 15788 $(".search-wrapper").each(function () { 15789 var $this = $(this); 15790 if ($this.is(":visible")) { 15791 equalHeight($this.find(".search-result-item"), true); 15792 } 15793 }); 15794 if (privateFunctions.mapExists()) { 15795 privateFunctions.calcStickyMap(); 15796 } else if (privateFunctions.mapGlobalSearchExists()) { 15797 privateFunctions.calcGlobalSearchMap(); 15798 } else {} 15799 resizeTimeout = null; 15800 }, 300); 15801 }); 15802 $(window).on("scroll", function () { 15803 if (privateFunctions.mapExists()) { 15804 privateFunctions.resizeMap(); 15805 } else if (privateFunctions.mapGlobalSearchExists()) { 15806 privateFunctions.calcGlobalSearchMap(); 15807 } else {} 15808 });
15809 $(".search-results").off("click", ".switch-to-map").on("click", ".switch-to-map", function (e) { 15810 e.preventDefault(); 15811 if (!!clickTimeout) { 15812 clearTimeout(clickTimeout); 15813 } 15814 clickTimeout = setTimeout(function () { 15815 var $target = $(e.target).closest(".switch-to-map"); 15816 $("#search-wrapper-id .result-display-wrapper .search-results").toggleClass("in-foreground"); 15817 if (!!$target.data("alternative-text")) { 15818 var currentText = $target.html(); 15819 var textToReplace = $target.data("alternative-text"); 15820 $target.data("alternative-text", currentText); 15821 $target.html(textToReplace); 15822 } 15823 if (privateFunctions.mapExists()) { 15824 $("#search-rbnb-map").toggleClass("in-foreground"); 15825 } else if (privateFunctions.mapGlobalSearchExists()) { 15826 $("#global-search-rbnb-map").toggleClass("in-foreground"); 15827 if ($("#global-search-rbnb-map").hasClass("in-foreground")) { 15828 $(".global-search .search-wrapper .search").height(globalSearchHeight); 15829 $('html, body').animate({ 15830 scrollTop: $(".searchPage").offset().top - $('.header-wrapper .header').height() - 16 15831 }, 800); 15832 } else { 15833 $(".global-search .search-wrapper .search").removeAttr('style'); 15834 } 15835 } 15836 if (!!ppcartoStatic && !!ppcartoStatic.$refs && !!ppcartoStatic.$refs.static && !!ppcartoStatic.$refs.static.refitBounds) { 15837 ppcartoStatic.$refs.static.refitBounds(); 15838 }
15839 window.pixelpoint.tagManager.event("moduleClicked", { 15840 "modulename": "Search Results", 15841 "suche-karte": "true", 15842 "view": $target.data("alternative-text") 15843 }); 15844 }, 200); 15845 }); 15846 $(".search-categories-list").on("click", "a.accordion-title", function (e) { 15847 var $target = $(e.target).closest("a.accordion-title"); 15848 var categoryName = $target.contents().filter(function () { 15849 return this.nodeType == 3; 15850 })[0].nodeValue; 15851 window.pixelpoint.tagManager.event("moduleClicked", { 15852 "modulename": "Search Results", 15853 "kategorie": "true", 15854 "kategorie-name": categoryName 15855 }); 15856 }); 15857 $(window).on('load', function () { 15858 if (searchWrapper.length == 0) return; 15859 let limit = 100; 15860 let loadFeatures = () => { 15861 var features = window.pixelpoint.airBnB.getFeatures(); 15862 if (!!features && features.length > 0) { 15863 var parent = $(".result-list"); 15864 var tiles = $(".result-list .search-result-item"); 15865 $.each(features, function (key, feature) { 15866 var index = key + 1; 15867 var id = feature.id; 15868 var poiType = feature.layer; 15869 var searchedTile = null; 15870 if (!!poiType) { 15871 searchedTile = tiles.filter(`[data-type="${poiType}"][data-item-id="${id}"]`).not('.indexed').first(); 15872 } else { 15873 searchedTile = tiles.filter(`[data-item-id="${id}"]`).not('.indexed').first(); 15874 } 15875 if (searchedTile.length == 0) return true; 15876 var number = searchedTile.find(".slider-wrapper p.number"); 15877 if (number.length > 0) { 15878 number.text(index); 15879 } else { 15880 searchedTile.find(".slider-wrapper").append(`<p class="number">${index}</p>`); 15881 } 15882 searchedTile.addClass("indexed"); 15883 parent.append(searchedTile); 15884 }); 15885 } else { 15886 if (limit > 0) { 15887 setTimeout(() => { 15888 loadFeatures(); 15889 }, 100); 15890 } 15891 } 15892 limit--; 15893 }; 15894 loadFeatures(); 15895 }); 15896}); 15897//include 28 15898jQuery(function () { 15899 var sessionKey = "ppMerkliste"; 15900 15901 //yes, we need the session key :S 15902 var getSessionKey = function () { 15903 var merklisteSession = "merkliste="; 15904 var decodedCookie = decodeURIComponent(document.cookie); 15905 var sessionId = null; 15906 var ca = decodedCookie.split(';'); 15907 for (var i = 0; i < ca.length; i++) { 15908 var c = ca[i]; 15909 while (c.charAt(0) == ' ') { 15910 c = c.substring(1); 15911 } 15912 if (c.indexOf(merklisteSession) == 0) { 15913 sessionId = c.substring(merklisteSession.length, c.length); 15914 } 15915 } 15916 if (sessionId == null) { 15917 sessionId = Math.random().toString(36).substring(7); 15918 document.cookie = `${merklisteSession}${sessionId};path=/`; 15919 } 15920 return sessionId; 15921 }; 15922 sessionKey += getSessionKey(); 15923 var itemTemplate = { 15924 group: "", 15925 template: "poi", 15926 url: "", 15927 data: {} 15928 }; 15929 var privateFunctions = { 15930 get() { 15931 var merkliste = window.pixelpoint.sessionService.get(sessionKey); 15932 return merkliste; 15933 }, 15934 count() { 15935 var merkliste = privateFunctions.get(); 15936 if (!!merkliste) return Object.keys(merkliste).length; 15937 return 0; 15938 }, 15939 set(merkliste) { 15940 window.pixelpoint.sessionService.set(sessionKey, merkliste); 15941 }, 15942 clear() { 15943 window.pixelpoint.sessionService.set(sessionKey, {}); 15944 privateFunctions.updateCount(); 15945 }, 15946 addOrUpdate(item, id) { 15947 var merkliste = privateFunctions.get(); 15948 if (!merkliste) { 15949 merkliste = {}; 15950 } 15951 merkliste[id] = item; 15952 privateFunctions.set(merkliste); 15953 privateFunctions.updateCount(); 15954 }, 15955 remove(id) { 15956 var merkliste = privateFunctions.get(); 15957 if (!merkliste) return; 15958 if (!!merkliste[id]) delete merkliste[id]; 15959 privateFunctions.set(merkliste); 15960 privateFunctions.updateCount(); 15961 }, 15962 exists(id) { 15963 var merkliste = privateFunctions.get(); 15964 if (!merkliste) return false; 15965 if (!!merkliste[id]) return true; 15966 return false; 15967 }, 15968 updateCount() { 15969 var elementsCount = privateFunctions.count(); 15970 var prepend = $(".header-wrapper .header .controls .control.icon-star-after, .header-wrapper .header .controls .control .icon-star").data("prepend") || ""; 15971 var prependMobile = $("#offCanvas .controls .control.icon-star-after, #offCanvas .controls .control .icon-star").data("prepend") || ""; 15972 $(".header-wrapper .header .controls .control.icon-star-after, .header-wrapper .header .controls .control .icon-star").text(prepend + elementsCount); 15973 var mobile = $("#offCanvas .controls .control.icon-star-after, #offCanvas .controls .control .icon-star"); 15974 var span = mobile.find("span"); 15975 if (span.length == 0) { 15976 span = $('<span></span>'); 15977 mobile.append(span); 15978 } 15979 span.text(prependMobile + elementsCount); 15980 15981 //console.log(elementsCount); 15982 }, 15983 createItem(data) { 15984 var item = $.extend(true, {}, itemTemplate); 15985 var itemKeys = Object.keys(item); 15986 for (var i in data) { 15987 if ($.inArray(i, itemKeys) > -1 && i != "data") { 15988 item[i] = data[i]; 15989 } else if (i == "data") { 15990 $.extend({}, item[i], data[i]); 15991 } else { 15992 item.data[i] = data[i]; 15993 } 15994 } 15995 return item; 15996 } 15997 }; 15998 privateFunctions.updateCount(); 15999 window.pixelpoint.merkliste = { 16000 get(id) { 16001 var merkliste = privateFunctions.get(); 16002 if (!merkliste) return null; 16003 if (!!merkliste[id]) return null; 16004 return merkliste[id]; 16005 }, 16006 getAll() { 16007 var merkliste = privateFunctions.get(); 16008 return merkliste; 16009 }, 16010 addOrUpdate(data, id) { 16011 var item = privateFunctions.createItem(data); 16012 privateFunctions.addOrUpdate(item, id); 16013 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.checkBookmarks); 16014 }, 16015 remove(id) { 16016 privateFunctions.remove(id); 16017 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.checkBookmarks); 16018 }, 16019 clear() { 16020 privateFunctions.clear(); 16021 window.pixelpoint.pubSub.publish(window.pixelpoint.pubSub.events.checkBookmarks); 16022 }, 16023 count() { 16024 return privateFunctions.count(); 16025 }, 16026 exists(id) { 16027 return privateFunctions.exists(id); 16028 } 16029 }; 16030}); 16031//include 28 16032jQuery(function () { 16033 var dataPrependString = "bookmarkProperty"; 16034 var checkBookmarks = function () { 16035 $("[data-bookmark]").each(function () { 16036 var $this = $(this); 16037 var id = $this.data("bookmark-id"); 16038 if (!!id) {
16039 if (window.pixelpoint.merkliste.exists(id)) { 16040 $this.addClass("bookmark-added"); 16041 } else { 16042 $this.removeClass("bookmark-added"); 16043 } 16044 } 16045 }); 16046 }; 16047 $("body").on("click", "[data-bookmark]", function () { 16048 var $this = $(this); 16049 var data = $this.data("bookmark-contents"); 16050 var id = $this.data("bookmark-id"); 16051 if (window.pixelpoint.merkliste.exists(id)) { 16052 window.pixelpoint.merkliste.remove(id); 16053 $this.removeClass("bookmark-added"); 16054 checkBookmarks(); 16055 return; 16056 } 16057 var item = {}; 16058 if (!data) { 16059 var storedData = $this.data(); 16060 var itemData = {}; 16061 for (var key in storedData) { 16062 if (storedData.hasOwnProperty(key)) { 16063 //important, so we do not access the prototype. Do not access the prototype here or bad thinks will happen! 16064 16065 if (key.indexOf(dataPrependString) == 0) { 16066 var propertyName = key.replace(dataPrependString, ""); 16067 if (!!propertyName) { 16068 propertyName = propertyName.charAt(0).toLowerCase() + propertyName.slice(1); 16069 itemData[propertyName] = storedData[key]; 16070 } 16071 } 16072 } 16073 } 16074 data = itemData; 16075 } 16076 window.pixelpoint.merkliste.addOrUpdate(data, id); 16077 $this.addClass("bookmark-added"); 16078 16079 //***************tag manager********************************* 16080 if (!!data.title) { 16081 var tagData = {}; 16082 tagData.Starname = data.title;
16083 window.pixelpoint.tagManager.event("icon_star_merken", tagData); 16084 } 16085 //*********************************************************** 16086 16087 checkBookmarks(); 16088 }); 16089 window.pixelpoint.pubSub.subscribe(window.pixelpoint.pubSub.events.checkBookmarks, checkBookmarks); 16090 checkBookmarks(); 16091}); 16092//include 28 16093jQuery(function () { 16094 var instance; 16095 var fallbackUrl = window.ppsettings.imageFallback; 16096 var conventionAnfrageEndpoint = window.pixelpoint.utilities.getAjaxUrl("/index.php?type=1732176051&action=conventionInquiry"); 16097 16098 //for now we use the same template 16099 var templateMapping = { 16100 poi: "poi", 16101 event: "poi", 16102 accomodation: "poi" 16103 }; 16104 var tabTranslations = { 16105 poi: window.ppt.translate("headline.offers.plural", "Angebote"), 16106 pois: window.ppt.translate("headline.offers.plural", "Angebote"), 16107 event: window.ppt.translate("headline.events", "Veranstaltungen"), 16108 eventdate: window.ppt.translate("headline.events", "Veranstaltungen"), 16109 page: window.ppt.translate("merkliste.article", "Artikel"), 16110 kiju: window.ppt.translate("merkliste.kiju", "Kinder- und Jugendunterkünfte"), 16111 familypass: window.ppt.translate("merkliste.familypass", "Familienpass-Angebote"), 16112 tour: window.ppt.translate("merkliste.tour", "Touren"), 16113 accomodation: window.ppt.translate("merkliste.accomodation", "Unterkünfte"), 16114 package: window.ppt.translate("merkliste.package", "Arrangements"), 16115 convention: window.ppt.translate("merkliste.convention", "Tagungen") 16116 }; 16117 var privateFunctions = { 16118 translateTab(tab) { 16119 var toLowerTab = tab.toLowerCase(); 16120 if (!!tabTranslations[toLowerTab]) return tabTranslations[toLowerTab];else return tab; 16121 }, 16122 reinitTabs(element) { 16123 var tabs = element.find("#bookmark-tabs"); 16124 var tabsContent = element.find(".tabs-content"); 16125 tabs.foundation('destroy'); 16126 tabsContent.find(".tabs-panel").each(function () { 16127 var elementsCount = $(this).find("div.item").length; 16128 if (elementsCount == 0) { 16129 var id = $(this).attr("id"); 16130 tabs.find(`a[href='#${id}']`).closest(".tabs-title").remove(); 16131 $(this).remove(); 16132 } 16133 }); 16134 if (tabsContent.find(".tabs-panel").length == 0) { 16135 instance.close(); 16136 return; 16137 } 16138 var elem = new Foundation.Tabs(tabs); 16139 privateFunctions.bindAnfrageButton(element); 16140 var id = tabsContent.find(".tabs-panel").first().attr("id"); 16141 elem.selectTab(`#${id}`); 16142 if (!$(`#${id}`).hasClass("is-active")) $(`#${id}`).addClass("is-active"); 16143 tabs.find(".tabs-title").removeAttr("style"); 16144 //tabs.foundation('_openTab', id);
16145 var sliderElement = element.find('.tabgallery .tabs-panel.is-active > .tabgallery-slider'); 16146 $(".lity-content").css({ 16147 width: $(".lity-content").width(), 16148 height: $(".lity-content").height() 16149 }); 16150 setTimeout(function () { 16151 if (!sliderElement.hasClass('slick-initialized')) { 16152 privateFunctions.initSlickOnTabGallery(element, id); 16153 } 16154 $(".lity-content").css({ 16155 width: '', 16156 height: '' 16157 }); 16158 }, 1); 16159 return elem; 16160 }, 16161 prepareItems(items) { 16162 if (!items) return {}; 16163 var groups = {}; 16164 _.each(items, function (item, itemId) { 16165 if (!!item.group) { 16166 var translation = privateFunctions.translateTab(item.group); 16167 if (!groups[translation]) { 16168 groups[translation] = { 16169 name: translation, 16170 escapedName: item.group, 16171 showAnfrage: false, 16172 items: [] 16173 }; 16174 } 16175 if (item.group == "convention") { 16176 groups[translation].showAnfrage = true; 16177 } 16178 if (!item.id) item.id = itemId; 16179 var idAndType = item.id.split("_"); 16180 if (idAndType.length > 1) { 16181 item.realId = idAndType[1]; 16182 } else { 16183 item.realId = 0; 16184 } 16185 16186 //we merge the region and location 16187 item.data.locationregion = ""; 16188 if (!!item.data.location) item.data.locationregion = item.data.location; 16189 if (!!item.data.region) { 16190 if (!item.data.locationregion) item.data.locationregion = item.data.region;else if (item.data.locationregion != item.data.region) item.data.locationregion += `, ${item.data.region}`; 16191 } 16192 groups[translation].items.push(item); 16193 } 16194 }); 16195 for (var i in groups) { 16196 var jsonData = _.map(groups[i].items, item => { 16197 return { 16198 id: item.realId, 16199 name: item.data.title 16200 }; 16201 }); 16202 groups[i].jsonData = JSON.stringify(jsonData); 16203 } 16204 return groups; 16205 }, 16206 render() { 16207 var items = window.pixelpoint.merkliste.getAll(); 16208 if (!items) return ""; 16209 var template = $("script#merkliste-template").html(); 16210 if (!template) return ""; 16211 var groups = privateFunctions.prepareItems(items); 16212 if (!groups) return ""; 16213 var compiled = _.template(template, { 16214 imports: { 16215 "_": _ 16216 } 16217 }); 16218 var compiledPartials = {}; 16219 var parentClassName = "large-6"; 16220 if (Object.keys(groups).length > 3) { 16221 parentClassName = "large-12"; 16222 } 16223 var firstName = Object.keys(groups)[0]; 16224 var showAnfrage = groups[firstName].showAnfrage == true; 16225 let templateValues = { 16226 groups: groups, 16227 firstGroupName: firstName, 16228 parentClassName: parentClassName, 16229 showAnfrage: showAnfrage, 16230 helpers: { 16231 partial: function (item, template) { 16232 if (!compiledPartials[template]) { 16233 var usedTemplate = template; 16234 if (!!templateMapping[template]) usedTemplate = templateMapping[template]; 16235 var partialTemplate = $(`script#merkliste-${usedTemplate}-template`).html(); 16236 if (!!partialTemplate) { 16237 compiledPartials[template] = _.template(partialTemplate, { 16238 imports: { 16239 "_": _ 16240 } 16241 }); 16242 } 16243 } 16244 if (!!compiledPartials[template]) { 16245 var result = compiledPartials[template]({ 16246 item: item 16247 }); 16248 if (typeof result !== "string") { 16249 result = result({ 16250 item: item 16251 }); 16252 } 16253 return result; 16254 } else { 16255 return ""; 16256 } 16257 } 16258 } 16259 }; 16260 let result = compiled(templateValues); 16261 if (typeof result !== "string") result = result(templateValues); 16262 return result; 16263 }, 16264 initSlickOnTabGallery(element, tabId) { 16265 if (!tabId) {
16266 tabId = '.tabs-panel.is-active'; 16267 } else if (tabId.charAt(0) != "#") { 16268 tabId = "#" + tabId; 16269 } 16270 var options = { 16271 initialSlide: 1, 16272 centerMode: true, 16273 //centerPadding: '-15px', 16274 centerPadding: '-20px', 16275 //centerPadding: '0', 16276 infinite: true, 16277 slidesToShow: 4, 16278 slidesToScroll: 1 16279 }, 16280 options1100 = { 16281 //arrows: false, 16282 centerMode: true, 16283 //centerPadding: '25px', 16284 //centerPadding: '0', 16285 slidesToShow: 4, 16286 //initialSlide: 2 16287 initialSlide: 1 16288 }, 16289 options800 = { 16290 //arrows: false, 16291 centerMode: true, 16292 //centerPadding: '25px', 16293 centerPadding: '-5px', 16294 slidesToShow: 2, 16295 initialSlide: 1 16296 }, 16297 options600 = { 16298 //arrows: false, 16299 centerMode: true, 16300 //centerPadding: '20px', 16301 centerPadding: '-5px', 16302 slidesToShow: 1, 16303 initialSlide: 1 16304 }, 16305 options400 = { 16306 //arrows: false, 16307 centerMode: true, 16308 //centerPadding: '10px', 16309 centerPadding: '0', 16310 slidesToShow: 1, 16311 initialSlide: 1 16312 }; 16313 var slidesCount = element.find('.tabgallery ' + tabId + " > .tabgallery-slider > .item").length; 16314 if (slidesCount <= 4) { 16315 options.initialSlide = 0; 16316 options.centerMode = false; 16317 options.centerPadding = 0; 16318 options.infinite = false; 16319 options1100.initialSlide = 0; 16320 options1100.centerMode = false; 16321 options1100.centerPadding = 0; 16322 options1100.infinite = false; 16323 if (slidesCount <= 3) { 16324 options800.initialSlide = 0; 16325 options800.centerMode = false; 16326 options800.centerPadding = 0; 16327 options800.infinite = false; 16328 } 16329 if (slidesCount <= 2) { 16330 options600.initialSlide = 0; 16331 options600.centerMode = false; 16332 options600.centerPadding = 0; 16333 options600.infinite = false; 16334 } 16335 if (slidesCount == 1) { 16336 options400.initialSlide = 0; 16337 options400.centerMode = false; 16338 options400.centerPadding = 0; 16339 options400.infinite = false; 16340 } 16341 } 16342 var mainSettings = { 16343 slide: ".item", 16344 swipeToSlide: true, 16345 prevArrow: '<button class="prev"><i class="icon-arrow-big-left"></i></button>', 16346 nextArrow: '<button class="next"><i class="icon-arrow-big-right"></i></button>' 16347 }; 16348 mainSettings = $.extend(mainSettings, options); 16349 mainSettings.responsive = [{ 16350 breakpoint: 1100, 16351 settings: options1100 16352 }, { 16353 breakpoint: 800, 16354 settings: options800 16355 }, { 16356 breakpoint: 600, 16357 settings: options600 16358 }, { 16359 breakpoint: 400, 16360 settings: options400 16361 }]; 16362 var determineHeight = function () { 16363 let maxHeight = 0; 16364 element.find(`.tabgallery ul .search-result-item-content`).each(function () { 16365 $(this).css('height', ''); 16366 }); 16367 setTimeout(() => { 16368 var firstSliderElement = element.find(`.tabgallery .tabs-p
16368anel.is-active div.search-result-item`).first(); 16369 var elementWidth = 300; 16370 if (firstSliderElement.length > 0) { 16371 if (firstSliderElement.width() > 0) elementWidth = firstSliderElement.width(); 16372 } 16373 element.find(`.tabgallery .tabs-panel`).each((index, panel) => { 16374 if (!$(panel).hasClass('is-active')) { 16375 $(panel).addClass('is-active remove-after'); 16376 $(panel).find("div.search-result-item").each((i, li) => { 16377 if (!$(li).is('[style*="width"]') || $(li).width() == 0) { 16378 $(li).css({ 16379 'width': `${elementWidth}px` 16380 }); 16381 } 16382 }); 16383 } 16384 }); 16385 element.find(`.tabgallery ul .search-result-item-content`).each(function () { 16386 $(this).css('height', ''); 16387 let height = $(this).height(); 16388 if (height > maxHeight) maxHeight = height; 16389 }); 16390 element.find(`.tabgallery .tabs-panel`).each((index, panel) => { 16391 if ($(panel).hasClass('remove-after')) { 16392 $(panel).removeClass('is-active').removeClass('remove-after'); 16393 } 16394 }); 16395 element.find(`.tabgallery ul .search-result-item-content`).each(function () { 16396 $(this).height(maxHeight); 16397 }); 16398 }, 100); 16399 }; 16400 element.find('.tabgallery ' + tabId + ' > .tabgallery-slider').off("init.determineHeight").on("init.determineHeight", determineHeight); 16401 var resizeTimeout = null; 16402 $(window).off("orientationchange.determineHeight resize.determineHeight").on("orientationchange.determineHeight resize.determineHeight", () => { 16403 if (resizeTimeout != null) clearTimeout(resizeTimeout); 16404 resizeTimeout = setTimeout(() => { 16405 determineHeight(); 16406 resizeTimeout = null; 16407 }, 50); 16408 }); 16409 element.find('.tabgallery ' + tabId + ' > .tabgallery-slider').each((index, el) => { 16410 if (!$(el).hasClass('slick-initialized')) $(el).slick(mainSettings);else { 16411 if (!!el.slick && !!el.slick.refresh) el.slick.refresh(); 16412 } 16413 }); 16414 //******************************************************** 16415 //******************************************************** 16416 }, 16417 bindAnfrageButton(tabs) { 16418 tabs.off('change.zf.tabs').on('change.zf.tabs', function (e, tab) { 16419 if (!!tab.data("anfrage")) { 16420 tabs.find(".tools .anfrage").removeClass("hide"); 16421 } else { 16422 tabs.find(".tools .anfrage").addClass("hide"); 16423 } 16424 }); 16425 }, 16426 initializeComponents(element) { 16427 var elem = new Foundation.Tabs(element.find("#bookmark-tabs")); 16428 privateFunctions.bindAnfrageButton(element); 16429 element.find('#bookmark-tabs .tabs-title').each(function () { 16430 var $this = $(this); 16431 setTimeout(function () { 16432 $this.children('a:first').css("width", "100%"); 16433 }, 10); 16434 }); 16435 element.find('#bookmark-tabs .tabs-title').click(function (e) { 16436 e.preventDefault(); 16437 var id = $(this).children('a:first').attr('href');
16438 if (!$(`.tabgallery .tabs-panel${id}`).hasClass('.is-active')) { 16439 $(`.tabgallery .tabs-panel${id}`).addClass('is-active'); 16440 } 16441 var sliderElement = element.find('.tabgallery .tabs-panel.is-active > .tabgallery-slider'); 16442 $(".lity-content").css({ 16443 width: $(".lity-content").width(), 16444 height: $(".lity-content").height() 16445 }); 16446 setTimeout(function () { 16447 if (sliderElement.hasClass('slick-initialized')) { 16448 privateFunctions.initSlickOnTabGallery(element, id); 16449 } 16450 $(".lity-content").css({ 16451 width: '', 16452 height: '' 16453 }); 16454 }, 1); 16455 }); 16456 //*/ 16457 privateFunctions.initSlickOnTabGallery(element); 16458 element.on("click", ".removeBookmark", function () { 16459 var slide = $(this).closest(".search-result-item"); 16460 if (slide.length == 0) return; 16461 var slider = slide.closest(".tabgallery-slider.slick-initialized"); 16462 if (slider.length == 0) return; 16463 var bookmarkId = slide.data("bookmark-item-id"); 16464 var slideIndex = slide.data("slide-index"); 16465 window.pixelpoint.merkliste.remove(bookmarkId); 16466 var itemData = slide.closest("#bookmark-modal").find(".tabs-title.is-active").data("items"); 16467 16468 // TPBB-1108 16469 //if(typeof(bookmarkId) == 'string' && bookmarkId.indexOf("_") >= 0){ 16470 var parts = bookmarkId.split("_"); 16471 if (parts.length >= 2) { 16472 itemData = _.filter(itemData, item => { 16473 return item.id != parts[1]; 16474 }); 16475 slide.closest("#bookmark-modal").find(".tabs-title.is-active").data("items", itemData); 16476 } 16477 /*} 16478 else { 16479 itemData = _.filter(itemData, item => { 16480 return item.id != bookmarkId; 16481 }); 16482 slide.closest("#bookmark-modal").find(".tabs-title.is-active").data("items", itemData); 16483 }*/ 16484 16485 //slider.slick('slickRemove', slideIndex); 16486 slider.slick('unslick'); 16487 element.find(`[data-bookmark-item-id='${bookmarkId}']`).remove(); 16488 var tab = slider.closest(".tabs-panel"); 16489 var remainingSlidesCount = tab.find("[data-bookmark-item-id]").length; 16490 if (remainingSlidesCount == 0) { 16491 elem = privateFunctions.reinitTabs(element); 16492 } else { 16493 privateFunctions.initSlickOnTabGallery(element); 16494 } 16495 }); 16496 window.pixelpoint.images.initializeErrors(element); 16497 element.find(".tools .print").on("click", function () { 16498 privateFunctions.print(); 16499 }); 16500 element.find(".tools .anfrage").on("click", function () { 16501 privateFunctions.anfrage(); 16502 }); 16503 }, 16504 open() { 16505 var html = privateFunctions.render(); 16506 if (!html) return; 16507 instance = lity(html); 16508 var element = instance.element(); 16509 //element.find(".lity-close").attr("title", "Fenster schlieÃen").tooltipster(); 16510 element.find(".lity-close").attr("title", "Fenster schlieÃen"); 16511 element.addClass("bookmark-lity"); 16512 privateFunctions.initializeComponents(element); 16513 }, 16514 anfrage() { 16515 var modal = $("#bookmark-modal"); 16516 var itemData = modal.find(".tabs-title.is-active").data("items"); 16517 var allProviders = _.map(itemData, item => { 16518 return item.name; 16519 }).join(", "); 16520 var data = { 16521 allProviders: allProviders, 16522 items: itemData 16523 }; 16524 var template = $("script#merkliste-convention-provider").html(); 16525 var compiled = _.template(template, { 16526 imports: { 16527 "_": _ 16528 } 16529 }); 16530 let h = compiled(data); 16531 if (typeof h !== "string") h = h(data); 16532 var formInstance = lity(h); 16533 var element = formInstance.element(); 16534 var form = element.find("form"); 16535 new Foundation.Abide(form, {}); 16536 var elementsToEqualize = element.find("[data-equalizer]"); 16537 new Foundation.Equalizer(elementsToEqualize, {}); 16538 var loader = element.find(".loader"); 16539 if (loader.length > 0) { 16540 window.pixelpoint.ppComponents.loader(loader); 16541 } 16542 var calendar = element.find(".calendar"); 16543 if (calendar.length > 0) { 16544 window.pixelpoint.ppComponents.calendar(calendar); 16545 } 16546 form.on("submit", function (e) { 16547 e.preventDefault(); 16548 privateFunctions.submitAnfrage(form, formInstance); 16549 }); 16550 element.find(".checkbox-helper").each(function (e) { 16551 var container = $(this); 16552 var label = container.find("label"); 16553 var checkboxId = label.attr("for"); 16554 label.attr("for", ""); 16555 label.addClass("clickable"); 16556 var onClickFunc = _.debounce(function () { 16557 container.find(`#${checkboxId}`).prop("checked", !container.find(`#${checkboxId}`).prop("checked")); 16558 }, 200); 16559 container.on("click touchstart", "label", function () { 16560 onClickFunc(); 16561 }); 16562 }); 16563 }, 16564 submitAnfrage: (form, formInstance) => { 16565 form.foundation('validateForm'); 16566 var element = formInstance.element();
16567 if (form.hasClass("valid")) { 16568 var dataToBeSent = form.serialize(); 16569 var loaderFunctions = element.find(".loader").data("exposed"); 16570 if (!!loaderFunctions.show) { 16571 loaderFunctions.show(); 16572 } 16573 $.ajax({ 16574 url: conventionAnfrageEndpoint, 16575 type: "POST", 16576 data: dataToBeSent 16577 }).done(function (data) { 16578 formInstance.close(); 16579 lity("#merkliste-anfrage-reply-success"); 16580 }).fail(function (e) { 16581 formInstance.close(); 16582 lity("#merkliste-anfrage-reply-fail"); 16583 }).always(function () { 16584 if (!!loaderFunctions.hide) { 16585 loaderFunctions.hide(); 16586 } 16587 }); 16588 } 16589 }, 16590 print() { 16591 var prtContent = privateFunctions.render(); 16592 var content = $(prtContent); 16593 content.addClass("for-print"); 16594 var WinPrint = window.open('', '', 'left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0'); 16595 var styles = $(`link[rel="stylesheet"]`); 16596 WinPrint.document.write('
16596<html><head>'); 16597 styles.each(function () { 16598 var clone = $(this).clone(); 16599 clone.attr("href", clone[0].href); //we need the absolute url 16600 WinPrint.document.write(clone[0].outerHTML); 16601 }); 16602 WinPrint.document.write('</head><body>'); 16603 var imagesLoaded = []; 16604 content.find(".center-cropped").each(function () { 16605 var img = $(this).find("img"); 16606 var $this = $(this); 16607 if (img.length > 0) { 16608 var src = img[0].src; 16609 16610 //we check if the image exists 16611 var deferred = $.Deferred(); 16612 imagesLoaded.push(deferred.promise()); 16613 var image = new Image(); 16614 image.onload = function () { 16615 let width = image.width; 16616 let height = image.height; 16617 if (width / height >= 298 / 180) { 16618 img.addClass('wide-img'); 16619 } else { 16620 img.addClass('tall-img'); 16621 } 16622 img.attr("src", src); 16623 $(this).attr('style', `background-image:url("${src}");`); 16624 deferred.resolve(); 16625 }; 16626 image.onerror = function () { 16627 img.attr("src", fallbackUrl); 16628 $(this).attr('style', `background-image:url("${fallbackUrl}");`); 16629 deferred.resolve(); 16630 }; 16631 image.src = src; 16632 // --------------------------- 16633 } 16634 }); 16635 var site = window.location.hostname; //"www.reiseland-brandenburg.de"; 16636 16637 var title = window.ppt.translate('merkliste.print.title', 'Ihre Merkliste von ' + site, [site]); 16638 content.find("h2.capital-blue").text(title); 16639 content.find("#bookmark-tabs .tabs-title a").each(function () { 16640 var target = $(this).attr("href"); 16641 var title = $(this).text(); 16642 content.find(target).before(`<h2 class="capital-blue page-break">${title}</h2>`); 16643 }); 16644 content.find(".content-header a").each(function () { 16645 let href = this.href; 16646 if (!!href && href != "#") { 16647 let title = href.replace("http://", "Link: "); 16648 title = title.replace("https://", "Link: "); 16649 $(`<a class="print-link" href="${href}">${title}</a>`).insertAfter($(this).closest(".search-result-item-content").find(".content-footer")); 16650 } 16651 }); 16652 $.when.apply($, imagesLoaded).then(function () { 16653 WinPrint.document.write(content[0].outerHTML);
16654 WinPrint.document.write('</body></html>'); 16655 setTimeout(function () { 16656 $(WinPrint.document).find(".tabs-panel").each(function () { 16657 let maxHeight = 0; 16658 $(this).find(`.search-result-item-content`).each(function () { 16659 let height = $(this).height(); 16660 if (height > maxHeight) maxHeight = height; 16661 }); 16662 $(this).find(`.search-result-item-content`).each(function () { 16663 $(this).height(maxHeight); 16664 }); 16665 }); 16666 WinPrint.document.close(); 16667 WinPrint.focus(); 16668 setTimeout(function () { 16669 WinPrint.print(); 16670 if (!window.keepPrintOpen) WinPrint.close(); 16671 }, 200); 16672 //WinPrint.close(); 16673 }, 200); 16674 }); 16675 } 16676 }; 16677 16678 //$(".header-wrapper .header .controls .control.icon-star-after,#offCanvas .controls .control.icon-star-after").on("click", function (e) { 16679 16680 /* 16681 .header-wrapper .header .controls .control.icon-star-after, 16682 .header-wrapper .header .controls .control .icon-star, 16683 #offCanvas .controls .control.icon-star-after, 16684 #offCanvas .controls .control .icon-star
16685 */ 16686 16687 $(".header-wrapper .header .controls .control.control-merkliste, #offCanvas .controls .control.control-merkliste").on("click touchstart", function (e) { 16688 e.stopPropagation(); 16689 e.preventDefault(); 16690 16691 //$('*').tooltipster('hide'); 16692 //$('.tooltipster-show').css("z-index", "0!important"); 16693 16694 var itemCount = window.pixelpoint.merkliste.count(); 16695 if (itemCount == 0) return; 16696 privateFunctions.open(); 16697 }); 16698}); 16699//# sourceMappingURL=maps/custom.js.map
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.