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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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