HWM_SMS_Sound

Уведомление о почте (и кланрассылке, если включены уведомления)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        HWM_SMS_Sound
// @namespace   Рианти
// @description Уведомление о почте (и кланрассылке, если включены уведомления)
// @include     http://www.heroeswm.ru/*
// @exclude     /.+(battle|battlechat|frames|war|cgame|login|chat|chatonline|ch_box|chat_line|ticker|chatpost)\.php.*/
// @exclude     /.+daily\.heroeswm\.ru.+/
// @version     1
// @grant       none
// ==/UserScript==

if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
    this.GM_getValue = function (key, def) { return localStorage[key] || def; }
    this.GM_setValue = function (key, value) { return localStorage[key] = value; }
    this.GM_deleteValue = function (key) { return delete localStorage[key]; }
}

var lastPlayed = GM_getValue('lastPlayed', '');

if(!lastPlayed){
    var _soundSrc = 'http://hwm.mcdir.ru/sounds/sms.mp3';

    if (document.querySelector('img[src*="pismo.gif"]')){
        new Audio(_soundSrc).play();
        GM_setValue('lastPlayed', 1);
    }
} else {
    if (!document.querySelector('img[src*="pismo.gif"]')){
        GM_deleteValue('lastPlayed');
    }
}