Greasy Fork镜像 支持简体中文。

Twitch Always Open "Following Live"

When you click on the "Following" button, open "Following Live" tab instead

  1. // ==UserScript==
  2. // @name Twitch Always Open "Following Live"
  3. // @namespace https://gf.qytechs.cn/en/users/786317
  4. // @version 1.0
  5. // @description When you click on the "Following" button, open "Following Live" tab instead
  6. // @author BidensGirl
  7. // @match https://www.twitch.tv/*
  8. // @icon https://www.twitch.tv/favicon.ico
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. /* I wanted to modify the big "Following" button at the top using
  17. document.querySelector('a.navigation-link[data-test-selector="top-nav__following-link"]');
  18. but for some reason this element's href parameter is not used when the button is clicked on
  19. and I could not figure out what place is responsible for opening a different page...
  20.  
  21. PS: It seems this data is coming from stored Web Components (?), there're many
  22. redundant references to /directory/ links in js files
  23. */
  24.  
  25. // Thanks, https://stackoverflow.com/questions/6390341/how-to-detect-if-url-has-changed-after-hash-in-javascript/41825103#41825103
  26. // popstate Event doesn't work indeed
  27. var pushState = history.pushState;
  28. history.pushState = function () {
  29. pushState.apply(history, arguments);
  30. //console.log(`URL changed to ${location.href}:` + JSON.stringify(arguments))
  31. // /directory/following
  32. if (arguments[2] === "/directory/following") {
  33. // this will inevitably reload the page completely
  34. window.location.replace(location.href + "/live");
  35. console.log("Twitch More Followed Channels: redirecting to /live");
  36. }
  37. };
  38.  
  39. })();

QingJ © 2025

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