Reddit Auto-Open First Post

Auto open first post in Reddit front page using Reddit API URL: https://api.reddit.com/?goToFirstPost

  1. // ==UserScript==
  2. // @name Reddit Auto-Open First Post
  3. // @namespace RedditAutoOpenFirstPost
  4. // @description Auto open first post in Reddit front page using Reddit API URL: https://api.reddit.com/?goToFirstPost
  5. // @include https://api.reddit.com/*
  6. // @version 1
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. if (location.pathname === "/") {
  11. if (location.search.toLowerCase() === "?gotofirstpost") {
  12. var obj = JSON.parse(document.body.children[0].innerHTML);
  13. var entries = obj.data.children;
  14. if (entries.length) {
  15. location.href = "https://www.reddit.com" + entries[0].data.permalink;
  16. } else {
  17. alert("No posted entry found in Reddit front page data.");
  18. }
  19. }
  20. }

QingJ © 2025

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