PageSourceSearch

https://erply.com/necessary-js?v=0

js erply.com collected 2026-09-24 17:47:49 UTC 3,036 bytes, 98 lines download raw bytes

1     // show cookies popup if cookie doesn't exist in localstorage
2    if (!localStorage.getItem('consentGranted')) {
3        showCookiesPopup();
4    } 
5
6    // if user accepts cookies
7    if (document.getElementById('accept-cookies')) {
8        document.getElementById('accept-cookies').addEventListener('click', function () {
9            localStorage.setItem("consentGranted", "true");
10
11            hideCookiesPopup();
12        });        
13    }
14
15    // if user declines cookies
16    if (document.getElementById('opt-out')) {
17        document.getElementById('opt-out').addEventListener('click', function () {
18            localStorage.setItem("consentGranted", "false");
19            hideCookiesPopup();
20        })
21    }
22
23
24
25
26// function to display banner
27function showCookiesPopup() {
28    if (document.getElementById('cookies-popup')) {
29        document.getElementById('cookies-popup').style.display = 'inline-flex';
30    }
31}
32
33// function to hide banner
34function hideCookiesPopup() {
35    if (document.getElementById('cookies-popup')) {
36        document.getElementById('cookies-popup').style.display = 'none';
37
38    }
39}
40
41
42
43
44
45
46
47document.addEventListener('DOMContentLoaded', function () {
48    const contentBody = document.querySelector('.contentBody');
49
50    if (contentBody) { // if it is a blog post page
51        const canonicalTag = document.querySelector('link[rel="canonical"]');
52        if (canonicalTag) {
53            const currentUrl = window.location.origin + window.location.pathname;
54            canonicalTag.setAttribute("href", currentUrl);
55        }
56
57        let originalContent = contentBody.innerHTML;
58        let modifiedContent = originalContent
59            .replace(/<\/a><br>/g, '</a>')
60            .replace(/<\/strong><br>/g, '</strong>')
61            .replace(/<br><strong>/g, '<strong>')
62            .replace(/<span>\.<\/span>/g, '')
63            .replace(/<span>\. <\/span>/g, '')
64            .replace(/\[caption[^\]]*]/g, '')
65            .replace(/\[\/caption]/g, '')
66            .replace(/<\/span><br>/g, '</span>')
67            .replace(/<br><b>/g, '<b>')
68            .replace(/<\/b><br>/g, '</b>')
69            .replace(/-page/g, '')
70            .replace(/staticFileLink/g, '.Tools.StaticLink')
71            .replace(/https:\/\/automat-eu\.erply\.com\/b2b\/533252\/en\//g, 'https://erply.com/')
72            .replace(/login\.erply\.com\/sign-up/g, 'go.erply.com/sign-up')
73            .replace(/login\.erply\.com/g, 'go.erply.com');
74
75
76        contentBody.innerHTML = modifiedContent;
77
78        const links = contentBody.querySelectorAll('a');
79        links.forEach(function (link) {
80            const href = link.getAttribute('href');
81            if (href && !href.includes('erply.com')) {
82                link.setAttribute('target', '_blank');
83            }
84        });
85
86        let images = document.querySelectorAll('img');
87
88        images.forEach(function (image) {
89            image.addEventListener('error', function () {
90                image.style.display = 'none';
91            });
92        });
93
94        
95
96    }
97
98});

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.