Todoist background colors 2023

Todoist.com changes upcoming section list itemms background color

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Todoist background colors 2023
// @namespace    https://todoist.com/app
// @version      0.0.2a
// @description  Todoist.com changes upcoming section list itemms background color 
// @copyright    samo, 2023
// @match        https://todoist.com/app*
// @license      free 
// ==/UserScript==

//Array with tasks parameters
// 0 - box name
// 1 - Text color - not used now 
// 2 - Background color
var pairings = [["work" , "white", "orangered" ],
                   ["vp", "white", "red"],
                   ["meet", "white", "red"],
                   ["home", "white", "red"],
                   ["vp", "blue" , "lightgreen"]
                  ];

// Changing tasks colour
function colour_tasks() {
    var tasks = document.getElementsByClassName("task_list_item__body");
    for (let i = 0; i < 200; i++){
        console.log(tasks);
        console.log(tasks[i]);
        console.log(tasks.item(i));
        var project_text_box = tasks.item(i).getElementsByClassName('a83bd4e0 _266d6623 _6a3e5ade _2f303ac3 _2a3b75a1 _211eebc7');
        console.log("before pairings");
        pairings.forEach(function(ls){
            console.log(ls);
            if (project_text_box.getElementsByTagName("span") == pairings[0]) {
                console.log("xxxxxxxxxxx");
                // if(project_text_box.innerText == ls[0]){
                // labels[i].innerText = labels[i].innerText.toUpperCase();
                // labels[i].style.color = ls[1];
                tasks.style.backgroundColor = ls[2];
            // }
            }
        })
    }
}

colour_tasks();
//setInterval(colour_labels, 1000);