Fixed (#388) and add percentage overlay to timers
This commit is contained in:
21
src/Disp.js
21
src/Disp.js
@@ -442,7 +442,7 @@ CM.Disp.CreateTimerBar = function() {
|
||||
CM.Disp.TimerBar.id = 'CMTimerBar';
|
||||
CM.Disp.TimerBar.style.position = 'absolute';
|
||||
CM.Disp.TimerBar.style.display = 'none';
|
||||
CM.Disp.TimerBar.style.height = '48px';
|
||||
CM.Disp.TimerBar.style.height = '30px';
|
||||
CM.Disp.TimerBar.style.fontSize = '10px';
|
||||
CM.Disp.TimerBar.style.fontWeight = 'bold';
|
||||
CM.Disp.TimerBar.style.backgroundColor = 'black';
|
||||
@@ -591,7 +591,8 @@ CM.Disp.UpdateTimerBar = function() {
|
||||
}
|
||||
else classColor = CM.Disp.colorPurple;
|
||||
timer.lastChild.children[1].className = CM.Disp.colorBackPre + classColor;
|
||||
timer.lastChild.children[1].style.width = Math.round(Game.buffs[i].time *(maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime) + 'px';
|
||||
timer.lastChild.children[1].textContent = Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime)) + "%";
|
||||
timer.lastChild.children[1].style.width = Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime) + 'px';
|
||||
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
|
||||
numberOfTimers++;
|
||||
CM.Disp.BuffTimerBars[Game.buffs[i].name] = timer
|
||||
@@ -602,13 +603,7 @@ CM.Disp.UpdateTimerBar = function() {
|
||||
}
|
||||
|
||||
if (numberOfTimers != 0) {
|
||||
var height = 48 / numberOfTimers;
|
||||
for (var i in CM.Disp.TimerBars) {
|
||||
CM.Disp.TimerBars[i].style.height = height + 'px';
|
||||
}
|
||||
for (var i in CM.Disp.BuffTimerBars) {
|
||||
CM.Disp.BuffTimerBars[i].style.height = height + 'px';
|
||||
}
|
||||
CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -650,22 +645,22 @@ CM.Disp.ToggleTimerBarPos = function() {
|
||||
*/
|
||||
CM.Disp.UpdateBotTimerBarPosition = function() {
|
||||
if (CM.Options.BotBar == 1 && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
|
||||
CM.Disp.BotBar.style.bottom = '48px';
|
||||
l('game').style.bottom = '118px';
|
||||
CM.Disp.BotBar.style.bottom = CM.Disp.TimerBar.style.height;
|
||||
l('game').style.bottom = Number(CM.Disp.TimerBar.style.height.replace("px","")) + 70 + "px";
|
||||
}
|
||||
else if (CM.Options.BotBar == 1) {
|
||||
CM.Disp.BotBar.style.bottom = '0px';
|
||||
l('game').style.bottom = '70px';
|
||||
}
|
||||
else if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
|
||||
l('game').style.bottom = '48px';
|
||||
l('game').style.bottom = CM.Disp.TimerBar.style.height;
|
||||
}
|
||||
else { // No bars
|
||||
l('game').style.bottom = '0px';
|
||||
}
|
||||
|
||||
if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
|
||||
l('sectionLeft').style.top = '48px';
|
||||
l('sectionLeft').style.top = CM.Disp.TimerBar.style.height;
|
||||
}
|
||||
else {
|
||||
l('sectionLeft').style.top = '';
|
||||
|
||||
Reference in New Issue
Block a user