teams style

styling teams according to the connected account

  1. // ==UserScript==
  2. // @name teams style
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description styling teams according to the connected account
  6. // @author CoStiC
  7. // @match https://teams.microsoft.com/*
  8. // @grant none
  9. // @require https://greasyfork.org/scripts/394721-w84kel/code/w84Kel.js?version=763614
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. waitForKeyElements("#personDropdown", item => getUser(item))
  16. })();
  17.  
  18. function getUser() {
  19. let userContainer = arguments[0].querySelector("[upn]");
  20. let user = userContainer.getAttribute("upn");
  21. teamsStyling(user);
  22. }
  23.  
  24. function teamsStyling(user) {
  25. let hbar = document.querySelectorAll(".app-header-bar")[0],
  26. navbar = document.querySelector("app-bar");;
  27. switch (user) {
  28. case "pierre.mars-prestataire@poste-immo.fr":
  29. hbar.style.background = "#009aa3";
  30. navbar.style.background = "#007076";
  31. break;
  32. case "pierre.mars-prestataire@laposte.fr":
  33. hbar.style.background = "#ffc928";
  34. navbar.style.background = "#003da5";
  35. break;
  36. case "pierre.mars@soprasteria.com" :
  37. hbar.style.background = "#de1823";
  38. navbar.style.background = "#f67200";
  39. break;
  40. }
  41. }