PageSourceSearch

https://swvasun.com/custom.js?v=29325115741

js swvasun.com collected 2026-09-29 05:15:46 UTC 8,786 bytes, 202 lines download raw bytes

1// directory frame
2document.addEventListener('readystatechange', event => {
3    if (event.target.readyState === "interactive") {
4        if (window.location.href.includes("#frame")) {
5            document.querySelector("#blbodymain").classList.add("directory_frame");
6            // Get the target container
7            var targetContainer = document.querySelector('.cus-directory-133-container');
8            // Make the target container and all its children visible
9            function makeVisible(element) {
10                element.style.display = 'block';
11                Array.from(element.children).forEach(child => {
12                    makeVisible(child);
13                });
14            }
15            makeVisible(targetContainer);
16            // Traverse up and make all parent elements visible
17            var parent = targetContainer.parentElement;
18            while (parent) {
19                parent.style.display = 'block';
20                parent = parent.parentElement;
21            }
22            // Add #frame to all links
23            var links = document.querySelectorAll('a');
24            links.forEach(function (link) {
25                link.href += '#frame';
26            });
27        }
28    }
29});
30function checkLoginStatus(isRestricted) {
31    if (readCookie('Style_s13251')) { // header background - old template
32        document.getElementById('tdHeader').style.backgroundImage = "url(/lib/images/" + readCookie('Style_s13251') + ")";
33    }
34    var url = location.href;
35    var qs = url.substring(url.indexOf('?'));
36    var myParameters = new Array();
37    myParameters = ReadSParameters();
38    var sname = myParameters['sname'];
39    var a = myParameters['a'];
40    var urlhttps = url.startsWith("https");
41    var urlarr = new URL(url);
42    var surl;
43    if (sname.length > 0) {
44        var uint = setInterval(function () {
45            if (readCookie('AppServer')) {
46                clearInterval(uint);
47                surl = readCookie('AppServer');
48                var sframe = "<center class='cus-frame1-loader mt-5 position-absolute w-100'><i aria-hidden='true' style='font-size: 5rem;' class='fa fa-spinner fa-6 fa-spin text-theme'></i></center><iframe id=\"frame1\" style=\"border:none;visibility:hidden\" width=\"100%\" src=\"" + surl + sname + qs + "\" onload=\"document.getElementsByClassName('cus-frame1-loader')[0].style.display = 'none';document.getElementById('frame1').style.visibility = 'visible';window.parent.parent.scrollTo(0,0);iFrameResize({log:true}, '#frame1');\"></iframe>"
49                document.getElementById("MainContent").innerHTML = sframe;
50            }
51        }, 10);
52    } else {
53        if (a == 1) {
54            var s = readCookie('loginStatus');
55            if (s != 'Yes') {
56                var divAccess1 = document.getElementById('divAccess');
57                if (divAccess1 != null) {
58                    document.getElementById('divAccess').style.display = 'none';
59                    OpenLoginPopup();
60                    document.getElementById('divMain').style.display = 'none';
61                }
62                return false;
63            } else {
64                var divMain1 = document.getElementById('divMain');
65                if (divMain1 != null) {
66                    document.getElementById('divMain').style.display = 'block';
67                }
68                return true;
69            }
70        } else {
71            var divMain = document.getElementById('divMain');
72            if (divMain != null) {
73                document.getElementById('divMain').style.display = 'block';
74            }
75            return true;
76        }
77    }
78}
79// sticky column css&js 
80document.addEventListener('readystatechange', event => {
81    if (event.target.readyState === "complete") {
82        if (document.querySelector("[data-sticky]")) {
83            var sp = document.querySelectorAll("[data-sticky]");
84            var sw = window.innerHeight;
85            var sf = () => {
86                if (sp != null) {
87                    sp.forEach(x => {
88                        var ds = x.getAttribute("data-sticky") != "" ? x.getAttribute("data-sticky") : 10;
89                        var st = x.offsetHeight - sw + 10;
90                        if (st >= 0) {
91                            x.style.top = `-${st}px`;
92                        } else if (st < 0) {
93                            if (st > -ds) {
94                                x.style.top = `${Math.abs(st)}px`;
95                            } else {
96                                x.style.top = `${ds}px`;
97                            }
98                        }
99                    });
100                }
101            }
102            sf();
103            setTimeout(() => {
104                sf();
105            }, 500);
106            setTimeout(() => {
107                sf();
108            }, 1000);
109            setTimeout(() => {
110                sf();
111            }, 3000);
112        }
113    }
114});
115// sticky column css&js
116document.addEventListener('readystatechange', event => {
117    if (event.target.readyState === "complete") {
118        if (document.querySelector("[data-sticky]")) {
119            var sp = document.querySelectorAll("[data-sticky]");
120            var sw = window.innerHeight;
121            var sf = () => {
122                if (sp != null) {
123                    sp.forEach(x => {
124                        var ds = x.getAttribute("data-sticky") != "" ? x.getAttribute("data-sticky") : 10;
125                        var st = x.offsetHeight - sw + 10;
126                        if (st >= 0) {
127                            x.style.top = `-${st}px`;
128                        } else if (st < 0) {
129                            if (st > -ds) {
130                                x.style.top = `${Math.abs(st)}px`;
131                            } else {
132                                x.style.top = `${ds}px`;
133                            }
134                        }
135                    });
136                }
137            }
138            sf();
139            setTimeout(() => {
140                sf();
141            }, 500);
142            setTimeout(() => {
143                sf();
144            }, 1000);
145            setTimeout(() => {
146                sf();
147            }, 3000);
148        }
149    }
150});
151function GetGoogleAnalytics(event, eventLabel = '', eventUrl = '') {
152    let eventCategory;
153    // Extract category if ":" exists
154    const indexOfColon = event.indexOf(':');
155    if (indexOfColon !== -1) {
156        eventCategory = event.substring(0, indexOfColon).trim().toUpperCase();
157        eventLabel = eventLabel || event.substring(indexOfColon + 1).trim(); // Default: Part after ':'
158    } else {
159        eventCategory = 'GENERAL'; // Default category (uppercase)
160        eventLabel = eventLabel || event; // Default label
161    }
162    eventUrl = eventUrl || window.location.href; // Default: Current URL
163    // Send event to GA4
164    gtag('event', eventCategory, { // Uppercase event category
165        'event_category': eventCategory,
166        'event_label': eventLabel,
167        'page_title': document.title,
168        'page_location': eventUrl,
169        'page_path': new URL(eventUrl).pathname,
170        'referrer': document.referrer,
171        'event_callback': function () {
172            console.log(`${eventCategory}: ${eventLabel} tracked successfully.`);
173        }
174    });
175}
176// Auto-track different link types when page loads
177document.addEventListener('readystatechange', event => {
178    if (event.target.readyState === "complete") {
179        document.querySelectorAll("a").forEach(link => {
180            let url = link.href;
181            let linkText = link.textContent.trim();
182            // Find an image inside <a> with class starting with "custom_adgroup_"
183            let img = link.querySelector("img[class^='custom_adgroup_']");
184            if (img) {
185                // Add onclick to <a>, using <img> title if available
186                link.setAttribute(`onclick`, `GetGoogleAnalytics('AD: ${img.title || 'Ad Image'}', '${url}');`);
187            }
188            else if (/.*-p[1-9]\d*-[1-9]\d*\.htm$/.test(url)) {
189                // Track article clicks
190                link.setAttribute(`onclick`, `GetGoogleAnalytics('ARTICLE: ${linkText}', '${url}');`);
191            }
192            else if (link.classList.contains("dropdown-item")) {
193                // Track submenu clicks
194                link.setAttribute(`onclick`, `GetGoogleAnalytics('SUBMENU: ${linkText}', '${url}');`);
195            }
196            else if (link.classList.contains("nav-link")) {
197                // Track menu clicks
198                link.setAttribute(`onclick`, `GetGoogleAnalytics('MENU: ${linkText}', '${url}');`);
199            }
200        });
201    }
202});

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.