Menu điều khiển với Auto Clicker, Music và SpeedHack (đã tích hợp)
// ==UserScript==
// @name Control Panel - Auto Clicker & Music & SpeedHack
// @namespace http://tampermonkey.net/
// @version 2.1
// @description Menu điều khiển với Auto Clicker, Music và SpeedHack (đã tích hợp)
// @author YourName
// @match *://*/*
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
// Xóa menu cũ nếu có
document.querySelectorAll('.main-menu-fab, .main-menu-panel, .autoClick-fab, .autoClick-panel, .autoClick-menu, #music-round-btn, #music-panel').forEach(el => el && el.remove());
// Hàm thêm CSS
function addStyle(css) {
const style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
}
// CSS - Hỗ trợ cuộn trong bảng
addStyle(`
.main-menu-fab {
position: fixed;
bottom: 80px;
right: 20px;
width: 55px;
height: 55px;
border-radius: 50%;
background: #00adb5;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
z-index: 999999;
cursor: grab;
overflow: hidden;
border: 2px solid white;
display: flex;
align-items: center;
justify-content: center;
touch-action: none;
user-select: none;
}
.main-menu-fab:active {
cursor: grabbing;
}
.main-menu-fab img {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
pointer-events: none;
}
.main-menu-panel {
position: fixed;
bottom: 150px;
right: 20px;
width: 320px;
max-height: 80vh;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
border-radius: 16px;
border: 1px solid #667eea;
color: white;
font-family: 'Segoe UI', Arial, sans-serif;
font-size: 14px;
z-index: 999998;
box-shadow: 0 8px 25px rgba(0,0,0,0.5);
backdrop-filter: blur(5px);
display: flex;
flex-direction: column;
overflow: hidden;
touch-action: pan-y pinch-zoom;
}
.main-menu-content {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 12px;
max-height: calc(80vh - 50px);
touch-action: pan-y pinch-zoom;
}
.main-menu-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 15px;
background: rgba(102,126,234,0.2);
border-bottom: 1px solid #667eea;
cursor: grab;
user-select: none;
touch-action: none;
flex-shrink: 0;
}
.main-menu-header:active {
cursor: grabbing;
}
.main-menu-title { font-weight: bold; color: #667eea; font-size: 14px; pointer-events: none; }
.main-menu-close {
background: #ff4757;
border: none;
color: white;
width: 26px;
height: 26px;
border-radius: 50%;
cursor: pointer;
font-size: 14px;
transition: 0.2s;
}
.main-menu-close:hover { background: #ff6b81; }
.menu-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px;
margin: 8px 0;
background: #0f0f1a;
border-radius: 10px;
cursor: pointer;
transition: 0.2s;
}
.menu-item:hover {
background: #1a1a2e;
}
.menu-item-left { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu-item-title { font-weight: bold; font-size: 14px; }
.menu-item-desc { font-size: 11px; color: #aaa; }
.arrow-icon {
font-size: 18px;
transition: transform 0.3s ease;
color: #667eea;
}
.arrow-icon.expanded {
transform: rotate(90deg);
}
.toggle-switch {
position: relative;
width: 50px;
height: 24px;
background-color: #2d2d44;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s;
}
.toggle-switch.active { background-color: #00adb5; }
.toggle-slider {
position: absolute;
top: 2px;
left: 2px;
width: 20px;
height: 20px;
background-color: white;
border-radius: 50%;
transition: all 0.3s;
}
.toggle-switch.active .toggle-slider { left: 28px; }
.submenu-container {
margin-left: 15px;
overflow: hidden;
transition: max-height 0.3s ease;
max-height: 0;
}
.submenu-container.show {
max-height: 500px;
}
.submenu-item {
padding: 10px;
background: #0a0a14;
border-radius: 8px;
margin-top: 8px;
}
.submenu-content {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.music-controls {
margin-top: 5px;
display: flex;
gap: 10px;
}
.music-btn {
flex: 1;
padding: 8px;
border: none;
border-radius: 20px;
cursor: pointer;
font-weight: bold;
transition: 0.2s;
}
.play-music-btn {
background: linear-gradient(135deg, #4caf50, #45a049);
color: white;
}
.play-music-btn:hover { opacity: 0.9; transform: scale(1.02); }
.stop-music-btn {
background: linear-gradient(135deg, #ff9800, #ff5722);
color: white;
}
.stop-music-btn:hover { opacity: 0.9; transform: scale(1.02); }
.music-status {
font-size: 10px;
text-align: center;
margin-top: 6px;
color: #4caf50;
}
.vip-badge {
background: linear-gradient(135deg, #ffd700, #ff8c00);
color: #000;
padding: 2px 8px;
border-radius: 12px;
font-size: 10px;
font-weight: bold;
margin-left: 8px;
}
.compact-item {
margin-bottom: 5px !important;
padding: 8px !important;
}
.speed-status, .autoclick-status {
font-size: 11px;
color: #4caf50;
margin-top: 5px;
text-align: center;
}
.coordinate-input {
display: flex;
gap: 8px;
margin: 10px 0;
}
.coordinate-input input {
flex: 1;
padding: 6px 8px;
background: rgba(255,255,255,0.1);
border: 1px solid rgba(255,255,255,0.25);
color: white;
border-radius: 6px;
font-size: 12px;
}
.coordinate-input input:focus {
outline: none;
border-color: #00adb5;
}
.action-btn {
background: linear-gradient(135deg, #00adb5, #00838f);
border: none;
color: white;
padding: 8px 12px;
border-radius: 8px;
cursor: pointer;
font-size: 12px;
font-weight: bold;
transition: 0.2s;
width: 100%;
}
.action-btn:hover {
opacity: 0.9;
transform: scale(1.02);
}
.danger-btn {
background: linear-gradient(135deg, #ff4757, #c0392b);
}
.info-text {
font-size: 10px;
color: #aaa;
text-align: center;
margin-top: 8px;
}
@media (max-width: 768px) {
.main-menu-panel { width: 300px; right: 5px; left: auto; max-height: 85vh; }
.main-menu-fab { bottom: 70px; right: 10px; width: 50px; height: 50px; }
}
`);
// ========== BIẾN TOÀN CỤC ==========
let myAudio = null;
let isPlaying = false;
let gameSoundMuted = false;
let musicFeatureState = {
isMuteGame: false
};
let speedHackEnabled = false;
let speedHackScript = null;
let autoClickerEnabled = false;
let autoClickerInterval = null;
let autoClickX = 0;
let autoClickY = 0;
let clickCount = 0;
// ========== HÀM LOAD SPEEDHACK ==========
function loadSpeedHack() {
return new Promise((resolve, reject) => {
const scriptUrl = 'https://update.greasyfork.org/scripts/543798/Universal%20HTML5%20Speed%20Hack.user.js';
fetch(scriptUrl)
.then(response => response.text())
.then(code => {
const script = document.createElement('script');
script.textContent = code;
script.setAttribute('data-speedhack-loaded', 'true');
document.head.appendChild(script);
speedHackScript = script;
setTimeout(() => {
console.log('%c✅ SpeedHack đã được tải và kích hoạt!', 'color: #4caf50; font-size: 12px');
console.log('%c💡 Nhấn phím L để ẩn/hiện giao diện SpeedHack', 'color: #ff9800; font-size: 12px');
resolve();
}, 500);
})
.catch(err => {
console.error('Lỗi tải SpeedHack:', err);
reject(err);
});
});
}
function unloadSpeedHack() {
if (speedHackScript) {
speedHackScript.remove();
speedHackScript = null;
}
const speedhackUI = document.getElementById('speedhack-ui');
if (speedhackUI) speedhackUI.remove();
console.log('%c🔴 SpeedHack đã được tắt', 'color: #ff5722; font-size: 12px');
}
// ========== HÀM AUTO CLICKER ==========
function startAutoClicker(x, y, intervalMs = 100) {
if (autoClickerInterval) {
clearInterval(autoClickerInterval);
autoClickerInterval = null;
}
clickCount = 0;
autoClickerInterval = setInterval(() => {
// Tạo sự kiện click tại tọa độ
const element = document.elementFromPoint(x, y);
if (element) {
const clickEvent = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true,
clientX: x,
clientY: y
});
element.dispatchEvent(clickEvent);
clickCount++;
// Cập nhật hiển thị số lần click
const countSpan = document.getElementById('clickCount');
if (countSpan) countSpan.textContent = clickCount;
}
}, intervalMs);
console.log(`✅ Auto Clicker đã bắt đầu tại (${x}, ${y})`);
}
function stopAutoClicker() {
if (autoClickerInterval) {
clearInterval(autoClickerInterval);
autoClickerInterval = null;
}
console.log('🔴 Auto Clicker đã dừng');
}
function updateClickPosition(x, y) {
autoClickX = x;
autoClickY = y;
if (autoClickerEnabled && autoClickerInterval) {
// Nếu đang chạy, restart với vị trí mới
const currentInterval = 100; // lấy interval hiện tại
stopAutoClicker();
startAutoClicker(autoClickX, autoClickY, currentInterval);
}
}
// ========== TẠO SUBMENU AUTO CLICKER ==========
function createAutoClickerSubmenu() {
const submenuDiv = document.getElementById('autoClickerSubmenu');
if (!submenuDiv) return;
submenuDiv.innerHTML = `
<div class="submenu-item">
<div class="submenu-content">
<span>🎯 Bật/Tắt Auto Clicker</span>
<div class="toggle-switch" id="toggleAutoClickerInside">
<div class="toggle-slider"></div>
</div>
</div>
<div class="autoclick-status" id="autoClickerStatus">
🔴 Chưa kích hoạt
</div>
</div>
<div class="submenu-item">
<div style="font-size: 12px; margin-bottom: 8px; color: #00adb5;">📍 Tọa độ click</div>
<div class="coordinate-input">
<input type="number" id="clickX" placeholder="X" value="${autoClickX}">
<input type="number" id="clickY" placeholder="Y" value="${autoClickY}">
</div>
<button class="action-btn" id="getCurrentPosBtn">🎯 Lấy vị trí chuột hiện tại</button>
<div class="info-text">💡 Di chuyển chuột đến vị trí muốn click, sau đó nhấn nút trên</div>
</div>
<div class="submenu-item">
<div style="font-size: 12px; margin-bottom: 8px;">⏱️ Tốc độ click</div>
<div class="coordinate-input">
<input type="range" id="clickSpeed" min="10" max="1000" value="100" step="10">
<span id="speedValue" style="min-width: 60px;">100 ms</span>
</div>
<div class="info-text">⚡ Càng nhỏ càng nhanh (10ms = 100 click/giây)</div>
</div>
<div class="submenu-item">
<div style="display: flex; gap: 8px;">
<button class="action-btn" id="updatePosBtn">📌 Cập nhật tọa độ</button>
<button class="action-btn danger-btn" id="stopAutoClickerBtn">⏹️ Dừng ngay</button>
</div>
<div class="info-text" style="margin-top: 8px;">
📊 Số lần đã click: <span id="clickCount" style="color: #00adb5; font-weight: bold;">0</span>
</div>
</div>
`;
const toggleAutoClickerInside = document.getElementById('toggleAutoClickerInside');
const autoClickerStatus = document.getElementById('autoClickerStatus');
const clickXInput = document.getElementById('clickX');
const clickYInput = document.getElementById('clickY');
const clickSpeed = document.getElementById('clickSpeed');
const speedValue = document.getElementById('speedValue');
const getCurrentPosBtn = document.getElementById('getCurrentPosBtn');
const updatePosBtn = document.getElementById('updatePosBtn');
const stopAutoClickerBtn = document.getElementById('stopAutoClickerBtn');
// Khôi phục trạng thái
if (autoClickerEnabled) {
toggleAutoClickerInside.classList.add('active');
if (autoClickerStatus) autoClickerStatus.innerHTML = '✅ Đang chạy...';
if (autoClickerInterval) {
const countSpan = document.getElementById('clickCount');
if (countSpan) {
setInterval(() => {
if (autoClickerEnabled && document.getElementById('clickCount')) {
document.getElementById('clickCount').textContent = clickCount;
}
}, 500);
}
}
}
// Toggle Auto Clicker
if (toggleAutoClickerInside) {
toggleAutoClickerInside.onclick = (e) => {
e.stopPropagation();
autoClickerEnabled = !autoClickerEnabled;
if (autoClickerEnabled) {
toggleAutoClickerInside.classList.add('active');
if (autoClickerStatus) autoClickerStatus.innerHTML = '⏳ Đang khởi động...';
const x = parseInt(clickXInput.value) || 0;
const y = parseInt(clickYInput.value) || 0;
const speed = parseInt(clickSpeed.value) || 100;
if (x === 0 && y === 0) {
alert('Vui lòng nhập tọa độ X và Y trước khi bật Auto Clicker!');
autoClickerEnabled = false;
toggleAutoClickerInside.classList.remove('active');
if (autoClickerStatus) autoClickerStatus.innerHTML = '🔴 Chưa kích hoạt';
return;
}
autoClickX = x;
autoClickY = y;
startAutoClicker(autoClickX, autoClickY, speed);
if (autoClickerStatus) autoClickerStatus.innerHTML = '✅ Đang chạy...';
} else {
toggleAutoClickerInside.classList.remove('active');
if (autoClickerStatus) autoClickerStatus.innerHTML = '🔴 Chưa kích hoạt';
stopAutoClicker();
}
};
}
// Cập nhật tốc độ
if (clickSpeed) {
clickSpeed.oninput = (e) => {
const val = e.target.value;
speedValue.textContent = val + ' ms';
if (autoClickerEnabled && autoClickerInterval) {
// Restart với tốc độ mới
stopAutoClicker();
startAutoClicker(autoClickX, autoClickY, parseInt(val));
}
};
}
// Lấy vị trí chuột hiện tại
if (getCurrentPosBtn) {
getCurrentPosBtn.onclick = () => {
const updateMousePos = (e) => {
clickXInput.value = e.clientX;
clickYInput.value = e.clientY;
document.removeEventListener('mousemove', updateMousePos);
alert(`Đã lấy tọa độ: (${e.clientX}, ${e.clientY})`);
};
document.addEventListener('mousemove', updateMousePos, { once: true });
alert('Di chuyển chuột đến vị trí muốn click và nhấn OK...');
};
}
// Cập nhật tọa độ
if (updatePosBtn) {
updatePosBtn.onclick = () => {
const newX = parseInt(clickXInput.value);
const newY = parseInt(clickYInput.value);
if (isNaN(newX) || isNaN(newY)) {
alert('Vui lòng nhập tọa độ hợp lệ!');
return;
}
autoClickX = newX;
autoClickY = newY;
if (autoClickerEnabled && autoClickerInterval) {
stopAutoClicker();
const speed = parseInt(clickSpeed.value) || 100;
startAutoClicker(autoClickX, autoClickY, speed);
}
alert(`Đã cập nhật tọa độ: (${autoClickX}, ${autoClickY})`);
};
}
// Dừng Auto Clicker
if (stopAutoClickerBtn) {
stopAutoClickerBtn.onclick = () => {
if (autoClickerEnabled) {
autoClickerEnabled = false;
if (toggleAutoClickerInside) toggleAutoClickerInside.classList.remove('active');
if (autoClickerStatus) autoClickerStatus.innerHTML = '🔴 Chưa kích hoạt';
stopAutoClicker();
alert('Đã dừng Auto Clicker!');
} else {
alert('Auto Clicker chưa được bật!');
}
};
}
}
// ========== TẠO SUBMENU SPEEDHACK ==========
function createSpeedHackSubmenu() {
const submenuDiv = document.getElementById('speedHackSubmenu');
if (!submenuDiv) return;
submenuDiv.innerHTML = `
<div class="submenu-item">
<div class="submenu-content">
<span>⚡ Bật/Tắt SpeedHack</span>
<div class="toggle-switch" id="toggleSpeedHackInside">
<div class="toggle-slider"></div>
</div>
</div>
<div class="speed-status" id="speedHackStatus">
🔴 Chưa kích hoạt
</div>
<div style="font-size: 11px; color: #aaa; margin-top: 8px; padding: 6px; background: rgba(0,0,0,0.3); border-radius: 6px;">
💡 Hướng dẫn: Sau khi bật, nhấn phím <strong style="color:#4caf50">L</strong> để hiện/ẩn giao diện điều khiển tốc độ.<br>
🎮 Có thể tăng tốc game lên đến 100x hoặc hơn!
</div>
</div>
`;
const toggleSpeedHackInside = document.getElementById('toggleSpeedHackInside');
const speedHackStatus = document.getElementById('speedHackStatus');
if (toggleSpeedHackInside) {
if (speedHackEnabled) {
toggleSpeedHackInside.classList.add('active');
if (speedHackStatus) speedHackStatus.innerHTML = '✅ Đã kích hoạt (Nhấn L để mở menu)';
}
toggleSpeedHackInside.onclick = async (e) => {
e.stopPropagation();
speedHackEnabled = !speedHackEnabled;
if (speedHackEnabled) {
toggleSpeedHackInside.classList.add('active');
if (speedHackStatus) speedHackStatus.innerHTML = '⏳ Đang tải SpeedHack...';
try {
await loadSpeedHack();
if (speedHackStatus) speedHackStatus.innerHTML = '✅ Đã kích hoạt (Nhấn L để mở menu)';
} catch (err) {
speedHackEnabled = false;
toggleSpeedHackInside.classList.remove('active');
if (speedHackStatus) speedHackStatus.innerHTML = '❌ Tải thất bại, thử lại sau';
console.error('Lỗi tải SpeedHack:', err);
}
} else {
toggleSpeedHackInside.classList.remove('active');
if (speedHackStatus) speedHackStatus.innerHTML = '🔴 Chưa kích hoạt';
unloadSpeedHack();
}
};
}
}
// ========== CHỨC NĂNG TẮT ÂM THANH GAME ==========
function muteGameSound() {
console.log("%c🔇 DANG TAT AM THANH GAME...", "color: #ff9800");
var iframes = document.querySelectorAll('iframe');
for (var i = 0; i < iframes.length; i++) {
try {
var iframeDoc = iframes[i].contentDocument;
if (iframeDoc) {
var iframeMedia = iframeDoc.querySelectorAll('audio, video');
for (var j = 0; j < iframeMedia.length; j++) {
iframeMedia[j].volume = 0;
iframeMedia[j].muted = true;
}
}
} catch(e) {}
}
var allMedia = document.querySelectorAll('audio, video');
for (var i = 0; i < allMedia.length; i++) {
if (!allMedia[i].isOurMusic) {
allMedia[i].volume = 0;
allMedia[i].muted = true;
}
}
var originalPlay = HTMLMediaElement.prototype.play;
HTMLMediaElement.prototype.play = function() {
if (this.isOurMusic) {
return originalPlay.call(this);
}
this.volume = 0;
this.muted = true;
return Promise.resolve();
};
gameSoundMuted = true;
const statusSpan = document.getElementById('muteGameStatus');
if (statusSpan) statusSpan.innerHTML = '✅ Đã tắt';
}
function unmuteGameSound() {
var allMedia = document.querySelectorAll('audio, video');
for (var i = 0; i < allMedia.length; i++) {
if (!allMedia[i].isOurMusic) {
allMedia[i].volume = 1;
allMedia[i].muted = false;
}
}
gameSoundMuted = false;
const statusSpan = document.getElementById('muteGameStatus');
if (statusSpan) statusSpan.innerHTML = '🔊 Chưa tắt';
}
// ========== CHỨC NĂNG PHÁT NHẠC ==========
function playMusic() {
try {
if (myAudio && isPlaying) {
console.log("Nhạc đang phát rồi!");
return;
}
if (myAudio && !isPlaying) {
myAudio.play();
isPlaying = true;
} else {
myAudio = new Audio();
myAudio.src = 'https://files.catbox.moe/l2a2j2.mp3';
myAudio.loop = true;
myAudio.volume = 0.8;
myAudio.muted = false;
myAudio.isOurMusic = true;
myAudio.play().then(() => {
isPlaying = true;
const statusSpan = document.getElementById('songStatus');
if (statusSpan) {
statusSpan.innerHTML = '🎵 ĐANG PHÁT';
statusSpan.style.color = '#4caf50';
}
console.log("✅ Đang phát nhạc: Sớm như vậy");
}).catch(err => console.error("Lỗi phát nhạc:", err));
}
} catch(e) { console.error(e); }
}
function stopMusic() {
if (myAudio) {
myAudio.pause();
isPlaying = false;
const statusSpan = document.getElementById('songStatus');
if (statusSpan) {
statusSpan.innerHTML = '⏸ ĐÃ DỪNG';
statusSpan.style.color = '#ffeb3b';
}
console.log("Đã dừng nhạc");
}
}
// ========== TẠO SUBMENU MUSIC ==========
function createMusicSubmenu() {
const submenuDiv = document.getElementById('musicSubmenu');
if (!submenuDiv) return;
submenuDiv.innerHTML = `
<div class="submenu-item">
<div class="submenu-content">
<span>🔇 Tắt âm thanh game</span>
<div class="toggle-switch" id="toggleMuteGame">
<div class="toggle-slider"></div>
</div>
</div>
<span id="muteGameStatus" style="font-size: 10px; color: #ffeb3b;">🔊 Chưa tắt</span>
</div>
<div class="submenu-item compact-item">
<div style="font-size: 12px; margin-bottom: 8px;">🎵 Sớm như vậy - Bùi Trường Linh</div>
<div class="music-controls">
<button class="music-btn play-music-btn" id="playMusicBtn">▶ PLAY</button>
<button class="music-btn stop-music-btn" id="stopMusicBtn">⏹ DỪNG</button>
</div>
<div class="music-status">
Trạng thái: <span id="songStatus">⏸ Chưa phát</span>
</div>
</div>
`;
const toggleMuteGame = document.getElementById('toggleMuteGame');
if (toggleMuteGame && musicFeatureState.isMuteGame) {
toggleMuteGame.classList.add('active');
muteGameSound();
}
if (toggleMuteGame) {
toggleMuteGame.onclick = (e) => {
e.stopPropagation();
musicFeatureState.isMuteGame = !musicFeatureState.isMuteGame;
if (musicFeatureState.isMuteGame) {
toggleMuteGame.classList.add('active');
muteGameSound();
} else {
toggleMuteGame.classList.remove('active');
unmuteGameSound();
}
};
}
const playBtn = document.getElementById('playMusicBtn');
if (playBtn) {
playBtn.onclick = (e) => {
e.stopPropagation();
playMusic();
};
}
const stopBtn = document.getElementById('stopMusicBtn');
if (stopBtn) {
stopBtn.onclick = (e) => {
e.stopPropagation();
stopMusic();
};
}
}
// ========== TẠO SUBMENU VIP ==========
function createVipSubmenu() {
const submenuDiv = document.getElementById('vipSubmenu');
if (!submenuDiv) return;
submenuDiv.innerHTML = `
<div class="submenu-item">
<div class="submenu-content">
<span>👑 Log hoạt động VIP</span>
</div>
<div style="font-size: 11px; color: #ffd700; margin-top: 8px; padding: 8px; background: #1a1a2e; border-radius: 8px;">
📝 Tính năng đang phát triển<br>
🔜 Sắp ra mắt: Auto Farm, Auto Quest, và nhiều tính năng VIP khác!
</div>
</div>
`;
}
// ========== TẠO NÚT MENU TRÒN ==========
const fab = document.createElement('div');
fab.className = 'main-menu-fab';
fab.innerHTML = '<img src="https://i.postimg.cc/3wJFzXWv/resized-image.jpg" alt="Menu">';
document.body.appendChild(fab);
// ========== TẠO PANEL MENU CHÍNH ==========
const panel = document.createElement('div');
panel.className = 'main-menu-panel';
panel.style.display = 'none';
panel.innerHTML = `
<div class="main-menu-header" id="mainMenuHeader">
<span class="main-menu-title">Control Panel</span>
<button class="main-menu-close" id="closeMenuBtn">✖</button>
</div>
<div class="main-menu-content">
<div class="menu-item" id="autoClickerItem">
<div class="menu-item-left">
<span class="menu-item-title">🎯 Auto Clicker</span>
<span class="menu-item-desc">Auto click theo tọa độ</span>
</div>
<div class="arrow-icon" id="autoClickerArrow">▶</div>
</div>
<div id="autoClickerSubmenu" class="submenu-container"></div>
<div class="menu-item" id="speedHackItem">
<div class="menu-item-left">
<span class="menu-item-title">⚡ SpeedHack</span>
<span class="menu-item-desc">Tăng tốc game (đã hỗ trợ)</span>
</div>
<div class="arrow-icon" id="speedHackArrow">▶</div>
</div>
<div id="speedHackSubmenu" class="submenu-container"></div>
<div class="menu-item" id="musicItem">
<div class="menu-item-left">
<span class="menu-item-title">🎵 Music</span>
<span class="menu-item-desc">Nghe nhạc & tắt âm game</span>
</div>
<div class="arrow-icon" id="musicArrow">▶</div>
</div>
<div id="musicSubmenu" class="submenu-container"></div>
<div class="menu-item" id="vipItem">
<div class="menu-item-left">
<span class="menu-item-title">👑 Log [VIP] <span class="vip-badge">VIP</span></span>
<span class="menu-item-desc">Tính năng đặc biệt dành cho VIP</span>
</div>
<div class="arrow-icon" id="vipArrow">▶</div>
</div>
<div id="vipSubmenu" class="submenu-container"></div>
</div>
`;
document.body.appendChild(panel);
// ========== XỬ LÝ MỞ/ĐÓNG SUBMENU ==========
let autoClickerExpanded = false;
let speedHackExpanded = false;
let musicExpanded = false;
let vipExpanded = false;
// Auto Clicker submenu
const autoClickerItem = document.getElementById('autoClickerItem');
const autoClickerArrow = document.getElementById('autoClickerArrow');
const autoClickerSubmenu = document.getElementById('autoClickerSubmenu');
if (autoClickerItem) {
autoClickerItem.addEventListener('click', (e) => {
e.stopPropagation();
autoClickerExpanded = !autoClickerExpanded;
if (autoClickerExpanded) {
autoClickerArrow.classList.add('expanded');
autoClickerSubmenu.classList.add('show');
createAutoClickerSubmenu();
} else {
autoClickerArrow.classList.remove('expanded');
autoClickerSubmenu.classList.remove('show');
}
});
}
// SpeedHack submenu
const speedHackItem = document.getElementById('speedHackItem');
const speedHackArrow = document.getElementById('speedHackArrow');
const speedHackSubmenu = document.getElementById('speedHackSubmenu');
if (speedHackItem) {
speedHackItem.addEventListener('click', (e) => {
e.stopPropagation();
speedHackExpanded = !speedHackExpanded;
if (speedHackExpanded) {
speedHackArrow.classList.add('expanded');
speedHackSubmenu.classList.add('show');
createSpeedHackSubmenu();
} else {
speedHackArrow.classList.remove('expanded');
speedHackSubmenu.classList.remove('show');
}
});
}
// Music submenu
const musicItem = document.getElementById('musicItem');
const musicArrow = document.getElementById('musicArrow');
const musicSubmenu = document.getElementById('musicSubmenu');
if (musicItem) {
musicItem.addEventListener('click', (e) => {
e.stopPropagation();
musicExpanded = !musicExpanded;
if (musicExpanded) {
musicArrow.classList.add('expanded');
musicSubmenu.classList.add('show');
createMusicSubmenu();
} else {
musicArrow.classList.remove('expanded');
musicSubmenu.classList.remove('show');
}
});
}
// VIP submenu
const vipItem = document.getElementById('vipItem');
const vipArrow = document.getElementById('vipArrow');
const vipSubmenu = document.getElementById('vipSubmenu');
if (vipItem) {
vipItem.addEventListener('click', (e) => {
e.stopPropagation();
vipExpanded = !vipExpanded;
if (vipExpanded) {
vipArrow.classList.add('expanded');
vipSubmenu.classList.add('show');
createVipSubmenu();
} else {
vipArrow.classList.remove('expanded');
vipSubmenu.classList.remove('show');
}
});
}
// ========== KÉO THẢ HỖ TRỢ CẢ PC & MOBILE ==========
function makeDraggable(element, dragHandle = null, onClickCallback = null) {
let isDragging = false;
let dragStarted = false;
let startX = 0, startY = 0;
let initialLeft = 0, initialTop = 0;
const handle = dragHandle || element;
const onStart = (clientX, clientY) => {
isDragging = true;
dragStarted = false;
startX = clientX;
startY = clientY;
const rect = element.getBoundingClientRect();
initialLeft = rect.left;
initialTop = rect.top;
element.style.cursor = 'grabbing';
if (dragHandle) dragHandle.style.cursor = 'grabbing';
};
const onMove = (clientX, clientY) => {
if (!isDragging) return;
const dx = clientX - startX;
const dy = clientY - startY;
if (Math.abs(dx) > 5 || Math.abs(dy) > 5) {
dragStarted = true;
}
let newLeft = initialLeft + dx;
let newTop = initialTop + dy;
newLeft = Math.max(0, Math.min(window.innerWidth - element.offsetWidth, newLeft));
newTop = Math.max(0, Math.min(window.innerHeight - element.offsetHeight, newTop));
element.style.left = newLeft + 'px';
element.style.top = newTop + 'px';
element.style.right = 'auto';
element.style.bottom = 'auto';
};
const onEnd = () => {
if (isDragging) {
isDragging = false;
element.style.cursor = '';
if (dragHandle) dragHandle.style.cursor = '';
if (!dragStarted && onClickCallback) {
onClickCallback();
}
dragStarted = false;
}
};
handle.addEventListener('mousedown', (e) => {
e.preventDefault();
onStart(e.clientX, e.clientY);
});
window.addEventListener('mousemove', (e) => {
if (isDragging) onMove(e.clientX, e.clientY);
});
window.addEventListener('mouseup', onEnd);
handle.addEventListener('touchstart', (e) => {
e.preventDefault();
const touch = e.touches[0];
onStart(touch.clientX, touch.clientY);
});
window.addEventListener('touchmove', (e) => {
if (isDragging) {
e.preventDefault();
const touch = e.touches[0];
onMove(touch.clientX, touch.clientY);
}
});
window.addEventListener('touchend', onEnd);
}
makeDraggable(fab, null, () => {
if (panel.style.display === 'none') {
panel.style.display = 'flex';
} else {
panel.style.display = 'none';
}
});
const panelHeader = document.getElementById('mainMenuHeader');
makeDraggable(panel, panelHeader, null);
document.getElementById('closeMenuBtn').addEventListener('click', (e) => {
e.stopPropagation();
panel.style.display = 'none';
});
console.log('%c✅ Menu đã sẵn sàng! Click nút tròn góc phải dưới', 'color: #0f0; font-size: 14px');
console.log('%c🎯 Auto Clicker - Có thể tùy chỉnh tọa độ và tốc độ click', 'color: #ff9800; font-size: 12px');
console.log('%c🎵 Music - Bấm PLAY để nghe nhạc', 'color: #ff9800; font-size: 12px');
console.log('%c⚡ SpeedHack - Bật toggle và nhấn L để mở menu tốc độ', 'color: #ff9800; font-size: 12px');
})();