From 3e0c8ac01a17c67bee3ce5dae1a7bedfc0d259e7 Mon Sep 17 00:00:00 2001 From: Florian Eisenmenger Date: Fri, 28 Jun 2024 13:11:34 +0200 Subject: [PATCH] stand ihk juni --- .../stories/components/header/header.js | 7 +- .../components/ihk-switch/ihk-switch.js | 41 ++++++----- .../components/image-text/image-text.scss | 7 +- .../marketingheader-typeahead.js | 7 +- .../marketingheader/marketingheader.scss | 7 ++ .../marketingheader/marketingheaderslider.js | 2 +- .../marketingheader/searchAccordion.js | 3 +- .../stories/sections/slider/slider.js | 70 +++++++++++-------- 8 files changed, 82 insertions(+), 62 deletions(-) diff --git a/gfi-ihk-2024/stories/components/header/header.js b/gfi-ihk-2024/stories/components/header/header.js index f53b3db..7aba207 100644 --- a/gfi-ihk-2024/stories/components/header/header.js +++ b/gfi-ihk-2024/stories/components/header/header.js @@ -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($('' + 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'); } diff --git a/gfi-ihk-2024/stories/components/ihk-switch/ihk-switch.js b/gfi-ihk-2024/stories/components/ihk-switch/ihk-switch.js index 99a3728..cfa4232 100644 --- a/gfi-ihk-2024/stories/components/ihk-switch/ihk-switch.js +++ b/gfi-ihk-2024/stories/components/ihk-switch/ihk-switch.js @@ -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) { diff --git a/gfi-ihk-2024/stories/components/image-text/image-text.scss b/gfi-ihk-2024/stories/components/image-text/image-text.scss index 95a401e..dbb344c 100644 --- a/gfi-ihk-2024/stories/components/image-text/image-text.scss +++ b/gfi-ihk-2024/stories/components/image-text/image-text.scss @@ -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; } } diff --git a/gfi-ihk-2024/stories/sections/marketingheader/marketingheader-typeahead.js b/gfi-ihk-2024/stories/sections/marketingheader/marketingheader-typeahead.js index 8391e5b..248203c 100644 --- a/gfi-ihk-2024/stories/sections/marketingheader/marketingheader-typeahead.js +++ b/gfi-ihk-2024/stories/sections/marketingheader/marketingheader-typeahead.js @@ -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 = $('').text('Alle Suchergebnisse'); @@ -10,7 +10,8 @@ class IHKSearchTypeahead { this.resultCount = $('').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() { diff --git a/gfi-ihk-2024/stories/sections/marketingheader/marketingheader.scss b/gfi-ihk-2024/stories/sections/marketingheader/marketingheader.scss index 003dcad..e1ae441 100644 --- a/gfi-ihk-2024/stories/sections/marketingheader/marketingheader.scss +++ b/gfi-ihk-2024/stories/sections/marketingheader/marketingheader.scss @@ -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; diff --git a/gfi-ihk-2024/stories/sections/marketingheader/marketingheaderslider.js b/gfi-ihk-2024/stories/sections/marketingheader/marketingheaderslider.js index d4fad0e..7996570 100644 --- a/gfi-ihk-2024/stories/sections/marketingheader/marketingheaderslider.js +++ b/gfi-ihk-2024/stories/sections/marketingheader/marketingheaderslider.js @@ -1,4 +1,4 @@ -import $ from 'jquery'; +const $ = global.$; import 'jquery.easing'; import Slider from "../slider/slider"; diff --git a/gfi-ihk-2024/stories/sections/marketingheader/searchAccordion.js b/gfi-ihk-2024/stories/sections/marketingheader/searchAccordion.js index b72b2c7..6b6336e 100644 --- a/gfi-ihk-2024/stories/sections/marketingheader/searchAccordion.js +++ b/gfi-ihk-2024/stories/sections/marketingheader/searchAccordion.js @@ -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)); }); }); + diff --git a/gfi-ihk-2024/stories/sections/slider/slider.js b/gfi-ihk-2024/stories/sections/slider/slider.js index 0688faf..aaad81a 100644 --- a/gfi-ihk-2024/stories/sections/slider/slider.js +++ b/gfi-ihk-2024/stories/sections/slider/slider.js @@ -111,42 +111,50 @@ class IHKSlider { .html('/' + this.slides.length + '') .prepend(this.count); - this.slides.each(function (i) { - const s = $(this); - const li = $('
  • ').appendTo(tabsWrapper); - - var button = $('