Change Deviantart "sort by" option back to newest

This replaces the default "/gallery" URL with "/gallery/all?order=newest" in order to make newest sort default for a user's gallery page. You must click on the "all" gallery, or manually refresh the page to activate. This just a quick patch because I don't know JS.

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Change Deviantart "sort by" option back to newest
// @namespace    https://www.deviantart.com
// @version      2025-11-16
// @description  This replaces the default "/gallery" URL with "/gallery/all?order=newest" in order to make newest sort default for a user's gallery page. You must click on the "all" gallery, or manually refresh the page to activate. This just a quick patch because I don't know JS.
// @author       Michael Washboard
// @match        https://www.deviantart.com/*gallery
// @match        https://www.deviantart.com/*gallery/all
// @icon         https://st.deviantart.net/eclipse/icons/favicon-v2-16x16.png
// @grant        none
// @license MIT
// ==/UserScript==
const { href } = window.location;
if (href.slice(-1) == 'l') {
  window.location.replace(href + '?order=newest')
} else if (href.slice(-1) !== '/all?order=newest') {
  window.location.replace(href + '/all?order=newest');
}