teams style

styling teams according to the connected account

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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;
    }
}