PageSourceSearch

http://my-kannada.com/assets/js/main.js?v=7

js my-kannada.com collected 2026-10-03 01:39:33 UTC 13,473 bytes, 445 lines download raw bytes

1var locale = null;
2
3//event doesn't work
4var messagesLoaded = false;
5
6const supportedSiteLanguages = new Set(["en", "tr", "ru", "ua", "zh", "ja", "de", "es", "it", "fr", "pt"]);
7
8function normalizeSiteLanguage(language) {
9    if (!language) {
10        return null;
11    }
12
13    let code = String(language).trim().toLowerCase().split(/[-_]/)[0];
14    if (code === "uk") {
15        code = "ua";
16    }
17
18    return supportedSiteLanguages.has(code) ? code : null;
19}
20
21function detectBrowserLanguage() {
22    const preferredLanguages = Array.isArray(navigator.languages) && navigator.languages.length
23        ? navigator.languages
24        : [navigator.language];
25
26    for (const preferredLanguage of preferredLanguages) {
27        const language = normalizeSiteLanguage(preferredLanguage);
28        if (language) {
29            return language;
30        }
31    }
32
33    return "en";
34}
35
36const storedLanguage = getCookie("lang");
37let lang = normalizeSiteLanguage(storedLanguage);
38
39if (lang == null) {
40    lang = detectBrowserLanguage();
41    setCookie("lang", lang, 365);
42} else if (storedLanguage !== lang) {
43    setCookie("lang", lang, 365);
44}
45
46$.ajax({
47    type: "GET",
48    url: "/api/getLocale?v=2&lang=" + lang,
49    success: function (response) {
50        locale = response;
51        messagesLoaded = true;
52
53        checkCookiesAccepted();
54    }
55});
56
57function getMessage(key, replacers) {
58    let message = locale[key];
59
60    if (replacers && replacers.length > 0) {
61        replacers.forEach((replacer, index) => {
62            message = message.replace(`{${index}}`, replacer);
63        });
64    }
65
66    return message;
67}
68
69function checkCookiesAccepted() {
70    const cookiesAccepted = getCookie("cookies_accepted");
71
72    if (!cookiesAccepted || cookiesAccepted === "") {
73        const acceptMessage = getMessage('cookies.accept.message');
74        const privacyPolicy = getMessage('cookies.privacy.policy');
75        const acceptButton = getMessage('cookies.accept.button');
76
77        $("footer").prepend(`
78            <div class="cookie">
79               <div class="cookie__content">
80                  <div class="cookie__text">
81                     ${acceptMessage}
82                     <a href="/info#privacy" class="">
83                     ${privacyPolicy}</a>
84                  </div>
85                  <div class="spacer"></div>
86                 <button type="button" onclick="acceptCookies(event)" class="cookie__btn">
87                    <span class="v-btn__content">${acceptButton}</span>
88                 </button>
89               </div>
90            </div>
91        `);
92    }
93}
94
95function getCookie(name) {
96    let cookieArr = document.cookie.split(";");
97
98    for(let i = 0; i < cookieArr.length; i++) {
99        let cookiePair = cookieArr[i].split("=");
100
101        if(name === cookiePair[0].trim()) {
102            return decodeURIComponent(cookiePair[1]);
103        }
104    }
105
106    return null;
107}
108
109function setCookie(cookieName, cookieValue, daysToExpire) {
110    let expires = "";
111    if (daysToExpire) {
112        const date = new Date();
113        date.setTime(date.getTime() + (daysToExpire * 24 * 60 * 60 * 1000));
114        expires = "; expires=" + date.toUTCString();
115    }
116    document.cookie = cookieName + "=" + cookieValue + expires + "; path=/";
117}
118
119function acceptCookies() {
120    event.preventDefault();
121
122    setCookie("cookies_accepted", "true", 999);
123    $(".cookie").remove();
124}
125
126//mobile app start
127const banner = $('#mobile-app-banner');
128
129$('#mobile-app-btn').on('click', () => {
130    banner.css('display', 'flex');
131});
132
133$('#mobile-app-close').on('click', () => {
134    banner.addClass('custom-popup-fade-out');
135
136    setTimeout(() => {
137        banner.css('display', 'none');
138        banner.removeClass('custom-popup-fade-out')
139    }, 500);
140});
141
142document.addEventListener('click', () => {
143    if (banner.css('display') !== 'none' && !event.target.closest('.v-dialog__content') && event.target.id !== 'mobile-app-btn') {
144        banner.css('display', 'none');
145    }
146});
147
148document.addEventListener('click', function() {
149    if (!event.target.closest('.main-menu__section__menu') && !event.target.closest('.main-menu__section__nav-button')
150        && !event.target.closest('.main-menu__section__profile') && !event.target.closest('.mobile-menu-button') && !event.target.closest('.mobile-menu') && !event.target.closest('.assets-hide-show')) {
151        $('.main-menu__section__nav-button').each((index, btn) => {
152            $(btn).removeClass('active');
153        });
154        $('.main-menu__section__menu').each((index, menu) => {
155            $(menu).css('display', 'none');
156        });
157        $(".mobile-menu-button > div").removeClass('open');
158        $(".mobile-menu").css('display', 'none');
159        $('.menu-lang').css('display', 'none');
160    }
161});
162//mobile app end
163
164//header start
165//mobile start
166
167$(".main-menu__section").on('click', function (event) {
168    if (event.target.closest('.main-menu__section__menu')) {
169        return;
170    }
171
172    const el = $(this).find('.main-menu__section__menu');
173    if ($(this).hasClass('lang-button')) {
174        return;
175    }
176    const active = el.css('display') !== 'none';
177
178    $('.main-menu__section__nav-button').each((index, btn) => {
179        $(btn).removeClass('active');
180    });
181    $('.main-menu__section__menu').each((index, menu) => {
182        $(menu).css('display', 'none');
183    });
184
185    $(".mobile-menu-button > div").removeClass('open');
186    $(".mobile-menu").css('display', 'none');
187    $('.menu-lang').css('display', 'none');
188
189    $('.mobile-menu__item__panel').each(function() {
190        const btnWrapper = $(this);
191
192        btnWrapper.removeClass('v-expansion-panel--active');
193        btnWrapper.removeClass('v-item--active');
194
195        const btn = btnWrapper.find('button');
196        btn.removeClass('v-expansion-panel-header--active');
197        btn.attr('aria-expanded', 'false');
198
199        btnWrapper.find('a').each(function() {
200            $(this).css('display', 'none');
201        });
202    });
203
204    if (!active) {
205        if (el.hasClass('main-menu__section-flex')) {
206            el.css('display', 'flex');
207        } else {
208            el.css('display', 'block');
209        }
210    }
211});
212//mobile end
213
214$(".main-menu__section").on('mouseenter', function (event) {
215    if (window.innerWidth < 1400) {
216        return;
217    }
218
219    $(this).find('.main-menu__section__nav-button').addClass('active');
220    const el = $(this).find('.main-menu__section__menu');
221    if (el.hasClass('main-menu__section-flex')) {
222        el.css('display', 'flex');
223    } else {
224        el.css('display', 'block');
225    }
226});
227
228$(".main-menu__section").on('mouseleave', function (event) {
229    if (window.innerWidth < 1400) {
230        return;
231    }
232
233    $(this).find('.main-menu__section__nav-button').removeClass('active');
234    $(this).find('.main-menu__section__menu').css('display', 'none');
235});
236
237$(".nav-button-lang").on('click', function () {
238    const has = $(this).hasClass('active');
239
240    $('.main-menu__section__nav-button').each((index, btn) => {
241        $(btn).removeClass('active');
242    });
243    $('.main-menu__section__menu').each((index, menu) => {
244        $(menu).css('display', 'none');
245    });
246
247    $(".mobile-menu-button > div").removeClass('open');
248    $(".mobile-menu").css('display', 'none');
249    $('.menu-lang').css('display', 'none');
250
251    $('.mobile-menu__item__panel').each(function() {
252        const btnWrapper = $(this);
253
254        btnWrapper.removeClass('v-expansion-panel--active');
255        btnWrapper.removeClass('v-item--active');
256
257        const btn = btnWrapper.find('button');
258        btn.removeClass('v-expansion-panel-header--active');
259        btn.attr('aria-expanded', 'false');
260
261        btnWrapper.find('a').each(function() {
262            $(this).css('display', 'none');
263        });
264    });
265
266    if (has) {
267        $(this).removeClass('active');
268        $('.menu-lang').css('display', 'none');
269    } else {
270        $(this).addClass('active');
271        $('.menu-lang').css('display', 'flex');
272    }
273});
274
275$(".mobile-menu-button").on('click', function () {
276    const buttonIcon = $(this).find('div');
277
278    const has = buttonIcon.hasClass('open');
279    $('.main-menu__section__nav-button').each((index, btn) => {
280        $(btn).removeClass('active');
281    });
282    $('.main-menu__section__menu').each((index, menu) => {
283        $(menu).css('display', 'none');
284    });
285    $(".mobile-menu-button > div").removeClass('open');
286    $(".mobile-menu").css('display', 'none');
287    $('.menu-lang').css('display', 'none');
288
289    $('.mobile-menu__item__panel').each(function() {
290        const btnWrapper = $(this);
291
292        btnWrapper.removeClass('v-expansion-panel--active');
293        btnWrapper.removeClass('v-item--active');
294
295        const btn = btnWrapper.find('button');
296        btn.removeClass('v-expansion-panel-header--active');
297        btn.attr('aria-expanded', 'false');
298
299        btnWrapper.find('a').each(function() {
300            $(this).css('display', 'none');
301        });
302    });
303
304    if (has) {
305        buttonIcon.removeClass('open');
306        $(".mobile-menu").css('display', 'none');
307    } else {
308        buttonIcon.addClass('open');
309        $(".mobile-menu").css('display', 'block');
310    }
311
312    $(".main-menu__section > button").each(el => {
313        $(el).removeClass('active');
314        $('.menu-lang').css('display', 'none');
315    })
316});
317
318$(".v-expansion-panel-header").on('click', function () {
319    const opened = $(this).hasClass('v-expansion-panel-header--active');
320    const panel = $(this).parent();
321    const content = panel.find('.v-expansion-panel-content');
322
323    if (opened) {
324        $(this).removeClass('v-expansion-panel-header--active');
325        panel.removeClass('v-expansion-panel--active v-item--active');
326        panel.attr('aria-expanded', 'false');
327        content.css({
328            'max-height': '0',
329            'overflow': 'hidden',
330            'padding': '0',
331            'margin': '0',
332            'display': 'none'
333        });
334    } else {
335        content.css({
336            'display': 'block',
337            'padding': '',
338            'margin': ''
339        });
340        const contentHeight = content.prop('scrollHeight');
341        $(this).addClass('v-expansion-panel-header--active');
342        panel.addClass('v-expansion-panel--active v-item--active');
343        panel.attr('aria-expanded', 'true');
344        content.css({
345            'max-height': contentHeight + 'px',
346            'overflow': 'hidden'
347        });
348    }
349});
350
351$(".footer-title__wrapper").on('click', function() {
352    const section = $(this).closest('.footer-section');
353
354    if (section.hasClass('active')) {
355        section.removeClass('active');
356    } else {
357        section.addClass('active');
358    }
359});
360
361$("#balances-general").on('click', function() {
362    window.scrollTo(0, 0);
363});
364//header end
365
366function copyToClipboard(text) {
367    var textarea = document.createElement("textarea");
368    textarea.value = text;
369    document.body.appendChild(textarea);
370    textarea.select();
371    document.execCommand("copy");
372    document.body.removeChild(textarea);
373}
374
375function copyWithButton(copyCodeBtn, copyMsg, copyFunction) {
376    copyCodeBtn.on('mousedown', function (event) {
377        if (event.button === 0) {
378            copyFunction();
379        }
380    });
381
382    copyCodeBtn.on('mouseup', function (event) {
383        if (event.button === 0) {
384            noti(copyMsg, 'success');
385        }
386    });
387}
388
389const usdBalance = $("#usd-balance");
390const btcBalance = $("#btc-balance");
391const spotBalance = $("#spot-balance");
392const marginBalance = $("#margin-balance");
393const futuresBalance = $("#futures-balance");
394const earnBalance = $("#earn-balance");
395
396var balanceShowed = getCookie("balance_showed");
397const assetsHideShow = $("#assets-hide-show");
398
399if (balanceShowed && balanceShowed !== 'true') {
400    hideBalance();
401}
402
403function hideBalance() {
404    usdBalance.html('***** USD');
405    btcBalance.html('≈ ***** BTC');
406    spotBalance.html('$*.**');
407    marginBalance.html('$*.**');
408    futuresBalance.html('$*.**');
409    earnBalance.html('$*.**');
410    assetsHideShow.attr('src', 'src="../assets/img/show.svg"');
411}
412
413function showBalance() {
414    usdBalance.html(usdBalance.attr('usd-balance') + ' USD');
415    btcBalance.html('≈ ' + btcBalance.attr('btc-balance') + ' BTC');
416    spotBalance.html('$0.00');
417    marginBalance.html('$0.00');
418    futuresBalance.html('$0.00');
419    earnBalance.html('$0.00');
420    assetsHideShow.attr('src', 'src="../hide/img/show.svg"');
421}
422
423function onAssetsHideShow(event) {
424    event.preventDefault();
425
426    balanceShowed = getCookie("balance_showed");
427
428    if (balanceShowed && balanceShowed !== 'true') {
429        setCookie("balance_showed", "true", 30);
430        showBalance();
431    } else {
432        setCookie("balance_showed", "false", 30);
433        hideBalance();
434    }
435}
436
437function formatBytes(bytes, decimals = 2) {
438    if (!+bytes) return "0 Bytes";
439    const dm = decimals < 0 ? 0 : decimals;
440    const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
441    const index = Math.floor(Math.log(bytes) / Math.log(1024));
442    const value = parseFloat((bytes / Math.pow(1024, index)).toFixed(dm));
443    return `${value} ${sizes[index]}`;
444}
445

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.