Greasy Fork is available in English.

Resize Image On "Open image in new tab"

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

Per 30-06-2016. Zie de nieuwste versie.

  1. // ==UserScript==
  2. // @name Resize Image On "Open image in new tab"
  3. // @name:zh-cn 右键在新标签中打开图片时显示最优化图像质量
  4. // @version 0.5.7
  5. // @description Support: Google(G+ blogspot picasa)\Tumblr\Twitter\Steam(Only user content)\weibo.com (And more...
  6. // @description:zh-cn 支持:谷歌(G+ blogspot picasa)、Tumblr、推特、Steam、新浪微博、腾讯微博、知乎、豆瓣、百度贴吧
  7. // @run-at document-start
  8. // @match http://*.googleusercontent.com/*
  9. // @match https://*.googleusercontent.com/*
  10. // @match http://*.media.tumblr.com/*
  11. // @match https://*.media.tumblr.com/*
  12. // @match http://*.bp.blogspot.com/*
  13. // @match https://*.bp.blogspot.com/*
  14. // @match http://*.sinaimg.cn/*
  15. // @match https://*.sinaimg.cn/*
  16. // @match http://*.qpic.cn/*
  17. // @match http://*.twimg.com/*
  18. // @match https://*.twimg.com/*
  19. // @match http://*.zhimg.com/*
  20. // @match https://*.zhimg.com/*
  21. // @match http://*.douban.com/view/*
  22. // @match https://*.douban.com/view/*
  23. // @match http://*.doubanio.com/view/*
  24. // @match https://*.doubanio.com/view/*
  25. // @match http://imgsrc.baidu.com/*
  26. // @match http://imgsrc.bdimg.com/*
  27. // @match http://*.hiphotos.baidu.com/*
  28. // @match http://*.hiphotos.bdimg.com/*
  29. // @match http://images.akamai.steamusercontent.com/*
  30. // @match http://*.artstation.com/*
  31. // @match https://*.artstation.com/*
  32. // @namespace https://greasyfork.org/users/2646
  33. // @copyright 2016+, CLE
  34. // ==/UserScript==
  35.  
  36. var url = document.location.toString();
  37. var m = null;
  38.  
  39. //google
  40. if( (m = url.match(/^(https?:\/\/\w+\.googleusercontent\.com\/.+\/)([^\/]+)(\/[^\/]+(\.(jpg|jpeg|gif|png|bmp|webp))?)(?:\?.+)?$/i)) ) {
  41. if(m[2] != "s0") {
  42. document.location = m[1] + "s0" + m[3];
  43. }
  44. }
  45. else if( (m = url.match(/^(https?:\/\/\w+\.googleusercontent\.com\/.+=)(.+)(?:\?.+)?$/i)) ) {
  46. if(m[2] != "s0") {
  47. document.location = m[1] + "s0";
  48. }
  49. }
  50.  
  51. //blogspot
  52. else if( (m = url.match(/^(https?:\/\/\w+\.bp\.blogspot\.com\/.+\/)([^\/]+)(\/[^\/]+(\.(jpg|jpeg|gif|png|bmp|webp))?)(?:\?.+)?$/i)) ) {
  53. if(m[2] != "s0") {
  54. document.location = m[1] + "s0" + m[3];
  55. }
  56. }
  57.  
  58. //tumblr
  59. else if( (m = url.match(/^(https?:\/\/\d+\.media\.tumblr\.com\/.*tumblr_\w+_)(\d+)(\.(jpg|jpeg|gif|png|bmp|webp))(?:\?.+)?$/i)) ) {
  60. if(m[2]<1280) {
  61. var ajax = new XMLHttpRequest();
  62. ajax.onreadystatechange=function() {
  63. if(ajax.status==200) {
  64. document.location = m[1] + "1280" + m[3];
  65. }
  66. };
  67. ajax.open("HEAD", m[1]+"1280"+m[3], true);
  68. ajax.send();
  69. }
  70. }
  71.  
  72. //twitter
  73. else if( (m = url.match(/^(https?:\/\/\w+\.twimg\.com\/media\/(?:[^\/:]+\.(?:jpg|jpeg|gif|png|bmp|webp)))(:\w+)?(?:\?.+)?$/i)) ) {
  74. if ( m[2]===null || m[2] != ":orig" )
  75. document.location = m[1] + ":orig";
  76. }
  77.  
  78. //Steam (Only user content)
  79. else if( (m = url.match(/^(http:\/\/images\.akamai\.steamusercontent\.com\/[^\?]+)\?.+$/i)) ){
  80. document.location = m[1];
  81. }
  82.  
  83. //性浪微博
  84. else if( (m = url.match(/^(https?:\/\/\w+\.sinaimg\.cn\/)([a-zA-Z]\w+)(\/.+)(?:\?.+)?$/i)) ) {
  85. if(m[2] != "large") {
  86. document.location = m[1] + "large" + m[3];
  87. }
  88. }
  89.  
  90. //疼逊微博
  91. else if( (m = url.match(/^(http:\/\/[\w\d]+\.qpic\.cn\/.+\/)(\d+)(?:\?.+)?$/i)) ) {
  92. if(m[2]<2000) {
  93. document.location = m[1] + "2000";
  94. }
  95. /*if(m[2]!=0) {
  96. document.location = m[1] + "0";
  97. }*/
  98. }
  99.  
  100. //zhihu
  101. else if( (m = url.match(/^(https?:\/\/.+\.zhimg\.com\/\w+_)(\w+)(\.(jpg|jpeg|gif|png|bmp|webp))(?:\?.+)?$/i)) ){
  102. if(m[2]!="r") {
  103. document.location = m[1] + "r" + m[3];
  104. }
  105. }
  106.  
  107. //douban
  108. else if( (m = url.match(/^(https?:\/\/\w+\.douban(?:io)?\.com\/view\/(?:photo|commodity_story)\/)(\w+)(\/public\/.+\.(jpg|jpeg|gif|png|bmp|webp))(?:\?.+)?$/i)) ){
  109. if(m[2] != "raw"){
  110. var ajax = new XMLHttpRequest();
  111. ajax.onreadystatechange=function() {
  112. if(ajax.status==200) {
  113. document.location = m[1] + "raw" + m[3];
  114. }else if(ajax.status==404) {
  115. if(m[2] != "photo"){
  116. document.location = m[1] + "photo" + m[3];
  117. }
  118. }
  119. };
  120. ajax.open("GET", m[1]+"raw"+m[3], true);
  121. ajax.send();
  122. }
  123. }
  124.  
  125. //artstation
  126. else if( (m = url.match(/^(https?:\/\/cdn\w+\.artstation\.com\/.+\/)(\w+)(\/[^\/]+)$/i)) ){
  127. if(m[2] != "original") {
  128. document.location = m[1] + "original" + m[3];
  129. }
  130. }
  131. //百度贴吧(然而对于画质提升什么的并没有什么卵用...)
  132. else if( !(m = url.match(/^http:\/\/imgsrc\.baidu\.com\/forum\/pic\/item\/.+/i)) ){
  133. if( (m = url.match(/^http:\/\/(?:imgsrc|\w+\.hiphotos)\.(?:bdimg|baidu)\.com\/(?:forum|album)\/.+\/(\w+\.(?:jpg|jpeg|gif|png|bmp|webp))(?:\?.+)?$/i)) ){
  134. document.location = "http://imgsrc.baidu.com/forum/pic/item/" + m[1];
  135. }
  136. }