Resize Image On "Open image in new tab"

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

目前为 2014-06-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Resize Image On "Open image in new tab"
  3. // @version 0.4.8
  4. // @description Support: Google(G+ blogspot picasa)\Tumblr\Twitter\新浪微博(sina weibo.com)\腾讯微博(tencent t.qq.com)
  5. // @match http://*.googleusercontent.com/*
  6. // @match https://*.googleusercontent.com/*
  7. // @match http://*.media.tumblr.com/*
  8. // @match https://*.media.tumblr.com/*
  9. // @match http://*.bp.blogspot.com/*
  10. // @match https://*.bp.blogspot.com/*
  11. // @match http://*.sinaimg.cn/*
  12. // @match https://*.sinaimg.cn/*
  13. // @match http://*.qpic.cn/*
  14. // @match http://*.twimg.com/*
  15. // @match https://*.twimg.com/*
  16. // @namespace https://greasyfork.org/users/2646
  17. // @copyright 2014+, CLE
  18. // ==/UserScript==
  19.  
  20. var url = document.location.toString();
  21. var m = null;
  22.  
  23. m = url.match(/^(https?:\/\/\w+\.googleusercontent\.com\/.+\/)([^\/]+)(\/[^\/]+(\.(jpg|jpeg|gif|png|bmp|webp))?)$/i);
  24. if(m) {
  25. if(m[2] != "s0") {
  26. document.location = m[1] + "s0" + m[3];
  27. }
  28. }
  29.  
  30. m = url.match(/^(https?:\/\/\w+\.googleusercontent\.com\/.+=)(.+)$/i);
  31. if(m) {
  32. if(m[2] != "s0") {
  33. document.location = m[1] + "s0";
  34. }
  35. }
  36.  
  37. m = url.match(/^(https?:\/\/\w+\.bp\.blogspot\.com\/.+\/)([^\/]+)(\/[^\/]+(\.(jpg|jpeg|gif|png|bmp|webp))?)$/i);
  38. if(m) {
  39. if(m[2] != "s0") {
  40. document.location = m[1] + "s0" + m[3];
  41. }
  42. }
  43.  
  44. var ma = url.match(/^(https?:\/\/\d+\.media\.tumblr\.com\/.*tumblr_\w+_)(\d+)(\.(jpg|jpeg|gif|png|bmp|webp))$/i);
  45. if(ma) {
  46. if(ma[2]<1280) {
  47. var ajax = new XMLHttpRequest();
  48. ajax.onreadystatechange=function() {
  49. if (ajax.readyState==4 && ajax.status==200) {
  50. document.location = ma[1] + "1280" + ma[3];
  51. }
  52. }
  53. ajax.open("HEAD", ma[1]+"1280"+ma[3], true);
  54. ajax.send();
  55. }
  56. }
  57.  
  58. m = url.match(/^(https?:\/\/ww[\d]+\.sinaimg\.cn\/)([^\/]+)(\/.+)$/i);
  59. if(m) {
  60. if(m[2] != "large") {
  61. document.location = m[1] + "large" + m[3];
  62. }
  63. }
  64.  
  65. m = url.match(/^(http:\/\/[\w\d]+\.qpic\.cn\/.+\/)(\d+)$/i);
  66. if(m) {
  67. if(m[2]<2000) {
  68. document.location = m[1] + "2000";
  69. }
  70. }
  71.  
  72. m = url.match(/^https?:\/\/\w+\.twimg\.com\/media\/[^\/]+\.(jpg|jpeg|gif|png|bmp|webp)$/i)
  73. if(m) {
  74. document.location = m[0] + ":large";
  75. }