Greasy Fork

Greasy Fork is available in English.

Facebook Chat Group Chat Painter

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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