Twitter Image Tweaks

Undo Twitter's insistence to downres images, download the full image without weird file extensions and search the image on IQDB.

اعتبارا من 27-11-2016. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Twitter Image Tweaks
// @version      1.0
// @description  Undo Twitter's insistence to downres images, download the full image without weird file extensions and search the image on IQDB.
// @author       ForgottenUmbrella
// @match        https://pbs.twimg.com/media/*
// @grant        none
// @noframes
// @namespace https://greasyfork.org/users/83187
// ==/UserScript==


function dom_create(type, text, after, func, 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";
    if (!location.href.includes(":orig")){
        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"});
})();