Optimize work experience at Microsoft!
当前为
// ==UserScript==
// @name Optimize work experience at Microsoft
// @namespace https://www.microsoft.com/
// @version 1.0.0
// @description Optimize work experience at Microsoft!
// @author Guosen Wang
// @match https://ms.portal.azure.com/*
// @match https://*.visualstudio.com/*
// @match https://m365pulse.microsoft.com/*
// @match https://eng.ms/docs/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
'use strict';
const host = location.host;
switch (true) {
case 'ms.portal.azure.com' === host:
azure();
break;
case 'm365pulse.microsoft.com' === host:
m365pulse();
break;
case ["developercommunity", "vssps"].indexOf(host.match(/([^\.]+).visualstudio.com/)[1].toLowerCase()) == -1:
vsts();
break;
}
})();
function azure() {
let checkExist = setInterval(function () {
const selector = '#_weave_e_6';
if (document.querySelector(selector)) {
document.querySelector(selector).remove();
const bannerLabel = document.querySelector("#_weave_e_5 > div.fxs-topbar-internal.fxs-internal-full");
bannerLabel.innerText = bannerLabel.innerText.replace(" (Preview)", "");
clearInterval(checkExist);
}
}, 100);
setTimeout(() => {
clearInterval(checkExist);
}, 5000);
}
// Redirect VSTS to DevOps
function vsts() {
let url = location.href.replace(/(\w+)\.visualstudio.com(\/DefaultCollection)?/, 'dev.azure.com/$1');
location.replace(url);
}
function m365pulse() {
// Remove the "New Version" link
let checkExist_NewVersionLink = setInterval(function () {
const newVersionLink = document.querySelector('a.right:nth-child(1)');
if (newVersionLink) {
if (newVersionLink.innerText === 'New Version') {
newVersionLink.remove();
}
clearInterval(checkExist_NewVersionLink);
}
}, 100);
setTimeout(() => {
clearInterval(checkExist_NewVersionLink);
}, 5000);
}