teams style

styling teams according to the connected account

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         teams style
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  styling teams according to the connected account
// @author       CoStiC
// @match        https://teams.microsoft.com/*
// @grant        none
// @require https://greasyfork.org/scripts/394721-w84kel/code/w84Kel.js?version=763614
// ==/UserScript==

(function() {
    'use strict';

    waitForKeyElements("#personDropdown", item => getUser(item))
})();

function getUser() {
    let userContainer = arguments[0].querySelector("[upn]");
    let user = userContainer.getAttribute("upn");
    teamsStyling(user);
}

function teamsStyling(user) {
    let hbar = document.querySelectorAll(".app-header-bar")[0],
        navbar = document.querySelector("app-bar");;
    switch (user) {
        case "[email protected]":
            hbar.style.background = "#009aa3";
            navbar.style.background = "#007076";
            break;
        case "[email protected]":
            hbar.style.background = "#ffc928";
            navbar.style.background = "#003da5";
            break;
        case "[email protected]" :
            hbar.style.background = "#de1823";
            navbar.style.background = "#f67200";
            break;
    }
}