Tumblr Image Size

When directly viewing an image on Tumblr, ensures that the highest resolution image is loaded.

  1. // ==UserScript==
  2. // @name Tumblr Image Size
  3. // @description When directly viewing an image on Tumblr, ensures that the highest resolution image is loaded.
  4. // @version 1.4
  5. // @namespace Dimethyl
  6. // @include /^https?://(\d+\.)?media\.tumblr\.com/(.+/)*tumblr_.+_\d+\.(jpe?g|gif|png|bmp)(\?.*)?$/
  7. // @grant GM.xmlHttpRequest
  8. // @connect amazonaws.com
  9. // ==/UserScript==
  10.  
  11. var sizes = [ /*'_raw.',*/ '_1280.', '_540.', '_500.', '_400.', '_250.', '_100.' ];
  12.  
  13. function checkSize(index) {
  14. if (index >= sizes.length) return;
  15. var url = window.location.href;
  16. // if (index == 0) url = url.replace(/^(https?:\/\/)\d+\.media\.tumblr\.com(\/.*)$/, '$1' + 's3.amazonaws.com/data.tumblr.com' + '$2');
  17. url = url.replace(/(.*(?=_))_\d*\.(.*)/, '$1' + sizes[index] + '$2');
  18. if (url == window.location.href) return;
  19. GM.xmlHttpRequest({
  20. url: url,
  21. method: 'HEAD',
  22. onload: function(response) {
  23. if (response.status != 200) {
  24. checkSize(index + 1);
  25. return;
  26. }
  27. window.location.replace(url);
  28. },
  29. onerror: function(response) {
  30. checkSize(index + 1);
  31. }
  32. });
  33. }
  34.  
  35. checkSize(0);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址