// ==UserScript==
// @name Link to MSDN in en-us
// @description Adds a link in the top left corner of the translated MSDN pages allowing to jump to en-us version.
// @match http*://learn.microsoft.com/*
// @match http*://msdn.microsoft.com/*
// ==/UserScript==
(function() {
'use strict';
let url = location.href;
let rx = /^http([s]?):\/\/(docs|msdn)\.microsoft\.com\/(\w+\-\w+)\/(.*)$/i;
let match;
if ( match = rx.exec(url) ) {
if (match[3] !== 'en-us') {
var targetUrl = url.replace(rx, "http$1://$2.microsoft.com/en-us/$4");
jQuery("body").prepend(
jQuery('<a>en-us</a>').attr('href', targetUrl)
);
}
}
})();