// ==UserScript==
// @name Regeneration [GW]
// @namespace
// @description Более подробная информация о выздоровлении персонажа.
// @include http://www.ganjawars.ru/me/*
// @version 1.01
// @author W_or_M, modified by TWW for Chrome
// ==/UserScript==
(function() {
// НАСТРОЙКИ
//-----------------------------------
var sound80 = 22; // звуковое оповещение при 80%, для отключения 0
var sound100 = 22; // звуковое оповещение при 100%, для отключения 0
var color = 'blue'; // цвет надписи, формат - #XXXXXX (X - от 0 до F)
//-----------------------------------
var state;
var hp_current;
var hp_max;
var hp_speed;
// куки
function setCookie (name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
function playSound(soundId) {
// создаем контейнер, если еще не создан
if (root.document.getElementById('flashcontent') == null) {
var div = root.document.createElement('div');
div.id = 'flashcontent';
root.document.body.appendChild(div);
}
root.document.getElementById('flashcontent').innerHTML = '';
}
// установка состояния
function setState(stateId) {
state = stateId;
setCookie('regen_state', stateId, 0, '/');
}
var root = typeof unsafeWindow != 'undefined' ? unsafeWindow : window;
// мы на главной
if (root.location.href.indexOf('http://www.ganjawars.ru/me/') >= 0) {
var tmp = root.document.head.innerHTML;
var myArray2 = tmp.match(/