Greasy Fork 支持简体中文。

twimg redirect to original

Redirect twimg to :orig

  1. // ==UserScript==
  2. // @name twimg redirect to original
  3. // @namespace https://mzile.net
  4. // @version 1.3.2
  5. // @description Redirect twimg to :orig
  6. // @author eai04191
  7. // @license MIT
  8. // @supportURL https://github.com/eai04191/twimg-redirect-to-original/issues
  9. // @match *://pbs.twimg.com/media/*
  10. // @exclude *://pbs.twimg.com/media/*name=orig
  11. // @run-at document-start
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. //https://pbs.twimg.com/media/ABC.jpg:large
  16. //https://pbs.twimg.com/media/ABC?format=jpg&name=large
  17.  
  18. var url = window.document.location + "";
  19. url = url.replace(/\?format=/, ".");
  20. url = url.replace(/\&name=/, ":");
  21. //https://pbs.twimg.com/media/ABC.jpg:large
  22. //https://pbs.twimg.com/media/ABC.jpg:large
  23.  
  24. url = url.replace(/\.(?=[^.]*$)/, "?format=");
  25. //https://pbs.twimg.com/media/ABC?format=jpg:large
  26.  
  27. url = url.replace( /(:large|:medium|:small|:orig|:thumb|:360x360|:900x900)/, "");
  28. //https://pbs.twimg.com/media/ABC?format=jpg
  29.  
  30. window.location.replace( url + "&name=orig" );
  31. //https://pbs.twimg.com/media/ABC?format=jpg&name=orig