PageSourceSearch

https://celoscan.io/assets/js/hs.core.js?v=26.9.3.0

js celoscan.io collected 2026-09-25 19:18:40 UTC 9,001 bytes, 252 lines download raw bytes

1/**
2 * HSCore -
3 *
4 * @author HtmlStream
5 * @version 1.0
6 */
7;
8(function ($) {
9
10    'use strict';
11
12    $.HSCore = {
13
14        /**
15         *
16         *
17         * @param
18         *
19         * @return
20         */
21        init: function () {
22
23            $(document).ready(function (e) {
24                // Botostrap Tootltips
25                $('[data-toggle="tooltip"]').tooltip({
26                    trigger: 'hover'
27                });
28
29                // Bootstrap Popovers
30                $('[data-toggle="popover"]').popover({
31                    trigger: 'hover'
32                });
33
34                // Dark Mode
35                $.HSCore.helpers.darkMode();
36
37                // Detect Internet Explorer (IE)
38                $.HSCore.helpers.detectIE();
39
40                // Bootstrap Navigation Options
41                $.HSCore.helpers.bootstrapNavOptions.init();
42
43            });
44
45        },
46
47        /**
48         *
49         *
50         * @var
51         */
52        components: {},
53
54        /**
55         *
56         *
57         * @var
58         */
59        helpers: {
60            Math: {
61                getRandomValueFromRange: function (startPoint, endPoint, fixed) {
62                    var fixedInner = fixed ? fixed : false;
63                    Math.random();
64                    return fixedInner ? (Math.random() * (endPoint - startPoint) + startPoint) : (Math.floor(Math.random() * (endPoint - startPoint + 1)) + startPoint);
65                }
66            },
67
68            /**
69             * Dark Mode
70             *
71             */
72            darkMode: function () {
73
74                $('#darkModaBtn').on('click', function () {
75                    $('body').toggleClass('dark-mode');
76
77                    
78
79                    if ($('body').hasClass('dark-mode')) {                      
80                        writeCookie("displaymode", "dark");
81                        $('#darkModaBtnIcon').toggleClass('fa-moon fa-sun');
82                        $('#logo-header').attr('src', '/images/logo-white.svg?v=0.0.4');
83                        window.mode = 'dark';
84                        $("iframe").each(function () {
85                            var src = $(this).contents().find('body');
86                            src.addClass('dark-mode');
87                            src.attr('style', 'background: #112641 !important;');
88
89                            var subIframe = $(this).contents().find('iframe');
90
91                            if (subIframe.length > 0) {
92                                var subIframeBody = $(subIframe).contents().find('body');
93
94                                var style = 'background: #112641 !important;';
95                                subIframeBody.addClass('dark-mode');
96                                subIframeBody.attr('style', style);
97                            }
98                        });
99                       
100                        $('#dappBody').css('background-image', 'url("/assets/svg/illustrations/dapp-bg-dark.svg")');
101
102                       
103
104                    } else {
105                        writeCookie("displaymode", "normal");
106                        $('#darkModaBtnIcon').toggleClass('fa-sun fa-moon');
107                        $('#logo-header').attr('src', '/images/logo-ether.svg?v=0.0.7');        
108                        window.mode = 'normal';
109                        $("iframe").each(function () {
110                            var src = $(this).contents().find('body');
111
112                            src.attr('class', '');
113                            src.removeAttr("style");
114
115                            var subIframe = $(this).contents().find('iframe');
116
117                            if (subIframe.length > 0) {
118                                var subIframeBody = $(subIframe).contents().find('body');
119
120                                subIframeBody.attr('class', '');
121                                subIframeBody.removeAttr("style");
122                            }     
123                        });
124
125                        $('#dappBody').css('background-image', 'url("/assets/svg/illustrations/dapp-bg.svg")');
126                    }
127
128                    if (typeof loaddisqus !== 'undefined' && $.isFunction(loaddisqus)) {
129                        if (disqusloaded === true) {
130                            disqusloaded = false;
131                            loaddisqus();
132                        }                        
133                    }
134                   
135                });
136
137                function writeCookie(key, value, days) {
138                    var date = new Date();                  
139                    days = days || 365;
140                    date.setTime(+ date + (days * 86400000));
141
142                    window.document.cookie = key + "=" + value + "; expires=" + date.toGMTString() + "; path=/";
143
144                    return value;
145                }
146            },
147      
148            /**
149             * Detect Internet Explorer (IE)
150             *
151             * @return version of IE or false, if browser is not Internet Explorer
152             */
153
154            detectIE: function () {
155                var ua = window.navigator.userAgent;
156
157                var trident = ua.indexOf('Trident/');
158                if (trident > 0) {
159                    // IE 11 => return version number
160                    var rv = ua.indexOf('rv:');
161                    var ieV = parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
162                    document.querySelector('body').className += ' IE';
163                }
164
165                var edge = ua.indexOf('Edge/');
166                if (edge > 0) {
167                    // IE 12 (aka Edge) => return version number
168                    var ieV = parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
169                    document.querySelector('body').className += ' IE';
170                }
171
172                // other browser
173                return false;
174            },
175
176
177            /**
178             * Bootstrap navigation options
179             *
180             */
181            bootstrapNavOptions: {
182                init: function () {
183                    this.mobileHideOnScroll();
184                },
185
186                mobileHideOnScroll: function () {
187                    var $collection = $('.navbar');
188                    if (!$collection.length) return;
189
190                    var $w = $(window),
191                        breakpointsMap = {
192                            'sm': 576,
193                            'md': 768,
194                            'lg': 992,
195                            'xl': 1200
196                        };
197
198                    $('body').on('click.HSMobileHideOnScroll', '.navbar-toggler', function (e) {
199                        var $navbar = $(this).closest('.navbar');
200
201                        if ($navbar.length) {
202                            $navbar.data('mobile-menu-scroll-position', $w.scrollTop());
203                        }
204                        e.preventDefault();
205                    });
206
207                    $w.on('scroll.HSMobileHideOnScroll', function (e) {
208                        $collection.each(function (i, el) {
209                            var $this = $(el), $toggler, $nav, offset, $hamburgers, breakpoint;
210                            if ($this.hasClass('navbar-expand-xl')) breakpoint = breakpointsMap['xl'];
211                            else if ($this.hasClass('navbar-expand-lg')) breakpoint = breakpointsMap['lg'];
212                            else if ($this.hasClass('navbar-expand-md')) breakpoint = breakpointsMap['md'];
213                            else if ($this.hasClass('navbar-expand-xs')) breakpoint = breakpointsMap['xs'];
214
215                            if ($w.width() > breakpoint) return;
216
217                            $toggler = $this.find('.navbar-toggler');
218                            $nav = $this.find('.navbar-collapse');
219
220                            if (!$nav.data('mobile-scroll-hide')) return;
221
222                            if ($nav.length) {
223                                offset = $this.data('mobile-menu-scroll-position');
224
225                                if (Math.abs($w.scrollTop() - offset) > 40 && $nav.hasClass('show')) {
226                                    $toggler.trigger('click');
227                                    $hamburgers = $toggler.find('.is-active');
228                                    if ($hamburgers.length) {
229                                        $hamburgers.removeClass('is-active');
230                                    }
231                                }
232                            }
233                        });
234                    });
235                }
236            }
237        },
238
239        /**
240         *
241         *
242         * @var
243         */
244        settings: {
245            rtl: false
246        }
247
248    };
249
250    $.HSCore.init();
251
252})(jQuery);

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.