您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
7/1/2023, 2:28:15 PM
当前为
// ==UserScript== // @name twitter.com to embed // @namespace Violentmonkey Scripts // @match https://*.twitter.com/* // @grant none // @version 1.0.1 // @license GPLv3 // @author - // @run-at document-start // @description 7/1/2023, 2:28:15 PM // ==/UserScript== function rewrite(url) { const paths = url.pathname.split(`/`).slice(1); if (paths.length === 1) { return `https://syndication.twitter.com/srv/timeline-profile/screen-name/` + paths[0]; } else if (paths.length == 3 && Number(paths[2])) { return `https://platform.twitter.com/embed/Tweet.html?id=` + paths[2]; } } if (location.hostname === `twitter.com` && rewrite(location)) { location.replace(rewrite(location)); } window.addEventListener(`load`, () => { if (location.href.startsWith(`https://syndication.twitter.com/srv/timeline-profile/screen-name/`)) { const style = document.createElement(`style`); style.innerHTML = `#__next { width: 800px; margin:auto; }`; document.head.append(style); } setTimeout(() => { for (const link of document.querySelectorAll(`a`)) { if (link.hostname.endsWith(`.twitter.com`)) continue; const newHref = rewrite(link); //console.debug(`rewrite ${link.href} to ${newHref}`) if (newHref) link.href = newHref; } }, 500); });