LNK_clanEvent

проверка клановых игроков в парном ивенте

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         LNK_clanEvent
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  проверка клановых игроков в парном ивенте
// @author       LNK
// @include      *heroeswm.ru/tj_event2.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

function notifyMes(title,mes) {
	if (!("Notification" in window)) {alert("Ваш браузер не поддерживает сообщения на рабочий стол!"); return false;}
	if (title == undefined) {title = "Some message from HWM!";}
	if (Notification.permission === "granted") {var notification = new Notification(title, {body : mes});}
	else {
		Notification.requestPermission(function (permission) {
			if (permission === "granted") {var notification = new Notification(title, {body : mes});}
		});
	}
} // notifyMes

function beep(duration, frequency, delay, gain) {
	var context = new (window.AudioContext || window.webkitAudioContext)();
	var gainNode = context.createGain();
	if (gain == undefined) {gain = 0.05;}
	gainNode.connect(context.destination);
	gainNode.gain.value = gain;
	var osc = context.createOscillator();
	osc.connect(gainNode);
	osc.type = 'square';
	if (frequency == undefined) {frequency = 350;}
	osc.frequency.value = frequency;
	if (delay == undefined) {delay = 50;}
	if (duration == undefined) {duration = 200;}
	setTimeout(function() {	osc.start(); setTimeout(function () { osc.stop(); }, duration);	}, delay);
	return osc;
} // beep

	var page = document.body.innerHTML;

	function checkMail() {
		page = document.body.innerHTML;
		var n = page.indexOf('Вступить к клану');
		if (n < 0) return false;
		beep(500);
		setTimeout(() => notifyMes('Event clan vacancy'), 1000);
	} //checkMail
//	setInterval(function() { page = document.body.innerHTML; alert(page.indexOf('Входящие'));}, 3000);
	setInterval(checkMail, 30000);
})();