Added the option to move the timer bars to the top left of the screen. Also added a nice visual rounding to the right side of the bars.

This commit is contained in:
Aktanusa
2014-08-24 22:14:27 -04:00
parent 27833773c9
commit db41ada262
4 changed files with 60 additions and 10 deletions

View File

@@ -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';

View File

@@ -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'};

View File

@@ -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'));

View File

@@ -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';