Redirect Reddit to show new posts

This script will automatically redirect subreddits to show new posts

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Redirect Reddit to show new posts
// @namespace   Violentmonkey Scripts
// @version     1.2
// @homepage    https://greasyfork.org/en/scripts/403954-redirect-reddit-to-show-new-posts
// @description This script will automatically redirect subreddits to show new posts
// @include     https://reddit.com/r/*
// @include     https://www.reddit.com/r/*
// @author      Aar318
// @description Script to Redirect subreddits to show new posts - 5/16/2020, 12:47:17 PM
// @grant       none
// ==/UserScript==

  // Redirect Reddit to show new posts //

(function () {
"use strict";

const { pathname, origin, href } = window.location;

if (href.includes("/comments")) return; // comment this out to function again

if (!pathname.includes("/new"))
  window.location.href = `${origin}${pathname}${
    pathname.endsWith("/")
      ? ""
      : "/"
//  }embed?pub=true`;
  }new`; 
})();


setTimeout(function(){
  document.querySelector('button#LayoutSwitch--picker').click();
  console.log("Layout Switcher");
}, 500);

setTimeout(function(){
  document.querySelector('button._10K5i7NW6qcm-UoCtpB3aK._3LwUIE7yX7CZQKmD2L87vf._1F02c6Yw0dfhdWwl99UrYn._1oYEKCssGFjqxQ9jJMNj5G').click();  
  console.log("Classic View");
}, 800);

setTimeout(function(){
  document.querySelector('h1._2yYPPW47QxD4lFQTKpfpLQ').click();  
  console.log("Click off of Picker");
}, 1000);

//button._10K5i7NW6qcm-UoCtpB3aK._3LwUIE7yX7CZQKmD2L87vf._1F02c6Yw0dfhdWwl99UrYn._1oYEKCssGFjqxQ9jJMNj5G //classic
//button#LayoutSwitch--picker._10K5i7NW6qcm-UoCtpB3aK._3LwUIE7yX7CZQKmD2L87vf._1F02c6Yw0dfhdWwl99UrYn._1fiOgAxLiYfEU41C1NOX9B._1IKtbRloF_LV1hPqMzP3MC // picker