| @@ -276,7 +276,7 @@ class IHKHeader { | |||
| a.attr('href', itemUrl); | |||
| } | |||
| if (this.linktype == 'external') { | |||
| if (this.linktype && this.linktype === 'external') { | |||
| li.addClass('external'); | |||
| $(li).find("a").attr("target", "_blank") | |||
| } | |||
| @@ -290,7 +290,7 @@ class IHKHeader { | |||
| a.text('').append($('<img src="' + this.titleImage + '" alt="' + this.title + '" />')) | |||
| } | |||
| } | |||
| if (this.viewType === 'themenseite' && !parentElement.root) { | |||
| if (this.viewType === 'themenseite' && (!parentElement.root || this.skipEmptyMenu)) { | |||
| li.addClass('overview'); | |||
| li.removeClass('deep'); | |||
| a.attr('href', itemUrl); | |||
| @@ -306,8 +306,7 @@ class IHKHeader { | |||
| li.addClass('intranet'); | |||
| } | |||
| if (this.doctype && | |||
| (this.doctype.indexOf('Datei') > -1 || this.doctype.indexOf('PDF') > -1 || this.doctype.indexOf('PIC') > -1)) { | |||
| if (this.linktype && this.linktype === 'document') { | |||
| li.addClass('download'); | |||
| } | |||
| @@ -34,7 +34,18 @@ class IHKSwitch { | |||
| } | |||
| this.checkState(); | |||
| this.initClosing(); | |||
| this.initClosing() | |||
| this.initStayHereZipBtn(section); | |||
| } | |||
| initStayHereZipBtn(section) { | |||
| let stayHereBtn = section.find('button.stay-here-zip'); | |||
| if (stayHereBtn) { | |||
| stayHereBtn.on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.getCurrentIhkAndSetCookie(true); | |||
| }); | |||
| } | |||
| } | |||
| isSessionStorageKeySet() { | |||
| @@ -52,7 +63,7 @@ class IHKSwitch { | |||
| this.section.find('.closer').on('click', () => { | |||
| this.setSessionStorageCookie(); | |||
| this.hideSwitch(); | |||
| }) | |||
| }); | |||
| } | |||
| hideSwitch() { | |||
| @@ -101,8 +112,7 @@ class IHKSwitch { | |||
| } | |||
| } | |||
| const input = t.form.find('#zipSwitchInput'); | |||
| t.zipInput = input; | |||
| t.zipInput = t.form.find('#zipSwitchInput'); | |||
| t.zipInput.typeahead({ | |||
| highlight: true, | |||
| @@ -141,7 +151,7 @@ class IHKSwitch { | |||
| this.section.attr('data-show-step', 'form'); | |||
| this.section.find('.stay-here').on('click', () => { | |||
| this.getCurrentIhkAndSetCookie(); | |||
| this.getCurrentIhkAndSetCookie(false); | |||
| this.hideSwitch(); | |||
| }); | |||
| this.section.find('.set-session-cookie').on('click', () => { | |||
| @@ -150,17 +160,7 @@ class IHKSwitch { | |||
| }) | |||
| } | |||
| // todo: delete this method after qs tests | |||
| fakeIHKsForTest(json) { | |||
| if (json.ihknr === 107 && ihk.settings.bIhkTestUrl !== "") { | |||
| json.homepage = ihk.settings.bIhkTestUrl; | |||
| } else if (json.ihknr === 118 && ihk.settings.doIhkTestUrl !== "") { | |||
| json.homepage = ihk.settings.doIhkTestUrl; | |||
| } | |||
| } | |||
| setMyLocationAsObj(item) { | |||
| this.fakeIHKsForTest(item); | |||
| this.myLocation = { | |||
| city: item.city, | |||
| country: item.country, | |||
| @@ -196,7 +196,7 @@ class IHKSwitch { | |||
| } | |||
| this.section.find('.stay-here').on('click', () => { | |||
| this.getCurrentIhkAndSetCookie(); | |||
| this.getCurrentIhkAndSetCookie(false); | |||
| this.hideSwitch(); | |||
| }); | |||
| @@ -217,7 +217,7 @@ class IHKSwitch { | |||
| } | |||
| } | |||
| getCurrentIhkAndSetCookie() { | |||
| getCurrentIhkAndSetCookie(withReload) { | |||
| this.getIhkList().then(() => { | |||
| let myIHK; | |||
| const currIHK = parseInt(this.section.find('.current-ihk').attr('data-ihknr')); | |||
| @@ -226,6 +226,9 @@ class IHKSwitch { | |||
| }); | |||
| this.setMyLocationAsObj(myIHK); | |||
| this.setCookie(); | |||
| if (withReload) { | |||
| window.location.reload(); | |||
| } | |||
| }); | |||
| } | |||
| @@ -270,6 +273,7 @@ class IHKSwitch { | |||
| try { | |||
| if (this.myLocation) { | |||
| Cookies.set('my-ihk', JSON.stringify(this.myLocation).toString(), {expires: 365}); | |||
| Cookies.set('ihknr', this.myLocation.ihknr, {expires: 365}); | |||
| } | |||
| } catch (e) { | |||
| console.log("Unable to set cookie"); | |||
| @@ -281,8 +285,7 @@ class IHKSwitch { | |||
| const p = 0.017453292519943295; | |||
| const c = Math.cos; | |||
| const a = 0.5 - c((ihk.latitude - currentPosition.latitude) * p) / 2 + c(currentPosition.latitude * p) * c(ihk.latitude * p) * (1 - c((ihk.longitude - currentPosition.longitude) * p)) / 2; | |||
| const distance = 12742 * Math.asin(Math.sqrt(a)); | |||
| return distance; | |||
| return 12742 * Math.asin(Math.sqrt(a)); | |||
| } | |||
| getIhkList(position) { | |||
| @@ -2,10 +2,11 @@ | |||
| @import '../../_global/styles/vars'; | |||
| .image-text { | |||
| max-width: 1340px; | |||
| display: flex; | |||
| justify-content: space-between; | |||
| align-items: center; | |||
| margin-bottom: var(--section-margin); | |||
| margin: 0 auto var(--section-margin) auto; | |||
| padding: 45px 0; | |||
| position: relative; | |||
| z-index: 1; | |||
| @@ -36,9 +37,9 @@ | |||
| position: absolute; | |||
| left: 50%; | |||
| top: 0; | |||
| width: 100vw; | |||
| width: calc(100vw - var(--scrollbar-width)); | |||
| height: 100%; | |||
| margin: 0 -50vw; | |||
| margin: 0 calc(-50vw + 7px); | |||
| z-index: -1; | |||
| } | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| const $ = require('jquery'); | |||
| const $ = global.$; | |||
| class IHKSearchTypeahead { | |||
| constructor(input) { | |||
| this.input = input; | |||
| this.input = input.addClass('initiated'); | |||
| this.api = input.data('api'); | |||
| this.tileWrapper = input.closest('form').next('.tiles'); | |||
| this.allResults = $('<a href="#" class="btn has-icon icon-small-arrow-right-simple" />').text('Alle Suchergebnisse'); | |||
| @@ -10,7 +10,8 @@ class IHKSearchTypeahead { | |||
| this.resultCount = $('<span class="count" />').appendTo(this.allResults); | |||
| //$('.results-wrapper').find('.h-kicker').each(function(i) {if (i < 10) {console.log($(this).text())}}); | |||
| this.handleKeyEvents(); | |||
| // unused function at the moment | |||
| //this.handleKeyEvents(); | |||
| } | |||
| handleKeyEvents() { | |||
| @@ -15,6 +15,13 @@ section.marketingheader{ | |||
| color:white; | |||
| } | |||
| } | |||
| .rotation .slider .outer { | |||
| max-height: 427px; | |||
| @media(max-width: 999px) { | |||
| max-height:none; | |||
| height:auto; | |||
| } | |||
| } | |||
| .search { | |||
| position: relative; | |||
| overflow: hidden; | |||
| @@ -1,4 +1,4 @@ | |||
| import $ from 'jquery'; | |||
| const $ = global.$; | |||
| import 'jquery.easing'; | |||
| import Slider from "../slider/slider"; | |||
| @@ -70,7 +70,8 @@ class IHKSearchAccordion { | |||
| export default IHKSearchAccordion; | |||
| $('body').on('ihk-init dynamic-component-loaded gfi-dynamic-init', function () { | |||
| $('form:not(.initiated)').each(function(i) { | |||
| $('.marketingheader > .search:not(.initiated)').each(function (i) { | |||
| new IHKSearchAccordion($(this)); | |||
| }); | |||
| }); | |||
| @@ -111,42 +111,50 @@ class IHKSlider { | |||
| .html('/<span class="total">' + this.slides.length + '</span></span>') | |||
| .prepend(this.count); | |||
| this.slides.each(function (i) { | |||
| const s = $(this); | |||
| const li = $('<li/>').appendTo(tabsWrapper); | |||
| var button = $('<button />').addClass('btn').appendTo(li); | |||
| const span = $('<span/>').appendTo(button); | |||
| span.text(s.data('title') ? s.data('title') : i + 1); | |||
| }); | |||
| this.tabs = tabsWrapper.children(); | |||
| tabsWrapper.find('button').on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.sectionInitialClicked = true; | |||
| this.changeSlide($(e.currentTarget).parent().index()); | |||
| }); | |||
| if (this.slides.length > 1) { | |||
| this.slides.each(function (i) { | |||
| const s = $(this); | |||
| const li = $('<li/>').appendTo(tabsWrapper); | |||
| this.prevButton.on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.sectionInitialClicked = true; | |||
| this.onPrev(); | |||
| }); | |||
| var button = $('<button />').addClass('btn').appendTo(li); | |||
| const span = $('<span/>').appendTo(button); | |||
| this.nextButton.on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.sectionInitialClicked = true; | |||
| this.onNext(); | |||
| }); | |||
| span.text(s.data('title') ? s.data('title') : i + 1); | |||
| }); | |||
| this.tabs = tabsWrapper.children(); | |||
| this.controls = $('<div class="controls" />') | |||
| .append(this.prevButton) | |||
| .append(tabsWrapper) | |||
| .append(countWrapper) | |||
| .append(this.nextButton) | |||
| .appendTo(this.section); | |||
| tabsWrapper.find('button').on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.sectionInitialClicked = true; | |||
| this.changeSlide($(e.currentTarget).parent().index()); | |||
| }); | |||
| this.prevButton.on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.sectionInitialClicked = true; | |||
| this.onPrev(); | |||
| }); | |||
| this.nextButton.on('click', (e) => { | |||
| e.preventDefault(); | |||
| this.sectionInitialClicked = true; | |||
| this.onNext(); | |||
| }); | |||
| this.controls = $('<div class="controls" />') | |||
| .append(this.prevButton) | |||
| .append(tabsWrapper) | |||
| .append(countWrapper) | |||
| .append(this.nextButton) | |||
| .appendTo(this.section); | |||
| } else { | |||
| this.controls = $('<div class="controls" />') | |||
| .append(tabsWrapper) | |||
| .append(countWrapper) | |||
| .appendTo(this.section); | |||
| } | |||
| } | |||
| changeSlide(index, offset, transition = true) { | |||