Twitter Original Image Link

Simple script that replace an image link with an original image URL if you click links on Tweet for navigating the image on new tab or copying the URL.

目前為 2019-11-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Twitter Original Image Link
// @name:ja     Twitter 原寸画像リンク
// @description Simple script that replace an image link with an original image URL if you click links on Tweet for navigating the image on new tab or copying the URL.
// @description:ja ツイート上の画像をクリックしたとき (新しいタブで開く・URLのコピー) に、画像のリンクを原寸画像のURLに置換する軽量スクリプトです。
// @namespace   https://gf.qytechs.cn/users/137
// @version     1.0.0
// @match       https://twitter.com/*
// @exclude     https://twitter.com/settings*
// @exclude     https://twitter.com/tos*
// @exclude     https://twitter.com/privacy*
// @exclude     https://twitter.com/jobs*
// @exclude     https://twitter.com/account/*
// @exclude     https://twitter.com/intent/*
// @exclude     https://twitter.com/i/cards/*
// @license     MPL-2.0
// @compatible  Edge 非推奨 / Deprecated
// @compatible  Firefox
// @compatible  Opera
// @compatible  Chrome
// @grant       dummy
// @run-at      document-start
// @icon        data:image/svg+xml;charset=utf8,<svg id="Logo_FIXED" data-name="Logo %E2%80%94 FIXED" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400"><defs><style>.cls-1{fill:none;}.cls-2{fill:%231da1f2;}</style></defs><title>Twitter_Logo_Blue</title><rect class="cls-1" width="400" height="400"/><path class="cls-2" d="M153.62,301.59c94.34,0,145.94-78.16,145.94-145.94,0-2.22,0-4.43-.15-6.63A104.36,104.36,0,0,0,325,122.47a102.38,102.38,0,0,1-29.46,8.07,51.47,51.47,0,0,0,22.55-28.37,102.79,102.79,0,0,1-32.57,12.45,51.34,51.34,0,0,0-87.41,46.78A145.62,145.62,0,0,1,92.4,107.81a51.33,51.33,0,0,0,15.88,68.47A50.91,50.91,0,0,1,85,169.86c0,.21,0,.43,0,.65a51.31,51.31,0,0,0,41.15,50.28,51.21,51.21,0,0,1-23.16.88,51.35,51.35,0,0,0,47.92,35.62,102.92,102.92,0,0,1-63.7,22A104.41,104.41,0,0,1,75,278.55a145.21,145.21,0,0,0,78.62,23"/></svg>
// @author      100の人
// @homepageURL https://gf.qytechs.cn/users/137
// ==/UserScript==

'use strict';

function replaceImageLink(event)
{
	if (event.target.localName !== 'img') {
		return;
	}

	const anchor
		= event.target.closest('[href$="/photo/1"], [href$="/photo/2"], [href$="/photo/3"], [href$="/photo/4"]');
	if (!anchor || !anchor.matches('article *')) {
		return;
	}

	const url = new URL(event.target.src);
	url.searchParams.set('name', 'orig');
	anchor.href = url;
}

addEventListener('click', replaceImageLink, true);
addEventListener('auxclick', replaceImageLink, true);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址