Twitch remove referrer=raid

automatically remove ?referrer=raid from twitch urls

  1. // ==UserScript==
  2. // @name Twitch remove referrer=raid
  3. // @description automatically remove ?referrer=raid from twitch urls
  4. // @namespace https://github.com/adrianmgg
  5. // @version 2.0.2
  6. // @author amgg
  7. // @license MIT
  8. // @compatible chrome
  9. // @compatible firefox
  10. // @match https://www.twitch.tv/*
  11. // @match https://www.twitch.tv
  12. // @grant unsafeWindow
  13. // @run-at document-start
  14. // ==/UserScript==
  15.  
  16. // i can't think of what to name this function right now
  17. function doTheThing(url) {
  18. // doing it this way (referrer=raid without the ?) since this works when there are other url params
  19. if(url.includes("referrer=raid")) {
  20. document.location.href = url.replace("referrer=raid", "");
  21. }
  22. }
  23.  
  24. const PUSHSTATE = unsafeWindow.history.pushState;
  25. unsafeWindow.history.pushState = function(state, title, url) {
  26. doTheThing(url);
  27. return PUSHSTATE.apply(this, arguments);
  28. };
  29.  
  30. // just in case we were brought to the page directly rather than through pushstate
  31. doTheThing(document.location.href);
  32.  

QingJ © 2025

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