您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Facebook一键脚本,支持点赞、移除推荐,并根据好友数量条件手动控制页面。提供UI按钮以控制开关,状态跨页面持久化保存,开关状态UI美化。
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/490096/1345135/Facebook%E7%8B%97%E6%8E%A8%E4%B8%93%E7%94%A8.js
// ==UserScript== // @name Facebook狗推专用 // @namespace http://tampermonkey.net/ // @version 2.1.8 // @description Facebook一键脚本,支持点赞、移除推荐,并根据好友数量条件手动控制页面。提供UI按钮以控制开关,状态跨页面持久化保存,开关状态UI美化。 // @author 亦安 // @match https://www.facebook.com/* // @grant none // ==/UserScript== (function () { "use strict"; const buttonStyle = "position: fixed; bottom: 100px; right: 20px; z-index: 10000; padding: 10px 15px; font-size: 16px; border: none; border-radius: 5px; color: white; cursor: pointer;"; const activeButtonColor = "#34A853"; const inactiveButtonColor = "#4267B2"; const likeButton = document.createElement("button"); likeButton.textContent = "一键点赞"; likeButton.style = buttonStyle + "background-color: #4267B2; bottom: 50px;"; document.body.appendChild(likeButton); const removeButton = document.createElement("button"); removeButton.textContent = "移除推荐"; removeButton.style = buttonStyle + "background-color: #4267B2; bottom: 100px;"; document.body.appendChild(removeButton); const listpullup = document.createElement("button"); listpullup.textContent = "一键列表上拉"; listpullup.style = buttonStyle + "background-color: #4267B2; bottom: 150px;"; document.body.appendChild(listpullup); const checkButton = document.createElement("button"); checkButton.style = buttonStyle + "bottom: 200px;"; document.body.appendChild(checkButton); let isChecking = false; let intervalId = null; function initializeButtonState() { isChecking = localStorage.getItem("fb-friendCheckEnabled") === "true"; checkButton.textContent = isChecking ? "停止检查好友数量" : "开始检查好友数量"; checkButton.style.backgroundColor = isChecking ? activeButtonColor : inactiveButtonColor; if (isChecking) { startChecking(); } } checkButton.addEventListener("click", toggleChecking); function toggleChecking() { isChecking = !isChecking; localStorage.setItem("fb-friendCheckEnabled", isChecking); checkButton.textContent = isChecking ? "停止检查好友数量" : "开始检查好友数量"; checkButton.style.backgroundColor = isChecking ? activeButtonColor : inactiveButtonColor; if (isChecking) { startChecking(); } else { stopChecking(); } } function startChecking() { if (intervalId) return; intervalId = setInterval(() => { let foundValidLink = false; const links = document.querySelectorAll("a"); links.forEach((link) => { if (link.textContent.includes("位好友")) { foundValidLink = true; const friendCountStr = link.textContent .split(" ")[0] .replace(/,/g, ""); const friendCount = parseInt(friendCountStr, 10); if (friendCount < 1 || friendCount > 1000) { localStorage.setItem("fb-friendCheckEnabled", isChecking); window.close(); } } }); if (!foundValidLink) { localStorage.setItem("fb-friendCheckEnabled", isChecking); window.close(); } }, 500); } function stopChecking() { if (intervalId) { clearInterval(intervalId); intervalId = null; } } likeButton.addEventListener("click", function () { const likeButtons = Array.from( document.querySelectorAll('div[aria-label="赞"][role="button"]'), ); const numberOfLikes = Math.floor(Math.random() * 8) + 3; for (let i = 0; i < numberOfLikes; i++) { const randomIndex = Math.floor(Math.random() * likeButtons.length); const buttonToClick = likeButtons[randomIndex]; if (buttonToClick) { setTimeout( () => buttonToClick.click(), Math.random() * (2000 - 1000) + 1000, ); likeButtons.splice(randomIndex, 1); } } }); removeButton.addEventListener("click", function () { setInterval(() => { const buttons = document.querySelectorAll('div[role="none"]'); buttons.forEach(function (button) { if ( button.innerText.includes("移除") || button.innerText.includes("删除") ) { button.click(); } }); }, 1000); }); listpullup.addEventListener("click", function () { const targetClassName = "x6s0dn4 xkh2ocl x1q0q8m5 x1qhh985 xu3j5b3 xcfux6l x26u7qi xm0m39n x13fuv20 x972fbf x9f619 x78zum5 x1q0g3np x1iyjqo2 xs83m0k x1qughib xat24cr x11i5rnm x1mh8g0r xdj266r x2lwn1j xeuugli x18d9i69 x4uap5 xkhd6sd xexx8yu x1n2onr6 x1ja2u2z"; const elements = document.querySelectorAll( `div.${targetClassName.replace(/\s/g, ".")}`, ); elements.forEach((element) => { if (element.textContent.includes("添加好友")) { const link = element.querySelector("a"); if (link && link.href) { window.open(link.href, "_blank"); } } }); }); initializeButtonState(); })();