// ==UserScript==
// @name              T-flomo-当天数据背景
// @author            tianyunperfect
// @description       简介
// @version           1.0.0
// @update            2023年03月08日16:28:55
// @match        https://v.flomoapp.com/mine
// @icon         https://www.google.com/s2/favicons?sz=64&domain=flomoapp.com


// ==/UserScript==
function contains(selector, text) {
    var elements = document.querySelectorAll(selector);
    return Array.prototype.filter.call(elements, function (element) {
        return RegExp(text).test(element.textContent);
    });
}

function getTodayString() {
    const today = new Date();
    const year = today.getFullYear();
    const month = (today.getMonth() + 1).toString().padStart(2, '0');
    const date = today.getDate().toString().padStart(2, '0');
    const dateString = `${year}-${month}-${date}`;
    return dateString;
}

console.log(getTodayString());

(async () => {
    if (window.top !== window.self) {
        return;
    }
    setInterval(() => {
        let contains1 = contains("span", getTodayString());
        for (const dom of contains1) {
            dom.style.backgroundColor = 'yellow'
        }
    }, 2000)

})();
