PageSourceSearch

https://www.solarwatt.com/_Resources/Static/Packages/Solarwatt.Website/connectionSpeedTest.js?bust=f832a4aa

js solarwatt.com collected 2026-10-01 16:03:03 UTC 2,653 bytes, 76 lines download raw bytes

1const arrTimes = [];
2let i = 0; // start
3const timesToTest = 5;
4const testImage = window.location.protocol + '//' + window.location.host + "/_Resources/Static/Packages/Solarwatt.Website/Animations/Battery/HeaderSnippet.webp?bust=" + Date.now();
5const dummyImage = new Image();
6
7let isTriggered = false;
8
9if(window.innerWidth > 767) {
10    testLatencyWhenHovered();
11}
12
13function testLatencyWhenHovered() {
14    var links = document.querySelectorAll('.animation-link');
15
16    const observer = new IntersectionObserver(entries => {
17        entries.forEach(entry => {
18          if (entry.isIntersecting && !isTriggered) {
19            testLatency(function(avg){
20                localStorage.setItem('pageSpeed', avg);
21            });
22            observer.unobserve(entry.target)
23          }
24        })
25      })
26
27    links.forEach((link) => {
28        // menu links will be triggered on menu hover
29        if (link.classList.contains('menu__link')) {
30            if (!isTriggered || true) {
31                // hover for desktop
32                link.closest('.nav-item.first-level')?.addEventListener('mouseover', function (e) {
33                    testLatency(function(avg){
34                        localStorage.setItem('pageSpeed', avg);
35                    });
36                }, { once: true } )
37                // click for mobil
38                link.closest('.nav-item.first-level')?.addEventListener('click', function (e) {
39                    testLatency(function(avg){
40                        localStorage.setItem('pageSpeed', avg);
41                    });
42                }, { once: true } )
43            }
44        } else {
45            // other links will be triggered with IntersectionOberserver
46            observer.observe(link);
47        }
48    } );
49}
50
51
52/** test and average time took to download image from server, called recursively timesToTest times */
53function testLatency(cb) {
54    if (!isTriggered) {
55        isTriggered = true;
56        var tStart = new Date().getTime();
57        if (i < timesToTest - 1) {
58            dummyImage.src = testImage + '?t=' + tStart;
59            dummyImage.onload = function () {
60                var tEnd = new Date().getTime();
61                var tTimeTook = tEnd - tStart;
62                arrTimes[i] = tTimeTook;
63                testLatency(cb);
64                i++;
65            };
66        } else {
67            /** calculate average of array items then callback */
68            var sum = arrTimes.reduce(function (a, b) {
69                return a + b;
70            });
71            var avg = sum / arrTimes.length;
72            cb(avg);
73            localStorage.setItem('pageSpeed', avg.toString());
74        }
75    }
76}

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.