Optimize work experience at Microsoft

Optimize work experience at Microsoft!

  1. // ==UserScript==
  2. // @name Optimize work experience at Microsoft
  3. // @namespace https://www.microsoft.com/
  4. // @version 1.0.0
  5. // @description Optimize work experience at Microsoft!
  6. // @author Guosen Wang
  7. // @match https://ms.portal.azure.com/*
  8. // @match https://*.visualstudio.com/*
  9. // @match https://m365pulse.microsoft.com/*
  10. // @run-at document-start
  11. // @grant none
  12. // ==/UserScript==
  13. (function () {
  14. 'use strict';
  15. const host = location.host;
  16.  
  17. switch (true) {
  18. case 'ms.portal.azure.com' === host:
  19. azure();
  20. break;
  21. case 'm365pulse.microsoft.com' === host:
  22. m365pulse();
  23. break;
  24. case ["developercommunity", "vssps"].indexOf(host.match(/([^\.]+).visualstudio.com/)[1].toLowerCase()) == -1:
  25. vsts();
  26. break;
  27. }
  28. })();
  29.  
  30. function azure() {
  31. let checkExist = setInterval(function () {
  32. const selector = '#_weave_e_6';
  33. if (document.querySelector(selector)) {
  34. document.querySelector(selector).remove();
  35. const bannerLabel = document.querySelector("#_weave_e_5 > div.fxs-topbar-internal.fxs-internal-full");
  36. bannerLabel.innerText = bannerLabel.innerText.replace(" (Preview)", "");
  37. clearInterval(checkExist);
  38. }
  39. }, 100);
  40. setTimeout(() => {
  41. clearInterval(checkExist);
  42. }, 5000);
  43. }
  44.  
  45. // Redirect VSTS to DevOps
  46. function vsts() {
  47. let url = location.href.replace(/(\w+)\.visualstudio.com(\/DefaultCollection)?/, 'dev.azure.com/$1');
  48. location.replace(url);
  49. }
  50.  
  51. function m365pulse() {
  52. // Remove the "New Version" link
  53. let checkExist_NewVersionLink = setInterval(function () {
  54. const newVersionLink = document.querySelector('a.right:nth-child(1)');
  55. if (newVersionLink) {
  56. if (newVersionLink.innerText === 'New Version') {
  57. newVersionLink.remove();
  58. }
  59. clearInterval(checkExist_NewVersionLink);
  60. }
  61. }, 100);
  62. setTimeout(() => {
  63. clearInterval(checkExist_NewVersionLink);
  64. }, 5000);
  65.  
  66. // Remove feedback widget
  67. let checkExist_FeedbackWidget = setInterval(function () {
  68. const feedbackWidget = document.querySelector('div[class^="feedback-"]');
  69. if (feedbackWidget) {
  70. feedbackWidget.parentElement.remove();
  71. clearInterval(checkExist_FeedbackWidget);
  72. }
  73. }, 100);
  74. setTimeout(() => {
  75. clearInterval(checkExist_FeedbackWidget);
  76. }, 10000);
  77. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址