0% found this document useful (0 votes)
121 views3 pages

Vip

The document is a JavaScript code snippet that manages user interface updates for a trading platform. It includes functions to wait for elements to load, retrieve user balance, update account information, and display leaderboard details. The script continuously updates the UI every second based on the user's balance and account status.

Uploaded by

rohitshembde87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views3 pages

Vip

The document is a JavaScript code snippet that manages user interface updates for a trading platform. It includes functions to wait for elements to load, retrieve user balance, update account information, and display leaderboard details. The script continuously updates the UI every second based on the user's balance and account status.

Uploaded by

rohitshembde87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

(function () {

'use strict';

const lname = "59728540";


const iblafp = 100;

function waitForElement(selector, callback, interval = 500) {


const checker = setInterval(() => {
const el = document.querySelector(selector);
if (el) {
clearInterval(checker);
callback();
}
}, interval);
}

function getBalanceValue() {
const el = document.querySelector(".usermenu__info-balance");
if (!el) return 0;
return parseInt(el.innerText.replace(/[^0-9]/g, "").slice(0, -2)) || 0;
}

function isINR() {
const symbol = document.querySelector(".usermenu__info-
balance")?.innerText.trim().charAt(0);
return symbol === "₹";
}

function updateTabInfo() {
document.title = "Live trading | Quotex";
const favicon = document.querySelector("link[rel~='icon']");
if (favicon) favicon.href = "https://qxbroker.com/favicon.ico";
}

function updateAccountName() {
const elName = document.querySelector(".usermenu__info-name");
if (elName) {
elName.innerText = "LIVE ACCOUNT";
elName.style.color = "#00c900";
elName.style.fontWeight = "bold";
}

const btnReal = document.getElementsByClassName("sidebar__button")[1];


const btnDemo = document.getElementsByClassName("sidebar__button")[2];
if (btnReal && btnDemo) {
btnReal.setAttribute("id", "real");
btnDemo.setAttribute("id", "demo");
btnReal.classList.add("active");
btnDemo.classList.remove("active");
}
}

function updateLevelIcon(blc) {
const iconWrap = document.querySelector(".usermenu__info-levels");
const dropdown = document.querySelector(".usermenu__dropdown");
let iconHTML = "", label = "", percent = "";

if ((isINR() && blc < 415000) || (!isINR() && blc < 5000)) {
iconHTML = "#icon-profile-level-standart"; label = "STANDARD:"; percent =
"+0% profit";
} else if ((isINR() && blc < 830000) || (!isINR() && blc < 10000)) {
iconHTML = "#icon-profile-level-pro"; label = "PRO:"; percent = "+2% profit";
} else {
iconHTML = "#icon-profile-level-vip"; label = "VIP:"; percent = "+4% profit";
}

const svg = `<svg class="icon-profile-level"><use


xlink:href="/profile/images/spritemap.svg${iconHTML}"></use></svg>`;
if (iconWrap) iconWrap.innerHTML = svg;

if (dropdown) {
const levelIcon = document.querySelector(".usermenu__level-icon");
const levelName = document.querySelector(".usermenu__level-name");
const levelProfit = document.querySelector(".usermenu__level-profit");
if (levelIcon) levelIcon.innerHTML = svg;
if (levelName) levelName.innerText = label;
if (levelProfit) levelProfit.innerText = percent;
}
}

function formatProfit(profit) {
const abs = Math.abs(profit).toLocaleString();
return profit >= 0 ? `$${abs}.00` : `- $${abs}.00`;
}

function updateLeaderboard(blc) {
const profit = blc - iblafp;
const profitColor = profit >= 0 ? "--green" : "--red";
const profitStr = formatProfit(profit);

const leaderboard = document.querySelector(".app--sidepanel-open");


if (!leaderboard) return;

const bar = document.querySelector(".position__loading");


if (bar) {
bar.style.background = "#0faf59";
bar.style.height = "2px";
}

const profitBox = document.querySelector(".position__header-money.--green") ||


document.querySelector(".position__header-money.--red");

if (profitBox) {
profitBox.className = `position__header-money ${profitColor}`;
profitBox.innerText = profitStr;
}

const position = Math.min(20, Math.max(1, 20 - Math.floor(profit / 1000)));


const posFooter = document.querySelector(".position__footer");
if (posFooter) {
posFooter.innerHTML = `<div class="position__footer-title">Your
position:</div>${position}`;
}

const top1 = document.querySelector(".panel-leader-board__item");


if (top1) {
top1.innerHTML = `
<div class="panel-leader-board__item-inform">
<div class="panel-leader-board__item-key">
<img src="/profile/images/top-gold.svg">
<div class="panel-leader-board__item-key__place">1</div>
</div>
<div class="panel-leader-board__item-block">
<svg class="flag flag-in"><use
xlink:href="/profile/images/flags.svg#flag-in"></use></svg>
<div class="panel-leader-board__item-avatar">
<svg class="icon-avatar-default"><use
xlink:href="/profile/images/spritemap.svg#icon-avatar-default"></use></svg>
</div>
</div>
<div class="panel-leader-board__item-name">${lname}</div>
</div>
<div class="panel-leader-board__item-money
${profitColor}">${profitStr}</div>
`;
}
}

function removeBonusBanner() {
const bonus = document.querySelector(".bonus-promo");
if (bonus) bonus.remove();
}

function runLoop() {
const blc = getBalanceValue();
updateAccountName();
updateLevelIcon(blc);
updateLeaderboard(blc);
removeBonusBanner();
}

waitForElement(".usermenu__info-balance", () => {
updateTabInfo();
runLoop();
setInterval(runLoop, 1000);
});
})();

You might also like