Twitter Image 1-Click Download Background Space

Make the background area of a Twitter-hosted image (like an address ending in .jpg) a clickable download-prompt to image itself. Think of it like 'left click empty space == save-as'.

目前為 2016-01-28 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Twitter Image 1-Click Download Background Space
// @version      0.1
// @description  Make the background area of a Twitter-hosted image (like an address ending in .jpg) a clickable download-prompt to image itself. Think of it like 'left click empty space == save-as'.
// @author       Cro
// @match        https://pbs.twimg.com/media/*
// @grant        none
// @namespace https://gf.qytechs.cn/users/10865
// ==/UserScript==
'use strict';

var img = document.getElementsByTagName('img')[0];
var body = document.getElementsByTagName('body')[0];

if (img && body)
{
    var src = img.getAttribute('src');
    
    if (src)
    {
        var a = document.createElement('a');

        a.setAttribute('href', src);
        a.setAttribute('download', src.substr(src.lastIndexOf('/') + 1).replace(/:.*/, ''));
        a.style.setProperty('position', 'absolute');
        a.style.setProperty('height', '100%');
        a.style.setProperty('width', '100%');

        body.insertBefore(a, body.firstChild);
    }
}

QingJ © 2025

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