Greasy Fork 还支持 简体中文。

Twitter Image Link

Add a direct link for each image in a tweet after "Reply/RT/Like/DM" icons

安裝腳本?
作者推薦腳本

您可能也會喜歡 Twitter t.co GO TO HELL

安裝腳本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Twitter Image Link
// @description Add a direct link for each image in a tweet after "Reply/RT/Like/DM" icons
// @icon        https://abs.twimg.com/favicons/favicon.ico
// @include     twitter.com
// @match       *://*.twitter.com/*
// @exclude     *://twitter.com/i/cards/*
// @version     1.0.1
// @grant       none
// @namespace   https://greasyfork.org/users/113252-garrison-baird
// @run-at      document-end
// ==/UserScript==

function linker () {
  var divs = document.querySelectorAll('.AdaptiveMedia');
  divs.forEach(function(div) {
    var container = div.parentElement;
    var content = container.parentElement;
    if (content.querySelector('.ProfileTweet-action--extractImages')) return;

    var div_a = document.createElement('div');
    div_a.className = "ProfileTweet-action ProfileTweet-action--extractImages";
    content.querySelector('div.ProfileTweet-actionList').appendChild(div_a);

    var sources = div.querySelectorAll('img');
    sources.forEach(function(source){
      var source = source.getAttribute('src')//.replace(/\.jpg$/i, '.jpg:orig');

      var button = document.createElement('a');
      button.className = 'ProfileTweet-actionButton u-textUserColorHover';
      div_a.appendChild(button);
      var div_span = document.createElement('div');
      div_span.className = 'IconContainer js-tooltip';
      button.appendChild(div_span);
      var span = document.createElement('span');
      span.className = 'Icon Icon--medium Icon--photo';
      div_span.appendChild(span);

      button.setAttribute('href', source);
      button.setAttribute('target', '_blank');
    })
  })

}

linker();
if (window.location.host == 'tweetdeck.twitter.com') {
  setInterval(linker, 1000);
} else {
  window.addEventListener('scroll', linker);
  setInterval(linker, 5000);
}