您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a download button to dynamically change the URL to mbasic and open it in a new tab.
当前为
// ==UserScript== // @name Add FB Download Button // @namespace http://tampermonkey.net/ // @version 1.0 // @description Add a download button to dynamically change the URL to mbasic and open it in a new tab. // @author You // @match *://*.facebook.com/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; // Function to create and append the button function addDownloadButton() { const targetElement = document.querySelector(".xygnafs > div:nth-child(1) > div:nth-child(1)"); if (targetElement && !document.querySelector("#customDownloadButton")) { // Create a button const button = document.createElement("button"); button.id = "customDownloadButton"; button.style.display = "flex"; button.style.alignItems = "center"; button.style.justifyContent = "center"; button.style.border = "none"; button.style.padding = "5px 5px"; button.style.borderRadius = "100%"; button.style.backgroundColor = "#663DA2"; button.style.cursor = "pointer"; button.style.position = "relative"; button.style.marginLeft = "10px"; button.style.width = "40px"; button.style.height = "40px"; // ton.classlist.add("x9f619 x1n2onr6 x1ja2u2z x78zum5 xdt5ytf x2lah0s x193iq5w x1xmf6yo x1e56ztr xzboxd6 x14l7nz5"); // Add an SVG icon inside the button button.innerHTML = ` <svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#fff" viewBox="0 0 24 24"> <path d="M5 20v-2h14v2H5Zm7-3-5-5 1.4-1.4 2.6 2.575V4h2v9.175L15.6 10.6 17 12l-5 5Z"/> </svg> `; // Add click event to the button button.addEventListener("click", () => { const currentUrl = window.location.href; const modifiedUrl = currentUrl.replace("www.", "mbasic."); window.open(modifiedUrl, "_blank"); }); // Append the button to the target element targetElement.appendChild(button); } } // Observe for changes in the DOM const observer = new MutationObserver(() => { addDownloadButton(); }); observer.observe(document.body, { childList: true, subtree: true }); // Try to add the button immediately if the element already exists addDownloadButton(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址