// ==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://greasyfork.org/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,Twitter_Logo_Blue // @author 100の人 // @homepageURL https://greasyfork.org/users/137 // @downloadURL none // ==/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);