Facebook Comment Sorter

Forces Facebook comments to show "All Comments" or "Newest" instead of "Most Relevant"

這裡顯示腳本的所有版本。 只顯示彼此間有代碼差異的版本。

  • v2.0 2025-06-01

    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:
      1. Looks for items that start with the exact text we want
      2. Tries to extract just the title part (before Facebook's description text)
      3. 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!

  • v2.0 2025-06-01

    facebook comment sorter: fix various known bug, major update

  • v1.1 2025-04-24 Imported from URL
  • v1.1 2025-04-23

    Facebook Comment Sorter v1.1 - Changelog

    What's changed in this version?

    Bug Fixes

    • Fixed issue with unwanted filter popups on profile pages
    • Resolved problem where script stopped functioning on comment sections
    • Eliminated popup spam when browsing pages with "filters" elements

    Improvements

    • Added targeted blocklist for problematic filter buttons
    • Improved detection of comment sort buttons vs profile filter buttons
    • Enhanced parent element checking to avoid triggering profile filter UI
    • Optimized button selection logic for better accuracy
    • Added specific checks for filter dialogs to prevent unwanted interactions

    Code Enhancements

    • Simplified button detection logic for better maintainability
    • Reorganized code structure for clearer separation of concerns
    • Improved error handling when interacting with Facebook UI elements
    • Enhanced URL processing for more reliable comment sorting
    • Optimized performance by reducing unnecessary button processing
  • v1.0 2025-04-17