i tried n worked ytd but i dont know why it didnt work today...
// ==UserScript==
// @name HV Cooldown
// @namespace hentaiverse.org
// @description Show Cooldown of Spell/Skills on the Quickbar
// @include
http://hentaiverse.org/*// @version 1.1.2
// @author holy_demon
// ==/UserScript==
if (document.getElementById("battleform")) {
var HVCooldown = function() {
var Spell = function(name, cooldown, ready, ref) {
this.name = name;
this.cooldown = cooldown;
this.ready = ready;
this.ref = ref;
};
var getSpells = function() {
var spellInfo = {};
var quickbar_spells = document.querySelectorAll(".btqs");
for (var i = 0; i < quickbar_spells.length; i++) {
var ref = quickbar_spells[i];
var desc = ref.getAttribute("onmouseover");
var info = /\(\'([\w -]*?)\',.*\, (\d*?)\)/.exec(desc);
var opacity = ref.firstElementChild.style.opacity;
if (info && info.length === 3) {
spellInfo[info[1]] = new Spell(info[1], Number(info[2]), !Boolean(opacity), ref);
}
}
return spellInfo;
};
var updateCooldowns = function(old_cooldowns, spellInfo) {
var cur_cooldowns = {};
var log = document.getElementById("togpane_log").textContent;
for (var name in spellInfo) {
if (spellInfo[name].cooldown > 0) { //only examine spell with cooldowns
if (spellInfo[name].ready) {//all ready spells has current cooldown set to -1
cur_cooldowns[name] = -1;
} else if (old_cooldowns[name] > 0 && !document.getElementById("#ckey_continue")) { // if spell was on cooldown previously, reduce it by 1
cur_cooldowns[name] = old_cooldowns[name] - 1;
} else if (old_cooldowns[name] === -1) { //spell was ready last turn
if (RegExp("You (use|cast) " + name + "\\.").exec(log)) { //check if it was casted in battle -> set to max cd
cur_cooldowns[name] = spellInfo[name].cooldown;
} else { // wasn't casted, still ready but unavailable for different reasons
cur_cooldowns[name] = 0;
}
} else { // otherwise assuming no cooldown
cur_cooldowns[name] = 0;
}
}
}
return cur_cooldowns;
};
var drawCooldowns = function(cur_cooldowns, spellInfo) {
var cooldown_style = document.documentElement.appendChild(document.createElement("style"));
cooldown_style.textContent = ".cooldown_indicator {position: relative; display: inline-block; text-align: center; top: 30px; z-index: 100; margin:auto; background: #EFEEDC; border: 1px solid #5C0D11; font-weight: bold; min-width: 12px; padding: 0 1px;}";
for (var name in cur_cooldowns) {
var cooldown = spellInfo[name].ref.appendChild(document.createElement("div"));
cooldown.classList.add("cooldown_indicator");
if (cur_cooldowns[name] === -1) {
cooldown.textContent = "ready";
} else {
cooldown.textContent = cur_cooldowns[name];
}
}
};
this.run = function() {
var spellInfo = getSpells();
var spellCooldown = JSON.parse(sessionStorage.HV_cooldowns || "{}");
spellCooldown = updateCooldowns(spellCooldown, spellInfo);
sessionStorage.HV_cooldowns = JSON.stringify(spellCooldown);
drawCooldowns(spellCooldown, spellInfo);
};
};
(new HVCooldown()).run();
}