MSDocs tweaks

Redirects to the en-us version of the current msdocs page and expands the document outline ("In this article")

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         MSDocs tweaks
// @namespace    https://github.com/xparadoxical/msdocs-tweaks
// @author       xparadoxical
// @license      MIT
// @version      1.1.2
// @description  Redirects to the en-us version of the current msdocs page and expands the document outline ("In this article")
// @source       https://github.com/xparadoxical/msdocs-tweaks
// @grant        none
// @run-at       document-start
// @match        https://learn.microsoft.com/*
// ==/UserScript==

//en-us
let pathname = window.location.pathname.split('/');
if (pathname[1].toLowerCase() !== 'en-us') {
    pathname[1] = 'en-us';
    pathname = pathname.join('/');
    window.location.href = window.location.origin + pathname + window.location.search;
} else {
    //auto-expand
    window.addEventListener('load', (event) => {
        document.querySelector('nav#side-doc-outline button[data-show-more]').click();
        document.activeElement.blur/*unfocus*/();

        const hash = window.location.hash;
        document.querySelector("[id='" + hash.substring(1) + "']").scrollIntoView();
    });
}