Facebook - Force Most Recent

Always set news feed to 'Most Recent'.

当前为 2018-12-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Facebook - Force Most Recent
  3. // @namespace https://greasyfork.org/users/222319
  4. // @version 1.0.2
  5. // @description Always set news feed to 'Most Recent'.
  6. // @author Explisam <explisam@gmail.com>
  7. // @compatible chrome
  8. // @compatible firefox
  9. // @compatible opera
  10. // @compatible safari
  11. // @license MIT License <https://opensource.org/licenses/MIT>
  12. // @include *www.facebook.com
  13. // @include *www.facebook.com/
  14. // @include *www.facebook.com/?*
  15. // @run-at document-start
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20. var url_string = window.location.href;
  21. var url = new URL(url_string);
  22. var sk = url.searchParams.get("sk");
  23. var p = (/(?<=\?).+/).exec(url_string);
  24.  
  25. if (sk !== "h_chr") {
  26. var params = p ? p.toString().replace(/sk=.*?(&|$)/, "") : "";
  27. params = params.concat(params ? params.match(/&$/) ? "sk=h_chr" : "&sk=h_chr" : "sk=h_chr");
  28. window.location.replace(("https://www.facebook.com/?").concat(params));
  29. }
  30. })();