X_Twitter_Pinned_List_Open

Open a pinned list when you visit X(Twitter).

  1. // ==UserScript==
  2. // @name X_Twitter_Pinned_List_Open
  3. // @name:ja X(Twitter)で固定されたリストを開く
  4. // @namespace https://greatest.deepsurf.us/users/1324207
  5. // @match https://x.com/*
  6. // @exclude https://x.com/en/*
  7. // @exclude https://x.com/ja/*
  8. // @exclude https://x.com/account/*
  9. // @exclude https://x.com/intent/*
  10. // @exclude https://x.com/i/cards/*
  11. // @version 1.0
  12. // @run-at document-start
  13. // @author 乾かしカラス
  14. // @description Open a pinned list when you visit X(Twitter).
  15. // @description:ja X(Twitter)を訪れた時に固定されたリストを開きます。
  16. // @license MIT
  17. // @icon https://abs.twimg.com/favicons/twitter.3.ico
  18. // ==/UserScript==
  19.  
  20. (function() {
  21. 'use strict';
  22.  
  23. new MutationObserver(function(mutations, observer) {
  24. const tabs = document.querySelectorAll('[role="tab"][href="/home"]');
  25.  
  26. if (tabs.length < 3) {
  27. return;
  28. }
  29.  
  30. if (!tabs[0].ariaSelected && !tabs[1].ariaSelected) {
  31. return;
  32. }
  33.  
  34. tabs[2].click();
  35.  
  36. observer.disconnect();
  37. }).observe(document, { childList: true, subtree: true });
  38.  
  39. })();