Microsoft Teams web client highlight

This highlights unread messages in the Microsoft Teams Web client.

Version vom 06.03.2019. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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 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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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      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);
})();