/* Source common/js/scripts/100_tab_toggle.js */ // TAB // Wird verwendet für: Startseite Tab Wechsel // ------------------------------------------------------------------------------------------------- (function(document) { var Register = function($register) { var _this = this; _this._$register = $register; _this._$tabs = $register.querySelectorAll('.register_tab'); _this._$titles = $register.querySelectorAll('.title'); _this._$contents = $register.querySelectorAll('.content'); }; Register.prototype = { init: function() { var _this = this; for(var i = 0; i < _this._$tabs.length; i++) { var current_tab = _this._$tabs[i]; current_tab.addEventListener('click', function() { // Alle Tabs Schließexpfun _this.closeTabs(); // Neuer Tab öffnen _this.openTab(this); }) } window.addEventListener('load', function() { _this._set_height(); }); window.addEventListener('resize', function() { _this._set_height(); }); }, _set_height: function() { var _this = this, title_highest = 0, title_height = 0; content_highest = 0; content_height = 0; for (var i = 0; i < _this._$titles.length; i++) { title_height = _this._$titles[i].clientHeight; if (title_height > title_highest) { title_highest = title_height; } } title_height = title_height + 10; for (var i = 0; i < _this._$titles.length; i++) { _this._$titles[i].style.height = title_highest + 'px'; } for (var i = 0; i < _this._$contents.length; i++) { content_height = _this._$contents[i].clientHeight; console.log(content_height); if (content_height > content_highest) { console.log('da'); console.log(_this._$contents[i]); content_highest = content_height; } } content_height = content_height + 10; for (var i = 0; i < _this._$contents.length; i++) { _this._$contents[i].style.height = content_highest + 'px'; } _this._$register.style.marginBottom = content_highest + 'px'; }, closeTabs: function() { var _this = this; for(var i = 0; i < _this._$tabs.length; i++) { var current_tab = _this._$tabs[i]; current_tab.classList.remove('active'); } }, openTab: function(active_tab) { var _this = this; active_tab.classList.add('active'); } }; var $register = document.querySelectorAll('.register'); for (var i = 0, len = $register.length; i < len; i++) { new Register($register[i]).init(); } })(document); /* Source common/js/scripts/20_form_search_opener.js */ // SUCHE (FORMULAR) // ------------------------------------------------------------------------------------------------- (function(document) { var FormSearchOpener = function($toggle_search_form) { this.$toggle_search_form = $toggle_search_form; this.$open_search_form = $toggle_search_form.querySelector('.open_search_form'); this.$search_form = $toggle_search_form.querySelector('form'); this.$header_nav_wrapper = document.querySelector('.header_mav_wrapper'); }; FormSearchOpener.prototype = { init: function() { var _this = this; _this.$open_search_form.addEventListener('click', _this._open.bind(_this)); document.querySelector('body').addEventListener('click', _this._close.bind(_this)); _this.$toggle_search_form.addEventListener('click', function(event) { event.stopPropagation(); }) }, _open: function(event) { var _this = this; event.stopPropagation(); event.preventDefault(); _this.$search_form.classList.add('show'); _this.$header_nav_wrapper.classList.add('search_form_open'); }, _close: function(event) { var _this = this; _this.$search_form.classList.remove('show'); _this.$header_nav_wrapper.classList.remove('search_form_open'); } }; var $toggle_search_form = document.getElementsByClassName('search_form'); for (var i = 0, len = $toggle_search_form.length; i < len; i++) { new FormSearchOpener($toggle_search_form[i]).init(); } })(document); /* Source common/js/scripts/22_consent_banner.js */ // CONSENT-BANNER // ------------------------------------------------------------------------------------------------- (function(document, window) { var ConsentBanner = function($consent_banner) { var _this = this; _this.$consent_banner = $consent_banner, _this.$all_checkboxes = $consent_banner.querySelectorAll('.consent_banner_input input'), _this.$selected_checkboxes = $consent_banner.querySelectorAll('.consent_banner_input input:checked'), _this.$show_consent_banner = document.querySelectorAll('.show_consent_banner'), _this.$body = document.querySelector('body'), _this.$button_check_all = $consent_banner.querySelector('#check_all'), _this.$button_check_selected = $consent_banner.querySelector('#check_selected'), _this.hostname = window.location.hostname.substring(window.location.hostname.lastIndexOf('.', window.location.hostname.lastIndexOf('.') - 1) + 1), _this.expire_period = new Date().getTime() + (7 * 24 * 60 * 60 * 1000 * 104), _this.expire_date = new Date(_this.expire_period), _this.current_consent; } ConsentBanner.prototype = { init: function() { var _this = this; if (_this._consent_banner_is_not_checked()) { _this._show_consent_banner(); } _this.$button_check_all.addEventListener('click', function(e) { e.preventDefault(); _this._set_consent_per_checkbox(_this.$all_checkboxes); _this._hide_consent_banner(); }); _this.$button_check_selected.addEventListener('click', function(e) { e.preventDefault(); _this.$selected_checkboxes = _this.$consent_banner.querySelectorAll('.consent_banner_input input:checked'); _this._set_consent_per_checkbox(_this.$selected_checkboxes); _this._hide_consent_banner(); }); for (var i = 0; i < _this.$show_consent_banner.length; i++) { _this.$show_consent_banner[i].addEventListener('mousedown', function(e) { e.preventDefault(); _this.$body.classList.remove('hide_consent_banner'); _this._get_current_consent(); _this._unset_consent(); _this._show_consent_banner(); }) } }, _consent_banner_is_not_checked: function() { var _this = this; var now = new Date().getTime(); _this._get_current_consent(); if (_this.current_consent.length <= 0 || _this.current_consent[0] === null || _this.current_consent === undefined || _this.now > _this.current_consent[0].split("=")[1] ) { return true; } return false; }, _get_current_consent: function() { var _this = this; _this.current_consent = []; var current_storage = document.cookie.split(';'); for (var i = 0; i < current_storage.length; i++) { if (current_storage[i].indexOf(domain + '_c_b_') !== -1) { _this.current_consent.push(current_storage[i]) } } }, _show_consent_banner: function() { var _this = this; _this._prefill_checkboxes(); _this.$consent_banner.classList.remove('hideme'); _this.$body.classList.add('cb_visible'); }, _prefill_checkboxes: function() { var _this = this; for (var i = 0; i < _this.current_consent.length; i++) { var current_id = _this.current_consent[i].split(domain + '_c_b_')[1].split('=')[0]; _this.$consent_banner.querySelector('#' + current_id).checked = true; } }, _hide_consent_banner: function() { var _this = this; _this.$consent_banner.classList.add('hideme'); _this.$body.classList.remove('cb_visible'); }, _set_consent_per_checkbox: function(checkboxes) { var _this = this; for (var i = 0; i < checkboxes.length; i++) { document.cookie = domain + '_c_b_' + checkboxes[i].id + '=' + _this.expire_period + ';expires=' + _this.expire_date + ';domain=.' + _this.hostname + ';path=/'; } document.dispatchEvent(consent_banner_event); }, _unset_consent: function(checkboxes) { var _this = this; var current_storage = document.cookie.split(';'); var hostname = window.location.hostname.substring(window.location.hostname.lastIndexOf('.', window.location.hostname.lastIndexOf('.') - 1) + 1); for (var i = 0; i < current_storage.length; i++) { document.cookie = current_storage[i] + '; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=.' + hostname + '; path=/;'; } } }; var $consent_banner = document.querySelectorAll('.consent_banner_wrapper'); for (var i = 0; i < $consent_banner.length; i++) { new ConsentBanner($consent_banner[i]).init(); } var consent_banner_event = document.createEvent('Event'); consent_banner_event.initEvent('consent_banner_change', true, true); })(document, window); /* Source common/js/scripts/26_seo_highlight_keywords.js */ // SEO: KEYWORDS IN STEUERNEWS ARTIKEL HERVORHEBEN // ------------------------------------------------------------------------------------------------- (function(document) { var SeoHighlightKeywords = function($article) { var _this = this; _this.$article = $article; _this.current_url = document.location.href; _this.previous_url = document.referrer; }; SeoHighlightKeywords.prototype = { init: function() { var _this = this; if (_this.previous_url.indexOf('/thema/') > -1 && _this.current_url.indexOf('/thema/') === -1) { var keyword = _this._get_keyword(), regex = new RegExp('(?![^<]*>)' + '(' + keyword + ')', 'gi'); _this.$article.innerHTML = _this.$article.innerHTML.replace(regex , '$1'); } }, _get_keyword: function() { var _this = this, keywords = _this.previous_url.split('/thema/'); return decodeURIComponent(keywords[1]); } }; var $article = document.getElementById('highlight_keywords'); if ($article) { // has_seo raus, wenn SEO-Baustein new SeoHighlightKeywords($article).init(); } })(document); /* Source common/js/scripts/40_dropdown_menu.js */ // DROPDOWN MENU // ------------------------------------------------------------------------------------------------- (function(document) { var DropdownMenu = function($dropdown_menu) { var _this = this, id = $dropdown_menu.getAttribute('id'); _this.$dropdown_menu = $dropdown_menu; _this.$main_menuitems = $dropdown_menu.querySelectorAll('#' + id + ' > ul > li > a'); _this.$sub_menuitems = $dropdown_menu.querySelectorAll('#' + id + ' > ul > li li > a'); _this.$sub_menuitems_with_sub_sub_menu = $dropdown_menu.querySelectorAll('#' + id + ' > ul > li li > a.has_sub_sub_menu'); _this.$main_menuitems_with_sub_menu = $dropdown_menu.querySelectorAll('#' + id + ' > ul > li > a[aria-controls]'); _this.main_menu_index = 0; _this.event_type = false; _this.$key = { 'tab' : 9, 'enter' : 13, 'escape' : 27, 'space' : 32, 'arrow_left' : 37, 'arrow_up' : 38, 'arrow_right' : 39, 'arrow_down' : 40 }; }; DropdownMenu.prototype = { init: function() { var _this = this; _this._init_accessibility(); _this._init_keyboard(); for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems[i]; i++) { var $li = $main_menuitem.parentElement; $li.addEventListener('mouseenter', _this._on_mouseenter_main_menuitem.bind(_this, $main_menuitem) ); $li.addEventListener('mouseover', _this._on_mouseover_main_menuitem.bind(_this, $main_menuitem) ); $li.addEventListener('mouseout', _this._on_mouseout_main_menuitem.bind(_this) ); $main_menuitem.addEventListener('focus', _this._on_focus_main_menuitem.bind(_this, $main_menuitem) ); } }, _init_accessibility: function() { var _this = this; for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems_with_sub_menu[i]; i++) { $main_menuitem.setAttribute('aria-expanded', 'false'); $main_menuitem.addEventListener('click', function(event) { event.preventDefault(); }); } }, _init_keyboard: function() { var _this = this; for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems[i]; i++) { $main_menuitem.addEventListener('keydown', _this._on_keydown_main_menuitem.bind(_this, $main_menuitem) ); } for (var j = 0, $sub_menuitem; $sub_menuitem = _this.$sub_menuitems[j]; j++) { $sub_menuitem.addEventListener('keydown', _this._on_keydown_sub_menuitem.bind(_this, $sub_menuitem) ); } }, _on_keydown_main_menuitem: function($main_menuitem, event) { var _this = this; _this.event_type = event.type; _this.main_menu_index = _this._get_main_menuitem_index(); _this.$main_menuitem = $main_menuitem; _this.$sub_menu = $main_menuitem.nextElementSibling; switch(event.keyCode) { case _this.$key.tab: if (event.shiftKey) { _this.main_menu_index -= 1; } else { _this.main_menu_index += 1; } break; case _this.$key.enter: if (_this.$sub_menu) { event.preventDefault(); _this._close_sub_menus(); this._open_sub_menu(false); } break; case _this.$key.escape: event.preventDefault(); if (_this.sub_menu_is_open) { event.stopPropagation(); } _this._close_sub_menu(); break; case _this.$key.arrow_left: event.preventDefault(); _this._focus_prev_main_menuitem(); break; case _this.$key.arrow_up: event.preventDefault(); if (_this.sub_menu_is_open) { _this._focus_prev_menuitem(); } break; case _this.$key.arrow_right: event.preventDefault(); _this._focus_next_main_menuitem(); break; case _this.$key.arrow_down: event.preventDefault(); if (_this.$sub_menu) { this._open_sub_menu(false); } else { _this._focus_next_main_menuitem(); } break; } }, _get_main_menuitem_index: function() { var _this = this; return Array.prototype.indexOf.call(_this.$main_menuitems, document.activeElement); }, _focus_prev_menuitem: function() { var _this = this; _this.main_menu_index -= 1; if (_this.main_menu_index < 0) { _this.main_menu_index = 0; return; } _this.$main_menuitem = _this.$main_menuitems[_this.main_menu_index]; _this.$sub_menu = _this.$main_menuitem.nextElementSibling; if (_this.$sub_menu && _this.sub_menu_is_open) { this._open_sub_menu(true); } else { _this.$main_menuitem.focus(); } }, _focus_prev_main_menuitem: function() { var _this = this; _this.main_menu_index -= 1; if (_this.main_menu_index < 0) { _this.main_menu_index = 0; return; } _this.$main_menuitem = _this.$main_menuitems[_this.main_menu_index]; _this.$main_menuitem.focus(); }, _focus_next_main_menuitem: function() { var _this = this; _this.main_menu_index += 1; if (_this.main_menu_index === _this.$main_menuitems.length) { _this.main_menu_index = _this.$main_menuitems.length - 1; return; } _this.$main_menuitem = _this.$main_menuitems[_this.main_menu_index]; _this.$main_menuitem.focus(); }, _on_mouseenter_main_menuitem: function($main_menuitem, event) { var _this = this; _this.event_type = event.type; _this.$main_menuitem = $main_menuitem; _this.$sub_menu = $main_menuitem.nextElementSibling; _this._close_sub_menus(); if (_this.$sub_menu) { _this._open_sub_menu(false); } }, _on_mouseover_main_menuitem: function() { var _this = this; clearTimeout(_this.close_sub_menu_timeout); }, _on_mouseout_main_menuitem: function() { var _this = this; _this.close_sub_menu_timeout = setTimeout(function() { _this._close_sub_menus(); }, 1000); }, _on_focus_main_menuitem: function($main_menuitem, event) { var _this = this; _this.event_type = event.type; if (_this.sub_menu_is_open) { _this.$main_menuitem = $main_menuitem; _this.$sub_menu = $main_menuitem.nextElementSibling; _this._close_sub_menus(); if (_this.$sub_menu) { _this._open_sub_menu(); } } }, _on_keydown_sub_menuitem: function($sub_menuitem, event) { var _this = this; switch(event.keyCode) { case _this.$key.tab: if (event.shiftKey) { _this.sub_menu_index -= 1; } else { _this.sub_menu_index += 1; } break; case _this.$key.escape: event.preventDefault(); event.stopPropagation(); _this._close_sub_menu(); break; case _this.$key.arrow_left: event.preventDefault(); _this.sub_menu_index = 0; _this._focus_prev_sub_menuitem(); break; case _this.$key.arrow_up: event.preventDefault(); _this._focus_prev_sub_menuitem(); break; case _this.$key.arrow_right: event.preventDefault(); _this.sub_menu_index = 0; _this._focus_prev_sub_menuitem(); break; case _this.$key.arrow_down: event.preventDefault(); _this._focus_next_sub_menuitem(); break; } _this._open_sub_sub_menu(); }, _open_sub_sub_menu: function() { var _this = this; $sub_menuitem = _this.$main_menuitem.nextElementSibling.querySelectorAll('li li > a')[_this.sub_menu_index]; if($sub_menuitem) { for (var i = 0, $menuitem; $menuitem = _this.$sub_menuitems[i]; i++) { var is_current_menuitem = $sub_menuitem === $menuitem, $sub_sub_menu = $sub_menuitem.parentNode.querySelector('ul'); is_sub_sub_menuitem = $sub_menuitem.classList.contains('sub_sub_menuitem'); if (is_current_menuitem && $sub_sub_menu) { $menuitem.parentElement.classList.add('hover'); $menuitem.setAttribute('aria-expanded', true); } else if (is_current_menuitem && is_sub_sub_menuitem) { $menuitem.parentElement.parentElement.parentElement.classList.add('hover'); $menuitem.parentElement.parentElement.parentElement.setAttribute('aria-expanded', true); } else { $menuitem.parentElement.classList.remove('hover'); $menuitem.setAttribute('aria-expanded', false); } } } else { _this._close_sub_sub_menus(); } }, _close_sub_sub_menus: function() { var _this = this; for (var i = 0, $sub_menuitem; $sub_menuitem = _this.$sub_menuitems_with_sub_sub_menu[i]; i++) { $sub_menuitem.parentElement.classList.remove('hover'); $sub_menuitem.setAttribute('aria-expanded', 'false'); } }, _focus_prev_sub_menuitem: function() { var _this = this, $sub_menuitems = _this.$main_menuitem.nextElementSibling.querySelectorAll('a'), $sub_menuitem, $main_menuitem; _this.sub_menu_index -= 1; $sub_menuitem = $sub_menuitems[_this.sub_menu_index]; if (_this.sub_menu_index < 0) { $main_menuitem = _this.$main_menuitems[_this.main_menu_index]; if ($main_menuitem) { $main_menuitem.focus(); } } else if ($sub_menuitem) { $sub_menuitem.focus(); } }, _focus_next_sub_menuitem: function() { var _this = this, $sub_menuitems = _this.$main_menuitem.nextElementSibling.querySelectorAll('a'), $sub_menuitem, $main_menuitem; _this.sub_menu_index += 1; $sub_menuitem = $sub_menuitems[_this.sub_menu_index]; if (_this.sub_menu_index === $sub_menuitems.length) { _this.main_menu_index += 1; $main_menuitem = _this.$main_menuitems[_this.main_menu_index]; if ($main_menuitem) { $main_menuitem.focus(); } else { _this.main_menu_index -= 1; _this.sub_menu_index -= 1; } } else { $sub_menuitem.focus(); } }, _open_sub_menu: function(focus_last_sub_menuitem) { var _this = this, $sub_menuitems; for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems_with_sub_menu[i]; i++) { var is_current_menuitem = _this.$main_menuitem === $main_menuitem; if (is_current_menuitem) { $main_menuitem.parentElement.classList.add('hover'); } else { $main_menuitem.parentElement.classList.remove('hover'); } $main_menuitem.setAttribute('aria-expanded', is_current_menuitem); } _this.sub_menu_index = 0; if (_this.event_type === 'keydown') { $sub_menuitems = _this.$sub_menu.querySelectorAll('a'); if (focus_last_sub_menuitem) { _this.sub_menu_index = $sub_menuitems.length - 1; } $sub_menuitems[_this.sub_menu_index].focus(); _this.event_type = false; } _this.sub_menu_is_open = true; }, _close_sub_menu: function() { var _this = this; _this.$main_menuitem.parentElement.classList.remove('hover'); _this.$main_menuitem.setAttribute('aria-expanded', 'false'); _this.sub_menu_is_open = false; _this.$main_menuitem.focus(); }, _close_sub_menus: function() { var _this = this; for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems_with_sub_menu[i]; i++) { $main_menuitem.parentElement.classList.remove('hover'); $main_menuitem.setAttribute('aria-expanded', 'false'); } _this._close_sub_sub_menus(); } }; var $dropdown_menu = document.getElementsByClassName('dropdown_menu'); for (var i = 0, len = $dropdown_menu.length; i < len; i++) { new DropdownMenu($dropdown_menu[i]).init(); } })(document); /* Source common/js/scripts/45_offcanvas_menu.js */ // OFFCANVAS MENU // ------------------------------------------------------------------------------------------------- (function(document) { var OffCanvasMenu = function($toggle_offcanvas_menu) { var _this = this, controls; controls = $toggle_offcanvas_menu.querySelector('.open_offcanvas_menu').getAttribute('aria-controls'); _this.$offcanvas_menu = document.getElementById(controls); _this.$main_menuitems_with_sub_menu = _this.$offcanvas_menu.querySelectorAll('a[aria-controls]'); _this.$focus_elements = _this.$offcanvas_menu.querySelectorAll('a'); _this.focus_element = false; _this.$offcanvas_menu_state = false; _this.$key = { 'tab' : 9, }; }; OffCanvasMenu.prototype = { init: function() { var _this = this; _this._init_accessibility(); _this._init_keyboard(); for (var j = 0, $main_menuitem_with_sub_menu; $main_menuitem_with_sub_menu = _this.$main_menuitems_with_sub_menu[j]; j++) { $main_menuitem_with_sub_menu.addEventListener('click', _this._on_click_main_menuitem.bind(_this, $main_menuitem_with_sub_menu) ); } }, _init_accessibility: function() { var _this = this; for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems_with_sub_menu[i]; i++) { $main_menuitem.setAttribute('aria-expanded', $main_menuitem.classList.contains('active')); } }, _init_keyboard: function() { var _this = this; document.addEventListener('keydown', function(event) { if (!_this.$offcanvas_menu_state.checked) { return; } if (event.keyCode === _this.$key.tab) { event.preventDefault(); if (event.shiftKey) { _this._focus_element_with_shift_tab_key(event); } else { _this._focus_element_with_tab_key(event); } } }); }, _focus_element_with_shift_tab_key: function() { var _this = this; _this.tab_index -= 1; if (_this.tab_index < 0) { _this.tab_index = _this.$focus_elements.length - 1; } for (var i = _this.tab_index, $focus_element; $focus_element = _this.$focus_elements[i]; i--) { if ($focus_element.offsetParent === null || $focus_element.offsetWidth === 0) { _this.tab_index -= 1; continue; } _this.$focus_elements[_this.tab_index].focus(); break; } }, _focus_element_with_tab_key: function() { var _this = this; if (_this.tab_index === _this.$focus_elements.length - 1) { _this.tab_index = 0; } else { _this.tab_index += 1; } for (var i = _this.tab_index, $focus_element; $focus_element = _this.$focus_elements[i]; i++) { if ($focus_element.offsetParent === null || $focus_element.offsetWidth === 0) { _this.tab_index += 1; if (_this.tab_index > _this.$focus_elements.length - 1) { _this.tab_index = 0; } else { continue; } } _this.$focus_elements[_this.tab_index].focus(); break; } }, _on_click_main_menuitem: function($main_menuitem, event) { var _this = this; event.preventDefault(); _this.$main_menuitem = $main_menuitem; _this._toggle_sub_menus(); }, _toggle_sub_menus: function() { var _this = this; for (var i = 0, $main_menuitem; $main_menuitem = _this.$main_menuitems_with_sub_menu[i]; i++) { var is_active_menuitem = _this.$main_menuitem === $main_menuitem, $parent_menuitems = _this._get_parent_menu_elements(); if (is_active_menuitem) { _this.sub_menu_is_open = $main_menuitem.getAttribute('aria-expanded') === 'false'; $main_menuitem.parentElement.classList.toggle('expanded', _this.sub_menu_is_open); $main_menuitem.setAttribute('aria-expanded', _this.sub_menu_is_open); } else if ($parent_menuitems.indexOf($main_menuitem) !== -1) { // Check parents $main_menuitem.parentElement.classList.toggle('expanded', 'true'); $main_menuitem.setAttribute('aria-expanded', 'true'); } else { $main_menuitem.parentElement.classList.remove('expanded'); $main_menuitem.setAttribute('aria-expanded', 'false'); } } }, _get_parent_menu_elements: function() { var _this = this.$main_menuitem, $findings = []; while (_this.parentNode) { _this = _this.parentNode; if (_this.nodeName.toLowerCase() === 'li') { $findings.push(_this.querySelector('a')); } } return $findings || False; } }; var OffCanvasMenuOpener = function($toggle_offcanvas_menu) { var _this = this; var controls = $toggle_offcanvas_menu.querySelector('.open_offcanvas_menu').getAttribute('aria-controls'); _this.$toggle_offcanvas_menu = $toggle_offcanvas_menu.querySelector('label'); _this.$open_offcanvas_menu = $toggle_offcanvas_menu.querySelector('.open_offcanvas_menu'); _this.$close_offcanvas_menu = $toggle_offcanvas_menu.querySelector('.close_offcanvas_menu'); _this.$offcanvas_menu_state = document.querySelector('#' + _this.$toggle_offcanvas_menu.getAttribute('for')); _this.$offcanvas_menu = document.getElementById(controls); _this.$focus_elements = _this.$offcanvas_menu.querySelectorAll('a'); _this.$key = { 'enter' : 13, 'escape' : 27, 'space' : 32 }; }; OffCanvasMenuOpener.prototype = { init: function() { var _this = this; _this._init_keyboard(); _this.$toggle_offcanvas_menu.addEventListener('click', _this._toggle_menu.bind(_this)); _this.$open_offcanvas_menu.addEventListener('click', _this._open_menu.bind(_this)); _this.$close_offcanvas_menu.addEventListener('click', _this._close_menu.bind(_this)); _this.$offcanvas_menu.addEventListener('transitionend', function(event) { // var _this = this; if (event.target !== this) { return; } if (_this.$offcanvas_menu_state.checked) { if (_this.focus_element) { _this.focus_element = false; _this.$focus_elements[0].focus(); } } else if (_this.focus_element) { _this.focus_element = false; _this.$open_offcanvas_menu.focus(); } }); }, _init_keyboard: function() { var _this = this; _this.$open_offcanvas_menu.addEventListener('keydown', function(event) { if (event.keyCode === _this.$key.space || event.keyCode === _this.$key.enter) { _this.focus_element = true; } if (event.keyCode === _this.$key.space) { event.preventDefault(); } }); _this.$close_offcanvas_menu.addEventListener('keydown', function(event) { if (event.keyCode === _this.$key.space) { event.preventDefault(); } }); document.addEventListener('keydown', function(event) { if (!_this.$offcanvas_menu_state.checked) { return; } if (event.keyCode === _this.$key.escape) { _this.focus_element = true; _this._close_menu(event); } }); }, _scroll_to_top: function() { var _this = this; setTimeout(function() { var duration = 300, interval; interval = setInterval(function() { var diff = -window.pageYOffset, step = diff / duration * 10; if (Math.abs(diff) <= Math.abs(step)) { if (_this.$anchor) { _this.$anchor.focus(); } clearInterval(interval); } window.scrollBy(0, step); duration -= 10; }, 10); }, 300); }, _toggle_menu: function(event) { var _this = this; if (_this.$offcanvas_menu_state.checked) { _this._close_menu(event); } else { _this._open_menu(event); } }, _open_menu: function(event) { var _this = this; event.preventDefault(); _this.$offcanvas_menu_state.checked = true; _this.tab_index = 0; // _this._scroll_to_top(); }, _close_menu: function(event) { var _this = this; event.preventDefault(); _this.$offcanvas_menu_state.checked = false; _this.tab_index = 0; } }; var $offcanvas_menu = document.getElementsByClassName('toggle_offcanvas_menu'); if ($offcanvas_menu.length) { new OffCanvasMenu($offcanvas_menu[0]).init(); // init once // create an opener for each button for (var i = 0, len = $offcanvas_menu.length; i < len; i++) { new OffCanvasMenuOpener($offcanvas_menu[i]).init(); } } })(document); /* Source common/js/scripts/70_form_search_datalist.js */ // FORMULARE: SUCHBEGRIFF-VORSCHLÄGE FÜR DIE SUCHE // Wird gebraucht in: steuernews_search, search // ------------------------------------------------------------------------------------------------- (function(document) { var FormSearchDataList = function($form) { var _this = this; _this.$form = $form; _this.$search = $form.querySelector('input[type="search"]'); _this.$submit = $form.querySelector('button[type="submit"]'); _this.datalist = $form.getAttribute('data-datalist'); _this.list = _this.$search.getAttribute('list'); _this.datalist_loaded = false; _this.datalist_inserted = false; }; FormSearchDataList.prototype = { init: function() { var _this = this; _this.$form.addEventListener('submit', _this._submit.bind(this)); _this.$search.addEventListener('focus', _this._focus.bind(this)); _this._init_keyboard(); _this._get_datalist(); }, _init_keyboard: function() { var _this = this, $key = { 'enter' : 13 }; _this.$search.addEventListener('keyup', function(event) { if (event.keyCode !== $key.enter) { return; } var url = _this._get_url(); if (url) { location.href = url; } }); }, _get_datalist: function() { var _this = this, $datalist = sessionStorage.getItem(domain + '_datalist_search'), $ajax, $options; if (!_this.datalist) { return; } if ($datalist) { $options = _this._get_sorted_datalist($datalist); _this._create_datalist($options); } else { $ajax = new XMLHttpRequest(); $ajax.open('GET', _this.datalist, true); $ajax.onload = function() { if (this.status === 200) { sessionStorage.setItem(domain + '_datalist_search', this.responseText); $options = _this._get_sorted_datalist(this.responseText); _this._create_datalist($options); } }; $ajax.send(); } }, _get_sorted_datalist: function($datalist) { var $options = JSON.parse($datalist); $options = $options.sort(function($a, $b) { var a_value = $a.value.toLowerCase(), b_value = $b.value.toLowerCase(); if (a_value < b_value) { return -1; } if (b_value < a_value) { return 1; } }); return $options; }, _create_datalist: function($options) { var _this = this, $datalist = document.createDocumentFragment(), $datalist_entry; for (var i = 0, $option; $option = $options[i]; i++) { $datalist_entry = document.createElement('option'); if ($option.url) { $datalist_entry.setAttribute('data-url', $option.url); } if ($option.label && /Chrome\b/.test(navigator.userAgent)) { if (!(/Edge\b/.test(navigator.userAgent))) { $datalist_entry.setAttribute('label', $option.label); } } $datalist_entry.setAttribute('data-value', $option.value.toLowerCase()); $datalist_entry.textContent = $option.value; $datalist.appendChild($datalist_entry); } _this.$datalist = $datalist; }, _focus: function() { var _this = this; if (_this.$datalist && !_this.datalist_inserted) { document.querySelector('#' + _this.list).appendChild(_this.$datalist); _this.datalist_inserted = true; _this.$submit.removeAttribute('disabled'); } }, _get_url: function() { var _this = this, value = _this.$search.value.toLowerCase(), $option = document.querySelector('#' + _this.list + ' option[data-value="' + value + '"]'); return $option ? $option.getAttribute('data-url') : ''; }, _submit: function(event) { var _this = this, url = _this._get_url(); if (url) { event.preventDefault(); location.href = url; } } }; var $forms = document.querySelectorAll('[data-form*="datalist"]'); for (var i = 0, $form; $form = $forms[i]; i++) { new FormSearchDataList($form).init(); } })(document); /* Source common/js/scripts/71_form_search.js */ // SUCHE // Wird gebraucht in: steuernews_search, suche // ------------------------------------------------------------------------------------------------- (function(document) { var FormSearch = function($search) { var _this = this; _this.$search = $search; _this.$input_search = $search.querySelector('input[type="search"]'); _this.$button = $search.querySelector('button[type="submit"]'); }; FormSearch.prototype = { init: function() { var _this = this; _this.$button.setAttribute('disabled', 'disabled'); _this.$input_search.addEventListener('input', _this._on_input.bind(_this)); }, _on_input: function() { var _this = this; if (_this.$input_search.value.length > 0) { _this.$button.removeAttribute('disabled'); } else { _this.$button.setAttribute('disabled', 'disabled'); } } }; var $search = document.querySelectorAll('[role="search"]'); if ($search.length) { for (var i = 0, len = $search.length; i < len; i++) { new FormSearch($search[i]).init(); } } })(document); /* Source common/js/scripts/72_form_search_box.js */ // SUCHE (BOX) // ------------------------------------------------------------------------------------------------- (function(document) { var FormSearchBox = function($toggle_search_box) { var _this = this, controls; _this.$toggle_search_box = $toggle_search_box.querySelector('label'); _this.$open_search_box = $toggle_search_box.querySelector('.open_search_box'); _this.$close_search_box_1 = $toggle_search_box.querySelector('.close_search_box'); _this.$search_box_state = document.querySelector('#' + _this.$toggle_search_box.getAttribute('for')); controls = _this.$open_search_box.getAttribute('aria-controls'); _this.$search_box = document.getElementById(controls); _this.$input_search = _this.$search_box.querySelector('input[type="search"]'); _this.$search_button = _this.$search_box.querySelector('button[type="submit"]'); _this.$close_search_box_2 = _this.$search_box.querySelector('.close_search_box'); _this.$focus_elements = _this.$search_box.querySelectorAll('input[type="search"], button[type="submit"], .close_search_box'); _this.$key = { 'escape' : 27, 'space' : 32, 'tab' : 9 }; }; FormSearchBox.prototype = { init: function() { var _this = this; _this.$toggle_search_box.addEventListener('click', _this._toggle.bind(_this)); _this.$open_search_box.addEventListener('click', _this._open.bind(_this)); _this.$close_search_box_1.addEventListener('click', _this._close.bind(_this)); _this.$close_search_box_2.addEventListener('click', _this._close.bind(_this)); _this.$search_box.addEventListener('transitionend', function(event) { if (event.target !== this) { return; } if (_this.$search_box_state.checked) { _this.$input_search.focus(); } }); _this._init_keyboard(); }, _init_keyboard: function() { var _this = this; _this.$open_search_box.addEventListener('keydown', function(event) { if (event.keyCode === _this.$key.space) { event.preventDefault(); } }); _this.$close_search_box_1.addEventListener('keydown', function(event) { if (event.keyCode === _this.$key.space) { event.preventDefault(); } }); _this.$close_search_box_2.addEventListener('keydown', function(event) { if (event.keyCode === _this.$key.space) { event.preventDefault(); } }); document.addEventListener('keydown', function(event) { if (!_this.$search_box_state.checked) { return; } switch(event.keyCode) { case _this.$key.escape: _this._close(event); break; case _this.$key.tab: event.preventDefault(); if (event.shiftKey) { _this._focus_element_with_shift_tab_key(event); } else { _this._focus_element_with_tab_key(event); } break; } }); }, _focus_element_with_shift_tab_key: function() { var _this = this; _this.tab_index -= 1; if (_this.$search_button === _this.$focus_elements[_this.tab_index] && _this.$search_button.getAttribute('disabled') === 'disabled') { _this.tab_index -= 1; } if (_this.tab_index < 0) { _this.tab_index = _this.$focus_elements.length - 1; } _this.$focus_elements[_this.tab_index].focus(); }, _focus_element_with_tab_key: function() { var _this = this; if (_this.tab_index === _this.$focus_elements.length - 1) { _this.tab_index = 0; } else { _this.tab_index += 1; } if (_this.$search_button === _this.$focus_elements[_this.tab_index] && _this.$search_button.getAttribute('disabled') === 'disabled') { _this.tab_index += 1; } _this.$focus_elements[_this.tab_index].focus(); }, _toggle: function(event) { var _this = this; if (_this.$search_box_state.checked) { _this._close(event); } else { _this._open(event); } }, _open: function(event) { var _this = this; event.preventDefault(); _this.$search_box_state.checked = true; _this.tab_index = 0; }, _close: function(event) { var _this = this; event.preventDefault(); _this.$search_box_state.checked = false; _this.$open_search_box.focus(); _this.tab_index = 0; if (event.type === 'click') { _this.$open_search_box.setAttribute('data-focus-method', 'mouse'); } } }; var $toggle_search_box = document.getElementsByClassName('toggle_search_box'); for (var i = 0, len = $toggle_search_box.length; i < len; i++) { new FormSearchBox($toggle_search_box[i]).init(); } })(document); /* Source common/js/scripts/73_seo_steuernews_issues_select.js */ // STEUERNEWS SEO - ALLE AUSGABEN // ------------------------------------------------------------------------------------------------- (function(document) { var SteuernewsIssues = function(issues_select) { var _this = this; _this.$issues_select = issues_select; _this.$select = issues_select.querySelector('select'); _this.$button = issues_select.querySelector('.button'); _this.$active_option = _this.$select.querySelector('option:checked'); }; SteuernewsIssues.prototype = { init: function() { var _this = this; _this.$select.addEventListener('change', function() { this.querySelectorAll('option')[this.selectedIndex]; href = this.querySelectorAll('option')[this.selectedIndex].value; _this.$button.href = href; }); }, }; var $steuernews_issues_select = document.querySelectorAll('.steuernews_issues_select'); for (var i = 0; i < $steuernews_issues_select.length; i++) { new SteuernewsIssues($steuernews_issues_select[i]).init(); } })(document); /* Source common/js/scripts/77_slider.js */ // SLIDER // ------------------------------------------------------------------------------------------------ (function(document, window) { var Slider = function($slider) { this.$slider = $slider; this.$slides = this.$slider.querySelectorAll('.slide'); this.active_index = 0; this.$navigation = this.$slider.querySelector('.navigation'); this.$navigation_next = this.$slider.querySelector('.navigation .next'); this.$navigation_prev = this.$slider.querySelector('.navigation .prev'); this.$pagination = this.$slider.querySelectorAll('.pagination > a'); this.auto_slide = this.$slider.className.match(/(\auto_slide\S*)/g); this.timeout = parseInt(this.auto_slide && this.auto_slide[0].split('auto_slide_')[1] || 4000); this.auto_stop = this.$slider.className.match(/(\auto_stop)/g); this.run = true; }; Slider.prototype = { init: function() { var _this = this; if (_this.auto_slide) { _this._auto_slide(); } if (_this.auto_stop) { _this._auto_stop(); } if (_this.$navigation) { _this._init_navigation(); } if (_this.$pagination.length) { _this._init_pagination(); } _this._update_slides(0); _this._init_slides_animation(); _this._init_accessibility(); }, next: function() { this.active_index = this._get_index(this.$slides, this.active_index + 1); this._update_slides(); this._set_slides_animation(); }, prev: function() { this.active_index = this._get_index(this.$slides, this.active_index - 1); this._update_slides(); this._set_slides_animation(); }, _init_slides_animation: function() { var _this = this; for (var i = 0; i < _this.$slides.length; i++) { _this.$slides[i].addEventListener('transitionend', function() { _this.$slides = _this._remove_all_classes(_this.$slides, 'animated'); }); _this.$slides[i].addEventListener('animationend', function() { _this.$slides = _this._remove_all_classes(_this.$slides, 'animated'); }); } }, _init_navigation: function() { var _this = this; _this.$navigation_next.addEventListener('click', function(event) { event.preventDefault(); _this.next(); }); _this.$navigation_prev.addEventListener('click', function(event) { event.preventDefault(); _this.prev(); }); }, _init_accessibility: function() { var _this = this; _this.$slider.addEventListener('click', function(event) { this.is_keyboard = false; }, true); _this.$slider.addEventListener('keydown', function(event) { this.is_keyboard = true; }, true); _this.$slider.addEventListener('focusin', function(event) { slide = event.target.closest('.slide'); if (slide && this.is_keyboard) { _this.active_index = parseInt(slide.getAttribute('data-index')); _this._update_slides(); _this._set_slides_animation(); _this.$slider.querySelector('.slides').scrollLeft = 0; this.is_keyboard = false; } }, true); }, _init_pagination: function() { var _this = this; for (var i = 0; i < _this.$pagination.length; i++) { _this.$pagination[i].addEventListener('click', function(event) { event.preventDefault(); _this.active_index = parseInt(this.getAttribute('data-index')); _this._update_slides(); _this._set_slides_animation(); }); } }, _auto_slide: function() { var _this = this; setInterval(function() { if (_this.run) { _this.next(); } }, _this.timeout); }, _auto_stop: function() { var _this = this; this.$slider.addEventListener('mousemove', function() { _this.run = false; }); this.$slider.addEventListener('mouseleave', function() { _this.run = true; }); }, _update_slides: function() { this._set_active_slide(); this._set_slides_position(); this._set_slides_visibility(); if (this.$pagination.length) { this._update_pagination(); } }, _update_pagination: function() { var index = this._get_index(this.$pagination, this.active_index); this.$pagination = this._remove_all_classes(this.$pagination, 'active'); this.$pagination[index].classList.add('active'); }, _remove_all_classes: function(elements, class_name) { for (var i = 0; i < elements.length; i++) { elements[i].classList.remove(class_name); } return elements; }, _get_index: function(element, number) { var _this = this; if (number >= (element.length * 2)) { number = number - (element.length * 2); } if (number >= element.length) { number = number - element.length; } if (number < 0) { number = number + element.length; } return number; }, _set_slides_animation: function() { var slide_length_third = this.$slides.length / 3; this.$slides = this._remove_all_classes(this.$slides, 'animated'); for (var i = -1; i <= slide_length_third; i++) { var index = this._get_index(this.$slides, this.active_index + i); this.$slides[index].classList.add('animated'); } }, _set_active_slide: function() { var index = this._get_index(this.$slides, this.active_index); this.$slides = this._remove_all_classes(this.$slides, 'active'); this.$slides[index].classList.add('active'); }, _set_slides_position: function() { var slide_length_half = Math.floor(this.$slides.length / 2); for (var i = -slide_length_half - 1; i <= slide_length_half; i++) { var index = this._get_index(this.$slides, this.active_index + i); this.$slides[index].setAttribute('data-position', i * 100); } }, _set_slides_visibility: function() { var slide_length_third = this.$slides.length / 3; this.$slides = this._remove_all_classes(this.$slides, 'visible'); for (var i = -1; i <= slide_length_third; i++) { var index = this._get_index(this.$slides, this.active_index + i); this.$slides[index].classList.add('visible'); } } }; var $slider = document.querySelectorAll(['.slider']); for (var i = 0; i < $slider.length; i++) { new Slider($slider[i]).init(); } })(document, window); /* Source common/js/scripts/86_infolists_add_tabindex.js */ // INFOLISTEN: Tabindex zu infolist_text hinzufügen, wenn dies innerhalb eines text_containers ist // ------------------------------------------------------------------------------------------------- (function() { var $infolist_texts = document.querySelectorAll('.infolist_text'); for (var i = 0, len = $infolist_texts.length; i < len; i++) { var parent = $infolist_texts[i].parentNode; if (parent && parent.classList.contains("infolist_text_container")) { $infolist_texts[i].tabIndex = 0; } } }()); /* Source common/js/scripts/87_social_media_share_popup.js */ // INFOLISTEN: WEITERE WERTE // Wird verwendet für Wichtige Beträge (show_more_content) // ------------------------------------------------------------------------------------------------- (function(window) { var $share_button = document.querySelectorAll('.share_button'); for (var i = 0, len = $share_button.length; i < len; i++) { $share_button[i].addEventListener('click', function(event) { event.preventDefault(); var _this = this, href = _this.getAttribute('href'); window.open(href,'Inhalt teilen','height=450, width=550, top=' + (window.innerHeight / 2 - 275) + ', left=' + (window.innerWidth / 2 - 225) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0'); }); } }(window)); /* Source common/js/scripts/90_vcard.js */ // VCARD SWITCHER FÜR DESKTOP/MOBIL // Wird verwendet für: team_overview, team_entry, address_vcard_button, steuernews_contact_person // ------------------------------------------------------------------------------------------------- (function(document) { if (device.mobile || device.tablet) { return; } var $vcards = document.querySelectorAll('[data-vcard-href]'); for (var i = 0, len = $vcards.length; i < len; i++) { var $vcard = $vcards[i], href = $vcard.getAttribute('data-vcard-href'); if (href) { $vcard.setAttribute('href', href); $vcard.removeAttribute('data-vcard-href'); } } }(document)); /* Source common/js/scripts/94_slider.js */ // SLIDER HORIZONTAL // Wird verwendet für: steuernews_article_slider // ------------------------------------------------------------------------------------------------- (function(document) { var Slider = function($slider) { var _this = this; _this.$slider_wrapper = $slider; _this.$slider = $slider.querySelector('.slider'); _this.$slides = $slider.querySelectorAll('.slide'); _this.$prev = $slider.querySelector('.prev_slide'); _this.$next = $slider.querySelector('.next_slide'); _this.index = 0; _this.time = 4000; _this.intervall; _this.touch_start_x; // Stoppen wenn Maus über Objekt ist _this.stop_on_hover = false; }; Slider.prototype = { init: function() { var _this = this; _this._init_mouse(); _this._init_touch(); if (_this.stop_on_hover) { _this.$slider.addEventListener('mouseover', function() { clearInterval(_this.intervall); }); _this.$slider.addEventListener('mouseout', function() { _this.intervall = setInterval(_this._next_slide.bind(_this), _this.time); }); } // Im Skript vergeben, wenn kein javascript aktiviert ist soll Button ausgeblendet sein _this.$next.classList.add('show'); _this.intervall = setInterval(_this._next_slide.bind(_this), _this.time); window.addEventListener('resize', function() { _this._set_height(); }); window.addEventListener('load', function() { _this._set_height(); }); }, _init_mouse: function() { var _this = this; _this.$prev.addEventListener('click', function(event) { event.preventDefault(); event.stopPropagation(); _this._prev_slide(); }); _this.$next.addEventListener('click', function(event) { event.preventDefault(); event.stopPropagation(); _this._next_slide(); }); }, _init_touch: function() { var _this = this _this.$slider.addEventListener('touchstart', function(event) { clearInterval(_this.intervall); _this.touch_start_x = event.changedTouches[0].pageX; }); _this.$slider.addEventListener('touchmove', function(event) { var touch = event.touches[0] || event.changedTouches[0], touch_x = touch.pageX; if ((touch_x - _this.touch_start_x > 50) || (touch_x - _this.touch_start_x < -50)) { event.preventDefault(); } }); _this.$slider.addEventListener('touchend', function(event) { var touch = event.touches[0] || event.changedTouches[0], touch_x = touch.pageX; if (touch_x - _this.touch_start_x > 50) { if (_this.index > 0) { _this._prev_slide(); } else { _this.intervall = setInterval(_this._next_slide.bind(_this), _this.time); } } else if (touch_x - _this.touch_start_x < -50) { if (_this.index < _this.$slides.length - 1) { _this._next_slide(); } else { _this.intervall = setInterval(_this._next_slide.bind(_this), _this.time); } } }); }, _prev_slide: function() { var _this = this; _this.index--; if (_this.index < 0) { _this.index = _this.$slides.length - 1; } _this._slide(); }, _next_slide: function() { var _this = this; _this.index++; if (_this.index >= _this.$slides.length) { _this.index = 0; } _this._slide(); }, _slide: function() { var _this = this, value = 'translate(-' + _this.index * 100 / _this.$slides.length + '%)'; clearInterval(_this.intervall); _this.$slider.style.transform = value; _this.$slider.style.WebkitTransform = value; _this.$slider.style.msTransform = value; _this.intervall = setInterval(_this._next_slide.bind(_this), _this.time); _this._manage_control(); }, _manage_control: function() { var _this = this; if (_this.index >= 0 && _this.index < _this.$slides.length - 1) { _this.$next.classList.add('show'); } else { _this.$next.classList.remove('show'); } if (_this.index > 0 && _this.index < _this.$slides.length) { _this.$prev.classList.add('show'); } else { _this.$prev.classList.remove('show'); } }, _set_height: function() { var _this = this, highest = 0, height = 0; // reset height _this.$slider_wrapper.style.height = 'auto'; _this.$slider.style.height = 'auto'; for (var i = 0; i < _this.$slides.length; i++) { height = _this.$slides[i].clientHeight; if (height > highest) { highest = height; } } height = height + 10; _this.$slider_wrapper.style.height = highest + 'px'; _this.$slider.style.height = highest + 'px'; } }; var $sliders = document.querySelectorAll('.steuernews_article_slider'); for (var i = 0, len = $sliders.length; i < len; i++) { new Slider($sliders[i]).init(); } })(document); /* Source common/js/scripts/96_open_street_map.js */ // OPEN STREET MAPS // ------------------------------------------------------------------------------------------------- (function(window) { var OpenStreetMap = function(id, locations, additional_markers, options) { this.id = id; this.locations = locations; this.additional_markers = additional_markers; this.options = options; this.$map_id = document.querySelector('#open_street_map_' + this.id); this.$layer_additional_markers = []; this.window_width = window.innerWidth; this.$selected_location; this.$map; }; OpenStreetMap.prototype = { init: function() { var _this = this; this._init_map(); this._init_locations_markers(); this._init_additional_markers(); this._init_plan_route(); window.addEventListener('resize', function() { // Manche mobilen Geräte lösen beim vertikalen Scrollen ein resize-Event aus, da die Browserleiste ein-/ausgeblendet wird if (_this.window_width !== window.innerWidth) { _this.window_width = window.innerWidth; _this._center_map(); } }); }, // OpenStreetMap Karte initialisieren _init_map: function() { var _this = this; $view = new ol.View({ center: ol.proj.fromLonLat([this.options.center_lng, this.options.center_lat]), zoom: this.options.zoom, minZoom: this.options.min_zoom, maxZoom: this.options.max_zoom, enableRotation: false }); var url = '/maps/tile/{z}/{x}/{y}.png'; // Anderer Tiles Server für die Verwendung auf der Beta if (window.location.hostname === 'beta.atikon.io') { url = 'https://maps.atikon.com/maps/tile/{z}/{x}/{y}.png'; } var tile = new ol.layer.Tile({ source: new ol.source.OSM({ url: url }) }); this.$map = new ol.Map({ // Auf iOS-Geräten soll das Srollen in der Karte nur mit zwei Fingern möglich sein. iOS benötigt ein eigenes Handling. Nur im Konstruktor der Map funktioniert dieser Event-Listener in Kombination mit DragPan flüssig. Bei Chrome greift ein CSS Regel. interactions: ol.interaction.defaults({ dragPan: false, // Lösche die DragPan Standard Funktion mouseWheelZoom: false // Kein Zoomen beim Betätigen des Mausrads }).extend([new ol.interaction.DragPan({ // Fügt eine eigene abgeleitete Drag Funktion ein und erweitere die Standardfunktionen um diese condition: function(event) { // Wenn iOS: return regelt das Aktivieren der Drag-Funktion if (document.querySelector('html').classList.contains('ios')) { // Chrome hat momentan ein Pointer-Event und kein Touch-Event wie iOS if (event.originalEvent.touches) { var $map_overlay = _this.$map_id.querySelector('.map_overlay'); if (event.originalEvent.touches.length > 1) { $map_overlay.classList.remove('show'); } else { // Blende eine Bedienwarnung "zwei Finger zum Verschieben" ein $map_overlay.classList.add('show'); setTimeout(function() { $map_overlay.classList.remove('show'); }, 1000); return false; } } } return true; } })]), target: 'map_' + this.id, layers: [tile], loadTilesWhileAnimating: true, view: $view }); // Soll Karte nach Graustufen konvertiert werden? if (this.options.grayscale) { tile.on('postcompose', function(event) { var imageData = _this._convert_map_to_greyscale(event.context) event.context.putImageData(imageData, 0, 0); }); } this._setup_zoom_buttons(); }, // Zoom Buttons als inaktiv kennzeichnen _setup_zoom_buttons: function() { var _this = this, $zoom_in_button = this.$map_id.querySelector('.ol-zoom-in'), $zoom_out_button = this.$map_id.querySelector('.ol-zoom-out'), $view = this.$map.getView(); if ($view.getZoom() >= this.options.max_zoom) { $zoom_in_button.classList.add('disabled'); } if ($view.getZoom() <= this.options.min_zoom) { $zoom_out_button.classList.add('disabled'); } $view.on('change:resolution', function() { if ($view.getZoom() >= _this.options.max_zoom) { $zoom_in_button.classList.add('disabled'); } else { $zoom_in_button.classList.remove('disabled'); } if ($view.getZoom() <= _this.options.min_zoom) { $zoom_out_button.classList.add('disabled'); } else { $zoom_out_button.classList.remove('disabled'); } }); }, // Karte nach Graustufen konvertieren _convert_map_to_greyscale: function(context) { var imageData = context.getImageData(0, 0, context.canvas.width, context.canvas.height), data = imageData.data; for (i = 0; i < data.length; i = i + 4) { var red = data[i], green = data[i + 1], blue = data[i + 2], alpha = data[i + 3]; var average = (red + green + blue) / 3; // Beim Laden der Karte die Transparenz auf Null setzen if (average === 0) { alpha = 0; } else { alpha = 255; } data[i] = average; // Rot data[i + 1] = average; // Grün data[i + 2] = average; // Blau data[i + 3] = alpha; // Alpha } return imageData; }, // Marker für Standort positionieren _init_locations_markers: function() { for (var i = 0; i < this.locations.length; i++) { $marker = this._add_marker( this.locations[i].lng, this.locations[i].lat, this.locations[i].marker ); this.$map.addLayer($marker); $marker.setZIndex(10); } if (this.locations.length === 1) { this.$selected_location = this.locations[0]; } this._center_map(); }, // Zusätzlich Marker positionieren _init_additional_markers: function() { for (var i = 0; i < this.additional_markers.length; i++) { $marker = this._add_marker( this.additional_markers[i].lng, this.additional_markers[i].lat, this.additional_markers[i].marker ); this.$layer_additional_markers.push($marker); this.$map.addLayer($marker); $marker.setZIndex(8); $marker.setVisible(false); } if (this.additional_markers.length > 0) { this._manage_additional_markers_visibility(); var _this = this; this.$map.getView().on('propertychange', function(event) { if (event.key === 'resolution') { _this._manage_additional_markers_visibility(); } }); } }, // Zusätzlich Marker Sichtbarkeit anhand der Zoomstufe regulieren _manage_additional_markers_visibility: function() { for (var i = 0; i < this.additional_markers.length; i++) { if (this.$map.getView().getZoom() >= this.additional_markers[i].min_zoom_visible) { this.$layer_additional_markers[i].setVisible(true); } else { this.$layer_additional_markers[i].setVisible(false); } } }, // Routenplanung initialisieren _init_plan_route: function() { var _this = this, $destination_select = this.$map_id.querySelector('select'), $plan_route_form = this.$map_id.querySelector('form'); if ($plan_route_form) { // Mehrere Standorte? if ($destination_select) { $destination_select.addEventListener('change', function() { if (this.options[this.selectedIndex].value !== '') { _this.$selected_location = _this.locations[(this.options[this.selectedIndex].value)]; _this._update_plan_route_form($plan_route_form); } else { // Kein Standort ausgewählt _this.$selected_location = ''; $plan_route_form.action = ''; _this._center_map(); } _this._center_map(); }); } else { _this._update_plan_route_form($plan_route_form); } } }, // Aktion für die Routenplanung via GoogleMaps zusammenbauen _update_plan_route_form: function($form) { var $daddr = this.$map_id.querySelector('[name="daddr"]'); $form.action = 'https://maps.google.de/maps'; $daddr.value = this.$selected_location.postal_code + ' ' + this.$selected_location.locality + ', ' + this.$selected_location.street_address; }, // Standardaktion für das Setzen von Markierungen (Standort und zusätzliche Markierungen) _add_marker: function(lng, lat, marker) { return new ol.layer.Vector({ source: new ol.source.Vector({ features: [new ol.Feature({ geometry: new ol.geom.Point( ol.proj.transform([lng, lat], this.options.dataProjection, this.options.featureProjection )), })] }), // Dient zur Ausrichtung der Markierung style: new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 1], anchorXUnits: 'fraction', anchorYUnits: 'fraction', src: marker['href'], scale: 0.5, maxZoom: 1, }) }) }); }, // Standardaktion zum Zentrieren der Karte _center_map: function() { // Ist eine Zentrierung der Karte gewünscht? if (this.options.center_lng === 0 && this.options.center_lat === 0) { // Gibt es nur einen Standort bzw. ist einer ausgewählt? if (this.locations.length === 1 || this.$selected_location) { this._center_map_point( this.$selected_location.lng, this.$selected_location.lat, this.options.zoom ); } else { // mehrere Standorte anzeigen this._center_map_more_locations(); } } else { this._center_map_point( this.options.center_lng, this.options.center_lat, this.options.center_zoom ); } }, // Karte auf einen Punkt zentrieren _center_map_point: function(lng, lat, zoom) { this.$map.getView().animate({ center: ol.proj.fromLonLat([lng, lat]), duration: 500, zoom: zoom }); }, // Karte neu zentrieren anhand von mehreren Standorten mit einem Sicherheitsabstand _center_map_more_locations: function() { var extent = ol.proj.transformExtent( this._get_locations_bounds(), this.options.dataProjection, this.options.featureProjection ); this.$map.getView().fit(extent, { size: this.$map.getSize(), padding: this._max_marker_padding(), constrainResolution: false, duration: 500 }); }, // Minimale und maximale Grenzen der Standorte als Koordinaten-Array _get_locations_bounds: function() { var lng_min = this.locations[0].lng, lng_max = this.locations[0].lng, lat_min = this.locations[0].lat, lat_max = this.locations[0].lat; for (var i = 1; i < this.locations.length; i++) { if (this.locations[i].lng > lng_max) { lng_max = this.locations[i].lng; } if (this.locations[i].lng < lng_min) { lng_min = this.locations[i].lng; } if (this.locations[i].lat > lat_max) { lat_max = this.locations[i].lat; } if (this.locations[i].lat < lat_min) { lat_min = this.locations[i].lat; } } return [lng_min, lat_min, lng_max, lat_max]; }, // Sicherheitsabstand der Markierungen zum User-Interface und den Kartenrändern _max_marker_padding: function() { var max_height = 0, max_width = 0, default_padding = 30 result = []; for (var i = 0; i < this.locations.length; i++) { if (this.locations[i].marker.width > max_width) { max_width = this.locations[i].marker.width; } if (this.locations[i].marker.height > max_height) { max_height = this.locations[i].marker.height; } } result = [max_height + default_padding, max_width / 2 + default_padding + this.$map_id.querySelector('button').offsetWidth, default_padding, max_width / 2 + default_padding]; return result; } }; // Hole von jeder Karte die vorkommt die Daten und lege ein eigenes JavaScript-Objekt an if (window.$open_street_map_data) { for (var i = 0, len = window.$open_street_map_data.length; i < len; i++) { var id = window.$open_street_map_data[i].id, locations = window.$open_street_map_data[i].locations, additional_markers = window.$open_street_map_data[i].additional_markers, options = window.$open_street_map_data[i].options; new OpenStreetMap(id, locations, additional_markers, options).init(); } } })(window); /* Source common/js/scripts/98_onlinetool_popup.js */ // ONLINETOOL POPUP // Wird verwendet für: download_overview, onlinetools_popup_overview, video_tutorials_overview // ------------------------------------------------------------------------------------------------- (function(document, window) { var OnlinetoolPopup = function($onlinetool) { var _this = this; _this.$onlinetool = $onlinetool; _this.title = $onlinetool.getAttribute('title'); _this.id = '#' + $onlinetool.getAttribute('data-popup-id'); _this.href = $onlinetool.getAttribute('href'); }, $body = document.querySelector('body'), $popup, $content, $close, $iframe; // Private function _create_element(html) { var $div = document.createElement('div'), $filtered_nodes = [], $nodes; $div.innerHTML = html.trim(); $nodes = $div.childNodes; for (var i = 0, len = $nodes.length; $nodes !== null && i < len; i++) { if ($nodes[i].nodeType === 1) { $filtered_nodes.push($nodes[i]); } } return $filtered_nodes; } function _create_popup() { $popup = document.querySelector('.popup_overlay'); $content = $popup.querySelector('.popup_content'); $close = $popup.querySelector('.popup_close'); $iframe = $popup.querySelector('iframe'); $iframe.addEventListener('load', function() { if ($iframe.getAttribute('src') && $iframe.getAttribute('src').length && $popup.classList.contains('show')) { $iframe.classList.add('show'); } }); } function _close_popup() { var _close = function() { $body.classList.remove('no_scroll'); $content.classList.remove('show'); $iframe.classList.remove('show'); window.history.replaceState(null, document.title, window.location.pathname); }; $close.addEventListener('click', function(event) { event.preventDefault(); _close(); }); document.addEventListener('keydown', function(event) { if ($popup.classList.contains('show') && event.which === 27) { _close(); } }); $content.addEventListener('transitionend', function() { if (!$content.classList.contains('show')) { $popup.classList.remove('show'); } }); } _create_popup(); _close_popup(); // Public OnlinetoolPopup.prototype = { init: function() { var _this = this; _this.$onlinetool.addEventListener('click', function(event) { event.preventDefault(); _this.open(); }); }, open: function() { var _this = this; $body.classList.add('no_scroll'); $popup.classList.add('show'); $content.classList.add('show'); $iframe.setAttribute('src', _this.href); window.history.replaceState(null, document.title, _this.id); } }; if (window.device.mobile || window.device.tablet) { return; } var $onlinetools = document.querySelectorAll('[data-popup="true"]'), $onlinetool; for (var i = 0, len = $onlinetools.length; i < len; i++) { $onlinetool = new OnlinetoolPopup($onlinetools[i]); $onlinetool.init(); if ($onlinetool.id === window.location.hash) { $onlinetool.open(); } } })(document, window); /* Source common/js/scripts/9991_stickyfill.js */ /*! * Stickyfill – `position: sticky` polyfill * v. 2.1.0 | https://github.com/wilddeer/stickyfill * MIT License */ /*! MIT License Copyright (c) 2017 Oleg Korsunsky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ "use strict";let seppuku=!1;const isWindowDefined="undefined"!=typeof window;if(isWindowDefined&&window.getComputedStyle){const t=document.createElement("div");["","-webkit-","-moz-","-ms-"].some(e=>{try{t.style.position=e+"sticky"}catch(t){}return""!=t.style.position})&&(seppuku=!0)}else seppuku=!0;let isInitialized=!1;const shadowRootExists="undefined"!=typeof ShadowRoot,scroll={top:null,left:null},stickies=[];function extend(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}function parseNumeric(t){return parseFloat(t)||0}function getDocOffsetTop(t){let e=0;for(;t;)e+=t.offsetTop,t=t.offsetParent;return e}class Sticky{constructor(t){if(!(t instanceof HTMLElement))throw new Error("First argument must be HTMLElement");if(stickies.some(e=>e._node===t))throw new Error("Stickyfill is already applied to this node");this._node=t,this._stickyMode=null,this._active=!1,stickies.push(this),this.refresh()}refresh(){if(seppuku||this._removed)return;this._active&&this._deactivate();const t=this._node,e=getComputedStyle(t),i={position:e.position,top:e.top,display:e.display,marginTop:e.marginTop,marginBottom:e.marginBottom,marginLeft:e.marginLeft,marginRight:e.marginRight,cssFloat:e.cssFloat};if(isNaN(parseFloat(i.top))||"table-cell"==i.display||"none"==i.display)return;this._active=!0;const o=t.style.position;"sticky"!=e.position&&"-webkit-sticky"!=e.position||(t.style.position="static");const s=t.parentNode,n=shadowRootExists&&s instanceof ShadowRoot?s.host:s,r=t.getBoundingClientRect(),l=n.getBoundingClientRect(),f=getComputedStyle(n);this._parent={node:n,styles:{position:n.style.position},offsetHeight:n.offsetHeight},this._offsetToWindow={left:r.left,right:document.documentElement.clientWidth-r.right},this._offsetToParent={top:r.top-l.top-parseNumeric(f.borderTopWidth),left:r.left-l.left-parseNumeric(f.borderLeftWidth),right:-r.right+l.right-parseNumeric(f.borderRightWidth)},this._styles={position:o,top:t.style.top,bottom:t.style.bottom,left:t.style.left,right:t.style.right,width:t.style.width,marginTop:t.style.marginTop,marginLeft:t.style.marginLeft,marginRight:t.style.marginRight};const d=parseNumeric(i.top);this._limits={start:r.top+window.pageYOffset-d,end:l.top+window.pageYOffset+n.offsetHeight-parseNumeric(f.borderBottomWidth)-t.offsetHeight-d-parseNumeric(i.marginBottom)};const a=f.position;"absolute"!=a&&"relative"!=a&&(n.style.position="relative"),this._recalcPosition();const c=this._clone={};c.node=document.createElement("div"),extend(c.node.style,{width:r.right-r.left+"px",height:r.bottom-r.top+"px",marginTop:i.marginTop,marginBottom:i.marginBottom,marginLeft:i.marginLeft,marginRight:i.marginRight,cssFloat:i.cssFloat,padding:0,border:0,borderSpacing:0,fontSize:"1em",position:"static"}),s.insertBefore(c.node,t),c.docOffsetTop=getDocOffsetTop(c.node)}_recalcPosition(){if(!this._active||this._removed)return;const t=scroll.top<=this._limits.start?"start":scroll.top>=this._limits.end?"end":"middle";if(this._stickyMode!=t){switch(t){case"start":extend(this._node.style,{position:"absolute",left:this._offsetToParent.left+"px",right:this._offsetToParent.right+"px",top:this._offsetToParent.top+"px",bottom:"auto",width:"auto",marginLeft:0,marginRight:0,marginTop:0});break;case"middle":extend(this._node.style,{position:"fixed",left:this._offsetToWindow.left+"px",right:this._offsetToWindow.right+"px",top:this._styles.top,bottom:"auto",width:"auto",marginLeft:0,marginRight:0,marginTop:0});break;case"end":extend(this._node.style,{position:"absolute",left:this._offsetToParent.left+"px",right:this._offsetToParent.right+"px",top:"auto",bottom:0,width:"auto",marginLeft:0,marginRight:0})}this._stickyMode=t}}_fastCheck(){this._active&&!this._removed&&(Math.abs(getDocOffsetTop(this._clone.node)-this._clone.docOffsetTop)>1||Math.abs(this._parent.node.offsetHeight-this._parent.offsetHeight)>1)&&this.refresh()}_deactivate(){this._active&&!this._removed&&(this._clone.node.parentNode.removeChild(this._clone.node),delete this._clone,extend(this._node.style,this._styles),delete this._styles,stickies.some(t=>t!==this&&t._parent&&t._parent.node===this._parent.node)||extend(this._parent.node.style,this._parent.styles),delete this._parent,this._stickyMode=null,this._active=!1,delete this._offsetToWindow,delete this._offsetToParent,delete this._limits)}remove(){this._deactivate(),stickies.some((t,e)=>{if(t._node===this._node)return stickies.splice(e,1),!0}),this._removed=!0}}const Stickyfill={stickies:stickies,Sticky:Sticky,forceSticky(){seppuku=!1,init(),this.refreshAll()},addOne(t){if(!(t instanceof HTMLElement)){if(!t.length||!t[0])return;t=t[0]}for(var e=0;e{if(t._node===o)return e.push(t),!0})||e.push(new Sticky(o)):e.push(void 0)}return e},refreshAll(){stickies.forEach(t=>t.refresh())},removeOne(t){if(!(t instanceof HTMLElement)){if(!t.length||!t[0])return;t=t[0]}stickies.some(e=>{if(e._node===t)return e.remove(),!0})},remove(t){if(t instanceof HTMLElement&&(t=[t]),t.length)for(let e=0;e{if(t._node===i)return t.remove(),!0})}},removeAll(){for(;stickies.length;)stickies[0].remove()}};function init(){if(isInitialized)return;function t(){window.pageXOffset!=scroll.left?(scroll.top=window.pageYOffset,scroll.left=window.pageXOffset,Stickyfill.refreshAll()):window.pageYOffset!=scroll.top&&(scroll.top=window.pageYOffset,scroll.left=window.pageXOffset,stickies.forEach(t=>t._recalcPosition()),Stickyfill.refreshAll())}let e,i,o;function s(){e=setInterval(function(){stickies.forEach(t=>t._fastCheck())},500)}isInitialized=!0,t(),window.addEventListener("scroll",t),window.addEventListener("resize",Stickyfill.refreshAll),window.addEventListener("orientationchange",Stickyfill.refreshAll),"hidden"in document?(i="hidden",o="visibilitychange"):"webkitHidden"in document&&(i="webkitHidden",o="webkitvisibilitychange"),o?(document[i]||s(),document.addEventListener(o,()=>{document[i]?clearInterval(e):s()})):s()}seppuku||init(),"undefined"!=typeof module&&module.exports?module.exports=Stickyfill:isWindowDefined&&(window.Stickyfill=Stickyfill); Stickyfill.forceSticky(); Stickyfill.add(document.querySelectorAll('[data-sticky]')); /* Source common/js/scripts/999_scripts.js */ // https://github.com/piersrueb/simpleparallax const simpleParallax = (elem, modifier) => { let paras = document.getElementsByClassName(elem); let is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); if (is_safari) { return; } for (let i = 0; i < paras.length; i++) { if (!paras[i].classList.contains("nofix")) { paras[i].style.backgroundAttachment = "fixed"; } } const sp = () => { for (let i = 0; i < paras.length; i++) { let x = paras[i].getBoundingClientRect().top / modifier; let offset = 0; if (paras[i].classList.contains("nofix")) { offset = 100; } let y = Math.round(x * 100) / 100 - offset; paras[i].style.backgroundPosition = "center " + y + "px"; } requestAnimationFrame(sp); }; requestAnimationFrame(sp); }; simpleParallax("parallax", 4); (function(document, window) { var elem = document.querySelector('.sticky'); if (elem) { var elemRect = elem.getBoundingClientRect(), top = elemRect.top, originaltop = elem.scrollTop, bodyRect = document.body.getBoundingClientRect(), offset = elemRect.top - bodyRect.top; if (document.documentElement.scrollTop >= offset) { elem.classList.add('fixed'); } else { elem.classList.remove('fixed'); } window.addEventListener('scroll', togglefixed); function togglefixed() { top = elem.getBoundingClientRect().top; // console.log('1-----' + document.documentElement.scrollTop); // console.log('2-----' + offset); if (document.documentElement.scrollTop >= offset) { elem.classList.add('fixed'); } else { elem.classList.remove('fixed'); } } } }(document, window)); (function(document, window) { var menu = document.querySelector('.toggle_offcanvas_menu'), state = document.querySelector('.offcanvas_menu_state'); if (menu) { window.addEventListener('click', function() { if (state.checked == true) { menu.classList.add('open'); } else { menu.classList.remove('open'); } }) } }(document, window)); (function(document) { var toggle_objs = document.querySelectorAll('.toggle_opacity'); for (var i = 0; i < toggle_objs.length; i++) { toggle_objs[i].addEventListener('click', function() { this.classList.toggle("fade"); }) } // toggle_objs.addEventListener('click', function() { // this.classList.toggle("fade"); // }) }(document)); // blendet das alternative photo aus, wenn textbox zu klein für zwei übereinander (function(document, window) { var height_check = document.querySelector('.team_entry.page .height_check'); if (! height_check) { return; } var box_height = height_check.getBoundingClientRect().height, photo = document.querySelector('.team_entry.page .person_photo'), photo_height = photo.getBoundingClientRect().height, photo_alt = document.querySelectorAll('.team_entry.page .photo_alt')[0]; // console.log(box_height); // console.log(photo_height); window.addEventListener('resize', function() { box_height = height_check.getBoundingClientRect().height; photo_height = photo.getBoundingClientRect().height; check_height(); }) check_height(); function check_height() { if (typeof photo_alt !== "undefined") { if (box_height >= (photo_height * 2)) { photo_alt.classList.add("show"); } else { photo_alt.classList.remove("show"); } } } }(document, window)); /* Source common/js/scripts/99_scrolled_down_arrow.js */ // SCROLL DOWN ARROW // Vergibt eine Klasse scrolled_down auf den fixierten Pfeil nach unten // ------------------------------------------------------------------------------------------------- (function(document, window) { var scrolled_down = function($animated_element) { var _this = this; _this._$animated_element = $animated_element; }; scrolled_down.prototype = { init: function() { var _this = this; window.addEventListener('scroll', this._is_scrolled_down.bind(_this), true); }, _is_scrolled_down: function() { var _this = this; if (window.pageYOffset > 40) { _this._$animated_element.classList.add('scrolled_down'); } else { _this._$animated_element.classList.remove('scrolled_down'); } } }; var $animated_elements = document.querySelectorAll('.down_arrow'); for (var i = 0, len = $animated_elements.length; i < len; i++) { new scrolled_down($animated_elements[i]).init(); } }(document, window));