Facebook - Show Most Recent Posts by Default

Forces the news feed to show 'most recent' posts by default.

  1. // ==UserScript==
  2. // @name Facebook - Show Most Recent Posts by Default
  3. // @namespace https://greasyfork.org/users/222319
  4. // @version 1.0.4
  5. // @description Forces the news feed to show 'most recent' posts by default.
  6. // @author Nomicwave <nomicwave@gmail.com>
  7. // @license MIT License <https://opensource.org/licenses/MIT>
  8. // @match *.facebook.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=facebook.com
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var url_string = window.location.href;
  16. var url = new URL(url_string);
  17. var sk = url.searchParams.get("sk");
  18.  
  19. if (sk !== "h_chr") {
  20. var p = (/(?<=\?).+/).exec(url_string);
  21. var params = p ? p.toString().replace(/sk=.*?(&|$)/, "") : "";
  22. params = params.concat(params ? params.match(/&$/) ? "sk=h_chr" : "&sk=h_chr" : "sk=h_chr");
  23. window.location.replace(("https://www.facebook.com/?").concat(params));
  24. }
  25. })();