Highlight Non-Followers User Script
This user script is designed to highlight non-followers in your X profile by modifying their background color. It uses a combination of CSS selectors and the MutationObserver API to dynamically identify non-followers as they load onto the page.
- This script requires a Tampermonkey or similar userscript manager.
- It assumes you are using X's web interface at
https://x.com/
. - You must replace
"https://x.com/rama_vats/following"
with your actual username in the script code.
- Install Tampermonkey from the Chrome Web Store or Firefox Addons.
- Create a new userscript by clicking the "Create a new script" button within Tampermonkey.
- Replace the placeholder
// @name
directive with"Highlight Non-Followers"
(or any other name of your choice). - Paste the contents of this code into the editor.
- Save and refresh your X Following page to see non-followers highlighted.
- When you navigate to your X following page, the script initializes after a 2-second delay to ensure the page has fully loaded.
- The script uses CSS selectors to identify all div elements with the
data-testid="cellInnerDiv"
attribute. - For each identified element, it checks if the user is not followed (i.e., no follow indicator exists). If so, it sets the background color of that element to a dark red (
#64181c
). - The script then sets up two MutationObserver instances:
- One observes changes in the DOM and re-runs the highlighting function every 2 seconds if on the correct page.
- Another monitors for URL changes and disables the script when you navigate away from your following page.