Greasy Fork is available in English.
Facebook一键脚本,目前支持点赞与移除推荐
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/490096/1344515/Facebook%E4%B8%80%E9%94%AE%E8%84%9A%E6%9C%AC.js
// ==UserScript==
// @name Facebook一键脚本
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Facebook一键脚本,目前支持点赞与移除推荐
// @author 亦安
// @match https://www.facebook.com/*
// @grant none
// ==/UserScript==
(function () {
"use strict";
const likeButton = document.createElement("button");
likeButton.textContent = "一键点赞";
likeButton.style =
"position: fixed; bottom: 60px; right: 20px; z-index: 10000; padding: 10px; fontSize: 16px;";
document.body.appendChild(likeButton);
const removeButton = document.createElement("button");
removeButton.textContent = "移除推荐";
removeButton.style =
"position: fixed; bottom: 20px; right: 20px; z-index: 10000; padding: 10px; fontSize: 16px;";
document.body.appendChild(removeButton);
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() * (1500 - 500) + 500,
);
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);
});
})();