Greasy Fork

Greasy Fork is available in English.

Yahoo!Mail Highlight important emails

Highlight emails coming from specific senders.

当前为 2024-05-27 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Yahoo!Mail Highlight important emails
// @namespace    http://tampermonkey.net/
// @version      2024-05-27
// @description  Highlight emails coming from specific senders.
// @author       blaze_125
// @match        https://mail.yahoo.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=yahoo.com
// @grant        none
// @license      MIT
// ==/UserScript==
/*
Add your desired email addresses to the 'emailAddressList' array.
When you're done with it it should look something like this
var emailAddressList = ["[email protected]", "[email protected]".toLowerCase()];

if you do not want to get an alert, then make 'alertMe' false.
*/
(function () {
    'use strict';
    window.localStorage.setItem("warnedAbout", "");
    document.addEventListener('DOMNodeInserted', function (e) {
        var alertMe = true;
        var warnedAbout = window.localStorage.getItem("warnedAbout").split(";");
        var emailAddressList = ["[email protected]".toLowerCase()];//always lowercase the addresses in here
        var lst = document.querySelectorAll("div[data-test-id='senders']");
        var foundLst = [];
        for (var i = 0; i < lst.length; i++) {
            var b = lst[i].querySelector("span[data-test-id='senders_list']");
            //console.log(b.title.toLowerCase());
            if (emailAddressList.indexOf(b.title.toLowerCase()) > -1) {
                if (warnedAbout.indexOf(b.title) == -1 && foundLst.indexOf(b.title) == -1) {
                    foundLst.splice(0, 0, b.title);
                }
                b.setAttribute("style", "color: red;")
            }
        }
        if (alertMe) {
            if (foundLst.length > 0) {
                window.localStorage.setItem("warnedAbout", warnedAbout.concat(foundLst).join(";"));
                alert("Found emails you should be interested in. Look carefuly\r\n" + foundLst.join("\n\r"));
            }
        }
    });
})();