🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Resize Image On "Open image in new tab"

Support: Google(G+ blogspot picasa)\Tumblr\Twitter\weibo.com (And more...

As of 2015-09-27. See the latest version.

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.

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

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

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

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

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

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name       Resize Image On "Open image in new tab"
// @name:zh-cn 右键在新标签中打开图片时显示最优化图像质量
// @version    0.4.15
// @description  Support: Google(G+ blogspot picasa)\Tumblr\Twitter\weibo.com (And more...
// @description:zh-cn 支持:谷歌(G+ blogspot picasa)、Tumblr、推特、新浪微博、腾讯微博、知乎、豆瓣
// @run-at     document-start
// @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/*
// @match      http://*.zhimg.com/*
// @match      https://*.zhimg.com/*
// @match      http://*.douban.com/view/photo/*
// @match      https://*.douban.com/view/photo/*
// @namespace https://greasyfork.org/users/2646
// @copyright  2015+, CLE
// ==/UserScript==

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

//google
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";
    }
}

//blogspot
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];
    }
}

//tumblr
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";
    }
    /*if(m[2]!=0) {
        document.location = m[1] + "0";
    }*/
}

//twitter
m = url.match(/^https?:\/\/\w+\.twimg\.com\/media\/([^\/:]+\.(jpg|jpeg|gif|png|bmp|webp))$/i);
if(m) {
    document.location = m[0] + ":large";
}
/*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];
    }
}*/

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

//douban
ma = url.match(/^(https?:\/\/\w+\.douban\.com\/view\/photo\/)(\w+)(\/public\/.+\.(jpg|jpeg|gif|png|bmp|webp))$/i);
if(ma){
    if(ma[2] != "large"){
        var ajax = new XMLHttpRequest();
        ajax.onreadystatechange=function() {
            if (ajax.readyState==4 && ajax.status==200) {
                document.location = ma[1] + "large" + ma[3];
            }else if(ajax.readyState==4 && ajax.status==404) {
                if(ma[2] != "photo"){
                    document.location = ma[1] + "photo" + ma[3];
                }
            }
        }
        ajax.open("GET", ma[1]+"large"+ma[3], true); //豆瓣不支持HEAD,只能用GET,会影响判断速度
        ajax.send();
    }
}