Last active
April 7, 2024 04:57
-
-
Save fujieda/bc86460d04c7256658c9fa2d99b55d2f to your computer and use it in GitHub Desktop.
Switches to en-US when loading Microsoft documents from another language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Prefer English on Microsoft | |
// @namespace https://gist.github.com/fujieda/bc86460d04c7256658c9fa2d99b55d2f/raw | |
// @description Switches to en-US when loading Microsoft documents from another language | |
// @include https://learn.microsoft.com/* | |
// ==/UserScript== | |
var pattern = /(.*microsoft.com)\/([a-z]{2}-[a-z]{2})\/(.*)/i; | |
var replacement = "$1/en-us/$3"; | |
var oldurl = window.location.href; | |
var newurl = oldurl.replace(pattern, replacement); | |
if (newurl != oldurl) | |
{ | |
window.stop(); | |
window.location.assign(newurl); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment