Discourse Sort Option Quick Switcher

Quickly switch Discourse list sorting (created, activity, replies, views, likes) via menu by updating URL params.

作者
Pipecraft
今日安裝
1
安裝總數
2
評價
0 0 0
版本
0.1.1
建立日期
2025-11-06
更新日期
2025-11-06
尺寸
5.5 KB
授權條款
MIT
腳本執行於

Discourse Sort Option Quick Switcher

Quickly switch Discourse topic list sorting via menu commands by updating URL parameters. Supports multiple sort options (created time, activity time, replies count, views, likes) in both directions, with bilingual labels (English and Chinese).

中文版

screencapture

Features

  • One-click sort switching using user script menu commands
  • Sorting options:
    • Created time: New → Old / Old → New
    • Activity time: New → Old / Old → New
    • Replies count: High → Low / Low → High
    • Views: High → Low / Low → High
    • Likes: High → Low / Low → High
  • Preserves existing query parameters; only updates order and ascending
  • Bilingual menu labels (English and Simplified Chinese) with auto language detection
  • Restricted to specific Discourse forums via @match, avoiding non-target sites
  • Avoids redundant reloads if the current page already matches the target sort

Supported Sites

This script runs only on these domains:

Installation

  1. Install a user script manager:
  2. Install the script:

Usage

  1. Visit a Discourse list page (Latest, New, Categories, Tags, etc.).
  2. Open your user script manager menu.
  3. Choose a sort command from the script menu. The page URL will be updated with order and ascending, and the page will navigate to the target sort.

Menu Items (English)

  • Sort by created (New → Old) / (Old → New)
  • Sort by activity (New → Old) / (Old → New)
  • Sort by replies (High → Low) / (Low → High)
  • Sort by views (High → Low) / (Low → High)

Notes

  • Some pages or forums may not support all sort parameters. In such cases, adding parameters may have no effect.
  • When the current page already matches the chosen sort, navigation is skipped to avoid unnecessary reloads.

Technical Details

  • Uses GM_registerMenuCommand to expose sort options in the script menu.
  • Updates the current page URL by setting order and ascending query parameters, then navigates via window.location.assign(...).
  • Auto language detection via navigator.language (zh* → Simplified Chinese, otherwise English).

Compatibility

Tested on modern browsers with Tampermonkey/Violentmonkey, and designed for Discourse-based forums.

Changelog

v0.1.1

  • Add likes sorting options (High → Low / Low → High)

v0.1.0

  • Initial release
  • Sort by created, activity, replies, views (both directions)
  • Bilingual menu labels (English and Chinese) with auto detection

More Useful Scripts

  • 🏷️ UTags — Add User Tags to Links

    • Greasy Fork镜像
    • Tag users or posts across popular sites; filter, export/import, auto-mark viewed posts
  • 🔄 Discourse Topic Quick Switcher

    • Greasy Fork镜像
    • Quickly navigate between topics with keyboard shortcuts and a floating panel
  • 🔗 Links Helper

    • Greasy Fork镜像
    • Open third-party links in new tabs; parse text links into hyperlinks
  • 🔍 Find Scripts For This Site

    • Greasy Fork镜像
    • One-click search for scripts relevant to the current website across multiple repositories

License

MIT License — see the repository LICENSE file.

Contributing

Issues and pull requests are welcome!

Related Links

QingJ © 2025

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