Resize Image On "Open image in new tab"

Support: Google(G+ blogspot picasa)\Tumblr\Twitter\新浪微博(sina weibo.com)\腾讯微博(tencent t.qq.com)

Versione datata 12/06/2014. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name       Resize Image On "Open image in new tab"
// @version    0.4.9
// @description  Support: Google(G+ blogspot picasa)\Tumblr\Twitter\新浪微博(sina weibo.com)\腾讯微博(tencent t.qq.com)
// @match      http://*.googleusercontent.com/*
// @match      https://*.googleusercontent.com/*
// @match      http://*.media.tumblr.com/*
// @match      https://*.media.tumblr.com/*
// @match      http://*.bp.blogspot.com/*
// @match      https://*.bp.blogspot.com/*
// @match      http://*.sinaimg.cn/*
// @match      https://*.sinaimg.cn/*
// @match      http://*.qpic.cn/*
// @match      http://*.twimg.com/*
// @match      https://*.twimg.com/*
// @namespace https://greasyfork.org/users/2646
// @copyright  2014+, CLE
// ==/UserScript==

var url = document.location.toString();
var m = null;

m = url.match(/^(https?:\/\/\w+\.googleusercontent\.com\/.+\/)([^\/]+)(\/[^\/]+(\.(jpg|jpeg|gif|png|bmp|webp))?)$/i);
if(m) {
    if(m[2] != "s0") {
        document.location = m[1] + "s0" + m[3];
    }
}

m = url.match(/^(https?:\/\/\w+\.googleusercontent\.com\/.+=)(.+)$/i);
if(m) {
    if(m[2] != "s0") {
        document.location = m[1] + "s0";
    }
}

m = url.match(/^(https?:\/\/\w+\.bp\.blogspot\.com\/.+\/)([^\/]+)(\/[^\/]+(\.(jpg|jpeg|gif|png|bmp|webp))?)$/i);
if(m) {
    if(m[2] != "s0") {
        document.location = m[1] + "s0" + m[3];
    }
}

var ma = url.match(/^(https?:\/\/\d+\.media\.tumblr\.com\/.*tumblr_\w+_)(\d+)(\.(jpg|jpeg|gif|png|bmp|webp))$/i);
if(ma) {
    if(ma[2]<1280) {
        var ajax = new XMLHttpRequest();
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4 && ajax.status==200) {
                document.location = ma[1] + "1280" + ma[3];
            }
        }
        ajax.open("HEAD", ma[1]+"1280"+ma[3], true);
        ajax.send();
    }
}

m = url.match(/^(https?:\/\/ww[\d]+\.sinaimg\.cn\/)([^\/]+)(\/.+)$/i);
if(m) {
    if(m[2] != "large") {
        document.location = m[1] + "large" + m[3];
    }
}

m = url.match(/^(http:\/\/[\w\d]+\.qpic\.cn\/.+\/)(\d+)$/i);
if(m) {
    if(m[2]<2000) {
        document.location = m[1] + "2000";
    }
}

m = url.match(/^https?:\/\/\w+\.twimg\.com\/media\/([^\/:]+\.(jpg|jpeg|gif|png|bmp|webp))$/i)
if(m) {
    document.location = m[0] + ":large?" + m[1];
}

m = url.match(/^(https?:\/\/\w+\.twimg\.com\/media\/([^\/]+\.(jpg|jpeg|gif|png|bmp|webp)))\:(\w+)$/i)
if(m) {
	if(m[4]!="large") {
        document.location = m[1] + ":large?" + m[2];
    }
}