Hopefully fix jscolor not loading before CM.Init is called (Thanks The_omniscent_pie)

This commit is contained in:
Aktanusa
2014-09-06 16:18:06 -04:00
parent 450db504be
commit c54ecefe4b
2 changed files with 58 additions and 38 deletions

View File

@@ -1894,7 +1894,7 @@ CM.ReplaceNative = function() {
CM.Backup.UpdateMenu = Game.UpdateMenu; CM.Backup.UpdateMenu = Game.UpdateMenu;
Game.UpdateMenu = function() { Game.UpdateMenu = function() {
if (jscolor == undefined || jscolor.picker == undefined || jscolor.picker.owner == undefined) { if (jscolor.picker == undefined || jscolor.picker.owner == undefined) {
CM.Backup.UpdateMenu(); CM.Backup.UpdateMenu();
CM.Disp.AddMenu(); CM.Disp.AddMenu();
} }
@@ -1956,6 +1956,17 @@ CM.Init = function() {
} }
if (proceed) { if (proceed) {
CM.Disp.AddJscolor(); CM.Disp.AddJscolor();
var delay = setInterval(function() {
if (jscolor != undefined) {
CM.DelayInit();
clearInterval(delay);
}
}, 500);
}
}
CM.DelayInit = function() {
CM.Disp.CreateCssArea(); CM.Disp.CreateCssArea();
CM.Disp.CreateBotBar(); CM.Disp.CreateBotBar();
CM.Disp.CreateTimerBar(); CM.Disp.CreateTimerBar();
@@ -1976,7 +1987,6 @@ CM.Init = function() {
Game.Win('Third-party'); Game.Win('Third-party');
} }
}
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}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; 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}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}};
CM.ConfigPrefix = 'CMConfig'; CM.ConfigPrefix = 'CMConfig';

View File

@@ -45,7 +45,7 @@ CM.ReplaceNative = function() {
CM.Backup.UpdateMenu = Game.UpdateMenu; CM.Backup.UpdateMenu = Game.UpdateMenu;
Game.UpdateMenu = function() { Game.UpdateMenu = function() {
if (jscolor == undefined || jscolor.picker == undefined || jscolor.picker.owner == undefined) { if (jscolor.picker == undefined || jscolor.picker.owner == undefined) {
CM.Backup.UpdateMenu(); CM.Backup.UpdateMenu();
CM.Disp.AddMenu(); CM.Disp.AddMenu();
} }
@@ -107,6 +107,17 @@ CM.Init = function() {
} }
if (proceed) { if (proceed) {
CM.Disp.AddJscolor(); CM.Disp.AddJscolor();
var delay = setInterval(function() {
if (jscolor != undefined) {
CM.DelayInit();
clearInterval(delay);
}
}, 500);
}
}
CM.DelayInit = function() {
CM.Disp.CreateCssArea(); CM.Disp.CreateCssArea();
CM.Disp.CreateBotBar(); CM.Disp.CreateBotBar();
CM.Disp.CreateTimerBar(); CM.Disp.CreateTimerBar();
@@ -127,7 +138,6 @@ CM.Init = function() {
Game.Win('Third-party'); Game.Win('Third-party');
} }
}
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}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; 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}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}};
CM.ConfigPrefix = 'CMConfig'; CM.ConfigPrefix = 'CMConfig';