Greasy Fork镜像 还支持 简体中文。

Image Window Fitter

When looking at a large image file that extends beyond the borders of the screen, this will fit it onto your screen

  1. // ==UserScript==
  2. // @name Image Window Fitter
  3. // @namespace http://use.i.E.your.homepage/
  4. // @version 0.1
  5. // @description When looking at a large image file that extends beyond the borders of the screen, this will fit it onto your screen
  6. // @match http*://*/*.jpg
  7. // @match http*://*/*.jpeg
  8. // @match http*://*/*.png
  9. // @match http*://*/*.gif
  10. // @match http*://*/*.tif
  11. // @match http*://*/*.tiff
  12. // @match http*://*/*.bmp
  13. // @author wpatter6
  14. // @copyright 2014+, wpatter6
  15. // ==/UserScript==
  16.  
  17. function addJQuery(callback) {
  18. var script = document.createElement("script");
  19. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  20. script.addEventListener('load', function() {
  21. var script = document.createElement("script");
  22. script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
  23. document.body.appendChild(script);
  24. }, false);
  25. document.body.appendChild(script);
  26. }
  27.  
  28. function main() {
  29. jQ('img').each(function (){
  30. if(jQ(this).width() > Math.min(jQ(this).parent().width(), jQ(window).width())){
  31. console.log("Resizing image " + (jQ(this).attr("id") || ""));
  32. jQ(this).css({"width":"100%"});
  33. }
  34. });
  35. }
  36.  
  37. addJQuery(main);

QingJ © 2025

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