PageSourceSearch

https://bcon.global/app/themes/crypto/js/custom.js?ver=1785330769

js bcon.global collected 2026-10-02 19:00:12 UTC 14,192 bytes, 417 lines download raw bytes

1$('input#filter').on('keyup', function () {
2    let val = $(this).val()
3    if (val.length > 2) {
4        $.ajax({
5            url: $('#live-search').attr('action'),
6            method: 'post',
7            data: {
8                action: 'search_faq',
9                search: val
10            },
11            success: function (resp) {
12                $('.show-search ul').html(resp.results)
13            }
14        })
15    } else {
16        $('.show-search ul').html('')
17    }
18})
19
20$('#live-search').on('submit', function (e) {
21    e.preventDefault();
22    let val = $('input#filter').val()
23    if (val.length > 2) {
24        let search = '?search=' + val
25        let url = location.protocol + '//' + location.host + location.pathname;
26        window.location.href = url + search;
27    }
28})
29
30
31jQuery(function ($) {
32    const collapseBranch = function ($root) {
33        $root.removeClass('is-open');
34        $root.find('li').removeClass('is-open');
35        $root.find('.sub-menu').stop(true, true).hide();
36        $root.find('.mobile-submenu-toggle').attr('aria-expanded', 'false');
37    };
38
39    const openBranch = function ($item, $button, $panel) {
40        $item.addClass('is-open');
41        $button.attr('aria-expanded', 'true');
42        $panel.stop(true, true).slideDown(200);
43    };
44
45    const closeBranch = function ($item, $button, $panel) {
46        $item.removeClass('is-open');
47        $button.attr('aria-expanded', 'false');
48        $panel.stop(true, true).slideUp(200);
49    };
50
51    $(document).on('click', '.mobile-drawer-nav .mobile-submenu-toggle', function (e) {
52        e.preventDefault();
53        e.stopPropagation();
54
55        const $button = $(this);
56        const $item = $button.closest('li.menu-item-has-children');
57        const $panel = $item.children('.sub-menu');
58        const isOpen = $button.attr('aria-expanded') === 'true';
59
60        const $siblings = $item.siblings('.menu-item-has-children');
61        collapseBranch($siblings);
62
63        if (isOpen) {
64            closeBranch($item, $button, $panel);
65            return;
66        }
67
68        openBranch($item, $button, $panel);
69    });
70
71    $(document).on('touchend', '.mobile-drawer-nav .mobile-submenu-toggle', function (e) {
72        e.preventDefault();
73        $(this).trigger('click');
74    });
75
76    $(document).on('click', '.close-menu', function () {
77        collapseBranch($('.menu .mobile-drawer-nav li.menu-item-has-children'));
78    });
79});
80
81// Mobile drawer submenu fallback: works even if jQuery handlers fail to bind.
82document.addEventListener('DOMContentLoaded', function () {
83    const mobileDrawer = document.querySelector('.mobile-drawer-nav');
84    if (!mobileDrawer) {
85        return;
86    }
87
88    const collapseBranch = function (root) {
89        const items = root.querySelectorAll('li.menu-item-has-children');
90        items.forEach(function (item) {
91            item.classList.remove('is-open');
92            const toggle = item.querySelector(':scope > .mobile-submenu-toggle');
93            const panel = item.querySelector(':scope > .sub-menu');
94
95            if (toggle) {
96                toggle.setAttribute('aria-expanded', 'false');
97            }
98            if (panel) {
99                panel.style.display = 'none';
100            }
101        });
102    };
103
104    // Remove non-functional chevrons for items that have no rendered submenu entries.
105    mobileDrawer.querySelectorAll('li.menu-item-has-children').forEach(function (item) {
106        const toggle = item.querySelector(':scope > .mobile-submenu-toggle');
107        const panel = item.querySelector(':scope > .sub-menu');
108        const hasChildren = panel && panel.querySelector('li');
109
110        if (!hasChildren) {
111            item.classList.remove('menu-item-has-children');
112            if (toggle) {
113                toggle.remove();
114            }
115            if (panel) {
116                panel.remove();
117            }
118        }
119    });
120
121    mobileDrawer.addEventListener('click', function (event) {
122        const button = event.target.closest('.mobile-submenu-toggle');
123        if (!button || !mobileDrawer.contains(button)) {
124            return;
125        }
126
127        event.preventDefault();
128        event.stopPropagation();
129
130        const item = button.closest('li.menu-item-has-children');
131        if (!item) {
132            return;
133        }
134
135        const panel = item.querySelector(':scope > .sub-menu');
136        if (!panel) {
137            return;
138        }
139
140        const isOpen = button.getAttribute('aria-expanded') === 'true';
141
142        item.parentElement.querySelectorAll(':scope > li.menu-item-has-children').forEach(function (sibling) {
143            if (sibling === item) {
144                return;
145            }
146
147            sibling.classList.remove('is-open');
148            const siblingToggle = sibling.querySelector(':scope > .mobile-submenu-toggle');
149            const siblingPanel = sibling.querySelector(':scope > .sub-menu');
150
151            if (siblingToggle) {
152                siblingToggle.setAttribute('aria-expanded', 'false');
153            }
154            if (siblingPanel) {
155                siblingPanel.style.display = 'none';
156            }
157        });
158
159        if (isOpen) {
160            item.classList.remove('is-open');
161            button.setAttribute('aria-expanded', 'false');
162            panel.style.display = 'none';
163            return;
164        }
165
166        item.classList.add('is-open');
167        button.setAttribute('aria-expanded', 'true');
168        panel.style.display = 'block';
169    });
170
171    document.querySelectorAll('.close-menu').forEach(function (closeButton) {
172        closeButton.addEventListener('click', function () {
173            collapseBranch(mobileDrawer);
174        });
175    });
176});
177
178$(window).scroll(function () {
179    // End of the document reached?
180    if ($(document).height() - $(this).height() == $(this).scrollTop()) {
181        let page = $('[data-page]').data('page');
182        let max = $('[data-pages]').data('pages');
183        let next = parseInt(page) + 1;
184
185        if(next <= parseInt(max)) {
186            $.ajax({
187                url: $('#live-search').attr('action'),
188                method: 'post',
189                data: {
190                    action: 'search_faq_page',
191                    page: next,
192                    search: $('[data-search]').data('search')
193                },
194                success: function(resp) {
195                    $('[data-page]').data('page', next)
196                    $('.faq-search-result ul').append(resp)
197                }
198            })
199
200        }
201    }
202});
203
204
205jQuery(function() {
206    initSameHeight();
207    initYoutube();
208});
209
210function initYoutube() {
211    // declare variables
212    let YTApiScript = document.createElement('script');
213    let YTPlayerVars = {
214        autoplay: 1,
215        autohide: 1,
216        modestbranding: 1,
217        rel: 0,
218        showinfo: 0,
219        controls: 0,
220        disablekb: 1,
221        enablejsapi: 0,
222        fs: 0,
223        loop: 1,
224        iv_load_policy: 3
225    };
226    // add youtube api
227    YTApiScript.src = 'https://www.youtube.com/player_api';
228    document.body.appendChild(YTApiScript);
229
230
231    function getAspectRatio(videoId, callback) {
232        var apiUrl = "https://www.googleapis.com/youtube/v3/videos";
233        var apiKey = "AIzaSyCIdSQZddFFql2dUG5xsknoz6Nb5rGJ2D8"; // Replace with your YouTube API key
234        var videoUrl = "https://www.youtube.com/watch?v=" + videoId;
235
236        // Fetch video details using YouTube Data API
237        fetch(`${apiUrl}?part=snippet&id=${videoId}&key=${apiKey}`)
238            .then(response => response.json())
239            .then(data => {
240                // Extract aspect ratio from video details
241                let aspectRatio = 1;
242                var width = data.items[0].snippet.thumbnails.maxres.width;
243                var height = data.items[0].snippet.thumbnails.maxres.height;
244
245                if (width && height) {
246                    aspectRatio = width / height;
247                }
248                callback(aspectRatio);
249            })
250            .catch(error => console.error("Error fetching video details:", error));
251    }
252
253    function setContainerPadding(videoId, playerContainer) {
254        getAspectRatio(videoId, function (aspectRatio) {
255            playerContainer.style.paddingBottom = `${100 / aspectRatio}%`;
256            playerContainer.classList.add('preview-youtube');
257        });
258    }
259
260    function onYouTubePlayerAPIReady() {
261        let players = document.querySelectorAll('.youtube-video');
262        players.forEach(player => {
263            let playerContainer = player.parentElement;
264            let videoId = player.getAttribute('data-video-id');
265            let YTPlayer = new YT.Player(player.getAttribute('id'), {events: {
266                onReady: function () {
267                    YTPlayer.loadVideoById(videoId);
268                    YTPlayer.mute();
269                    setContainerPadding(videoId, playerContainer);
270                },
271                onStateChange: function (e) {
272                    if (e.data === 0) {
273                        YTPlayer.playVideo();
274                    }
275                }
276            }, playerVars: YTPlayerVars});
277        });
278    }
279}
280
281
282// align blocks height
283function initSameHeight() {
284    jQuery('div.blog').sameHeight({
285        elements: 'article.post',
286        useMinHeight: true,
287        flexible: true,
288        multiLine: true,
289        biggestHeight: true
290    });
291}
292
293
294/*
295 * jQuery SameHeight plugin
296 */
297;(function($){
298    $.fn.sameHeight = function(opt) {
299        var options = $.extend({
300            skipClass: 'same-height-ignore',
301            leftEdgeClass: 'same-height-left',
302            rightEdgeClass: 'same-height-right',
303            elements: '>*',
304            flexible: false,
305            multiLine: false,
306            useMinHeight: false,
307            biggestHeight: false
308        },opt);
309        return this.each(function(){
310            var holder = $(this), postResizeTimer, ignoreResize;
311            var elements = holder.find(options.elements).not('.' + options.skipClass);
312            if(!elements.length) return;
313
314            // resize handler
315            function doResize() {
316                elements.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', '');
317                if(options.multiLine) {
318                    // resize elements row by row
319                    resizeElementsByRows(elements, options);
320                } else {
321                    // resize elements by holder
322                    resizeElements(elements, holder, options);
323                }
324            }
325            doResize();
326
327            // handle flexible layout / font resize
328            var delayedResizeHandler = function() {
329                if(!ignoreResize) {
330                    ignoreResize = true;
331                    doResize();
332                    clearTimeout(postResizeTimer);
333                    postResizeTimer = setTimeout(function() {
334                        doResize();
335                        setTimeout(function(){
336                            ignoreResize = false;
337                        }, 10);
338                    }, 100);
339                }
340            };
341
342            // handle flexible/responsive layout
343            if(options.flexible) {
344                $(window).bind('resize orientationchange fontresize', delayedResizeHandler);
345            }
346
347            // handle complete page load including images and fonts
348            $(window).bind('load', delayedResizeHandler);
349        });
350    };
351
352    // detect css min-height support
353    var supportMinHeight = typeof document.documentElement.style.maxHeight !== 'undefined';
354
355    // get elements by rows
356    function resizeElementsByRows(boxes, options) {
357        var currentRow = $(), maxHeight, maxCalcHeight = 0, firstOffset = boxes.eq(0).offset().top;
358        boxes.each(function(ind){
359            var curItem = $(this);
360            if(curItem.offset().top === firstOffset) {
361                currentRow = currentRow.add(this);
362            } else {
363                maxHeight = getMaxHeight(currentRow);
364                maxCalcHeight = Math.max(maxCalcHeight, resizeElements(currentRow, maxHeight, options));
365                currentRow = curItem;
366                firstOffset = curItem.offset().top;
367            }
368        });
369        if(currentRow.length) {
370            maxHeight = getMaxHeight(currentRow);
371            maxCalcHeight = Math.max(maxCalcHeight, resizeElements(currentRow, maxHeight, options));
372        }
373        if(options.biggestHeight) {
374            boxes.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', maxCalcHeight);
375        }
376    }
377
378    // calculate max element height
379    function getMaxHeight(boxes) {
380        var maxHeight = 0;
381        boxes.each(function(){
382            maxHeight = Math.max(maxHeight, $(this).outerHeight());
383        });
384        return maxHeight;
385    }
386
387    // resize helper function
388    function resizeElements(boxes, parent, options) {
389        var calcHeight;
390        var parentHeight = typeof parent === 'number' ? parent : parent.height();
391        boxes.removeClass(options.leftEdgeClass).removeClass(options.rightEdgeClass).each(function(i){
392            var element = $(this);
393            var depthDiffHeight = 0;
394            var isBorderBox = element.css('boxSizing') === 'border-box' || element.css('-moz-box-sizing') === 'border-box' || element.css('-webkit-box-sizing') === 'border-box';
395
396            if(typeof parent !== 'number') {
397                element.parents().each(function(){
398                    var tmpParent = $(this);
399                    if(parent.is(this)) {
400                        return false;
401                    } else {
402                        depthDiffHeight += tmpParent.outerHeight() - tmpParent.height();
403                    }
404                });
405            }
406            calcHeight = parentHeight - depthDiffHeight;
407            calcHeight -= isBorderBox ? 0 : element.outerHeight() - element.height();
408
409            if(calcHeight > 0) {
410                element.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', calcHeight);
411            }
412        });
413        boxes.filter(':first').addClass(options.leftEdgeClass);
414        boxes.filter(':last').addClass(options.rightEdgeClass);
415        return calcHeight;
416    }
417}(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.