(() => loadSubpage('dashboard'))(); document.getElementById('message').addEventListener("keypress", function (event) { if (event.key === "Enter") { document.getElementById('send-message').click() } }); document.getElementById('send-message').addEventListener('click', async function () { var _0x483d51 = document.getElementById('message').value; document.getElementById('message').value = ''; const _0x2726eb = await fetch(window.location.origin + '/dashboard/api/chat/addChat.php', { 'method': 'POST', 'headers': { 'Content-Type': 'application/json' }, 'body': JSON.stringify({ 'message': _0x483d51 }) }); const _0x4d195e = await _0x2726eb.json(); if (_0x4d195e.success) { fetchMessages(); } else { if (_0x4d195e.msg) { Toastify({ 'text': _0x4d195e.msg, 'duration': 0x1388, 'newWindow': true, 'gravity': 'top', 'position': 'center', 'stopOnFocus': true, 'style': { 'background': '#ef4444', 'text': 'white', 'border-radius': '5px' } }).showToast(); } } }); async function loadSubpage(_0x3c803e) { const _0x1e911c = document.getElementById('content'); _0x1e911c.classList.remove('opacity-100'); _0x1e911c.classList.add('opacity-0', 'transition-opacity', 'duration-200', 'ease-in-out'); await new Promise(_0x1492f4 => setTimeout(_0x1492f4, 0xc8)); try { _0x1e911c.innerHTML = await (await fetch('pages/' + _0x3c803e + '.php')).text(); const _0x5e2c5a = document.querySelectorAll("script[src^=\"assets/js/pages/\"]"); _0x5e2c5a.forEach(_0x260560 => _0x260560.remove()); const _0x263050 = document.createElement('script'); _0x263050.src = 'assets/js/pages/' + _0x3c803e + '.js?' + new Date().getTime(); _0x263050.type = 'module'; _0x263050.defer = true; _0x263050.onload = () => { _0x1e911c.classList.remove('opacity-0'); _0x1e911c.classList.add('opacity-100'); const _0x486dae = _0x1e911c.querySelector("a, button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])"); if (_0x486dae) { _0x486dae.focus(); } }; document.body.appendChild(_0x263050); } catch (_0x41bcc0) { console.error("Error loading subpage:", _0x41bcc0); _0x1e911c.innerHTML = "

Error loading content. Please try again.

"; _0x1e911c.classList.remove('opacity-0'); _0x1e911c.classList.add('opacity-100'); } } const formatter = Intl.NumberFormat("en", { notation: "compact" }); function increment(_0x173698) { const _0x138b23 = document.getElementById(_0x173698); _0x138b23.value = parseInt(_0x138b23.value || 0x0) + 0x1; } function decrement(_0x3751d9) { const _0x2c9d6e = document.getElementById(_0x3751d9); const _0x380b3b = parseInt(_0x2c9d6e.value || 0x0); if (_0x380b3b > 0x0) { _0x2c9d6e.value = _0x380b3b - 0x1; } } function validateNumber(_0x425f82) { const _0x2b540b = parseInt(_0x425f82.value || 0x0); if (_0x2b540b < 0x0 || isNaN(_0x2b540b)) { _0x425f82.value = 0x0; } } function copyText(_0x15f5ac) { const _0x1a5d66 = _0x15f5ac.previousElementSibling; const _0xd0fb82 = _0x1a5d66.textContent; navigator.clipboard.writeText(_0xd0fb82).then(() => { _0x15f5ac.textContent = '✓ '; setTimeout(() => _0x15f5ac.textContent = '📋', 0x3e8); }); } function escapeHTML(_0x2a0a55) { if (typeof _0x2a0a55 !== 'string') { return ''; } return _0x2a0a55.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); } const liveChat = document.getElementById('live-chat'); let currentMessageIds = []; async function DeleteMessage(_0x11f278) { const _0x234442 = await fetch(window.location.origin + '/dashboard/api/chat/deleteChat.php', { 'method': 'POST', 'headers': { 'Content-Type': 'application/json' }, 'body': JSON.stringify({ 'messageId': _0x11f278 }) }); data = await _0x234442.json(); if (data.success) { Toastify({ 'text': "Deleted Message.", 'duration': 0x1388, 'newWindow': true, 'gravity': 'top', 'position': 'center', 'stopOnFocus': true, 'style': { 'background': '#22c55e', 'text': 'white', 'border-radius': '5px' } }).showToast(); fetchMessages(); } else { if (data.msg) { Toastify({ 'text': data.msg, 'duration': 0x1388, 'newWindow': true, 'gravity': 'top', 'position': 'center', 'stopOnFocus': true, 'style': { 'background': '#ef4444', 'text': 'white', 'border-radius': '5px' } }).showToast(); } } } async function BanFromChat(_0x1edf43) { const _0x154d57 = await fetch(window.location.origin + '/dashboard/api/chat/banFromChat.php', { 'method': 'POST', 'headers': { 'Content-Type': 'application/json' }, 'body': JSON.stringify({ 'messageId': _0x1edf43 }) }); data = await _0x154d57.json(); if (data.success) { Toastify({ 'text': "Banned User.", 'duration': 0x1388, 'newWindow': true, 'gravity': 'top', 'position': 'center', 'stopOnFocus': true, 'style': { 'background': '#22c55e', 'text': 'white', 'border-radius': '5px' } }).showToast(); fetchMessages(); } else { if (data.msg) { Toastify({ 'text': data.msg, 'duration': 0x1388, 'newWindow': true, 'gravity': 'top', 'position': 'center', 'stopOnFocus': true, 'style': { 'background': '#ef4444', 'text': 'white', 'border-radius': '5px' } }).showToast(); } } } function removeOldMessages(_0x9fbae3) { const _0x1590c6 = document.querySelectorAll("#live-chat > div"); _0x1590c6.forEach(_0x32e3ab => { const _0x52d9ba = _0x32e3ab.getAttribute('data-id'); if (_0x52d9ba) { if (!_0x9fbae3.includes(_0x52d9ba)) { _0x32e3ab.remove(); currentMessageIds = currentMessageIds.filter(_0x5a9ef4 => _0x5a9ef4 !== _0x52d9ba); } } }); } async function fetchMessages() { try { const _0x524e95 = await fetch(window.location.origin + '/dashboard/api/chat/chat.php'); const _0x3bd513 = await _0x524e95.json(); const _0xc3b2ff = []; _0x3bd513.reverse(); _0x3bd513.forEach(_0x31b319 => { _0xc3b2ff.push(_0x31b319.id); const _0x5cb76b = document.querySelector("#live-chat [data-id=\"" + _0x31b319.id + "\"]"); if (_0x5cb76b) { updateMessage(_0x5cb76b, _0x31b319); } else { addMessage(_0x31b319.time, _0x31b319.username, _0x31b319.avatarUrl, _0x31b319.message, _0x31b319.level, _0x31b319.rank, _0x31b319.id, _0x31b319.isAdmin, false); } }); removeOldMessages(_0xc3b2ff); } catch (_0x6d0a0f) { console.error("Error fetching messages:", _0x6d0a0f); } } function updateMessage(_0x55217b, _0x5f0258) { const _0x14c5fe = _0x55217b.querySelector('.text-xs.text-gray-400'); if (_0x14c5fe) { _0x14c5fe.textContent = _0x5f0258.time; } const _0x5b4eef = _0x55217b.querySelector('.level'); if (_0x5b4eef) { _0x5b4eef.textContent = "Lvl " + _0x5f0258.level; } const _0x5046ef = _0x55217b.querySelector('.rank'); if (_0x5046ef) { _0x5046ef.textContent = _0x5f0258.rank; } } function addMessage(_0x89198b, _0x3a17c2, _0x22dfb1, _0x369572, _0x11ed96, _0x1ba783, _0x5d5898, _0x168f64, _0x125c1a = false) { if (currentMessageIds.includes(_0x5d5898)) { return; } const _0x4bceb0 = _0x89198b instanceof Date ? formatTime(_0x89198b) : _0x89198b; const _0x41d846 = "\n
\n \n
\n
\n " + _0x3a17c2 + "\n \n Lvl " + _0x11ed96 + "\n \n \n " + _0x1ba783 + "\n \n " + (_0x168f64 ? " \n \n Delete\n \n\n \n Ban\n \n " : '') + "\n " + _0x4bceb0 + "\n
\n

" + _0x369572 + "

\n
\n
\n "; const _0x426beb = document.createElement('div'); _0x426beb.innerHTML = _0x41d846; _0x426beb.setAttribute('data-id', _0x5d5898); if (_0x125c1a) { liveChat.insertBefore(_0x426beb, liveChat.firstChild); } else { liveChat.appendChild(_0x426beb); } if (liveChat.children.length > 0x32) { liveChat.removeChild(liveChat.firstChild); } currentMessageIds.push(_0x5d5898); const _0x254cd7 = document.getElementById('live-chat-div'); _0x254cd7.scrollTop = _0x254cd7.scrollHeight; } fetchMessages(); setInterval(fetchMessages, 5000); function formatTime(_0x1a90df) { const _0x39beed = String(_0x1a90df.getHours()).padStart(0x2, '0'); const _0x4cdeef = String(_0x1a90df.getMinutes()).padStart(0x2, '0'); return _0x39beed + ':' + _0x4cdeef; } function copyContent(_0x176d4d) { navigator.clipboard.writeText(_0x176d4d).then(() => { Toastify({ 'text': "Copied to clipboard!", 'duration': 0x1388, 'newWindow': true, 'gravity': 'top', 'position': 'center', 'stopOnFocus': true, 'style': { 'background': '#22c55e', 'text': 'white', 'border-radius': '5px' } }).showToast(); })['catch'](_0x43b7b4 => { console.error("Failed to copy text: ", _0x43b7b4); }); }