You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让Twitter信息流图片不被裁剪,无需点击即可完整显示?

解决方案

临时测试方案(开发者控制台直接运行)

直接在Chrome开发者工具的「控制台」标签页粘贴以下代码回车即可生效:

// 修复图片容器比例的函数
function fixTwitterImageRatio() {
  const imageContainers = document.querySelectorAll('div.r-1adg3ll.r-13qz1uu');
  imageContainers.forEach(container => {
    if (container.dataset.processed) return;
    const innerImg = container.querySelector('img[src*="pbs.twimg.com"]');
    if (!innerImg) return;
    const rawImg = new Image();
    rawImg.crossOrigin = 'anonymous';
    rawImg.onload = () => {
      const aspectRatio = (rawImg.naturalHeight / rawImg.naturalWidth) * 100;
      container.style.paddingBottom = `${aspectRatio}%`;
      container.dataset.processed = '1';
    };
    rawImg.src = innerImg.src.replace(/name=[^&]+$/, 'name=orig');
  });
}

// 处理当前页已加载的内容
fixTwitterImageRatio();

// 监听信息流动态加载的新内容
const observer = new MutationObserver(fixTwitterImageRatio);
observer.observe(document.querySelector('main') || document.body, {
  childList: true,
  subtree: true
});

注意:刷新页面或关闭浏览器后效果会失效,仅适合临时使用

长期生效方案

不需要从零开发完整Chrome扩展,两种低门槛方案可选:

  • 油猴脚本:将上述代码封装为油猴脚本,设置匹配规则为https://x.com/*、https://twitter.com/*,打开对应站点时脚本会自动执行,永久生效
  • 极简Chrome扩展:仅需创建两个文件即可打包为扩展,manifest.json填写基础的扩展配置,content.js写入上述代码,安装扩展后打开站点自动生效

内容的提问来源于stack exchange,提问作者vepzfe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 13:15:03