Greasy Fork

Greasy Fork is available in English.

View Full Twitter Image

Undo Twitter's insistence to down-res images when viewing on its dedicated page and add a button to download the full image without the weird file extensions which don't count as actual images.

当前为 2017-02-07 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         View Full Twitter Image
// @version      1.2.1
// @description  Undo Twitter's insistence to down-res images when viewing on its dedicated page and add a button to download the full image without the weird file extensions which don't count as actual images.
// @author       ForgottenUmbrella
// @match        https://pbs.twimg.com/media/*
// @grant        none
// @noframes
// @namespace http://greasyfork.icu/users/83187
// ==/UserScript==


function dom_create(type, text, after, func, style)
{
    if (typeof style === 'undefined') {
        style = {};
    }
    var element = document.createElement(type);
    var t = document.createTextNode(text);
    element.appendChild(t);
    element.onclick = func;
    element.style.height = style.height;
    element.style.width = style.width;
    element.style.marginLeft = style.margin_left;
    element.style.marginRight = style.margin_right;
    element.style.marginTop = style.margin_top;
    element.style.marginBottom = style.margin_bottom;
    document.body.insertBefore(element, after);
    return element;
}


function download_pic()
{
    'use strict';
    var dl = document.createElement('a');
    dl.href = location.href;
    dl.setAttribute('download', location.href.slice(28, location.href.length-5));
    dl.click();
}


//function iqdb_search()
//{
//    'use strict';
//    location.href = "https://iqdb.org?url=" + location.href;
//}


(function()
{
    "use strict";
    console.log('(Full Image) Running.');
    if (window.location.href.includes(":large")) {
        console.log("(Full Image) Will replace large with original.");
        window.location.href = window.location.href.replace(":large", ":orig");
    }
    if (!window.location.href.includes(":orig")) {
        console.log('(Full Image) Will change URL.');
        window.location.href += ":orig";
    }

    var img = document.getElementsByTagName('img')[0];
    var spacing = dom_create('p', "", img);
    var btn = dom_create('button', "Download", spacing, download_pic);
    //var btn_2 = dom_create('button', "IQDB Search", spacing, iqdb_search, {margin_left:"20px"});
})();