PageSourceSearch

https://eservice.nationalgeneral.com/service/lib/browserservice.js

js nationalgeneral.com collected 2026-10-01 12:32:58 UTC 3,517 bytes, 106 lines download raw bytes

1window.browserService = {
2    getClientSize: function () {
3        return {
4            width: window.innerWidth, height: window.innerHeight
5        };
6    },
7    getDocumentProperty: function (name) {
8        return document[name];
9    },
10    hideAllPoppers: function () {
11        // Poppers
12        document.querySelectorAll('natgen-popper').forEach(function (popper) {
13            popper.show = false;
14        });
15
16        // Hamburger Buttons
17        document.querySelectorAll('natgen-hamburger-button').forEach(function (hamburgerButton) {
18            hamburgerButton.opened = false;
19        });
20
21        // Hamburger Buttons in nav bars
22        document.querySelectorAll('natgen-nav-bar').forEach(function (navBar) {
23            navBar.shadowRoot.querySelectorAll('natgen-hamburger-button').forEach(function (hamburgerButton) {
24                hamburgerButton.opened = false;
25            });
26        });
27    },
28    scrollTo: function (position) {
29        window.scrollTo(0, position);
30    },
31    downloadData: function (data, name) {
32        fetch(data)
33            .then(function (response) {
34                return response.blob();
35            })
36            .then(function (blob) {
37                var a = document.createElement('a');
38                a.href = URL.createObjectURL(blob);
39                a.download = name;
40                a.target = '_blank';
41                document.body.appendChild(a);
42                a.click();
43                document.body.removeChild(a);
44            });
45    },
46    checkNavigationHistory: function () {
47        return (history.length > 1);
48    },
49    goBack: function () {
50        if (history.length > 1) history.back();
51    },
52    downloadFileFromStream: async function (fileName, contentStreamReference) {
53        const arrayBuffer = await contentStreamReference.arrayBuffer();
54        const blob = new Blob([arrayBuffer]);
55        const url = URL.createObjectURL(blob);
56
57        const anchorElement = document.createElement('a');
58        anchorElement.href = url;
59        if (fileName)
60            anchorElement.download = fileName;
61        anchorElement.click();
62        anchorElement.remove();
63
64        URL.revokeObjectURL(url);
65    },
66    getDesignSystemProperty: function (name) {
67        return JSON.stringify(NatGenUI[name]);
68    },
69    getUserBrowsingDevice: function () {
70        var device = "";
71
72        if (/iphone|ipad/i.test(navigator.userAgent.toLowerCase()))
73                device = "iOS";
74        else if (/android/i.test(navigator.userAgent.toLowerCase()))
75            device = "android";
76        else
77            device = "web";
78
79        return device;
80    },
81    openNewWindow: async function (url, title, size ) {
82        window.open(url, title, size);
83        return false;
84    },
85    getClientHour: function () {
86        return new Date().getHours();
87    },
88    callApiEndpoint: async function (url) {
89        try {
90            console.log("URL is: " + url);
91            let response = await fetch(url, {
92                method: 'GET',
93                headers: {
94                    'Content-Type': 'text/plain'
95                }
96            });
97            console.log("Response: " + response);
98            let data = await response.text();
99            console.log("Data: " + data);
100            return data;
101        } catch (error) {
102            console.error('Error calling API:', error);
103            return null;
104        }
105    }
106};

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.