Control Panel for Twitter

Gives you more control over Twitter and adds missing features and UI improvements

当前为 2025-01-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Control Panel for Twitter
  3. // @description Gives you more control over Twitter and adds missing features and UI improvements
  4. // @icon https://raw.githubusercontent.com/insin/control-panel-for-twitter/master/icons/icon32.png
  5. // @namespace https://github.com/insin/control-panel-for-twitter/
  6. // @match https://twitter.com/*
  7. // @match https://mobile.twitter.com/*
  8. // @match https://x.com/*
  9. // @match https://mobile.x.com/*
  10. // @run-at document-start
  11. // @version 180
  12. // ==/UserScript==
  13. void function() {
  14.  
  15. let debug = false
  16.  
  17. /** @type {boolean} */
  18. let desktop
  19. /** @type {boolean} */
  20. let mobile
  21. let isSafari = navigator.userAgent.includes('Safari/') && !/Chrom(e|ium)\//.test(navigator.userAgent)
  22.  
  23. /** @type {HTMLHtmlElement} */
  24. let $html
  25. /** @type {HTMLElement} */
  26. let $body
  27. /** @type {HTMLElement} */
  28. let $reactRoot
  29. /** @type {string} */
  30. let lang
  31. /** @type {string} */
  32. let dir
  33. /** @type {boolean} */
  34. let ltr
  35.  
  36. //#region Default config
  37. /**
  38. * @type {import("./types").Config}
  39. */
  40. const config = {
  41. debug: false,
  42. // Shared
  43. addAddMutedWordMenuItem: true,
  44. alwaysUseLatestTweets: true,
  45. defaultToLatestSearch: false,
  46. disableHomeTimeline: false,
  47. disabledHomeTimelineRedirect: 'notifications',
  48. disableTweetTextFormatting: false,
  49. dontUseChirpFont: false,
  50. dropdownMenuFontWeight: true,
  51. fastBlock: true,
  52. followButtonStyle: 'monochrome',
  53. hideAdsNav: true,
  54. hideBlueReplyFollowedBy: false,
  55. hideBlueReplyFollowing: false,
  56. hideBookmarkButton: false,
  57. hideBookmarkMetrics: true,
  58. hideBookmarksNav: false,
  59. hideCommunitiesNav: false,
  60. hideExplorePageContents: true,
  61. hideFollowingMetrics: true,
  62. hideForYouTimeline: true,
  63. hideGrokNav: true,
  64. hideInlinePrompts: true,
  65. hideJobsNav: true,
  66. hideLikeMetrics: true,
  67. hideListsNav: false,
  68. hideMetrics: false,
  69. hideMonetizationNav: true,
  70. hideMoreTweets: true,
  71. hideProfileRetweets: false,
  72. hideQuoteTweetMetrics: true,
  73. hideQuotesFrom: [],
  74. hideReplyMetrics: true,
  75. hideRetweetMetrics: true,
  76. hideSeeNewTweets: false,
  77. hideShareTweetButton: false,
  78. hideSubscriptions: true,
  79. hideTimelineTweetBox: false,
  80. hideTotalTweetsMetrics: true,
  81. hideTweetAnalyticsLinks: false,
  82. hideTwitterBlueReplies: false,
  83. hideTwitterBlueUpsells: true,
  84. hideUnavailableQuoteTweets: true,
  85. hideVerifiedNotificationsTab: true,
  86. hideViews: true,
  87. hideWhoToFollowEtc: true,
  88. listRetweets: 'ignore',
  89. mutableQuoteTweets: true,
  90. mutedQuotes: [],
  91. quoteTweets: 'ignore',
  92. reducedInteractionMode: false,
  93. restoreLinkHeadlines: true,
  94. replaceLogo: true,
  95. restoreOtherInteractionLinks: false,
  96. restoreQuoteTweetsLink: true,
  97. retweets: 'separate',
  98. showBlueReplyFollowersCountAmount: '1000000',
  99. showBlueReplyFollowersCount: false,
  100. showBlueReplyVerifiedAccounts: false,
  101. showBookmarkButtonUnderFocusedTweets: true,
  102. sortReplies: 'relevant',
  103. tweakQuoteTweetsPage: true,
  104. twitterBlueChecks: 'replace',
  105. unblurSensitiveContent: false,
  106. uninvertFollowButtons: true,
  107. // Experiments
  108. // none currently
  109. // Desktop only
  110. fullWidthContent: false,
  111. fullWidthMedia: true,
  112. hideAccountSwitcher: false,
  113. hideExploreNav: true,
  114. hideExploreNavWithSidebar: true,
  115. hideMessagesDrawer: true,
  116. hideProNav: true,
  117. hideSidebarContent: true,
  118. hideSpacesNav: false,
  119. navBaseFontSize: true,
  120. navDensity: 'default',
  121. showRelevantPeople: false,
  122. // Mobile only
  123. hideMessagesBottomNavItem: false,
  124. }
  125. //#endregion
  126.  
  127. //#region Locales
  128. /**
  129. * @type {Record<string, import("./types").Locale>}
  130. */
  131. const locales = {
  132. 'ar-x-fm': {
  133. ADD_MUTED_WORD: 'اضافة كلمة مكتومة',
  134. GROK_ACTIONS: 'إجراءات Grok',
  135. HOME: 'الرئيسيّة',
  136. LIKES: 'الإعجابات',
  137. MOST_RELEVANT: 'الأكثر ملائمة',
  138. MUTE_THIS_CONVERSATION: 'كتم هذه المحادثه',
  139. POST_ALL: 'نشر الكل',
  140. POST_UNAVAILABLE: 'هذا المنشور غير متاح.',
  141. PROFILE_SUMMARY: 'ملخص الملف الشخصيّ',
  142. QUOTES: 'اقتباسات',
  143. QUOTE_TWEET: 'اقتباس التغريدة',
  144. QUOTE_TWEETS: 'تغريدات اقتباس',
  145. REPOST: 'إعادة النشر',
  146. REPOSTS: 'المنشورات المُعاد نشرها',
  147. RETWEET: 'إعادة التغريد',
  148. RETWEETED_BY: 'مُعاد تغريدها بواسطة',
  149. RETWEETS: 'إعادات التغريد',
  150. SHARED: 'مشترك',
  151. SHARED_TWEETS: 'التغريدات المشتركة',
  152. SHOW: 'إظهار',
  153. SHOW_MORE_REPLIES: 'عرض المزيد من الردود',
  154. SORT_REPLIES: 'فرز الردود',
  155. TURN_OFF_QUOTE_TWEETS: 'تعطيل تغريدات اقتباس',
  156. TURN_OFF_RETWEETS: 'تعطيل إعادة التغريد',
  157. TURN_ON_RETWEETS: 'تفعيل إعادة التغريد',
  158. TWEET: 'غرّدي',
  159. TWEETS: 'التغريدات',
  160. TWEET_ALL: 'تغريد الكل',
  161. TWEET_INTERACTIONS: 'تفاعلات التغريدة',
  162. TWEET_YOUR_REPLY: 'التغريد بردك!',
  163. TWITTER: 'تويتر',
  164. UNDO_RETWEET: 'التراجع عن التغريدة',
  165. VIEW: 'عرض',
  166. },
  167. ar: {
  168. ADD_MUTED_WORD: 'اضافة كلمة مكتومة',
  169. GROK_ACTIONS: 'إجراءات Grok',
  170. HOME: 'الرئيسيّة',
  171. LIKES: 'الإعجابات',
  172. MOST_RELEVANT: 'الأكثر ملائمة',
  173. MUTE_THIS_CONVERSATION: 'كتم هذه المحادثه',
  174. POST_ALL: 'نشر الكل',
  175. POST_UNAVAILABLE: 'هذا المنشور غير متاح.',
  176. PROFILE_SUMMARY: 'ملخص الملف الشخصيّ',
  177. QUOTE: 'اقتباس',
  178. QUOTES: 'اقتباسات',
  179. QUOTE_TWEET: 'اقتباس التغريدة',
  180. QUOTE_TWEETS: 'تغريدات اقتباس',
  181. REPOST: 'إعادة النشر',
  182. REPOSTS: 'المنشورات المُعاد نشرها',
  183. RETWEET: 'إعادة التغريد',
  184. RETWEETED_BY: 'مُعاد تغريدها بواسطة',
  185. RETWEETS: 'إعادات التغريد',
  186. SHARED: 'مشترك',
  187. SHARED_TWEETS: 'التغريدات المشتركة',
  188. SHOW: 'إظهار',
  189. SHOW_MORE_REPLIES: 'عرض المزيد من الردود',
  190. SORT_REPLIES: 'فرز الردود',
  191. TURN_OFF_QUOTE_TWEETS: 'تعطيل تغريدات اقتباس',
  192. TURN_OFF_RETWEETS: 'تعطيل إعادة التغريد',
  193. TURN_ON_RETWEETS: 'تفعيل إعادة التغريد',
  194. TWEET: 'تغريد',
  195. TWEETS: 'التغريدات',
  196. TWEET_ALL: 'تغريد الكل',
  197. TWEET_INTERACTIONS: 'تفاعلات التغريدة',
  198. TWEET_YOUR_REPLY: 'التغريد بردك!',
  199. UNDO_RETWEET: 'التراجع عن التغريدة',
  200. VIEW: 'عرض',
  201. },
  202. bg: {
  203. ADD_MUTED_WORD: 'Добавяне на заглушена дума',
  204. GROK_ACTIONS: 'Действия, свързани с Grok',
  205. HOME: 'Начало',
  206. LIKES: 'Харесвания',
  207. MOST_RELEVANT: 'Най-подходящи',
  208. MUTE_THIS_CONVERSATION: 'Заглушаване на разговора',
  209. POST_ALL: 'Публикуване на всичко',
  210. POST_UNAVAILABLE: 'Тази публикация не е налична.',
  211. PROFILE_SUMMARY: 'Резюме на профила',
  212. QUOTE: 'Цитат',
  213. QUOTES: 'Цитати',
  214. QUOTE_TWEET: 'Цитиране на туита',
  215. QUOTE_TWEETS: 'Туитове с цитат',
  216. REPOST: 'Препубликуване',
  217. REPOSTS: 'Препубликувания',
  218. RETWEET: 'Ретуитване',
  219. RETWEETED_BY: 'Ретуитнат от',
  220. RETWEETS: 'Ретуитове',
  221. SHARED: 'Споделен',
  222. SHARED_TWEETS: 'Споделени туитове',
  223. SHOW: 'Показване',
  224. SHOW_MORE_REPLIES: 'Показване на още отговори',
  225. SORT_REPLIES: 'Сортиране на отговорите',
  226. TURN_OFF_QUOTE_TWEETS: 'Изключване на туитове с цитат',
  227. TURN_OFF_RETWEETS: 'Изключване на ретуитовете',
  228. TURN_ON_RETWEETS: 'Включване на ретуитовете',
  229. TWEET: 'Туит',
  230. TWEETS: 'Туитове',
  231. TWEET_ALL: 'Туитване на всички',
  232. TWEET_INTERACTIONS: 'Интеракции с туит',
  233. TWEET_YOUR_REPLY: 'Отговори с туит!',
  234. UNDO_RETWEET: 'Отмяна на ретуитването',
  235. VIEW: 'Преглед',
  236. },
  237. bn: {
  238. ADD_MUTED_WORD: 'নীরব করা শব্দ যোগ করুন',
  239. GROK_ACTIONS: 'Grok কার্যকলাপ',
  240. HOME: 'হোম',
  241. LIKES: 'পছন্দ',
  242. MOST_RELEVANT: 'সবচেয়ে প্রাসঙ্গিক',
  243. MUTE_THIS_CONVERSATION: 'এই কথা-বার্তা নীরব করুন',
  244. POST_ALL: 'সবকটি পোস্ট করুন',
  245. POST_UNAVAILABLE: 'এই পোস্টটি অনুপলভ্য।',
  246. PROFILE_SUMMARY: 'প্রোফাইল সারসংক্ষেপ',
  247. QUOTE: 'উদ্ধৃতি',
  248. QUOTES: 'উদ্ধৃতিগুলো',
  249. QUOTE_TWEET: 'টুইট উদ্ধৃত করুন',
  250. QUOTE_TWEETS: 'টুইট উদ্ধৃতিগুলো',
  251. REPOST: 'রিপোস্ট',
  252. REPOSTS: 'রিপোস্ট',
  253. RETWEET: 'পুনঃটুইট',
  254. RETWEETED_BY: 'পুনঃ টুইট করেছেন',
  255. RETWEETS: 'পুনঃটুইটগুলো',
  256. SHARED: 'ভাগ করা',
  257. SHARED_TWEETS: 'ভাগ করা টুইটগুলি',
  258. SHOW: 'দেখান',
  259. SHOW_MORE_REPLIES: 'আরও উত্তর দেখান',
  260. SORT_REPLIES: 'উত্তরগুলো বাছুন',
  261. TURN_OFF_QUOTE_TWEETS: 'উদ্ধৃতি টুইটগুলি বন্ধ করুন',
  262. TURN_OFF_RETWEETS: 'পুনঃ টুইটগুলি বন্ধ করুন',
  263. TURN_ON_RETWEETS: 'পুনঃ টুইটগুলি চালু করুন',
  264. TWEET: 'টুইট',
  265. TWEETS: 'টুইটগুলি',
  266. TWEET_ALL: 'সব টুইট করুন',
  267. TWEET_INTERACTIONS: 'টুইট ইন্টারেকশন',
  268. TWEET_YOUR_REPLY: 'আপনার উত্তর টুইট করুন!',
  269. TWITTER: 'টুইটার',
  270. UNDO_RETWEET: 'পুনঃ টুইট পুর্বাবস্থায় ফেরান',
  271. VIEW: 'দেখুন',
  272. },
  273. ca: {
  274. ADD_MUTED_WORD: 'Afegeix una paraula silenciada',
  275. GROK_ACTIONS: 'Accions de Grok',
  276. HOME: 'Inici',
  277. LIKES: 'Agradaments',
  278. MOST_RELEVANT: 'El més rellevant',
  279. MUTE_THIS_CONVERSATION: 'Silencia la conversa',
  280. POST_ALL: 'Publica-ho tot',
  281. POST_UNAVAILABLE: 'Aquesta publicació no està disponible.',
  282. PROFILE_SUMMARY: 'Resum del perfil',
  283. QUOTE: 'Cita',
  284. QUOTES: 'Cites',
  285. QUOTE_TWEET: 'Cita el tuit',
  286. QUOTE_TWEETS: 'Tuits amb cita',
  287. REPOST: 'Republicació',
  288. REPOSTS: 'Republicacions',
  289. RETWEET: 'Retuit',
  290. RETWEETED_BY: 'Retuitat per',
  291. RETWEETS: 'Retuits',
  292. SHARED: 'Compartit',
  293. SHARED_TWEETS: 'Tuits compartits',
  294. SHOW: 'Mostra',
  295. SHOW_MORE_REPLIES: 'Mostra més respostes',
  296. SORT_REPLIES: 'Ordena les respostes',
  297. TURN_OFF_QUOTE_TWEETS: 'Desactiva els tuits amb cita',
  298. TURN_OFF_RETWEETS: 'Desactiva els retuits',
  299. TURN_ON_RETWEETS: 'Activa els retuits',
  300. TWEET: 'Tuita',
  301. TWEETS: 'Tuits',
  302. TWEET_ALL: 'Tuita-ho tot',
  303. TWEET_INTERACTIONS: 'Interaccions amb tuits',
  304. TWEET_YOUR_REPLY: 'Tuita la teva resposta',
  305. UNDO_RETWEET: 'Desfés el retuit',
  306. VIEW: 'Mostra',
  307. },
  308. cs: {
  309. ADD_MUTED_WORD: 'Přidat slovo na seznam skrytých slov',
  310. GROK_ACTIONS: 'Akce funkce Grok',
  311. HOME: 'Hlavní stránka',
  312. LIKES: 'Lajky',
  313. MOST_RELEVANT: 'Nejvíce související',
  314. MUTE_THIS_CONVERSATION: 'Skrýt tuto konverzaci',
  315. POST_ALL: 'Postovat vše',
  316. POST_UNAVAILABLE: 'Tento post není dostupný.',
  317. PROFILE_SUMMARY: 'Souhrn profilu',
  318. QUOTE: 'Citace',
  319. QUOTES: 'Citace',
  320. QUOTE_TWEET: 'Citovat Tweet',
  321. QUOTE_TWEETS: 'Tweety s citací',
  322. REPOSTS: 'Reposty',
  323. RETWEET: 'Retweetnout',
  324. RETWEETED_BY: 'Retweetnuto uživateli',
  325. RETWEETS: 'Retweety',
  326. SHARED: 'Sdílený',
  327. SHARED_TWEETS: 'Sdílené tweety',
  328. SHOW: 'Zobrazit',
  329. SHOW_MORE_REPLIES: 'Zobrazit další odpovědi',
  330. SORT_REPLIES: 'Seřadit odpovědi',
  331. TURN_OFF_QUOTE_TWEETS: 'Vypnout tweety s citací',
  332. TURN_OFF_RETWEETS: 'Vypnout retweety',
  333. TURN_ON_RETWEETS: 'Zapnout retweety',
  334. TWEET: 'Tweetovat',
  335. TWEETS: 'Tweety',
  336. TWEET_ALL: 'Tweetnout vše',
  337. TWEET_INTERACTIONS: 'Tweetovat interakce',
  338. TWEET_YOUR_REPLY: 'Tweetujte svou odpověď!',
  339. UNDO_RETWEET: 'Zrušit Retweet',
  340. VIEW: 'Zobrazit',
  341. },
  342. da: {
  343. ADD_MUTED_WORD: 'Tilføj skjult ord',
  344. GROK_ACTIONS: 'Grok-handlinger',
  345. HOME: 'Forside',
  346. LIKES: 'Likes',
  347. MOST_RELEVANT: 'Mest relevante',
  348. MUTE_THIS_CONVERSATION: 'Skjul denne samtale',
  349. POST_ALL: 'Post alle',
  350. POST_UNAVAILABLE: 'Denne post er ikke tilgængelig.',
  351. PROFILE_SUMMARY: 'Profilresumé',
  352. QUOTE: 'Citat',
  353. QUOTES: 'Citater',
  354. QUOTE_TWEET: 'Citér Tweet',
  355. QUOTE_TWEETS: 'Citat-Tweets',
  356. RETWEETED_BY: 'Retweetet af',
  357. SHARED: 'Delt',
  358. SHARED_TWEETS: 'Delte tweets',
  359. SHOW: 'Vis',
  360. SHOW_MORE_REPLIES: 'Vis flere svar',
  361. SORT_REPLIES: 'Sortér svar',
  362. TURN_OFF_QUOTE_TWEETS: 'Slå Citat-Tweets fra',
  363. TURN_OFF_RETWEETS: 'Slå Retweets fra',
  364. TURN_ON_RETWEETS: 'Slå Retweets til',
  365. TWEET_ALL: 'Tweet alt',
  366. TWEET_INTERACTIONS: 'Tweet-interaktioner',
  367. TWEET_YOUR_REPLY: 'Tweet dit svar!',
  368. UNDO_RETWEET: 'Fortryd Retweet',
  369. VIEW: 'Vis',
  370. },
  371. de: {
  372. ADD_MUTED_WORD: 'Stummgeschaltetes Wort hinzufügen',
  373. GROK_ACTIONS: 'Grok-Aktionen',
  374. HOME: 'Startseite',
  375. LIKES: 'Gefällt mir',
  376. MOST_RELEVANT: 'Besonders relevant',
  377. MUTE_THIS_CONVERSATION: 'Diese Konversation stummschalten',
  378. POST_ALL: 'Alle posten',
  379. POST_UNAVAILABLE: 'Dieser Post ist nicht verfügbar.',
  380. PROFILE_SUMMARY: 'Kurzprofil',
  381. QUOTE: 'Zitat',
  382. QUOTES: 'Zitate',
  383. QUOTE_TWEET: 'Tweet zitieren',
  384. QUOTE_TWEETS: 'Zitierte Tweets',
  385. REPOST: 'Reposten',
  386. RETWEET: 'Retweeten',
  387. RETWEETED_BY: 'Retweetet von',
  388. SHARED: 'Geteilt',
  389. SHARED_TWEETS: 'Geteilte Tweets',
  390. SHOW: 'Anzeigen',
  391. SHOW_MORE_REPLIES: 'Mehr Antworten anzeigen',
  392. SORT_REPLIES: 'Antworten sortieren',
  393. TURN_OFF_QUOTE_TWEETS: 'Zitierte Tweets ausschalten',
  394. TURN_OFF_RETWEETS: 'Retweets ausschalten',
  395. TURN_ON_RETWEETS: 'Retweets einschalten',
  396. TWEET: 'Twittern',
  397. TWEET_ALL: 'Alle twittern',
  398. TWEET_INTERACTIONS: 'Tweet-Interaktionen',
  399. TWEET_YOUR_REPLY: 'Twittere deine Antwort!',
  400. UNDO_RETWEET: 'Retweet rückgängig machen',
  401. VIEW: 'Anzeigen',
  402. },
  403. el: {
  404. ADD_MUTED_WORD: 'Προσθήκη λέξης σε σίγαση',
  405. GROK_ACTIONS: 'Δράσεις Grok',
  406. HOME: 'Αρχική σελίδα',
  407. LIKES: '"Μου αρέσει"',
  408. MOST_RELEVANT: 'Πιο σχετική',
  409. MUTE_THIS_CONVERSATION: 'Σίγαση αυτής της συζήτησης',
  410. POST_ALL: 'Δημοσίευση όλων',
  411. POST_UNAVAILABLE: 'Αυτή η ανάρτηση δεν είναι διαθέσιμη.',
  412. PROFILE_SUMMARY: ' Περίληψη προφίλ',
  413. QUOTE: 'Παράθεση',
  414. QUOTES: 'Παραθέσεις',
  415. QUOTE_TWEET: 'Παράθεση Tweet',
  416. QUOTE_TWEETS: 'Tweet με παράθεση',
  417. REPOST: 'Αναδημοσίευση',
  418. REPOSTS: 'Αναδημοσιεύσεις',
  419. RETWEETED_BY: 'Έγινε Retweet από',
  420. RETWEETS: 'Retweet',
  421. SHARED: 'Κοινόχρηστο',
  422. SHARED_TWEETS: 'Κοινόχρηστα Tweets',
  423. SHOW: 'Εμφάνιση',
  424. SHOW_MORE_REPLIES: 'Εμφάνιση περισσότερων απαντήσεων',
  425. SORT_REPLIES: 'Ταξινόμηση απαντήσεων',
  426. TURN_OFF_QUOTE_TWEETS: 'Απενεργοποίηση των tweet με παράθεση',
  427. TURN_OFF_RETWEETS: 'Απενεργοποίηση των Retweet',
  428. TURN_ON_RETWEETS: 'Ενεργοποίηση των Retweet',
  429. TWEETS: 'Tweet',
  430. TWEET_ALL: 'Δημοσίευση όλων ως Tweet',
  431. TWEET_INTERACTIONS: 'Αλληλεπιδράσεις με tweet',
  432. TWEET_YOUR_REPLY: 'Στείλτε την απάντησή σας!',
  433. UNDO_RETWEET: 'Αναίρεση Retweet',
  434. VIEW: 'Προβολή',
  435. },
  436. en: {
  437. ADD_MUTED_WORD: 'Add muted word',
  438. GROK_ACTIONS: 'Grok actions',
  439. HOME: 'Home',
  440. LIKES: 'Likes',
  441. MOST_RELEVANT: 'Most relevant',
  442. MUTE_THIS_CONVERSATION: 'Mute this conversation',
  443. POST_ALL: 'Post all',
  444. POST_UNAVAILABLE: 'This post is unavailable.',
  445. PROFILE_SUMMARY: 'Profile Summary',
  446. QUOTE: 'Quote',
  447. QUOTES: 'Quotes',
  448. QUOTE_TWEET: 'Quote Tweet',
  449. QUOTE_TWEETS: 'Quote Tweets',
  450. REPOST: 'Repost',
  451. REPOSTS: 'Reposts',
  452. RETWEET: 'Retweet',
  453. RETWEETED_BY: 'Retweeted by',
  454. RETWEETS: 'Retweets',
  455. SHARED: 'Shared',
  456. SHARED_TWEETS: 'Shared Tweets',
  457. SHOW: 'Show',
  458. SHOW_MORE_REPLIES: 'Show more replies',
  459. SORT_REPLIES: 'Sort replies',
  460. TURN_OFF_QUOTE_TWEETS: 'Turn off Quote Tweets',
  461. TURN_OFF_RETWEETS: 'Turn off Retweets',
  462. TURN_ON_RETWEETS: 'Turn on Retweets',
  463. TWEET: 'Tweet',
  464. TWEETS: 'Tweets',
  465. TWEET_ALL: 'Tweet all',
  466. TWEET_INTERACTIONS: 'Tweet interactions',
  467. TWEET_YOUR_REPLY: 'Tweet your reply!',
  468. TWITTER: 'Twitter',
  469. UNDO_RETWEET: 'Undo Retweet',
  470. VIEW: 'View',
  471. },
  472. es: {
  473. ADD_MUTED_WORD: 'Añadir palabra silenciada',
  474. GROK_ACTIONS: 'Acciones de Grok',
  475. HOME: 'Inicio',
  476. LIKES: 'Me gusta',
  477. MOST_RELEVANT: 'Más relevantes',
  478. MUTE_THIS_CONVERSATION: 'Silenciar esta conversación',
  479. POST_ALL: 'Postear todo',
  480. POST_UNAVAILABLE: 'Este post no está disponible.',
  481. PROFILE_SUMMARY: 'Resumen del perfil',
  482. QUOTE: 'Cita',
  483. QUOTES: 'Citas',
  484. QUOTE_TWEET: 'Citar Tweet',
  485. QUOTE_TWEETS: 'Tweets citados',
  486. REPOST: 'Repostear',
  487. RETWEET: 'Retwittear',
  488. RETWEETED_BY: 'Retwitteado por',
  489. SHARED: 'Compartido',
  490. SHARED_TWEETS: 'Tweets compartidos',
  491. SHOW: 'Mostrar',
  492. SHOW_MORE_REPLIES: 'Mostrar más respuestas',
  493. SORT_REPLIES: 'Organizar respuestas',
  494. TURN_OFF_QUOTE_TWEETS: 'Desactivar tweets citados',
  495. TURN_OFF_RETWEETS: 'Desactivar Retweets',
  496. TURN_ON_RETWEETS: 'Activar Retweets',
  497. TWEET: 'Twittear',
  498. TWEET_ALL: 'Twittear todo',
  499. TWEET_INTERACTIONS: 'Interacciones con Tweet',
  500. TWEET_YOUR_REPLY: '¡Twittea tu respuesta!',
  501. UNDO_RETWEET: 'Deshacer Retweet',
  502. VIEW: 'Ver',
  503. },
  504. eu: {
  505. ADD_MUTED_WORD: 'Gehitu isilarazitako hitza',
  506. GROK_ACTIONS: 'Grok actions',
  507. HOME: 'Hasiera',
  508. LIKES: 'Atsegiteak',
  509. MUTE_THIS_CONVERSATION: 'Isilarazi elkarrizketa hau',
  510. QUOTE: 'Aipamena',
  511. QUOTES: 'Aipamenak',
  512. QUOTE_TWEET: 'Txioa apaitu',
  513. QUOTE_TWEETS: 'Aipatu txioak',
  514. RETWEET: 'Bertxiotu',
  515. RETWEETED_BY: 'Bertxiotua:',
  516. RETWEETS: 'Bertxioak',
  517. SHARED: 'Partekatua',
  518. SHARED_TWEETS: 'Partekatutako',
  519. SHOW: 'Erakutsi',
  520. SHOW_MORE_REPLIES: 'Erakutsi erantzun gehiago',
  521. TURN_OFF_QUOTE_TWEETS: 'Desaktibatu aipatu txioak',
  522. TURN_OFF_RETWEETS: 'Desaktibatu birtxioak',
  523. TURN_ON_RETWEETS: 'Aktibatu birtxioak',
  524. TWEET: 'Txio',
  525. TWEETS: 'Txioak',
  526. TWEET_ALL: 'Txiotu guztiak',
  527. TWEET_INTERACTIONS: 'Txio elkarrekintzak',
  528. UNDO_RETWEET: 'Desegin birtxiokatzea',
  529. VIEW: 'Ikusi',
  530. },
  531. fa: {
  532. ADD_MUTED_WORD: 'افزودن واژه خموش‌سازی شده',
  533. GROK_ACTIONS: 'کنش‌های Grok',
  534. HOME: 'خانه',
  535. LIKES: 'پسندها',
  536. MOST_RELEVANT: 'مرتبط‌ترین',
  537. MUTE_THIS_CONVERSATION: 'خموش‌سازی این گفتگو',
  538. POST_ALL: 'پست کردن همه',
  539. POST_UNAVAILABLE: 'این پست دردسترس نیست.',
  540. PROFILE_SUMMARY: 'خلاصه نمایه',
  541. QUOTE: 'نقل‌قول',
  542. QUOTES: 'نقل‌قول‌ها',
  543. QUOTE_TWEET: 'نقل‌توییت',
  544. QUOTE_TWEETS: 'نقل‌توییت‌ها',
  545. REPOST: 'بازپست',
  546. REPOSTS: 'بازپست',
  547. RETWEET: 'بازتوییت',
  548. RETWEETED_BY: 'بازتوییت‌ شد توسط',
  549. RETWEETS: 'بازتوییت‌ها',
  550. SHARED: 'مشترک',
  551. SHARED_TWEETS: 'توییتهای مشترک',
  552. SHOW: 'نمایش',
  553. SHOW_MORE_REPLIES: 'نمایش پاسخ‌های بیشتر',
  554. SORT_REPLIES: 'مرتب‌سازی پاسخ‌ها',
  555. TURN_OFF_QUOTE_TWEETS: 'غیرفعال‌سازی نقل‌توییت‌ها',
  556. TURN_OFF_RETWEETS: 'غیرفعال‌سازی بازتوییت‌ها',
  557. TURN_ON_RETWEETS: 'فعال سازی بازتوییت‌ها',
  558. TWEET: 'توییت',
  559. TWEETS: 'توييت‌ها',
  560. TWEET_ALL: 'توییت به همه',
  561. TWEET_INTERACTIONS: 'تعاملات توییت',
  562. TWEET_YOUR_REPLY: 'پاسختان را توییت کنید!',
  563. TWITTER: 'توییتر',
  564. UNDO_RETWEET: 'لغو بازتوییت',
  565. VIEW: 'مشاهده',
  566. },
  567. fi: {
  568. ADD_MUTED_WORD: 'Lisää hiljennetty sana',
  569. GROK_ACTIONS: 'Grok-toiminnat',
  570. HOME: 'Etusivu',
  571. LIKES: 'Tykkäykset',
  572. MOST_RELEVANT: 'Relevanteimmat',
  573. MUTE_THIS_CONVERSATION: 'Hiljennä tämä keskustelu',
  574. POST_ALL: 'Julkaise kaikki',
  575. POST_UNAVAILABLE: 'Tämä julkaisu ei ole saatavilla.',
  576. PROFILE_SUMMARY: 'Profiilin yhteenveto',
  577. QUOTE: 'Lainaa',
  578. QUOTES: 'Lainaukset',
  579. QUOTE_TWEET: 'Twiitin lainaus',
  580. QUOTE_TWEETS: 'Twiitin lainaukset',
  581. REPOST: 'Uudelleenjulkaise',
  582. REPOSTS: 'Uudelleenjulkaisut',
  583. RETWEET: 'Uudelleentwiittaa',
  584. RETWEETED_BY: 'Uudelleentwiitannut',
  585. RETWEETS: 'Uudelleentwiittaukset',
  586. SHARED: 'Jaettu',
  587. SHARED_TWEETS: 'Jaetut twiitit',
  588. SHOW: 'Näytä',
  589. SHOW_MORE_REPLIES: 'Näytä lisää vastauksia',
  590. SORT_REPLIES: 'Lajittele vastaukset',
  591. TURN_OFF_QUOTE_TWEETS: 'Poista twiitin lainaukset käytöstä',
  592. TURN_OFF_RETWEETS: 'Poista uudelleentwiittaukset käytöstä',
  593. TURN_ON_RETWEETS: 'Ota uudelleentwiittaukset käyttöön',
  594. TWEET: 'Twiittaa',
  595. TWEETS: 'Twiitit',
  596. TWEET_ALL: 'Twiittaa kaikki',
  597. TWEET_INTERACTIONS: 'Twiitin vuorovaikutukset',
  598. TWEET_YOUR_REPLY: 'Twiittaa vastauksesi',
  599. UNDO_RETWEET: 'Kumoa uudelleentwiittaus',
  600. VIEW: 'Näytä',
  601. },
  602. fil: {
  603. ADD_MUTED_WORD: 'Idagdag ang naka-mute na salita',
  604. GROK_ACTIONS: 'Mga aksyon ni Grok',
  605. LIKES: 'Mga Gusto',
  606. MOST_RELEVANT: 'Pinakanauugnay',
  607. MUTE_THIS_CONVERSATION: 'I-mute ang usapang ito',
  608. POST_ALL: 'I-post lahat',
  609. POST_UNAVAILABLE: 'Hindi available ang post na Ito.',
  610. PROFILE_SUMMARY: 'Buod ng Profile',
  611. QUOTES: 'Mga Quote',
  612. QUOTE_TWEET: 'Quote na Tweet',
  613. QUOTE_TWEETS: 'Mga Quote na Tweet',
  614. REPOST: 'I-repost',
  615. REPOSTS: '(na) Repost',
  616. RETWEET: 'I-retweet',
  617. RETWEETED_BY: 'Ni-retweet ni',
  618. RETWEETS: 'Mga Retweet',
  619. SHARED: 'Ibinahagi',
  620. SHARED_TWEETS: 'Mga Ibinahaging Tweet',
  621. SHOW: 'Ipakita',
  622. SHOW_MORE_REPLIES: 'Magpakita pa ng mga sagot',
  623. SORT_REPLIES: 'I-sort ang mga reply',
  624. TURN_OFF_QUOTE_TWEETS: 'I-off ang mga Quote na Tweet',
  625. TURN_OFF_RETWEETS: 'I-off ang Retweets',
  626. TURN_ON_RETWEETS: 'I-on ang Retweets',
  627. TWEET: 'Mag-tweet',
  628. TWEETS: 'Mga Tweet',
  629. TWEET_ALL: 'I-tweet lahat',
  630. TWEET_INTERACTIONS: 'Interaksyon sa Tweet',
  631. TWEET_YOUR_REPLY: 'I-Tweet ang sagot mo!',
  632. UNDO_RETWEET: 'Huwag nang I-retweet',
  633. VIEW: 'Tingnan',
  634. },
  635. fr: {
  636. ADD_MUTED_WORD: 'Ajouter un mot masqué',
  637. GROK_ACTIONS: 'Actions Grok',
  638. HOME: 'Accueil',
  639. LIKES: "J'aime",
  640. MOST_RELEVANT: 'Les plus pertinentes',
  641. MUTE_THIS_CONVERSATION: 'Masquer cette conversation',
  642. POST_ALL: 'Tout poster',
  643. POST_UNAVAILABLE: "Ce post n'est pas disponible.",
  644. PROFILE_SUMMARY: 'Résumé du profil',
  645. QUOTE: 'Citation',
  646. QUOTES: 'Citations',
  647. QUOTE_TWEET: 'Citer le Tweet',
  648. QUOTE_TWEETS: 'Tweets cités',
  649. RETWEET: 'Retweeter',
  650. RETWEETED_BY: 'Retweeté par',
  651. SHARED: 'Partagé',
  652. SHARED_TWEETS: 'Tweets partagés',
  653. SHOW: 'Afficher',
  654. SHOW_MORE_REPLIES: 'Voir plus de réponses',
  655. SORT_REPLIES: 'Trier les réponses',
  656. TURN_OFF_QUOTE_TWEETS: 'Désactiver les Tweets cités',
  657. TURN_OFF_RETWEETS: 'Désactiver les Retweets',
  658. TURN_ON_RETWEETS: 'Activer les Retweets',
  659. TWEET: 'Tweeter',
  660. TWEET_ALL: 'Tout tweeter',
  661. TWEET_INTERACTIONS: 'Interactions avec Tweet',
  662. TWEET_YOUR_REPLY: 'Tweetez votre réponse!',
  663. UNDO_RETWEET: 'Annuler le Retweet',
  664. VIEW: 'Voir',
  665. },
  666. ga: {
  667. ADD_MUTED_WORD: 'Cuir focal balbhaithe leis',
  668. GROK_ACTIONS: 'Grok actions',
  669. HOME: 'Baile',
  670. LIKES: 'Thaitin siad seo le',
  671. MUTE_THIS_CONVERSATION: 'Balbhaigh an comhrá seo',
  672. QUOTE: 'Sliocht',
  673. QUOTES: 'Sleachta',
  674. QUOTE_TWEET: 'Cuir Ráiteas Leis',
  675. QUOTE_TWEETS: 'Luaigh Tvuíteanna',
  676. RETWEET: 'Atweetáil',
  677. RETWEETED_BY: 'Atweetáilte ag',
  678. RETWEETS: 'Atweetanna',
  679. SHARED: 'Roinnte',
  680. SHARED_TWEETS: 'Tweetanna Roinnte',
  681. SHOW: 'Taispeáin',
  682. SHOW_MORE_REPLIES: 'Taispeáin tuilleadh freagraí',
  683. TURN_OFF_QUOTE_TWEETS: 'Cas as Luaigh Tvuíteanna',
  684. TURN_OFF_RETWEETS: 'Cas as Atweetanna',
  685. TURN_ON_RETWEETS: 'Cas Atweetanna air',
  686. TWEETS: 'Tweetanna',
  687. TWEET_ALL: 'Tweetáil gach rud',
  688. TWEET_INTERACTIONS: 'Idirghníomhaíochtaí le Tweet',
  689. UNDO_RETWEET: 'Cuir an Atweet ar ceal',
  690. VIEW: 'Breathnaigh',
  691. },
  692. gl: {
  693. ADD_MUTED_WORD: 'Engadir palabra silenciada',
  694. GROK_ACTIONS: 'Grok actions',
  695. HOME: 'Inicio',
  696. LIKES: 'Gústames',
  697. MUTE_THIS_CONVERSATION: 'Silenciar esta conversa',
  698. QUOTE: 'Cita',
  699. QUOTES: 'Citas',
  700. QUOTE_TWEET: 'Citar chío',
  701. QUOTE_TWEETS: 'Chíos citados',
  702. RETWEET: 'Rechouchiar',
  703. RETWEETED_BY: 'Rechouchiado por',
  704. RETWEETS: 'Rechouchíos',
  705. SHARED: 'Compartido',
  706. SHARED_TWEETS: 'Chíos compartidos',
  707. SHOW: 'Amosar',
  708. SHOW_MORE_REPLIES: 'Amosar máis respostas',
  709. TURN_OFF_QUOTE_TWEETS: 'Desactivar os chíos citados',
  710. TURN_OFF_RETWEETS: 'Desactivar os rechouchíos',
  711. TURN_ON_RETWEETS: 'Activar os rechouchíos',
  712. TWEET: 'Chío',
  713. TWEETS: 'Chíos',
  714. TWEET_ALL: 'Chiar todo',
  715. TWEET_INTERACTIONS: 'Interaccións chío',
  716. UNDO_RETWEET: 'Desfacer rechouchío',
  717. VIEW: 'Ver',
  718. },
  719. gu: {
  720. ADD_MUTED_WORD: 'જોડાણ અટકાવેલો શબ્દ ઉમેરો',
  721. GROK_ACTIONS: 'Grok પગલાં',
  722. HOME: 'હોમ',
  723. LIKES: 'લાઈક્સ',
  724. MOST_RELEVANT: 'સૌથી વધુ સુસંગત',
  725. MUTE_THIS_CONVERSATION: 'આ વાર્તાલાપનું જોડાણ અટકાવો',
  726. POST_ALL: 'બધા પોસ્ટ કરો',
  727. POST_UNAVAILABLE: 'આ પોસ્ટ અનુપલબ્ધ છે.',
  728. PROFILE_SUMMARY: 'પ્રોફાઇલ સારાંશ',
  729. QUOTE: 'અવતરણ',
  730. QUOTES: 'અવતરણો',
  731. QUOTE_TWEET: 'અવતરણની સાથે ટ્વીટ કરો',
  732. QUOTE_TWEETS: 'અવતરણની સાથે ટ્વીટ્સ',
  733. REPOST: 'રીપોસ્ટ કરો',
  734. REPOSTS: 'ફરીથી કરવામાં આવેલી પોસ્ટ',
  735. RETWEET: 'પુનટ્વીટ',
  736. RETWEETED_BY: 'આમની દ્વારા પુનટ્વીટ કરવામાં આવી',
  737. RETWEETS: 'પુનટ્વીટ્સ',
  738. SHARED: 'સાંજેડેલું',
  739. SHARED_TWEETS: 'શેર કરેલી ટ્વીટ્સ',
  740. SHOW: 'બતાવો',
  741. SHOW_MORE_REPLIES: 'વધુ પ્રત્યુતરો દર્શાવો',
  742. SORT_REPLIES: 'પ્રત્યુત્તરોને સૉર્ટ કરો',
  743. TURN_OFF_QUOTE_TWEETS: 'અવતરણની સાથે ટ્વીટ્સ બંધ કરો',
  744. TURN_OFF_RETWEETS: 'પુનટ્વીટ્સ બંધ કરો',
  745. TURN_ON_RETWEETS: 'પુનટ્વીટ્સ ચાલુ કરો',
  746. TWEET: 'ટ્વીટ',
  747. TWEETS: 'ટ્વીટ્સ',
  748. TWEET_ALL: 'બધાને ટ્વીટ કરો',
  749. TWEET_INTERACTIONS: 'ટ્વીટ ક્રિયાપ્રતિક્રિયાઓ',
  750. TWEET_YOUR_REPLY: 'તમારા પ્રત્યુત્તરને ટ્વીટ કરો!',
  751. UNDO_RETWEET: 'પુનટ્વીટને પૂર્વવત કરો',
  752. VIEW: 'જુઓ',
  753. },
  754. he: {
  755. ADD_MUTED_WORD: 'הוסף מילה מושתקת',
  756. GROK_ACTIONS: 'פעולות של Grok',
  757. HOME: 'דף הבית',
  758. LIKES: 'הערות "אהבתי"',
  759. MOST_RELEVANT: 'הכי רלוונטי',
  760. MUTE_THIS_CONVERSATION: 'להשתיק את השיחה הזאת',
  761. POST_ALL: 'פרסום הכל',
  762. POST_UNAVAILABLE: 'פוסט זה אינו זמין.',
  763. PROFILE_SUMMARY: 'סיכום הפרופיל',
  764. QUOTE: 'ציטוט',
  765. QUOTES: 'ציטוטים',
  766. QUOTE_TWEET: 'ציטוט ציוץ',
  767. QUOTE_TWEETS: 'ציוצי ציטוט',
  768. REPOST: 'לפרסם מחדש',
  769. REPOSTS: 'פרסומים מחדש',
  770. RETWEET: 'צייץ מחדש',
  771. RETWEETED_BY: 'צויץ מחדש על־ידי',
  772. RETWEETS: 'ציוצים מחדש',
  773. SHARED: 'משותף',
  774. SHARED_TWEETS: 'ציוצים משותפים',
  775. SHOW: 'הצג',
  776. SHOW_MORE_REPLIES: 'הצג תשובות נוספות',
  777. SORT_REPLIES: 'מיון תשובות',
  778. TURN_OFF_QUOTE_TWEETS: 'כבה ציוצי ציטוט',
  779. TURN_OFF_RETWEETS: 'כבה ציוצים מחדש',
  780. TURN_ON_RETWEETS: 'הפעל ציוצים מחדש',
  781. TWEET: 'צייץ',
  782. TWEETS: 'ציוצים',
  783. TWEET_ALL: 'צייץ הכול',
  784. TWEET_INTERACTIONS: 'אינטראקציות צייץ',
  785. TWEET_YOUR_REPLY: 'צייץ את התשובה!',
  786. TWITTER: 'טוויטר',
  787. UNDO_RETWEET: 'ביטול ציוץ מחדש',
  788. VIEW: 'הצג',
  789. },
  790. hi: {
  791. ADD_MUTED_WORD: 'म्यूट किया गया शब्द जोड़ें',
  792. GROK_ACTIONS: 'Grok कार्रवाई',
  793. HOME: 'होम',
  794. LIKES: 'पसंद',
  795. MOST_RELEVANT: 'सर्वाधिक प्रासंगिक',
  796. MUTE_THIS_CONVERSATION: 'इस बातचीत को म्यूट करें',
  797. POST_ALL: 'सभी पोस्ट करें',
  798. POST_UNAVAILABLE: 'यह पोस्ट उपलब्ध नहीं है.',
  799. PROFILE_SUMMARY: 'प्रोफ़ाइल सारांश',
  800. QUOTE: 'कोट',
  801. QUOTES: 'कोट',
  802. QUOTE_TWEET: 'ट्वीट क्वोट करें',
  803. QUOTE_TWEETS: 'कोट ट्वीट्स',
  804. REPOST: 'रीपोस्ट',
  805. REPOSTS: 'रीपोस्ट्स',
  806. RETWEET: 'रीट्वीट करें',
  807. RETWEETED_BY: 'इनके द्वारा रीट्वीट किया गया',
  808. RETWEETS: 'रीट्वीट्स',
  809. SHARED: 'साझा किया हुआ',
  810. SHARED_TWEETS: 'साझा किए गए ट्वीट',
  811. SHOW: 'दिखाएं',
  812. SHOW_MORE_REPLIES: 'और अधिक जवाब दिखाएँ',
  813. SORT_REPLIES: 'जवाब सॉर्ट करें',
  814. TURN_OFF_QUOTE_TWEETS: 'कोट ट्वीट्स बंद करें',
  815. TURN_OFF_RETWEETS: 'रीट्वीट बंद करें',
  816. TURN_ON_RETWEETS: 'रीट्वीट चालू करें',
  817. TWEET: 'ट्वीट करें',
  818. TWEETS: 'ट्वीट',
  819. TWEET_ALL: 'सभी ट्वीट करें',
  820. TWEET_INTERACTIONS: 'ट्वीट इंटरैक्शन',
  821. TWEET_YOUR_REPLY: 'अपना जवाब ट्वीट करें!',
  822. UNDO_RETWEET: 'रीट्वीट को पूर्ववत करें',
  823. VIEW: 'देखें',
  824. },
  825. hr: {
  826. ADD_MUTED_WORD: 'Dodaj onemogućenu riječ',
  827. GROK_ACTIONS: 'Grokove radnje',
  828. HOME: 'Naslovnica',
  829. LIKES: 'Oznake „sviđa mi se”',
  830. MOST_RELEVANT: 'Najrelevantnije',
  831. MUTE_THIS_CONVERSATION: 'Isključi zvuk ovog razgovora',
  832. POST_ALL: 'Objavi sve',
  833. POST_UNAVAILABLE: 'Ta objava nije dostupna.',
  834. PROFILE_SUMMARY: 'Sažetak profila',
  835. QUOTE: 'Citat',
  836. QUOTES: 'Citati',
  837. QUOTE_TWEET: 'Citiraj Tweet',
  838. QUOTE_TWEETS: 'Citirani tweetovi',
  839. REPOST: 'Proslijedi objavu',
  840. REPOSTS: 'Proslijeđene objave',
  841. RETWEET: 'Proslijedi tweet',
  842. RETWEETED_BY: 'Korisnici koji su proslijedili Tweet',
  843. RETWEETS: 'Proslijeđeni tweetovi',
  844. SHARED: 'Podijeljeno',
  845. SHARED_TWEETS: 'Dijeljeni tweetovi',
  846. SHOW: 'Prikaži',
  847. SHOW_MORE_REPLIES: 'Prikaži još odgovora',
  848. SORT_REPLIES: 'Sortiraj odgovore',
  849. TURN_OFF_QUOTE_TWEETS: 'Isključi citirane tweetove',
  850. TURN_OFF_RETWEETS: 'Isključi proslijeđene tweetove',
  851. TURN_ON_RETWEETS: 'Uključi proslijeđene tweetove',
  852. TWEETS: 'Tweetovi',
  853. TWEET_ALL: 'Tweetaj sve',
  854. TWEET_INTERACTIONS: 'Interakcije s Tweet',
  855. TWEET_YOUR_REPLY: 'Pošaljite Tweet s odgovorom!',
  856. UNDO_RETWEET: 'Poništi prosljeđivanje tweeta',
  857. VIEW: 'Prikaz',
  858. },
  859. hu: {
  860. ADD_MUTED_WORD: 'Elnémított szó hozzáadása',
  861. GROK_ACTIONS: 'Grok-műveletek',
  862. HOME: 'Kezdőlap',
  863. LIKES: 'Kedvelések',
  864. MOST_RELEVANT: 'Legmegfelelőbb',
  865. MUTE_THIS_CONVERSATION: 'Beszélgetés némítása',
  866. POST_ALL: 'Az összes közzététele',
  867. POST_UNAVAILABLE: 'Ez a bejegyzés nem elérhető.',
  868. PROFILE_SUMMARY: 'Profil összegzése',
  869. QUOTE: 'Idézés',
  870. QUOTES: 'Idézések',
  871. QUOTE_TWEET: 'Tweet idézése',
  872. QUOTE_TWEETS: 'Tweet-idézések',
  873. REPOST: 'Újraposztolás',
  874. REPOSTS: 'Újraposztolások',
  875. RETWEETED_BY: 'Retweetelte',
  876. RETWEETS: 'Retweetek',
  877. SHARED: 'Megosztott',
  878. SHARED_TWEETS: 'Megosztott tweetek',
  879. SHOW: 'Megjelenítés',
  880. SHOW_MORE_REPLIES: 'Több válasz megjelenítése',
  881. SORT_REPLIES: 'Válaszok rendezése',
  882. TURN_OFF_QUOTE_TWEETS: 'Tweet-idézések kikapcsolása',
  883. TURN_OFF_RETWEETS: 'Retweetek kikapcsolása',
  884. TURN_ON_RETWEETS: 'Retweetek bekapcsolása',
  885. TWEET: 'Tweetelj',
  886. TWEETS: 'Tweetek',
  887. TWEET_ALL: 'Tweet küldése mindenkinek',
  888. TWEET_INTERACTIONS: 'Tweet interakciók',
  889. TWEET_YOUR_REPLY: 'Tweeteld válaszodat',
  890. UNDO_RETWEET: 'Retweet visszavonása',
  891. VIEW: 'Megtekintés',
  892. },
  893. id: {
  894. ADD_MUTED_WORD: 'Tambahkan kata kunci yang dibisukan',
  895. GROK_ACTIONS: 'Tindakan Grok',
  896. HOME: 'Beranda',
  897. LIKES: 'Suka',
  898. MOST_RELEVANT: 'Paling relevan',
  899. MUTE_THIS_CONVERSATION: 'Bisukan percakapan ini',
  900. POST_ALL: 'Posting semua',
  901. POST_UNAVAILABLE: 'Postingan ini tidak tersedia.',
  902. PROFILE_SUMMARY: 'Ringkasan Profil',
  903. QUOTE: 'Kutipan',
  904. QUOTES: 'Kutipan',
  905. QUOTE_TWEET: 'Kutip Tweet',
  906. QUOTE_TWEETS: 'Tweet Kutipan',
  907. REPOST: 'Posting ulang',
  908. REPOSTS: 'Posting ulang',
  909. RETWEETED_BY: 'Di-retweet oleh',
  910. RETWEETS: 'Retweet',
  911. SHARED: 'Dibagikan',
  912. SHARED_TWEETS: 'Tweet yang Dibagikan',
  913. SHOW: 'Tampilkan',
  914. SHOW_MORE_REPLIES: 'Tampilkan balasan lainnya',
  915. SORT_REPLIES: 'Urutkan balasan',
  916. TURN_OFF_QUOTE_TWEETS: 'Matikan Tweet Kutipan',
  917. TURN_OFF_RETWEETS: 'Matikan Retweet',
  918. TURN_ON_RETWEETS: 'Nyalakan Retweet',
  919. TWEETS: 'Tweet',
  920. TWEET_ALL: 'Tweet semua',
  921. TWEET_INTERACTIONS: 'Interaksi Tweet',
  922. TWEET_YOUR_REPLY: 'Tweet balasan Anda!',
  923. UNDO_RETWEET: 'Batalkan Retweet',
  924. VIEW: 'Lihat',
  925. },
  926. it: {
  927. ADD_MUTED_WORD: 'Aggiungi parola o frase silenziata',
  928. GROK_ACTIONS: 'Azioni di Grok',
  929. LIKES: 'Mi piace',
  930. MOST_RELEVANT: 'Più pertinenti',
  931. MUTE_THIS_CONVERSATION: 'Silenzia questa conversazione',
  932. POST_ALL: 'Posta tutto',
  933. POST_UNAVAILABLE: 'Questo post non è disponibile.',
  934. PROFILE_SUMMARY: 'Riepilogo del profilo',
  935. QUOTE: 'Citazione',
  936. QUOTES: 'Citazioni',
  937. QUOTE_TWEET: 'Cita Tweet',
  938. QUOTE_TWEETS: 'Tweet di citazione',
  939. REPOSTS: 'Repost',
  940. RETWEET: 'Ritwitta',
  941. RETWEETED_BY: 'Ritwittato da',
  942. RETWEETS: 'Retweet',
  943. SHARED: 'Condiviso',
  944. SHARED_TWEETS: 'Tweet condivisi',
  945. SHOW: 'Mostra',
  946. SHOW_MORE_REPLIES: 'Mostra altre risposte',
  947. SORT_REPLIES: 'Ordina risposte',
  948. TURN_OFF_QUOTE_TWEETS: 'Disattiva i Tweet di citazione',
  949. TURN_OFF_RETWEETS: 'Disattiva Retweet',
  950. TURN_ON_RETWEETS: 'Attiva Retweet',
  951. TWEET: 'Twitta',
  952. TWEETS: 'Tweet',
  953. TWEET_ALL: 'Twitta tutto',
  954. TWEET_INTERACTIONS: 'Interazioni con Tweet',
  955. TWEET_YOUR_REPLY: 'Twitta la tua risposta.',
  956. UNDO_RETWEET: 'Annulla Retweet',
  957. VIEW: 'Visualizza',
  958. },
  959. ja: {
  960. ADD_MUTED_WORD: 'ミュートするキーワードを追加',
  961. GROK_ACTIONS: 'Grokのアクション',
  962. HOME: 'ホーム',
  963. LIKES: 'いいね',
  964. MOST_RELEVANT: '関連性が高い',
  965. MUTE_THIS_CONVERSATION: 'この会話をミュート',
  966. POST_ALL: 'すべてポスト',
  967. POST_UNAVAILABLE: 'このポストは表示できません。',
  968. PROFILE_SUMMARY: 'プロフィールの要約',
  969. QUOTE: '引用',
  970. QUOTES: '引用',
  971. QUOTE_TWEET: '引用ツイート',
  972. QUOTE_TWEETS: '引用ツイート',
  973. REPOST: 'リポスト',
  974. REPOSTS: 'リポスト',
  975. RETWEET: 'リツイート',
  976. RETWEETED_BY: 'リツイートしたユーザー',
  977. RETWEETS: 'リツイート',
  978. SHARED: '共有',
  979. SHARED_TWEETS: '共有ツイート',
  980. SHOW: '表示',
  981. SHOW_MORE_REPLIES: '返信をさらに表示',
  982. SORT_REPLIES: '返信を並べ替え',
  983. TURN_OFF_QUOTE_TWEETS: '引用ツイートをオフにする',
  984. TURN_OFF_RETWEETS: 'リツイートをオフにする',
  985. TURN_ON_RETWEETS: 'リツイートをオンにする',
  986. TWEET: 'ツイートする',
  987. TWEETS: 'ツイート',
  988. TWEET_ALL: 'すべてツイート',
  989. TWEET_INTERACTIONS: 'ツイートの相互作用',
  990. TWEET_YOUR_REPLY: '返信をツイートしましょう。',
  991. UNDO_RETWEET: 'リツイートを取り消す',
  992. VIEW: '表示する',
  993. },
  994. kn: {
  995. ADD_MUTED_WORD: 'ಸದ್ದಡಗಿಸಿದ ಪದವನ್ನು ಸೇರಿಸಿ',
  996. GROK_ACTIONS: 'Grok ಕ್ರಮಗಳು',
  997. HOME: 'ಹೋಮ್',
  998. LIKES: 'ಇಷ್ಟಗಳು',
  999. MOST_RELEVANT: 'ಅತ್ಯಂತ ಸಂಬಂಧಿತ',
  1000. MUTE_THIS_CONVERSATION: 'ಈ ಸಂವಾದವನ್ನು ಸದ್ದಡಗಿಸಿ',
  1001. POST_ALL: 'ಎಲ್ಲವನ್ನೂ ಪೋಸ್ಟ್ ಮಾಡಿ',
  1002. POST_UNAVAILABLE: 'ಈ ಪೋಸ್ಟ್ ಲಭ್ಯವಿಲ್ಲ.',
  1003. PROFILE_SUMMARY: 'ಪ್ರೊಫೈಲ್ ಸಾರಾಂಶ',
  1004. QUOTE: 'ಕೋಟ್‌',
  1005. QUOTES: 'ಉಲ್ಲೇಖಗಳು',
  1006. QUOTE_TWEET: 'ಟ್ವೀಟ್ ಕೋಟ್ ಮಾಡಿ',
  1007. QUOTE_TWEETS: 'ಕೋಟ್ ಟ್ವೀಟ್‌ಗಳು',
  1008. REPOST: 'ಮರುಪೋಸ್ಟ್ ಮಾಡಿ',
  1009. REPOSTS: 'ಮರುಪೋಸ್ಟ್‌ಗಳು',
  1010. RETWEET: 'ಮರುಟ್ವೀಟಿಸಿ',
  1011. RETWEETED_BY: 'ಮರುಟ್ವೀಟಿಸಿದವರು',
  1012. RETWEETS: 'ಮರುಟ್ವೀಟ್‌ಗಳು',
  1013. SHARED: 'ಹಂಚಲಾಗಿದೆ',
  1014. SHARED_TWEETS: 'ಹಂಚಿದ ಟ್ವೀಟ್‌ಗಳು',
  1015. SHOW: 'ತೋರಿಸಿ',
  1016. SHOW_MORE_REPLIES: 'ಇನ್ನಷ್ಟು ಪ್ರತಿಕ್ರಿಯೆಗಳನ್ನು ತೋರಿಸಿ',
  1017. SORT_REPLIES: 'ಪ್ರತಿಕ್ರಿಯೆಗಳನ್ನು ಆಯೋಜಿಸಿ',
  1018. TURN_OFF_QUOTE_TWEETS: 'ಕೋಟ್ ಟ್ವೀಟ್‌ಗಳನ್ನು ಆಫ್ ಮಾಡಿ',
  1019. TURN_OFF_RETWEETS: 'ಮರುಟ್ವೀಟ್‌ಗಳನ್ನು ಆಫ್ ಮಾಡಿ',
  1020. TURN_ON_RETWEETS: 'ಮರುಟ್ವೀಟ್‌ಗಳನ್ನು ಆನ್ ಮಾಡಿ',
  1021. TWEET: 'ಟ್ವೀಟ್',
  1022. TWEETS: 'ಟ್ವೀಟ್‌ಗಳು',
  1023. TWEET_ALL: 'ಎಲ್ಲಾ ಟ್ವೀಟ್ ಮಾಡಿ',
  1024. TWEET_INTERACTIONS: 'ಟ್ವೀಟ್ ಸಂವಾದಗಳು',
  1025. TWEET_YOUR_REPLY: 'ನಿಮ್ಮ ಪ್ರತಿಕ್ರಿಯೆಯನ್ನು ಟ್ವೀಟ್ ಮಾಡಿ!',
  1026. UNDO_RETWEET: 'ಮರುಟ್ವೀಟಿಸುವುದನ್ನು ರದ್ದುಮಾಡಿ',
  1027. VIEW: 'ವೀಕ್ಷಿಸಿ',
  1028. },
  1029. ko: {
  1030. ADD_MUTED_WORD: '뮤트할 단어 추가하기',
  1031. GROK_ACTIONS: 'Grok 작업',
  1032. HOME: '홈',
  1033. LIKES: '마음에 들어요',
  1034. MOST_RELEVANT: '관련도 순서',
  1035. MUTE_THIS_CONVERSATION: '이 대화 뮤트하기',
  1036. POST_ALL: '모두 게시하기',
  1037. POST_UNAVAILABLE: '이 게시물을 볼 수 없습니다.',
  1038. PROFILE_SUMMARY: '프로필 요약',
  1039. QUOTE: '인용',
  1040. QUOTES: '인용',
  1041. QUOTE_TWEET: '트윗 인용하기',
  1042. QUOTE_TWEETS: '트윗 인용하기',
  1043. REPOST: '재게시',
  1044. REPOSTS: '재게시',
  1045. RETWEET: '리트윗',
  1046. RETWEETED_BY: '리트윗함',
  1047. RETWEETS: '리트윗',
  1048. SHARED: '공유된',
  1049. SHARED_TWEETS: '공유 트윗',
  1050. SHOW: '표시',
  1051. SHOW_MORE_REPLIES: '더 많은 답글 보기',
  1052. SORT_REPLIES: '답글 정렬하기',
  1053. TURN_OFF_QUOTE_TWEETS: '인용 트윗 끄기',
  1054. TURN_OFF_RETWEETS: '리트윗 끄기',
  1055. TURN_ON_RETWEETS: '리트윗 켜기',
  1056. TWEET: '트윗',
  1057. TWEETS: '트윗',
  1058. TWEET_ALL: '모두 트윗하기',
  1059. TWEET_INTERACTIONS: '트윗 상호작용',
  1060. TWEET_YOUR_REPLY: '내 답글을 트윗하세요',
  1061. TWITTER: '트위터',
  1062. UNDO_RETWEET: '리트윗 취소',
  1063. VIEW: '보기',
  1064. },
  1065. mr: {
  1066. ADD_MUTED_WORD: 'म्यूट केलेले शब्द सामील करा',
  1067. GROK_ACTIONS: 'Grok कृती',
  1068. HOME: 'होम',
  1069. LIKES: 'पसंती',
  1070. MOST_RELEVANT: 'सर्वात महत्वाचे',
  1071. MUTE_THIS_CONVERSATION: 'ही चर्चा म्यूट करा',
  1072. POST_ALL: 'सर्व पोस्ट करा',
  1073. POST_UNAVAILABLE: 'हे पोस्ट अनुपलब्ध आहे.',
  1074. PROFILE_SUMMARY: 'प्रोफाइल सारांश',
  1075. QUOTE: 'भाष्य',
  1076. QUOTES: 'भाष्य',
  1077. QUOTE_TWEET: 'ट्विट वर भाष्य करा',
  1078. QUOTE_TWEETS: 'भाष्य ट्विट्स',
  1079. REPOST: 'पुन्हा पोस्ट करा',
  1080. REPOSTS: 'रिपोस्ट',
  1081. RETWEET: 'पुन्हा ट्विट',
  1082. RETWEETED_BY: 'यांनी पुन्हा ट्विट केले',
  1083. RETWEETS: 'पुनर्ट्विट्स',
  1084. SHARED: 'सामायिक',
  1085. SHARED_TWEETS: 'सामायिक ट्विट',
  1086. SHOW: 'दाखवा',
  1087. SHOW_MORE_REPLIES: 'अधिक प्रत्युत्तरे दाखवा',
  1088. SORT_REPLIES: 'प्रत्युत्तरांची क्रमवारी करा',
  1089. TURN_OFF_QUOTE_TWEETS: 'भाष्य ट्विट्स बंद करा',
  1090. TURN_OFF_RETWEETS: 'पुनर्ट्विट्स बंद करा',
  1091. TURN_ON_RETWEETS: 'पुनर्ट्विट्स चालू करा',
  1092. TWEET: 'ट्विट',
  1093. TWEETS: 'ट्विट्स',
  1094. TWEET_ALL: 'सर्व ट्विट करा',
  1095. TWEET_INTERACTIONS: 'ट्वीट इंटरऍक्शन्स',
  1096. TWEET_YOUR_REPLY: 'आपल्या प्रत्युत्तरावर ट्विट करा!',
  1097. UNDO_RETWEET: 'पुनर्ट्विट पूर्ववत करा',
  1098. VIEW: 'पहा',
  1099. },
  1100. ms: {
  1101. ADD_MUTED_WORD: 'Tambahkan perkataan yang disenyapkan',
  1102. GROK_ACTIONS: 'Tindakan Grok',
  1103. HOME: 'Laman Utama',
  1104. LIKES: 'Suka',
  1105. MOST_RELEVANT: 'Paling berkaitan',
  1106. MUTE_THIS_CONVERSATION: 'Senyapkan perbualan ini',
  1107. POST_ALL: 'Siarkan semua',
  1108. POST_UNAVAILABLE: 'Siaran ini tidak tersedia.',
  1109. PROFILE_SUMMARY: 'Ringkasan Profil',
  1110. QUOTE: 'Petikan',
  1111. QUOTES: 'Petikan',
  1112. QUOTE_TWEET: 'Petik Tweet',
  1113. QUOTE_TWEETS: 'Tweet Petikan',
  1114. REPOST: 'Siaran semula',
  1115. REPOSTS: 'Siaran semula',
  1116. RETWEET: 'Tweet semula',
  1117. RETWEETED_BY: 'Ditweet semula oleh',
  1118. RETWEETS: 'Tweet semula',
  1119. SHARED: 'Dikongsi',
  1120. SHARED_TWEETS: 'Tweet Berkongsi',
  1121. SHOW: 'Tunjukkan',
  1122. SHOW_MORE_REPLIES: 'Tunjukkan lagi balasan',
  1123. SORT_REPLIES: 'Isih balasan',
  1124. TURN_OFF_QUOTE_TWEETS: 'Matikan Tweet Petikan',
  1125. TURN_OFF_RETWEETS: 'Matikan Tweet semula',
  1126. TURN_ON_RETWEETS: 'Hidupkan Tweet semula',
  1127. TWEETS: 'Tweet',
  1128. TWEET_ALL: 'Tweet semua',
  1129. TWEET_INTERACTIONS: 'Interaksi Tweet',
  1130. TWEET_YOUR_REPLY: 'Tweet balasan anda!',
  1131. UNDO_RETWEET: 'Buat asal Tweet semula',
  1132. VIEW: 'Lihat',
  1133. },
  1134. nb: {
  1135. ADD_MUTED_WORD: 'Skjul nytt ord',
  1136. GROK_ACTIONS: 'Grok-handlinger',
  1137. HOME: 'Hjem',
  1138. LIKES: 'Liker',
  1139. MOST_RELEVANT: 'Mest relevante',
  1140. MUTE_THIS_CONVERSATION: 'Skjul denne samtalen',
  1141. POST_ALL: 'Publiser alle',
  1142. POST_UNAVAILABLE: 'Dette innlegget er utilgjengelig.',
  1143. PROFILE_SUMMARY: 'Profilsammendrag',
  1144. QUOTE: 'Sitat',
  1145. QUOTES: 'Sitater',
  1146. QUOTE_TWEET: 'Sitat-Tweet',
  1147. QUOTE_TWEETS: 'Sitat-Tweets',
  1148. REPOST: 'Republiser',
  1149. REPOSTS: 'Republiseringer',
  1150. RETWEETED_BY: 'Retweetet av',
  1151. SHARED: 'Delt',
  1152. SHARED_TWEETS: 'Delte tweets',
  1153. SHOW: 'Vis',
  1154. SHOW_MORE_REPLIES: 'Vis flere svar',
  1155. SORT_REPLIES: 'Sorter svar',
  1156. TURN_OFF_QUOTE_TWEETS: 'Slå av sitat-tweets',
  1157. TURN_OFF_RETWEETS: 'Slå av Retweets',
  1158. TURN_ON_RETWEETS: 'Slå på Retweets',
  1159. TWEET_ALL: 'Tweet alle',
  1160. TWEET_INTERACTIONS: 'Tweet-interaksjoner',
  1161. TWEET_YOUR_REPLY: 'Tweet svaret ditt!',
  1162. UNDO_RETWEET: 'Angre Retweet',
  1163. VIEW: 'Vis',
  1164. },
  1165. nl: {
  1166. ADD_MUTED_WORD: 'Genegeerd woord toevoegen',
  1167. GROK_ACTIONS: 'Grok-acties',
  1168. HOME: 'Startpagina',
  1169. LIKES: 'Vind-ik-leuks',
  1170. MOST_RELEVANT: 'Meest relevant',
  1171. MUTE_THIS_CONVERSATION: 'Dit gesprek negeren',
  1172. POST_ALL: 'Alles plaatsen',
  1173. POST_UNAVAILABLE: 'Deze post is niet beschikbaar.',
  1174. PROFILE_SUMMARY: 'Profieloverzicht',
  1175. QUOTE: 'Geciteerd',
  1176. QUOTES: 'Geciteerd',
  1177. QUOTE_TWEET: 'Citeer Tweet',
  1178. QUOTE_TWEETS: 'Geciteerde Tweets',
  1179. RETWEET: 'Retweeten',
  1180. RETWEETED_BY: 'Geretweet door',
  1181. SHARED: 'Gedeeld',
  1182. SHARED_TWEETS: 'Gedeelde Tweets',
  1183. SHOW: 'Weergeven',
  1184. SHOW_MORE_REPLIES: 'Meer antwoorden tonen',
  1185. SORT_REPLIES: 'Antwoorden sorteren',
  1186. TURN_OFF_QUOTE_TWEETS: 'Geciteerde Tweets uitschakelen',
  1187. TURN_OFF_RETWEETS: 'Retweets uitschakelen',
  1188. TURN_ON_RETWEETS: 'Retweets inschakelen',
  1189. TWEET: 'Tweeten',
  1190. TWEET_ALL: 'Alles tweeten',
  1191. TWEET_INTERACTIONS: 'Tweet-interacties',
  1192. TWEET_YOUR_REPLY: 'Tweet je antwoord!',
  1193. UNDO_RETWEET: 'Retweet ongedaan maken',
  1194. VIEW: 'Bekijken',
  1195. },
  1196. pl: {
  1197. ADD_MUTED_WORD: 'Dodaj wyciszone słowo',
  1198. GROK_ACTIONS: 'Akcje Groka',
  1199. HOME: 'Główna',
  1200. LIKES: 'Polubienia',
  1201. MOST_RELEVANT: 'Najtrafniejsze',
  1202. MUTE_THIS_CONVERSATION: 'Wycisz tę rozmowę',
  1203. POST_ALL: 'Opublikuj wszystko',
  1204. POST_UNAVAILABLE: 'Ten wpis jest niedostępny.',
  1205. PROFILE_SUMMARY: 'Podsumowanie profilu',
  1206. QUOTE: 'Cytuj',
  1207. QUOTES: 'Cytaty',
  1208. QUOTE_TWEET: 'Cytuj Tweeta',
  1209. QUOTE_TWEETS: 'Cytaty z Tweeta',
  1210. REPOST: 'Podaj dalej wpis',
  1211. REPOSTS: 'Wpisy podane dalej',
  1212. RETWEET: 'Podaj dalej',
  1213. RETWEETED_BY: 'Podane dalej przez',
  1214. RETWEETS: 'Tweety podane dalej',
  1215. SHARED: 'Udostępniony',
  1216. SHARED_TWEETS: 'Udostępnione Tweety',
  1217. SHOW: 'Pokaż',
  1218. SHOW_MORE_REPLIES: 'Pokaż więcej odpowiedzi',
  1219. SORT_REPLIES: 'Sortuj odpowiedzi',
  1220. TURN_OFF_QUOTE_TWEETS: 'Wyłącz tweety z cytatem',
  1221. TURN_OFF_RETWEETS: 'Wyłącz Tweety podane dalej',
  1222. TURN_ON_RETWEETS: 'Włącz Tweety podane dalej',
  1223. TWEETS: 'Tweety',
  1224. TWEET_ALL: 'Tweetnij wszystko',
  1225. TWEET_INTERACTIONS: 'Interakcje na Tweeta',
  1226. TWEET_YOUR_REPLY: 'Wyślij Tweeta z odpowiedzią!',
  1227. UNDO_RETWEET: 'Cofnij podanie dalej',
  1228. VIEW: 'Wyświetl',
  1229. },
  1230. pt: {
  1231. ADD_MUTED_WORD: 'Adicionar palavra silenciada',
  1232. GROK_ACTIONS: 'Ações do Grok',
  1233. HOME: 'Página Inicial',
  1234. LIKES: 'Curtidas',
  1235. MOST_RELEVANT: 'Mais relevante',
  1236. MUTE_THIS_CONVERSATION: 'Silenciar esta conversa',
  1237. POST_ALL: 'Postar tudo',
  1238. POST_UNAVAILABLE: 'Este post está indisponível.',
  1239. PROFILE_SUMMARY: 'Resumo do perfil',
  1240. QUOTE: 'Comentar',
  1241. QUOTES: 'Comentários',
  1242. QUOTE_TWEET: 'Comentar o Tweet',
  1243. QUOTE_TWEETS: 'Tweets com comentário',
  1244. REPOST: 'Repostar',
  1245. RETWEET: 'Retweetar',
  1246. RETWEETED_BY: 'Retweetado por',
  1247. SHARED: 'Compartilhado',
  1248. SHARED_TWEETS: 'Tweets Compartilhados',
  1249. SHOW: 'Mostrar',
  1250. SHOW_MORE_REPLIES: 'Mostrar mais respostas',
  1251. SORT_REPLIES: 'Ordenar respostas',
  1252. TURN_OFF_QUOTE_TWEETS: 'Desativar Tweets com comentário',
  1253. TURN_OFF_RETWEETS: 'Desativar Retweets',
  1254. TURN_ON_RETWEETS: 'Ativar Retweets',
  1255. TWEET: 'Tweetar',
  1256. TWEET_ALL: 'Tweetar tudo',
  1257. TWEET_INTERACTIONS: 'Interações com Tweet',
  1258. TWEET_YOUR_REPLY: 'Tweetar sua resposta!',
  1259. UNDO_RETWEET: 'Desfazer Retweet',
  1260. VIEW: 'Ver',
  1261. },
  1262. ro: {
  1263. ADD_MUTED_WORD: 'Adaugă cuvântul ignorat',
  1264. GROK_ACTIONS: 'Acțiuni Grok',
  1265. HOME: 'Pagina principală',
  1266. LIKES: 'Aprecieri',
  1267. MOST_RELEVANT: 'Cele mai relevante',
  1268. MUTE_THIS_CONVERSATION: 'Ignoră această conversație',
  1269. POST_ALL: 'Postează tot',
  1270. POST_UNAVAILABLE: 'Această postare este indisponibilă.',
  1271. PROFILE_SUMMARY: 'Sumarul profilului',
  1272. QUOTE: 'Citat',
  1273. QUOTES: 'Citate',
  1274. QUOTE_TWEET: 'Citează Tweetul',
  1275. QUOTE_TWEETS: 'Tweeturi cu citat',
  1276. REPOST: 'Repostează',
  1277. REPOSTS: 'Repostări',
  1278. RETWEET: 'Redistribuie',
  1279. RETWEETED_BY: 'Redistribuit de către',
  1280. RETWEETS: 'Retweeturi',
  1281. SHARED: 'Partajat',
  1282. SHARED_TWEETS: 'Tweeturi partajate',
  1283. SHOW: 'Afișează',
  1284. SHOW_MORE_REPLIES: 'Afișează mai multe răspunsuri',
  1285. SORT_REPLIES: 'Sortare răspunsuri',
  1286. TURN_OFF_QUOTE_TWEETS: 'Dezactivează tweeturile cu citat',
  1287. TURN_OFF_RETWEETS: 'Dezactivează Retweeturile',
  1288. TURN_ON_RETWEETS: 'Activează Retweeturile',
  1289. TWEETS: 'Tweeturi',
  1290. TWEET_ALL: 'Dă Tweeturi cu tot',
  1291. TWEET_INTERACTIONS: 'Interacțiuni cu Tweetul',
  1292. TWEET_YOUR_REPLY: 'Dă Tweet cu răspunsul!',
  1293. UNDO_RETWEET: 'Anulează Retweetul',
  1294. VIEW: 'Vezi',
  1295. },
  1296. ru: {
  1297. ADD_MUTED_WORD: 'Добавить игнорируемое слово',
  1298. GROK_ACTIONS: 'Действия Grok',
  1299. HOME: 'Главная',
  1300. LIKES: 'Нравится',
  1301. MOST_RELEVANT: 'Наиболее актуальные',
  1302. MUTE_THIS_CONVERSATION: 'Игнорировать эту переписку',
  1303. POST_ALL: 'Опубликовать все',
  1304. POST_UNAVAILABLE: 'Этот пост недоступен.',
  1305. PROFILE_SUMMARY: 'Сводка профиля',
  1306. QUOTE: 'Цитата',
  1307. QUOTES: 'Цитаты',
  1308. QUOTE_TWEET: 'Цитировать',
  1309. QUOTE_TWEETS: 'Твиты с цитатами',
  1310. REPOST: 'Сделать репост',
  1311. REPOSTS: 'Репосты',
  1312. RETWEET: 'Ретвитнуть',
  1313. RETWEETED_BY: 'Ретвитнул(а)',
  1314. RETWEETS: 'Ретвиты',
  1315. SHARED: 'Общий',
  1316. SHARED_TWEETS: 'Общие твиты',
  1317. SHOW: 'Показать',
  1318. SHOW_MORE_REPLIES: 'Показать ещё ответы',
  1319. SORT_REPLIES: 'Упорядочить ответы',
  1320. TURN_OFF_QUOTE_TWEETS: 'Отключить твиты с цитатами',
  1321. TURN_OFF_RETWEETS: 'Отключить ретвиты',
  1322. TURN_ON_RETWEETS: 'Включить ретвиты',
  1323. TWEET: 'Твитнуть',
  1324. TWEETS: 'Твиты',
  1325. TWEET_ALL: 'Твитнуть все',
  1326. TWEET_INTERACTIONS: 'Взаимодействие в Твитнуть',
  1327. TWEET_YOUR_REPLY: 'Твитните свой ответ!',
  1328. TWITTER: 'Твиттер',
  1329. UNDO_RETWEET: 'Отменить ретвит',
  1330. VIEW: 'Посмотреть',
  1331. },
  1332. sk: {
  1333. ADD_MUTED_WORD: 'Pridať stíšené slovo',
  1334. GROK_ACTIONS: 'Akcie Groka',
  1335. HOME: 'Domov',
  1336. LIKES: 'Páči sa',
  1337. MOST_RELEVANT: 'Najrelevantnejšie',
  1338. MUTE_THIS_CONVERSATION: 'Stíšiť túto konverzáciu',
  1339. POST_ALL: 'Uverejniť všetko',
  1340. POST_UNAVAILABLE: 'Tento príspevok je nedostupný.',
  1341. PROFILE_SUMMARY: 'Súhrn profilu',
  1342. QUOTE: 'Citát',
  1343. QUOTES: 'Citáty',
  1344. QUOTE_TWEET: 'Tweet s citátom',
  1345. QUOTE_TWEETS: 'Tweety s citátom',
  1346. REPOST: 'Opätovné uverejnenie',
  1347. REPOSTS: 'Opätovné uverejnenia',
  1348. RETWEET: 'Retweetnuť',
  1349. RETWEETED_BY: 'Retweetnuté používateľom',
  1350. RETWEETS: 'Retweety',
  1351. SHARED: 'Zdieľaný',
  1352. SHARED_TWEETS: 'Zdieľané Tweety',
  1353. SHOW: 'Zobraziť',
  1354. SHOW_MORE_REPLIES: 'Zobraziť viac odpovedí',
  1355. SORT_REPLIES: 'Zoradiť odpovede',
  1356. TURN_OFF_QUOTE_TWEETS: 'Vypnúť tweety s citátom',
  1357. TURN_OFF_RETWEETS: 'Vypnúť retweety',
  1358. TURN_ON_RETWEETS: 'Zapnúť retweety',
  1359. TWEET: 'Tweetnuť',
  1360. TWEETS: 'Tweety',
  1361. TWEET_ALL: 'Tweetnuť všetko',
  1362. TWEET_INTERACTIONS: 'Interakcie s Tweet',
  1363. TWEET_YOUR_REPLY: 'Tweetnite odpoveď!',
  1364. UNDO_RETWEET: 'Zrušiť retweet',
  1365. VIEW: 'Zobraziť',
  1366. },
  1367. sr: {
  1368. ADD_MUTED_WORD: 'Додај игнорисану реч',
  1369. GROK_ACTIONS: 'Grok радње',
  1370. HOME: 'Почетна',
  1371. LIKES: 'Свиђања',
  1372. MOST_RELEVANT: 'Најважније',
  1373. MUTE_THIS_CONVERSATION: 'Игнориши овај разговор',
  1374. POST_ALL: 'Објави све',
  1375. POST_UNAVAILABLE: 'Ова објава није доступна.',
  1376. PROFILE_SUMMARY: 'Резиме профила',
  1377. QUOTE: 'Цитат',
  1378. QUOTES: 'Цитати',
  1379. QUOTE_TWEET: 'твит са цитатом',
  1380. QUOTE_TWEETS: 'твит(ов)а са цитатом',
  1381. REPOST: 'Поново објави',
  1382. REPOSTS: 'Понвне објаве',
  1383. RETWEET: 'Ретвитуј',
  1384. RETWEETED_BY: 'Ретвитовано од стране',
  1385. RETWEETS: 'Ретвитови',
  1386. SHARED: 'Подељено',
  1387. SHARED_TWEETS: 'Дељени твитови',
  1388. SHOW: 'Прикажи',
  1389. SHOW_MORE_REPLIES: 'Прикажи још одговора',
  1390. SORT_REPLIES: 'Сортирање одговора',
  1391. TURN_OFF_QUOTE_TWEETS: 'Искључи твит(ов)е са цитатом',
  1392. TURN_OFF_RETWEETS: 'Искључи ретвитове',
  1393. TURN_ON_RETWEETS: 'Укључи ретвитове',
  1394. TWEET: 'Твитуј',
  1395. TWEETS: 'Твитови',
  1396. TWEET_ALL: 'Твитуј све',
  1397. TWEET_INTERACTIONS: 'Интеракције са Твитуј',
  1398. TWEET_YOUR_REPLY: 'Твитуј свој одговор!',
  1399. TWITTER: 'Твитер',
  1400. UNDO_RETWEET: 'Опозови ретвит',
  1401. VIEW: 'Погледај',
  1402. },
  1403. sv: {
  1404. ADD_MUTED_WORD: 'Lägg till ignorerat ord',
  1405. GROK_ACTIONS: 'Grok-åtgärder',
  1406. HOME: 'Hem',
  1407. LIKES: 'Gilla-markeringar',
  1408. MOST_RELEVANT: 'Mest relevant',
  1409. MUTE_THIS_CONVERSATION: 'Ignorera den här konversationen',
  1410. POST_ALL: 'Lägg upp allt',
  1411. POST_UNAVAILABLE: 'Detta inlägg är inte tillgängligt.',
  1412. PROFILE_SUMMARY: 'Profilöversikt',
  1413. QUOTE: 'Citat',
  1414. QUOTES: 'Citat',
  1415. QUOTE_TWEET: 'Citera Tweet',
  1416. QUOTE_TWEETS: 'Citat-tweets',
  1417. REPOST: 'Återpublicera',
  1418. REPOSTS: 'Återpubliceringar',
  1419. RETWEET: 'Retweeta',
  1420. RETWEETED_BY: 'Retweetad av',
  1421. SHARED: 'Delad',
  1422. SHARED_TWEETS: 'Delade tweetsen',
  1423. SHOW: 'Visa',
  1424. SHOW_MORE_REPLIES: 'Visa fler svar',
  1425. SORT_REPLIES: 'Sortera svar',
  1426. TURN_OFF_QUOTE_TWEETS: 'Stäng av citat-tweets',
  1427. TURN_OFF_RETWEETS: 'Stäng av Retweets',
  1428. TURN_ON_RETWEETS: 'Slå på Retweets',
  1429. TWEET: 'Tweeta',
  1430. TWEET_ALL: 'Tweeta allt',
  1431. TWEET_INTERACTIONS: 'Interaktioner med Tweet',
  1432. TWEET_YOUR_REPLY: 'Tweeta ditt svar!',
  1433. UNDO_RETWEET: 'Ångra retweeten',
  1434. VIEW: 'Visa',
  1435. },
  1436. ta: {
  1437. ADD_MUTED_WORD: 'செயல்மறைத்த வார்த்தையைச் சேர்',
  1438. GROK_ACTIONS: 'Grok செயல்கள்',
  1439. HOME: 'முகப்பு',
  1440. LIKES: 'விருப்பங்கள்',
  1441. MOST_RELEVANT: 'மிகவும் தொடர்புடையவை',
  1442. MUTE_THIS_CONVERSATION: 'இந்த உரையாடலை செயல்மறை',
  1443. POST_ALL: 'எல்லாம் இடுகையிடு',
  1444. POST_UNAVAILABLE: 'இந்த இடுகை கிடைக்கவில்லை.',
  1445. PROFILE_SUMMARY: 'சுயவிவரச் சுருக்கம்',
  1446. QUOTE: 'மேற்கோள்',
  1447. QUOTES: 'மேற்கோள்கள்',
  1448. QUOTE_TWEET: 'ட்விட்டை மேற்கோள் காட்டு',
  1449. QUOTE_TWEETS: 'மேற்கோள் கீச்சுகள்',
  1450. REPOST: 'மறுஇடுகை',
  1451. REPOSTS: 'மறுஇடுகைகள்',
  1452. RETWEET: 'மறுட்விட் செய்',
  1453. RETWEETED_BY: 'இவரால் மறுட்விட் செய்யப்பட்டது',
  1454. RETWEETS: 'மறுகீச்சுகள்',
  1455. SHARED: 'பகிரப்பட்டது',
  1456. SHARED_TWEETS: 'பகிரப்பட்ட ட்வீட்டுகள்',
  1457. SHOW: 'காண்பி',
  1458. SHOW_MORE_REPLIES: 'மேலும் பதில்களைக் காண்பி',
  1459. SORT_REPLIES: 'பதில்களை வகைப்படுத்து',
  1460. TURN_OFF_QUOTE_TWEETS: 'மேற்கோள் கீச்சுகளை அணை',
  1461. TURN_OFF_RETWEETS: 'மறுகீச்சுகளை அணை',
  1462. TURN_ON_RETWEETS: 'மறுகீச்சுகளை இயக்கு',
  1463. TWEET: 'ட்விட் செய்',
  1464. TWEETS: 'கீச்சுகள்',
  1465. TWEET_ALL: 'அனைத்தையும் ட்விட் செய்',
  1466. TWEET_INTERACTIONS: 'ட்விட் செய் ஊடாடல்களைக்',
  1467. TWEET_YOUR_REPLY: 'உங்கள் பதிலை ட்விட் செய்யவும்!',
  1468. UNDO_RETWEET: 'மறுகீச்சை செயல்தவிர்',
  1469. VIEW: 'காண்பி',
  1470. },
  1471. th: {
  1472. ADD_MUTED_WORD: 'เพิ่มคำที่ซ่อน',
  1473. GROK_ACTIONS: 'การดำเนินการของ Grok',
  1474. HOME: 'หน้าแรก',
  1475. LIKES: 'ความชอบ',
  1476. MOST_RELEVANT: 'เกี่ยวข้องที่สุด',
  1477. MUTE_THIS_CONVERSATION: 'ซ่อนบทสนทนานี้',
  1478. POST_ALL: 'โพสต์ทั้งหมด',
  1479. POST_UNAVAILABLE: 'โพสต์นี้ไม่สามารถใช้งานได้',
  1480. PROFILE_SUMMARY: 'ข้อมูลส่วนตัวโดยย่อ',
  1481. QUOTE: 'การอ้างอิง',
  1482. QUOTES: 'คำพูด',
  1483. QUOTE_TWEET: 'อ้างอิงทวีต',
  1484. QUOTE_TWEETS: 'ทวีตและคำพูด',
  1485. REPOST: 'รีโพสต์',
  1486. REPOSTS: 'รีโพสต์',
  1487. RETWEET: 'รีทวีต',
  1488. RETWEETED_BY: 'ถูกรีทวีตโดย',
  1489. RETWEETS: 'รีทวีต',
  1490. SHARED: 'แบ่งปัน',
  1491. SHARED_TWEETS: 'ทวีตที่แชร์',
  1492. SHOW: 'แสดง',
  1493. SHOW_MORE_REPLIES: 'แสดงการตอบกลับเพิ่มเติม',
  1494. SORT_REPLIES: 'จัดเรียงการตอบกลับ',
  1495. TURN_OFF_QUOTE_TWEETS: 'ปิดทวีตและคำพูด',
  1496. TURN_OFF_RETWEETS: 'ปิดรีทวีต',
  1497. TURN_ON_RETWEETS: 'เปิดรีทวีต',
  1498. TWEET: 'ทวีต',
  1499. TWEETS: 'ทวีต',
  1500. TWEET_ALL: 'ทวีตทั้งหมด',
  1501. TWEET_INTERACTIONS: 'การโต้ตอบของทวีต',
  1502. TWEET_YOUR_REPLY: 'ทวีตการตอบกลับของคุณ',
  1503. TWITTER: 'ทวิตเตอร์',
  1504. UNDO_RETWEET: 'ยกเลิกการรีทวีต',
  1505. VIEW: 'ดู',
  1506. },
  1507. tr: {
  1508. ADD_MUTED_WORD: 'Sessize alınacak kelime ekle',
  1509. GROK_ACTIONS: 'Grok işlemleri',
  1510. HOME: 'Anasayfa',
  1511. LIKES: 'Beğeni',
  1512. MOST_RELEVANT: 'En alakalı',
  1513. MUTE_THIS_CONVERSATION: 'Bu sohbeti sessize al',
  1514. POST_ALL: 'Tümünü gönder',
  1515. POST_UNAVAILABLE: 'Bu gönderi kullanılamıyor.',
  1516. PROFILE_SUMMARY: 'Profil Özeti',
  1517. QUOTE: 'Alıntı',
  1518. QUOTES: 'Alıntılar',
  1519. QUOTE_TWEET: 'Tweeti Alıntıla',
  1520. QUOTE_TWEETS: 'Alıntı Tweetler',
  1521. REPOST: 'Yeniden gönder',
  1522. REPOSTS: 'Yeniden gönderiler',
  1523. RETWEETED_BY: 'Retweetleyen(ler):',
  1524. RETWEETS: 'Retweetler',
  1525. SHARED: 'Paylaşılan',
  1526. SHARED_TWEETS: 'Paylaşılan Tweetler',
  1527. SHOW: 'Göster',
  1528. SHOW_MORE_REPLIES: 'Daha fazla yanıt göster',
  1529. SORT_REPLIES: 'Yanıtları sırala',
  1530. TURN_OFF_QUOTE_TWEETS: 'Alıntı Tweetleri kapat',
  1531. TURN_OFF_RETWEETS: 'Retweetleri kapat',
  1532. TURN_ON_RETWEETS: 'Retweetleri aç',
  1533. TWEET: 'Tweetle',
  1534. TWEETS: 'Tweetler',
  1535. TWEET_ALL: 'Hepsini Tweetle',
  1536. TWEET_INTERACTIONS: 'Tweet etkileşimleri',
  1537. TWEET_YOUR_REPLY: 'Yanıtını Tweetle.',
  1538. UNDO_RETWEET: 'Retweeti Geri Al',
  1539. VIEW: 'Görüntüle',
  1540. },
  1541. uk: {
  1542. ADD_MUTED_WORD: 'Додати слово до списку ігнорування',
  1543. GROK_ACTIONS: 'Дії Grok',
  1544. HOME: 'Головна',
  1545. LIKES: 'Вподобання',
  1546. MOST_RELEVANT: 'Найактуальніші',
  1547. MUTE_THIS_CONVERSATION: 'Ігнорувати цю розмову',
  1548. POST_ALL: 'Опублікувати все',
  1549. POST_UNAVAILABLE: 'Цей пост недоступний.',
  1550. PROFILE_SUMMARY: 'Зведення профілю',
  1551. QUOTE: 'Цитата',
  1552. QUOTES: 'Цитати',
  1553. QUOTE_TWEET: 'Цитувати твіт',
  1554. QUOTE_TWEETS: 'Цитовані твіти',
  1555. REPOST: 'Зробити репост',
  1556. REPOSTS: 'Репости',
  1557. RETWEET: 'Ретвітнути',
  1558. RETWEETED_BY: 'Ретвіти',
  1559. RETWEETS: 'Ретвіти',
  1560. SHARED: 'Спільний',
  1561. SHARED_TWEETS: 'Спільні твіти',
  1562. SHOW: 'Показати',
  1563. SHOW_MORE_REPLIES: 'Показати більше відповідей',
  1564. SORT_REPLIES: 'Сортувати відповіді',
  1565. TURN_OFF_QUOTE_TWEETS: 'Вимкнути цитовані твіти',
  1566. TURN_OFF_RETWEETS: 'Вимкнути ретвіти',
  1567. TURN_ON_RETWEETS: 'Увімкнути ретвіти',
  1568. TWEET: 'Твіт',
  1569. TWEETS: 'Твіти',
  1570. TWEET_ALL: 'Твітнути все',
  1571. TWEET_INTERACTIONS: 'Взаємодія твітів',
  1572. TWEET_YOUR_REPLY: 'Твітніть свою відповідь!',
  1573. TWITTER: 'Твіттер',
  1574. UNDO_RETWEET: 'Скасувати ретвіт',
  1575. VIEW: 'Переглянути',
  1576. },
  1577. ur: {
  1578. ADD_MUTED_WORD: 'میوٹ شدہ لفظ شامل کریں',
  1579. GROK_ACTIONS: 'Grok actions',
  1580. HOME: 'ہوم',
  1581. LIKES: 'لائک',
  1582. MUTE_THIS_CONVERSATION: 'اس گفتگو کو میوٹ کریں',
  1583. QUOTE: 'نقل کریں',
  1584. QUOTES: 'منقول',
  1585. QUOTE_TWEET: 'ٹویٹ کا حوالہ دیں',
  1586. QUOTE_TWEETS: 'ٹویٹ کو نقل کرو',
  1587. RETWEET: 'ریٹویٹ',
  1588. RETWEETED_BY: 'جنہوں نے ریٹویٹ کیا',
  1589. RETWEETS: 'ریٹویٹس',
  1590. SHARED: 'مشترکہ',
  1591. SHARED_TWEETS: 'مشترکہ ٹویٹس',
  1592. SHOW: 'دکھائیں',
  1593. SHOW_MORE_REPLIES: 'مزید جوابات دکھائیں',
  1594. TURN_OFF_QUOTE_TWEETS: 'ٹویٹ کو نقل کرنا بند کریں',
  1595. TURN_OFF_RETWEETS: 'ری ٹویٹس غیر فعال کریں',
  1596. TURN_ON_RETWEETS: 'ری ٹویٹس غیر فعال کریں',
  1597. TWEET: 'ٹویٹ',
  1598. TWEETS: 'ٹویٹس',
  1599. TWEET_ALL: 'سب کو ٹویٹ کریں',
  1600. TWEET_INTERACTIONS: 'ٹویٹ تعاملات',
  1601. TWITTER: 'ٹوئٹر',
  1602. UNDO_RETWEET: 'ری ٹویٹ کو کالعدم کریں',
  1603. VIEW: 'دیکھیں',
  1604. },
  1605. vi: {
  1606. ADD_MUTED_WORD: 'Thêm từ tắt tiếng',
  1607. GROK_ACTIONS: 'Hành động của Grok',
  1608. HOME: 'Trang chủ',
  1609. LIKES: 'Lượt thích',
  1610. MOST_RELEVANT: 'Liên quan nhất',
  1611. MUTE_THIS_CONVERSATION: 'Tắt tiếng cuộc trò chuyện này',
  1612. POST_ALL: 'Đăng tất cả',
  1613. POST_UNAVAILABLE: 'Không có bài đăng này.',
  1614. PROFILE_SUMMARY: 'Tóm tắt hồ sơ',
  1615. QUOTE: 'Trích dẫn',
  1616. QUOTES: 'Trích dẫn',
  1617. QUOTE_TWEET: 'Trích dẫn Tweet',
  1618. QUOTE_TWEETS: 'Tweet trích dẫn',
  1619. REPOST: 'Đăng lại',
  1620. REPOSTS: 'Bài đăng lại',
  1621. RETWEET: 'Tweet lại',
  1622. RETWEETED_BY: 'Được Tweet lại bởi',
  1623. RETWEETS: 'Các Tweet lại',
  1624. SHARED: 'Đã chia sẻ',
  1625. SHARED_TWEETS: 'Tweet được chia sẻ',
  1626. SHOW: 'Hiện',
  1627. SHOW_MORE_REPLIES: 'Hiển thị thêm trả lời',
  1628. SORT_REPLIES: 'Sắp xếp câu trả lời',
  1629. TURN_OFF_QUOTE_TWEETS: 'Tắt Tweet trích dẫn',
  1630. TURN_OFF_RETWEETS: 'Tắt Tweet lại',
  1631. TURN_ON_RETWEETS: 'Bật Tweet lại',
  1632. TWEETS: 'Tweet',
  1633. TWEET_ALL: 'Đăng Tweet tất cả',
  1634. TWEET_INTERACTIONS: 'Tương tác Tweet',
  1635. TWEET_YOUR_REPLY: 'Đăng Tweet câu trả lời của bạn!',
  1636. UNDO_RETWEET: 'Hoàn tác Tweet lại',
  1637. VIEW: 'Xem',
  1638. },
  1639. 'zh-Hant': {
  1640. ADD_MUTED_WORD: '加入靜音文字',
  1641. GROK_ACTIONS: 'Grok 動作',
  1642. HOME: '首頁',
  1643. LIKES: '喜歡的內容',
  1644. MOST_RELEVANT: '最相關',
  1645. MUTE_THIS_CONVERSATION: '將此對話靜音',
  1646. POST_ALL: '全部發佈',
  1647. POST_UNAVAILABLE: '此貼文無法查看。',
  1648. PROFILE_SUMMARY: '個人檔案摘要',
  1649. QUOTE: '引用',
  1650. QUOTES: '引用',
  1651. QUOTE_TWEET: '引用推文',
  1652. QUOTE_TWEETS: '引用的推文',
  1653. REPOST: '轉發',
  1654. REPOSTS: '轉發',
  1655. RETWEET: '轉推',
  1656. RETWEETED_BY: '已被轉推',
  1657. RETWEETS: '轉推',
  1658. SHARED: '共享',
  1659. SHARED_TWEETS: '分享的推文',
  1660. SHOW: '顯示',
  1661. SHOW_MORE_REPLIES: '顯示更多回覆',
  1662. SORT_REPLIES: '將回覆排序',
  1663. TURN_OFF_QUOTE_TWEETS: '關閉引用的推文',
  1664. TURN_OFF_RETWEETS: '關閉轉推',
  1665. TURN_ON_RETWEETS: '開啟轉推',
  1666. TWEET: '推文',
  1667. TWEETS: '推文',
  1668. TWEET_ALL: '推全部內容',
  1669. TWEET_INTERACTIONS: '推文互動',
  1670. TWEET_YOUR_REPLY: '推你的回覆!',
  1671. UNDO_RETWEET: '取消轉推',
  1672. VIEW: '查看',
  1673. },
  1674. zh: {
  1675. ADD_MUTED_WORD: '添加要隐藏的字词',
  1676. GROK_ACTIONS: 'Grok 操作',
  1677. HOME: '主页',
  1678. LIKES: '喜欢',
  1679. MOST_RELEVANT: '最相关',
  1680. MUTE_THIS_CONVERSATION: '隐藏此对话',
  1681. POST_ALL: '全部发帖',
  1682. POST_UNAVAILABLE: '这个帖子不可用。',
  1683. PROFILE_SUMMARY: '个人资料概要',
  1684. QUOTE: '引用',
  1685. QUOTES: '引用',
  1686. QUOTE_TWEET: '引用推文',
  1687. QUOTE_TWEETS: '引用推文',
  1688. REPOST: '转帖',
  1689. REPOSTS: '转帖',
  1690. RETWEET: '转推',
  1691. RETWEETED_BY: '转推者',
  1692. RETWEETS: '转推',
  1693. SHARED: '共享',
  1694. SHARED_TWEETS: '分享的推文',
  1695. SHOW: '显示',
  1696. SHOW_MORE_REPLIES: '显示更多回复',
  1697. SORT_REPLIES: '对回复排序',
  1698. TURN_OFF_QUOTE_TWEETS: '关闭引用推文',
  1699. TURN_OFF_RETWEETS: '关闭转推',
  1700. TURN_ON_RETWEETS: '开启转推',
  1701. TWEET: '推文',
  1702. TWEETS: '推文',
  1703. TWEET_ALL: '全部发推',
  1704. TWEET_INTERACTIONS: '推文互动',
  1705. TWEET_YOUR_REPLY: '发布你的回复!',
  1706. UNDO_RETWEET: '撤销转推',
  1707. VIEW: '查看',
  1708. },
  1709. }
  1710.  
  1711. /**
  1712. * @param {import("./types").LocaleKey} code
  1713. * @returns {string}
  1714. */
  1715. function getString(code) {
  1716. return (locales[lang] || locales['en'])[code] || locales['en'][code];
  1717. }
  1718. //#endregion
  1719.  
  1720. //#region Constants
  1721. /** @enum {string} */
  1722. const PagePaths = {
  1723. ACCESSIBILITY_SETTINGS: '/settings/accessibility',
  1724. ADD_MUTED_WORD: '/settings/add_muted_keyword',
  1725. BOOKMARKS: '/i/bookmarks',
  1726. COMPOSE_MESSAGE: '/messages/compose',
  1727. COMPOSE_TWEET: '/compose/post',
  1728. CONNECT: '/i/connect',
  1729. DISPLAY_SETTINGS: '/settings/display',
  1730. HOME: '/home',
  1731. NOTIFICATION_TIMELINE: '/i/timeline',
  1732. PROFILE_SETTINGS: '/settings/profile',
  1733. SEARCH: '/search',
  1734. TIMELINE_SETTINGS: '/home/pinned/edit',
  1735. }
  1736.  
  1737. /** @enum {string} */
  1738. const Selectors = {
  1739. BLOCK_MENU_ITEM: '[data-testid="block"]',
  1740. DESKTOP_TIMELINE_HEADER: 'div[data-testid="primaryColumn"] > div > div:first-of-type',
  1741. DISPLAY_DONE_BUTTON_DESKTOP: '#layers button[role="button"]:not([aria-label])',
  1742. DISPLAY_DONE_BUTTON_MOBILE: 'main button[role="button"]:not([aria-label])',
  1743. MODAL_TIMELINE: 'section > h1 + div[aria-label] > div',
  1744. MOBILE_TIMELINE_HEADER: 'div[data-testid="TopNavBar"]',
  1745. NAV_HOME_LINK: 'a[data-testid="AppTabBar_Home_Link"]',
  1746. PRIMARY_COLUMN: 'div[data-testid="primaryColumn"]',
  1747. PRIMARY_NAV_DESKTOP: 'header nav',
  1748. PRIMARY_NAV_MOBILE: '#layers nav',
  1749. PROMOTED_TWEET_CONTAINER: '[data-testid="placementTracking"]',
  1750. SIDEBAR: 'div[data-testid="sidebarColumn"]',
  1751. SIDEBAR_WRAPPERS: 'div[data-testid="sidebarColumn"] > div > div > div > div > div',
  1752. SORT_REPLIES_PATH: 'svg path[d="M14 6V3h2v8h-2V8H3V6h11zm7 2h-3.5V6H21v2zM8 16v-3h2v8H8v-3H3v-2h5zm13 2h-9.5v-2H21v2z"]',
  1753. TIMELINE: 'div[data-testid="primaryColumn"] section > h1 + div[aria-label] > div',
  1754. TIMELINE_HEADING: 'h2[role="heading"]',
  1755. TWEET: '[data-testid="tweet"]',
  1756. VERIFIED_TICK: 'svg[data-testid="icon-verified"]',
  1757. X_LOGO_PATH: 'svg path[d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"]',
  1758. X_DARUMA_LOGO_PATH: 'svg path[d="M18.436 1.92h3.403l-7.433 8.495 8.745 11.563h-6.849l-5.363-7.012-6.136 7.012H1.4l7.951-9.088L.96 1.92h7.02l4.848 6.41 5.608-6.41zm-1.194 18.021h1.886L6.958 3.851H4.933l12.308 16.09z"]',
  1759. }
  1760.  
  1761. /** @enum {string} */
  1762. const Svgs = {
  1763. BLUE_LOGO_PATH: 'M16.5 3H2v18h15c3.038 0 5.5-2.46 5.5-5.5 0-1.4-.524-2.68-1.385-3.65-.08-.09-.089-.22-.023-.32.574-.87.908-1.91.908-3.03C22 5.46 19.538 3 16.5 3zm-.796 5.99c.457-.05.892-.17 1.296-.35-.302.45-.684.84-1.125 1.15.004.1.006.19.006.29 0 2.94-2.269 6.32-6.421 6.32-1.274 0-2.46-.37-3.459-1 .177.02.357.03.539.03 1.057 0 2.03-.35 2.803-.95-.988-.02-1.821-.66-2.109-1.54.138.03.28.04.425.04.206 0 .405-.03.595-.08-1.033-.2-1.811-1.1-1.811-2.18v-.03c.305.17.652.27 1.023.28-.606-.4-1.004-1.08-1.004-1.85 0-.4.111-.78.305-1.11 1.113 1.34 2.775 2.22 4.652 2.32-.038-.17-.058-.33-.058-.51 0-1.23 1.01-2.22 2.256-2.22.649 0 1.235.27 1.647.7.514-.1.997-.28 1.433-.54-.168.52-.526.96-.992 1.23z',
  1764. MUTE: '<g><path d="M18 6.59V1.2L8.71 7H5.5C4.12 7 3 8.12 3 9.5v5C3 15.88 4.12 17 5.5 17h2.09l-2.3 2.29 1.42 1.42 15.5-15.5-1.42-1.42L18 6.59zm-8 8V8.55l6-3.75v3.79l-6 6zM5 9.5c0-.28.22-.5.5-.5H8v6H5.5c-.28 0-.5-.22-.5-.5v-5zm6.5 9.24l1.45-1.45L16 19.2V14l2 .02v8.78l-6.5-4.06z"></path></g>',
  1765. RETWEET: '<g><path d="M4.5 3.88l4.432 4.14-1.364 1.46L5.5 7.55V16c0 1.1.896 2 2 2H13v2H7.5c-2.209 0-4-1.79-4-4V7.55L1.432 9.48.068 8.02 4.5 3.88zM16.5 6H11V4h5.5c2.209 0 4 1.79 4 4v8.45l2.068-1.93 1.364 1.46-4.432 4.14-4.432-4.14 1.364-1.46 2.068 1.93V8c0-1.1-.896-2-2-2z"></path></g>',
  1766. RETWEETS_OFF: '<g><path d="M3.707 21.707l18-18-1.414-1.414-2.088 2.088C17.688 4.137 17.11 4 16.5 4H11v2h5.5c.028 0 .056 0 .084.002l-10.88 10.88c-.131-.266-.204-.565-.204-.882V7.551l2.068 1.93 1.365-1.462L4.5 3.882.068 8.019l1.365 1.462 2.068-1.93V16c0 .871.278 1.677.751 2.334l-1.959 1.959 1.414 1.414zM18.5 9h2v7.449l2.068-1.93 1.365 1.462-4.433 4.137-4.432-4.137 1.365-1.462 2.067 1.93V9zm-8.964 9l-2 2H13v-2H9.536z"></path></g>',
  1767. TWITTER_HOME_ACTIVE_PATH: 'M12 1.696L.622 8.807l1.06 1.696L3 9.679V19.5C3 20.881 4.119 22 5.5 22h13c1.381 0 2.5-1.119 2.5-2.5V9.679l1.318.824 1.06-1.696L12 1.696zM12 16.5c-1.933 0-3.5-1.567-3.5-3.5s1.567-3.5 3.5-3.5 3.5 1.567 3.5 3.5-1.567 3.5-3.5 3.5z',
  1768. TWITTER_HOME_INACTIVE_PATH: 'M12 9c-2.209 0-4 1.791-4 4s1.791 4 4 4 4-1.791 4-4-1.791-4-4-4zm0 6c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2zm0-13.304L.622 8.807l1.06 1.696L3 9.679V19.5C3 20.881 4.119 22 5.5 22h13c1.381 0 2.5-1.119 2.5-2.5V9.679l1.318.824 1.06-1.696L12 1.696zM19 19.5c0 .276-.224.5-.5.5h-13c-.276 0-.5-.224-.5-.5V8.429l7-4.375 7 4.375V19.5z',
  1769. TWITTER_LOGO_PATH: 'M23.643 4.937c-.835.37-1.732.62-2.675.733.962-.576 1.7-1.49 2.048-2.578-.9.534-1.897.922-2.958 1.13-.85-.904-2.06-1.47-3.4-1.47-2.572 0-4.658 2.086-4.658 4.66 0 .364.042.718.12 1.06-3.873-.195-7.304-2.05-9.602-4.868-.4.69-.63 1.49-.63 2.342 0 1.616.823 3.043 2.072 3.878-.764-.025-1.482-.234-2.11-.583v.06c0 2.257 1.605 4.14 3.737 4.568-.392.106-.803.162-1.227.162-.3 0-.593-.028-.877-.082.593 1.85 2.313 3.198 4.352 3.234-1.595 1.25-3.604 1.995-5.786 1.995-.376 0-.747-.022-1.112-.065 2.062 1.323 4.51 2.093 7.14 2.093 8.57 0 13.255-7.098 13.255-13.254 0-.2-.005-.402-.014-.602.91-.658 1.7-1.477 2.323-2.41z',
  1770. X_HOME_ACTIVE_PATH: 'M21.591 7.146L12.52 1.157c-.316-.21-.724-.21-1.04 0l-9.071 5.99c-.26.173-.409.456-.409.757v13.183c0 .502.418.913.929.913H9.14c.51 0 .929-.41.929-.913v-7.075h3.909v7.075c0 .502.417.913.928.913h6.165c.511 0 .929-.41.929-.913V7.904c0-.301-.158-.584-.408-.758z',
  1771. X_HOME_INACTIVE_PATH: 'M21.591 7.146L12.52 1.157c-.316-.21-.724-.21-1.04 0l-9.071 5.99c-.26.173-.409.456-.409.757v13.183c0 .502.418.913.929.913h6.638c.511 0 .929-.41.929-.913v-7.075h3.008v7.075c0 .502.418.913.929.913h6.639c.51 0 .928-.41.928-.913V7.904c0-.301-.158-.584-.408-.758zM20 20l-4.5.01.011-7.097c0-.502-.418-.913-.928-.913H9.44c-.511 0-.929.41-.929.913L8.5 20H4V8.773l8.011-5.342L20 8.764z',
  1772. }
  1773.  
  1774. /** @enum {string} */
  1775. const Images = {
  1776. TWITTER_FAVICON: 'data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA0pJREFUWAntVk1oE1EQnnlJbFK3KUq9VJPYWgQVD/5QD0qpfweL1YJQoZAULBRPggp6kB78PQn14kHx0jRB0UO9REVFb1YqVBEsbZW2SbVS0B6apEnbbMbZ6qbZdTempqCHPAjvzcw3P5mdmfcAiquYgX+cAVwu/+5AdDMQnSPCHUhQA0hf+Rxy2OjicIvzm+qnKhito0qpb2wvJhWeJgCPP7oPELeHvdJ1VSGf3eOPnSWga0S0Qo9HxEkEusDBuNjbEca8G291nlBxmgDc/ukuIvAJxI6wr+yKCsq1ewLxQ2lZfpQLo8oQ4ZXdCkfnACrGWpyDCl+oQmVn5xuVPU102e2P3qoJkFOhzVb9S7KSnL5jJs/mI+As01PJFPSlZeFSZZoAGBRXBZyq9lk5NrC+e7pJ5en30c+JWk59pZ5vRDOuhAD381c/H/FKz1SMNgCE16rg505r5TT0uLqme93d0fbq+1SeLSeU83Ke0RHYFPGVPcjQfNDUwIa7M665+dQAEEjZoMwZMcEF9RxIDAgBQ2mCcqJ0Z0b+h4MNbZ4RnyOSDbNmE2iRk5jCNgIIckFoZAs4IgfLGrlKGjkzS16iwj6pV9I4mUvCPf73JVytH9nRJj24QHrqU8NCIWrMaGqAC+Ut/3ZzAS63cx4v2K/x/IvQBOCwWzu5KmJGwEJ5PIgeG9nQBDDcXPpFoDjJ7ThvBC6EZxXWkJG+JgAFwGM4KBAOcibeGCn8FQ/hyajXPmSk+1sACogn4hYk7OdiHDFSWipPkPWSmY6mCzIghEEuxJvcEYUvxIdhX2mvmSHDDPBF9AJRnDZTyp+P40671JYLbxiAohDxSTfQIg4oNxgPzCWPHaWQBViOf2jGqVwBaEaxGbAqOFMrp+SefC8eNhoFIY5lXzpmtnMGUB2IbU3JdIqVW9m5zcxINn/hAYKiIexdaTh4srHKORMAP0b28PNgJyGt5gvHzQVYx91QpVcwpRFl/p63HSR1DLbid1OcTpAJQOG7u+KH+aI5Qwj13IsamU5vkUSIc8uGLDa8OtoivV8U5HcydFLtT7hlSDVy2nfxI2Ibg9awuVU8IeJAOMF5m2B6jFs1tM5R9rS3GRP5uSuiihn4DzPwA7z7GDH+43gqAAAAAElFTkSuQmCC',
  1777. TWITTER_PIP_FAVICON: 'data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALASURBVHgB7VZNchJBFP5eM9FoRWV2WiZmbmBuIJ4g5ASBRWJlRXIC4ASQVUqxCo4QTwDegJzAiYlFXM1YZWmVQD9fQ6YyAwMMGBZW8i2G6e7He1+/3wHuOih4+fWieJhiKsirA0ZbE44fXZUaWDIGBH4/L+UUUB897DMfPf5ermKJUOaRIhTiDlNEBSwZlnkwY2vCuYOEWD/xMrCoKC41utISRlcc3Or2dfnqwHbDcj9X0fbztn9DAHxOoM0xrZILSIBXtR9F0VGKbJIhz7kVi3Lr770yAz4p2iYm188/awVi6lo4Ns4mETEDLz94uTHjIxDDRaWoohhOSjwi/9mKEFjtlKsayAuRM7M2HmFJwCRVIIqLSAAJjS822v0Vaip1E1oKC6XrXtrExjnxnJ6ldoVKFj0+ujywW3FKTTzJoibmAXP+Yt9uBEsrfLbWRelJzS/0B8z4WoKa6zW/1dd83Hlnn0Z0peAQkqNHvNPZi+qIELBWUNU97LLJ4hDESMZSlNmo+b5UTEvC85m0JCipTQREE+BhdzypIwSkLvyn4LKYrEzQkSZCloiyw+xJbnygfxX+VAJrPWnBoC9ixBXdDm4XflD7YajIinFq3L0E45J7fBa3HyEg7mhgeWjPJODu223J/iMsATzhcmp04+ueXTW1OsiD2zIuVfNNLockBAyIkdaaPxHGs3YR0JTQWnGbWkFCQZX5imwCmBoX++nGpONYD1zu2S0a9IN/g3jSNcNnqsy0ww2ZdPJzCKLXWAAy1N6ay2BRAgEcGZ+aqDnaoqdbjw6dhQgYwz1S2xKOQyQ0Phy7vDPr5iH5ITY+elmtpddLFyQzZBTP3xGl3FJ95NzQJ1hiAgMSw5jnJOZvMA/EMBNKSW89kUAAp+45+g+yojRjljL9NoP4GxdLYzk334vy3lYP0HBjhsw97vHf4C/b8RLHAOr+CQAAAABJRU5ErkJggg==',
  1778. }
  1779.  
  1780. const THEME_BLUE = 'rgb(29, 155, 240)'
  1781. const THEME_COLORS = new Map([
  1782. ['blue500', THEME_BLUE],
  1783. ['yellow500', 'rgb(255, 212, 0)'],
  1784. ['magenta500', 'rgb(249, 24, 128)'],
  1785. ['purple500', 'rgb(120, 86, 255)'],
  1786. ['orange500', 'rgb(255, 122, 0)'],
  1787. ['green500', 'rgb(0, 186, 124)'],
  1788. ])
  1789. const HIGH_CONTRAST_LIGHT = new Map([
  1790. ['blue500', 'rgb(0, 56, 134)'],
  1791. ['yellow500', 'rgb(111, 62, 0)'],
  1792. ['magenta500', 'rgb(137, 10, 70)'],
  1793. ['purple500', 'rgb(82, 52, 183)'],
  1794. ['orange500', 'rgb(137, 43, 0)'],
  1795. ['green500', 'rgb(0, 97, 61)'],
  1796. ])
  1797. const HIGH_CONTRAST_DARK = new Map([
  1798. ['blue500', 'rgb(107, 201, 251)'],
  1799. ['yellow500', 'rgb(255, 235, 107)'],
  1800. ['magenta500', 'rgb(251, 112, 176)'],
  1801. ['purple500', 'rgb(172, 151, 255)'],
  1802. ['orange500', 'rgb(255, 173, 97)'],
  1803. ['green500', 'rgb(97, 214, 163)'],
  1804. ])
  1805. // <body> pseudo-selector for pages the full-width content feature works on
  1806. const FULL_WIDTH_BODY_PSEUDO = ':is(.Community, .List, .HomeTimeline)'
  1807. // Matches any notification count at the start of the title
  1808. const TITLE_NOTIFICATION_RE = /^\(\d+\+?\) /
  1809. // The Communities nav item takes you to /yourusername/communities
  1810. const URL_COMMUNITIES_RE = /^\/[a-zA-Z\d_]{1,20}\/communities\/?$/
  1811. const URL_COMMUNITY_RE = /^\/i\/communities\/\d+(?:\/about)?\/?$/
  1812. const URL_COMMUNITY_MEMBERS_RE = /^\/i\/communities\/\d+\/(?:members|moderators)\/?$/
  1813. const URL_DISCOVER_COMMUNITIES_RE = /^\/i\/communities\/suggested\/?/
  1814. const URL_LIST_RE = /\/i\/lists\/\d+\/?$/
  1815. const URL_MEDIA_RE = /\/(?:photo|video)\/\d\/?$/
  1816. const URL_MEDIAVIEWER_RE = /^\/[a-zA-Z\d_]{1,20}\/status\/\d+\/mediaviewer$/i
  1817. // Matches URLs which show one of the tabs on a user profile page
  1818. const URL_PROFILE_RE = /^\/([a-zA-Z\d_]{1,20})(?:\/(affiliates|with_replies|superfollows|highlights|articles|media|likes))?\/?$/
  1819. // Matches URLs which show a user's Followers you know / Followers / Following tab
  1820. const URL_PROFILE_FOLLOWS_RE = /^\/[a-zA-Z\d_]{1,20}\/(?:verified_followers|follow(?:ing|ers|ers_you_follow)|creator-subscriptions\/subscriptions)\/?$/
  1821. const URL_TWEET_RE = /^\/([a-zA-Z\d_]{1,20})\/status\/(\d+)\/?$/
  1822. const URL_TWEET_ENGAGEMENT_RE = /^\/[a-zA-Z\d_]{1,20}\/status\/\d+\/(quotes|retweets|reposts|likes)\/?$/
  1823.  
  1824. // The Twitter Media Assist exension adds a new button at the end of the action
  1825. // bar (#346)
  1826. const TWITTER_MEDIA_ASSIST_BUTTON_SELECTOR = '.tva-download-icon, .tva-modal-download-icon'
  1827. //#endregion
  1828.  
  1829. //#region Variables
  1830. /**
  1831. * The quoted Tweet associated with a caret menu that's just been opened.
  1832. * @type {import("./types").QuotedTweet}
  1833. */
  1834. let quotedTweet = null
  1835.  
  1836. /** `true` when a 'Block @${user}' menu item was seen in the last popup. */
  1837. let blockMenuItemSeen = false
  1838.  
  1839. /** `true` if we're opening the Sort replies menu to change settings. */
  1840. let changingSortReplies = false
  1841.  
  1842. /** Notification count in the title (including trailing space), e.g. `'(1) '`. */
  1843. let currentNotificationCount = ''
  1844.  
  1845. /** Title of the current page, without the `' / Twitter'` suffix. */
  1846. let currentPage = ''
  1847.  
  1848. /** Current `location.pathname`. */
  1849. let currentPath = ''
  1850.  
  1851. /**
  1852. * React Native stylesheet rule for the blur filter for sensitive content.
  1853. * @type {CSSStyleRule}
  1854. */
  1855. let filterBlurRule = null
  1856.  
  1857. /**
  1858. * React Native stylesheett rule for the Chirp font-family.
  1859. * @type {CSSStyleRule}
  1860. */
  1861. let fontFamilyRule = null
  1862.  
  1863. /** @type {string} */
  1864. let fontSize = null
  1865.  
  1866. /** Set to `true` when a Home/Following heading or Home nav link is used. */
  1867. let homeNavigationIsBeingUsed = false
  1868.  
  1869. /** Set to `true` when the media modal is open on desktop. */
  1870. let isDesktopMediaModalOpen = false
  1871.  
  1872. /** Set to `true` when the compose tweet modal is open on desktop. */
  1873. let isDesktopComposeTweetModalOpen = false
  1874.  
  1875. /**
  1876. * Cache for the last page title which was used for the Home timeline.
  1877. * @type {string}
  1878. */
  1879. let lastHomeTimelineTitle = null
  1880.  
  1881. /**
  1882. * MutationObservers active on the current modal.
  1883. * @type {import("./types").Disconnectable[]}
  1884. */
  1885. let modalObservers = []
  1886.  
  1887. /**
  1888. * `true` after the app has initialised.
  1889. * @type {boolean}
  1890. */
  1891. let observingPageChanges = false
  1892.  
  1893. /**
  1894. * MutationObservers active on the current page, or anything else we want to
  1895. * clean up when the user moves off the current page.
  1896. * @type {import("./types").NamedMutationObserver[]}
  1897. */
  1898. let pageObservers = []
  1899.  
  1900. /** `true` when a 'Pin to your profile' menu item was seen in the last popup. */
  1901. let pinMenuItemSeen = false
  1902.  
  1903. /** @type {number} */
  1904. let selectedHomeTabIndex = -1
  1905.  
  1906. /**
  1907. * Title for the fake timeline used to separate out retweets and quote tweets.
  1908. * @type {string}
  1909. */
  1910. let separatedTweetsTimelineTitle = null
  1911.  
  1912. /**
  1913. * The current "Color" setting.
  1914. * @type {string}
  1915. */
  1916. let themeColor = THEME_BLUE
  1917.  
  1918. /**
  1919. * Tab to switch to after navigating to the Tweet interactions page.
  1920. * @type {string}
  1921. */
  1922. let tweetInteractionsTab = null
  1923.  
  1924. /**
  1925. * `true` when "For you" was the last tab selected on the Home timeline.
  1926. */
  1927. let wasForYouTabSelected = false
  1928.  
  1929. function isOnAccessibilitySettingsPage() {
  1930. return currentPath == PagePaths.ACCESSIBILITY_SETTINGS
  1931. }
  1932.  
  1933. function isOnBookmarksPage() {
  1934. return currentPath.startsWith(PagePaths.BOOKMARKS)
  1935. }
  1936.  
  1937. function isOnCommunitiesPage() {
  1938. return URL_COMMUNITIES_RE.test(currentPath)
  1939. }
  1940.  
  1941. function isOnCommunityPage() {
  1942. return URL_COMMUNITY_RE.test(currentPath)
  1943. }
  1944.  
  1945. function isOnCommunityMembersPage() {
  1946. return URL_COMMUNITY_MEMBERS_RE.test(currentPath)
  1947. }
  1948.  
  1949. function isOnDiscoverCommunitiesPage() {
  1950. return URL_DISCOVER_COMMUNITIES_RE.test(currentPath)
  1951. }
  1952.  
  1953. function isOnDisplaySettingsPage() {
  1954. return currentPath == PagePaths.DISPLAY_SETTINGS
  1955. }
  1956.  
  1957. function isOnExplorePage() {
  1958. return currentPath == '/explore' || currentPath.startsWith('/explore/')
  1959. }
  1960.  
  1961. function isOnFollowListPage() {
  1962. return URL_PROFILE_FOLLOWS_RE.test(currentPath)
  1963. }
  1964.  
  1965. function isOnIndividualTweetPage() {
  1966. return URL_TWEET_RE.test(currentPath)
  1967. }
  1968.  
  1969. function isOnListPage() {
  1970. return URL_LIST_RE.test(currentPath)
  1971. }
  1972.  
  1973. function isOnHomeTimelinePage() {
  1974. return currentPath == PagePaths.HOME
  1975. }
  1976.  
  1977. function isOnMessagesPage() {
  1978. return currentPath.startsWith('/messages')
  1979. }
  1980.  
  1981. function isOnNotificationsPage() {
  1982. return currentPath.startsWith('/notifications')
  1983. }
  1984.  
  1985. function isOnProfilePage() {
  1986. let profilePathUsername = currentPath.match(URL_PROFILE_RE)?.[1]
  1987. if (!profilePathUsername) return false
  1988. // twitter.com/user and its sub-URLs put @user in the title
  1989. return currentPage.toLowerCase().includes(`${ltr ? '@' : ''}${profilePathUsername.toLowerCase()}${!ltr ? '@' : ''}`)
  1990. }
  1991.  
  1992. function isOnQuoteTweetsPage() {
  1993. let match = currentPath.match(URL_TWEET_ENGAGEMENT_RE)
  1994. return match?.[1] == 'quotes'
  1995. }
  1996.  
  1997. function isOnSearchPage() {
  1998. return currentPath.startsWith('/search') || currentPath.startsWith('/hashtag/')
  1999. }
  2000.  
  2001. function isOnSeparatedTweetsTimeline() {
  2002. return currentPage == separatedTweetsTimelineTitle
  2003. }
  2004.  
  2005. function isOnSettingsPage() {
  2006. return currentPath.startsWith('/settings')
  2007. }
  2008.  
  2009. function shouldHideSidebar() {
  2010. return isOnExplorePage() || isOnDiscoverCommunitiesPage()
  2011. }
  2012.  
  2013. function shouldShowSeparatedTweetsTab() {
  2014. return config.retweets == 'separate' || config.quoteTweets == 'separate'
  2015. }
  2016. //#endregion
  2017.  
  2018. //#region Utility functions
  2019. /**
  2020. * @param {string} role
  2021. * @return {HTMLStyleElement}
  2022. */
  2023. function addStyle(role) {
  2024. let $style = document.createElement('style')
  2025. $style.dataset.insertedBy = 'control-panel-for-twitter'
  2026. $style.dataset.role = role
  2027. document.head.appendChild($style)
  2028. return $style
  2029. }
  2030.  
  2031. /**
  2032. * @param {Element} $svg
  2033. */
  2034. function blueCheck($svg) {
  2035. if (!$svg) {
  2036. warn('blueCheck was given', $svg)
  2037. return
  2038. }
  2039. $svg.classList.add('tnt_blue_check')
  2040. // Safari doesn't support using `d: path(…)` to replace paths in an SVG, so
  2041. // we have to manually patch the path in it.
  2042. if (isSafari && config.twitterBlueChecks == 'replace') {
  2043. $svg.firstElementChild.firstElementChild.setAttribute('d', Svgs.BLUE_LOGO_PATH)
  2044. }
  2045. }
  2046.  
  2047. /**
  2048. * @param {Element} $svgPath
  2049. */
  2050. function twitterLogo($svgPath) {
  2051. // Safari doesn't support using `d: path(…)` to replace paths in an SVG, so
  2052. // we have to manually patch the path in it.
  2053. $svgPath.setAttribute('d', Svgs.TWITTER_LOGO_PATH)
  2054. $svgPath.classList.add('tnt_logo')
  2055. }
  2056.  
  2057. /**
  2058. * @param {Element} $svgPath
  2059. */
  2060. function homeIcon($svgPath) {
  2061. // Safari doesn't support using `d: path(…)` to replace paths in an SVG, so
  2062. // we have to manually patch the path in it.
  2063. let replacementPath = {
  2064. [Svgs.X_HOME_ACTIVE_PATH]: Svgs.TWITTER_HOME_ACTIVE_PATH,
  2065. [Svgs.X_HOME_INACTIVE_PATH]: Svgs.TWITTER_HOME_INACTIVE_PATH,
  2066. }[$svgPath.getAttribute('d')]
  2067. if (replacementPath) {
  2068. $svgPath.setAttribute('d', replacementPath)
  2069. }
  2070. }
  2071.  
  2072. /**
  2073. * @param {string} str
  2074. * @return {string}
  2075. */
  2076. function dedent(str) {
  2077. str = str.replace(/^[ \t]*\r?\n/, '')
  2078. let indent = /^[ \t]+/m.exec(str)
  2079. if (indent) str = str.replace(new RegExp('^' + indent[0], 'gm'), '')
  2080. return str.replace(/(\r?\n)[ \t]+$/, '$1')
  2081. }
  2082.  
  2083. /**
  2084. * @param {string} name
  2085. * @param {import("./types").Disconnectable[]} observers
  2086. */
  2087. function disconnectObserver(name, observers) {
  2088. for (let i = observers.length -1; i >= 0; i--) {
  2089. let observer = observers[i]
  2090. if ('name' in observer && observer.name == name) {
  2091. observer.disconnect()
  2092. observers.splice(i, 1)
  2093. log(`disconnected ${name} ${observers === pageObservers ? 'page' : 'modal'} observer`)
  2094. }
  2095. }
  2096. }
  2097.  
  2098. function disconnectModalObserver(name) {
  2099. disconnectObserver(name, modalObservers)
  2100. }
  2101.  
  2102. function disconnectAllModalObservers() {
  2103. if (modalObservers.length > 0) {
  2104. log(
  2105. `disconnecting ${modalObservers.length} modal observer${s(modalObservers.length)}`,
  2106. modalObservers.map(observer => observer['name'])
  2107. )
  2108. modalObservers.forEach(observer => observer.disconnect())
  2109. modalObservers = []
  2110. }
  2111. }
  2112.  
  2113. function disconnectPageObserver(name) {
  2114. disconnectObserver(name, pageObservers)
  2115. }
  2116.  
  2117. /**
  2118. * @param {MutationRecord[]} mutations
  2119. * @param {($el: Node) => boolean | HTMLElement} fn - return `true` to use [$el]
  2120. * as the result, or return a different HTMLElement to use it as the result.
  2121. * @returns {Node | HTMLElement | null}
  2122. */
  2123. function findAddedNode(mutations, fn) {
  2124. for (let mutation of mutations) {
  2125. for (let el of mutation.addedNodes) {
  2126. let result = fn(el)
  2127. if (result) {
  2128. return result === true ? el : result
  2129. }
  2130. }
  2131. }
  2132. return null
  2133. }
  2134.  
  2135. /**
  2136. * @param {string} selector
  2137. * @param {{
  2138. * name?: string
  2139. * stopIf?: () => boolean
  2140. * timeout?: number
  2141. * context?: Document | HTMLElement
  2142. * }?} options
  2143. * @returns {Promise<HTMLElement | null>}
  2144. */
  2145. function getElement(selector, {
  2146. name = null,
  2147. stopIf = null,
  2148. timeout = Infinity,
  2149. context = document,
  2150. } = {}) {
  2151. return new Promise((resolve) => {
  2152. let startTime = Date.now()
  2153. let rafId
  2154. let timeoutId
  2155.  
  2156. function stop($element, reason) {
  2157. if ($element == null) {
  2158. warn(`stopped waiting for ${name || selector} after ${reason}`)
  2159. }
  2160. else if (Date.now() > startTime) {
  2161. log(`${name || selector} appeared after ${Date.now() - startTime}ms`)
  2162. }
  2163. if (rafId) {
  2164. cancelAnimationFrame(rafId)
  2165. }
  2166. if (timeoutId) {
  2167. clearTimeout(timeoutId)
  2168. }
  2169. resolve($element)
  2170. }
  2171.  
  2172. if (timeout !== Infinity) {
  2173. timeoutId = setTimeout(stop, timeout, null, `${timeout}ms timeout`)
  2174. }
  2175.  
  2176. function queryElement() {
  2177. let $element = context.querySelector(selector)
  2178. if ($element) {
  2179. stop($element)
  2180. }
  2181. else if (stopIf?.() === true) {
  2182. stop(null, 'stopIf condition met')
  2183. }
  2184. else {
  2185. rafId = requestAnimationFrame(queryElement)
  2186. }
  2187. }
  2188.  
  2189. queryElement()
  2190. })
  2191. }
  2192.  
  2193. function getState() {
  2194. let wrapped = $reactRoot.firstElementChild.wrappedJSObject || $reactRoot.firstElementChild
  2195. let reactPropsKey = Object.keys(wrapped).find(key => key.startsWith('__reactProps'))
  2196. if (reactPropsKey) {
  2197. let state = wrapped[reactPropsKey].children?.props?.children?.props?.store?.getState()
  2198. if (state) return state
  2199. warn('React state not found')
  2200. } else {
  2201. warn('React prop key not found')
  2202. }
  2203. }
  2204.  
  2205. function getStateEntities() {
  2206. let state = getState()
  2207. if (state) {
  2208. if (state.entities) return state.entities
  2209. warn('React state entities not found')
  2210. }
  2211. }
  2212.  
  2213. function getThemeColorFromState() {
  2214. let localState = getState().settings?.local
  2215. let color = localState?.themeColor
  2216. let highContrast = localState?.highContrastEnabled
  2217. $body.classList.toggle('HighContrast', highContrast)
  2218. if (color) {
  2219. if (THEME_COLORS.has(color)) {
  2220. let colors = THEME_COLORS
  2221. if (highContrast) colors = getColorScheme() == 'Default' ? HIGH_CONTRAST_LIGHT : HIGH_CONTRAST_DARK
  2222. return colors.get(color)
  2223. }
  2224. warn(color, 'not found in THEME_COLORS')
  2225. } else {
  2226. warn('could not get settings.local.themeColor from React state')
  2227. }
  2228. }
  2229.  
  2230. /**
  2231. * Gets cached tweet info from React state.
  2232. */
  2233. function getTweetInfo(id) {
  2234. let tweetEntities = getStateEntities()?.tweets?.entities
  2235. if (tweetEntities) {
  2236. let tweetInfo = tweetEntities[id]
  2237. if (!tweetInfo) {
  2238. warn('tweet info not found')
  2239. }
  2240. return tweetInfo
  2241. } else {
  2242. warn('tweet entities not found')
  2243. }
  2244. }
  2245.  
  2246. /**
  2247. * Gets cached user info from React state.
  2248. * @returns {import("./types").UserInfoObject}
  2249. */
  2250. function getUserInfo() {
  2251. /** @type {import("./types").UserInfoObject} */
  2252. let userInfo = {}
  2253. let userEntities = getStateEntities()?.users?.entities
  2254. if (userEntities) {
  2255. for (let user of Object.values(userEntities)) {
  2256. userInfo[user.screen_name] = {
  2257. following: user.following,
  2258. followedBy: user.followed_by,
  2259. followersCount: user.followers_count,
  2260. }
  2261. }
  2262. } else {
  2263. warn('user entities not found')
  2264. }
  2265. return userInfo
  2266. }
  2267.  
  2268. /**
  2269. * @param {import("./types").Disconnectable[]} observers
  2270. * @param {string} name
  2271. */
  2272. function isObserving(observers, name) {
  2273. return observers.some(observer => 'name' in observer && observer.name == name)
  2274. }
  2275.  
  2276. function log(...args) {
  2277. if (debug) {
  2278. let page = currentPage?.replace(/(\r?\n)+/g, ' ')
  2279. console.log(`${page ? `(${
  2280. page.length < 42 ? page : page.slice(0, 42) + '…'
  2281. })` : ''}`, ...args)
  2282. }
  2283. }
  2284.  
  2285. function warn(...args) {
  2286. if (debug) {
  2287. console.log(`❗ ${currentPage ? `(${currentPage})` : ''}`, ...args)
  2288. }
  2289. }
  2290.  
  2291. function error(...args) {
  2292. console.log(`❌ ${currentPage ? `(${currentPage})` : ''}`, ...args)
  2293. }
  2294.  
  2295. /**
  2296. * @param {() => boolean} condition
  2297. * @returns {() => boolean}
  2298. */
  2299. function not(condition) {
  2300. return () => !condition()
  2301. }
  2302.  
  2303. /**
  2304. * Convenience wrapper for the MutationObserver API - the callback is called
  2305. * immediately to support using an observer and its options as a trigger for any
  2306. * change, without looking at MutationRecords.
  2307. * @param {Node} $element
  2308. * @param {MutationCallback} callback
  2309. * @param {string} name
  2310. * @param {MutationObserverInit} options
  2311. * @return {import("./types").NamedMutationObserver}
  2312. */
  2313. function observeElement($element, callback, name, options = {childList: true}) {
  2314. if (name) {
  2315. if (options.childList && callback.length > 0) {
  2316. log(`observing ${name}`, $element)
  2317. } else {
  2318. log (`observing ${name}`)
  2319. }
  2320. }
  2321.  
  2322. let observer = new MutationObserver(callback)
  2323. callback([], observer)
  2324. observer.observe($element, options)
  2325. observer['name'] = name
  2326. return observer
  2327. }
  2328.  
  2329. /**
  2330. * @param {string} page
  2331. * @returns {() => boolean}
  2332. */
  2333. function pageIsNot(page) {
  2334. return function() {
  2335. let pageChanged = page != currentPage
  2336. if (pageChanged) {
  2337. log('pageIsNot', {page, currentPage})
  2338. }
  2339. return pageChanged
  2340. }
  2341. }
  2342.  
  2343. /**
  2344. * @param {string} path
  2345. * @returns {() => boolean}
  2346. */
  2347. function pathIsNot(path) {
  2348. return () => path != currentPath
  2349. }
  2350.  
  2351. /**
  2352. * @param {number} n
  2353. * @returns {string}
  2354. */
  2355. function s(n) {
  2356. return n == 1 ? '' : 's'
  2357. }
  2358.  
  2359. /**
  2360. * @param {Element} $tweetButtonText
  2361. */
  2362. function setTweetButtonText($tweetButtonText) {
  2363. let currentText = $tweetButtonText.textContent
  2364. if (currentText == getString('TWEET') || currentText == getString('TWEET_ALL')) return
  2365. $tweetButtonText.textContent = currentText == getString('POST_ALL') ? getString('TWEET_ALL') : getString('TWEET')
  2366. }
  2367.  
  2368. function storeConfigChanges(changes) {
  2369. window.postMessage({type: 'tntConfigChange', changes})
  2370. }
  2371. //#endregion
  2372.  
  2373. //#region Global observers
  2374. const checkReactNativeStylesheet = (() => {
  2375. /** @type {number} */
  2376. let startTime
  2377.  
  2378. return function checkReactNativeStylesheet() {
  2379. startTime ??= Date.now()
  2380.  
  2381. let $style = /** @type {HTMLStyleElement} */ (document.querySelector('style#react-native-stylesheet'))
  2382. if (!$style) {
  2383. warn('React Native stylesheet not found')
  2384. return
  2385. }
  2386.  
  2387. for (let rule of $style.sheet.cssRules) {
  2388. if (!(rule instanceof CSSStyleRule)) continue
  2389.  
  2390. if (fontFamilyRule == null &&
  2391. rule.style.fontFamily?.includes('TwitterChirp') &&
  2392. !rule.style.fontFamily.includes('TwitterChirpExtendedHeavy')) {
  2393. fontFamilyRule = rule
  2394. log('found Chirp fontFamily CSS rule in React Native stylesheet')
  2395. configureFont()
  2396. }
  2397.  
  2398. if (filterBlurRule == null && rule.style.filter?.includes('blur(30px)')) {
  2399. filterBlurRule = rule
  2400. log('found filter: blur(30px) rule in React Native stylesheet', filterBlurRule)
  2401. configureDynamicCss()
  2402. }
  2403. }
  2404.  
  2405. let elapsedTime = Date.now() - startTime
  2406. if (fontFamilyRule == null || filterBlurRule == null) {
  2407. if (elapsedTime < 3000) {
  2408. setTimeout(checkReactNativeStylesheet, 100)
  2409. } else {
  2410. warn(`stopped checking React Native stylesheet after ${elapsedTime}ms`)
  2411. }
  2412. } else {
  2413. log(`finished checking React Native stylesheet in ${elapsedTime}ms`)
  2414. }
  2415. }
  2416. })()
  2417.  
  2418. /**
  2419. * When the "Background" setting is changed, <body>'s backgroundColor is changed
  2420. * and the app is re-rendered, so we need to re-process the current page.
  2421. */
  2422. function observeBodyBackgroundColor() {
  2423. let lastBackgroundColor = null
  2424.  
  2425. observeElement($body, () => {
  2426. let backgroundColor = $body.style.backgroundColor
  2427. if (backgroundColor == lastBackgroundColor) return
  2428.  
  2429. $body.classList.toggle('Default', backgroundColor == 'rgb(255, 255, 255)')
  2430. $body.classList.toggle('Dim', backgroundColor == 'rgb(21, 32, 43)')
  2431. $body.classList.toggle('LightsOut', backgroundColor == 'rgb(0, 0, 0)')
  2432.  
  2433. if (lastBackgroundColor != null) {
  2434. log('Background setting changed - re-processing current page')
  2435. observePopups()
  2436. observeSideNavTweetButton()
  2437. processCurrentPage()
  2438. }
  2439. lastBackgroundColor = backgroundColor
  2440. }, '<body> style attribute for background colour changes', {
  2441. attributes: true,
  2442. attributeFilter: ['style']
  2443. })
  2444. }
  2445.  
  2446. async function observeDesktopComposeTweetModal($popup) {
  2447. let $modalDialog = await getElement('div[role="dialog"][aria-labelledby]', {
  2448. context: $popup,
  2449. stopIf: () => !isDesktopComposeTweetModalOpen
  2450. })
  2451. if (!$modalDialog) return
  2452.  
  2453. /** @type {import("./types").Disconnectable} */
  2454. let tweetButtonObserver
  2455.  
  2456. function disconnectTweetButtonObserver() {
  2457. if (tweetButtonObserver) {
  2458. log('disconnecting tweet button dialog observer')
  2459. tweetButtonObserver.disconnect()
  2460. modalObservers.splice(modalObservers.indexOf(tweetButtonObserver), 1)
  2461. tweetButtonObserver = null
  2462. }
  2463. }
  2464.  
  2465. let waitingForTweetButton = false
  2466.  
  2467. modalObservers.push(
  2468. observeElement($modalDialog, async () => {
  2469. if (waitingForTweetButton) return
  2470.  
  2471. waitingForTweetButton = true
  2472. let $tweetButtonText = await getElement('button[data-testid="tweetButton"] span > span', {
  2473. context: $modalDialog,
  2474. name: 'tweet button',
  2475. timeout: 500,
  2476. })
  2477. waitingForTweetButton = false
  2478.  
  2479. if (!$tweetButtonText) {
  2480. disconnectTweetButtonObserver()
  2481. return
  2482. }
  2483.  
  2484. setTweetButtonText($tweetButtonText)
  2485.  
  2486. // The button will be moved around when multiple Tweets are being edited
  2487. tweetButtonObserver = observeElement($modalDialog, (mutations) => {
  2488. for (let mutation of mutations) {
  2489. for (let $addedNode of mutation.addedNodes) {
  2490. let $tweetButtonText = $addedNode.querySelector?.('button[data-testid="tweetButton"] span > span')
  2491. if ($tweetButtonText) {
  2492. setTweetButtonText($tweetButtonText)
  2493. }
  2494. }
  2495. }
  2496. }, 'tweet button dialog', {childList: true, subtree: true})
  2497. modalObservers.push(tweetButtonObserver)
  2498. }, 'compose tweet modal dialog')
  2499. )
  2500. }
  2501.  
  2502. /**
  2503. * @param {HTMLElement} $popup
  2504. */
  2505. async function observeDesktopModalTimeline($popup) {
  2506. // Media modals remember if they were previously collapsed, so we could be
  2507. // waiting for the initial timeline to be either rendered or expanded.
  2508. let $initialTimeline = await getElement(Selectors.MODAL_TIMELINE, {
  2509. context: $popup,
  2510. name: 'initial modal timeline',
  2511. stopIf: () => !isDesktopMediaModalOpen,
  2512. })
  2513.  
  2514. if ($initialTimeline == null) return
  2515.  
  2516. /**
  2517. * @param {HTMLElement} $timeline
  2518. */
  2519. function observeModalTimelineItems($timeline) {
  2520. disconnectModalObserver('modal timeline')
  2521. modalObservers.push(
  2522. observeElement($timeline, () => onIndividualTweetTimelineChange($timeline, {observers: modalObservers}), 'modal timeline')
  2523. )
  2524. setDefaultSortReplies()
  2525.  
  2526. // If other media in the modal is clicked, the timeline is replaced.
  2527. disconnectModalObserver('modal timeline parent')
  2528. modalObservers.push(
  2529. observeElement($timeline.parentElement, (mutations) => {
  2530. mutations.forEach((mutation) => {
  2531. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $newTimeline) => {
  2532. log('modal timeline replaced')
  2533. disconnectModalObserver('modal timeline')
  2534. modalObservers.push(
  2535. observeElement($newTimeline, () => onIndividualTweetTimelineChange($newTimeline, {observers: modalObservers}), 'modal timeline')
  2536. )
  2537. setDefaultSortReplies()
  2538. })
  2539. })
  2540. }, 'modal timeline parent')
  2541. )
  2542. }
  2543.  
  2544. /**
  2545. * @param {HTMLElement} $timeline
  2546. */
  2547. function observeModalTimeline($timeline) {
  2548. // If the inital timeline doesn't have a style attribute it's a placeholder
  2549. if ($timeline.hasAttribute('style')) {
  2550. observeModalTimelineItems($timeline)
  2551. }
  2552. else {
  2553. log('waiting for modal timeline')
  2554. let startTime = Date.now()
  2555. modalObservers.push(
  2556. observeElement($timeline.parentElement, (mutations) => {
  2557. mutations.forEach((mutation) => {
  2558. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $timeline) => {
  2559. disconnectModalObserver('modal timeline parent')
  2560. if (Date.now() > startTime) {
  2561. log(`modal timeline appeared after ${Date.now() - startTime}ms`, $timeline)
  2562. }
  2563. observeModalTimelineItems($timeline)
  2564. })
  2565. })
  2566. }, 'modal timeline parent')
  2567. )
  2568. }
  2569. }
  2570.  
  2571. // The modal timeline can be expanded and collapsed
  2572. let $expandedContainer = $initialTimeline.closest('[aria-expanded="true"]')
  2573. modalObservers.push(
  2574. observeElement($expandedContainer.parentElement, async (mutations) => {
  2575. if (mutations.some(mutation => mutation.removedNodes.length > 0)) {
  2576. log('modal timeline collapsed')
  2577. disconnectModalObserver('modal timeline parent')
  2578. disconnectModalObserver('modal timeline')
  2579. }
  2580. else if (mutations.some(mutation => mutation.addedNodes.length > 0)) {
  2581. log('modal timeline expanded')
  2582. let $timeline = await getElement(Selectors.MODAL_TIMELINE, {
  2583. context: $popup,
  2584. name: 'expanded modal timeline',
  2585. stopIf: () => !isDesktopMediaModalOpen,
  2586. })
  2587. if ($timeline == null) return
  2588. observeModalTimeline($timeline)
  2589. }
  2590. }, 'collapsible modal timeline container')
  2591. )
  2592.  
  2593. observeModalTimeline($initialTimeline)
  2594. }
  2595.  
  2596. const observeFavicon = (() => {
  2597. /** @type {HTMLElement} */
  2598. let $shortcutIcon
  2599. /** @type {MutationObserver} */
  2600. let shortcutIconObserver
  2601.  
  2602. async function observeFavicon() {
  2603. $shortcutIcon ??= await getElement('link[rel="shortcut icon"]', {name: 'shortcut icon'})
  2604.  
  2605. if (!config.replaceLogo) {
  2606. if (shortcutIconObserver != null) {
  2607. shortcutIconObserver.disconnect()
  2608. shortcutIconObserver = null
  2609. if ($shortcutIcon.getAttribute('href').startsWith('data:')) {
  2610. $shortcutIcon.setAttribute('href', `//abs.twimg.com/favicons/twitter${currentNotificationCount ? '-pip' : ''}.3.ico`)
  2611. }
  2612. }
  2613. return
  2614. }
  2615.  
  2616. shortcutIconObserver = observeElement($shortcutIcon, () => {
  2617. let href = $shortcutIcon.getAttribute('href')
  2618. if (href.startsWith('data:')) return
  2619. $shortcutIcon.setAttribute('href', href.includes('pip') ? Images.TWITTER_PIP_FAVICON : Images.TWITTER_FAVICON)
  2620. }, 'shortcut icon href', {
  2621. attributes: true,
  2622. attributeFilter: ['href']
  2623. })
  2624. }
  2625.  
  2626. observeFavicon.updatePip = function(showPip) {
  2627. if (!$shortcutIcon) return
  2628. let icon = showPip ? Images.TWITTER_PIP_FAVICON : Images.TWITTER_FAVICON
  2629. if ($shortcutIcon.getAttribute('href') != icon) {
  2630. $shortcutIcon.setAttribute('href', icon)
  2631. }
  2632. }
  2633.  
  2634. return observeFavicon
  2635. })()
  2636.  
  2637. /**
  2638. * Twitter displays popups in the #layers element. It also reuses open popups
  2639. * in certain cases rather than creating one from scratch, so we also need to
  2640. * deal with nested popups, e.g. if you hover over the caret menu in a Tweet, a
  2641. * popup will be created to display a "More" tootip and clicking to open the
  2642. * menu will create a nested element in the existing popup, whereas clicking the
  2643. * caret quickly without hovering over it will display the menu in new popup.
  2644. * Use of nested popups can also differ between desktop and mobile, so features
  2645. * need to be mindful of that.
  2646. */
  2647. const observePopups = (() => {
  2648. /** @type {MutationObserver} */
  2649. let popupObserver
  2650. /** @type {WeakMap<HTMLElement, {disconnect()}>} */
  2651. let nestedObservers = new WeakMap()
  2652.  
  2653. return async function observePopups() {
  2654. if (popupObserver) {
  2655. popupObserver.disconnect()
  2656. popupObserver = null
  2657. }
  2658.  
  2659. let $layers = await getElement('#layers', {
  2660. name: 'layers',
  2661. })
  2662.  
  2663. // There can be only one
  2664. if (popupObserver) {
  2665. popupObserver.disconnect()
  2666. }
  2667.  
  2668. popupObserver = observeElement($layers, (mutations) => {
  2669. mutations.forEach((mutation) => {
  2670. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $el) => {
  2671. let nestedObserver = onPopup($el)
  2672. if (nestedObserver) {
  2673. nestedObservers.set($el, nestedObserver)
  2674. }
  2675. })
  2676. mutation.removedNodes.forEach((/** @type {HTMLElement} */ $el) => {
  2677. if (nestedObservers.has($el)) {
  2678. nestedObservers.get($el).disconnect()
  2679. nestedObservers.delete($el)
  2680. }
  2681. })
  2682. })
  2683. }, 'popup container')
  2684. }
  2685. })()
  2686.  
  2687. async function observeTitle() {
  2688. let $title = await getElement('title', {name: '<title>'})
  2689. observeElement($title, () => {
  2690. let title = $title.textContent
  2691. if (config.replaceLogo && (ltr ? /X$/ : /^(?:\(\d+\+?\) )?X/).test(title)) {
  2692. let newTitle = title.replace(ltr ? /X$/ : 'X', getString('TWITTER'))
  2693. document.title = newTitle
  2694. // If Twitter is opened in the background, changing the title might not
  2695. // re-fire the title MutationObserver, preventing the initial page from
  2696. // being processed.
  2697. if (!currentPage) {
  2698. onTitleChange(newTitle)
  2699. }
  2700. return
  2701. }
  2702. if (observingPageChanges) {
  2703. onTitleChange(title)
  2704. }
  2705. }, '<title>')
  2706. }
  2707. //#endregion
  2708.  
  2709. //#region Page observers
  2710. async function observeSidebar() {
  2711. let $primaryColumn = await getElement(Selectors.PRIMARY_COLUMN, {
  2712. name: 'primary column'
  2713. })
  2714. let $sidebarContainer = $primaryColumn.parentElement
  2715. pageObservers.push(
  2716. observeElement($sidebarContainer, () => {
  2717. let $sidebar = $sidebarContainer.querySelector(Selectors.SIDEBAR)
  2718. log(`sidebar ${$sidebar ? 'appeared' : 'disappeared'}`)
  2719. $body.classList.toggle('Sidebar', Boolean($sidebar))
  2720. if ($sidebar && config.twitterBlueChecks != 'ignore' && !isOnSearchPage() && !isOnExplorePage()) {
  2721. observeSearchForm()
  2722. }
  2723. }, 'sidebar container')
  2724. )
  2725. }
  2726.  
  2727. const observeSideNavTweetButton = (() => {
  2728. /** @type {MutationObserver} */
  2729. let observer
  2730.  
  2731. return async function observeSideNavTweetButton() {
  2732. if (observer) {
  2733. observer.disconnect()
  2734. observer = null
  2735. }
  2736.  
  2737. if (!desktop || !config.replaceLogo) return
  2738.  
  2739. // This element is updated when text is added or removed on resize
  2740. let $buttonTextContainer = await getElement('a[data-testid="SideNav_NewTweet_Button"] > div > span', {
  2741. name: 'sidenav tweet button text container',
  2742. })
  2743. observer = observeElement($buttonTextContainer, () => {
  2744. if ($buttonTextContainer.childElementCount > 0) {
  2745. let $buttonText = /** @type {HTMLElement} */ ($buttonTextContainer.querySelector('span > span'))
  2746. if ($buttonText) {
  2747. setTweetButtonText($buttonText)
  2748. } else {
  2749. warn('could not find tweet button text')
  2750. }
  2751. }
  2752. }, 'sidenav tweet button')
  2753. }
  2754. })()
  2755.  
  2756. async function observeSearchForm() {
  2757. let $searchForm = await getElement('form[role="search"]', {
  2758. name: 'search form',
  2759. stopIf: pageIsNot(currentPage),
  2760. // The sidebar on Profile pages can be really slow
  2761. timeout: 2000,
  2762. })
  2763. if (!$searchForm) return
  2764. let $results = /** @type {HTMLElement} */ ($searchForm.lastElementChild)
  2765. pageObservers.push(
  2766. observeElement($results, () => {
  2767. processBlueChecks($results)
  2768. }, 'search results', {childList: true, subtree: true})
  2769. )
  2770. }
  2771.  
  2772. /**
  2773. * @param {string} page
  2774. * @param {import("./types").TimelineOptions?} options
  2775. */
  2776. async function observeTimeline(page, options = {}) {
  2777. let {
  2778. isTabbed = false,
  2779. onTabChanged = null,
  2780. onTimelineAppeared = null,
  2781. tabbedTimelineContainerSelector = null,
  2782. timelineSelector = Selectors.TIMELINE,
  2783. } = options
  2784.  
  2785. let $timeline = await getElement(timelineSelector, {
  2786. name: 'initial timeline',
  2787. stopIf: pageIsNot(page),
  2788. })
  2789.  
  2790. if ($timeline == null) return
  2791.  
  2792. /**
  2793. * @param {HTMLElement} $timeline
  2794. */
  2795. function observeTimelineItems($timeline) {
  2796. disconnectPageObserver('timeline')
  2797. pageObservers.push(
  2798. observeElement($timeline, () => onTimelineChange($timeline, page, options), 'timeline')
  2799. )
  2800. onTimelineAppeared?.()
  2801. if (isTabbed) {
  2802. // When a tab which has been viewed before is revisited, the timeline is
  2803. // replaced.
  2804. disconnectPageObserver('timeline parent')
  2805. pageObservers.push(
  2806. observeElement($timeline.parentElement, (mutations) => {
  2807. mutations.forEach((mutation) => {
  2808. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $newTimeline) => {
  2809. disconnectPageObserver('timeline')
  2810. log('tab changed')
  2811. onTabChanged?.()
  2812. pageObservers.push(
  2813. observeElement($newTimeline, () => onTimelineChange($newTimeline, page, options), 'timeline')
  2814. )
  2815. })
  2816. })
  2817. }, 'timeline parent')
  2818. )
  2819. }
  2820. }
  2821.  
  2822. // If the inital timeline doesn't have a style attribute it's a placeholder
  2823. if ($timeline.hasAttribute('style')) {
  2824. observeTimelineItems($timeline)
  2825. }
  2826. else {
  2827. log('waiting for timeline')
  2828. let startTime = Date.now()
  2829. pageObservers.push(
  2830. observeElement($timeline.parentElement, (mutations) => {
  2831. mutations.forEach((mutation) => {
  2832. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $timeline) => {
  2833. disconnectPageObserver('timeline parent')
  2834. if (Date.now() > startTime) {
  2835. log(`timeline appeared after ${Date.now() - startTime}ms`, $timeline)
  2836. }
  2837. observeTimelineItems($timeline)
  2838. })
  2839. })
  2840. }, 'timeline parent')
  2841. )
  2842. }
  2843.  
  2844. // On some tabbed timeline pages, the first time a new tab is navigated to,
  2845. // the element containing the timeline is replaced with a loading spinner.
  2846. if (isTabbed && tabbedTimelineContainerSelector) {
  2847. let $tabbedTimelineContainer = document.querySelector(tabbedTimelineContainerSelector)
  2848. if ($tabbedTimelineContainer) {
  2849. let waitingForNewTimeline = false
  2850. pageObservers.push(
  2851. observeElement($tabbedTimelineContainer, async (mutations) => {
  2852. // This is going to fire twice on a new tab, as the spinner is added
  2853. // then replaced with the new timeline element.
  2854. if (!mutations.some(mutation => mutation.addedNodes.length > 0) || waitingForNewTimeline) return
  2855.  
  2856. waitingForNewTimeline = true
  2857. let $newTimeline = await getElement(timelineSelector, {
  2858. name: 'new timeline',
  2859. stopIf: pageIsNot(page),
  2860. })
  2861. waitingForNewTimeline = false
  2862. if (!$newTimeline) return
  2863.  
  2864. log('tab changed')
  2865. onTabChanged?.()
  2866. observeTimelineItems($newTimeline)
  2867. }, 'tabbed timeline container')
  2868. )
  2869. } else {
  2870. warn('tabbed timeline container not found', tabbedTimelineContainerSelector)
  2871. }
  2872. }
  2873. }
  2874.  
  2875. /**
  2876. * @param {string} page
  2877. */
  2878. async function observeIndividualTweetTimeline(page) {
  2879. let $timeline = await getElement(Selectors.TIMELINE, {
  2880. name: 'initial individual tweet timeline',
  2881. stopIf: pageIsNot(page),
  2882. })
  2883.  
  2884. if ($timeline == null) return
  2885.  
  2886. /**
  2887. * @param {HTMLElement} $timeline
  2888. */
  2889. function observeTimelineItems($timeline) {
  2890. pageObservers.push(
  2891. observeElement($timeline, () => onIndividualTweetTimelineChange($timeline, {observers: pageObservers}), 'individual tweet timeline')
  2892. )
  2893. }
  2894.  
  2895. // If the inital timeline doesn't have a style attribute it's a placeholder
  2896. if ($timeline.hasAttribute('style')) {
  2897. observeTimelineItems($timeline)
  2898. }
  2899. else {
  2900. log('waiting for individual tweet timeline')
  2901. let startTime = Date.now()
  2902. pageObservers.push(
  2903. observeElement($timeline.parentElement, (mutations) => {
  2904. mutations.forEach((mutation) => {
  2905. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $timeline) => {
  2906. disconnectPageObserver('individual tweet timeline parent')
  2907. if (Date.now() > startTime) {
  2908. log(`individual tweet timeline appeared after ${Date.now() - startTime}ms`, $timeline)
  2909. }
  2910. observeTimelineItems($timeline)
  2911. })
  2912. })
  2913. }, 'individual tweet timeline parent')
  2914. )
  2915. }
  2916. }
  2917. //#endregion
  2918.  
  2919. //#region Tweak functions
  2920. /**
  2921. * Add an "Add muted word" menu item after the given link which takes you
  2922. * straight to entering a new muted word (by clicking its way through all the
  2923. * individual screens!).
  2924. * @param {HTMLElement} $link
  2925. * @param {string} linkSelector
  2926. */
  2927. async function addAddMutedWordMenuItem($link, linkSelector) {
  2928. log('adding "Add muted word" menu item')
  2929.  
  2930. // Wait for the dropdown to appear on desktop
  2931. if (desktop) {
  2932. $link = await getElement(`#layers div[data-testid="Dropdown"] ${linkSelector}`, {
  2933. name: 'rendered menu item',
  2934. timeout: 100,
  2935. })
  2936. if (!$link) return
  2937. }
  2938.  
  2939. let $addMutedWord = /** @type {HTMLElement} */ ($link.parentElement.cloneNode(true))
  2940. $addMutedWord.classList.add('tnt_menu_item')
  2941. $addMutedWord.querySelector('a').href = PagePaths.ADD_MUTED_WORD
  2942. $addMutedWord.querySelector('span').textContent = getString('ADD_MUTED_WORD')
  2943. $addMutedWord.querySelector('svg').innerHTML = Svgs.MUTE
  2944. $addMutedWord.addEventListener('click', (e) => {
  2945. e.preventDefault()
  2946. addMutedWord()
  2947. })
  2948. $link.parentElement.insertAdjacentElement('beforebegin', $addMutedWord)
  2949. }
  2950.  
  2951. function addCaretMenuListenerForQuoteTweet($tweet) {
  2952. let $caret = /** @type {HTMLElement} */ ($tweet.querySelector('[data-testid="caret"]'))
  2953. if ($caret && !$caret.dataset.tweakNewTwitterListener) {
  2954. $caret.addEventListener('click', () => {
  2955. quotedTweet = getQuotedTweetDetails($tweet, {getText: true})
  2956. })
  2957. $caret.dataset.tweakNewTwitterListener = 'true'
  2958. }
  2959. }
  2960.  
  2961. /**
  2962. * @param {HTMLElement} $blockMenuItem
  2963. */
  2964. async function addMuteQuotesMenuItems($blockMenuItem) {
  2965. log('mutableQuoteTweets: adding "Mute this conversation" and "Turn off Quote Tweets" menu item')
  2966.  
  2967. // Wait for the menu to render properly on desktop
  2968. if (desktop) {
  2969. $blockMenuItem = await getElement(`:scope > div > div > div > ${Selectors.BLOCK_MENU_ITEM}`, {
  2970. context: $blockMenuItem.parentElement,
  2971. name: 'rendered block menu item',
  2972. timeout: 100,
  2973. })
  2974. if (!$blockMenuItem) return
  2975. }
  2976.  
  2977. let $muteQuotes = /** @type {HTMLElement} */ ($blockMenuItem.previousElementSibling.cloneNode(true))
  2978. $muteQuotes.classList.add('tnt_menu_item')
  2979. $muteQuotes.querySelector('span').textContent = getString('MUTE_THIS_CONVERSATION')
  2980. $muteQuotes.addEventListener('click', (e) => {
  2981. e.preventDefault()
  2982. log('mutableQuoteTweets: muting quotes of a tweet', quotedTweet)
  2983. config.mutedQuotes = config.mutedQuotes.concat(quotedTweet)
  2984. storeConfigChanges({mutedQuotes: config.mutedQuotes})
  2985. processCurrentPage()
  2986. // Dismiss the menu
  2987. let $menuLayer = /** @type {HTMLElement} */ ($blockMenuItem.closest('[role="group"]')?.firstElementChild?.firstElementChild)
  2988. if (!$menuLayer) {
  2989. warn('mutableQuoteTweets: could not find menu layer to dismiss menu')
  2990. }
  2991. $menuLayer?.click()
  2992. })
  2993.  
  2994. if (quotedTweet?.quotedBy) {
  2995. let $toggleQuotes = /** @type {HTMLElement} */ ($blockMenuItem.previousElementSibling.cloneNode(true))
  2996. $toggleQuotes.classList.add('tnt_menu_item')
  2997. $toggleQuotes.querySelector('span').textContent = getString(`TURN_OFF_QUOTE_TWEETS`)
  2998. $toggleQuotes.querySelector('svg').innerHTML = Svgs.RETWEETS_OFF
  2999. $toggleQuotes.addEventListener('click', (e) => {
  3000. e.preventDefault()
  3001. log('mutableQuoteTweets: toggling quotes from', quotedTweet.quotedBy)
  3002. if (config.hideQuotesFrom.includes(quotedTweet.quotedBy)) {
  3003. config.hideQuotesFrom = config.hideQuotesFrom.filter(user => user != quotedTweet.quotedBy)
  3004. } else {
  3005. config.hideQuotesFrom = config.hideQuotesFrom.concat(quotedTweet.quotedBy)
  3006. }
  3007. storeConfigChanges({hideQuotesFrom: config.hideQuotesFrom})
  3008. processCurrentPage()
  3009. // Dismiss the menu
  3010. let $menuLayer = /** @type {HTMLElement} */ ($blockMenuItem.closest('[role="group"]')?.firstElementChild?.firstElementChild)
  3011. if (!$menuLayer) {
  3012. warn('mutableQuoteTweets: could not find menu layer to dismiss menu')
  3013. }
  3014. $menuLayer?.click()
  3015. })
  3016. $blockMenuItem.insertAdjacentElement('beforebegin', $toggleQuotes)
  3017. } else {
  3018. warn('mutableQuoteTweets: quotedBy not available when Tweet menu was opened')
  3019. }
  3020.  
  3021. $blockMenuItem.insertAdjacentElement('beforebegin', $muteQuotes)
  3022. }
  3023.  
  3024. async function addMutedWord() {
  3025. if (!document.querySelector('a[href="/settings')) {
  3026. let $settingsAndSupport = /** @type {HTMLElement} */ (document.querySelector('[data-testid="settingsAndSupport"]'))
  3027. $settingsAndSupport?.click()
  3028. }
  3029.  
  3030. for (let path of [
  3031. '/settings',
  3032. '/settings/privacy_and_safety',
  3033. '/settings/mute_and_block',
  3034. '/settings/muted_keywords',
  3035. '/settings/add_muted_keyword',
  3036. ]) {
  3037. let $link = await getElement(`a[href="${path}"]`, {timeout: 500})
  3038. if (!$link) return
  3039. $link.click()
  3040. }
  3041. let $input = await getElement('input[name="keyword"]')
  3042. setTimeout(() => $input.focus(), 100)
  3043. }
  3044.  
  3045. /**
  3046. * Add a "Turn on/off Retweets" menu item to a List's menu.
  3047. * @param {HTMLElement} $switchMenuItem
  3048. */
  3049. async function addToggleListRetweetsMenuItem($switchMenuItem) {
  3050. log('adding "Turn on/off Retweets" menu item')
  3051.  
  3052. // Wait for the menu to render properly on desktop
  3053. if (desktop) {
  3054. $switchMenuItem = await getElement(':scope > div > div > div > [role="menuitem"]', {
  3055. context: $switchMenuItem.parentElement,
  3056. name: 'rendered switch menu item',
  3057. timeout: 100,
  3058. })
  3059. if (!$switchMenuItem) return
  3060. }
  3061.  
  3062. let $toggleRetweets = /** @type {HTMLElement} */ ($switchMenuItem.cloneNode(true))
  3063. $toggleRetweets.classList.add('tnt_menu_item')
  3064. $toggleRetweets.querySelector('span').textContent = getString(`TURN_${config.listRetweets == 'ignore' ? 'OFF' : 'ON'}_RETWEETS`)
  3065. $toggleRetweets.querySelector('svg').innerHTML = config.listRetweets == 'ignore' ? Svgs.RETWEETS_OFF : Svgs.RETWEET
  3066. // Remove subtitle if the cloned menu item has one
  3067. $toggleRetweets.querySelector('div[dir] + div[dir]')?.remove()
  3068. $toggleRetweets.addEventListener('click', (e) => {
  3069. e.preventDefault()
  3070. log('toggling list retweets')
  3071. config.listRetweets = config.listRetweets == 'ignore' ? 'hide' : 'ignore'
  3072. storeConfigChanges({listRetweets: config.listRetweets})
  3073. processCurrentPage()
  3074. // Dismiss the menu
  3075. let $menuLayer = /** @type {HTMLElement} */ ($switchMenuItem.closest('[role="group"]')?.firstElementChild?.firstElementChild)
  3076. if (!$menuLayer) {
  3077. log('could not find menu layer to dismiss menu')
  3078. }
  3079. $menuLayer?.click()
  3080. })
  3081.  
  3082. $switchMenuItem.insertAdjacentElement('beforebegin', $toggleRetweets)
  3083. }
  3084.  
  3085. /**
  3086. * Redirects away from the Home timeline if we're on it and it's been disabled.
  3087. * @returns {boolean} `true` if redirected as a result of this call
  3088. */
  3089. function checkforDisabledHomeTimeline() {
  3090. if (config.disableHomeTimeline && location.pathname == PagePaths.HOME) {
  3091. log(`Home timeline disabled, redirecting to /${config.disabledHomeTimelineRedirect}`)
  3092. let primaryNavSelector = desktop ? Selectors.PRIMARY_NAV_DESKTOP : Selectors.PRIMARY_NAV_MOBILE
  3093. void (async () => {
  3094. let $navLink = await getElement(`${primaryNavSelector} a[href="/${config.disabledHomeTimelineRedirect}"]`, {
  3095. name: `${config.disabledHomeTimelineRedirect} nav link`,
  3096. stopIf: () => location.pathname != PagePaths.HOME,
  3097. })
  3098. if (!$navLink) return
  3099. $navLink.click()
  3100. })()
  3101. return true
  3102. }
  3103. }
  3104.  
  3105. //#region CSS
  3106. const configureCss = (() => {
  3107. let $style
  3108.  
  3109. return function configureCss() {
  3110. $style ??= addStyle('features')
  3111. let cssRules = [`
  3112. .tnt_font_family {
  3113. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  3114. }
  3115. `]
  3116. let hideCssSelectors = ['.HiddenTweet', '.HiddenTweet + [role="separator"]']
  3117. let menuRole = `[role="${desktop ? 'menu' : 'dialog'}"]`
  3118.  
  3119. // Theme colours for custom UI items
  3120. cssRules.push(`
  3121. body.Default {
  3122. --border-color: rgb(239, 243, 244);
  3123. --color: rgb(83, 100, 113);
  3124. --color-emphasis: rgb(15, 20, 25);
  3125. --hover-bg-color: rgb(247, 249, 249);
  3126. }
  3127. body.Dim {
  3128. --border-color: rgb(56, 68, 77);
  3129. --color: rgb(139, 152, 165);
  3130. --color-emphasis: rgb(247, 249, 249);
  3131. --hover-bg-color: rgb(30, 39, 50);
  3132. }
  3133. body.LightsOut {
  3134. --border-color: rgb(47, 51, 54);
  3135. --color: rgb(113, 118, 123);
  3136. --color-emphasis: rgb(247, 249, 249);
  3137. --hover-bg-color: rgb(22, 24, 28);
  3138. }
  3139. .tnt_menu_item:hover { background-color: var(--hover-bg-color) !important; }
  3140. `)
  3141.  
  3142. if (config.alwaysUseLatestTweets && config.hideForYouTimeline) {
  3143. cssRules.push(`
  3144. /* Prevent the For you tab container taking up space */
  3145. body.HomeTimeline nav.TimelineTabs div[role="tablist"] > div:first-child {
  3146. flex-grow: 0;
  3147. flex-shrink: 1;
  3148. }
  3149. /* Hide the For you tab link */
  3150. body.HomeTimeline nav.TimelineTabs div[role="tablist"] > div:first-child > a {
  3151. display: none;
  3152. }
  3153. `)
  3154. }
  3155. if (config.disableTweetTextFormatting) {
  3156. cssRules.push(`
  3157. div[data-testid="tweetText"] span {
  3158. font-style: normal;
  3159. font-weight: normal;
  3160. }
  3161. `)
  3162. }
  3163. if (config.dropdownMenuFontWeight) {
  3164. cssRules.push(`
  3165. [data-testid="${desktop ? 'Dropdown' : 'sheetDialog'}"] [role="menuitem"] [dir] {
  3166. font-weight: normal;
  3167. }
  3168. `)
  3169. }
  3170. if (config.hideBookmarkButton) {
  3171. // Under timeline tweets
  3172. hideCssSelectors.push(
  3173. 'body:not(.Bookmarks) [data-testid="tweet"][tabindex="0"] [role="group"] > div:has(> button[data-testid$="ookmark"])',
  3174. )
  3175. if (!config.showBookmarkButtonUnderFocusedTweets) {
  3176. // Under the focused tweet
  3177. hideCssSelectors.push(
  3178. '[data-testid="tweet"][tabindex="-1"] [role="group"][id^="id__"] > div:has(> button[data-testid$="ookmark"])',
  3179. )
  3180. }
  3181. }
  3182. if (config.hideListsNav) {
  3183. hideCssSelectors.push(`${menuRole} a[href$="/lists"]`)
  3184. }
  3185. if (config.hideBookmarksNav) {
  3186. hideCssSelectors.push(`${menuRole} a[href$="/bookmarks"]`)
  3187. }
  3188. if (config.hideCommunitiesNav) {
  3189. hideCssSelectors.push(`${menuRole} a[href$="/communities"]`)
  3190. }
  3191. if (config.hideShareTweetButton) {
  3192. hideCssSelectors.push(
  3193. // Under timeline tweets
  3194. `[data-testid="tweet"][tabindex="0"] [role="group"] > div[style]:not(${TWITTER_MEDIA_ASSIST_BUTTON_SELECTOR})`,
  3195. // Under the focused tweet
  3196. `[data-testid="tweet"][tabindex="-1"] [role="group"] > div[style]:not(${TWITTER_MEDIA_ASSIST_BUTTON_SELECTOR})`,
  3197. )
  3198. }
  3199. if (config.hideSubscriptions) {
  3200. hideCssSelectors.push(
  3201. // Subscribe buttons in profile (multiple locations)
  3202. 'body.Profile [role="button"][style*="border-color: rgb(201, 54, 204)"]',
  3203. // Subscriptions count in profile
  3204. 'body.Profile a[href$="/creator-subscriptions/subscriptions"]',
  3205. // Subs tab in profile
  3206. 'body.Profile .SubsTab',
  3207. // Subscribe button in focused tweet
  3208. '[data-testid="tweet"][tabindex="-1"] [data-testid$="-subscribe"]',
  3209. // "Subscribe to" dropdown item (desktop)
  3210. '[data-testid="Dropdown"] > [data-testid="subscribe"]',
  3211. // "Subscribe to" menu item (mobile)
  3212. '[data-testid="sheetDialog"] > [data-testid="subscribe"]',
  3213. // "Subscriber" indicator in replies from subscribers
  3214. '[data-testid="tweet"] [data-testid="icon-subscriber"]',
  3215. // Monetization and Subscriptions items in Settings
  3216. 'body.Settings a[href="/settings/monetization"]',
  3217. 'body.Settings a[href="/settings/manage_subscriptions"]',
  3218. // Subscriptions tab link in Following/Follows
  3219. `body.ProfileFollows.Subscriptions ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:last-child > a`,
  3220. )
  3221. // Subscriptions tab in Following/Follows
  3222. cssRules.push(`
  3223. body.ProfileFollows.Subscriptions ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:last-child {
  3224. flex: 0;
  3225. }
  3226. `)
  3227. }
  3228. if (config.hideMetrics) {
  3229. configureHideMetricsCss(cssRules, hideCssSelectors)
  3230. }
  3231. if (config.hideCommunitiesNav) {
  3232. hideCssSelectors.push(`${menuRole} a[href$="/communities"]`)
  3233. }
  3234. if (config.hideGrokNav) {
  3235. hideCssSelectors.push(
  3236. // In menus
  3237. `${menuRole} a[href$="/i/grok"]`,
  3238. // Grok Actions button
  3239. `button[aria-label="${getString('GROK_ACTIONS')}"]`,
  3240. // "Generate image" button in the Tweet editor
  3241. 'button[data-testid="grokImgGen"]',
  3242. // Any Grok buttons we manually tag
  3243. '.GrokButton',
  3244. // Grok suggested prompts in Tweets
  3245. '[data-testid="tweet"] [data-testid^="followups_"]',
  3246. '[data-testid="tweet"] [data-testid^="followups_"] + nav',
  3247. // Profile Summary button
  3248. `button[aria-label="${getString('PROFILE_SUMMARY')}"]`,
  3249. )
  3250. }
  3251. if (config.hideMonetizationNav) {
  3252. hideCssSelectors.push(`${menuRole} a[href$="/i/monetization"]`)
  3253. }
  3254. if (config.hideAdsNav) {
  3255. hideCssSelectors.push(`${menuRole} a:is([href*="ads.twitter.com"], [href*="ads.x.com"])`)
  3256. }
  3257. if (config.hideJobsNav) {
  3258. hideCssSelectors.push(
  3259. // Jobs navigation item
  3260. `${menuRole} a[href="/jobs"]`,
  3261. // Jobs section in profiles
  3262. '.Profile [data-testid="jobs"]',
  3263. )
  3264. }
  3265. if (config.hideTweetAnalyticsLinks) {
  3266. hideCssSelectors.push('a[data-testid="analyticsButton"]')
  3267. }
  3268. if (config.hideTwitterBlueUpsells) {
  3269. hideCssSelectors.push(
  3270. // Premium/Verified menu items
  3271. `${menuRole} a:is([href^="/i/premium"], [href^="/i/verified"])`,
  3272. // Analytics menu item
  3273. `${menuRole} a[href="/i/account_analytics"]`,
  3274. // "Highlight on your profile" on your tweets
  3275. '[role="menuitem"][data-testid="highlightUpsell"]',
  3276. // "Edit with Premium" on recent tweets
  3277. '[role="menuitem"][data-testid="editWithTwitterBlue"]',
  3278. // Premium item in Settings
  3279. 'body.Settings a[href^="/i/premium"]',
  3280. // "Highlight your best content instead" on the pin modal
  3281. '.PinModal [data-testid="sheetDialog"] > div > div:last-child > div > div > div:first-child',
  3282. // Highlight button on the pin modal
  3283. '.PinModal [data-testid="sheetDialog"] [role="button"]:first-child:nth-last-child(3)',
  3284. // Misc upsells in your own profile
  3285. `.OwnProfile ${Selectors.PRIMARY_COLUMN} a[href^="/i/premium"]`,
  3286. // Unlock Analytics button in your own profile
  3287. '.OwnProfile [data-testid="analytics-preview"]',
  3288. )
  3289. // Hide Highlights and Articles tabs in your own profile if you don't have Premium
  3290. let profileTabsList = `body.OwnProfile:not(.PremiumProfile) ${Selectors.PRIMARY_COLUMN} nav div[role="tablist"]`
  3291. let upsellTabLinks = 'a:is([href$="/highlights"], [href$="/articles"])'
  3292. cssRules.push(`
  3293. ${profileTabsList} > div:has(> ${upsellTabLinks}) {
  3294. flex: 0;
  3295. }
  3296. ${profileTabsList} > div > ${upsellTabLinks} {
  3297. display: none;
  3298. }
  3299. `)
  3300. // Hide upsell on the Likes tab in your own profile
  3301. cssRules.push(`
  3302. body.OwnProfile ${Selectors.PRIMARY_COLUMN} nav + div:has(a[href^="/i/premium"]) {
  3303. display: none;
  3304. }
  3305. `)
  3306. // Allow Pin and Cancel buttons go to max-width on the pin modal
  3307. cssRules.push(`
  3308. .PinModal [data-testid="sheetDialog"] > div > div:last-child > div > div {
  3309. width: 100%;
  3310. margin-top: 0;
  3311. padding-left: 32px;
  3312. padding-right: 32px;
  3313. }
  3314. `)
  3315. }
  3316. if (config.hideVerifiedNotificationsTab) {
  3317. cssRules.push(`
  3318. body.Notifications ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:nth-child(2),
  3319. body.ProfileFollows ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:nth-child(1) {
  3320. flex: 0;
  3321. }
  3322. body.Notifications ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:nth-child(2) > a,
  3323. body.ProfileFollows ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:nth-child(1) > a {
  3324. display: none;
  3325. }
  3326. `)
  3327. }
  3328. if (config.hideViews) {
  3329. hideCssSelectors.push(
  3330. // "Views" under the focused tweet
  3331. '[data-testid="tweet"][tabindex="-1"] div[dir] + div[aria-hidden="true"]:nth-child(2):nth-last-child(2)',
  3332. '[data-testid="tweet"][tabindex="-1"] div[dir] + div[aria-hidden="true"]:nth-child(2):nth-last-child(2) + div[dir]:last-child'
  3333. )
  3334. }
  3335. if (config.hideWhoToFollowEtc) {
  3336. hideCssSelectors.push(`body.Profile ${Selectors.PRIMARY_COLUMN} aside[role="complementary"]`)
  3337. }
  3338. if (config.reducedInteractionMode) {
  3339. hideCssSelectors.push(
  3340. '[data-testid="tweet"] [role="group"]',
  3341. 'body.Tweet [data-testid="tweet"] + div > div [role="group"]',
  3342. )
  3343. }
  3344. if (config.restoreLinkHeadlines) {
  3345. hideCssSelectors.push(
  3346. // Existing headline overlaid on the card
  3347. '.tnt_overlay_headline',
  3348. // From <domain> link after the card
  3349. 'div[data-testid="card.wrapper"] + a',
  3350. )
  3351. } else {
  3352. hideCssSelectors.push('.tnt_link_headline')
  3353. }
  3354. if (config.restoreQuoteTweetsLink || config.restoreOtherInteractionLinks) {
  3355. cssRules.push(`
  3356. #tntInteractionLinks a {
  3357. text-decoration: none;
  3358. color: var(--color);
  3359. }
  3360. #tntInteractionLinks a:hover span:last-child {
  3361. text-decoration: underline;
  3362. }
  3363. #tntQuoteTweetCount {
  3364. margin-right: 2px;
  3365. font-weight: 700;
  3366. color: var(--color-emphasis);
  3367. }
  3368. /* Replaces the "View post engagements" link under your own tweets */
  3369. a[data-testid="analyticsButton"] {
  3370. display: none;
  3371. }
  3372. `)
  3373. } else {
  3374. hideCssSelectors.push('#tntInteractionLinks')
  3375. }
  3376. if (!config.restoreQuoteTweetsLink) {
  3377. hideCssSelectors.push('#tntQuoteTweetsLink')
  3378. }
  3379. if (!config.restoreOtherInteractionLinks) {
  3380. hideCssSelectors.push('#tntRetweetsLink', '#tntLikesLink')
  3381. }
  3382. if (config.tweakQuoteTweetsPage) {
  3383. // Hide the quoted tweet, which is repeated in every quote tweet
  3384. hideCssSelectors.push('body.QuoteTweets [data-testid="tweet"] [aria-labelledby] > div:last-child')
  3385. }
  3386. if (config.twitterBlueChecks == 'hide') {
  3387. hideCssSelectors.push('.tnt_blue_check')
  3388. }
  3389. if (config.twitterBlueChecks == 'replace') {
  3390. cssRules.push(`
  3391. :is(${Selectors.VERIFIED_TICK}, svg[data-testid="verificationBadge"]).tnt_blue_check path {
  3392. d: path("${Svgs.BLUE_LOGO_PATH}");
  3393. }
  3394. `)
  3395. }
  3396.  
  3397. if (shouldShowSeparatedTweetsTab()) {
  3398. cssRules.push(`
  3399. body.Default {
  3400. --tab-hover: rgba(15, 20, 25, 0.1);
  3401. }
  3402. body.Dim {
  3403. --tab-hover: rgba(247, 249, 249, 0.1);
  3404. }
  3405. body.LightsOut {
  3406. --tab-hover: rgba(231, 233, 234, 0.1);
  3407. }
  3408.  
  3409. /* Tabbed timeline */
  3410. body.Desktop #tnt_separated_tweets_tab:hover,
  3411. body.Mobile:not(.SeparatedTweets) #tnt_separated_tweets_tab:hover,
  3412. body.Mobile #tnt_separated_tweets_tab:active {
  3413. background-color: var(--tab-hover);
  3414. }
  3415. body:not(.SeparatedTweets) #tnt_separated_tweets_tab > a > div > div,
  3416. body.HomeTimeline.SeparatedTweets ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:not(#tnt_separated_tweets_tab) > a > div > div {
  3417. font-weight: normal !important;
  3418. color: var(--color) !important;
  3419. }
  3420. body.SeparatedTweets #tnt_separated_tweets_tab > a > div > div {
  3421. font-weight: bold;
  3422. color: var(--color-emphasis); !important;
  3423. }
  3424. body:not(.SeparatedTweets) #tnt_separated_tweets_tab > a > div > div > div,
  3425. body.HomeTimeline.SeparatedTweets ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav div[role="tablist"] > div:not(#tnt_separated_tweets_tab) > a > div > div > div {
  3426. height: 0 !important;
  3427. }
  3428. body.SeparatedTweets #tnt_separated_tweets_tab > a > div > div > div {
  3429. height: 4px !important;
  3430. min-width: 56px;
  3431. width: 100%;
  3432. position: absolute;
  3433. bottom: 0;
  3434. border-radius: 9999px;
  3435. }
  3436. `)
  3437. }
  3438.  
  3439. //#region Desktop-only
  3440. if (desktop) {
  3441. if (config.navDensity == 'comfortable' || config.navDensity == 'compact') {
  3442. cssRules.push(`
  3443. header nav > a,
  3444. header nav > div[data-testid="AppTabBar_More_Menu"] {
  3445. padding-top: 0 !important;
  3446. padding-bottom: 0 !important;
  3447. }
  3448. `)
  3449. }
  3450. if (config.navDensity == 'compact') {
  3451. cssRules.push(`
  3452. header nav > a > div,
  3453. header nav > div[data-testid="AppTabBar_More_Menu"] > div {
  3454. padding-top: 6px !important;
  3455. padding-bottom: 6px !important;
  3456. }
  3457. `)
  3458. }
  3459. if (config.hideSeeNewTweets) {
  3460. hideCssSelectors.push(`body.HomeTimeline ${Selectors.PRIMARY_COLUMN} > div > div:first-child > div[style^="transform"]`)
  3461. }
  3462. if (config.hideTimelineTweetBox) {
  3463. hideCssSelectors.push(`body.HomeTimeline ${Selectors.PRIMARY_COLUMN} > div > div:nth-child(3)`)
  3464. }
  3465. if (config.disableHomeTimeline) {
  3466. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a[href="/home"]`)
  3467. }
  3468. if (config.fullWidthContent) {
  3469. cssRules.push(`
  3470. /* Use full width when the sidebar is visible */
  3471. body.Sidebar${FULL_WIDTH_BODY_PSEUDO} ${Selectors.PRIMARY_COLUMN},
  3472. body.Sidebar${FULL_WIDTH_BODY_PSEUDO} ${Selectors.PRIMARY_COLUMN} > div:first-child > div:last-child {
  3473. max-width: 990px;
  3474. }
  3475. /* Make the "What's happening" input keep its original width */
  3476. body.HomeTimeline ${Selectors.PRIMARY_COLUMN} > div:first-child > div:nth-of-type(3) div[role="progressbar"] + div {
  3477. max-width: 598px;
  3478. }
  3479. /* Use full width when the sidebar is not visible */
  3480. body:not(.Sidebar)${FULL_WIDTH_BODY_PSEUDO} header[role="banner"] {
  3481. flex-grow: 0;
  3482. }
  3483. body:not(.Sidebar)${FULL_WIDTH_BODY_PSEUDO} main[role="main"] > div {
  3484. width: 100%;
  3485. }
  3486. body:not(.Sidebar)${FULL_WIDTH_BODY_PSEUDO} ${Selectors.PRIMARY_COLUMN} {
  3487. max-width: unset;
  3488. width: 100%;
  3489. }
  3490. body:not(.Sidebar)${FULL_WIDTH_BODY_PSEUDO} ${Selectors.PRIMARY_COLUMN} > div:first-child > div:first-child div,
  3491. body:not(.Sidebar)${FULL_WIDTH_BODY_PSEUDO} ${Selectors.PRIMARY_COLUMN} > div:first-child > div:last-child {
  3492. max-width: unset;
  3493. }
  3494. `)
  3495. if (!config.fullWidthMedia) {
  3496. // Make media & cards keep their original width
  3497. cssRules.push(`
  3498. body${FULL_WIDTH_BODY_PSEUDO} ${Selectors.PRIMARY_COLUMN} ${Selectors.TWEET} > div > div > div:nth-of-type(2) > div:nth-of-type(2) > div[id][aria-labelledby]:not(:empty) {
  3499. max-width: 504px;
  3500. }
  3501. `)
  3502. }
  3503. // Hide the sidebar when present
  3504. hideCssSelectors.push(`body.Sidebar${FULL_WIDTH_BODY_PSEUDO} ${Selectors.SIDEBAR}`)
  3505. }
  3506. if (config.hideAccountSwitcher) {
  3507. cssRules.push(`
  3508. header[role="banner"] > div > div > div > div:last-child {
  3509. flex-shrink: 1 !important;
  3510. align-items: flex-end !important;
  3511. }
  3512. `)
  3513. hideCssSelectors.push(
  3514. '[data-testid="SideNav_AccountSwitcher_Button"] > div:first-child:not(:only-child)',
  3515. '[data-testid="SideNav_AccountSwitcher_Button"] > div:first-child + div',
  3516. )
  3517. }
  3518. if (config.hideExplorePageContents) {
  3519. hideCssSelectors.push(
  3520. // Tabs
  3521. `body.Explore ${Selectors.DESKTOP_TIMELINE_HEADER} nav`,
  3522. // Content
  3523. `body.Explore ${Selectors.TIMELINE}`,
  3524. )
  3525. }
  3526. if (config.hideGrokNav) {
  3527. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a[href$="/i/grok"]`)
  3528. cssRules.push(`div[data-testid="GrokDrawer"] { visibility: hidden; }`)
  3529. }
  3530. if (config.hideJobsNav) {
  3531. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a[href="/jobs"]`)
  3532. }
  3533. if (config.hideListsNav) {
  3534. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a[href$="/lists"]`)
  3535. }
  3536. if (config.hideProNav) {
  3537. hideCssSelectors.push(`${menuRole} a:is([href*="pro.twitter.com"], [href*="pro.x.com"])`)
  3538. }
  3539. if (config.hideSpacesNav) {
  3540. hideCssSelectors.push(`${menuRole} a[href="/i/spaces/start"]`)
  3541. }
  3542. if (config.hideTwitterBlueUpsells) {
  3543. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a:is([href^="/i/premium"], [href^="/i/verified"])`)
  3544. }
  3545. if (config.hideSidebarContent) {
  3546. // Only show the first sidebar item by default
  3547. // Re-show subsequent non-algorithmic sections on specific pages
  3548. cssRules.push(`
  3549. ${Selectors.SIDEBAR_WRAPPERS} > div:not(:first-of-type) {
  3550. display: none;
  3551. }
  3552. body.Search ${Selectors.SIDEBAR_WRAPPERS} > div:nth-of-type(2) {
  3553. display: block;
  3554. }
  3555. body.Search ${Selectors.SIDEBAR_WRAPPERS}:has(a[href="/i/radar"]) > div:first-of-type {
  3556. display: none;
  3557. }
  3558. body.Search ${Selectors.SIDEBAR_WRAPPERS}:has(a[href="/i/radar"]) > div:nth-of-type(3) {
  3559. display: block;
  3560. }
  3561. `)
  3562. if (config.showRelevantPeople) {
  3563. cssRules.push(`
  3564. body.Tweet ${Selectors.SIDEBAR_WRAPPERS} > div:is(:nth-of-type(2), :nth-of-type(3)) {
  3565. display: block;
  3566. }
  3567. `)
  3568. }
  3569. hideCssSelectors.push(`body.HideSidebar ${Selectors.SIDEBAR}`)
  3570. } else if (config.hideTwitterBlueUpsells) {
  3571. // Hide "Subscribe to premium" individually
  3572. hideCssSelectors.push(
  3573. `body.HomeTimeline ${Selectors.SIDEBAR_WRAPPERS} > div:nth-of-type(3)`
  3574. )
  3575. }
  3576. if (config.hideShareTweetButton) {
  3577. hideCssSelectors.push(
  3578. // In media modal
  3579. `[aria-modal="true"] div > div:first-of-type [role="group"] > div[style]:not([role]):not(${TWITTER_MEDIA_ASSIST_BUTTON_SELECTOR})`,
  3580. )
  3581. }
  3582. if (config.hideExploreNav) {
  3583. // When configured, hide Explore only when the sidebar is showing, or
  3584. // when on a page full-width content is enabled on.
  3585. let bodySelector = `${config.hideExploreNavWithSidebar ? `body.Sidebar${config.fullWidthContent ? `:not(${FULL_WIDTH_BODY_PSEUDO})` : ''} ` : ''}`
  3586. hideCssSelectors.push(`${bodySelector}${Selectors.PRIMARY_NAV_DESKTOP} a[href="/explore"]`)
  3587. }
  3588. if (config.hideBookmarksNav) {
  3589. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a[href="/i/bookmarks"]`)
  3590. }
  3591. if (config.hideCommunitiesNav) {
  3592. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_DESKTOP} a[href$="/communities"]`)
  3593. }
  3594. if (config.hideMessagesDrawer) {
  3595. cssRules.push(`div[data-testid="DMDrawer"] { visibility: hidden; }`)
  3596. }
  3597. if (config.hideViews) {
  3598. hideCssSelectors.push(
  3599. // Under timeline tweets
  3600. '[data-testid="tweet"][tabindex="0"] [role="group"] > div:has(> a[href$="/analytics"])',
  3601. // In media modal
  3602. '[aria-modal="true"] > div > div:first-of-type [role="group"] > div:has(> a[href$="/analytics"])',
  3603. )
  3604. }
  3605. if (config.retweets != 'separate' && config.quoteTweets != 'separate') {
  3606. hideCssSelectors.push('#tnt_separated_tweets_tab')
  3607. }
  3608. }
  3609. //#endregion
  3610.  
  3611. //#region Mobile only
  3612. if (mobile) {
  3613. if (config.disableHomeTimeline) {
  3614. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_MOBILE} a[href="/home"]`)
  3615. }
  3616. if (config.hideSeeNewTweets) {
  3617. hideCssSelectors.push(`body.HomeTimeline ${Selectors.MOBILE_TIMELINE_HEADER} ~ div[style^="transform"]:last-child`)
  3618. }
  3619. if (config.hideExplorePageContents) {
  3620. // Hide explore page contents so we don't get a brief flash of them
  3621. // before automatically switching the page to search mode.
  3622. hideCssSelectors.push(
  3623. // Tabs
  3624. `body.Explore ${Selectors.MOBILE_TIMELINE_HEADER} > div > div:nth-of-type(2)`,
  3625. // Content
  3626. `body.Explore ${Selectors.TIMELINE}`,
  3627. )
  3628. }
  3629. if (config.hideGrokNav) {
  3630. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_MOBILE} a[href="/i/grok"]`)
  3631. }
  3632. if (config.hideCommunitiesNav) {
  3633. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_MOBILE} a[href$="/communities"]`)
  3634. }
  3635. if (config.hideMessagesBottomNavItem) {
  3636. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_MOBILE} a[href="/messages"]`)
  3637. }
  3638. if (config.hideJobsNav) {
  3639. hideCssSelectors.push(`${Selectors.PRIMARY_NAV_MOBILE} a[href="/jobs"]`)
  3640. }
  3641. if (config.hideTwitterBlueUpsells) {
  3642. hideCssSelectors.push(
  3643. `${Selectors.PRIMARY_NAV_MOBILE} a[href^="/i/premium"]`,
  3644. `${Selectors.MOBILE_TIMELINE_HEADER} a[href^="/i/premium"]`,
  3645. )
  3646. }
  3647. if (config.hideShareTweetButton) {
  3648. hideCssSelectors.push(
  3649. // In media modal
  3650. `body.MobileMedia [role="group"] > div[style]:not(${TWITTER_MEDIA_ASSIST_BUTTON_SELECTOR})`,
  3651. )
  3652. }
  3653. if (config.hideViews) {
  3654. hideCssSelectors.push(
  3655. // Under timeline tweets
  3656. '[data-testid="tweet"][tabindex="0"] [role="group"] > div:has(> a[href$="/analytics"])',
  3657. // In media modal
  3658. 'body.MobileMedia [role="group"] > div:has(> a[href$="/analytics"])',
  3659. )
  3660. }
  3661. //#endregion
  3662. }
  3663.  
  3664. if (hideCssSelectors.length > 0) {
  3665. cssRules.push(`
  3666. ${hideCssSelectors.join(',\n')} {
  3667. display: none !important;
  3668. }
  3669. `)
  3670. }
  3671.  
  3672. $style.textContent = cssRules.map(dedent).join('\n')
  3673. }
  3674. })()
  3675.  
  3676. function configureFont() {
  3677. if (!fontFamilyRule) {
  3678. warn('no fontFamilyRule found for configureFont to use')
  3679. return
  3680. }
  3681.  
  3682. if (config.dontUseChirpFont) {
  3683. if (fontFamilyRule.style.fontFamily.includes('TwitterChirp')) {
  3684. fontFamilyRule.style.fontFamily = fontFamilyRule.style.fontFamily.replace(/"?TwitterChirp"?, ?/, '')
  3685. log('disabled Chirp font')
  3686. }
  3687. } else if (!fontFamilyRule.style.fontFamily.includes('TwitterChirp')) {
  3688. fontFamilyRule.style.fontFamily = `"TwitterChirp", ${fontFamilyRule.style.fontFamily}`
  3689. log(`enabled Chirp font`)
  3690. }
  3691. }
  3692.  
  3693. /**
  3694. * @param {string[]} cssRules
  3695. * @param {string[]} hideCssSelectors
  3696. */
  3697. function configureHideMetricsCss(cssRules, hideCssSelectors) {
  3698. if (config.hideFollowingMetrics) {
  3699. // User profile hover card and page metrics
  3700. hideCssSelectors.push(
  3701. ':is(#layers, body.Profile) a:is([href$="/following"], [href$="/verified_followers"]) > span:first-child'
  3702. )
  3703. // Fix display of whitespace after hidden metrics
  3704. cssRules.push(
  3705. ':is(#layers, body.Profile) a:is([href$="/following"], [href$="/verified_followers"]) { white-space: pre-line; }'
  3706. )
  3707. }
  3708.  
  3709. if (config.hideTotalTweetsMetrics) {
  3710. // Tweet count under username header on profile pages
  3711. hideCssSelectors.push(`
  3712. body.Profile ${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} > div > div:first-of-type h2 + div[dir]
  3713. `)
  3714. }
  3715.  
  3716. let timelineMetricSelectors = [
  3717. config.hideReplyMetrics && '[data-testid="reply"]',
  3718. config.hideRetweetMetrics && '[data-testid$="retweet"]',
  3719. config.hideLikeMetrics && '[data-testid$="like"]',
  3720. config.hideBookmarkMetrics && '[data-testid$="bookmark"], [data-testid$="removeBookmark"]',
  3721. ].filter(Boolean).join(', ')
  3722.  
  3723. if (timelineMetricSelectors) {
  3724. cssRules.push(
  3725. `[role="group"] button:is(${timelineMetricSelectors}) span { visibility: hidden; }`
  3726. )
  3727. }
  3728.  
  3729. if (config.hideQuoteTweetMetrics) {
  3730. hideCssSelectors.push('#tntQuoteTweetCount')
  3731. }
  3732. }
  3733.  
  3734. /**
  3735. * CSS which depends on anything we need to get from the page.
  3736. */
  3737. const configureDynamicCss = (() => {
  3738. let $style
  3739.  
  3740. return function configureDynamicCss() {
  3741. $style ??= addStyle('dynamic')
  3742. let cssRules = []
  3743.  
  3744. if (fontSize != null && config.navBaseFontSize) {
  3745. cssRules.push(`
  3746. ${Selectors.PRIMARY_NAV_DESKTOP} div[dir] span { font-size: ${fontSize}; font-weight: normal; }
  3747. ${Selectors.PRIMARY_NAV_DESKTOP} div[dir] { margin-top: -4px; }
  3748. `)
  3749. }
  3750.  
  3751. if (filterBlurRule != null && config.unblurSensitiveContent) {
  3752. cssRules.push(`
  3753. ${filterBlurRule.selectorText} {
  3754. filter: none !important;
  3755. }
  3756. ${filterBlurRule.selectorText} + div {
  3757. display: none !important;
  3758. }
  3759. `)
  3760. }
  3761.  
  3762. $style.textContent = cssRules.map(dedent).join('\n')
  3763. }
  3764. })()
  3765. //#endregion
  3766.  
  3767. /**
  3768. * Configures – or re-configures – the separated tweets timeline title.
  3769. *
  3770. * If we're currently on the separated tweets timeline and…
  3771. * - …its title has changed, the page title will be changed to "navigate" to it.
  3772. * - …the separated tweets timeline is no longer needed, we'll change the page
  3773. * title to "navigate" back to the Home timeline.
  3774. *
  3775. * @returns {boolean} `true` if "navigation" was triggered by this call
  3776. */
  3777. function configureSeparatedTweetsTimelineTitle() {
  3778. let wasOnSeparatedTweetsTimeline = isOnSeparatedTweetsTimeline()
  3779. let previousTitle = separatedTweetsTimelineTitle
  3780.  
  3781. if (config.retweets == 'separate' && config.quoteTweets == 'separate') {
  3782. separatedTweetsTimelineTitle = getString(config.replaceLogo ? 'SHARED_TWEETS' : 'SHARED')
  3783. } else if (config.retweets == 'separate') {
  3784. separatedTweetsTimelineTitle = getString(config.replaceLogo ? 'RETWEETS' : 'REPOSTS')
  3785. } else if (config.quoteTweets == 'separate') {
  3786. separatedTweetsTimelineTitle = getString(config.replaceLogo ? 'QUOTE_TWEETS' : 'QUOTES')
  3787. } else {
  3788. separatedTweetsTimelineTitle = null
  3789. }
  3790.  
  3791. let titleChanged = previousTitle != separatedTweetsTimelineTitle
  3792. if (wasOnSeparatedTweetsTimeline) {
  3793. if (separatedTweetsTimelineTitle == null) {
  3794. log('moving from separated tweets timeline to Home timeline after config change')
  3795. setTitle(getString('HOME'))
  3796. return true
  3797. }
  3798. if (titleChanged) {
  3799. log('applying new separated tweets timeline title after config change')
  3800. setTitle(separatedTweetsTimelineTitle)
  3801. return true
  3802. }
  3803. } else {
  3804. if (titleChanged && previousTitle != null && lastHomeTimelineTitle == previousTitle) {
  3805. log('updating lastHomeTimelineTitle with new separated tweets timeline title')
  3806. lastHomeTimelineTitle = separatedTweetsTimelineTitle
  3807. }
  3808. }
  3809. }
  3810.  
  3811. const configureThemeCss = (() => {
  3812. let $style
  3813.  
  3814. return function configureThemeCss() {
  3815. $style ??= addStyle('theme')
  3816. let cssRules = []
  3817.  
  3818. if (debug) {
  3819. cssRules.push(`
  3820. [data-item-type]::after {
  3821. position: absolute;
  3822. top: 0;
  3823. ${ltr ? 'right': 'left'}: 50px;
  3824. content: attr(data-item-type);
  3825. font-family: ${fontFamilyRule?.style.fontFamily || '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial'};
  3826. background-color: rgb(242, 29, 29);
  3827. color: white;
  3828. font-size: 11px;
  3829. font-weight: bold;
  3830. padding: 4px 6px;
  3831. border-bottom-left-radius: 1em;
  3832. border-bottom-right-radius: 1em;
  3833. }
  3834. `)
  3835. }
  3836.  
  3837. // Active tab colour for custom tabs
  3838. if (themeColor != null && shouldShowSeparatedTweetsTab()) {
  3839. cssRules.push(`
  3840. body.SeparatedTweets #tnt_separated_tweets_tab > a > div > div > div {
  3841. background-color: ${themeColor} !important;
  3842. }
  3843. `)
  3844. }
  3845.  
  3846. if (config.replaceLogo) {
  3847. cssRules.push(`
  3848. ${Selectors.X_LOGO_PATH}, ${Selectors.X_DARUMA_LOGO_PATH} {
  3849. fill: ${THEME_BLUE};
  3850. d: path("${Svgs.TWITTER_LOGO_PATH}");
  3851. }
  3852. .tnt_logo {
  3853. fill: ${THEME_BLUE};
  3854. }
  3855. svg path[d="${Svgs.X_HOME_ACTIVE_PATH}"] {
  3856. d: path("${Svgs.TWITTER_HOME_ACTIVE_PATH}");
  3857. }
  3858. svg path[d="${Svgs.X_HOME_INACTIVE_PATH}"] {
  3859. d: path("${Svgs.TWITTER_HOME_INACTIVE_PATH}");
  3860. }
  3861. `)
  3862. if (desktop) {
  3863. // Revert the Tweet buttons being made monochrome
  3864. cssRules.push(`
  3865. [data-testid="SideNav_NewTweet_Button"],
  3866. [data-testid="tweetButtonInline"],
  3867. [data-testid="tweetButton"] {
  3868. background-color: ${themeColor} !important;
  3869. }
  3870. [data-testid="SideNav_NewTweet_Button"]:hover,
  3871. [data-testid="tweetButtonInline"]:hover:not(:disabled),
  3872. [data-testid="tweetButton"]:hover:not(:disabled) {
  3873. background-color: ${themeColor.replace(')', ', 80%)')} !important;
  3874. }
  3875. body:is(.Dim, .LightsOut):not(.HighContrast) [data-testid="SideNav_NewTweet_Button"] > div,
  3876. body:is(.Dim, .LightsOut):not(.HighContrast) [data-testid="tweetButtonInline"] > div,
  3877. body:is(.Dim, .LightsOut):not(.HighContrast) [data-testid="tweetButton"] > div,
  3878. body:is(.Dim, .LightsOut):not(.HighContrast) [data-testid="SideNav_NewTweet_Button"] > div > svg {
  3879. color: rgb(255, 255, 255) !important;
  3880. }
  3881. `)
  3882. }
  3883. }
  3884.  
  3885. if (config.uninvertFollowButtons) {
  3886. // Shared styles for Following and Follow buttons
  3887. cssRules.push(`
  3888. [role="button"][data-testid$="-unfollow"]:not(:hover) {
  3889. border-color: rgba(0, 0, 0, 0) !important;
  3890. }
  3891. [role="button"][data-testid$="-follow"] {
  3892. background-color: rgba(0, 0, 0, 0) !important;
  3893. }
  3894. `)
  3895. if (config.followButtonStyle == 'monochrome' || themeColor == null) {
  3896. cssRules.push(`
  3897. /* Following button */
  3898. body.Default [role="button"][data-testid$="-unfollow"]:not(:hover) {
  3899. background-color: rgb(15, 20, 25) !important;
  3900. }
  3901. body.Default [role="button"][data-testid$="-unfollow"]:not(:hover) > :is(div, span) {
  3902. color: rgb(255, 255, 255) !important;
  3903. }
  3904. body:is(.Dim, .LightsOut) [role="button"][data-testid$="-unfollow"]:not(:hover) {
  3905. background-color: rgb(255, 255, 255) !important;
  3906. }
  3907. body:is(.Dim, .LightsOut) [role="button"][data-testid$="-unfollow"]:not(:hover) > :is(div, span) {
  3908. color: rgb(15, 20, 25) !important;
  3909. }
  3910. /* Follow button */
  3911. body.Default [role="button"][data-testid$="-follow"] {
  3912. border-color: rgb(207, 217, 222) !important;
  3913. }
  3914. body:is(.Dim, .LightsOut) [role="button"][data-testid$="-follow"] {
  3915. border-color: rgb(83, 100, 113) !important;
  3916. }
  3917. body.Default [role="button"][data-testid$="-follow"] > :is(div, span) {
  3918. color: rgb(15, 20, 25) !important;
  3919. }
  3920. body:is(.Dim, .LightsOut) [role="button"][data-testid$="-follow"] > :is(div, span) {
  3921. color: rgb(255, 255, 255) !important;
  3922. }
  3923. body.Default [role="button"][data-testid$="-follow"]:hover {
  3924. background-color: rgba(15, 20, 25, 0.1) !important;
  3925. }
  3926. body:is(.Dim, .LightsOut) [role="button"][data-testid$="-follow"]:hover {
  3927. background-color: rgba(255, 255, 255, 0.1) !important;
  3928. }
  3929. `)
  3930. }
  3931. if (config.followButtonStyle == 'themed' && themeColor != null) {
  3932. cssRules.push(`
  3933. /* Following button */
  3934. [role="button"][data-testid$="-unfollow"]:not(:hover) {
  3935. background-color: ${themeColor} !important;
  3936. }
  3937. [role="button"][data-testid$="-unfollow"]:not(:hover) > :is(div, span) {
  3938. color: rgb(255, 255, 255) !important;
  3939. }
  3940. /* Follow button */
  3941. [role="button"][data-testid$="-follow"] {
  3942. border-color: ${themeColor} !important;
  3943. }
  3944. [role="button"][data-testid$="-follow"] > :is(div, span) {
  3945. color: ${themeColor} !important;
  3946. }
  3947. [role="button"][data-testid$="-follow"]:hover {
  3948. background-color: ${themeColor} !important;
  3949. }
  3950. [role="button"][data-testid$="-follow"]:hover > :is(div, span) {
  3951. color: rgb(255, 255, 255) !important;
  3952. }
  3953. `)
  3954. }
  3955. if (mobile) {
  3956. cssRules.push(`
  3957. body.MediaViewer [role="button"][data-testid$="follow"]:not(:hover) {
  3958. border: revert !important;
  3959. background-color: transparent !important;
  3960. }
  3961. body.MediaViewer [role="button"][data-testid$="follow"]:not(:hover) > div {
  3962. color: ${themeColor} !important;
  3963. }
  3964. `)
  3965. }
  3966. }
  3967.  
  3968. $style.textContent = cssRules.map(dedent).join('\n')
  3969. }
  3970. })()
  3971.  
  3972. async function setDefaultSortReplies() {
  3973. if (config.sortReplies == 'relevant') return
  3974.  
  3975. let $sortRepliesIconPath = await getElement(Selectors.SORT_REPLIES_PATH, {
  3976. name: 'sort replies icon',
  3977. stopIf: pageIsNot(currentPage),
  3978. timeout: 3000,
  3979. })
  3980. if (!$sortRepliesIconPath) return
  3981.  
  3982. let $svg = $sortRepliesIconPath.parentElement.parentElement
  3983. let currentSort = $svg.nextElementSibling?.textContent
  3984. log('sortReplies: replies are sorted by', currentSort)
  3985. if (currentSort != getString('MOST_RELEVANT')) return
  3986.  
  3987. function changeSort() {
  3988. if (changingSortReplies) {
  3989. warn('sortReplies: ignoring additonal changeSort() call')
  3990. return
  3991. }
  3992. changingSortReplies = true
  3993. log('sortReplies: clicking Sort replies dropdown', $svg.parentElement.parentElement)
  3994. setTimeout(() => $svg.parentElement.parentElement.click(), 100)
  3995. }
  3996.  
  3997. let $focusedTweet = $svg.closest('div[data-testid="cellInnerDiv"]')
  3998. if ($focusedTweet.parentElement.childElementCount > 1) {
  3999. changeSort()
  4000. return
  4001. }
  4002.  
  4003. pageObservers.push(
  4004. observeElement($focusedTweet.parentElement, () => {
  4005. if ($focusedTweet.parentElement.childElementCount > 2) {
  4006. log('sortReplies: timeline elements added')
  4007. disconnectPageObserver('sortReplies: individual tweet timeline')
  4008. changeSort()
  4009. }
  4010. }, 'sortReplies: individual tweet timeline')
  4011. )
  4012. }
  4013.  
  4014. function getColorScheme() {
  4015. return {
  4016. 'rgb(255, 255, 255)': 'Default',
  4017. 'rgb(21, 32, 43)': 'Dim',
  4018. 'rgb(0, 0, 0)': 'LightsOut',
  4019. }[$body.style.backgroundColor]
  4020. }
  4021.  
  4022. /**
  4023. * @param {HTMLElement} $tweet
  4024. * @param {?{getText?: boolean}} options
  4025. * @returns {import("./types").QuotedTweet}
  4026. */
  4027. function getQuotedTweetDetails($tweet, options = {}) {
  4028. let {getText = false} = options
  4029. let $quotedByLink = /** @type {HTMLAnchorElement} */ ($tweet.querySelector('[data-testid="User-Name"] a'))
  4030. let $quotedTweet = $tweet.querySelector('div[id^="id__"] > div[dir] > span').parentElement.nextElementSibling
  4031. let $userName = $quotedTweet?.querySelector('[data-testid="User-Name"]')
  4032. let quotedBy = $quotedByLink?.pathname?.substring(1)
  4033. let user = $userName?.querySelector('[tabindex="-1"]')?.textContent
  4034. let time = $userName?.querySelector('time')?.dateTime
  4035. if (!getText) return {quotedBy, user, time}
  4036.  
  4037. let $heading = $quotedTweet?.querySelector(':scope > div > div:first-child')
  4038. let $qtText = $heading?.nextElementSibling?.querySelector('[lang]')
  4039. let text = $qtText && Array.from($qtText.childNodes, node => {
  4040. if (node.nodeType == 1) {
  4041. if (node.nodeName == 'IMG') return node.alt
  4042. return node.textContent
  4043. }
  4044. return node.nodeValue
  4045. }).join('')
  4046. return {quotedBy, user, time, text}
  4047. }
  4048.  
  4049. /**
  4050. * Attempts to determine the type of a timeline Tweet given the element with
  4051. * data-testid="tweet" on it, falling back to TWEET if it doesn't appear to be
  4052. * one of the particular types we care about.
  4053. * @param {HTMLElement} $tweet
  4054. * @param {?boolean} checkSocialContext
  4055. * @returns {import("./types").TweetType}
  4056. */
  4057. function getTweetType($tweet, checkSocialContext = false) {
  4058. if ($tweet.closest(Selectors.PROMOTED_TWEET_CONTAINER)) {
  4059. return 'PROMOTED_TWEET'
  4060. }
  4061. // Assume social context tweets are Retweets
  4062. if ($tweet.querySelector('[data-testid="socialContext"]')) {
  4063. if (checkSocialContext) {
  4064. let svgPath = $tweet.querySelector('svg path')?.getAttribute('d') ?? ''
  4065. if (svgPath.startsWith('M7 4.5C7 3.12 8.12 2 9.5 2h5C1')) return 'PINNED_TWEET'
  4066. }
  4067. // Quoted tweets from accounts you blocked or muted are displayed as an
  4068. // <article> with "This Tweet is unavailable."
  4069. if ($tweet.querySelector('article')) {
  4070. return 'UNAVAILABLE_RETWEET'
  4071. }
  4072. // Quoted tweets are preceded by visually-hidden "Quote" text
  4073. if ($tweet.querySelector('div[id^="id__"] > div[dir] > span')?.textContent.includes(getString('QUOTE'))) {
  4074. return 'RETWEETED_QUOTE_TWEET'
  4075. }
  4076. return 'RETWEET'
  4077. }
  4078. // Quoted tweets are preceded by visually-hidden "Quote" text
  4079. if ($tweet.querySelector('div[id^="id__"] > div[dir] > span')?.textContent.includes(getString('QUOTE'))) {
  4080. return 'QUOTE_TWEET'
  4081. }
  4082. // Quoted tweets from accounts you blocked or muted are displayed as an
  4083. // <article> with "This Tweet is unavailable."
  4084. if ($tweet.querySelector('article')) {
  4085. return 'UNAVAILABLE_QUOTE_TWEET'
  4086. }
  4087. return 'TWEET'
  4088. }
  4089.  
  4090. // Add 1 every time this gets broken: 6
  4091. function getVerifiedProps($svg) {
  4092. let propsGetter = (props) => props?.children?.props?.children?.[0]?.[0]?.props
  4093. let $parent = $svg.parentElement.parentElement
  4094. // Verified badge button on the profile screen
  4095. if (isOnProfilePage() && $svg.parentElement.getAttribute('role') == 'button') {
  4096. $parent = $svg.closest('span').parentElement
  4097. }
  4098. // Link variant in "user followed/liked/retweeted" notifications
  4099. else if (isOnNotificationsPage() && $parent.getAttribute('role') == 'link') {
  4100. propsGetter = (props) => {
  4101. let linkChildren = props?.children?.props?.children?.[0]
  4102. return linkChildren?.[linkChildren.length - 1]?.props
  4103. }
  4104. }
  4105. if ($parent.wrappedJSObject) {
  4106. $parent = $parent.wrappedJSObject
  4107. }
  4108. let reactPropsKey = Object.keys($parent).find(key => key.startsWith('__reactProps$'))
  4109. let props = propsGetter($parent[reactPropsKey])
  4110. if (!props) {
  4111. warn('React props not found for', $svg)
  4112. }
  4113. else if (!('isBlueVerified' in props)) {
  4114. warn('isBlueVerified not in React props for', $svg, {props})
  4115. }
  4116. return props
  4117. }
  4118.  
  4119. /**
  4120. * @param {HTMLElement} $popup
  4121. * @returns {{tookAction: boolean, onPopupClosed?: () => void}}
  4122. */
  4123. function handlePopup($popup) {
  4124. let result = {tookAction: false, onPopupClosed: null}
  4125.  
  4126. if (changingSortReplies) {
  4127. let $dialog = /** @type {HTMLElement} */ ($popup.querySelector(`[data-testid="${desktop ? 'HoverCard' : 'sheetDialog'}"]`))
  4128. if ($dialog) {
  4129. let $menuItems = /** @type {NodeListOf<HTMLElement>} */ ($dialog.querySelectorAll('div[role="menuitem"]'))
  4130. if ($menuItems[0].previousElementSibling?.textContent == getString('SORT_REPLIES')) {
  4131. log('sortReplies: changing Sort replies to', config.sortReplies)
  4132. $menuItems[{recent: 1, liked: 2}[config.sortReplies]]?.click()
  4133. } else {
  4134. warn('sortReplies: dialog does not contain "Sort replies" heading')
  4135. }
  4136. result.tookAction = true
  4137. changingSortReplies = false
  4138. return result
  4139. } else {
  4140. warn('sortReplies: could not find Sort replies dialog')
  4141. changingSortReplies = false
  4142. }
  4143. }
  4144.  
  4145. if (desktop && !isDesktopComposeTweetModalOpen && location.pathname.startsWith(PagePaths.COMPOSE_TWEET)) {
  4146. log('compose tweet modal opened')
  4147. isDesktopComposeTweetModalOpen = true
  4148. observeDesktopComposeTweetModal($popup)
  4149. return {
  4150. tookAction: true,
  4151. onPopupClosed() {
  4152. log('compose tweet modal closed')
  4153. isDesktopComposeTweetModalOpen = false
  4154. // The Tweet button will re-render if the modal was opened to edit
  4155. // multiple Tweets on the Home timeline.
  4156. if (config.replaceLogo && isOnHomeTimelinePage()) {
  4157. tweakTweetButton()
  4158. }
  4159. }
  4160. }
  4161. }
  4162.  
  4163. if (desktop && !isDesktopMediaModalOpen && URL_MEDIA_RE.test(location.pathname) && currentPath != location.pathname) {
  4164. log('media modal opened')
  4165. isDesktopMediaModalOpen = true
  4166. observeDesktopModalTimeline($popup)
  4167. return {
  4168. tookAction: true,
  4169. onPopupClosed() {
  4170. log('media modal closed')
  4171. isDesktopMediaModalOpen = false
  4172. disconnectAllModalObservers()
  4173. }
  4174. }
  4175. }
  4176.  
  4177. if (config.replaceLogo) {
  4178. let $retweetDropdownItem = $popup.querySelector('div:is([data-testid="retweetConfirm"], [data-testid="repostConfirm"])')
  4179. if ($retweetDropdownItem) {
  4180. tweakRetweetDropdown($retweetDropdownItem, 'div:is([data-testid="retweetConfirm"], [data-testid="repostConfirm"])', 'RETWEET')
  4181. return {tookAction: true}
  4182. }
  4183.  
  4184. let $unretweetDropdownItem = $popup.querySelector('div:is([data-testid="unretweetConfirm"], [data-testid="unrepostConfirm"])')
  4185. if ($unretweetDropdownItem) {
  4186. tweakRetweetDropdown($unretweetDropdownItem, 'div:is([data-testid="unretweetConfirm"], [data-testid="unrepostConfirm"])', 'UNDO_RETWEET')
  4187. return {tookAction: true}
  4188. }
  4189.  
  4190. let $hoverLabel = $popup.querySelector('span[data-testid="HoverLabel"] > span')
  4191. if ($hoverLabel?.textContent == getString('REPOST')) {
  4192. $hoverLabel.textContent = getString('RETWEET')
  4193. }
  4194. }
  4195.  
  4196. if (isOnListPage()) {
  4197. let $switchSvg = $popup.querySelector(`svg path[d="M3 2h18.61l-3.5 7 3.5 7H5v6H3V2zm2 12h13.38l-2.5-5 2.5-5H5v10z"]`)
  4198. if ($switchSvg) {
  4199. addToggleListRetweetsMenuItem($popup.querySelector(`[role="menuitem"]`))
  4200. return {tookAction: true}
  4201. }
  4202. }
  4203.  
  4204. if (config.mutableQuoteTweets) {
  4205. if (quotedTweet) {
  4206. let $blockMenuItem = /** @type {HTMLElement} */ ($popup.querySelector(Selectors.BLOCK_MENU_ITEM))
  4207. if ($blockMenuItem) {
  4208. addMuteQuotesMenuItems($blockMenuItem)
  4209. result.tookAction = true
  4210. // Clear the quoted tweet when the popup closes
  4211. result.onPopupClosed = () => {
  4212. quotedTweet = null
  4213. }
  4214. } else {
  4215. quotedTweet = null
  4216. }
  4217. }
  4218. }
  4219.  
  4220. if (config.fastBlock) {
  4221. if (blockMenuItemSeen && $popup.querySelector('[data-testid="confirmationSheetConfirm"]')) {
  4222. log('fast blocking')
  4223. ;/** @type {HTMLElement} */ ($popup.querySelector('[data-testid="confirmationSheetConfirm"]')).click()
  4224. result.tookAction = true
  4225. }
  4226. else if ($popup.querySelector(Selectors.BLOCK_MENU_ITEM)) {
  4227. log('preparing for fast blocking')
  4228. blockMenuItemSeen = true
  4229. // Create a nested observer for mobile, as it reuses the popup element
  4230. result.tookAction = !mobile
  4231. } else {
  4232. blockMenuItemSeen = false
  4233. }
  4234. }
  4235.  
  4236. if (config.hideTwitterBlueUpsells) {
  4237. // The "Pin to your profile" menu item is currently the only one which opens
  4238. // a sheet dialog.
  4239. if (pinMenuItemSeen && $popup.querySelector('[data-testid="sheetDialog"]')) {
  4240. log('pin to your profile modal opened')
  4241. $popup.classList.add('PinModal')
  4242. result.tookAction = true
  4243. }
  4244. else if ($popup.querySelector('[data-testid="highlighOnPin"]')) {
  4245. log('preparing to hide Twitter Blue upsell when pinning a tweet')
  4246. pinMenuItemSeen = true
  4247. // Create a nested observer for mobile, as it reuses the popup element
  4248. result.tookAction = !mobile
  4249. } else {
  4250. pinMenuItemSeen = false
  4251. }
  4252. }
  4253.  
  4254. if (config.addAddMutedWordMenuItem) {
  4255. let linkSelector = 'a[href$="/settings"]'
  4256. let $link = /** @type {HTMLElement} */ ($popup.querySelector(linkSelector))
  4257. if ($link) {
  4258. addAddMutedWordMenuItem($link, linkSelector)
  4259. result.tookAction = true
  4260. }
  4261. }
  4262.  
  4263. if (config.twitterBlueChecks != 'ignore') {
  4264. // User typeahead dropdown
  4265. let $typeaheadDropdown = /** @type {HTMLElement} */ ($popup.querySelector('div[id^="typeaheadDropdown"]'))
  4266. if ($typeaheadDropdown) {
  4267. log('typeahead dropdown appeared')
  4268. let observer = observeElement($typeaheadDropdown, () => {
  4269. processBlueChecks($typeaheadDropdown)
  4270. }, 'popup typeahead dropdown')
  4271. return {
  4272. tookAction: true,
  4273. onPopupClosed() {
  4274. log('typeahead dropdown closed')
  4275. observer.disconnect()
  4276. }
  4277. }
  4278. }
  4279.  
  4280. // User hovercard popup
  4281. let $hoverCard = /** @type {HTMLElement} */ ($popup.querySelector('[data-testid="HoverCard"]'))
  4282. if ($hoverCard) {
  4283. result.tookAction = true
  4284. getElement('div[data-testid^="UserAvatar-Container"]', {
  4285. context: $hoverCard,
  4286. name: 'user hovercard contents',
  4287. timeout: 500,
  4288. }).then(($contents) => {
  4289. if (!$contents) return
  4290. // Grok "Profile Summary" button
  4291. let $grokButton = $popup.querySelector('[data-testid="HoverCard"] > div > div > div:last-child:has(> button)')
  4292. if ($grokButton) {
  4293. $grokButton.classList.add('GrokButton')
  4294. }
  4295. processBlueChecks($popup)
  4296. })
  4297. }
  4298. }
  4299.  
  4300. // Verified account popup when you press the check button on a profile page
  4301. if (config.twitterBlueChecks == 'replace' && isOnProfilePage()) {
  4302. if (mobile) {
  4303. let $verificationBadge = /** @type {HTMLElement} */ ($popup.querySelector('[data-testid="sheetDialog"] [data-testid="verificationBadge"]'))
  4304. if ($verificationBadge) {
  4305. result.tookAction = true
  4306. let $headerBlueCheck = document.querySelector(`body.Profile ${Selectors.MOBILE_TIMELINE_HEADER} .tnt_blue_check`)
  4307. if ($headerBlueCheck) {
  4308. blueCheck($verificationBadge)
  4309. }
  4310. }
  4311. } else {
  4312. let $hoverCard = /** @type {HTMLElement} */ ($popup.querySelector('[data-testid="HoverCard"]'))
  4313. if ($hoverCard) {
  4314. result.tookAction = true
  4315. getElement(':scope > div > div > div > svg[data-testid="verificationBadge"]', {
  4316. context: $hoverCard,
  4317. name: 'verified account hovercard verification badge',
  4318. timeout: 500,
  4319. }).then(($verificationBadge) => {
  4320. if (!$verificationBadge) return
  4321.  
  4322. let $headerBlueCheck = document.querySelector(`body.Profile ${Selectors.PRIMARY_COLUMN} > div > div:first-of-type h2 .tnt_blue_check`)
  4323. if (!$headerBlueCheck) return
  4324.  
  4325. // Wait for the hovercard to render its contents
  4326. let popupRenderObserver = observeElement($popup, (mutations) => {
  4327. if (!mutations.length) return
  4328. blueCheck($popup.querySelector('svg[data-testid="verificationBadge"]'))
  4329. popupRenderObserver.disconnect()
  4330. }, 'verified popup render', {childList: true, subtree: true})
  4331. })
  4332. }
  4333. }
  4334. }
  4335.  
  4336. return result
  4337. }
  4338.  
  4339. function isBlueVerified($svg) {
  4340. let props = getVerifiedProps($svg)
  4341. return Boolean(props && props.isBlueVerified && !(
  4342. props.verifiedType || (
  4343. props.affiliateBadgeInfo?.userLabelType == 'BusinessLabel' &&
  4344. props.affiliateBadgeInfo?.description == 'X'
  4345. )
  4346. ))
  4347. }
  4348.  
  4349. /**
  4350. * @returns {import("./types").VerifiedType}
  4351. */
  4352. function getVerifiedType($svg) {
  4353. let props = getVerifiedProps($svg)
  4354. if (props) {
  4355. if (props.affiliateBadgeInfo?.userLabelType == 'BusinessLabel' &&
  4356. props.affiliateBadgeInfo?.description == 'X')
  4357. // Ignore Twitter associated checks
  4358. return null
  4359. if (props.verifiedType == 'Business')
  4360. return 'VERIFIED_ORG'
  4361. if (props.isBlueVerified)
  4362. return 'BLUE'
  4363. }
  4364. return null
  4365. }
  4366.  
  4367. /**
  4368. * Checks if a tweet is preceded by an element creating a vertical reply line.
  4369. * @param {HTMLElement} $tweet
  4370. * @returns {boolean}
  4371. */
  4372. function isReplyToPreviousTweet($tweet) {
  4373. let $replyLine = $tweet.firstElementChild?.firstElementChild?.firstElementChild?.firstElementChild?.firstElementChild?.firstElementChild
  4374. if ($replyLine) {
  4375. return getComputedStyle($replyLine).width == '2px'
  4376. }
  4377. }
  4378.  
  4379. /**
  4380. * @returns {{disconnect()}}
  4381. */
  4382. function onPopup($popup) {
  4383. log('popup appeared', $popup, location.pathname)
  4384.  
  4385. // If handlePopup did something, we don't need to observe nested popups
  4386. let {tookAction, onPopupClosed} = handlePopup($popup)
  4387. if (tookAction) {
  4388. return onPopupClosed ? {disconnect: onPopupClosed} : null
  4389. }
  4390.  
  4391. /** @type {HTMLElement} */
  4392. let $nestedPopup
  4393.  
  4394. let nestedObserver = observeElement($popup, (mutations) => {
  4395. mutations.forEach((mutation) => {
  4396. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $el) => {
  4397. log('nested popup appeared', $el)
  4398. $nestedPopup = $el
  4399. ;({onPopupClosed} = handlePopup($el))
  4400. })
  4401. mutation.removedNodes.forEach((/** @type {HTMLElement} */ $el) => {
  4402. if ($el !== $nestedPopup) return
  4403. if (onPopupClosed) {
  4404. log('cleaning up after nested popup removed')
  4405. onPopupClosed()
  4406. }
  4407. })
  4408. })
  4409. }, 'nested popup observer')
  4410.  
  4411. let disconnect = nestedObserver.disconnect.bind(nestedObserver)
  4412. nestedObserver.disconnect = () => {
  4413. if (onPopupClosed) {
  4414. log('cleaning up after nested popup observer disconnected')
  4415. onPopupClosed()
  4416. }
  4417. disconnect()
  4418. }
  4419.  
  4420. return nestedObserver
  4421. }
  4422.  
  4423. /**
  4424. * @param {HTMLElement} $timeline
  4425. * @param {string} page
  4426. * @param {import("./types").TimelineOptions?} options
  4427. */
  4428. function onTimelineChange($timeline, page, options = {}) {
  4429. let startTime = Date.now()
  4430. let {classifyTweets = true, hideHeadings = true, isUserTimeline = false} = options
  4431.  
  4432. let isOnHomeTimeline = isOnHomeTimelinePage()
  4433. let isOnListTimeline = isOnListPage()
  4434. let isOnProfileTimeline = isOnProfilePage()
  4435. let timelineHasSpecificHandling = isOnHomeTimeline || isOnListTimeline || isOnProfileTimeline
  4436.  
  4437. if (config.twitterBlueChecks != 'ignore' && (isUserTimeline || !timelineHasSpecificHandling)) {
  4438. processBlueChecks($timeline)
  4439. }
  4440.  
  4441. if (isSafari && config.replaceLogo && isOnNotificationsPage()) {
  4442. processTwitterLogos($timeline)
  4443. }
  4444.  
  4445. if (isUserTimeline || !classifyTweets) return
  4446.  
  4447. let itemTypes = {}
  4448. let hiddenItemCount = 0
  4449. let hiddenItemTypes = {}
  4450.  
  4451. /** @type {?boolean} */
  4452. let hidPreviousItem = null
  4453. /** @type {{$item: Element, hideItem?: boolean}[]} */
  4454. let changes = []
  4455.  
  4456. for (let $item of $timeline.children) {
  4457. /** @type {?import("./types").TimelineItemType} */
  4458. let itemType = null
  4459. /** @type {?boolean} */
  4460. let hideItem = null
  4461. /** @type {?HTMLElement} */
  4462. let $tweet = $item.querySelector(Selectors.TWEET)
  4463. /** @type {boolean} */
  4464. let isReply = false
  4465. /** @type {boolean} */
  4466. let isBlueTweet = false
  4467.  
  4468. if ($tweet != null) {
  4469. itemType = getTweetType($tweet, isOnProfileTimeline)
  4470. if (timelineHasSpecificHandling) {
  4471. isReply = isReplyToPreviousTweet($tweet)
  4472. if (isReply && hidPreviousItem != null) {
  4473. hideItem = hidPreviousItem
  4474. } else {
  4475. if (isOnHomeTimeline) {
  4476. hideItem = shouldHideHomeTimelineItem(itemType, page)
  4477. if (config.mutableQuoteTweets && !hideItem && itemType == 'QUOTE_TWEET' && config.hideQuotesFrom.length > 0) {
  4478. let $quotedByLink = /** @type {HTMLAnchorElement} */ ($tweet.querySelector('[data-testid="User-Name"] a'))
  4479. let quotedBy = $quotedByLink?.pathname.substring(1)
  4480. if (quotedBy) {
  4481. hideItem = config.hideQuotesFrom.includes(quotedBy)
  4482. } else {
  4483. warn('hideQuotesFrom: unable to get quote tweet user')
  4484. }
  4485. }
  4486. }
  4487. else if (isOnListTimeline) {
  4488. hideItem = shouldHideListTimelineItem(itemType)
  4489. }
  4490. else if (isOnProfileTimeline) {
  4491. hideItem = shouldHideProfileTimelineItem(itemType)
  4492. }
  4493. }
  4494.  
  4495. if (!hideItem && config.mutableQuoteTweets && (itemType == 'QUOTE_TWEET' || itemType == 'RETWEETED_QUOTE_TWEET')) {
  4496. if (config.mutedQuotes.length > 0) {
  4497. let quotedTweet = getQuotedTweetDetails($tweet)
  4498. hideItem = config.mutedQuotes.some(muted => muted.user == quotedTweet.user && muted.time == quotedTweet.time)
  4499. }
  4500. if (!hideItem) {
  4501. addCaretMenuListenerForQuoteTweet($tweet)
  4502. }
  4503. }
  4504.  
  4505. if (config.twitterBlueChecks != 'ignore') {
  4506. for (let $svg of $tweet.querySelectorAll(Selectors.VERIFIED_TICK)) {
  4507. let isBlueCheck = isBlueVerified($svg)
  4508. if (!isBlueCheck) continue
  4509.  
  4510. blueCheck($svg)
  4511.  
  4512. // Don't count a tweet as blue if the check is in a quoted tweet
  4513. let userProfileLink = $svg.closest('a[role="link"]:not([href^="/i/status"])')
  4514. if (!userProfileLink) continue
  4515.  
  4516. isBlueTweet = true
  4517. }
  4518. }
  4519. }
  4520.  
  4521. if (!hideItem && config.restoreLinkHeadlines) {
  4522. restoreLinkHeadline($tweet)
  4523. }
  4524. }
  4525. else if (!timelineHasSpecificHandling) {
  4526. if ($item.querySelector(':scope > div > div > div > article')) {
  4527. itemType = 'UNAVAILABLE'
  4528. }
  4529. }
  4530.  
  4531. if (!timelineHasSpecificHandling) {
  4532. if (itemType != null) {
  4533. hideItem = shouldHideOtherTimelineItem(itemType)
  4534. }
  4535. }
  4536.  
  4537. // Special handling for non-Tweet timeline items
  4538. if (itemType == null) {
  4539. if ($item.querySelector('[data-testid="inlinePrompt"]')) {
  4540. itemType = 'INLINE_PROMPT'
  4541. hideItem = config.hideInlinePrompts || (
  4542. config.hideTwitterBlueUpsells && Boolean($item.querySelector('a[href^="/i/premium"]')) ||
  4543. config.hideMonetizationNav && Boolean($item.querySelector('a[href="/settings/monetization"]'))
  4544. )
  4545. } else if ($item.querySelector(Selectors.TIMELINE_HEADING)) {
  4546. itemType = 'HEADING'
  4547. hideItem = hideHeadings && config.hideWhoToFollowEtc
  4548. }
  4549. }
  4550.  
  4551. if (debug && itemType != null) {
  4552. $item.firstElementChild.dataset.itemType = `${itemType}${isReply ? ' / REPLY' : ''}${isBlueTweet ? ' / BLUE' : ''}`
  4553. }
  4554.  
  4555. // Assume a non-identified item following an identified item is related
  4556. if (itemType == null && hidPreviousItem != null) {
  4557. hideItem = hidPreviousItem
  4558. itemType = 'SUBSEQUENT_ITEM'
  4559. }
  4560.  
  4561. if (itemType != null) {
  4562. itemTypes[itemType] ||= 0
  4563. itemTypes[itemType]++
  4564. }
  4565.  
  4566. if (hideItem) {
  4567. hiddenItemCount++
  4568. hiddenItemTypes[itemType] ||= 0
  4569. hiddenItemTypes[itemType]++
  4570. }
  4571.  
  4572. if (hideItem != null && $item.firstElementChild) {
  4573. let hidden = $item.firstElementChild.classList.contains('HiddenTweet')
  4574. if (hidden != hideItem) {
  4575. changes.push({$item, hideItem})
  4576. }
  4577. }
  4578.  
  4579. hidPreviousItem = hideItem
  4580. }
  4581.  
  4582. for (let change of changes) {
  4583. change.$item.firstElementChild.classList.toggle('HiddenTweet', change.hideItem)
  4584. }
  4585.  
  4586. log(
  4587. `processed ${$timeline.children.length} timeline item${s($timeline.children.length)} in ${Date.now() - startTime}ms`,
  4588. itemTypes, `hid ${hiddenItemCount}`, hiddenItemTypes
  4589. )
  4590. }
  4591.  
  4592. /**
  4593. * @param {HTMLElement} $timeline
  4594. * @param {import("./types").IndividualTweetTimelineOptions} options
  4595. */
  4596. function onIndividualTweetTimelineChange($timeline, options) {
  4597. let startTime = Date.now()
  4598.  
  4599. let itemTypes = {}
  4600. let hiddenItemCount = 0
  4601. let hiddenItemTypes = {}
  4602.  
  4603. /** @type {?boolean} */
  4604. let hidPreviousItem = null
  4605. /** @type {boolean} */
  4606. let hideAllSubsequentItems = false
  4607. /** @type {string} */
  4608. let opScreenName = /^\/([a-zA-Z\d_]{1,20})\//.exec(location.pathname)[1].toLowerCase()
  4609. /** @type {{$item: Element, hideItem?: boolean}[]} */
  4610. let changes = []
  4611. /** @type {import("./types").UserInfoObject} */
  4612. let userInfo = getUserInfo()
  4613. /** @type {?HTMLElement} */
  4614. let $focusedTweet
  4615.  
  4616. for (let $item of $timeline.children) {
  4617. /** @type {?import("./types").TimelineItemType} */
  4618. let itemType = null
  4619. /** @type {?boolean} */
  4620. let hideItem = null
  4621. /** @type {?HTMLElement} */
  4622. let $tweet = $item.querySelector(Selectors.TWEET)
  4623. /** @type {boolean} */
  4624. let isFocusedTweet = false
  4625. /** @type {boolean} */
  4626. let isReply = false
  4627. /** @type {import("./types").VerifiedType} */
  4628. let tweetVerifiedType = null
  4629. /** @type {?string} */
  4630. let screenName = null
  4631.  
  4632. if (hideAllSubsequentItems) {
  4633. hideItem = true
  4634. itemType = 'DISCOVER_MORE_TWEET'
  4635. }
  4636. else if ($tweet != null) {
  4637. isFocusedTweet = $tweet.tabIndex == -1
  4638. isReply = isReplyToPreviousTweet($tweet)
  4639. if (isFocusedTweet) {
  4640. itemType = 'FOCUSED_TWEET'
  4641. hideItem = false
  4642. $focusedTweet = $tweet
  4643. } else {
  4644. itemType = getTweetType($tweet)
  4645. if (isReply && hidPreviousItem != null) {
  4646. hideItem = hidPreviousItem
  4647. } else {
  4648. hideItem = shouldHideIndividualTweetTimelineItem(itemType)
  4649. }
  4650. }
  4651.  
  4652. if (!hideItem && config.restoreLinkHeadlines) {
  4653. restoreLinkHeadline($tweet)
  4654. }
  4655.  
  4656. if (!hideItem && (config.twitterBlueChecks != 'ignore' || config.hideTwitterBlueReplies)) {
  4657. for (let $svg of $tweet.querySelectorAll(Selectors.VERIFIED_TICK)) {
  4658. let verifiedType = getVerifiedType($svg)
  4659. if (!verifiedType) continue
  4660.  
  4661. if (config.twitterBlueChecks != 'ignore' && verifiedType == 'BLUE') {
  4662. blueCheck($svg)
  4663. }
  4664.  
  4665. // Don't count a tweet as verified if the check is in a quoted tweet
  4666. let $userProfileLink = /** @type {HTMLAnchorElement} */ ($svg.closest('a[role="link"]:not([href^="/i/status"])'))
  4667. if (!$userProfileLink) continue
  4668.  
  4669. tweetVerifiedType = verifiedType
  4670. screenName = $userProfileLink.href.split('/').pop()
  4671. }
  4672.  
  4673. // Replies to the focused tweet don't have the reply indicator
  4674. if (tweetVerifiedType && !isFocusedTweet && !isReply && screenName.toLowerCase() != opScreenName) {
  4675. itemType = `${tweetVerifiedType}_REPLY`
  4676. if (!hideItem) {
  4677. let user = userInfo[screenName]
  4678. let shouldHideBasedOnVerifiedType = config.hideTwitterBlueReplies && (
  4679. tweetVerifiedType == 'BLUE' ||
  4680. tweetVerifiedType == 'VERIFIED_ORG' && !config.showBlueReplyVerifiedAccounts
  4681. )
  4682. hideItem = shouldHideBasedOnVerifiedType && (user == null || !(
  4683. user.following && !config.hideBlueReplyFollowing ||
  4684. user.followedBy && !config.hideBlueReplyFollowedBy ||
  4685. config.showBlueReplyFollowersCount && user.followersCount >= Number(config.showBlueReplyFollowersCountAmount)
  4686. ))
  4687. }
  4688. }
  4689. }
  4690. }
  4691. else {
  4692. let $article = $item.querySelector('article')
  4693. if ($article) {
  4694. // Deleted or private, unless…
  4695. itemType = 'UNAVAILABLE'
  4696. let $button = $article.querySelector('[role="button"]')
  4697. if ($button) {
  4698. if ($button.textContent == getString('SHOW')) {
  4699. itemType = 'SHOW_MORE'
  4700. }
  4701. else if ($button.textContent == getString('VIEW')) {
  4702. // "This Tweet is from an account you (blocked|muted)." with a View button
  4703. hideItem = config.hideUnavailableQuoteTweets
  4704. }
  4705. }
  4706. else if ($article.textContent == getString('POST_UNAVAILABLE')) {
  4707. // Likely blocked or muted
  4708. hideItem = config.hideUnavailableQuoteTweets
  4709. }
  4710. } else {
  4711. // We need to identify "Show more replies" so it doesn't get hidden if the
  4712. // item immediately before it was hidden.
  4713. let $button = $item.querySelector('button[role="button"]')
  4714. if ($button) {
  4715. if ($button?.textContent == getString('SHOW_MORE_REPLIES')) {
  4716. itemType = 'SHOW_MORE'
  4717. }
  4718. } else {
  4719. let $heading = $item.querySelector(Selectors.TIMELINE_HEADING)
  4720. if ($heading) {
  4721. // Discover More headings have a description next to them
  4722. if ($heading.nextElementSibling &&
  4723. $heading.nextElementSibling.tagName == 'DIV' &&
  4724. $heading.nextElementSibling.getAttribute('dir') != null) {
  4725. itemType = 'DISCOVER_MORE_HEADING'
  4726. hideItem = config.hideMoreTweets
  4727. hideAllSubsequentItems = config.hideMoreTweets
  4728. } else {
  4729. itemType = 'HEADING'
  4730. }
  4731. }
  4732. }
  4733. }
  4734. }
  4735.  
  4736. if (debug && itemType != null) {
  4737. $item.firstElementChild.dataset.itemType = `${itemType}${isReply ? ' / REPLY' : ''}`
  4738. }
  4739.  
  4740. // Assume a non-identified item following an identified item is related
  4741. if (itemType == null && hidPreviousItem != null) {
  4742. hideItem = hidPreviousItem
  4743. itemType = 'SUBSEQUENT_ITEM'
  4744. }
  4745.  
  4746. if (itemType != null) {
  4747. itemTypes[itemType] ||= 0
  4748. itemTypes[itemType]++
  4749. }
  4750.  
  4751. if (hideItem) {
  4752. hiddenItemCount++
  4753. hiddenItemTypes[itemType] ||= 0
  4754. hiddenItemTypes[itemType]++
  4755. }
  4756.  
  4757. if (isFocusedTweet) {
  4758. // Tweets prior to the focused tweet should never be hidden
  4759. changes = []
  4760. hiddenItemCount = 0
  4761. hiddenItemTypes = {}
  4762. }
  4763. else if (hideItem != null && $item.firstElementChild) {
  4764. let hidden = $item.firstElementChild.classList.contains('HiddenTweet')
  4765. if (hidden != hideItem) {
  4766. changes.push({$item, hideItem})
  4767. }
  4768. }
  4769.  
  4770. hidPreviousItem = hideItem
  4771. }
  4772.  
  4773. for (let change of changes) {
  4774. change.$item.firstElementChild.classList.toggle('HiddenTweet', change.hideItem)
  4775. }
  4776.  
  4777. tweakFocusedTweet($focusedTweet, options)
  4778.  
  4779. log(
  4780. `processed ${$timeline.children.length} thread item${s($timeline.children.length)} in ${Date.now() - startTime}ms`,
  4781. itemTypes, `hid ${hiddenItemCount}`, hiddenItemTypes
  4782. )
  4783. }
  4784.  
  4785. /**
  4786. * Title format (including notification count):
  4787. * - LTR: (3) ${title} / X
  4788. * - RTL: (3) X \ ${title}
  4789. * @param {string} title
  4790. */
  4791. function onTitleChange(title) {
  4792. log('title changed', {title, path: location.pathname})
  4793.  
  4794. if (checkforDisabledHomeTimeline()) return
  4795.  
  4796. // Ignore leading notification counts in titles
  4797. let notificationCount = ''
  4798. if (TITLE_NOTIFICATION_RE.test(title)) {
  4799. notificationCount = TITLE_NOTIFICATION_RE.exec(title)[0]
  4800. title = title.replace(TITLE_NOTIFICATION_RE, '')
  4801. }
  4802.  
  4803. if (config.replaceLogo && Boolean(notificationCount) != Boolean(currentNotificationCount)) {
  4804. observeFavicon.updatePip(Boolean(notificationCount))
  4805. }
  4806.  
  4807. let homeNavigationWasUsed = homeNavigationIsBeingUsed
  4808. homeNavigationIsBeingUsed = false
  4809.  
  4810. if (title == 'X' || title == getString('TWITTER')) {
  4811. // Mobile uses "Twitter" when viewing media - we need to let these process
  4812. // so the next page will be re-processed when the media is closed.
  4813. if (mobile && (URL_MEDIA_RE.test(location.pathname) || URL_MEDIAVIEWER_RE.test(location.pathname))) {
  4814. log('viewing media on mobile')
  4815. }
  4816. // Going to the root Settings page on desktop when the sidebar is hidden
  4817. // sets an empty title.
  4818. else if (desktop && location.pathname == '/settings' && currentPath != '/settings') {
  4819. log('viewing root Settings page')
  4820. }
  4821. else if (location.pathname.startsWith(PagePaths.BOOKMARKS) && !currentPath.startsWith(PagePaths.BOOKMARKS)) {
  4822. log('viewing Bookmarks page')
  4823. }
  4824. // Ignore Flash of Uninitialised Title when navigating to a page for the
  4825. // first time.
  4826. else {
  4827. log('ignoring Flash of Uninitialised Title')
  4828. return
  4829. }
  4830. }
  4831.  
  4832. // Remove " / Twitter" or "Twitter \ " from the title
  4833. let newPage = title
  4834. if (newPage != 'X' && newPage != getString('TWITTER')) {
  4835. newPage = title.slice(...ltr ? [0, title.lastIndexOf('/') - 1] : [title.indexOf('\\') + 2])
  4836. }
  4837.  
  4838. let hasDesktopModalBeenOpenedOrClosed = desktop && (
  4839. // Timeline settings dialog opened
  4840. location.pathname == PagePaths.TIMELINE_SETTINGS ||
  4841. // Timeline settings dialog closed
  4842. currentPath == PagePaths.TIMELINE_SETTINGS ||
  4843. // Media modal opened
  4844. URL_MEDIA_RE.test(location.pathname) ||
  4845. // Media modal closed
  4846. URL_MEDIA_RE.test(currentPath) ||
  4847. // "Send via Direct Message" dialog opened
  4848. location.pathname == PagePaths.COMPOSE_MESSAGE ||
  4849. // "Send via Direct Message" dialog closed
  4850. currentPath == PagePaths.COMPOSE_MESSAGE ||
  4851. // Compose Tweet dialog opened
  4852. location.pathname == PagePaths.COMPOSE_TWEET ||
  4853. // Compose Tweet dialog closed
  4854. currentPath == PagePaths.COMPOSE_TWEET
  4855. )
  4856.  
  4857. if (newPage == currentPage) {
  4858. // XXX After initial migration to x.com, Twitter has a bug where viewing a
  4859. // user profile makes the title sticky, so we also check the pathname.
  4860. // Remove this when we can, as unexpected modals on desktop will cause
  4861. // the underlying page to be reprocessed incorrectly.
  4862. if (location.pathname != currentPath && !hasDesktopModalBeenOpenedOrClosed) {
  4863. warn('Twitter bug: title is the same but path has changed', {from: currentPath, to: location.pathname})
  4864. }
  4865. else {
  4866. log(`ignoring duplicate title change`)
  4867. currentNotificationCount = notificationCount
  4868. return
  4869. }
  4870. }
  4871.  
  4872. // Search terms are shown in the title
  4873. if (currentPath == PagePaths.SEARCH && location.pathname == PagePaths.SEARCH) {
  4874. log('ignoring title change on Search page')
  4875. currentNotificationCount = notificationCount
  4876. return
  4877. }
  4878.  
  4879. // On desktop, stay on the separated tweets timeline when…
  4880. if (desktop && currentPage == separatedTweetsTimelineTitle &&
  4881. // …the title has changed back to the Home timeline…
  4882. (newPage == getString('HOME')) &&
  4883. // …the Home nav link or Following / Home header _wasn't_ clicked and…
  4884. !homeNavigationWasUsed &&
  4885. (
  4886. // …a modal which changes the pathname has been opened or closed.
  4887. hasDesktopModalBeenOpenedOrClosed ||
  4888. // …the notification count in the title changed.
  4889. notificationCount != currentNotificationCount
  4890. )) {
  4891. log('ignoring title change on separated tweets timeline')
  4892. currentNotificationCount = notificationCount
  4893. currentPath = location.pathname
  4894. setTitle(separatedTweetsTimelineTitle)
  4895. return
  4896. }
  4897.  
  4898. // Restore display of the separated tweets timelne if it's the last one we
  4899. // saw, and the user navigated back home without using the Home navigation
  4900. // item.
  4901. if (location.pathname == PagePaths.HOME &&
  4902. currentPath != PagePaths.HOME &&
  4903. !homeNavigationWasUsed &&
  4904. lastHomeTimelineTitle != null &&
  4905. separatedTweetsTimelineTitle != null &&
  4906. lastHomeTimelineTitle == separatedTweetsTimelineTitle) {
  4907. log('restoring display of the separated tweets timeline')
  4908. currentNotificationCount = notificationCount
  4909. currentPath = location.pathname
  4910. setTitle(separatedTweetsTimelineTitle)
  4911. return
  4912. }
  4913.  
  4914. // Assumption: all non-FOUT, non-duplicate title changes are navigation, which
  4915. // need the page to be re-processed.
  4916.  
  4917. currentPage = newPage
  4918. currentNotificationCount = notificationCount
  4919. currentPath = location.pathname
  4920.  
  4921. if (isOnHomeTimelinePage()) {
  4922. lastHomeTimelineTitle = currentPage
  4923. }
  4924.  
  4925. log('processing new page')
  4926.  
  4927. processCurrentPage()
  4928. }
  4929.  
  4930. /**
  4931. * Processes all Twitter Blue checks inside an element.
  4932. * @param {HTMLElement} $el
  4933. */
  4934. function processBlueChecks($el) {
  4935. for (let $svg of $el.querySelectorAll(`${Selectors.VERIFIED_TICK}:not(.tnt_blue_check)`)) {
  4936. if (isBlueVerified($svg)) {
  4937. blueCheck($svg)
  4938. }
  4939. }
  4940. }
  4941.  
  4942. /**
  4943. * Processes all Twitter logos inside an element.
  4944. */
  4945. function processTwitterLogos($el) {
  4946. for (let $svgPath of $el.querySelectorAll(Selectors.X_LOGO_PATH)) {
  4947. twitterLogo($svgPath)
  4948. }
  4949. }
  4950.  
  4951. function processCurrentPage() {
  4952. if (pageObservers.length > 0) {
  4953. log(
  4954. `disconnecting ${pageObservers.length} page observer${s(pageObservers.length)}`,
  4955. pageObservers.map(observer => observer['name'])
  4956. )
  4957. pageObservers.forEach(observer => observer.disconnect())
  4958. pageObservers = []
  4959. }
  4960.  
  4961. // Hooks for styling pages
  4962. $body.classList.toggle('Bookmarks', isOnBookmarksPage())
  4963. $body.classList.toggle('Community', isOnCommunityPage())
  4964. $body.classList.toggle('Explore', isOnExplorePage())
  4965. $body.classList.toggle('HideSidebar', shouldHideSidebar())
  4966. $body.classList.toggle('List', isOnListPage())
  4967. $body.classList.toggle('HomeTimeline', isOnHomeTimelinePage())
  4968. $body.classList.toggle('Notifications', isOnNotificationsPage())
  4969. $body.classList.toggle('Profile', isOnProfilePage())
  4970. if (!isOnProfilePage()) {
  4971. $body.classList.remove('OwnProfile', 'PremiumProfile')
  4972. }
  4973. $body.classList.toggle('ProfileFollows', isOnFollowListPage())
  4974. if (!isOnFollowListPage()) {
  4975. $body.classList.remove('Subscriptions')
  4976. }
  4977. $body.classList.toggle('QuoteTweets', isOnQuoteTweetsPage())
  4978. $body.classList.toggle('Tweet', isOnIndividualTweetPage())
  4979. $body.classList.toggle('Search', isOnSearchPage())
  4980. $body.classList.toggle('Settings', isOnSettingsPage())
  4981. $body.classList.toggle('MobileMedia', mobile && URL_MEDIA_RE.test(location.pathname))
  4982. $body.classList.toggle('MediaViewer', mobile && URL_MEDIAVIEWER_RE.test(location.pathname))
  4983. $body.classList.remove('SeparatedTweets')
  4984.  
  4985. if (desktop) {
  4986. let shouldObserveSidebarForConfig = (
  4987. config.twitterBlueChecks != 'ignore' ||
  4988. config.fullWidthContent ||
  4989. config.hideExploreNav && config.hideExploreNavWithSidebar
  4990. )
  4991. if (shouldObserveSidebarForConfig && !isOnMessagesPage() && !isOnSettingsPage()) {
  4992. observeSidebar()
  4993. } else {
  4994. $body.classList.remove('Sidebar')
  4995. }
  4996. if (isSafari && config.replaceLogo) {
  4997. tweakDesktopLogo()
  4998. }
  4999. }
  5000.  
  5001. if (isSafari && config.replaceLogo) {
  5002. tweakHomeIcon()
  5003. }
  5004.  
  5005. if (config.twitterBlueChecks != 'ignore' && (isOnSearchPage() || isOnExplorePage())) {
  5006. observeSearchForm()
  5007. }
  5008.  
  5009. if (isOnHomeTimelinePage()) {
  5010. tweakHomeTimelinePage()
  5011. }
  5012. else {
  5013. removeMobileTimelineHeaderElements()
  5014. }
  5015.  
  5016. if (isOnProfilePage()) {
  5017. tweakProfilePage()
  5018. }
  5019. else if (isOnFollowListPage()) {
  5020. tweakFollowListPage()
  5021. }
  5022. else if (isOnIndividualTweetPage()) {
  5023. tweakIndividualTweetPage()
  5024. }
  5025. else if (isOnNotificationsPage()) {
  5026. tweakNotificationsPage()
  5027. }
  5028. else if (isOnSearchPage()) {
  5029. tweakSearchPage()
  5030. }
  5031. else if (URL_TWEET_ENGAGEMENT_RE.test(currentPath)) {
  5032. tweakTweetEngagementPage()
  5033. }
  5034. else if (isOnListPage()) {
  5035. tweakListPage()
  5036. }
  5037. else if (isOnExplorePage()) {
  5038. tweakExplorePage()
  5039. }
  5040. else if (isOnBookmarksPage()) {
  5041. tweakBookmarksPage()
  5042. }
  5043. else if (isOnCommunitiesPage()) {
  5044. tweakCommunitiesPage()
  5045. }
  5046. else if (isOnCommunityPage()) {
  5047. tweakCommunityPage()
  5048. }
  5049. else if (isOnCommunityMembersPage()) {
  5050. tweakCommunityMembersPage()
  5051. }
  5052. else if (isOnDisplaySettingsPage() || isOnAccessibilitySettingsPage()) {
  5053. tweakDisplaySettingsPage()
  5054. }
  5055.  
  5056. // On mobile, these are pages instead of modals
  5057. if (mobile) {
  5058. if (currentPath == PagePaths.COMPOSE_TWEET) {
  5059. tweakMobileComposeTweetPage()
  5060. }
  5061. else if (URL_MEDIAVIEWER_RE.test(currentPath)) {
  5062. tweakMobileMediaViewerPage()
  5063. }
  5064. }
  5065. }
  5066.  
  5067. /**
  5068. * The mobile version of Twitter reuses heading elements between screens, so we
  5069. * always remove any elements which could be there from the previous page and
  5070. * re-add them later when needed.
  5071. */
  5072. function removeMobileTimelineHeaderElements() {
  5073. if (mobile) {
  5074. document.querySelector('#tnt_separated_tweets_tab')?.remove()
  5075. }
  5076. }
  5077.  
  5078. /**
  5079. * @param {HTMLElement} $tweet
  5080. */
  5081. function restoreLinkHeadline($tweet) {
  5082. let $link = /** @type {HTMLElement} */ ($tweet.querySelector('div[data-testid="card.layoutLarge.media"] > a[rel][aria-label]'))
  5083. if ($link && !$link.dataset.headlineRestored) {
  5084. let [site, ...rest] = $link.getAttribute('aria-label').split(' ')
  5085. let headline = rest.join(' ')
  5086. $link.lastElementChild?.classList.add('tnt_overlay_headline')
  5087. $link.insertAdjacentHTML('beforeend', `<div class="tnt_link_headline ${fontFamilyRule?.selectorText?.replace('.', '') || 'tnt_font_family'}" style="border-top: 1px solid var(--border-color); padding: 14px;">
  5088. <div style="color: var(--color); margin-bottom: 2px;">${site}</div>
  5089. <div style="color: var(--color-emphasis)">${headline}</div>
  5090. </div>`)
  5091. $link.dataset.headlineRestored = 'true'
  5092. }
  5093. }
  5094.  
  5095. /**
  5096. * @param {HTMLElement} $focusedTweet
  5097. */
  5098. function restoreTweetInteractionsLinks($focusedTweet) {
  5099. if (!config.restoreQuoteTweetsLink && !config.restoreOtherInteractionLinks) return
  5100.  
  5101. let [tweetLink, tweetId] = location.pathname.match(/^\/[a-zA-Z\d_]{1,20}\/status\/(\d+)/) ?? []
  5102. let tweetInfo = getTweetInfo(tweetId)
  5103. log('focused tweet', {tweetLink, tweetId, tweetInfo})
  5104. if (!tweetInfo) return
  5105.  
  5106. let shouldDisplayLinks = (
  5107. (config.restoreQuoteTweetsLink && tweetInfo.quote_count > 0) ||
  5108. (config.restoreOtherInteractionLinks && (tweetInfo.retweet_count > 0 || tweetInfo.favorite_count > 0))
  5109. )
  5110. let $existingLinks = $focusedTweet.querySelector('#tntInteractionLinks')
  5111. if (!shouldDisplayLinks || $existingLinks) {
  5112. if (!shouldDisplayLinks) $existingLinks?.remove()
  5113. return
  5114. }
  5115.  
  5116. let $group = $focusedTweet.querySelector('[role="group"][id^="id__"]')
  5117. if (!$group) return warn('focused tweet action bar not found')
  5118.  
  5119. $group.parentElement.insertAdjacentHTML('beforebegin', `
  5120. <div id="tntInteractionLinks">
  5121. <div class="${fontFamilyRule?.selectorText?.replace('.', '') || 'tnt_font_family'}" style="padding: 16px 4px; border-top: 1px solid var(--border-color); display: flex; gap: 20px;">
  5122. ${tweetInfo.quote_count > 0 ? `<a id="tntQuoteTweetsLink" class="quoteTweets" href="${tweetLink}/quotes" dir="auto" role="link">
  5123. <span id="tntQuoteTweetCount">
  5124. ${Intl.NumberFormat(lang, {notation: tweetInfo.quote_count < 10000 ? 'standard' : 'compact', compactDisplay: 'short'}).format(tweetInfo.quote_count)}
  5125. </span>
  5126. <span>${getString(tweetInfo.quote_count == 1 ? (config.replaceLogo ? 'QUOTE_TWEET' : 'QUOTE') : (config.replaceLogo ? 'QUOTE_TWEETS' : 'QUOTES'))}</span>
  5127. </a>` : ''}
  5128. ${tweetInfo.retweet_count > 0 ? `<a id="tntRetweetsLink" data-tab="2" href="${tweetLink}/retweets" dir="auto" role="link">
  5129. <span>${getString(config.replaceLogo ? 'RETWEETS' : 'REPOSTS')}</span>
  5130. </a>` : ''}
  5131. ${tweetInfo.favorite_count > 0 ? `<a id="tntLikesLink" data-tab="3" href="${tweetLink}/likes" dir="auto" role="link">
  5132. <span>${getString('LIKES')}</span>
  5133. </a>` : ''}
  5134. </div>
  5135. </div>
  5136. `)
  5137.  
  5138. let links = /** @type {NodeListOf<HTMLAnchorElement>} */ ($focusedTweet.querySelectorAll('#tntInteractionLinks a'))
  5139. links.forEach(($link) => {
  5140. $link.addEventListener('click', async (e) => {
  5141. let $caret = /** @type {HTMLElement} */ ($focusedTweet.querySelector('[data-testid="caret"]'))
  5142. if (!$caret) return warn('focused tweet menu caret not found')
  5143.  
  5144. log('clicking "View post engagements" menu item')
  5145. e.preventDefault()
  5146. $caret.click()
  5147. let $tweetEngagements = await getElement('#layers a[data-testid="tweetEngagements"]', {
  5148. name: 'View post engagements menu item',
  5149. stopIf: pageIsNot(currentPage),
  5150. timeout: 500,
  5151. })
  5152. if ($tweetEngagements) {
  5153. tweetInteractionsTab = $link.dataset.tab || null
  5154. $tweetEngagements.click()
  5155. } else {
  5156. warn('falling back to full page refresh')
  5157. location.href = $link.href
  5158. }
  5159. })
  5160. })
  5161. }
  5162.  
  5163. /**
  5164. * Sets the page name in <title>, retaining any current notification count.
  5165. * @param {string} page
  5166. */
  5167. function setTitle(page) {
  5168. let name = config.replaceLogo ? getString('TWITTER') : 'X'
  5169. document.title = ltr ? (
  5170. `${currentNotificationCount}${page} / ${name}`
  5171. ) : (
  5172. `${currentNotificationCount}${name} \\ ${page}`
  5173. )
  5174. }
  5175.  
  5176. /**
  5177. * @param {import("./types").TimelineItemType} type
  5178. * @returns {boolean}
  5179. */
  5180. function shouldHideIndividualTweetTimelineItem(type) {
  5181. switch (type) {
  5182. case 'QUOTE_TWEET':
  5183. case 'RETWEET':
  5184. case 'RETWEETED_QUOTE_TWEET':
  5185. case 'TWEET':
  5186. return false
  5187. case 'UNAVAILABLE_QUOTE_TWEET':
  5188. case 'UNAVAILABLE_RETWEET':
  5189. return config.hideUnavailableQuoteTweets
  5190. default:
  5191. return true
  5192. }
  5193. }
  5194.  
  5195. /**
  5196. * @param {import("./types").TimelineItemType} type
  5197. * @returns {boolean}
  5198. */
  5199. function shouldHideListTimelineItem(type) {
  5200. switch (type) {
  5201. case 'RETWEET':
  5202. case 'RETWEETED_QUOTE_TWEET':
  5203. return config.listRetweets == 'hide'
  5204. case 'UNAVAILABLE_QUOTE_TWEET':
  5205. return config.hideUnavailableQuoteTweets
  5206. case 'UNAVAILABLE_RETWEET':
  5207. return config.hideUnavailableQuoteTweets || config.listRetweets == 'hide'
  5208. default:
  5209. return false
  5210. }
  5211. }
  5212.  
  5213. /**
  5214. * @param {import("./types").TimelineItemType} type
  5215. * @param {string} page
  5216. * @returns {boolean}
  5217. */
  5218. function shouldHideHomeTimelineItem(type, page) {
  5219. switch (type) {
  5220. case 'QUOTE_TWEET':
  5221. return shouldHideSharedTweet(config.quoteTweets, page)
  5222. case 'RETWEET':
  5223. return selectedHomeTabIndex >= 2 ? config.listRetweets == 'hide' : shouldHideSharedTweet(config.retweets, page)
  5224. case 'RETWEETED_QUOTE_TWEET':
  5225. return selectedHomeTabIndex >= 2 ? (
  5226. config.listRetweets == 'hide'
  5227. ) : (
  5228. shouldHideSharedTweet(config.retweets, page) || shouldHideSharedTweet(config.quoteTweets, page)
  5229. )
  5230. case 'TWEET':
  5231. return page == separatedTweetsTimelineTitle
  5232. case 'UNAVAILABLE_QUOTE_TWEET':
  5233. return config.hideUnavailableQuoteTweets || shouldHideSharedTweet(config.quoteTweets, page)
  5234. case 'UNAVAILABLE_RETWEET':
  5235. return config.hideUnavailableQuoteTweets || selectedHomeTabIndex >= 2 ? config.listRetweets == 'hide' : shouldHideSharedTweet(config.retweets, page)
  5236. default:
  5237. return true
  5238. }
  5239. }
  5240.  
  5241. /**
  5242. * @param {import("./types").TimelineItemType} type
  5243. * @returns {boolean}
  5244. */
  5245. function shouldHideProfileTimelineItem(type) {
  5246. switch (type) {
  5247. case 'PINNED_TWEET':
  5248. case 'QUOTE_TWEET':
  5249. case 'TWEET':
  5250. return false
  5251. case 'RETWEET':
  5252. case 'RETWEETED_QUOTE_TWEET':
  5253. return config.hideProfileRetweets
  5254. case 'UNAVAILABLE_QUOTE_TWEET':
  5255. return config.hideUnavailableQuoteTweets
  5256. default:
  5257. return true
  5258. }
  5259. }
  5260.  
  5261. /**
  5262. * @param {import("./types").TimelineItemType} type
  5263. * @returns {boolean}
  5264. */
  5265. function shouldHideOtherTimelineItem(type) {
  5266. switch (type) {
  5267. case 'QUOTE_TWEET':
  5268. case 'RETWEET':
  5269. case 'RETWEETED_QUOTE_TWEET':
  5270. case 'TWEET':
  5271. case 'UNAVAILABLE':
  5272. case 'UNAVAILABLE_QUOTE_TWEET':
  5273. case 'UNAVAILABLE_RETWEET':
  5274. return false
  5275. default:
  5276. return true
  5277. }
  5278. }
  5279.  
  5280. /**
  5281. * @param {import("./types").SharedTweetsConfig} config
  5282. * @param {string} page
  5283. * @returns {boolean}
  5284. */
  5285. function shouldHideSharedTweet(config, page) {
  5286. switch (config) {
  5287. case 'hide': return true
  5288. case 'ignore': return page == separatedTweetsTimelineTitle
  5289. case 'separate': return page != separatedTweetsTimelineTitle
  5290. }
  5291. }
  5292.  
  5293. async function tweakBookmarksPage() {
  5294. if (config.twitterBlueChecks != 'ignore' || config.restoreLinkHeadlines) {
  5295. observeTimeline(currentPage)
  5296. }
  5297. }
  5298.  
  5299. async function tweakExplorePage() {
  5300. if (!config.hideExplorePageContents) return
  5301.  
  5302. let $searchInput = await getElement('input[data-testid="SearchBox_Search_Input"]', {
  5303. name: 'explore page search input',
  5304. stopIf: () => !isOnExplorePage(),
  5305. })
  5306. if (!$searchInput) return
  5307.  
  5308. log('focusing search input')
  5309. $searchInput.focus()
  5310.  
  5311. if (mobile) {
  5312. // The back button appears after the search input is focused on mobile. When
  5313. // you tap it or otherwise navigate back, it's replaced with the slide-out
  5314. // menu button and Explore page contents are shown - we want to skip that.
  5315. let $backButton = await getElement('div[data-testid="app-bar-back"]', {
  5316. name: 'back button',
  5317. stopIf: () => !isOnExplorePage(),
  5318. })
  5319. if (!$backButton) return
  5320.  
  5321. pageObservers.push(
  5322. observeElement($backButton.parentElement, (mutations) => {
  5323. mutations.forEach((mutation) => {
  5324. mutation.addedNodes.forEach((/** @type {HTMLElement} */ $el) => {
  5325. if ($el.querySelector('[data-testid="DashButton_ProfileIcon_Link"]')) {
  5326. log('slide-out menu button appeared, going back to skip Explore page')
  5327. history.go(-2)
  5328. }
  5329. })
  5330. })
  5331. }, 'back button parent')
  5332. )
  5333. }
  5334. }
  5335.  
  5336. function tweakCommunitiesPage() {
  5337. observeTimeline(currentPage)
  5338. }
  5339.  
  5340. function tweakCommunityPage() {
  5341. if (config.twitterBlueChecks != 'ignore') {
  5342. observeTimeline(currentPage, {
  5343. classifyTweets: false,
  5344. isTabbed: true,
  5345. tabbedTimelineContainerSelector: `${Selectors.PRIMARY_COLUMN} > div > div:last-child`,
  5346. onTimelineAppeared() {
  5347. // The About tab has static content at the top which can include a check
  5348. if (/\/about\/?$/.test(location.pathname)) {
  5349. processBlueChecks(document.querySelector(Selectors.PRIMARY_COLUMN))
  5350. }
  5351. }
  5352. })
  5353. }
  5354. }
  5355.  
  5356. function tweakCommunityMembersPage() {
  5357. if (config.twitterBlueChecks != 'ignore') {
  5358. observeTimeline(currentPage, {
  5359. classifyTweets: false,
  5360. isTabbed: true,
  5361. timelineSelector: 'div[data-testid="primaryColumn"] > div > div:last-child',
  5362. })
  5363. }
  5364. }
  5365.  
  5366. function tweakDisplaySettingsPage() {
  5367. (async () => {
  5368. let $colorRerenderBoundary = await getElement('#react-root > div > div')
  5369.  
  5370. pageObservers.push(
  5371. observeElement($colorRerenderBoundary, () => {
  5372. let newThemeColor = getThemeColorFromState()
  5373. if (newThemeColor == themeColor) return
  5374.  
  5375. log('Color setting changed')
  5376. themeColor = newThemeColor
  5377. configureThemeCss()
  5378. observePopups()
  5379. observeSideNavTweetButton()
  5380. }, 'Color change re-render boundary')
  5381. )
  5382. })()
  5383.  
  5384. if (desktop) {
  5385. pageObservers.push(
  5386. observeElement($html, () => {
  5387. if (!$html.style.fontSize) return
  5388.  
  5389. if ($html.style.fontSize != fontSize) {
  5390. fontSize = $html.style.fontSize
  5391. log(`<html> fontSize has changed to ${fontSize}`)
  5392. configureDynamicCss()
  5393. observePopups()
  5394. observeSideNavTweetButton()
  5395. }
  5396. }, '<html> style attribute for font size changes', {
  5397. attributes: true,
  5398. attributeFilter: ['style']
  5399. })
  5400. )
  5401. }
  5402. }
  5403.  
  5404. /**
  5405. * @param {HTMLElement} $focusedTweet
  5406. * @param {import("./types").IndividualTweetTimelineOptions} options
  5407. */
  5408. async function tweakFocusedTweet($focusedTweet, options) {
  5409. let {observers} = options
  5410. if ($focusedTweet) {
  5411. restoreTweetInteractionsLinks($focusedTweet)
  5412.  
  5413. if (desktop && config.replaceLogo && !isObserving(observers, 'tweet editor')) {
  5414. let $editorRoot = await getElement('.DraftEditor-root', {
  5415. context: $focusedTweet.parentElement,
  5416. name: 'tweet editor in focused tweet',
  5417. timeout: 500,
  5418. })
  5419. if ($editorRoot && !isObserving(observers, 'tweet editor')) {
  5420. observers.unshift(
  5421. observeElement($editorRoot, () => {
  5422. if ($editorRoot.firstElementChild.classList.contains('public-DraftEditorPlaceholder-root')) {
  5423. let $placeholder = $editorRoot.querySelector('.public-DraftEditorPlaceholder-inner')
  5424. if ($placeholder) {
  5425. $placeholder.textContent = getString('TWEET_YOUR_REPLY')
  5426. }
  5427. }
  5428. }, 'tweet editor')
  5429. )
  5430. }
  5431. }
  5432. }
  5433. else {
  5434. disconnectObserver('tweet editor', observers)
  5435. }
  5436. }
  5437.  
  5438. async function tweakFollowListPage() {
  5439. // These tabs are dynamic as "Followers you know" only appears when applicable
  5440. let $tabs = await getElement(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav`, {
  5441. name: 'Following tabs',
  5442. stopIf: pageIsNot(currentPage),
  5443. })
  5444. if (!$tabs) return
  5445.  
  5446. let $subscriptionsTabLink = $tabs.querySelector('div[role="tablist"] a[href$="/subscriptions"]')
  5447. if ($subscriptionsTabLink) {
  5448. $body.classList.add('Subscriptions')
  5449. }
  5450.  
  5451. if (config.hideVerifiedNotificationsTab) {
  5452. let isVerifiedTabSelected = Boolean($tabs.querySelector('div[role="tablist"] > div:nth-child(1) > a[aria-selected="true"]'))
  5453. if (isVerifiedTabSelected) {
  5454. log('switching to Following tab')
  5455. $tabs.querySelector(`div[role="tablist"] > div:nth-last-child(${$subscriptionsTabLink ? 3 : 2}) > a`)?.click()
  5456. }
  5457. }
  5458.  
  5459. if (config.twitterBlueChecks != 'ignore') {
  5460. observeTimeline(currentPage, {
  5461. classifyTweets: false,
  5462. })
  5463. }
  5464. }
  5465.  
  5466. async function tweakIndividualTweetPage() {
  5467. observeIndividualTweetTimeline(currentPage)
  5468.  
  5469. if (config.replaceLogo) {
  5470. (async () => {
  5471. let $headingText = await getElement(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} h2 span`, {
  5472. name: 'tweet thread heading',
  5473. stopIf: pageIsNot(currentPage)
  5474. })
  5475. if ($headingText && $headingText.textContent != getString('TWEET')) {
  5476. $headingText.textContent = getString('TWEET')
  5477. }
  5478. })()
  5479. }
  5480.  
  5481. setDefaultSortReplies()
  5482. }
  5483.  
  5484. function tweakListPage() {
  5485. observeTimeline(currentPage, {
  5486. hideHeadings: false,
  5487. })
  5488. }
  5489.  
  5490. async function tweakDesktopLogo() {
  5491. let $logoPath = await getElement(`h1 ${Selectors.X_LOGO_PATH}, h1 ${Selectors.X_DARUMA_LOGO_PATH}`, {
  5492. name: 'desktop nav logo',
  5493. timeout: 5000,
  5494. })
  5495. if ($logoPath) {
  5496. twitterLogo($logoPath)
  5497. }
  5498. }
  5499.  
  5500. async function tweakHomeIcon() {
  5501. let $homeIconPath = await getElement(`${Selectors.NAV_HOME_LINK} svg path`, {name: 'Home icon', stopIf: pageIsNot(currentPage)})
  5502. if ($homeIconPath) {
  5503. homeIcon($homeIconPath)
  5504. }
  5505. }
  5506.  
  5507. async function tweakTweetBox() {
  5508. // Observe username typeahead dropdowns to replace Blue checks
  5509. if (config.twitterBlueChecks != 'ignore') {
  5510. let $tweetTextarea = await getElement(`${desktop ? 'div[data-testid="primaryColumn"]': 'main'} [data-testid^="tweetTextarea"]`, {
  5511. name: 'tweet textarea',
  5512. stopIf: pageIsNot(currentPage),
  5513. })
  5514. if (!$tweetTextarea) return
  5515.  
  5516. /** @type {HTMLElement} */
  5517. let $typeaheadDropdown
  5518.  
  5519. pageObservers.push(
  5520. observeElement($tweetTextarea.parentElement.parentElement.parentElement.parentElement, (mutations) => {
  5521. for (let mutation of mutations) {
  5522. if ($typeaheadDropdown && mutations.some(mutation => Array.from(mutation.removedNodes).includes($typeaheadDropdown))) {
  5523. disconnectPageObserver('tweet textarea typeahead dropdown')
  5524. $typeaheadDropdown = null
  5525. }
  5526. for (let $addedNode of mutation.addedNodes) {
  5527. if ($addedNode instanceof HTMLElement && $addedNode.getAttribute('id')?.startsWith('typeaheadDropdown')) {
  5528. $typeaheadDropdown = $addedNode
  5529. pageObservers.push(
  5530. observeElement($typeaheadDropdown, () => {
  5531. processBlueChecks($typeaheadDropdown)
  5532. }, 'tweet textarea typeahead dropdown')
  5533. )
  5534. }
  5535. }
  5536. }
  5537. }, 'tweet textarea typeahead dropdown container')
  5538. )
  5539. }
  5540.  
  5541. if (config.replaceLogo) {
  5542. tweakTweetButton()
  5543. }
  5544. }
  5545.  
  5546. async function tweakTweetButton() {
  5547. let $tweetButton = await getElement(`${desktop ? 'div[data-testid="primaryColumn"]': 'main'} button[data-testid^="tweetButton"]`, {
  5548. name: 'tweet button',
  5549. stopIf: pageIsNot(currentPage),
  5550. })
  5551. if ($tweetButton) {
  5552. let $text = $tweetButton.querySelector('span > span')
  5553. if ($text) {
  5554. setTweetButtonText($text)
  5555. } else {
  5556. warn('could not find tweet button text')
  5557. }
  5558. }
  5559. }
  5560.  
  5561. function tweakHomeTimelinePage() {
  5562. if (desktop) {
  5563. tweakTweetBox()
  5564. }
  5565.  
  5566. let $timelineTabs = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav`)
  5567.  
  5568. // Hook for styling when on the separated tweets tab
  5569. $body.classList.toggle('SeparatedTweets', isOnSeparatedTweetsTimeline())
  5570.  
  5571. if ($timelineTabs == null) {
  5572. warn('could not find timeline tabs')
  5573. return
  5574. }
  5575.  
  5576. tweakTimelineTabs($timelineTabs)
  5577. if (mobile && isSafari && config.replaceLogo) {
  5578. processTwitterLogos(document.querySelector(Selectors.MOBILE_TIMELINE_HEADER))
  5579. }
  5580.  
  5581. function updateSelectedHomeTabIndex() {
  5582. let $selectedHomeTabLink = $timelineTabs.querySelector('div[role="tablist"] a[aria-selected="true"]')
  5583. if ($selectedHomeTabLink) {
  5584. selectedHomeTabIndex = Array.from($selectedHomeTabLink.parentElement.parentElement.children).indexOf($selectedHomeTabLink.parentElement)
  5585. log({selectedHomeTabIndex})
  5586. } else {
  5587. warn('could not find selected Home tab link')
  5588. selectedHomeTabIndex = -1
  5589. }
  5590. }
  5591.  
  5592. updateSelectedHomeTabIndex()
  5593.  
  5594. // If there are pinned lists, the timeline tabs <nav> will be replaced when they load
  5595. pageObservers.push(
  5596. observeElement($timelineTabs.parentElement, (mutations) => {
  5597. let timelineTabsReplaced = mutations.some(mutation => Array.from(mutation.removedNodes).includes($timelineTabs))
  5598. if (timelineTabsReplaced) {
  5599. log('timeline tabs replaced')
  5600. $timelineTabs = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav`)
  5601. tweakTimelineTabs($timelineTabs)
  5602. }
  5603. }, 'timeline tabs nav container')
  5604. )
  5605.  
  5606. observeTimeline(currentPage, {
  5607. isTabbed: true,
  5608. onTabChanged: () => {
  5609. updateSelectedHomeTabIndex()
  5610. wasForYouTabSelected = selectedHomeTabIndex == 0
  5611. },
  5612. tabbedTimelineContainerSelector: 'div[data-testid="primaryColumn"] > div > div:last-child',
  5613. })
  5614. }
  5615.  
  5616. function tweakMobileComposeTweetPage() {
  5617. tweakTweetBox()
  5618. }
  5619.  
  5620. function tweakMobileMediaViewerPage() {
  5621. if (config.twitterBlueChecks == 'ignore') return
  5622.  
  5623. let $timeline = /** @type {HTMLElement} */ (document.querySelector('[data-testid="vss-scroll-view"] > div'))
  5624. if (!$timeline) {
  5625. warn('media viewer timeline not found')
  5626. return
  5627. }
  5628.  
  5629. observeElement($timeline, (mutations) => {
  5630. for (let mutation of mutations) {
  5631. if (!mutation.addedNodes) continue
  5632. for (let $addedNode of mutation.addedNodes) {
  5633. if ($addedNode.querySelector?.('div[data-testid^="immersive-tweet-ui-content-container"]')) {
  5634. processBlueChecks($addedNode)
  5635. }
  5636. }
  5637. }
  5638. }, 'media viewer timeline', {childList: true, subtree: true})
  5639. }
  5640.  
  5641. async function tweakTimelineTabs($timelineTabs) {
  5642. $timelineTabs.classList.add('TimelineTabs')
  5643. let $followingTabLink = /** @type {HTMLElement} */ ($timelineTabs.querySelector('div[role="tablist"] > div:nth-child(2) > a'))
  5644.  
  5645. if (config.alwaysUseLatestTweets && !document.title.startsWith(separatedTweetsTimelineTitle)) {
  5646. let isForYouTabSelected = Boolean($timelineTabs.querySelector('div[role="tablist"] > div:first-child > a[aria-selected="true"]'))
  5647. if (isForYouTabSelected && (!wasForYouTabSelected || config.hideForYouTimeline)) {
  5648. log('switching to Following timeline')
  5649. $followingTabLink.click()
  5650. wasForYouTabSelected = false
  5651. } else {
  5652. wasForYouTabSelected = isForYouTabSelected
  5653. }
  5654. }
  5655.  
  5656. if (shouldShowSeparatedTweetsTab()) {
  5657. let $newTab = /** @type {HTMLElement} */ ($timelineTabs.querySelector('#tnt_separated_tweets_tab'))
  5658. if ($newTab) {
  5659. log('separated tweets timeline tab already present')
  5660. $newTab.querySelector('span').textContent = separatedTweetsTimelineTitle
  5661. }
  5662. else {
  5663. log('inserting separated tweets tab')
  5664. $newTab = /** @type {HTMLElement} */ ($followingTabLink.parentElement.cloneNode(true))
  5665. $newTab.id = 'tnt_separated_tweets_tab'
  5666. $newTab.querySelector('span').textContent = separatedTweetsTimelineTitle
  5667. let $link = $newTab.querySelector('a')
  5668. $link.removeAttribute('aria-selected')
  5669.  
  5670. // This script assumes navigation has occurred when the document title
  5671. // changes, so by changing the title we fake navigation to a non-existent
  5672. // page representing the separated tweets timeline.
  5673. $link.addEventListener('click', (e) => {
  5674. e.preventDefault()
  5675. e.stopPropagation()
  5676. if (!document.title.startsWith(separatedTweetsTimelineTitle)) {
  5677. // The separated tweets tab belongs to the Following tab
  5678. let isFollowingTabSelected = Boolean($timelineTabs.querySelector('div[role="tablist"] > div:nth-child(2) > a[aria-selected="true"]'))
  5679. if (!isFollowingTabSelected) {
  5680. log('switching to the Following tab for separated tweets')
  5681. $followingTabLink.click()
  5682. }
  5683. setTitle(separatedTweetsTimelineTitle)
  5684. }
  5685. window.scrollTo({top: 0})
  5686. })
  5687. $followingTabLink.parentElement.insertAdjacentElement('afterend', $newTab)
  5688.  
  5689. // Return to the Home timeline when any other tab is clicked
  5690. $followingTabLink.parentElement.parentElement.addEventListener('click', () => {
  5691. if (location.pathname == '/home' && !document.title.startsWith(getString('HOME'))) {
  5692. log('setting title to Home')
  5693. homeNavigationIsBeingUsed = true
  5694. setTitle(getString('HOME'))
  5695. }
  5696. })
  5697.  
  5698. // Return to the Home timeline when the Home nav link is clicked
  5699. let $homeNavLink = await getElement(Selectors.NAV_HOME_LINK, {
  5700. name: 'home nav link',
  5701. stopIf: pathIsNot(currentPath),
  5702. })
  5703. if ($homeNavLink && !$homeNavLink.dataset.tweakNewTwitterListener) {
  5704. $homeNavLink.addEventListener('click', () => {
  5705. homeNavigationIsBeingUsed = true
  5706. if (location.pathname == '/home' && !document.title.startsWith(getString('HOME'))) {
  5707. setTitle(getString('HOME'))
  5708. }
  5709. })
  5710. $homeNavLink.dataset.tweakNewTwitterListener = 'true'
  5711. }
  5712. }
  5713. } else {
  5714. removeMobileTimelineHeaderElements()
  5715. }
  5716. }
  5717.  
  5718. function tweakNotificationsPage() {
  5719. let $navigationTabs = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav`)
  5720. if ($navigationTabs == null) {
  5721. warn('could not find Notifications tabs')
  5722. return
  5723. }
  5724.  
  5725. if (config.hideVerifiedNotificationsTab) {
  5726. let isVerifiedTabSelected = Boolean($navigationTabs.querySelector('div[role="tablist"] > div:nth-child(2) > a[aria-selected="true"]'))
  5727. if (isVerifiedTabSelected) {
  5728. log('switching to All tab')
  5729. $navigationTabs.querySelector('div[role="tablist"] > div:nth-child(1) > a')?.click()
  5730. }
  5731. }
  5732.  
  5733. if (config.twitterBlueChecks != 'ignore' || config.restoreLinkHeadlines) {
  5734. observeTimeline(currentPage, {
  5735. isTabbed: true,
  5736. tabbedTimelineContainerSelector: 'div[data-testid="primaryColumn"] > div > div:last-child',
  5737. })
  5738. }
  5739. }
  5740.  
  5741. async function tweakProfilePage() {
  5742. let $initialContent = await getElement(desktop ? Selectors.PRIMARY_COLUMN : Selectors.MOBILE_TIMELINE_HEADER, {
  5743. name: 'initial profile content',
  5744. stopIf: pageIsNot(currentPage),
  5745. })
  5746. if (!$initialContent) return
  5747.  
  5748. if (config.twitterBlueChecks != 'ignore') {
  5749. processBlueChecks($initialContent)
  5750. }
  5751.  
  5752. let tab = currentPath.match(URL_PROFILE_RE)?.[2] || 'tweets'
  5753. log(`on ${tab} tab`)
  5754. observeTimeline(currentPage, {
  5755. isUserTimeline: tab == 'affiliates'
  5756. })
  5757.  
  5758. let $editProfileButton = document.querySelector('a[href="/settings/profile"]')
  5759. let $headerVerifiedIcon = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.TIMELINE_HEADING} [data-testid="icon-verified"]`)
  5760. $body.classList.toggle('OwnProfile', Boolean($editProfileButton))
  5761. $body.classList.toggle('PremiumProfile', Boolean($headerVerifiedIcon))
  5762.  
  5763. if (config.replaceLogo || config.hideSubscriptions) {
  5764. let $profileTabs = await getElement(`${Selectors.PRIMARY_COLUMN} nav`, {
  5765. name: 'profile tabs',
  5766. stopIf: pageIsNot(currentPage),
  5767. })
  5768. if (!$profileTabs) return
  5769. // The Profile tabs <nav> can be replaced
  5770. pageObservers.push(
  5771. observeElement($profileTabs.parentElement, async (mutations) => {
  5772. if (mutations.length > 0) {
  5773. let $newProfileTabs = findAddedNode(mutations, ($el) => $el instanceof HTMLElement && $el.tagName == 'NAV')
  5774. if ($newProfileTabs == null) return
  5775. $profileTabs = /** @type {HTMLElement} */ ($newProfileTabs)
  5776. }
  5777. if (config.replaceLogo) {
  5778. let $tweetsTabText = await getElement('[data-testid="ScrollSnap-List"] > [role="presentation"]:first-child div[dir] > span:first-child', {
  5779. context: $profileTabs,
  5780. name: 'Tweets tab text',
  5781. stopIf: pageIsNot(currentPage),
  5782. })
  5783. if ($tweetsTabText && $tweetsTabText.textContent != getString('TWEETS')) {
  5784. $tweetsTabText.textContent = getString('TWEETS')
  5785. }
  5786. }
  5787. if (config.hideSubscriptions) {
  5788. let $subscriptionsTabLink = await getElement('a[href$="/superfollows"]', {
  5789. context: $profileTabs,
  5790. name: 'Subscriptions tab link',
  5791. stopIf: pageIsNot(currentPage),
  5792. timeout: 1000,
  5793. })
  5794. if ($subscriptionsTabLink) {
  5795. $subscriptionsTabLink.parentElement.classList.add('SubsTab')
  5796. }
  5797. }
  5798. }, 'profile tabs', {childList: true})
  5799. )
  5800. }
  5801. }
  5802.  
  5803. /**
  5804. * @param {Element} $dropdownItem
  5805. * @param {string} dropdownItemSelector
  5806. * @param {import("./types").LocaleKey} localeKey
  5807. */
  5808. async function tweakRetweetDropdown($dropdownItem, dropdownItemSelector, localeKey) {
  5809. log('tweaking Retweet/Quote Tweet dropdown')
  5810.  
  5811. if (desktop) {
  5812. $dropdownItem = await getElement(`
  5813. #layers div[data-testid="Dropdown"] ${dropdownItemSelector}
  5814. `, {
  5815. name: 'rendered menu item',
  5816. timeout: 100,
  5817. })
  5818. if (!$dropdownItem) return
  5819. }
  5820.  
  5821. let $text = $dropdownItem.querySelector('div[dir] > span')
  5822. if ($text) $text.textContent = getString(localeKey)
  5823.  
  5824. let $quoteTweetText = $dropdownItem.nextElementSibling?.querySelector('div[dir] > span')
  5825. if ($quoteTweetText) $quoteTweetText.textContent = getString('QUOTE_TWEET')
  5826. }
  5827.  
  5828. function tweakSearchPage() {
  5829. let $searchTabs = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav`)
  5830. if ($searchTabs != null) {
  5831. if (config.defaultToLatestSearch) {
  5832. let isTopTabSelected = Boolean($searchTabs.querySelector('div[role="tablist"] > div:nth-child(1) > a[aria-selected="true"]'))
  5833. if (isTopTabSelected) {
  5834. log('switching to Latest tab')
  5835. $searchTabs.querySelector('div[role="tablist"] > div:nth-child(2) > a')?.click()
  5836. }
  5837. }
  5838. } else {
  5839. warn('could not find Search tabs')
  5840. }
  5841.  
  5842. observeTimeline(currentPage, {
  5843. hideHeadings: false,
  5844. isTabbed: true,
  5845. tabbedTimelineContainerSelector: 'div[data-testid="primaryColumn"] > div > div:last-child',
  5846. })
  5847. }
  5848.  
  5849. function tweakTweetEngagementPage() {
  5850. if (config.replaceLogo) {
  5851. let $headingText = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} h2 span`)
  5852. if ($headingText) {
  5853. if ($headingText.textContent != getString('TWEET_INTERACTIONS')) {
  5854. $headingText.textContent = getString('TWEET_INTERACTIONS')
  5855. }
  5856. } else {
  5857. warn('could not find Post engagement heading')
  5858. }
  5859. }
  5860.  
  5861. let $tabs = document.querySelector(`${mobile ? Selectors.MOBILE_TIMELINE_HEADER : Selectors.PRIMARY_COLUMN} nav`)
  5862. if ($tabs == null) {
  5863. warn('could not find Post engagement tabs')
  5864. return
  5865. }
  5866.  
  5867. if (tweetInteractionsTab) {
  5868. log('switching to tab', tweetInteractionsTab)
  5869. $tabs.querySelector(`div[role="tablist"] > div:nth-child(${tweetInteractionsTab}) > a`)?.click()
  5870. tweetInteractionsTab = null
  5871. }
  5872.  
  5873. if (config.replaceLogo) {
  5874. let $quoteTweetsTabText = $tabs.querySelector('div[role="tablist"] > div:nth-child(1) div[dir] > span')
  5875. if ($quoteTweetsTabText) $quoteTweetsTabText.textContent = getString('QUOTE_TWEETS')
  5876. let $retweetsTabText = $tabs.querySelector('div[role="tablist"] > div:nth-child(2) div[dir] > span')
  5877. if ($retweetsTabText) $retweetsTabText.textContent = getString('RETWEETS')
  5878. }
  5879.  
  5880. if (config.twitterBlueChecks != 'ignore') {
  5881. observeTimeline(currentPage, {classifyTweets: false})
  5882. }
  5883. }
  5884. //#endregion
  5885.  
  5886. //#region Main
  5887. async function main() {
  5888. let $settings = /** @type {HTMLScriptElement} */ (document.querySelector('script#tnt_settings'))
  5889. if ($settings) {
  5890. try {
  5891. Object.assign(config, JSON.parse($settings.innerText))
  5892. } catch(e) {
  5893. error('error parsing initial settings', e)
  5894. }
  5895.  
  5896. let settingsChangeObserver = new MutationObserver(() => {
  5897. /** @type {Partial<import("./types").Config>} */
  5898. let configChanges
  5899. try {
  5900. configChanges = JSON.parse($settings.innerText)
  5901. } catch(e) {
  5902. error('error parsing incoming settings change', e)
  5903. return
  5904. }
  5905.  
  5906. if ('debug' in configChanges) {
  5907. log('disabling debug mode')
  5908. debug = configChanges.debug
  5909. log('enabled debug mode')
  5910. configureThemeCss()
  5911. return
  5912. }
  5913.  
  5914. Object.assign(config, configChanges)
  5915. configChanged(configChanges)
  5916. })
  5917. settingsChangeObserver.observe($settings, {childList: true})
  5918. }
  5919.  
  5920. if (config.debug) {
  5921. debug = true
  5922. }
  5923.  
  5924. observeTitle()
  5925.  
  5926. let $loadingStyle
  5927. if (config.replaceLogo) {
  5928. getElement('html', {name: 'html element'}).then(($html) => {
  5929. $loadingStyle = document.createElement('style')
  5930. $loadingStyle.dataset.insertedBy = 'control-panel-for-twitter'
  5931. $loadingStyle.dataset.role = 'loading-logo'
  5932. $loadingStyle.textContent = dedent(`
  5933. ${Selectors.X_LOGO_PATH} {
  5934. fill: ${isSafari ? 'transparent' : THEME_BLUE};
  5935. d: path("${Svgs.TWITTER_LOGO_PATH}");
  5936. }
  5937. .tnt_logo {
  5938. fill: ${THEME_BLUE};
  5939. }
  5940. `)
  5941. $html.appendChild($loadingStyle)
  5942. })
  5943.  
  5944. if (isSafari) {
  5945. getElement(Selectors.X_LOGO_PATH, {name: 'pre-loading indicator logo', timeout: 1000}).then(($logoPath) => {
  5946. if ($logoPath) {
  5947. twitterLogo($logoPath)
  5948. }
  5949. })
  5950. }
  5951.  
  5952. observeFavicon()
  5953. }
  5954.  
  5955. let $appWrapper = await getElement('#layers + div', {name: 'app wrapper'})
  5956.  
  5957. $html = document.querySelector('html')
  5958. $body = document.body
  5959. $reactRoot = document.querySelector('#react-root')
  5960. lang = $html.lang
  5961. dir = $html.dir
  5962. ltr = dir == 'ltr'
  5963. let lastFlexDirection
  5964.  
  5965. observeElement($appWrapper, () => {
  5966. let flexDirection = getComputedStyle($appWrapper).flexDirection
  5967.  
  5968. mobile = flexDirection == 'column'
  5969. desktop = !mobile
  5970.  
  5971. /** @type {'mobile' | 'desktop'} */
  5972. let version = mobile ? 'mobile' : 'desktop'
  5973.  
  5974. if (version != config.version) {
  5975. log('setting version to', version)
  5976. config.version = version
  5977. // Let the options page know which version is being used
  5978. storeConfigChanges({version})
  5979. }
  5980.  
  5981. if (lastFlexDirection == null) {
  5982. log('initial config', {config, lang, version})
  5983.  
  5984. // One-time setup
  5985. checkReactNativeStylesheet()
  5986. observeBodyBackgroundColor()
  5987. let initialThemeColor = getThemeColorFromState()
  5988. if (initialThemeColor) {
  5989. themeColor = initialThemeColor
  5990. }
  5991. if (desktop) {
  5992. fontSize = $html.style.fontSize
  5993. if (!fontSize) {
  5994. warn('initial fontSize not set on <html>')
  5995. }
  5996. }
  5997.  
  5998. // Repeatable configuration setup
  5999. configureSeparatedTweetsTimelineTitle()
  6000. configureCss()
  6001. configureDynamicCss()
  6002. configureThemeCss()
  6003. observePopups()
  6004. observeSideNavTweetButton()
  6005.  
  6006. // Start taking action on page changes
  6007. observingPageChanges = true
  6008.  
  6009. // Delay removing loading icon styles to avoid Flash of X
  6010. if ($loadingStyle) {
  6011. setTimeout(() => $loadingStyle.remove(), 1000)
  6012. }
  6013. }
  6014. else if (flexDirection != lastFlexDirection) {
  6015. configChanged({version})
  6016. }
  6017.  
  6018. $body.classList.toggle('Mobile', mobile)
  6019. $body.classList.toggle('Desktop', desktop)
  6020.  
  6021. lastFlexDirection = flexDirection
  6022. }, 'app wrapper class attribute for version changes (mobile ↔ desktop)', {
  6023. attributes: true,
  6024. attributeFilter: ['class']
  6025. })
  6026. }
  6027.  
  6028. /**
  6029. * @param {Partial<import("./types").Config>} changes
  6030. */
  6031. function configChanged(changes) {
  6032. log('config changed', changes)
  6033.  
  6034. if ('version' in changes) {
  6035. fontSize = desktop ? $html.style.fontSize : null
  6036. }
  6037.  
  6038. configureCss()
  6039. configureFont()
  6040. configureDynamicCss()
  6041. configureThemeCss()
  6042. observeFavicon()
  6043. observePopups()
  6044. observeSideNavTweetButton()
  6045.  
  6046. // Only re-process the current page if navigation wasn't already triggered
  6047. // while applying the following config changes (if there were any).
  6048. let navigationTriggered = (
  6049. configureSeparatedTweetsTimelineTitle() ||
  6050. checkforDisabledHomeTimeline()
  6051. )
  6052. if (!navigationTriggered) {
  6053. processCurrentPage()
  6054. }
  6055. }
  6056.  
  6057. main()
  6058. //#endregion
  6059.  
  6060. }()