X.com Automation Script
Description
This Tampermonkey script enhances your experience on X.com by automating certain actions and ensuring smoother navigation. It is designed specifically for the /home page of X.com and offers robust features to handle new posts, saved content, and timeline browsing.
Features
Precise Search for Saved Posts: The script accurately searches for a specific saved post based on the author's handler and timestamp.
Automated Scroll to Saved Post: Ensures that after loading new posts, the view automatically scrolls back to the saved post.
New Posts Loading: Automatically detects and interacts with the "Show New Posts" button to load fresh content seamlessly.
3-Hour Timeline Limit: Stops searching for the saved post if the visible timeline is older than 3 hours compared to the saved post.
Tab Switch Detection: Reactivates automation when you return to the X.com tab after switching to another.
Fallback Mechanisms: If loading new posts fails, retries are handled gracefully with clear console feedback.
How It Works
Saved Post Management:
The script monitors the topmost visible post and saves its timestamp and author's handler for future reference.
Automatic New Post Loading:
When the "Show New Posts" button appears, the script clicks it and waits until new posts are loaded. It ensures no duplicate actions occur.
Timeline Scrolling:
The script searches for the saved post or scrolls through the timeline while ensuring performance limits by stopping if the posts are too old (more than 3 hours).
Error Handling:
Built-in timeouts and checks prevent infinite loops or unnecessary actions in case of loading delays or failures.
Technical Details
Supported URL: https://x.com/home
Script Activation: Automatically enabled on the /home page.
Error Logging: Provides detailed console logs for every action, including button clicks, loading states, and post detection.
Requirements
Browser Extension: Tampermonkey (or similar userscript manager)
Supported Browsers: Chrome, Firefox, Edge
Installation
Install Tampermonkey or a compatible userscript manager in your browser.
Copy the script and add it as a new script in Tampermonkey.
Save the script, and it will activate automatically on https://x.com/home.
Notes
This script is tailored specifically for X.com’s /home page and may not function correctly on other parts of the website.
Ensure you have a stable internet connection for uninterrupted operation.
Disclaimer
This script is provided for personal use only and should not be used to violate any terms of service of X.com. The author is not responsible for any consequences resulting from its usage.