Twitter remove view ui

Fuck Elon Musk, Remove twitter annoying view count icon

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name Twitter remove view ui
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.27
  5. // @description Fuck Elon Musk, Remove twitter annoying view count icon
  6. // @author You
  7. // @match https://twitter.com/*
  8. // @match https://*.x.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. const controlClassName = 'r-1kbdv8c';
  19.  
  20. var starter = setInterval(() => {
  21. if(document.getElementsByClassName(controlClassName).length>0){
  22. console.log("have");
  23. combine();
  24. clearInterval(starter);
  25. }else{
  26. console.log("class not found");
  27. }
  28. }, 200);
  29.  
  30. function combine(){
  31. //ChangeCss('r-1mdbhws','max-width: initial;}.r-1mdbhws>:nth-child(4) { display: none; ');
  32. ChangeCss(controlClassName,`max-width: initial;}.${controlClassName}>:nth-child(4) { display: none; `);
  33. //ChangeCssSingle('jcaQle','width','274px;');
  34. }
  35.  
  36. function ChangeCss(classs,css){
  37. var allstylesheet = document.getElementsByTagName('style');
  38. //console.log(allstylesheet);
  39. for (let i = 0; i < allstylesheet.length; i++) {
  40. console.log(allstylesheet[i].innerHTML.split(classs).length);
  41. if (allstylesheet[i].innerHTML.split(classs).length >= 2) {
  42. //console.log('Running1')
  43. //console.log(allstylesheet[i].innerHTML);
  44. //console.log(allstylesheet[i].innerHTML.split(classs+'{')[1].split('}')[0]);
  45. allstylesheet[i].innerHTML=allstylesheet[i].innerHTML.replace(allstylesheet[i].innerHTML.split(classs+'{')[1].split('}')[0],css);
  46. //console.log('Running2_end')
  47. }else if(allstylesheet[i].innerHTML.split(classs).length < 2 &&i==allstylesheet.length-1) {
  48. var newstylesheet = document.createElement('style');
  49. newstylesheet.innerHTML='.'+classs+'{'+css+'}';
  50. document.body.appendChild(newstylesheet);
  51. console.log('Added to new style');
  52. }
  53.  
  54. }
  55.  
  56. }
  57.  
  58. function ChangeCssSingle(classs,css,value){
  59. var allstylesheet = document.getElementsByTagName('style');
  60. //console.log(allstylesheet);
  61. for (let i = 0; i < allstylesheet.length; i++) {
  62. //console.log(allstylesheet[i].innerHTML.split('C9gDHb').length);
  63. if (allstylesheet[i].innerHTML.split(classs).length >= 2) {
  64. //console.log(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1]);
  65. //console.log(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1].split(':')[1]);
  66. //console.log(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1].split(':')[1].split(';')[0]);
  67. allstylesheet[i].innerHTML=allstylesheet[i].innerHTML.replace(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1].split(':')[1].split(';')[0],value);
  68.  
  69. }else{
  70. console.log('class "'+classs+'"not found in this style sheet')
  71. }
  72.  
  73. }
  74. }
  75.  
  76.  
  77.  
  78. const class_observer = new MutationObserver(function (callback_eles) {
  79. console.log('callback_eles', callback_eles);
  80. for (let i = 0; i < callback_eles.length; i++) {
  81. const fuckdiv = callback_eles[i].target.querySelectorAll(`[class="css-1dbjc4n r-1kbdv8c r-18u37iz r-h3s6tt r-1wtj0ep r-10m99ii r-1e081e0"]`)[0];
  82. const fuckdiv2 = callback_eles[i].target.querySelectorAll(`[class="css-1dbjc4n r-1oszu61 r-j5o65s r-rull8r r-qklmqi r-1dgieki r-1efd50x r-5kkj8d r-1kbdv8c r-18u37iz r-h3s6tt r-1wtj0ep r-3qxfft r-s1qlax"]`)[0];
  83.  
  84. if (fuckdiv != undefined) {
  85. console.log('callback_eles_2', fuckdiv);
  86. fuckdiv.classList.add('RONI_DIV_CONTROLLER');
  87. }
  88.  
  89. if (fuckdiv2 != undefined) {
  90. console.log('callback_eles_2', fuckdiv2);
  91. fuckdiv2.classList.add('RONI_DIV_CONTROLLER');
  92. }
  93.  
  94. }
  95. });
  96.  
  97. class_observer.observe(document.querySelector("div"), {
  98. attributes: true, childList: true, subtree: true
  99. }
  100. );
  101.  
  102. const cc = document.createElement('style');
  103. cc.innerHTML = `.RONI_DIV_CONTROLLER>:nth-child(4) { display: none;}`;
  104. document.body.appendChild(cc);
  105.  
  106.  
  107. var change_twi_logo = setInterval(() => {
  108. const find_div = document.getElementsByClassName('r-18jsvk2 r-4qtqp9 r-yyyyoo r-16y2uox r-8kz0gk r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-lrsllp');
  109. if (find_div.length > 0) {
  110. console.log("have logo");
  111. find_div[0].setAttribute('viewBox','0 0 40 40');
  112.  
  113. const path_div = find_div[0].getElementsByTagName('path')[0];
  114. path_div.setAttribute('fill','#03A9F4');
  115. path_div.setAttribute('d', 'M42,12.429c-1.323,0.586-2.746,0.977-4.247,1.162c1.526-0.906,2.7-2.351,3.251-4.058c-1.428,0.837-3.01,1.452-4.693,1.776C34.967,9.884,33.05,9,30.926,9c-4.08,0-7.387,3.278-7.387,7.32c0,0.572,0.067,1.129,0.193,1.67c-6.138-0.308-11.582-3.226-15.224-7.654c-0.64,1.082-1,2.349-1,3.686c0,2.541,1.301,4.778,3.285,6.096c-1.211-0.037-2.351-0.374-3.349-0.914c0,0.022,0,0.055,0,0.086c0,3.551,2.547,6.508,5.923,7.181c-0.617,0.169-1.269,0.263-1.941,0.263c-0.477,0-0.942-0.054-1.392-0.135c0.94,2.902,3.667,5.023,6.898,5.086c-2.528,1.96-5.712,3.134-9.174,3.134c-0.598,0-1.183-0.034-1.761-0.104C9.268,36.786,13.152,38,17.321,38c13.585,0,21.017-11.156,21.017-20.834c0-0.317-0.01-0.633-0.025-0.945C39.763,15.197,41.013,13.905,42,12.429');
  116.  
  117. clearInterval(change_twi_logo);
  118. } else {
  119. console.log("class not found");
  120. }
  121. }, 200);
  122.  
  123.  
  124. /*var change_twi_logo2 = setInterval(() => {
  125. const find_div = document.getElementsByClassName('r-1p0dtai r-18jsvk2 r-4qtqp9 r-yyyyoo r-wy61xf r-1d2f490 r-ywje51 r-dnmrzs r-u8s1d r-zchlnj r-1plcrui r-ipm5af r-lrvibr r-1blnp2b');
  126. if (find_div.length > 0) {
  127. console.log("have logo");
  128. find_div[0].setAttribute('viewBox', '0 0 40 40');
  129.  
  130. const path_div = find_div[0].getElementsByTagName('path')[0];
  131. path_div.setAttribute('fill', '#03A9F4');
  132. path_div.setAttribute('d', 'M42,12.429c-1.323,0.586-2.746,0.977-4.247,1.162c1.526-0.906,2.7-2.351,3.251-4.058c-1.428,0.837-3.01,1.452-4.693,1.776C34.967,9.884,33.05,9,30.926,9c-4.08,0-7.387,3.278-7.387,7.32c0,0.572,0.067,1.129,0.193,1.67c-6.138-0.308-11.582-3.226-15.224-7.654c-0.64,1.082-1,2.349-1,3.686c0,2.541,1.301,4.778,3.285,6.096c-1.211-0.037-2.351-0.374-3.349-0.914c0,0.022,0,0.055,0,0.086c0,3.551,2.547,6.508,5.923,7.181c-0.617,0.169-1.269,0.263-1.941,0.263c-0.477,0-0.942-0.054-1.392-0.135c0.94,2.902,3.667,5.023,6.898,5.086c-2.528,1.96-5.712,3.134-9.174,3.134c-0.598,0-1.183-0.034-1.761-0.104C9.268,36.786,13.152,38,17.321,38c13.585,0,21.017-11.156,21.017-20.834c0-0.317-0.01-0.633-0.025-0.945C39.763,15.197,41.013,13.905,42,12.429');
  133.  
  134. clearInterval(change_twi_logo2);
  135. } else {
  136. console.log("class not found");
  137. }
  138. }, 200);*/
  139.  
  140. })();