LKML last100 → last1000 redirector

自動把 https://lkml.org/lkml/last100/ 系列網址導向至 last1000/;分頁路徑亦同。

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         LKML last100 → last1000 redirector
// @namespace    https://your-site.example/
// @version      1.0
// @description  自動把 https://lkml.org/lkml/last100/ 系列網址導向至 last1000/;分頁路徑亦同。
// @author       abc0922001
// @match        https://lkml.org/lkml/last100/*
// @run-at       document-start
// @grant        none
// @license      MIT
// ==/UserScript==

(() => {
  'use strict';

  // 僅於 /lkml/last100/ 路徑下運作
  const path = location.pathname;
  if (!/^\/lkml\/last100(\/.*)?$/.test(path)) return;

  // 替換路徑並保留分頁、查詢與錨點
  const newPath = path.replace('/last100', '/last1000');
  const newURL  = `${location.origin}${newPath}${location.search}${location.hash}`;

  // 避免無限迴圈
  if (newURL !== location.href) {
    // replace 不留瀏覽紀錄
    location.replace(newURL);
  }
})();