twimg_redirect_orig2

Redirect twimg to :orig (keep protocol, http or https)

当前为 2015-12-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name twimg_redirect_orig2
  3. // @namespace http://catherine.v0cyc1pp.com/twimg_redirect_orig2.user.js
  4. // @include http://pbs.twimg.com/media/*
  5. // @include https://pbs.twimg.com/media/*
  6. // @exclude http://pbs.twimg.com/media/*:orig#.*
  7. // @exclude https://pbs.twimg.com/media/*:orig#.*
  8. // @run-at document-start
  9. // @author greg10
  10. // @license GPL 3.0
  11. // @version 2.0
  12. // @grant none
  13. // @description Redirect twimg to :orig (keep protocol, http or https)
  14. // ==/UserScript==
  15.  
  16. var str = content.document.location + "";
  17.  
  18.  
  19. str = str.replace( /:(large|orig).*$/, "");
  20. //str = str.replace( /^https:/, "http:");
  21. var ext = str.substr( str.length - 3, 3);
  22. //console.log("ext="+ext);
  23.  
  24. var url = str + ":orig#." + ext;
  25.  
  26. window.location.replace( url );