Version 2.0 - "finally fixed That annoying bug" update
What Got Fixed
- The big one: Script was being dumb and clicking "Newest" when you wanted "All Comments". Here's what was happening:
- Facebook's "Newest" menu item actually contains text like "NewestShow all comments with the newest comments first"
- Our old matching logic saw "all comments" in there and thought it was the "All Comments" option
- So when you set
sortPreference = "all"
, it kept clicking "Newest" instead
- Now we check if the text STARTS with our target words instead of just containing them
- Menu detection completely rewritten - now it actually separates menu titles from descriptions
- Fixed the script randomly stopping working on some comment sections
What's New
- Smart matching system: Tries 3 different strategies to find the right menu option:
- Looks for items that start with the exact text we want
- Tries to extract just the title part (before Facebook's description text)
- Falls back to menu positions if text matching fails (Most Relevant=0, Newest=1, All Comments=2)
- Debug mode: Set
DEBUG = true
to see exactly what's happening in the console
- Shows all menu items it finds
- Tells you which matching strategy worked
- Logs API modifications
- Better language support: Added more translations and smarter text detection
- More API coverage: Now modifies additional Facebook parameters like
view_option
, sort_by
, isInitialFetch
Under the Hood Stuff
- Completely rewrote the menu item matching logic (was a mess before)
- Enhanced GraphQL POST body modification - now catches more API calls
- Better error recovery - removes buttons from processed list if menu doesn't appear
- Added comprehensive parameter mappings for both XMLHttpRequest and fetch
- Improved button filtering to avoid clicking wrong elements
- More robust URL change detection
How to Use It
Same as before - just change the setting at the top:
const sortPreference = "all"; // for all comments
const sortPreference = "newest"; // for newest first
Known Issues
- Sometimes needs a second try on slow connections
- Facebook changes their interface randomly, so it might break occasionally
Version 1.1 (Previous Update)
- Fixed some menu clicking issues
- Added support for different languages
- Made it work with Facebook's GraphQL API changes
Version 1.0 (First Release)
- Basic comment sorting
- Worked... most of the time 😅
Note: If something breaks, check the browser console with DEBUG = true
and let me know what you see!