您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Very useful when coming from elsewhere and ending up with docs some random ancient version.
// ==UserScript== // @namespace https://kludge.guru/ // @name Redirect PostgreSQL.org docs to current version // @description Very useful when coming from elsewhere and ending up with docs some random ancient version. // @match https://www.postgresql.org/docs/* // @version 1.0 // ==/UserScript== function maybeRedirect() { if (!document.referrer || document.referrer.indexOf('https://www.postgresql.org') === 0) { return; } const { pathname } = document.location; const match = pathname.match(/^\/docs\/[0-9\.]+\/(.*)$/); if (!match) { return; } const url = `/docs/current/${match[1]}`; const a = document.querySelector(`a[href="${url}"]`); if (!a) { return; } location.replace(url); } maybeRedirect();