Mercurial > ec-userscripts
comparison twitter-default-following-tab.user.js @ 128:f2a53a2b9a5b
More precise selector
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 21 Jan 2023 03:18:24 +0900 |
parents | a701294f38ff |
children | 7a7aafa65bae |
comparison
equal
deleted
inserted
replaced
127:a701294f38ff | 128:f2a53a2b9a5b |
---|---|
3 // @namespace https://nanaya.net | 3 // @namespace https://nanaya.net |
4 // @match https://mobile.twitter.com/* | 4 // @match https://mobile.twitter.com/* |
5 // @match https://twitter.com/* | 5 // @match https://twitter.com/* |
6 // @grant none | 6 // @grant none |
7 // @run-at document-start | 7 // @run-at document-start |
8 // @version 1.1.0 | 8 // @version 1.1.1 |
9 // @author nanaya | 9 // @author nanaya |
10 // @description Always select Following tab on first load | 10 // @description Always select Following tab on first load |
11 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/twitter-default-following-tab.user.js | 11 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/twitter-default-following-tab.user.js |
12 // @updateURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/twitter-default-following-tab.user.js | 12 // @updateURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/twitter-default-following-tab.user.js |
13 // ==/UserScript== | 13 // ==/UserScript== |
42 return; | 42 return; |
43 } | 43 } |
44 | 44 |
45 if (selected) return; | 45 if (selected) return; |
46 | 46 |
47 const followingTab = document.querySelectorAll('[href="/home"][role=tab]')?.[1]; | 47 const followingTab = document.querySelectorAll('a[href="/home"][role=tab]')?.[1]; |
48 if (followingTab == null) return; | 48 if (followingTab == null) return; |
49 | 49 |
50 if (followingTab.getAttribute('aria-selected') === 'true') { | 50 if (followingTab.getAttribute('aria-selected') === 'true') { |
51 selected = true; | 51 selected = true; |
52 return; | 52 return; |