Greasy Fork is available in English.

NetTruyen Tools (Remake)

Remove ads and add zoom-out options for NetTruyen

Skaber
Anh Khoa Phan
Daglige installationer
0
Installationer i alt
1
Bedømmelser
0 0 0
Version
1.3
Oprettet
13.05.2024
Opdateret
13.05.2024
Licens
MIT
Gælder for

Based on kylyte's version of the code, I have proceeded to upgrade the code:
1. Enhanced Ad Removal Selectors
• Original kylyte Version: The script targeted specific ad-related elements with precise CSS selectors. While effective, it required updates whenever the page structure changed.
• Updated AstralRift Version: I've expanded the ad removal capability by including broader CSS selectors that target ad elements by common attributes found in their class and id, such as “div[class*="ads"] and div[id*="ad-"]”. This approach is designed to be more robust against changes in the website's structure and naming conventions, ensuring that the script remains effective even if the website updates its layout or adds new ad elements.

2. Improved Zoom Functionality
• Original kylyte Version: Zoom functionality was applied by adjusting the width and height of images based on a zoom factor, which could potentially distort the image display under certain conditions.
• Updated AstralRift Version: The zoom function now uses CSS transforms (“transform: scale()”) to resize images, which is a more modern and efficient approach. This method preserves image quality and aspect ratio, enhances performance, and provides a smoother user experience with the addition of transition effects (“transition: transform 0.3s ease”). The transform origin is set to 'top left', ensuring consistent scaling behavior.

3. Improved lazy loading for comments
• Original kylyte Version: Implemented a basic lazy loading mechanism using “IntersectionObserver”, which is an advanced technique to load content as it comes into view.
• Updated AstralRift Version: I further optimized the lazy loading by ensuring that the IntersectionObserver is properly cleaned up after its job is done by unobserving the observed elements. This cleanup process prevents potential memory leaks and ensures better performance as the number of elements monitored by the observer is reduced after they are loaded.

4. Enhanced Error Handling and User Feedback
• Updated AstralRift Version: I introduced error handling in the zoom functionality, which provides console error messages if the user tries to set an invalid zoom factor. This feedback is crucial for debugging and enhancing user interaction, ensuring that users are aware of any issues with their input.

5. Usability Improvements
• Updated AstralRift Version: Added more intuitive and user-friendly menu commands for zoom levels, each clearly labeled with the percentage for easy recognition. This update helps users quickly select their desired zoom level without confusion, improving overall usability.
These updates make the script more adaptable, robust, and user-friendly, enhancing its functionality and ensuring better long-term performance on the NetTruyen website.

Thank you!
Best regard, AstralRift