1$(function () { 2 3 var $membersGallery = $(".membersGalleryFull") 4 var $partnersGallery = $(".partnersGalleryFull") 5 var $gallery = null 6 var mode = null 7 if ($membersGallery[0]) { 8 $gallery = $membersGallery 9 mode = "members" 10 } else if ($partnersGallery[0]) { 11 $gallery = $partnersGallery 12 mode = "partners" 13 } 14 15 if ($gallery != null) { 16 var $galleryDetails = $gallery.find(".gallery-details") 17 var $imageContainer = $galleryDetails.find(".image-container") 18 var $addressContainer = $galleryDetails.find(".address-container") 19 var $descriptionContainer = $galleryDetails.find(".description-container") 20 var $galleryItems = $gallery.find(".gallery-item, .gallery-item-spacer") 21 var status = "notshown" 22 var cache = {} 23 var currentId = null 24 25 $galleryItems.click(function () { 26 var $this = $(this) 27 var $itemSelected = $('.gallery-item-selected') 28 $itemSelected.removeClass('gallery-item-selected') 29 if ($this[0] === $itemSelected[0]) { 30 hideDetails() 31 } else { 32 $this.addClass('gallery-item-selected') 33 moveAndShowDetails($this.attr("data-id")) 34 } 35 }) 36 37 function hideDetails() { 38 if (status === "shown") { 39 $galleryDetails.slideUp() 40 } 41 status = "notshown" 42 } 43 44 function moveAndShowDetails(id) { 45 if (id) { 46 var $itemToSelect = $(".gallery-item[data-id=\"" + id + "\"]") 47 $itemToSelect.addClass("gallery-item-selected") 48 currentId = id 49 fetchContent(id, function (data) { 50 // console.log("fetchContent", data) 51 var itemsPerRow = 0 52 $galleryDetails.hide() // hide so doesn't affect calculations 53 var $firstItem = $galleryItems.eq(0) 54 var $itemTop = $firstItem.position().top 55 $galleryItems.each(function (i) { 56 if ($(this).position().top !== $itemTop) { 57 itemsPerRow = i 58 return false 59 } 60 }) 61 var selectedIndex = $galleryItems.index($('.gallery-item-selected')[0]) 62 var selectedRowNum = Math.floor(selectedIndex / itemsPerRow) + 1 63 if(mode === "members") { 64 if (data.image) { 65 var imageUrl = "url(\"" + data.image + "\")" 66 $imageContainer.css("background-image", imageUrl) 67 } else { 68 $imageContainer.css("background-image", "none") 69 } 70 var html = "" 71 html += "<h1 class='name'>" + data.name + "</h1>" + 72 "<p>" + (data.street != null ? data.street + "<br/>" : "") + 73 (data.city != null ? data.city : "") + "</p>" + 74 "<p>" + (data.phone != null ? _t.phone + ": <a href='tel:" + data.phone + "'>" + data.phone + "</a><br/>" : "") + 75 (data.fax != null ? _t.fax + ": " + data.fax : "") + "</p>" + 76 (data.email ? "<p>" + _t.email + ": <a href='mailto:" + data.email + "'>" + data.email + "</a></p>" : "") 77 html += "<div class='social'>" 78 html += renderSocial(data.youtubeUrl, "youtube") 79 html += renderSocial(data.facebookUrl, "facebook") 80 html += renderSocial(data.instagramUrl, "instagram") 81 html += renderSocial(data.pinterestUrl, "pinterest") 82 html += renderSocial(data.twitterUrl, "x") 83 html += renderSocial(data.tiktokUrl, "tiktok") 84 html += renderSocial(data.linkedinUrl, "linkedin") 85 html += "</div>" 86 if(data.karriereUrl) { 87 const buttonText = data.karriereButtonTest || "Karriere" 88 html += `<a target="_blank" class="btn btn-primary btn-primary-block mt-4" href="${data.karriereUrl}">${buttonText}</a>` 89 } 90 if (data.url) { 91 var urlText = data.url.replace(/(^\w+:|^)\/\//, '').replace(/^\/|\/$/g, '') 92 html += '<div class="homepage"><a target="_blank" href="' + data.url + '">' + urlText + '</a></div>' 93 } 94 $addressContainer.html(html) 95 var htmlDescription = "" 96 htmlDescription += "<h1 class='name'>" + data.name + "</h1>" 97 if (data.description) { 98 htmlDescription += data.description 99 } 100 if (data.url) { 101 var urlText = data.url.replace(/(^\w+:|^)\/\//, '').replace(/^\/|\/$/g, '') 102 htmlDescription += '<div class="homepage"><a target="_blank" href="' + data.url + '">' + urlText + '</a></div>' 103 } 104 $descriptionContainer.html(htmlDescription) 105 } else if (mode === "partners") { 106 $descriptionContainer.html(data.description) 107 } 108 109 $galleryDetails.removeClass("d-none").insertAfter($galleryItems.eq((selectedRowNum * itemsPerRow) - 1))
110 if (status === "notshown") { 111 $galleryDetails.slideDown() 112 } else { 113 $galleryDetails.show() 114 } 115 status = "shown" 116 // console.log("scrollTo", id) 117 scrollSmoothTo($galleryDetails, 290) 118 }) 119 } 120 } 121 122 function renderSocial(link, name) { 123 if (link) { 124 return '<a href="' + link + '" target="_blank"><img title="' + name + '" alt="' + name + '" src="/assets/images/social/2024-06-18/icon_' + name + '.svg"/></a>' 125 } else { 126 return "" 127 } 128 } 129 130 function fetchContent(id, callback) { 131 if (cache[id]) { 132 callback(cache[id]) 133 } else { 134 $.get("/" + mode + "/" + id + ".json", function (data) { 135 cache[id] = data 136 callback(data) 137 }) 138 } 139 } 140 141 var lastWidth = 0 142 $(document).ready(function () { 143 lastWidth = $(window).width() 144 }) 145 $(window).resize(function () { 146 if (lastWidth !== $(window).width()) { 147 lastWidth = $(window).width() 148 $galleryDetails.hide() // hide Details so it doesn't interfere with the flex layout during resize 149 clearTimeout(window.resizedFinished) 150 window.resizedFinished = setTimeout(function () { 151 moveAndShowDetails(currentId) 152 }, 500) 153 } 154 }) 155 156 moveAndShowDetails($galleryDetails.attr("data-showId")) 157 } 158})
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.