PageSourceSearch

https://www.vivacom.bg/js/binom/binom.ea.overrides.js?cb=1.0.0.389…aGDyB6TfVEVxgdH5eVCebcetOiQsJBq6vCqKOz05CJM

js vivacom.bg collected 2026-09-24 09:29:54 UTC 8,907 bytes, 277 lines download raw bytes

1// -- EA initializer override [START]
2EA.LoadMethod = function (context) {
3
4    $(context).find('*[data-method]').each(function () {
5        const that = $(this);
6        const methods = (that.attr('data-method') || '').replace(/\s\s+/g, ' ');
7        $.each(methods.split(' '), function (_, methodName) {
8            const MethodClass = EA.Methods[methodName];
9            if (typeof MethodClass === 'function' && MethodClass.prototype && MethodClass.prototype.constructor === MethodClass) {
10                try {
11                    _ = new MethodClass(that);
12                }
13                catch (e) {
14                    console.log('HANDLED EXCEPTION failed EA method initializer', methodName, e);
15                }
16            }
17        });
18    });
19
20};
21
22EA.setupObserver = function (context) {
23
24    const observer = new MutationObserver(function (mutationsList, _) {
25        for (const mutation of mutationsList) {
26            if (mutation.type === 'childList') {
27                EA.LoadMethod($(mutation.addedNodes));
28            }
29        }
30    });
31
32    observer.observe(context[0], {
33        childList: true,
34        subtree: true
35    });
36};
37
38EA.onReady = function () {
39    const context = $(document);
40    EA.LoadMethod(context);
41    EA.setupObserver(context);
42    $('html').removeClass('no-js').addClass('js');
43};
44
45// -- EA initializer override [END]
46
47EA.Methods.selectActive = function ($this) {
48	$this.find('.toggle-active').on('click', function (e) {
49		$(this).toggleClass('active').siblings('.toggle-active').removeClass('active');
50	});
51};
52
53EA.Methods.topupLogic = function ($this) {
54};
55
56EA.Methods.faqList = function ($this) {
57    var item = $this.find('.quick-step-link');
58    item.on('click', function (e) {
59        e.preventDefault();
60        var thisIndex = $(this).parent('.quick-help-step-item').index();
61        $(this).parent('.quick-help-step-item').addClass('active').siblings('.quick-help-step-item').removeClass('active');
62        $('.faq-inner-list').eq(thisIndex).addClass('active').siblings('.faq-inner-list').removeClass('active');
63
64        window.location.hash = 'sideNav=' + thisIndex;
65    });
66
67    // on pageLoad, activate and focus the SideNav tab content
68    var sideNavValue = parsedHash().get('sideNav');
69    if (sideNavValue != undefined && sideNavValue != null && sideNavValue.length > 0) {
70        var itemIndex = parseInt(sideNavValue);
71        if (itemIndex !== NaN) {
72            var activeItem = item.eq(itemIndex);
73            var activeIndex = activeItem.parent('.quick-help-step-item').index();
74            activeItem.parent('.quick-help-step-item').addClass('active').siblings('.quick-help-step-item').removeClass('active');
75            $('.faq-inner-list').eq(activeIndex).addClass('active').siblings('.faq-inner-list').removeClass('active');
76        }
77    }
78};
79
80EA.Methods.toggleContent = function ($this) {
81    const checkbox = $this.find('input');
82    const item = $this.find('label');
83    const target1 = $this.data('target1');
84    const target2 = $this.data('target2');
85    const redirect = $this.data('redirect');
86    const content1 = $('[data-target="' + target1 + '"]');
87    const content2 = $('[data-target="' + target2 + '"]');
88    
89    setTimeout(function () {
90        content1.removeClass('hidden-element');
91        content2.addClass('hidden-element');
92    }, 300);
93
94    item.on('click', function () {
95        let checkboxChecked = checkbox.prop('checked');
96        if (redirect) {
97            if (checkboxChecked) {
98                window.location = target1; 
99            }
100            else {
101                window.location = target2;
102            }
103        }
104        else {
105            if (checkboxChecked) {
106                content1.removeClass('hidden-element');
107                content2.addClass('hidden-element');
108            }
109            else {
110                content1.addClass('hidden-element');
111                content2.removeClass('hidden-element');
112            }
113        }
114    }); 
115};
116
117EA.Methods.headerScroll = function($this) {
118    let scrolling;
119    let position = 0;
120    let hh = $this.outerHeight();
121    let dh = $(document).height();
122    let wh = $(window).height();
123    let delta = 5;
124    let headerHeight = $this.outerHeight();
125    const body = $('body');
126
127    const orderSummary = document?.querySelector('.outer-order-details-wrap.mobile-view');
128    const orderSummaryButton = orderSummary?.querySelector('.inner-order-detail-wrap, .basket-summary-top');
129
130    let isOrderSummaryButtonClicked = false;
131
132    // On resize update header height but also debounce it to prevent too many calls
133    let headerHeightTimeout;
134    $(window).on('resize', () => {
135        clearTimeout(headerHeightTimeout);
136        headerHeightTimeout = setTimeout(() => {
137            headerHeight = $this.outerHeight();
138        }, 100);
139    });
140
141    function onClassChange(mutationsList) {
142        mutationsList.forEach(mutation => {
143            if(mutation.type === 'attributes' && mutation.attributeName === 'class') {
144                $this.removeClass('active return-active');
145                $(window).scrollTop(0);
146
147                if(mutation.target.classList.contains('active')) {
148                    //body.css('overflow', 'hidden');
149                    isOrderSummaryButtonClicked = true;
150                } else {
151                    body.css('overflow', '');
152                    isOrderSummaryButtonClicked = false;
153                }
154            }
155        })
156    }
157    
158    const orderSummaryObserver = new MutationObserver(onClassChange);
159    
160    const orderSummaryObserverConfig = {
161        attributes: true,
162        attributeFilter: ['class'],
163    };
164    
165    if(orderSummaryButton) {
166        orderSummaryObserver.observe(orderSummaryButton, orderSummaryObserverConfig);
167    }
168
169    let st = $(window).scrollTop();
170    if (st > 5) {
171        $this.addClass('active');
172    }
173
174    $(window).scroll(function(event) {
175        scrolling = true;
176    });
177
178    setInterval(function() {
179        if (scrolling) {
180            scrollFunction();
181            scrolling = false;
182        }
183    }, 100);
184
185    
186    function scrollFunction() {
187        let st = $(this).scrollTop();
188
189        if(isOrderSummaryButtonClicked) return;
190
191        if (st <= 10) {
192            $this.removeClass('active return-active');
193            if(orderSummary) {
194                orderSummary.style.top = `${headerHeight}px`;
195            }
196            return;
197        }
198        
199        if(st >= (dh - wh * 1.25)) {
200            $this.removeClass('return-active').addClass('active');
201            if(orderSummary) {
202                orderSummary.style.top = '0px';
203            }
204
205            return;
206        }
207        
208        if (Math.abs(position - st) <= delta)
209            return;
210        
211
212        if (st > position && st > hh) {
213            $this.removeClass('return-active').addClass('active');
214            if(orderSummary) {
215                orderSummary.style.top = '0px';
216            }
217        }
218         else {
219            if (st + wh < dh) {
220                $this.removeClass('active').addClass('return-active');
221                if(orderSummary) {
222                    orderSummary.style.top = `${headerHeight}px`;
223                }
224            }
225        }
226        position = st;
227    };
228};
229
230var parsedHash = function () {
231    return new URLSearchParams(
232        window.location.hash.substring(1) // skip the first char (#)
233    );
234};
235
236EA.Methods.countdownBanner = function ($this) {
237    const header = $('header');
238    const mobileMenu = $('.moible-menu-wrapper');
239    const flipDownEl = $this.find('.flipdown');
240    const dataTime = $this.data('time');
241    const close = $this.find('.banner-close-link');
242    const main = $(document).find('main');
243
244    let flipDownInstance;
245
246    const currentTime = new Date().getTime() / 1000;
247    if (currentTime < dataTime) {
248        createCountdown();
249    }
250
251    close.on('click', (e) => {
252        e.preventDefault();
253        closeCountdown();
254    });
255
256    function createCountdown() {
257        header.addClass('has-counter');
258        mobileMenu.addClass('has-counter');
259        flipDownInstance = new FlipDown(dataTime, {
260            headings: ["Days", "Hours", "Minutes", "Seconds"],
261        }, flipDownEl).start();
262
263        flipDownInstance.ifEnded(() => {
264            closeCountdown();
265        });
266    }
267
268    function closeCountdown() {
269        if (flipDownInstance) {
270            header.removeClass('has-counter');
271            mobileMenu.removeClass('has-counter');
272            header.css('transform', 'translateY(0)');
273            var headerHeight = header.outerHeight();
274            main.css('padding-top', headerHeight + 'px');
275        }
276    }
277}

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.