Microsoft Teams web client highlight

This highlights unread messages in the Microsoft Teams Web client.

Stan na 06-03-2019. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name      Microsoft Teams web client highlight
// @name:ja   Microsoft Teams Webクライアントのハイライト表示
// @namespace proyuki02
// @version   3
// @license   MIT
// @grant     none
// @match     https://teams.microsoft.com/*
// @require   http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js
// @require   https://cdnjs.cloudflare.com/ajax/libs/favico.js/0.3.10/favico.min.js
// @description This highlights unread messages in the Microsoft Teams Web client.
// @description:ja This highlights unread messages in the Microsoft Teams Web client.
// ==/UserScript==

function addGlobalStyle(css) {
  var head, style;
  head = document.getElementsByTagName('head')[0];
  if (!head) { return; }
  style = document.createElement('style');
  style.type = 'text/css';
  style.innerHTML = css;
  head.appendChild(style);
}

// unread team
addGlobalStyle('.channel-list-team-header a.unread { background-color: rgba(255,182,193,0.5); }');

// unread channel
addGlobalStyle('.ts-channel-list a.ts-unread-channel { background-color: rgba(255,182,193,0.5); }');

// unread message
addGlobalStyle('.mod-unread-message-list-item > div, .mod-unread-message-list-item~.item-wrap.ts-message-list-item > div { background-color: rgba(255,182,193,0.5) !important; }');

(function(){
  var favicon = new Favico({ animation: 'slide' });
  var preCount;
  setInterval(function(){
    // notification badge
    var count = Number($(".app-bar-app-header-bar-common .activity-badge").text());
    if (preCount !== count) {
      preCount = count;
      favicon.badge(count);
    }

    // unread message
    $(".item-wrap.ts-message-list-item:has(.message-list-divider[data-tid='lastReadLine']:not(.ng-hide))").addClass("mod-unread-message-list-item");
  }, 1000);
})();