// B1 - nhận = code này nhé nhưng mời 1 mail very code 1 lần rồi nhận các link còn lại nhé
// B2 - nhấn f12 coppy pass code vào và chạy
(function() {
// ============================================================
// NBTEAM AGENCY - TOOL NHẬN LINK BM V3.6 (MULTILINE PLACEHOLDER)
// Author: Tool By Mr.OK (Bản Nâng Cấp Kéo Giãn, Thống Kê, Đa Luồng)
// ============================================================
var oldTool = document.getElementById("NBTEAM2026");
if (oldTool) oldTool.remove();
var listSuccess = [], listFail = [];
var isRunning = false;
// Hàm rút gọn link để hiển thị log
function shortenLink(url) {
try {
return url.substring(0, 35) + "...";
} catch(e) { return "Link..."; }
}
// Hàm cập nhật thống kê trên nút bấm
function updateStats() {
document.getElementById("btn-copy-success").innerText = `Copy Thành Công (${listSuccess.length})`;
document.getElementById("btn-copy-fail").innerText = `Copy Thất Bại (${listFail.length})`;
}
var htmlUI = `
<div id="NBTEAM2026" style="
position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: 1050px; height: 650px; z-index: 99999;
background: #f0f2f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
border-radius: 10px; box-shadow: 0 25px 70px rgba(0,0,0,0.5); border: 1px solid #bbb;
display: flex; flex-direction: column; resize: both; overflow: hidden; min-width: 800px; min-height: 500px;
">
<!-- Header -->
<div id="la-header" style="
padding: 18px; background: linear-gradient(90deg, #FF9800 0%, #F57C00 100%);
color: white; cursor: move; display: flex; justify-content: center; align-items: center; position: relative;
flex-shrink: 0;
">
<div style="font-weight: bold; font-size: 19px; text-transform: uppercase; letter-spacing: 1px;">
💎 NBTEAM AGENCY - TOOL NHẬN LINK BM VIP PRO 💎
</div>
<div id="la-btn-close" style="position: absolute; right: 20px; cursor: pointer; font-size: 22px; font-weight: bold;">✕</div>
</div>
<div style="flex: 1; padding: 25px; display: flex; gap: 25px; box-sizing: border-box; overflow: hidden;">
<!-- Cột Trái -->
<div style="flex: 1; display: flex; flex-direction: column; gap: 15px; overflow: hidden;">
<div style="flex: 1; display: flex; flex-direction: column; min-height: 0;">
<label style="font-size: 13px; font-weight: 600; color: #333; display: flex; justify-content: space-between; margin-bottom: 8px;">
<span>Danh sách Link BM:</span>
<span style="color: #d32f2f;">Tổng: <span id="la-link-count">0</span> link</span>
</label>
<textarea id="la-links" style="
flex: 1; width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px;
font-size: 12px; line-height: 1.5; outline: none; resize: none; box-sizing: border-box;
font-family: 'Courier New', monospace; white-space: pre; overflow: auto;
" placeholder="Dán link vào đây, mỗi link 1 dòng. Lưu ý: Với mỗi mail mời, hãy nhận tay và verify code 1 lần trước khi chạy tool nhé!"></textarea>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; flex-shrink: 0;">
<div>
<label style="font-size: 11px; font-weight: 600; display: block; margin-bottom: 5px;">First Name:</label>
<input type="text" id="la-fname" value="NBTEAM" style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
</div>
<div>
<label style="font-size: 11px; font-weight: 600; display: block; margin-bottom: 5px;">Last Name (Auto UID):</label>
<input type="text" id="la-lname" disabled style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; background: #e9ecef; box-sizing: border-box;">
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 80px 80px; gap: 15px; flex-shrink: 0;">
<div style="position: relative;">
<label style="font-size: 11px; font-weight: 600; display: block; margin-bottom: 5px;">Mật khẩu Facebook:</label>
<input type="password" id="la-password" style="width: 100%; padding: 10px; padding-right: 35px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;" placeholder="Nhập pass...">
<span id="la-eye-icon" style="position: absolute; right: 10px; top: 25px; cursor: pointer; font-size: 16px;">👁️</span>
</div>
<div>
<label style="font-size: 11px; font-weight: 600; display: block; margin-bottom: 5px;">Luồng/lúc:</label>
<input type="number" id="la-threads" value="100" min="1" style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; text-align: center; box-sizing: border-box;">
</div>
<div>
<label style="font-size: 11px; font-weight: 600; display: block; margin-bottom: 5px;">Delay (s):</label>
<input type="number" id="la-delay" value="5" min="0" style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; text-align: center; box-sizing: border-box;">
</div>
</div>
</div>
<!-- Cột Phải -->
<div style="flex: 1; display: flex; flex-direction: column; gap: 15px; overflow: hidden;">
<div style="flex: 1; display: flex; flex-direction: column; min-height: 0;">
<label style="font-size: 13px; font-weight: 600; color: #333; display: block; margin-bottom: 8px;">Trạng thái xử lý (Link | Thông báo):</label>
<div id="la-log" style="
flex: 1; width: 100%; border: 1px solid #ccc; border-radius: 6px; background: #fff;
padding: 12px; overflow-y: auto; font-size: 11px; box-sizing: border-box;
font-family: 'Courier New', monospace;
">
<div style="color: #999; font-style: italic;">Sẵn sàng xử lý...</div>
</div>
</div>
<!-- Thanh Progress Bar -->
<div style="width: 100%; height: 16px; background: #e0e0e0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); flex-shrink: 0;">
<div id="la-progress-bar" style="width: 0%; height: 100%; background: linear-gradient(90deg, #4CAF50, #8BC34A); transition: width 0.3s; text-align: center; color: white; font-size: 11px; line-height: 16px; font-weight: bold;"></div>
</div>
<div style="display: flex; gap: 10px; flex-shrink: 0;">
<button id="btn-copy-success" style="flex:1; padding:12px; cursor:pointer; background:#e8f5e9; border:1px solid #4CAF50; border-radius:4px; font-size:12px; font-weight:bold; color:#2E7D32;">Copy Thành Công (0)</button>
<button id="btn-copy-fail" style="flex:1; padding:12px; cursor:pointer; background:#ffebee; border:1px solid #f44336; border-radius:4px; font-size:12px; font-weight:bold; color:#C62828;">Copy Thất Bại (0)</button>
</div>
<div style="display: flex; flex-direction: column; gap: 10px; margin-top: 5px; flex-shrink: 0;">
<div style="display: flex; gap: 10px;">
<button id="la-btn-reset" style="flex: 1; padding: 15px; border: none; border-radius: 6px; background: linear-gradient(90deg, #FF9800 0%, #F57C00 100%); color: white; font-weight: bold; cursor: pointer; font-size: 14px; text-transform: uppercase;">RESET LIST</button>
<button id="la-btn-stop" style="flex: 1; padding: 15px; border: none; border-radius: 6px; background: linear-gradient(90deg, #F44336 0%, #D32F2F 100%); color: white; font-weight: bold; cursor: pointer; font-size: 16px;">DỪNG</button>
</div>
<button id="la-btn-start" style="width: 100%; padding: 15px; border: none; border-radius: 6px; background: linear-gradient(90deg, #4CAF50 0%, #2E7D32 100%); color: white; font-weight: bold; cursor: pointer; font-size: 18px; text-transform: uppercase; letter-spacing: 1px;">BẮT ĐẦU NHẬN</button>
</div>
</div>
</div>
<div style="padding: 12px; text-align: center; font-size: 11px; color: #777; background: #e9ebee; border-top: 1px solid #ddd; flex-shrink: 0;">
Tool BM Meta <b>NBTEAM AGENCY</b> - Dev by Mr.OK
</div>
</div>
`;
document.body.insertAdjacentHTML('beforeend', htmlUI);
// Bật tắt con mắt ẩn/hiện mật khẩu
document.getElementById("la-eye-icon").onclick = function() {
var pwdInput = document.getElementById("la-password");
if (pwdInput.type === "password") {
pwdInput.type = "text";
this.innerText = "🙈";
} else {
pwdInput.type = "password";
this.innerText = "👁️";
}
};
// Sự kiện đếm tổng số link khi dán vào
document.getElementById("la-links").addEventListener("input", function() {
var links = this.value.trim().split("\n").filter(l => l.length > 10);
document.getElementById("la-link-count").innerText = links.length;
});
function log(msg, color = "#333") {
var logBox = document.getElementById("la-log");
var div = document.createElement("div");
div.innerHTML = msg; div.style.color = color; div.style.padding = "3px 0";
div.style.borderBottom = "1px solid #f0f0f0";
logBox.appendChild(div);
logBox.scrollTop = logBox.scrollHeight;
}
function getEnv() {
var dtsg = document.querySelector('input[name="fb_dtsg"]')?.value || "";
if(!dtsg) { try { let m = document.documentElement.innerHTML.match(/"DTSGInitialData",\[\],{"token":"(.*?)"/); if(m) dtsg = m[1]; } catch(e) {} }
var uid = (document.cookie.match(/c_user=(\d+)/) || [])[1];
return { dtsg, uid };
}
const env = getEnv();
if(env.uid) document.getElementById("la-lname").value = env.uid;
async function acceptLink(link, password, firstName, lastName) {
let invitationToken = link.match(/token=([^&]+)/)?.[1];
let displayLink = shortenLink(link);
if(!invitationToken) {
log(`${displayLink} | Link không hợp lệ`, "red");
listFail.push(link);
updateStats();
return;
}
const { dtsg, uid } = getEnv();
let params = new URLSearchParams({
"first_name": firstName, "last_name": lastName, "invitation_token": invitationToken,
"user_preferred_business_email": "", "__user": uid, "__a": "1", "fb_dtsg": dtsg, "confirmed": "1"
});
if(password) params.append("ajax_password", password);
try {
let res = await fetch("https://business.facebook.com/business/invitation/login/", {
method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: params.toString()
});
let text = await res.text();
let cleanText = text.replace("for (;;);", "");
if (cleanText.includes("error") || cleanText.includes("errorSummary")) {
let errorMsg = "Something went wrong";
try {
let json = JSON.parse(cleanText);
errorMsg = json.errorSummary || json.errorDescription || (json.error && json.error.message) || "Error";
} catch(e) {}
log(`${displayLink} | Thất bại: ${errorMsg}`, "#FF9800");
listFail.push(link);
} else {
log(`${displayLink} | Thành công!`, "green");
listSuccess.push(link);
}
} catch (e) {
log(`${displayLink} | Lỗi kết nối server`, "red");
listFail.push(link);
}
updateStats(); // Cập nhật số liệu trên nút
}
document.getElementById("la-btn-start").onclick = async function() {
if (isRunning) return;
var links = document.getElementById("la-links").value.trim().split("\n").filter(l => l.length > 10);
if (links.length === 0) return alert("Vui lòng nhập link!");
isRunning = true; listSuccess = []; listFail = []; updateStats();
// Reset Progress bar
document.getElementById("la-progress-bar").style.width = "0%";
document.getElementById("la-progress-bar").innerText = "0%";
this.innerText = "⏳ ĐANG XỬ LÝ..."; this.style.opacity = "0.7";
document.getElementById("la-log").innerHTML = `<div>🚀 Bắt đầu xử lý ${links.length} link...</div>`;
let threads = parseInt(document.getElementById("la-threads").value) || 2;
let delayTime = parseInt(document.getElementById("la-delay").value) * 1000;
let pwd = document.getElementById("la-password").value;
let fname = document.getElementById("la-fname").value;
let lname = document.getElementById("la-lname").value;
let processedCount = 0;
for (let i = 0; i < links.length; i += threads) {
if (!isRunning) break;
let chunk = links.slice(i, i + threads);
// Xử lý song song các link trong 1 chunk
await Promise.all(chunk.map(async (link) => {
if(!isRunning) return;
await acceptLink(link, pwd, fname, lname);
processedCount++;
// Cập nhật thanh Progress Bar theo từng link hoàn thành
let percent = Math.round((processedCount / links.length) * 100);
document.getElementById("la-progress-bar").style.width = percent + "%";
document.getElementById("la-progress-bar").innerText = percent + "%";
}));
// Đợi delay trước khi chạy cụm luồng tiếp theo
if (processedCount < links.length && isRunning) {
await new Promise(r => setTimeout(r, delayTime));
}
}
isRunning = false; this.innerText = "BẮT ĐẦU NHẬN"; this.style.opacity = "1";
log("🎉 Đã hoàn tất!", "blue");
};
document.getElementById("la-btn-stop").onclick = function() { isRunning = false; log("🛑 Đã bấm dừng!", "red"); };
document.getElementById("la-btn-reset").onclick = function() {
// Yêu cầu: chỉ làm trống 2 ô Danh sách Link BM và ô Trạng thái xử lý (Log)
document.getElementById("la-links").value = "";
document.getElementById("la-link-count").innerText = "0";
document.getElementById("la-log").innerHTML = '<div style="color: #999; font-style: italic;">Sẵn sàng xử lý...</div>';
};
document.getElementById("la-btn-close").onclick = function() { document.getElementById("NBTEAM2026").remove(); };
document.getElementById("btn-copy-success").onclick = function() { navigator.clipboard.writeText(listSuccess.join("\n")); alert("Đã copy " + listSuccess.length + " link thành công"); };
document.getElementById("btn-copy-fail").onclick = function() { navigator.clipboard.writeText(listFail.join("\n")); alert("Đã copy " + listFail.length + " link thất bại"); };
// Xử lý kéo thả UI
var dragItem = document.getElementById("la-header"), container = document.getElementById("NBTEAM2026");
var active = false, currentX, currentY, initialX, initialY, xOffset = 0, yOffset = 0;
container.addEventListener("mousedown", (e) => { if (e.target === dragItem) { initialX = e.clientX - xOffset; initialY = e.clientY - yOffset; active = true; } });
document.addEventListener("mouseup", () => { initialX = currentX; initialY = currentY; active = false; });
document.addEventListener("mousemove", (e) => { if (active) { e.preventDefault(); currentX = e.clientX - initialX; currentY = e.clientY - initialY; xOffset = currentX; yOffset = currentY; container.style.transform = `translate3d(${currentX}px, ${currentY}px, 0)`; } });
})();
