PageSourceSearch

https://www.wuerth.com/system/layout_wl2bootstrap/bootstrap_library/general/wuerth_bootstrap_general.js

js wuerth.com collected 2026-09-24 09:25:23 UTC 12,609 bytes, 400 lines download raw bytes

1function equalHeight(element) {
2    var maxHeight = 0;
3    element.each(function() {
4        $(this).css("height", "auto");
5        currentHeight = $(this).height();
6        if (currentHeight > maxHeight) {
7            maxHeight = currentHeight;
8        }
9    });
10    element.each(function() {
11        $(this).css("height", maxHeight + "px");
12    });
13}
14
15function makeTablesScrolling() {
16    $('table').each(function() {
17        var _this = $(this);
18        if (!_this.parent().hasClass('table_scroller') && !_this.hasClass('dataTable')) {
19            _this.wrap('<div class="table_scroller"></div>');
20        }
21    });
22}
23
24function prepareObjectForFS(obj) {
25    let object = {}
26    for (var key in obj) {
27      if (obj.hasOwnProperty(key)) {
28            let k = key.replace("$","")
29            object[k] = obj[key]
30      }
31    }   
32    return object
33}
34
35function mailthis(adr) {
36    adrnew = adr.replace(/ \[dot\] /g, ".");
37    adrnew = adrnew.replace(/ \[at\] /g, "@");
38    top.location.href = "mailto:" + adrnew;
39    return false;
40}
41
42function clickToHeaderUser() {
43    jQuery('html, body').animate({
44        scrollTop: 0
45    }, 200, function() {
46        // condition for deprecated responsive user header - can be removed if last site not use this header version
47        if ($('a.jsOpenAnonymousHeaderUserLayer').length > 0 && !jQuery('div#headerUser').is(':visible')) {
48            $('a.jsOpenAnonymousHeaderUserLayer').trigger('click');
49        } else {
50            $('#headerUser').triggerHandler('mouseover');
51        }    
52    });
53}; 
54
55function getUrlParameter(sParam) {
56    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
57        sURLVariables = sPageURL.split('&'),
58        sParameterName,
59        i;
60    for (i = 0; i < sURLVariables.length; i++) {
61        sParameterName = sURLVariables[i].split('=');
62        if (sParameterName[0] === sParam) {
63            return sParameterName[1] === undefined ? true : sParameterName[1];
64        }
65    }
66};
67
68function toggleTextReadMore( id ) {
69    if ($('#textTogglerClosed_'+id).hasClass("visible")) {
70        $('#textTogglerClosed_'+id).fadeOut( "fast", function() {
71            $('#textTogglerOpened_'+id).fadeIn( "slow", function() {
72                // Animation complete.
73            });
74        });
75        $('#textTogglerClosed_'+id).removeClass("visible");
76        
77    } else {
78       $('#textTogglerOpened_'+id).fadeOut( "fast", function() {
79            $('#textTogglerClosed_'+id).fadeIn( "slow", function() {
80                // Animation complete.
81            });
82        });
83        $('#textTogglerClosed_'+id).addClass("visible"); 
84    }
85}
86function addRandomValueToTextfield() {
87    if($('#randomTextfield').find('input').val().substr($('#randomTextfield').find('input').val().length-1,1) == "+") {
88        var addTimestamp = true;
89        var inputValue = $('#randomTextfield').find('input').val().substr(0,$('#randomTextfield').find('input').val().length-1)
90    } else {
91        var addTimestamp = false;
92        var inputValue = $('#randomTextfield').find('input').val();
93    
94    }
95    //console.log(inputValue);
96    if(inputValue.substr(inputValue.length-2,1) == "_") {
97        var prefixtext = inputValue.substr(0, inputValue.length-2);
98        var randomlength = inputValue.substr(inputValue.length-1,inputValue.length);
99        var newRand = generateRandomWithLength(parseInt(randomlength));
100        //console.log(randomlength);
101        if(addTimestamp) {
102            var newRandValue = prefixtext+newRand+"_"+Math.floor(Date.now() / 1000);
103        } else {
104            var newRandValue = prefixtext+newRand;
105        }
106        //console.log(newRandValue);
107        
108        $('#randomTextfield').find('input').val(newRandValue);
109        $('#randomTextfield').find('.randomValue').text(newRandValue);
110    }
111
112}
113function generateRandomWithLength(n) {
114    var add = 1, max = 12 - add;   // 12 is the min safe number Math.random() can generate without it starting to pad the end with zeros.   
115
116    if ( n > max ) {
117            return generate(max) + generate(n - max);
118    }
119
120    max        = Math.pow(10, n+add);
121    var min    = max/10; // Math.pow(10, n) basically
122    var number = Math.floor( Math.random() * (max - min + 1) ) + min;
123
124    return ("" + number).substring(add); 
125}
126
127//START Copy to Clipboard Function
128var copytranslate = "copy";
129var copytranslated = "copied";
130  // Multi line
131function clipboard(){
132    $(".btn-clipboard").click(function () {
133    copyToClipboard($(this).parent().find('.language-html'));
134    $(this).tooltip('hide')
135      .attr('data-original-title', copytranslated)
136      .tooltip('show')
137  });
138
139  function copyToClipboard(element) {
140    var $temp = $("<input>");
141    $("body").append($temp);
142    $temp.val($(element).text()).select();
143    document.execCommand("copy");
144    $temp.remove();
145  }
146  $(".btn-clipboard").hover(function () {
147    $(this).tooltip('show')
148      .attr('data-original-title', copytranslate)
149  });
150  // Inline
151  $(".btn-clipboard-inline").click(function () {
152    copyToClipboard($(this).find('.inline-code'));
153    $(this).tooltip('hide')
154    .attr('data-original-title', copytranslated)
155    .tooltip('show')
156  });
157
158}
159//END Copy to Clipboard Function
160
161//BEGIN Couponcode
162function changeCouponValue(containerid,couponcode){
163    $("#"+containerid).find('.active-coupon-label').text(couponcode);
164    $("#"+containerid).find("code").text(couponcode);
165    $("#"+containerid).find(".couponlabel").text(couponcode);
166 }
167//END Couponcode
168
169
170 
171function prevLog(msg, tag) {
172    
173}
174
175/* general variables */
176var document_width, document_height;
177
178$(document).ready(function() {
179
180    $.each($(".gridlist.centered-images"), function() {
181        equalHeight($(this).find('a'));
182    });
183
184   
185    $('.teaserlist.portalteaser .col-md-6 .img-container').each(function() {
186        width = ($(this).width());
187        $(this).css("height",width / 3 * 2);
188        $(this).css("overflow","hidden");
189    })
190
191    $('.teaserlist.portalteaser .col-md-4 .img-container').each(function() {
192        width = ($(this).width());
193        $(this).css("height",width / 3 * 2);
194        $(this).css("overflow","hidden");
195    })
196
197    $('.teaserlist.samelayerteaser .col-md-6 .img-container').each(function() {
198        width = ($(this).width());
199        $(this).css("height",width / 3 * 2);
200        $(this).css("overflow","hidden");
201    })
202
203    $('.teaserlist.portalteaser .img-container.full').each(function() {
204        width = ($(this).width());
205        $(this).css("height","auto");
206        $(this).css("overflow","hidden");
207        $(this).find(".img-fluid").css("width","100%");
208        $(this).find(".img-fluid").css("height","auto");
209    })
210
211    var res = $(window).width();
212
213    if (res <= 576) {
214
215    $('.teaserlist .col-12.startpageteaser .img-container.full-image').each(function() {
216        width = ($(this).width());
217        $(this).css("height",width / 3 * 2);
218        $(this).css("overflow","hidden");
219    })
220
221    $('.teaserlist.portalteaser .img-container.full').each(function() {
222        width = ($(this).width());
223        $(this).css("height",width / 3 * 2);
224        $(this).css("overflow","hidden");
225        $(this).find(".img-fluid").css("width","auto");
226        $(this).find(".img-fluid").css("height","100%");
227    })
228
229    }
230
231    $('#collapsedIntrotext').on('shown.bs.collapse', function () {
232        $('#introtextCollapser').find('.collapse-link.hidden').removeClass('hide');
233        $('#introtextCollapser').find('.collapse-link.show').addClass('hide');
234    })
235    $('#collapsedIntrotext').on('hidden.bs.collapse', function () {
236        $('#introtextCollapser').find('.collapse-link.hidden').addClass('hide');
237        $('#introtextCollapser').find('.collapse-link.show').removeClass('hide');
238    })
239
240    
241
242    if($('#randomTextfield').length) {
243        addRandomValueToTextfield();
244    }
245
246    if($('#headerUserLayerAnnymousLoginFormWrapper').length) {
247        if($('#headerUserLayerAnnymousLoginFormWrapper').find('#2stageTab').length && $.cookie('ltab') === "true" ) {
248            $('#2stageTab').click();
249        } else {
250            $('#classicTab').click();
251        }
252    }
253
254
255   
256    /* new subnav */
257    $("#nav_shop").parent().not(".showOnMenu").mouseover(function() {
258        $(".showOnMenu").css("display", "none");
259    });
260
261    /* new eyecatcher */
262    $("#nav_shop").parent().not(".showOnMenu").mouseenter(function() {
263    	$(".showOnMenu").hide()
264    });
265    
266
267
268    /*for Kastenlayout 1/2spaltiger Teaser*/
269    $.each($(".frontpage2col.teaserLayout"), function() {
270        // equalHeight($(this).find('img'));
271        //equalHeight($(this).find('.imgcontainer'));
272        equalHeight($(this).find('.frontpage2col_news.teaserLayout'));
273    });
274
275    
276
277
278
279    document_width = $(document).width();
280    document_height = $(document).height();
281
282    //STARTS EXECUTION
283    var res = $(window).width();
284
285    if (res <= 974) {
286        makeTablesScrolling();
287
288        /* responsive imagemap */
289        if ($('img[usemap]').length > 0) {
290            if ($(".imagemapResponsiveSections").length) {
291                $(".imagemap-container").hide();
292                $(".imagemapResponsiveSections").show();
293            }
294        }
295        /* end responsive imagemap */
296
297    }
298
299    //CONTROL RESIZE
300    $(window).on('resize', function() {
301        
302        $.each($(".gridlist.centered-images"), function() {
303            equalHeight($(this).find('a'));
304        });
305    
306       
307        $('.teaserlist.portalteaser .col-md-6 .img-container').each(function() {
308            width = ($(this).width());
309            $(this).css("height",width / 3 * 2);
310            $(this).css("overflow","hidden");
311        })
312    
313        $('.teaserlist.samelayerteaser .col-md-6 .img-container').each(function() {
314            width = ($(this).width());
315            $(this).css("height",width / 3 * 2);
316            $(this).css("overflow","hidden");
317        })
318
319        $('.teaserlist.portalteaser .img-container.full').each(function() {
320            width = ($(this).width());
321            $(this).css("height","auto");
322            $(this).css("overflow","hidden");
323            $(this).find(".img-fluid").css("width","100%");
324            $(this).find(".img-fluid").css("height","auto");
325        })
326    
327        var res = $(window).width();
328    
329        if (res <= 576) {
330    
331        $('.teaserlist .col-12.startpageteaser .img-container.full-image').each(function() {
332            width = ($(this).width());
333            $(this).css("height",width / 3 * 2);
334            $(this).css("overflow","hidden");
335        })
336
337        $('.teaserlist.portalteaser .img-container.full').each(function() {
338            width = ($(this).width());
339            $(this).css("height",width / 3 * 2);
340            $(this).css("overflow","hidden");
341            $(this).find(".img-fluid").css("width","auto");
342            $(this).find(".img-fluid").css("height","100%");
343        })
344
345        }
346        
347        
348        
349        
350        
351        res = $(document).width()
352
353        if (document_width != $(document).width()) {
354            /* things to to on resize */
355            if (res <= 974) {
356                makeTablesScrolling();
357
358                /* responsive imagemap */
359                if ($('img[usemap]').length > 0) {
360                    if ($(".imagemapResponsiveSections").length) {
361                        $(".imagemap-container").hide();
362                        $(".imagemapResponsiveSections").show();
363                    }
364                }
365                /* end responsive imagemap */
366            }
367
368            if (res > 974) {
369                /* responsive imagemap */
370                if ($('img[usemap]').length > 0) {
371                    if ($(".imagemapResponsiveSections").length) {
372                        $(".imagemap-container").show();
373                        $(".imagemapResponsiveSections").hide();
374                    }
375                }
376                /* end responsive imagemap */
377            }
378
379        }
380
381        /* set new helping variables, because mobile browsers fire resize-event on scrolling */
382        document_width = $(document).width();
383        document_height = $(document).height();
384        /* end helping function mobile browsers */
385
386    });
387   
388    $(".coupon-item").click(function(){
389		console.log("item click");
390        var container = $(this).closest(".row.couponContainer")
391        var containerId = container.attr("id");
392        var couponCode = $(this).find("span").data("coupon");
393        $(".coupon-item.active").each(function(){ $(this).removeClass("active") });
394        $(this).addClass("active");
395        changeCouponValue(containerId, couponCode);
396	});
397   
398    clipboard();
399
400});

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.