PageSourceSearch

https://www.ehi.org/wp-content/themes/EHI.org/assets/js/custom.js?ver=7.1.2

js ehi.org collected 2026-09-24 15:21:06 UTC 8,243 bytes, 306 lines download raw bytes

1//const { default: UIkit } = require("uikit");
2
3jQuery(document).ready(function($) {
4
5
6  jQuery('.et_pb_section.et_pb_with_background').addClass('et_pb_section_with_background');
7
8  /*var lastContentSection = jQuery('#et-main-area .et_pb_section:last-child');
9
10  if(lastContentSection.hasClass('et_pb_with_background')){
11    lastContentSection.css('margin-bottom', '-20px');
12  }*/
13
14  jQuery('.et_pb_section.et_pb_with_background').each(function(){
15    var $this = jQuery(this);
16    var afterBackgroundSection = $this.next();
17
18    if(!afterBackgroundSection.hasClass('et_pb_with_background')){
19      afterBackgroundSection.addClass('et_pb_section_after_with_background');
20    }
21
22  }); 
23
24  jQuery('.ehi-filter-icon-mobile').on('click', function(event){
25
26    event.preventDefault();
27    var filterColumn = jQuery('.s3dm_factfinder_filter_column');
28    
29    filterColumn.css({
30      zIndex: 3
31    });
32
33    filterColumn.animate(
34    {
35      opacity: 1
36    }, 300);
37
38   
39
40  });
41
42  jQuery('.ehi-filter-close-icon-mobile').on('click', function(event){
43
44    event.preventDefault();
45    var filterColumn = jQuery('.s3dm_factfinder_filter_column');
46
47    filterColumn.animate({
48        opacity: 0,
49        zIndex: -1
50      }, 300, function(){
51        filterColumn.css({
52          zIndex: -1
53        });
54      });
55
56  });
57
58
59  var windowWidth = jQuery(window).width();
60
61  /*var links = jQuery('.et_pb_text_inner a[target="_blank"]' );
62
63  links.each(function(){
64    var $link = jQuery(this);
65
66    if(!$link.find('img').length){
67
68      $link.append('<i class="fas fa-external-link-alt"></i>');
69
70    }
71
72  });*/
73
74  var popupForm = jQuery('#footer-newsletter-form');
75  var newsletter_submit = jQuery('.open-nl-form-modal');
76  var eMailField = jQuery('.newsletter-email');
77
78  newsletter_submit.on('click', function() {
79
80    var eMailFieldVal = eMailField.val();
81    if(!eMailFieldVal){
82      eMailField.addClass('email-error');
83      return;
84    }
85
86    jQuery('#displayform input[name="email"]').val(eMailFieldVal);
87    UIkit.modal(popupForm).show();
88
89  });
90
91
92
93  $('#page-container').removeClass('et-animated-content');
94
95  var ThemenStudienlistItems = $('.ehi-studien-liste article');
96  ThemenStudienlistItems.each(function(){
97      jQuery(this).children().wrapAll('<div class="post-content-wrapper"></div>');
98  });
99  if(windowWidth > 768){
100    /*
101    * Same-Height Fix Blog List
102    *
103    */
104
105
106    var ThemenStudienheights = ThemenStudienlistItems.map(function (){
107      return jQuery(this).find('.post-content-wrapper').outerHeight();
108    }).get(),
109    ThemenStudienmaxHeight = Math.max.apply(null, ThemenStudienheights);
110    ThemenStudienlistItems.css('height', ThemenStudienmaxHeight);
111  }
112
113  var gridSliderItemTitle = jQuery('.s3dm-grid-slider-item-title h3');
114  var maxHeightGridSliderTitle = getMaxHeight(gridSliderItemTitle);
115  $('.s3dm-grid-slider-item-title').css('height', maxHeightGridSliderTitle);
116
117  /*
118    Remove empty p tags inside single posts
119  */
120  var postContentContainer = jQuery('.single-post-content-module').length;
121  var productContentContainer = jQuery('.product-content-module').length;
122
123  if(postContentContainer > 0 ){
124
125    var allThePostPs = jQuery('.single-post-content-module p');
126    
127
128    allThePostPs.each(function(index, item){
129
130      if(item.innerHTML === ''){
131        item.remove();
132      }
133
134      if(item.innerHTML === ' '){
135        item.remove();
136      }
137
138      if(item.innerHTML === '&nbsp;'){
139        item.remove();
140      }
141
142    });
143
144    
145
146  }
147
148  if(productContentContainer > 0){
149
150    var allTheProductPs = jQuery('.product-content-module p');
151
152    allTheProductPs.each(function(index, item){
153
154      if(item.innerHTML === ''){
155        item.remove();
156      }
157
158      if(item.innerHTML === ' '){
159        item.remove();
160      }
161
162      if(item.innerHTML === '&nbsp;'){
163        item.remove();
164      }
165
166    });
167
168  }
169
170  var categoryListContainer = jQuery('.single-post-category-list');
171
172  if(categoryListContainer.length > 0){
173    //wrap links inside div to properly align them inside the grid
174    categoryListContainer.find('a').wrap('<div class="post_category"></div>');
175
176    //initialize grid because divi gets rid of html attributes of the wrapper element
177    UIkit.grid(categoryListContainer);
178  }
179
180  /*
181  * Custom Select Script
182  *
183  */
184
185  var x, i, j, l, ll, selElmnt, a, b, c;
186  /* Look for any elements with the class "custom-select": */
187  x = document.getElementsByClassName('custom-select');
188  l = x.length;
189  for (i = 0; i < l; i++) {
190    selElmnt = x[i].getElementsByTagName("select")[0];
191    ll = selElmnt.length;
192    /* For each element, create a new DIV that will act as the selected item: */
193    a = document.createElement("DIV");
194    a.setAttribute("class", "select-selected");
195    a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
196    x[i].appendChild(a);
197    /* For each element, create a new DIV that will contain the option list: */
198    b = document.createElement("DIV");
199    b.setAttribute("class", "select-items select-hide");
200    for (j = 1; j < ll; j++) {
201      /* For each option in the original select element,
202      create a new DIV that will act as an option item: */
203      c = document.createElement("DIV");
204      c.innerHTML = selElmnt.options[j].innerHTML;
205      c.addEventListener("click", function(e) {
206          /* When an item is clicked, update the original select box,
207          and the selected item: */
208          var y, i, k, s, h, sl, yl;
209          s = this.parentNode.parentNode.getElementsByTagName("select")[0];
210          sl = s.length;
211          h = this.parentNode.previousSibling;
212          for (i = 0; i < sl; i++) {
213            if (s.options[i].innerHTML == this.innerHTML) {
214              s.selectedIndex = i;
215              h.innerHTML = this.innerHTML;
216              y = this.parentNode.getElementsByClassName("same-as-selected");
217              yl = y.length;
218              for (k = 0; k < yl; k++) {
219                y[k].removeAttribute("class");
220              }
221              this.setAttribute("class", "same-as-selected");
222              break;
223            }
224          }
225          h.click();
226      });
227      b.appendChild(c);
228    }
229    x[i].appendChild(b);
230    a.addEventListener("click", function(e) {
231      /* When the select box is clicked, close any other select boxes,
232      and open/close the current select box: */
233      e.stopPropagation();
234      closeAllSelect(this);
235      this.nextSibling.classList.toggle("select-hide");
236      this.classList.toggle("select-arrow-active");
237    });
238  }
239
240  /* If the user clicks anywhere outside the select box,
241  then close all select boxes: */
242  document.addEventListener("click", closeAllSelect);
243
244  /* recolor the text in brackets at the end of an accordion title */
245  jQuery(".et_pb_accordion .et_pb_toggle_title").each( function (index) {
246    var ttlCont = jQuery(this).html();
247    var brackets = ttlCont.match(/\(.*?\)/gmi);
248    ttlCont = ttlCont.replace( brackets, "<span style='color:#00b2b2;font-size:80%;flex-basis:60%;'>&nbsp;&thinsp;" + brackets + "</span>" )
249    jQuery(this).html( ttlCont );
250  });
251
252  var loadWindowWidth = jQuery(window).width();
253
254  if(loadWindowWidth > 980){
255    var handelsdatenPriceRow = jQuery('.ehi-handelsdaten-price-row');
256
257    if(handelsdatenPriceRow.length > 0){
258
259      var elements = handelsdatenPriceRow.find('.et_pb_text_inner');
260      var parent = handelsdatenPriceRow.find('.et_pb_text');
261      var maxHeight = getMaxHeightResize(elements);
262      parent.height(maxHeight);
263
264    }
265  }
266
267  
268
269
270});
271
272
273
274function getMaxHeight(elements){
275  var heights = elements.map(function ()
276  {
277      return jQuery(this).height();
278  }).get();
279
280  maxHeight = Math.max.apply(null, heights);
281
282  return maxHeight;
283}
284
285
286function closeAllSelect(elmnt) {
287  /* A function that will close all select boxes in the document,
288  except the current select box: */
289  var x, y, i, xl, yl, arrNo = [];
290  x = document.getElementsByClassName("select-items");
291  y = document.getElementsByClassName("select-selected");
292  xl = x.length;
293  yl = y.length;
294  for (i = 0; i < yl; i++) {
295    if (elmnt == y[i]) {
296      arrNo.push(i)
297    } else {
298      y[i].classList.remove("select-arrow-active");
299    }
300  }
301  for (i = 0; i < xl; i++) {
302    if (arrNo.indexOf(i)) {
303      x[i].classList.add("select-hide");
304    }
305  }
306}

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.