PageSourceSearch

https://www.edwardsvacuum.com/etc/clientlibs/vtba-commons.lc-17895…-lc.min.dc0c22bc1f70ad6e42ae7f0ca7a9b18a.js

js edwardsvacuum.com collected 2026-09-24 17:37:11 UTC 41,083 bytes, 1,096 lines download raw bytes

1;(function () {
2    "use strict"
3    /** Event Listeners attachment */
4
5    $(".trimable-text").each(function () {
6        const $this = $(this);
7        const characterLimit = $this.data("read_threshold");
8        this.innerHTML = this.innerHTML.substring(0, characterLimit)
9        this.innerHTML = this.innerHTML.substring(0,
10            this.innerHTML.lastIndexOf(" ")) + " ...";
11    });
12
13    $(".geo-location-close").on("click", function () {
14        $(this).parents(".cmp-market-picker-prompt").remove();
15    })
16
17    $(".geo-location--select-list li a").on("click", function (ev) {
18        ev.preventDefault();
19        vtba.localeLinkClicked(this)
20    });
21
22    $(".confirm-redirect").on("click", function () {
23        vtba.dontShowAgainAcition();
24        window.location = $(this).data("href");
25    });
26
27    $("#confirm-noredirect").on("click", function () {
28        vtba.dontShowAgainAcition();
29        vtba.MODAL_SELECTOR.remove();
30    });
31
32    /** Framework functions */
33
34    window.vtba = window.vtba || {};
35    vtba.accessibility = vtba.accessibility || {};
36
37    vtba.debugMode = false;
38    vtba.PREFERRED_LOCALE_COOKIE_NAME = "preferred-locale";
39    vtba.PREFERRED_LOCALE_DONT_SHOW_AGAIN_COOKIE_NAME = "preferred-locale-dont-show-again";
40    vtba.CHOOSE_MARKET_SELECTOR = $("#cmp-market-picker-prompt--choose-market");
41    vtba.MODAL_SELECTOR = $(".cmp-market-picker-prompt__modal");
42    vtba.$COMPONENT_HOLDER = $(".cmp-market-picker-prompt");
43
44    vtba.accessibility.focusTrapHandleBluer = function handleBlur(ev) {
45        const containerId = this.dataset.container;
46        const container = document.getElementById(containerId);
47        const backId = this.dataset.trapback;
48        const back = document.getElementById(backId);
49        if (ev.relatedTarget && !container.contains(ev.relatedTarget)) {
50            ev.preventDefault();
51            back.focus();
52        }
53    }
54
55    vtba.accessibility.focusTrapForContainer = function focusTrapForContainer(container,
56        back, ignoreHidden, excludeFocusableInParentsSelector) {
57        if (typeof container === "string") {
58            container = document.querySelector(container);
59        }
60
61        if (typeof back === "string") {
62            back = document.querySelector(back);
63        }
64
65        function isElementHidden(element) {
66            let isHidden = false
67            if (element instanceof HTMLElement) {
68                isHidden = getComputedStyle(element).display === 'none'
69                    || (element.parentElement && isElementHidden(
70                        element.parentElement));
71            }
72
73            return isHidden;
74        }
75
76        if (!!container) {
77            let allFocusable = container.querySelectorAll("a,button");
78            back = back ? back : allFocusable[0];
79
80            for (const focusable of allFocusable) {
81                focusable.removeEventListener("blur",
82                    vtba.accessibility.focusTrapHandleBluer);
83            }
84
85            if (allFocusable.length > 0) {
86                let last = Array.from(allFocusable).filter(function (element) {
87                    const isHidden = (!!ignoreHidden && isElementHidden(
88                            element)) ||
89                        (!!excludeFocusableInParentsSelector && element.closest(
90                            excludeFocusableInParentsSelector));
91                    return !isHidden;
92                }).pop();
93
94                if (!last) {
95                    last = allFocusable[allFocusable.length - 1]
96                }
97
98                if (!back.id) {
99                    back.id = generateRandomId();
100                }
101
102                if (!container.id) {
103                    container.id = generateRandomId();
104                }
105
106                last.dataset.trapback = back.id;
107                last.dataset.container = container.id;
108                last.addEventListener("blur",
109                    vtba.accessibility.focusTrapHandleBluer);
110            }
111        }
112    }
113
114    function generateRandomId(length = 16) {
115        const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
116        let id = '';
117        for (let i = 0; i < length; i++) {
118            id += characters.charAt(
119                Math.floor(Math.random() * characters.length));
120        }
121        return id;
122    }
123
124    if (vtba.debugMode) {
125        $("head").append(
126            "<link rel=\"alternate\" hreflang=\"zh-tw\" href=\"https://www.edwardsvacuum.com/zh-tw\">"
127            + "<link rel=\"alternate\" hreflang=\"pt-br\" href=\"https://www.edwardsvacuum.com/pt-br\">"
128            + "<link rel=\"alternate\" hreflang=\"es-mx\" href=\"https://www.edwardsvacuum.com/es-mx\">"
129            + "<link rel=\"alternate\" hreflang=\"fr-fr\" href=\"https://www.edwardsvacuum.com/fr-fr\">"
130            + "<link rel=\"alternate\" hreflang=\"de-de\" href=\"https://www.edwardsvacuum.com/de-de\">")
131    }
132
133    vtba.setCookie = function (cookieName, cookieValue, lifetime) {
134        let cookieString = encodeURIComponent(cookieName) + "="
135            + encodeURIComponent(cookieValue);
136
137        if (lifetime) {
138            let expirationDate = new Date();
139            expirationDate.setTime(
140                expirationDate.getTime() + (lifetime * 24 * 60 * 60 * 1000));
141            cookieString += "; expires=" + expirationDate.toUTCString();
142        } else {
143            cookieString += "; expires=Fri, 31 Dec 9999 23:59:59 GMT";
144        }
145
146        document.cookie = cookieString + ";path=/";
147    }
148    vtba.localeLinkClicked = function (that) {
149        let $link = $(that);
150
151        let href = $link.attr("href");
152        let localeCode = href.split("/")[1]
153
154        if (href.indexOf("/content/leybold/") === 0 || href.indexOf(
155            "/content/edwards/") === 0) {
156            localeCode = href.split("/")[3];
157        }
158
159        if (localeCode) {
160            localeCode = (/^[a-z]{2}[-_][A-Z]{2}$/).test(localeCode)
161                ? locale : localeCode.substring(0, 5);
162            vtba.setCookie(vtba.PREFERRED_LOCALE_COOKIE_NAME, localeCode);
163        }
164
165        window.location = href;
166    }
167
168    vtba.getCookieConsentForGroupStatus = function (groupId) {
169        const value = vtba.getCookie("OptanonConsent");
170        let status = false;
171        if (!!value) {
172            let values = value.split("&");
173            let groupsValue = vtba.findInArrayElementStartingWith("groups=",
174                values);
175            if (!!groupsValue) {
176                groupsValue = decodeURIComponent(groupsValue);
177                let groups = groupsValue.split(",")
178                status = vtba.findInArrayElementStartingWith(groupId,
179                    groups) === "1";
180            }
181        }
182        return status
183    }
184
185    vtba.findInArrayElementStartingWith = function (key, array) {
186        let theElement = "";
187
188        for (let i = 0; i < array.length; i++) {
189            let element = array[i];
190            if (element.startsWith(key)) {
191                theElement = element.substring(key.length + 1);
192                break;
193            }
194        }
195        return theElement;
196    }
197
198    vtba.getParameter = function (parameterName) {
199        let queryString = window.location.search;
200        queryString = queryString.substring(1);
201        let params = queryString.split("&");
202        for (let i = 0; i < params.length; i++) {
203            let keyValue = params[i].split("=");
204            let key = decodeURIComponent(keyValue[0]);
205            let value = decodeURIComponent(keyValue[1]);
206            if (key === parameterName) {
207                return value;
208            }
209        }
210        return null;
211    }
212
213    vtba.getCookie = function (name) {
214        let cookies = document.cookie.split(";");
215        for (let i = 0; i < cookies.length; i++) {
216            let cookie = cookies[i].trim();
217            if (cookie.startsWith(name + "=")) {
218                return cookie.substring(name.length + 1);
219            }
220        }
221        return null;
222    }
223
224    vtba.initGeoLocationDetector = function () {
225        //Only show if browser supports geo location
226        let presetLocale = vtba.getCookie(vtba.PREFERRED_LOCALE_COOKIE_NAME);
227        const isFunctionalCookiesConsent = vtba.getCookieConsentForGroupStatus(
228            "C0003");
229        if (isFunctionalCookiesConsent || vtba.debugMode) {
230            if (presetLocale) {
231                vtba.doesPageExistForPreferredLocale();
232                vtba.CHOOSE_MARKET_SELECTOR.hide()
233            } else {
234                vtba.CHOOSE_MARKET_SELECTOR.show(); //in case if we decide the default to be hidden
235            }
236            if ("geolocation" in navigator) {
237                $(".geo-location--get").show();
238                $(".geo-location-group--choose").show();
239            } else {
240                $(".geo-location-group--no-auto").show();
241                console.log("Geolocation is not supported by this browser.");
242            }
243        } else {
244            console.log("Functional cookies disallowed");
245            vtba.$COMPONENT_HOLDER.remove();
246        }
247        vtba.$COMPONENT_HOLDER.show();
248
249    }
250
251    vtba.doesPageExistForPreferredLocale = function () {
252        let currentPagePath = window.location.pathname;
253        let preferredMarket = vtba.getCookie(
254            vtba.PREFERRED_LOCALE_COOKIE_NAME).toLowerCase();
255
256        let preferredLocaleUrl;
257
258        const variations = [
259            preferredMarket,
260            preferredMarket.replace("-", "_"),
261            preferredMarket.substring(3)
262        ];
263
264        for (const variation of variations) {
265            preferredLocaleUrl =
266                $('link[rel="alternate"][href*="' + variation + '"]');
267            if (preferredLocaleUrl.length > 0) {
268                break;
269            }
270        }
271        /*checking if preferred market page exists and if we are not on it*/
272        if (!!preferredLocaleUrl[0] && !!preferredLocaleUrl[0].href &&
273            currentPagePath.indexOf(preferredMarket) === -1 &&
274            currentPagePath.indexOf(preferredMarket.replace("_", "-")) === -1) {
275
276            if (!localStorage.getItem(
277                vtba.PREFERRED_LOCALE_DONT_SHOW_AGAIN_COOKIE_NAME)) {
278                vtba.MODAL_SELECTOR.show();
279                $(".confirm-redirect").attr("data-href",
280                    preferredLocaleUrl[0].href);
281            } else {
282                $(".cmp-market-picker-prompt").remove();
283            }
284        } else {
285            $(".cmp-market-picker-prompt").remove();
286        }
287    }
288
289    vtba.requestGeolocation = function () {
290        if (navigator.geolocation) {
291            navigator.geolocation.getCurrentPosition(vtba.showPosition,
292                vtba.showGeoLocationObtainError);
293        } else {
294            alert("Geolocation is not supported by this browser.");
295        }
296    }
297
298    vtba.showPosition = function (position) {
299        vtba.getMarketCode(position.coords.latitude, position.coords.longitude);
300    }
301
302    vtba.showGeoLocationObtainError = function (error) {
303        $(".geo-location-group--choose").hide();
304        $(".geo-location-group--no-auto").show();
305        switch (error.code) {
306            case error.PERMISSION_DENIED:
307                alert("User denied the request for Geolocation.");
308                break;
309            case error.POSITION_UNAVAILABLE:
310                alert("Location information is unavailable.");
311                break;
312            case error.TIMEOUT:
313                alert("The request to get user location timed out.");
314                break;
315            case error.UNKNOWN_ERROR:
316                alert("An unknown error occurred.");
317                break;
318        }
319    }
320
321    vtba.getMarketCode = async function (latitude, longitude) {
322
323        function processLocaleExceptions(localeCode) {
324            switch (localeCode) {
325                case "en-gb":
326                    return "en-uk";
327                case "zh-Hans":
328                    return "zh-cn";
329                case "zh-Hant":
330                    return "zh-tw";
331                default:
332                    return localeCode;
333            }
334
335        }
336
337        function getCode() {
338            let geocoder = new google.maps.Geocoder();
339            let countryCode, languageCode;
340            let latlng = {lat: latitude, lng: longitude};
341            geocoder.geocode(
342                {'location': latlng}, function (results, status) {
343                    const addressComponents = results[0].address_components;
344                    $(addressComponents).each(function (i, component) {
345                        let types = component.types;
346                        if (types.includes('country')) {
347                            countryCode = component.short_name;
348                        }
349                        if (types.includes('language')) {
350                            languageCode = component.short_name.toLowerCase();
351                        }
352                    });
353                    if (countryCode) {
354                        if (!languageCode) {
355                            languageCode = window.vtba
356                            .getCountyDefaultLanguageCode(countryCode);
357                        }
358                        let localeCode = (languageCode + "-"
359                            + countryCode).toLowerCase();
360                        localeCode = processLocaleExceptions(localeCode);
361                        vtba.setCookie(vtba.PREFERRED_LOCALE_COOKIE_NAME,
362                            localeCode);
363                        vtba.CHOOSE_MARKET_SELECTOR.hide();
364                        vtba.customFindMatchingMarket(localeCode);
365                    } else {
366                        console.log(
367                            "default market finder error:" + countryCode)
368                    }
369
370                }, function () {
371                    console.log("OK")
372                });
373        }
374
375        if (!window.google || !window.google.maps) {
376            $.ajax({
377                url: "//maps.googleapis.com/maps/api/js?v=3&key=AIzaSyBfhYxtoaEhYZcZykY94n-iU7c0QsbfOC0",
378                dataType: "script",
379                timeout: 10 * 1000
380            })
381            .done(getCode)
382            .fail(function (response) {
383                console.log("default market finder error:" + response.status);
384            });
385        } else {
386            getCode()
387        }
388    }
389
390    vtba.dontShowAgainAcition = function () {
391        if ($("#confirm-dont-show-again").is(":checked")) {
392            localStorage.setItem(
393                vtba.PREFERRED_LOCALE_DONT_SHOW_AGAIN_COOKIE_NAME, true);
394        }
395    }
396
397    window.vtba = vtba;
398
399    /** On load triggers */
400    vtba.initGeoLocationDetector();
401
402    vtba.hotSwapTaiwanForTaiwanChinaAtChina = function () {
403        const path = window.location.pathname;
404        if (path.indexOf("zh-cn") > -1) {
405            let $link = $(".cmp-header__list").find("a[href*='zh-tw']");
406            $link.html("中国台湾");
407        }
408    }
409
410    vtba.adjustTextSizeToFitContainer = function (selectorsArr) {
411        for (let selector of selectorsArr) {
412            const allOfType = "string" !== typeof selector
413            const selectorString = allOfType ? selector[0] : selector;
414            const elements = document.querySelectorAll(selectorString);
415            if (elements.length > 0) {
416                let smallestFont = parseFloat(window
417                .getComputedStyle(elements[0], null)
418                .getPropertyValue('font-size'));
419
420                elements.forEach(element => {
421                    const parent = element.parentElement;
422                    element.style.fontSize = "";
423                    let fontSize = parseFloat(window
424                    .getComputedStyle(element, null)
425                    .getPropertyValue('font-size'));
426
427                    element.style.wordBreak = "unset";
428                    element.style.wordWrap = "unset";
429                    element.style.overflowWrap = "unset";
430
431                    while (element.scrollWidth > parent.clientWidth) {
432                        fontSize--;
433                        element.style.fontSize = fontSize + 'px';
434                        smallestFont = smallestFont > fontSize ? fontSize
435                            : smallestFont;
436                        if (fontSize <= 0) {
437                            break;
438                        }
439                    }
440                });
441                if (allOfType) {
442                    elements.forEach(element => {
443                        element.style.fontSize = smallestFont + 'px';
444                    })
445                }
446            }
447        }
448    };
449
450    /** On load triggers */
451    vtba.initGeoLocationDetector();
452
453    if (vtba.debugMode) {
454        function handleTabKeyPress(event) {
455            if (event.keyCode === 9) {
456                const focusedElement = document.activeElement;
457                console.log("Currently focused element:", focusedElement);
458            }
459        }
460
461        document.addEventListener('keydown', handleTabKeyPress);
462    }
463
464})();
465;(function () {
466    window.vtba = window.vtba || {};
467
468    window.vtba.getCountyDefaultLanguageCode = function (countryCode) {
469        let countriesMap = {
470            "AL": "sq", // Albania
471            "AM": "hy", // Armenia
472            "AZ": "az", // Azerbaijan
473            "BS": "en", // Bahamas
474            "BB": "en", // Barbados
475            "BY": "be", // Belarus
476            "BZ": "en", // Belize
477            "BN": "ms", // Brunei
478            "BG": "bg", // Bulgaria
479            "CR": "es", // Costa Rica
480            "HR": "hr", // Croatia
481            "CU": "es", // Cuba
482            "DO": "es", // Dominican Republic
483            "SV": "es", // El Salvador
484            "EE": "et", // Estonia
485            "GE": "ka", // Georgia
486            "GT": "es", // Guatemala
487            "GY": "en", // Guyana
488            "HT": "ht", // Haiti
489            "HN": "es", // Honduras
490            "JM": "en", // Jamaica
491            "KZ": "kk", // Kazakhstan
492            "KG": "ky", // Kyrgyzstan
493            "LV": "lv", // Latvia
494            "LT": "lt", // Lithuania
495            "MD": "ro", // Moldova
496            "ME": "sr", // Montenegro
497            "NP": "ne", // Nepal
498            "NI": "es", // Nicaragua
499            "MK": "mk", // North Macedonia
500            "PA": "es", // Panama
501            "RS": "sr", // Serbia
502            "SK": "sk", // Slovakia
503            "SI": "sl", // Slovenia
504            "SR": "nl", // Suriname
505            "TJ": "tg", // Tajikistan
506            "TT": "en", // Trinidad and Tobago
507            "TM": "tk", // Turkmenistan
508            "UA": "uk", // Ukraine
509            "UZ": "uz", // Uzbekistan
510            "AF": "ps", // Afghanistan
511            "DZ": "ar", // Algeria
512            "AR": "es", // Argentina
513            "AU": "en", // Australia
514            "AT": "de", // Austria
515            "BH": "ar", // Bahrain
516            "BD": "bn", // Bangladesh
517            "BE": "nl", // Belgium
518            "BR": "pt", // Brazil
519            "BI": "rn", // Burundi
520            "CA": "en", // Canada
521            "CN": "zh", // China
522            "CZ": "cs", // Czech Republic
523            "DK": "da", // Denmark
524            "DJ": "fr", // Djibouti
525            "EG": "ar", // Egypt
526            "ER": "ti", // Eritrea
527            "ET": "am", // Ethiopia
528            "FI": "fi", // Finland
529            "FR": "fr", // France
530            "DE": "de", // Germany
531            "GR": "el", // Greece
532            "HU": "hu", // Hungary
533            "IN": "hi", // India
534            "ID": "id", // Indonesia
535            "IR": "fa", // Iran
536            "IQ": "ar", // Iraq
537            "IE": "en", // Ireland
538            "IL": "he", // Israel
539            "IT": "it", // Italy
540            "JP": "ja", // Japan
541            "JO": "ar", // Jordan
542            "KE": "sw", // Kenya
543            "KW": "ar", // Kuwait
544            "LB": "ar", // Lebanon
545            "LY": "ar", // Libya
546            "MY": "ms", // Malaysia
547            "MX": "es", // Mexico
548            "MA": "ar", // Morocco
549            "MM": "my", // Myanmar
550            "NL": "nl", // Netherlands
551            "NZ": "en", // New Zealand
552            "NG": "en", // Nigeria
553            "NO": "no", // Norway
554            "OM": "ar", // Oman
555            "PK": "ur", // Pakistan
556            "PH": "tl", // Philippines
557            "PL": "pl", // Poland
558            "PT": "pt", // Portugal
559            "QA": "ar", // Qatar
560            "RO": "ro", // Romania
561            "RU": "ru", // Russia
562            "RW": "rw", // Rwanda
563            "SA": "ar", // Saudi Arabia
564            "SO": "so", // Somalia
565            "ZA": "af", // South Africa
566            "KR": "ko", // South Korea
567            "ES": "es", // Spain
568            "SD": "ar", // Sudan
569            "SE": "sv", // Sweden
570            "CH": "de", // Switzerland
571            "SY": "ar", // Syria
572            "TW": "zh", // Taiwan
573            "TZ": "sw", // Tanzania
574            "TH": "th", // Thailand
575            "TN": "ar", // Tunisia
576            "TR": "tr", // Turkey
577            "UG": "en", // Uganda
578            "AE": "ar", // United Arab Emirates
579            "GB": "en", // United Kingdom
580            "US": "en", // United States
581            "VN": "vi", // Vietnam
582            "YE": "ar"  // Yemen
583        }
584        return countriesMap[countryCode] || "en";
585    }
586})();
587;(function () {
588    "use strict";
589    //TODO the required scripts to go here if needed
590})();
591
592;(function () {
593    "use strict";
594    let $videos = $(".external-video-container");
595    if ($videos.length > 0) {
596        const firstScriptTag = document.getElementsByTagName('script')[0];
597
598        if (typeof window.YT === "undefined") {
599            const tag = document.createElement('script');
600            tag.src = "https://www.youtube.com/iframe_api";
601            firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
602        }
603        if (typeof window.Vimeo === "undefined") {
604            const tag = document.createElement('script');
605            tag.src = "https://player.vimeo.com/api/player.js";
606            firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
607        }
608
609        var done = false;
610        var player;
611
612        function onPlayerReady(event) {
613            event.target.playVideo();
614            $("#player-inject").parent().show();
615        }
616
617        function onPlayerStateChange(event) {
618            if (event.data === YT.PlayerState.PLAYING && !done) {
619                done = true;
620            }
621        }
622
623        function stopVideo() {
624            if (typeof player.stopVideo !== "undefined") {
625                player.stopVideo();
626            }
627        }
628
629        $(".video-playing-container--close").click(function () {
630            stopVideo();
631            let $player = $("#player-inject");
632            let $parent = $player.parent();
633            $player.remove();
634            $parent.hide();
635            $("body").removeClass("playing-video");
636        });
637
638        $videos.click(function () {
639            let $this = $(this);
640            let videoId = $this.data("video_id");
641            let channel = $this.data("channel");
642            let playerDiv = document.createElement("div");
643            playerDiv.id = "player-inject";
644            $("body").addClass("playing-video");
645            $(".cmp-header__container").addClass("playing-video");
646            $this.next(".video-playing-container").append(playerDiv);
647            const width = 640;
648            const height = 390;
649            if (channel === "YOUTUBE") {
650                player = new YT.Player('player-inject', {
651                    height: height,
652                    width: width,
653                    videoId: videoId,
654                    playerVars: {
655                        'autoplay': 1,
656                        'controls': 1,
657                        'playsinline': 1,
658                        'share': 0
659                    },
660                    events: {
661                        'onReady': onPlayerReady,
662                        'onStateChange': onPlayerStateChange
663                    }
664                });
665            } else if (channel === "VIMEO") {
666
667                let options = {
668                    id: videoId,
669                    width: window.innerWidth * 70 / 100,
670                    autoplay: true
671                }
672                player = new Vimeo.Player(playerDiv.id, options);
673                $("#player-inject").parent().show();
674
675            } else if (channel === "BILIBILI") {
676                //TODO integrate bilibili
677            } else if (channel === "SYNTHESIA") {
678                let videoId = $this.data("video_id");
679                if (!videoId) {
680                    console.error("Synthesia embed URL missing on element:",
681                        $this);
682                    return;
683                }
684                // Create iframe element
685                let iframe = document.createElement("iframe");
686                iframe.src = `https://share.synthesia.io/embeds/videos/${videoId}?language=en&autoplay=1`;
687                iframe.width = width;
688                iframe.height = height;
689                iframe.frameBorder = "0";
690                iframe.allow = "autoplay; encrypted-media; fullscreen";
691                iframe.allowFullscreen = true;
692
693                // Add classes or styling as needed
694                iframe.style.maxWidth = "100%";
695                iframe.style.display = "block";
696
697                let $player = $(`#player-inject`)
698                $player.append(iframe)
699                $player.parent().show();
700
701                // Add page state classes
702                $("body").addClass("playing-video");
703                $(".cmp-header__container").addClass("playing-video");
704            }
705        })
706    }
707})();
708
709;(function () {
710    let $newsAndEventsInstance = $(".cmp-news-and-events");
711    if ($newsAndEventsInstance.length > 0) {
712        $newsAndEventsInstance.each(function () {
713            initiateInstance(this);
714        })
715    }
716
717    function initiateInstance(that) {
718        const $this = $(that);
719        let $targets = $this.find(".target");
720        const $filter = $this.find("[name='filter']");
721        paginateInstance(that);
722
723        $filter.each(function () {
724            const currentFilter = this.value;
725            if (currentFilter !== "all") {
726                if ($targets
727                .filter("[data-filters*='" + currentFilter + "']").length === 0) {
728                    $(this).parent().remove();
729                }
730            }
731        })
732
733        $filter.click(function (ev) {
734            ev.stopPropagation();
735            const currentFilter = this.value;
736            $targets.addClass("filter-hidden");
737            if (currentFilter === "all") {
738                $targets.removeClass("filter-hidden");
739            } else {
740                $targets
741                .filter("[data-filters*='" + currentFilter + "']")
742                .removeClass("filter-hidden");
743            }
744            paginateInstance(that, true);
745        });
746
747    }
748
749    function paginateInstance(that, reset) {
750        const $this = $(that);
751        let $targets = $this.find(".target");
752        $targets.removeClass("pagination-hidden");
753        let $pagination = $this.find(".pagination");
754        const itemsPerPage = $pagination.data("paginate");
755        $pagination.html("");
756        let $visibleTargets = $targets.filter(":not('.filter-hidden')");
757        if (reset) {
758            $pagination.data("page", 0);
759        }
760        if ($visibleTargets.length > itemsPerPage) {
761            const paginationPage = $pagination.data("page");
762            const currentPageStart = paginationPage * itemsPerPage;
763            const currentPageEnd =
764                paginationPage * itemsPerPage + itemsPerPage * 1;
765            $targets.addClass("pagination-hidden");
766            $visibleTargets
767            .slice(currentPageStart, currentPageEnd)
768            .removeClass("pagination-hidden");
769
770            for (let i = 0; i < $visibleTargets.length; i += itemsPerPage) {
771                let button = generatePaginationButton(i / itemsPerPage);
772                if (i === paginationPage) {
773                    $(button).addClass("active");
774                }
775                $pagination.append(button);
776            }
777            $pagination.children().eq(paginationPage).addClass("active");
778        }
779    }
780
781    function generatePaginationButton(index) {
782        let button = document.createElement("button");
783        button.innerHTML = index + 1;
784        button.value = index;
785        button.onclick = paginationButtonClick;
786        return button;
787    }
788
789    function paginationButtonClick() {
790        const $this = $(this);
791        $this.parent().data("page", this.value);
792        paginateInstance($this.parents(".cmp-news-and-events"));
793    }
794})();
795;(function () {
796    let $getGeoLocation = $(".geo-location--get");
797    if ($getGeoLocation.length > 0) {
798        $getGeoLocation.click(window.vtba.requestGeolocation);
799    }
800
801    window.vtba = window.vtba || {};
802    vtba.customFindMatchingMarket = function (marketCode) {
803        vtba.setCookie(vtba.PREFERRED_LOCALE_COOKIE_NAME, marketCode);
804        vtba.doesPageExistForPreferredLocale();
805        /** implement this method in every version of a proxy component
806         *  to ensure it's suitable for given brands header */
807        console.log(marketCode);
808    }
809})();
810/*
811 * Copyright 2019 Atlas Copco. All rights reserved.
812 */
813;(function () {
814    "use strict";
815
816    const DOWNLOAD_MODAL_HOLDER_CLASS = "download-modal-holder";
817
818    $(".download-button").click(function (ev) {
819        hubspotFormLoadAndAction(ev,this)
820    });
821
822    window.hubspotFormLoadAndAction = function (ev,that) {
823        let $this = $(that);
824        let portalId = $this.data("hubspot_portal_id");
825        let formId = $this.data("hubspot_form_id");
826        let noThankYou = $this.data("no_thank_you_page");
827        let downloadUrlPropertyName = $this.data("download_url_property_name")
828            || "download__url";
829        let downloadTitleName = $this.data("download_title_property_name")
830            || "download_title";
831        if (!!portalId && !!formId) {
832            ev.preventDefault();
833            ev.stopPropagation();
834            let href = $this.attr("href");
835            let title = $this.data("download_title_value");
836            window.hubspot_downloadable_asset_path = href;
837            if (sessionStorage.hubspotdata != null && !!href) {
838                let hiddenFormHtml = document.createElement("script");
839                hiddenFormHtml.innerHTML = formId;
840                window.hbspt.forms.create({
841                    portalId: portalId,
842                    formId: formId
843                }).onReady(function () {
844                    let $form = $("#hsForm_" + formId);
845
846                    $form
847                    .find("input[name='" + downloadTitleName + "']")
848                    .val(title);
849
850                    $form
851                    .find("input[name='" + downloadUrlPropertyName + "']")
852                    .val(href);
853
854                    let prospect = JSON.parse(sessionStorage.hubspotdata);
855                    let keys = Object.keys(prospect);
856                    for (let i = 0; i < keys.length; i++) {
857                        $form.find("input[name='" + keys[i] + "']").val(
858                            prospect[keys[i]]);
859                    }
860                    if (!!href) {
861                        window.open(href, '_blank');
862                    }
863                    $form.trigger("submit");
864                    setTimeout(function () {
865                        $form.remove();
866                    }, 500)
867
868                });
869            } else {
870                let url = $this.data("current_node") + ".modal.html"
871                $.ajax({
872                    type: "GET",
873                    url: url,
874                    responseType: "text/html"
875                }).done(function (responseText) {
876                    $("body").append(responseText);
877                    let $holder = $("." + DOWNLOAD_MODAL_HOLDER_CLASS);
878                    $holder.attr("data-initiator", href);
879                    let form = window.hbspt.forms.create({
880                        portalId: portalId,
881                        formId: formId
882                    });
883
884                    form.onReady(function () {
885                        $("html, body").animate({scrollTop: 0}, 300);
886                        $holder.css({opacity: 1});
887                        let title = $("#form-title").html().trim();
888                        setPostLoadListeners();
889
890                        $holder
891                        .find("input[name='" + downloadTitleName + "']")
892                        .val(title);
893
894                        $holder
895                        .find("input[name='" + downloadUrlPropertyName + "']")
896                        .val(href);
897
898                        let $htmlForm = $holder.find("form");
899                        $htmlForm.submit(function (ev) {
900                            ev.preventDefault();
901                            /* Ugly you may think: reason its done like so is,
902                            the form validation is performed by hubspot code.
903                            We have no control over it nor callback is provided
904                            for eiter on validationFail nor validationPass.
905                            Yet we depend on it if we want to collect
906                            and preserve users input. */
907                            setTimeout(function () {
908                                if ($htmlForm.find(".hs-error-msg").length
909                                    === 0) {
910
911                                    let firstname = !!$htmlForm[0].firstname
912                                        ? $htmlForm[0].firstname.value : '';
913                                    let lastname = !!$htmlForm[0].lastname
914                                        ? $htmlForm[0].lastname.value : '';
915                                    let email = !!$htmlForm[0].email
916                                        ? $htmlForm[0].email.value
917                                        : '';
918                                    let val = JSON.stringify({
919                                        "firstname": firstname,
920                                        "lastname": lastname,
921                                        "email": email,
922                                    });
923                                    sessionStorage.setItem("hubspotdata", val)
924                                    $htmlForm.submit();
925                                    $htmlForm.remove();
926                                    if (!!href) {
927                                        window.open(href, '_blank');
928                                    }
929                                    if (noThankYou) {
930                                        closeModal();
931                                    }
932                                }
933                            }, 500)
934
935                        });
936                    });
937
938                }).fail(function (a, b, c) {
939                    console.log("fail to load registration form");
940                    if (!!href) {
941                        window.open(href, '_blank');
942                    }
943                });
944            }
945        }
946    };
947
948    window.addEventListener("message", function (event) {
949        if (event.data.eventName === "onFormDefinitionFetchError") {
950            closeModal();
951            console.log("Incorrect hubspot values");
952            if (!!window.hubspot_downloadable_asset_path) {
953                window.location = window.hubspot_downloadable_asset_path;
954            }
955        }
956    })
957
958    function setPostLoadListeners() {
959        $("." + DOWNLOAD_MODAL_HOLDER_CLASS).on("click", function (ev) {
960            let $target = $(ev.target);
961            if ($target.hasClass(DOWNLOAD_MODAL_HOLDER_CLASS)) {
962                closeModal();
963            }
964            if($target[0].id === "close-download-modal"){
965                closeModal(this);
966            }
967        })
968    }
969
970    function closeModal() {
971        let $holder = $("." + DOWNLOAD_MODAL_HOLDER_CLASS);
972        let href = $holder.data("initiator");
973        let initiator = $("[href='" + href + "']")[0];
974        if (!!initiator) {
975            let top = initiator.offsetTop - 150;
976            $("html, body").animate({scrollTop: top}, 300);
977        }
978        $holder.remove();
979    }
980
981})();
982
983
984
985
986
987/*
988 * Copyright 2019 Atlas Copco. All rights reserved.
989 */
990;(function () {
991    "use strict";
992    let $this = $("#hubspot-form");
993    if ($this.length > 0) {
994        $(window).on("load", function (ev) {
995            let portalId = $this.data("hubspot_portal_id");
996            let formId = $this.data("hubspot_form_id");
997            let href = $this.data("href");
998            let title = $this.data("download_title_value");
999            let downloadUrlPropertyName = $this.data(
1000                    "download_url_property_name")
1001                || "download__url";
1002            let downloadTitleName = $this.data("download_title_property_name")
1003                || "download_title";
1004            if (!!portalId && !!formId && !!href) {
1005                ev.preventDefault();
1006                ev.stopPropagation();
1007                if (sessionStorage.hubspotdata != null) {
1008                    let hiddenFormHtml = document.createElement("script");
1009                    hiddenFormHtml.innerHTML = formId;
1010                    window.hbspt.forms.create({
1011                        portalId: portalId,
1012                        formId: formId
1013                    }).onReady(function () {
1014                        let $form = $("#hsForm_" + formId);
1015                        $form.find(
1016                            "input[name='" + downloadTitleName + "']").val(
1017                            title);
1018                        $form.find("input[name='" + downloadUrlPropertyName
1019                            + "']").val(href);
1020                        let prospect = JSON.parse(sessionStorage.hubspotdata);
1021                        let keys = Object.keys(prospect);
1022                        for (let i = 0; i < keys.length; i++) {
1023                            $form.find("input[name='" + keys[i] + "']").val(
1024                                prospect[keys[i]]);
1025                        }
1026                        $form.trigger("submit");
1027                        postSend($this);
1028                    });
1029                } else {
1030                    window.hbspt.forms.create({
1031                        portalId: portalId,
1032                        formId: formId
1033                    }).onReady(function ($htmlForm) {
1034                        $this.find(".form-wrapper").append($htmlForm.parent());
1035                        const title = $htmlForm.parent().find("#form-title").text().trim();
1036                        $htmlForm
1037                        .find("input[name='" + downloadTitleName + "']")
1038                        .val(title);
1039
1040                        $htmlForm
1041                        .find("input[name='" + downloadUrlPropertyName + "']")
1042                        .val(href);
1043
1044                        $htmlForm.submit(function (ev) {
1045                            ev.preventDefault();
1046                            setTimeout(function () {
1047                                if ($htmlForm.find(".hs-error-msg").length
1048                                    === 0) {
1049                                    let firstname = !!$htmlForm[0].firstname
1050                                        ? $htmlForm[0].firstname.value : '';
1051                                    let lastname = !!$htmlForm[0].lastname
1052                                        ? $htmlForm[0].lastname.value : '';
1053                                    let email = !!$htmlForm[0].email
1054                                        ? $htmlForm[0].email.value
1055                                        : '';
1056                                    let val = JSON.stringify({
1057                                        "firstname": firstname,
1058                                        "lastname": lastname,
1059                                        "email": email,
1060                                    });
1061                                    sessionStorage.setItem("hubspotdata", val)
1062                                    $htmlForm.submit();
1063                                    postSend($this);
1064                                }
1065                            }, 500);
1066                        });
1067                    });
1068                }
1069            }
1070        });
1071
1072        window.addEventListener("message", function (event) {
1073            if (event.data.eventName === "onFormDefinitionFetchError") {
1074                console.log("Incorrect hubspot values");
1075                if (!!window.hubspot_downloadable_asset_path) {
1076                    window.location = window.hubspot_downloadable_asset_path;
1077                }
1078            }
1079        })
1080
1081        function postSend($parent) {
1082            let downloadButton = $parent.next(".thank-you-can-download");
1083            if ($parent.data("no_thank_you_page")) {
1084                setTimeout(function () {
1085                    $parent.find("#hubspot-form").remove();
1086                }, 500)
1087            }
1088            downloadButton.show();
1089        }
1090    }
1091})();
1092
1093
1094
1095
1096

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.