X.com (Twitter) - Auto Show Sensitive Content

X.com (Twitter) Auto Show Sensitive Content. You Don't Have To Click "Show" Button Anymore When Reading NSFW Tweets With Blur Alert. 推特自动显示色情暴力内容,不再被模糊化。

  1. // ==UserScript==
  2. // @name X.com (Twitter) - Auto Show Sensitive Content
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.5
  5. // @description X.com (Twitter) Auto Show Sensitive Content. You Don't Have To Click "Show" Button Anymore When Reading NSFW Tweets With Blur Alert. 推特自动显示色情暴力内容,不再被模糊化。
  6. // @author Martin______X
  7. // @match https://twitter.com/*
  8. // @include https://x.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=x.com
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. let $home_show_button = "css-175oi2r r-sdzlij r-1phboty r-rs99b7 r-lrvibr r-173mn98 r-1s2bzr4 r-15ysp7h r-4wgw6l r-3pj75a r-1loqt21 r-o7ynqc r-6416eg r-1ny4l3l";
  15.  
  16. let $media_show_button = "css-146c3p1 r-bcqeeo r-qvutc0 r-37j5jr r-a023e6 r-rjixqe r-16dba41 r-1loqt21 r-fdjqy7";
  17.  
  18. let $home_hide_button = "css-175oi2r r-sdzlij r-1phboty r-rs99b7 r-lrvibr r-rki7wi r-42265s r-u8s1d r-15ysp7h r-4wgw6l r-3pj75a r-1loqt21 r-o7ynqc r-6416eg r-1ny4l3l";
  19.  
  20. let $profile_show_button = "css-175oi2r r-sdzlij r-1phboty r-rs99b7 r-lrvibr r-k200y r-1j93nrh r-1mnahxq r-19yznuf r-64el8z r-1fkl15p r-1loqt21 r-o7ynqc r-6416eg r-1ny4l3l";
  21.  
  22. const simpleClick = (async (button)=>{
  23. button.click();
  24. });
  25. const nfswClickInterval = setInterval(() => {
  26. try{
  27. //Counter
  28. let i = 0;
  29. //For Profile caution
  30. let profile_show_buttons = document.getElementsByClassName($profile_show_button);
  31. //For Home & Profile--->Tweets
  32. let home_show_buttons = document.getElementsByClassName($home_show_button);
  33. //For Profile--->Media
  34. let media_show_buttons = document.getElementsByClassName($media_show_button);
  35. //Annoying Button
  36. let home_hide_buttons = document.getElementsByClassName($home_hide_button);
  37. //Attributes In Tabs
  38. let role = "";
  39. let dir = "";
  40.  
  41. //Profile caution
  42. for(i=0;i<profile_show_buttons.length;i++){
  43. let profile_show_button = profile_show_buttons[i];
  44. role = profile_show_button.getAttribute("role");
  45. dir = profile_show_button.getAttribute("dir");
  46. if(role == "button"){
  47. simpleClick(profile_show_button);
  48. }
  49. }
  50. //Click The Show Button On Home & Profile Tweets
  51. for(i=0;i<home_show_buttons.length;i++){
  52. let home_show_button = home_show_buttons[i];
  53. role = home_show_button.getAttribute("role");
  54. if(role == "button"){
  55. simpleClick(home_show_button);
  56. }
  57. }
  58. //Click The Show Button On Media
  59. for(i=0;i<media_show_buttons.length;i++){
  60. let media_show_button = media_show_buttons[i];
  61. role = media_show_button.getAttribute("role");
  62. dir = media_show_button.getAttribute("dir");
  63. if(role == "button" & dir == "ltr"){
  64. simpleClick(media_show_button);
  65. }
  66. }
  67. //Hide The Hide Button On Home & Profile Tweets
  68. for(i=0;i<home_hide_buttons.length;i++){
  69. let home_hide_button = home_hide_buttons[i];
  70. role = home_hide_button.getAttribute("role");
  71. if(role == "button"){
  72. home_hide_button.style.display = 'none';
  73. }
  74. }
  75. }catch(error){
  76. //console.error(error)
  77. }
  78. }, 1);