Sort Facebook NewsFeed by Most Recent

Automatically sorts your news feed by Most Recent instead of by Top Stories.

目前为 2016-04-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Sort Facebook NewsFeed by Most Recent
  3. // @version 1.0
  4. // @description Automatically sorts your news feed by Most Recent instead of by Top Stories.
  5. // @author Eric Mintz
  6. // @match https://www.facebook.com/*
  7. // @grant none
  8. // @run-at document-start
  9. // @namespace https://greasyfork.org/users/7084
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var addListener = function(){
  16. document.addEventListener('DOMSubtreeModified',domChangeListener);
  17. };
  18.  
  19. var removeListener = function(){
  20. // pause the monitor for 10 seconds (less CPU)
  21. document.removeEventListener('DOMSubtreeModified',domChangeListener);
  22. setTimout(function(){addListener();},10000);
  23. };
  24.  
  25. var domChangeListener = function() {
  26. if (document.location.href == 'https://www.facebook.com/') {
  27. //orderByPostDate;
  28. document.location.href += '?sk=h_chr';
  29. removeListener();
  30. }
  31. };
  32. // Start the monitor
  33. addListener();
  34.  
  35. })();