您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Extract name, location, and username from Facebook profile pages and update the title
当前为
// ==UserScript== // @name Facebook PageTitle updater // @version 1.1 // @description Extract name, location, and username from Facebook profile pages and update the title // @match https://www.facebook.com/* // @grant none // @namespace https://gf.qytechs.cn/users/1409709 // ==/UserScript== (function() { 'use strict'; function extractInfo() { const nameElement = document.querySelector('h1.html-h1'); let name = nameElement ? nameElement.textContent.trim() : ''; const livesInElement = Array.from(document.querySelectorAll('div[role="main"] span[dir="auto"]')).find(el => el.textContent.includes('Lives in')); let livesIn = livesInElement ? livesInElement.querySelector('a span').textContent.trim() : ''; const fromElement = Array.from(document.querySelectorAll('div[role="main"] span[dir="auto"]')).find(el => el.textContent.includes('From')); let from = fromElement ? fromElement.querySelector('a span').textContent.trim() : ''; const url = window.location.href; let username = ''; const usernameMatch = url.match(/facebook\.com\/([^/?&]+)/); if (usernameMatch && usernameMatch[1] && !usernameMatch[1].includes('profile.php')) { username = usernameMatch[1]; } let newTitle = ''; if (name) newTitle += `${name}`; if (livesIn) newTitle += ` - ${livesIn}`; if (from) newTitle += ` (From ${from})`; if (username) newTitle += ` - ${username}`; const titleElement = document.querySelector('title'); if (titleElement) titleElement.textContent = newTitle; } function monitorURLChanges() { let lastURL = window.location.href; setInterval(() => { const currentURL = window.location.href; if (currentURL !== lastURL) { lastURL = currentURL; extractInfo(); } }, 1000); } window.addEventListener('load', () => { extractInfo(); monitorURLChanges(); const titleObserver = new MutationObserver(() => { extractInfo(); }); const titleElement = document.querySelector('title'); if (titleElement) { titleObserver.observe(titleElement, { childList: true }); } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址