diff --git a/CookieMonster.js b/CookieMonster.js index 69a618b..e734160 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -287,6 +287,7 @@ CM.ToggleStatsConfig = function(config) { CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', func: function() {CM.Disp.ToggleBotBar();}}; CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', func: function() {CM.Disp.ToggleTimerBar();}}; +CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top-left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'}; @@ -521,9 +522,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.bottom = '0px'; CM.Disp.TimerBar.style.height = '48px'; - CM.Disp.TimerBar.style.width = '100%'; CM.Disp.TimerBar.style.fontSize = '10px'; CM.Disp.TimerBar.style.fontWeight = 'bold'; CM.Disp.TimerBar.style.backgroundColor = 'black'; @@ -553,6 +552,10 @@ CM.Disp.CreateTimerBar = function() { colorBar.id = bars[i].id colorBar.style.display = 'inline-block'; colorBar.style.height = '10px'; + if (bars.length == 1 || i == 1) { + colorBar.style.borderTopRightRadius = '10px'; + colorBar.style.borderBottomRightRadius = '10px'; + } if (bars[i].color != undefined) { colorBar.style.backgroundColor = bars[i].color; } @@ -610,6 +613,20 @@ CM.Disp.ToggleTimerBar = function() { else { CM.Disp.TimerBar.style.display = 'none'; } + CM.Disp.ToggleTimerBarPos(); +} + +CM.Disp.ToggleTimerBarPos = function() { + if (CM.Config.TimerBarPos == 0) { + CM.Disp.TimerBar.style.width = '30%'; + CM.Disp.TimerBar.style.bottom = ''; + l('game').insertBefore(CM.Disp.TimerBar, l('game').childNodes[22]); + } + else { + CM.Disp.TimerBar.style.width = '100%'; + CM.Disp.TimerBar.style.bottom = '0px'; + l('wrapper').appendChild(CM.Disp.TimerBar); + } CM.Disp.UpdateBotTimerBarDisplay(); } @@ -684,7 +701,7 @@ CM.Disp.UpdateTimerBar = function() { } CM.Disp.UpdateBotTimerBarDisplay = function() { - if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1) { + if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { CM.Disp.BotBar.style.bottom = '48px'; l('game').style.bottom = '104px'; } @@ -692,13 +709,20 @@ CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.BotBar.style.bottom = '0px'; l('game').style.bottom = '56px'; } - else if (CM.Config.TimerBar == 1) { + else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { l('game').style.bottom = '48px'; } else { // No bars l('game').style.bottom = '0px'; } + if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) { + l('sectionLeft').style.top = '48px'; + } + else { + l('sectionLeft').style.top = ''; + } + CM.Disp.UpdateBackground(); } @@ -1035,6 +1059,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(header('Bars/Colors')); frag.appendChild(listing('BotBar')); frag.appendChild(listing('TimerBar')); + frag.appendChild(listing('TimerBarPos')); frag.appendChild(listing('BuildColor')); frag.appendChild(listing('UpBarColor')); @@ -1884,7 +1909,7 @@ CM.Init = function() { } } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465'; diff --git a/src/Config.js b/src/Config.js index 0d2fae7..16912a1 100644 --- a/src/Config.js +++ b/src/Config.js @@ -98,6 +98,7 @@ CM.ToggleStatsConfig = function(config) { CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', func: function() {CM.Disp.ToggleBotBar();}}; CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', func: function() {CM.Disp.ToggleTimerBar();}}; +CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top-left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'}; diff --git a/src/Disp.js b/src/Disp.js index e6328e2..99b9647 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -203,9 +203,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.bottom = '0px'; CM.Disp.TimerBar.style.height = '48px'; - CM.Disp.TimerBar.style.width = '100%'; CM.Disp.TimerBar.style.fontSize = '10px'; CM.Disp.TimerBar.style.fontWeight = 'bold'; CM.Disp.TimerBar.style.backgroundColor = 'black'; @@ -235,6 +233,10 @@ CM.Disp.CreateTimerBar = function() { colorBar.id = bars[i].id colorBar.style.display = 'inline-block'; colorBar.style.height = '10px'; + if (bars.length == 1 || i == 1) { + colorBar.style.borderTopRightRadius = '10px'; + colorBar.style.borderBottomRightRadius = '10px'; + } if (bars[i].color != undefined) { colorBar.style.backgroundColor = bars[i].color; } @@ -292,6 +294,20 @@ CM.Disp.ToggleTimerBar = function() { else { CM.Disp.TimerBar.style.display = 'none'; } + CM.Disp.ToggleTimerBarPos(); +} + +CM.Disp.ToggleTimerBarPos = function() { + if (CM.Config.TimerBarPos == 0) { + CM.Disp.TimerBar.style.width = '30%'; + CM.Disp.TimerBar.style.bottom = ''; + l('game').insertBefore(CM.Disp.TimerBar, l('game').childNodes[22]); + } + else { + CM.Disp.TimerBar.style.width = '100%'; + CM.Disp.TimerBar.style.bottom = '0px'; + l('wrapper').appendChild(CM.Disp.TimerBar); + } CM.Disp.UpdateBotTimerBarDisplay(); } @@ -366,7 +382,7 @@ CM.Disp.UpdateTimerBar = function() { } CM.Disp.UpdateBotTimerBarDisplay = function() { - if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1) { + if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { CM.Disp.BotBar.style.bottom = '48px'; l('game').style.bottom = '104px'; } @@ -374,13 +390,20 @@ CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.BotBar.style.bottom = '0px'; l('game').style.bottom = '56px'; } - else if (CM.Config.TimerBar == 1) { + else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { l('game').style.bottom = '48px'; } else { // No bars l('game').style.bottom = '0px'; } + if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) { + l('sectionLeft').style.top = '48px'; + } + else { + l('sectionLeft').style.top = ''; + } + CM.Disp.UpdateBackground(); } @@ -717,6 +740,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(header('Bars/Colors')); frag.appendChild(listing('BotBar')); frag.appendChild(listing('TimerBar')); + frag.appendChild(listing('TimerBarPos')); frag.appendChild(listing('BuildColor')); frag.appendChild(listing('UpBarColor')); diff --git a/src/Main.js b/src/Main.js index 7b1e91f..4984d94 100644 --- a/src/Main.js +++ b/src/Main.js @@ -125,7 +125,7 @@ CM.Init = function() { } } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465';