Greasy Fork is available in English.
Fuck Elon Musk, Remove twitter annoying view count icon
当前为
// ==UserScript==
// @name Twitter remove view ui
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Fuck Elon Musk, Remove twitter annoying view count icon
// @author You
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
var starter = setInterval(() => {
if(document.getElementsByClassName('r-1mdbhws').length>0){
console.log("have");
combine();
clearInterval(starter);
}else{
console.log("class not found");
}
}, 200);
function combine(){
ChangeCss('r-1mdbhws','max-width: initial;}.r-1mdbhws>:nth-child(4) { display: none; ');
//ChangeCssSingle('jcaQle','width','274px;');
}
function ChangeCss(classs,css){
var allstylesheet = document.getElementsByTagName('style');
//console.log(allstylesheet);
for (let i = 0; i < allstylesheet.length; i++) {
console.log(allstylesheet[i].innerHTML.split(classs).length);
if (allstylesheet[i].innerHTML.split(classs).length >= 2) {
//console.log('Running1')
//console.log(allstylesheet[i].innerHTML);
//console.log(allstylesheet[i].innerHTML.split(classs+'{')[1].split('}')[0]);
allstylesheet[i].innerHTML=allstylesheet[i].innerHTML.replace(allstylesheet[i].innerHTML.split(classs+'{')[1].split('}')[0],css);
//console.log('Running2_end')
}else if(allstylesheet[i].innerHTML.split(classs).length < 2 &&i==allstylesheet.length-1) {
var newstylesheet = document.createElement('style');
newstylesheet.innerHTML='.'+classs+'{'+css+'}';
document.body.appendChild(newstylesheet);
console.log('Added to new style');
}
}
}
function ChangeCssSingle(classs,css,value){
var allstylesheet = document.getElementsByTagName('style');
//console.log(allstylesheet);
for (let i = 0; i < allstylesheet.length; i++) {
//console.log(allstylesheet[i].innerHTML.split('C9gDHb').length);
if (allstylesheet[i].innerHTML.split(classs).length >= 2) {
//console.log(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1]);
//console.log(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1].split(':')[1]);
//console.log(allstylesheet[i].innerHTML.split(classs)[1].split('{')[1].split('}')[0].split(css)[1].split(':')[1].split(';')[0]);
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);
}else{
console.log('class "'+classs+'"not found in this style sheet')
}
}
}
})();