您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replace x.com links with embedded tweets
当前为
- // ==UserScript==
- // @name X.com to Twitter.com Embedded Tweet in Voz
- // @namespace Embedded Tweet in Voz
- // @version 1.3
- // @description Replace x.com links with embedded tweets
- // @icon https://www.google.com/s2/favicons?sz=64&domain=voz.vn
- // @author kylyte
- // @match https://voz.vn/t/*
- // @match https://voz.vn/conversations/*
- // @match https://voz.vn/whats-new/profile-posts/*
- // @match https://voz.vn/u/*
- // @run-at document-start
- // @license GPL-3.0
- // ==/UserScript==
- (function() {
- 'use strict';
- function replaceDivWithIframe() {
- const divs = document.querySelectorAll('div.bbCodeBlock--unfurl');
- divs.forEach(div => {
- const anchor = div.querySelector('a[href^="https://x.com"]');
- if (anchor) {
- const href = anchor.getAttribute('href');
- const postIdMatch = href.match(/status\/(\d+)/);
- if (postIdMatch && postIdMatch[1]) {
- const postId = postIdMatch[1];
- const iframe = document.createElement('iframe');
- iframe.id = "twitter-widget-0";
- iframe.scrolling = "no";
- iframe.frameBorder = "0";
- iframe.allowTransparency = "true";
- iframe.allowFullscreen = "true";
- iframe.style.position = "static";
- iframe.style.visibility = "visible";
- iframe.style.width = "550px";
- iframe.style.height = "1410px";
- iframe.style.display = "block";
- iframe.style.flexGrow = "1";
- iframe.title = "X Post";
- iframe.dataset.tweetId = postId;
- iframe.src = `https://platform.twitter.com/embed/Tweet.html?id=${postId}&width=550px`;
- div.parentNode.replaceChild(iframe, div);
- }
- }
- });
- }
- window.addEventListener('load', replaceDivWithIframe);
- const observer = new MutationObserver(replaceDivWithIframe);
- observer.observe(document.body, { childList: true, subtree: true });
- })();