Redirect Reddit to show new posts

This script will automatically redirect subreddits to show new posts

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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