// ==UserScript== // @name Show Twitter Censored Media Section // @namespace http://tampermonkey.net/ // @version 1.0 // @description Modifies the CSS classes to automatically show censored media on Twitter in desktop mode // @author hacim17h // @match https://twitter.com/* // @match https://x.com/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Function to modify classes of children for specific parent divs function modifyChildClasses() { const parentDivs = document.querySelectorAll('.css-175oi2r.r-18u37iz.r-9aw3ui.r-4amgru.r-14gqq1x'); parentDivs.forEach(parentDiv => { const children = parentDiv.querySelectorAll('.css-175oi2r.r-1udh08x, .css-175oi2r.r-yfv4eo'); children.forEach(child => { // You could adjust here if you want to keep some of the old classes child.className = 'css-175oi2r r-1adg3ll r-1ny4l3l'; }); }); } // Function to remove specific divs by a complex class string function removeSpecificDivs() { const elements = document.querySelectorAll('.css-175oi2r.r-1awozwy.r-1p0dtai.r-zchlnj.r-1cmwbt1.r-1777fci.r-edyy15.r-u8s1d.r-1d2f490.r-ipm5af'); elements.forEach(element => element.remove()); } // MutationObserver for dynamic content handling const observer = new MutationObserver(mutations => { mutations.forEach(() => { modifyChildClasses(); removeSpecificDivs(); }); }); const config = { childList: true, subtree: true }; observer.observe(document.body, config); // Initial call to functions modifyChildClasses(); removeSpecificDivs(); })();