PageSourceSearch

https://xpal.com/js/footer.js

js xpal.com collected 2026-10-02 15:02:05 UTC 3,962 bytes, 86 lines download raw bytes

1window.onload = function () {
2    function detectDevice() {
3        const userAgent = navigator.userAgent || navigator.vendor || window.opera;
4
5        const isIOS = /iPad|iPhone|iPod/.test(userAgent) ||
6            (navigator.platform && /Mac/.test(navigator.platform) && "ontouchend" in document);
7        const isAndroid = /android/i.test(userAgent);
8        const isDesktop = !isAndroid && !isIOS;
9
10        const iosLinks = document.querySelectorAll('.ios-link-footer');
11        const androidLinks = document.querySelectorAll('.android-link-footer');
12        const apkLinks = document.querySelectorAll('.apk-link-footer');
13        const desktopLinks = document.querySelectorAll('.desktop-link-footer');
14
15        // Hide all buttons first
16        iosLinks.forEach(link => link.style.display = 'none');
17        androidLinks.forEach(link => link.style.display = 'none');
18        apkLinks.forEach(link => link.style.display = 'none');
19        desktopLinks.forEach(link => link.style.display = 'none');
20
21        // Add a small delay before showing the buttons (prevents iOS Safari bugs)
22        setTimeout(() => {
23            if (isAndroid) {
24                androidLinks.forEach(link => link.style.display = 'inline');
25                apkLinks.forEach(link => link.style.display = 'inline');
26            } else if (isIOS) {
27                iosLinks.forEach(link => link.style.display = 'inline');
28            } else {
29                iosLinks.forEach(link => link.style.display = 'inline');
30                androidLinks.forEach(link => link.style.display = 'inline');
31                apkLinks.forEach(link => link.style.display = 'inline');
32                desktopLinks.forEach(link => link.style.display = 'inline');
33            }
34
35            // Force reflow (fix for Safari back-forward cache issue)
36            document.body.offsetHeight;
37        }, 0);
38    }
39
40    detectDevice();
41
42    // Ensure buttons are displayed correctly even after reload (retry if necessary)
43    setTimeout(() => {
44        const visibleButtons = document.querySelectorAll('.ios-link-footer, .android-link-footer, .apk-link-footer, .desktop-link-footer');
45        let isAnyButtonVisible = Array.from(visibleButtons).some(button => button.style.display !== 'none');
46
47        if (!isAnyButtonVisible) {
48            detectDevice();  // Retry if buttons are still hidden
49        }
50    }, 200);
51};
52
53
54//window.onload = function () {
55//    function detectDevice() {
56//        const userAgent = navigator.userAgent || navigator.vendor || window.opera;
57
58//        const isAndroid = /android/i.test(userAgent);
59//        const isIOS = /iPad|iPhone|iPod/.test(userAgent) ||
60//            (navigator.platform.includes("Mac") && "ontouchend" in document);
61//        const isDesktop = !isAndroid && !isIOS;
62
63//        const iosLinks = document.querySelectorAll('.ios-link-footer');
64//        const androidLinks = document.querySelectorAll('.android-link-footer');
65//        const apkLinks = document.querySelectorAll('.apk-link-footer');
66
67//        // First, hide all buttons to avoid incorrect displays
68//        iosLinks.forEach(link => link.style.display = 'none');
69//        androidLinks.forEach(link => link.style.display = 'none');
70//        apkLinks.forEach(link => link.style.display = 'none');
71
72//        // Then, show only the relevant buttons
73//        if (isAndroid) {
74//            androidLinks.forEach(link => link.style.display = 'inline');
75//            apkLinks.forEach(link => link.style.display = 'inline');
76//        } else if (isIOS) {
77//            iosLinks.forEach(link => link.style.display = 'inline');
78//        } else {
79//            iosLinks.forEach(link => link.style.display = 'inline');
80//            androidLinks.forEach(link => link.style.display = 'inline');
81//            apkLinks.forEach(link => link.style.display = 'inline');
82//        }
83//    }
84
85//    detectDevice();
86//};

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.