1/* global jQuery, $, console, textZoomEvent */ 2jQuery(function ($) { 3 'use strict'; 4 5 // der wysiwyg editor setzt kein <p>s, sondern <br>s. deswegen klebt gern mal eine <ul> hinter einer textnode und 6 // kann nicht vernuenftig gestylt werden. das script geht alle kindnodes von .wcms-text-section durch - wenn auf eine 7 // textnode ein <ul> folgt, wird die textnode in ein span gewrappt 8 var lastNode; 9 $('.wcms-text-section') 10 .contents() 11 .filter(function () { 12 var ret = false; 13 if (this.nodeType === 1 && lastNode && lastNode.nodeType === 3 && this.tagName === 'UL') { 14 $(lastNode).wrap('<span class="textnode"></span>'); 15 } 16 lastNode = this; 17 }); 18 19 // jobfilter: nach manuellem abschicken des formulars zu den ergebnissen scrollen 20 $('#jobSearch__form').each(function () { 21 $(this).on('submit', function () { 22 sessionStorage.setItem('jobfilterScroll', '1'); 23 }); 24 if (sessionStorage.getItem('jobfilterScroll') === '1') { 25 $('html,body').animate( 26 { 27 scrollTop: $('#jobSummaries__headline').offset().top 28 }, 29 300 30 ); 31 } 32 }); 33 sessionStorage.setItem('jobfilterScroll', '0'); 34 35 36 // bei den kacheln ohne sichtbaren linktext die ganze kachel klickbar machen 37 // wenn kein link geklickt wird, zum ziel des letzten links der kachel wechseln 38 $('.teaserWithoutImage--linkLayout-chevron').on('click', function (e) { 39 if (e.target.nodeName.toLowerCase() !== 'a' && !$(e.target).closest('a').length) { 40 document.location.href = $(this).find('a:last').attr('href'); 41 } 42 }); 43 44 $('#scroll-top').each(function () { 45 var $window = $(window), 46 offset = ($window.height() + 200), // show 47 $this = $(this); 48 49 $this.on('click', function (e) { 50 e.preventDefault(); 51 $('body,html').animate({ 52 scrollTop: 0 53 }, 600); 54 }); 55 $window.on('scroll', function () { 56 if ($window.scrollTop() < 200) { 57 $this.css('display', 'none'); 58 } else { 59 $this.css('display', 'block'); 60 } 61 }); 62 $window.trigger('scroll'); 63 }); 64 65 $('#header__searchToggle').on('click', function (e) { 66 $('#header__searchToggle').removeClass('active'); 67 $('#header__search').toggleClass('srOnly'); 68 if (!$('#header__search').hasClass('srOnly')) { 69 $('#header__searchToggle').addClass('active'); 70 $('#header__search').find('input,button').removeAttr('tabindex'); 71 $('#header__search').removeAttr('aria-hidden'); 72 $('#header__search').find('input[type="text"]').focus(); 73 } else { 74 $('#header__search').attr('aria-hidden', true); 75 $('#header__search').find('input,button').attr('tabindex', -1); 76 } 77 }); 78 79 $('.template--default').each(function () { 80 var open = false, 81 closed = false, 82 $wrapperTPL = $('<div class="element__wrapper backgroundWrapper"></div>'), 83 $wrapper; 84 $('.getsBackgroundWrapper').each(function () { 85 var $this = $(this), 86 $next = $this.next(); 87 // max verschachtelung auf .element__wrapper .element__wrapper begrenzen 88 if ($this.parentsUntil($('main'), '.element__wrapper').length > 1) { 89 return true; 90 } 91 if (!open) { 92 $wrapper = $wrapperTPL.clone(); 93 $this.before($wrapper); 94 $wrapper.append($this); 95 if (!$next.length || !$next.hasClass('getsBackgroundWrapper')) { 96 open = false; 97 return true; 98 } 99 open = true; 100 } else { 101 $wrapper.append($this); 102 if (!$next.length || !$next.hasClass('getsBackgroun
102dWrapper')) { 103 open = false; 104 return true; 105 } 106 open = true; 107 } 108 }); 109 }); 110 111 $('.wcms-search-results-wrapper').each(function () { 112 var $this = $(this), 113 $search = $this.prev('.wcms-search-searchfield-wrapper'), 114 hrefG = encodeURI('https://www.google.com/search?q=site:https://www.blindeninstitut.de'), 115 textG = 'Mit den Ergebnissen nicht zufrieden? Google Suche verwenden', 116 hrefK = encodeURI('https://www.blindeninstitut.de/de/kontakt/?search='), 117 textK = 'Sie suchen nach einem Kontakt? Zur Kontaktsuche', 118 searchstring = $.trim($search.find('[name="searchstr"]').val()); 119 if (searchstring) { 120 hrefG += '+' + encodeURI(searchstring); 121 hrefK += encodeURI(searchstring); 122 } 123 if ($search.length) { 124 $search.append('<a class="link2GoogleSearch" href="' + hrefG + '">' + textG + '</a><br>'); 125 $search.append('<a class="link2ContactSearch" href="' + hrefK + '">' + textK + '</a>'); 126 } 127 }); 128 129 // text zoom erkennen, die augen svgs ausblenden wenn mehr als 120% gezoomt wird 130 textZoomEvent.init(16); 131 if (textZoomEvent.resizeFactor() > 1.2) { 132 $('html').addClass('zoomed'); 133 } 134 document.addEventListener('textzoom', function textZoomEvent(e) { 135 if (e.detail.resizeFactor() > 1.2) { 136 $('html').addClass('zoomed'); 137 } else { 138 $('html').removeClass('zoomed'); 139 } 140 }); 141 142 143 $('#tableOfContents__list').each(function () { 144 $(this).slideUp(0); 145 $(this).html(getTableOfContents()); 146 $(this).on('click', 'a', function () { 147 scrollToid(this.href.slice(this.href.indexOf('#'))); 148 }); 149 }); 150 $('.tableOfContents__toggler').on('click', function () { 151 $(this).toggleClass('tableOfContents__toggler--open'); 152 $(this).next().slideToggle(0); 153 }); 154 155 156 var $main = $('main'), 157 $headlines = $main.find('h1, h2, h3'); 158 159 $headlines.each(function () { 160 var $headline = $(this), 161 id = ''; 162 if (!$headline.attr('id')) { 163 id = $headline.text().toLowerCase(); 164 id = id.replace(/ä/g, 'ae'); 165 id = id.replace(/ö/g, 'oe'); 166 id = id.replace(/ü/g, 'ue'); 167 id = id.replace(/Ã/g, 'ss'); 168 id = id.replace(/\W/g, '_'); 169 id = id.replace(/_+/g, '_'); 170 id = id.replace(/^_/, ''); 171 id = id.replace(/_$/, ''); 172 $headline.attr('id', id); 173 174 if ($('html').hasClass('isBeUser')) { 175 var $button = $('<button class="copyHeadlineId"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"/></svg> <span class="copy">Link kopieren</span><span class="copied">Link kopiert</span></button>'); 176 $button.on('click', function (e) { 177 e.preventDefault(); 178 e.stopImmediatePropagation(); 179 //copy(location.href.replace(location.hash, '') + '#' + id); 180 //copy('#' + id); 181 navigator.clipboard.writeText('#' + id); 182 $button.addClass('successfullyCopied'); 183 $button.on('mouseleave', function () { 184 $button.removeClass('successfullyCopied'); 185 }); 186 }); 187 $headline.append($button); 188 } 189 } 190 });
191 scrollToid(location.hash); 192 193 var searchterm = $('[name=search]').val(); 194 var matches = []; 195 if (searchterm) { 196 matches = [searchterm].concat(searchterm.split(' ')); 197 } 198 //$('.contactDB__result[data-matches]').each(function () { 199 $('.contactDB__result,.jobSummaries__summary').each(function () { 200 //var matches = $(this).data('matches'), 201 var n, 202 a = [], 203 walk = document.createTreeWalker(this, NodeFilter.SHOW_TEXT, null, false); 204 while (n = walk.nextNode()) { 205 if ($(n.parentNode).hasClass('buttonLink') || $(n.parentNode).hasClass('copy') || $(n.parentNode).hasClass('copied')) { 206 continue; 207 } 208 //markTermInTextnode(v, matches); 209 a.push(n); 210 } 211 $.each(a, function (k, v) { 212 markTermInTextnode(v, matches); 213 }); 214 }); 215 216}); 217 218function markTermInTextnode(node, terms) { 219 var indices = []; 220 $.each(terms, function (k, v) { 221 $.each(getIndicesOf(v, node.nodeValue), function (k, v) { 222 indices.push(v); 223 }); 224 }); 225 // nach indexposition aufsteigend sortieren 226 if (indices.length > 1) { 227 var tmp = []; 228 $.each(indices, function (k, v) { 229 tmp[v.index] = v; 230 }); 231 indices = tmp; 232 } 233 var text = node.nodeValue, 234 parentNode = node.parentNode, 235 offset = 0, 236 newNodes = []; 237 $.each(indices, function (k, v) { 238 if (!v) { 239 return true; 240 } 241 var highlight = text.substring(v.index, (v.index + v.length)); 242 if (offset < v.index) { 243 newNodes.push(document.createTextNode(text.substring(offset, v.index))); 244 } 245 var bNode = document.createElement('b'); 246 bNode.className = 'contactSearchHighlight'; 247 var textNode = document.createTextNode(highlight); 248 bNode.appendChild(textNode); 249 newNodes.push(bNode); 250 offset = (v.index + v.length); 251 }); 252 if (offset < text.length) { 253 newNodes.push(document.createTextNode(text.substring(offset))); 254 } 255 $.each(newNodes.reverse(), function (k, v) { 256 parentNode.insertBefore(v, node.nextSibling); 257 }); 258 parentNode.removeChild(node); 259 260 return true; 261} 262 263function getIndicesOf(searchStr, str) { 264 var searchStrLen = searchStr.length; 265 if (searchStrLen == 0) { 266 return []; 267 } 268 var startIndex = 0, index, indices = []; 269 str = str.toLowerCase(); 270 searchStr = searchStr.toLowerCase(); 271 while ((index = str.indexOf(searchStr, startIndex)) > -1) { 272 indices.push({'index': index, 'length': searchStrLen}); 273 startIndex = index + searchStrLen; 274 } 275 return indices; 276} 277 278function scrollToid(id) { 279 if (id) { 280 var $id = $('main').find(id); 281 if ($id.length) { 282 $('html, body').animate({ 283 scrollTop: $id.offset().top 284 }, 1000); 285 } 286 } 287} 288 289function trapFocus(element) { 290 'use strict'; 291 var focusableEls = element.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])'); 292 var firstFocusableEl = focusableEls[0]; 293 var lastFocusableEl = focusableEls[focusableEls.length - 1]; 294 var KEYCODE_TAB = 9; 295 296 element.addEventListener('keydown', function (e) { 297 var isTabPressed = (e.key === 'Tab' || e.keyCode === KEYCODE_TAB); 298 299 if (!isTabPressed) { 300 return; 301 } 302 303 if (e.shiftKey) /* shift + tab */ { 304 if (document.activeElement === firstFocusableEl) {
305 lastFocusableEl.focus(); 306 e.preventDefault(); 307 } 308 } else /* tab */ { 309 if (document.activeElement === lastFocusableEl) { 310 firstFocusableEl.focus(); 311 e.preventDefault(); 312 } 313 } 314 }); 315} 316 317function getTableOfContents() { 318 var html = '<ul>'; 319 $('.headlineWithAnchor').each(function () { 320 var $this = $(this), 321 $headline = $this.find(':header'), 322 depth = ''; 323 324 if (!$headline.prop('nodeName')) { 325 return true; 326 } 327 depth = parseInt($headline.prop('nodeName').substr(1)); 328 html += '<li class="headlineLevel' + depth + '"><a href="' + $headline.data('href') + '">' + $headline.text() + '</a></li>'; 329 }); 330 html += '</ul>'; 331 return html; 332} 333 334 335jQuery(function ($) { 336 'use strict'; 337 var $toggleButtons = $('.textPlusHiddenText__toggleContent'); 338 var $fullTextWrappers = $('.textPlusHiddenText__text2'); 339 var fullText; 340 var toggleButtonText; 341 342 $fullTextWrappers.attr('hidden', true); 343 344 $toggleButtons.removeAttr('hidden'); 345 346 // add listener for each button 347 $toggleButtons.each(function () { 348 349 $(this).on('click', function () { 350 351 var $this = $(this), 352 fullTextWrapper = $this.parent().find('.textPlusHiddenText__text2'), 353 showMoreText = $this.data('show_more'), 354 showLessText = $this.data('show_less'), 355 $text = $this.find('span'); 356 357 if (!fullTextWrapper.attr('hidden')) { 358 $text.text(showMoreText); 359 fullTextWrapper.attr('hidden', true); 360 $this.attr('aria-expanded', false); 361 } else { 362 $text.text(showLessText); 363 fullTextWrapper.removeAttr('hidden'); 364 $this.attr('aria-expanded', true); 365 } 366 }); 367 }); 368 369 370 $('a[href^="http://"], a[href^="https://"]').not('a[href*="' + location.hostname + '"]').attr({ 371 'target': '_blank', 372 'rel': 'noopener noreferrer nofollow' 373 }); 374 // alle links mit linkziel aktuelle seite 375 var urlParams = new URLSearchParams(window.location.search); 376 if (urlParams.get('wcmsint') !== 'preview') { 377 $('a[href*="' + location.protocol + '//' + location.host + location.pathname + '"]').each(function () { 378 // link geht auf id 379 if (this.href.indexOf('#') !== -1) { 380 $(this).on('click', function (e) { 381 e.preventDefault(); 382 e.stopImmediatePropagation(); 383 scrollToid(this.href.slice(this.href.indexOf('#'))); 384 }); 385 } 386 }); 387 } 388 389});
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.