Skip to content

Commit

Permalink
Bottom bar now changes depending on bulk-mode and has a height that f…
Browse files Browse the repository at this point in the history
…its all info (#354)
  • Loading branch information
DanielNoord authored Nov 26, 2020
1 parent 66ac922 commit 744ee0d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions CookieMonster.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bul-buy mode', toggle: false};
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}};
CM.ConfigData.Colors = {
desc: {
Expand Down Expand Up @@ -1049,7 +1049,7 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
CM.Disp.CreateBotBar = function() {
CM.Disp.BotBar = document.createElement('div');
CM.Disp.BotBar.id = 'CMBotBar';
CM.Disp.BotBar.style.height = '55px';
CM.Disp.BotBar.style.height = '69px';
CM.Disp.BotBar.style.width = '100%';
CM.Disp.BotBar.style.position = 'absolute';
CM.Disp.BotBar.style.display = 'none';
Expand Down Expand Up @@ -1112,11 +1112,14 @@ CM.Disp.UpdateBotBarOther = function() {
var count = 0;

for (var i in CM.Cache.Objects) {
var target = 'Objects';
if (Game.buyBulk == 10) {target = 'Objects10';}
if (Game.buyBulk == 100) {target = 'Objects100';}
count++;
CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color;
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].pp, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache[target][i].color;
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2);
}
}
}
Expand Down Expand Up @@ -1370,11 +1373,11 @@ CM.Disp.UpdateTimerBar = function() {
CM.Disp.UpdateBotTimerBarDisplay = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '104px';
l('game').style.bottom = '118px';
}
else if (CM.Config.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '56px';
l('game').style.bottom = '70px';
}
else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
l('game').style.bottom = '48px';
Expand Down
2 changes: 1 addition & 1 deletion src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bul-buy mode', toggle: false};
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}};
CM.ConfigData.Colors = {
desc: {
Expand Down
15 changes: 9 additions & 6 deletions src/Disp.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
CM.Disp.CreateBotBar = function() {
CM.Disp.BotBar = document.createElement('div');
CM.Disp.BotBar.id = 'CMBotBar';
CM.Disp.BotBar.style.height = '55px';
CM.Disp.BotBar.style.height = '69px';
CM.Disp.BotBar.style.width = '100%';
CM.Disp.BotBar.style.position = 'absolute';
CM.Disp.BotBar.style.display = 'none';
Expand Down Expand Up @@ -352,11 +352,14 @@ CM.Disp.UpdateBotBarOther = function() {
var count = 0;

for (var i in CM.Cache.Objects) {
var target = 'Objects';
if (Game.buyBulk == 10) {target = 'Objects10';}
if (Game.buyBulk == 100) {target = 'Objects100';}
count++;
CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color;
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].pp, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2);
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache[target][i].color;
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2);
}
}
}
Expand Down Expand Up @@ -610,11 +613,11 @@ CM.Disp.UpdateTimerBar = function() {
CM.Disp.UpdateBotTimerBarDisplay = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '104px';
l('game').style.bottom = '118px';
}
else if (CM.Config.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '56px';
l('game').style.bottom = '70px';
}
else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
l('game').style.bottom = '48px';
Expand Down

0 comments on commit 744ee0d

Please sign in to comment.