Facebook Chat Group Chat Painter

Paint the title of group chats in different color to make them easier to distinguish

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        Facebook Chat Group Chat Painter
// @namespace   userscript.danielrozenberg.com
// @description Paint the title of group chats in different color to make them easier to distinguish
// @include     https://www.facebook.com/*
// @version     1.1
// @grant       none
// ==/UserScript==


// Add the CSS style to the page
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = ".focusedTab .__fcgcp_group { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVAQMAAACT2TfVAAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMAKEMmZcIAAAA9SURBVAjXdcmhFYAgFADA4xm0WW2uYXMtm4zGKIxA/IHHYwKunoHuEC7No/oUIadgC/bGWbkLb+bHIPVlT7UWFLs2cSVZAAAAAElFTkSuQmCC) !important; }";
document.head.appendChild(style);

// Define the repainting function and set it to run on interval
function repaintChats() {
  for (elm of document.querySelectorAll('.fbNubFlyout .titlebar:not(.__fcgcp)')) {
    elm.classList.add('__fcgcp');
    if (elm.querySelector('a.titlebarText[href*="/messages/conversation"]')) {
      elm.classList.add('__fcgcp_group');
    }
  }
}

window.setInterval(repaintChats, 100);