PageSourceSearch

https://www.adbutler.com/blog/js/blog.js?v=e4da3b7fbbce2345d7772b0674a318d5

js adbutler.com collected 2026-09-24 08:33:51 UTC 5,479 bytes, 155 lines download raw bytes

1
2
3(function (_w, _s) {
4    var document = _w.document,
5        app = {},
6        _logMessage = function (m) {
7            if (!app.logging) {
8                return;
9            }
10
11            m = '[abWebFlow] ' + m;
12            _w.console && _w.console.log && _w.console.log(m);
13        },
14        _logObject = function (obj) {
15            if (!app.logging) {
16                return;
17            }
18
19            var m = '[abWebFlow Object]';
20            _w.console && _w.console.log && _w.console.log(m, obj);
21        };
22
23    app = {
24        logging: false,
25        makingRequest: false,
26
27        init: function () {
28            _logMessage('Init abWebflow app...');
29            if (app.getCookie('adbutlerNewsletterSignUpDone') !== 'yes') {
30                app.ctaHandler.init();
31            }
32        },
33
34        setCookie: function (name, value, days) {
35            var expires = '';
36            if (days) {
37                var date = new Date();
38                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
39                expires = '; expires=' + date.toUTCString();
40            }
41            document.cookie = name + '=' + (value || '') + expires + '; path=/';
42        },
43
44        getCookie: function (name) {
45            var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
46            return v ? v[2] : '';
47        },
48
49        ctaHandler: {
50            toasterEligible: '',
51            modalEligible: '',
52            toasterViewable: '',
53            modalViewable: '',
54            toasterRedirect: '',
55            modalRedirect: '',
56
57            init: function() {
58                if (typeof _w.abCTAData !== 'undefined') {
59                    app.ctaHandler.toasterEligible = typeof _w.abCTAData.toasterEligible !== 'undefined' ? _w.abCTAData.toasterEligible : '';
60                    app.ctaHandler.modalEligible = typeof _w.abCTAData.modalEligible !== 'undefined' ? _w.abCTAData.modalEligible : '';
61                    app.ctaHandler.toasterViewable = typeof _w.abCTAData.toasterViewable !== 'undefined' ? _w.abCTAData.toasterViewable : '';
62                    app.ctaHandler.modalViewable = typeof _w.abCTAData.modalViewable !== 'undefined' ? _w.abCTAData.modalViewable : '';
63                    app.ctaHandler.toasterRedirect = typeof _w.abCTAData.toasterRedirect !== 'undefined' ? _w.abCTAData.toasterRedirect : '';
64                    app.ctaHandler.modalRedirect = typeof _w.abCTAData.modalRedirect !== 'undefined' ? _w.abCTAData.modalRedirect : '';
65                }
66
67                app.ctaHandler.showToaster();
68            },
69
70            showToaster: function() {
71                var toastContainer = document.querySelector('.toast-container-blog');
72                if (toastContainer) {
73                    toastContainer.style.display = 'block';
74                }
75
76                // call the eligible
77                app.ctaHandler.xmlHttpRequest(app.ctaHandler.toasterEligible);
78                app.ctaHandler.xmlHttpRequest(app.ctaHandler.modalEligible);
79                app.ctaHandler.xmlHttpRequest(app.ctaHandler.toasterViewable);
80            },
81
82            hideToaster: function () {
83                var toastContainer = document.querySelector('.toast-container-blog');
84                if (toastContainer) {
85                    toastContainer.style.display = 'none';
86                }
87            },
88
89            xmlHttpRequest: function (url) {
90                if (url === '') {
91                    return;
92                }
93                const xhttp = new XMLHttpRequest();
94                xhttp.onreadystatechange = async function () {
95                    if (this.readyState == 4 && this.status == 200) {
96                        // sent
97                    }
98                };
99                xhttp.open("GET", url, true);
100                xhttp.send();
101            },
102
103            displaySubscribeModal: function () {
104                var modal = document.getElementById('subscribeModal');
105                if (modal) {
106                    var modalInstance = new bootstrap.Modal(modal);
107                    modalInstance.show();
108                }
109
110                app.ctaHandler.xmlHttpRequest(app.ctaHandler.modalViewable);
111                app.ctaHandler.xmlHttpRequest(app.ctaHandler.toasterRedirect);
112            }
113        }
114    };
115
116    _w.abCTAHandler = app;
117    document.addEventListener('DOMContentLoaded', function() {
118        app.init();
119    });
120
121}(window, screen));
122
123
124/**
125 * Calls that rely on jquery for the blog page base (adbutlerBlogPageBase.class)
126 *
127 * They were moved here so that they can be deferred.
128  */
129
130// moved from adbutlerBlogPageBase->displayPanelSearchBox()
131document.addEventListener('DOMContentLoaded', function() {
132    var searchBox = document.getElementById('top-panel-search');
133    var searchButton = document.getElementById('top-panel-search-btn');
134
135    if (searchButton) {
136        searchButton.addEventListener('click', function(e) {
137            if (searchBox.value.length === 0) {
138                e.preventDefault();
139                searchBox.focus();
140            }
141        });
142    }
143
144    if (searchBox) {
145        searchBox.addEventListener('focus', function() {
146            this.setAttribute('placeholder', '');
147            searchButton.style.backgroundColor = 'white';
148        });
149
150        searchBox.addEventListener('blur', function() {
151            this.setAttribute('placeholder', 'Search');
152            searchButton.style.backgroundColor = '#F6F6F7';
153        });
154    }
155});

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.