PageSourceSearch

https://www.swissrefoundation.org/.resources/swissre-web/webresources/js/mgnl.js

js swissrefoundation.org collected 2026-10-02 14:37:04 UTC 4,422 bytes, 83 lines download raw bytes

1// SRWIQ-10: IE11 not supports .endsWith method, hence the polyfill below
2if (!String.prototype.endsWith) {
3    String.prototype.endsWith = function(search, this_len) {
4        if (this_len === undefined || this_len > this.length) {
5            this_len = this.length;
6        }
7        return this.substring(this_len - search.length, this_len) === search;
8    };
9  }
10
11var currentURL = location.href;
12var ckeditorLinks=document.querySelectorAll(".richtext a"),
13    lang,
14    lngsToExlude=["/en/","/de/","/fr/","/es/","/pt/","/zh/","/zh_CN/","/zh_TW/","/ja/","/it/","/ko/"],
15    regions = ["japan", "australia-newzealand", "brasil-seguros", "mexico-seguros", "brasil", "colombia",
16        "mexico", "australia_newzealand", "china", "korea"],
17    sites = ["swissre", "corporatesolutions"],
18    urlRegion = "";
19
20for(var x=0;x<regions.length;x++) {
21    if(currentURL.toLowerCase().toString().indexOf("/" + regions[x] + "/") > -1 ){
22        urlRegion = "/" + regions[x] + "/";
23        break
24    }
25}
26
27for(var i=0;i<ckeditorLinks.length;i++) {
28    var ckeditorLink = ckeditorLinks[i],
29        ckeditorLinkHref = ckeditorLink.href,
30        isInternalLinkRegionalSite = true;
31
32    if(ckeditorLinkHref.endsWith(".pdf") && !ckeditorLink.hasAttribute("target")) {
33        ckeditorLink.setAttribute("target","_blank");
34    }
35
36    if(!ckeditorLinkHref.includes(urlRegion) && !ckeditorLink.pathname.includes("http")) {
37        isInternalLinkRegionalSite = false;
38    }
39
40    for(var e=0;e<lngsToExlude.length;e++) {
41        lang = lngsToExlude[e];
42        if(ckeditorLinkHref.indexOf(lang) > -1
43            &&
44            (ckeditorLink.pathname.match("swissre.com/|/swissre|/corporatesolutions|pensionskasse") && ckeditorLink.pathname.includes("http")
45            ||
46            isInternalLinkRegionalSite === false)
47            )
48                {
49                    ckeditorLinkHref = ckeditorLinkHref.replace(lang,"/");
50                    ckeditorLink.href= ckeditorLinkHref;
51                    break
52                }
53    }
54
55}
56
57function getReadyForEQSSubscription(e){
58    var n=e.value,o=e.getAttribute("attrurl"),t=e.checked;""!=n&&""!=o&&
59    document.getElementById("newsletterForm").addEventListener("submit",function(e){if(t){
60        var d,c=new XMLHttpRequest,p=[];
61        p.push(encodeURIComponent("firstname")+"="+encodeURIComponent(document.getElementById("firstName").value)),
62        p.push(encodeURIComponent("lastname")+"="+encodeURIComponent(document.getElementById("lastName").value)),
63        p.push(encodeURIComponent("email")+"="+encodeURIComponent(document.getElementById("emailAddress").value)),
64        p.push(encodeURIComponent("company")+"="+encodeURIComponent(document.getElementById("company").value)),
65        p.push(encodeURIComponent("https")+"="+encodeURIComponent("1")),
66        p.push(encodeURIComponent("formID")+"="+encodeURIComponent("subscribeForm")),
67        p.push(encodeURIComponent("requestPageID")+"="+encodeURIComponent(n)),
68        p.push(encodeURIComponent("salutation")+"="+encodeURIComponent("1")),
69        p.push(encodeURIComponent("eqs_nonce")+"="+encodeURIComponent("0")),
70        p.push(encodeURIComponent("sessionID")+"="+encodeURIComponent("c6854ca000ea046ad1680be65d06f26768d2c038")), 
71        p.push(encodeURIComponent("action")+"="+encodeURIComponent("subscribe")), 
72        p.push(encodeURIComponent("category")+"="+encodeURIComponent("Website Registrations")), 
73        p.push(encodeURIComponent("distributionlist")+"="+encodeURIComponent("Website Registrations")), 
74        p.push(encodeURIComponent("prefered_language")+"="+encodeURIComponent("English")),
75        d=p.join("&").replace(/%20/g,"+"),
76        // c.addEventListener("load",function(e){console.log(c.response)}),
77        // c.addEventListener("error",function(e){console.log(c.response)}),
78        console.log("Sending data to: ",o),
79        // console.log("Data being sent: ",d),
80        c.open("POST",o),
81        c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),
82        c.send(d)}})}
83function changeEventsOverviewStatusFilter(t){ if(t.value == "future" && t.checked) { document.getElementById('status_past').checked = false; } else if(t.value == "past" && t.checked) { document.getElementById('status_future').checked = false; document.getElementById('status_live').checked = false;} else if(t.value == "live" && t.checked) { document.getElementById('status_past').checked = false; }}

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.