Facebook and Group Sort by CHRONOLOGICAL

Forces Facebook groups to sort posts by newest/chronological automatically

目前为 2025-03-07 提交的版本。查看 最新版本

// ==UserScript==
// @name         Facebook and Group Sort by CHRONOLOGICAL
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Forces Facebook groups to sort posts by newest/chronological automatically
// @author       CHATgpt
// @include       *facebook.com*
// @match       *://*.facebook.com/*
// @exclude       *facebook.com/reel/*
// @exclude       *facebook.com/photo/*
// @grant        none
// @license     MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to update sorting if not already set
    function updateSorting() {
        const url = new URL(window.location.href);
        if (!url.searchParams.has("sorting_setting")) {
            url.searchParams.set("sorting_setting", "CHRONOLOGICAL"); // change to RECENT_ACTIVITY if you want
            window.location.replace(url.href);
        }
    }

    // Run once when the script loads
    updateSorting();

    // Observe URL changes (Facebook uses dynamic navigation)
    let lastUrl = location.href;
    const observer = new MutationObserver(() => {
        if (location.href !== lastUrl) {
            lastUrl = location.href;
            updateSorting();
        }
    });

    // Start observing changes to the page
    observer.observe(document, { subtree: true, childList: true });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址