Greasy Fork

Greasy Fork is available in English.

Yahoo! new mail alert

This script will play the classic "Yahoo! Mail" voice wav file when it detects you have new unread mail in your mailbox

当前为 2014-09-05 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Yahoo! new mail alert
// @namespace   https://github.com/mjremijan
// @include     https://*.mail.yahoo.com/*
// @version     1
// @grant       none
// @description This script will play the classic "Yahoo! Mail" voice wav file when it detects you have new unread mail in your mailbox
// ==/UserScript==
 
var unread = -1;

function checkForUnread() {
	// (xx unread) ....
	var t = document.title;
	var p = -1;
	if (t.charAt(0) == "(") {
		p = parseInt(t.substring(1, t.indexOf(" ")));
		//alert("p = ["+p+"]");
	}
	
	var play = false;
	if (unread == -1) {
		unread = p;
		play = (unread > 0);
	} else {
		if (p > unread) {
			play = true;
		}
		unread = p;
	}
	
	if (play) 
	{
		var wavFile = "https://www.dropbox.com/s/bsmsmccug65vdtd/yahoomail.wav?dl=1";
	
		var src1 = document.createElement('SOURCE');
		src1.type= 'audio/wav';
		src1.src= wavFile;

		var e = document.createElement('AUDIO');
		e.appendChild(src1);
		e.play();
	}
}

setInterval(checkForUnread, 60 * 1000); // 60 * 1000 ms