IMDb URL cleaner

Removes crap from IMDb URLs

  1. // ==UserScript==
  2. // @name IMDb URL cleaner
  3. // @namespace Rennex/IMDb-cleaner
  4. // @version 1.1
  5. // @description Removes crap from IMDb URLs
  6. // @author Rennex
  7. // @include http*://*.imdb.*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. var origloc = location.href
  13.  
  14. // clean up the hostname
  15. var loc = origloc.replace(/(akas|former)\.imdb\.(com|de|it|fr)/, "www.imdb.com")
  16. // we need to redirect if the hostname changed
  17. var redirect = (loc != origloc)
  18.  
  19. // clean up query string crap
  20. loc = loc.replace(/([\?&])ref_=[^&#]*&?/, "$1").replace(/[\?&]($|#)/, "$1")
  21.  
  22. if (redirect) location.href = loc
  23. else if (loc != origloc) history.replaceState(null, "", loc.replace(/^https?:\/\/[^\/]+/, ""))
  24.  

QingJ © 2025

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