Changed variable names

This commit is contained in:
Daniel van Noord
2021-02-09 23:13:42 +01:00
parent a025fe51d7
commit fec72bbf91
5 changed files with 76 additions and 85 deletions

View File

@@ -106,15 +106,15 @@ CM.Config.ToggleConfig = function(config) {
if (CM.Options[config] == CM.ConfigData[config].label.length) {
CM.Options[config] = 0;
if (CM.ConfigData[config].toggle) l(CM.ConfigPrefix + config).className = 'option off';
if (CM.ConfigData[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off';
}
else l(CM.ConfigPrefix + config).className = 'option';
else l(CM.Config.ConfigPrefix + config).className = 'option';
if (typeof CM.ConfigData[config].func !== 'undefined') {
CM.ConfigData[config].func();
}
l(CM.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]];
l(CM.Config.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]];
CM.Config.SaveConfig();
};
@@ -176,4 +176,12 @@ CM.Config.CheckNotificationPermissions = function(ToggleOnOff) {
}
}
}
};
};
/********
* Section: Variables used in Config functions */
/**
* Used to name certain DOM elements and refer to them
*/
CM.Config.ConfigPrefix = 'CMConfig';

View File

@@ -2049,7 +2049,7 @@ CM.Disp.CreatePrefOption = function(config) {
else {
a.className = 'option';
}
a.id = CM.ConfigPrefix + config;
a.id = CM.Config.ConfigPrefix + config;
a.onclick = function() {CM.Config.ToggleConfig(config);};
a.textContent = CM.ConfigData[config].label[CM.Options[config]];
div.appendChild(a);
@@ -2095,7 +2095,7 @@ CM.Disp.CreatePrefOption = function(config) {
span.textContent = CM.ConfigData[config].label + ' ';
div.appendChild(span);
let input = document.createElement('input');
input.id = CM.ConfigPrefix + config;
input.id = CM.Config.ConfigPrefix + config;
input.className = 'option';
input.type = 'text';
input.readOnly = true;
@@ -2104,13 +2104,13 @@ CM.Disp.CreatePrefOption = function(config) {
div.appendChild(input);
div.appendChild(document.createTextNode(' '));
let inputPrompt = document.createElement('input');
inputPrompt.id = CM.ConfigPrefix + config + 'Prompt';
inputPrompt.id = CM.Config.ConfigPrefix + config + 'Prompt';
inputPrompt.className = 'option';
inputPrompt.type = 'text';
inputPrompt.setAttribute('value', CM.Options[config]);
let a = document.createElement('a');
a.className = 'option';
a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);};
a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.Config.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);};
a.textContent = 'Edit';
div.appendChild(a);
let label = document.createElement('label');
@@ -2145,7 +2145,7 @@ CM.Disp.CreatePrefOption = function(config) {
span.textContent = CM.ConfigData[config].label + ' ';
div.appendChild(span);
let input = document.createElement('input');
input.id = CM.ConfigPrefix + config;
input.id = CM.Config.ConfigPrefix + config;
input.className = 'option';
input.type = 'number';
input.value = (CM.Options[config]);

View File

@@ -5,33 +5,17 @@
/**
* This functions creates the necessary objects and is run when they do not already exist
*/
const RunCookieMonsterHeader = function() {
CM = {};
CM.VersionMajor = '2.031';
CM.VersionMinor = '3';
CM.Backup = {};
CM.Cache = {};
CM.Config = {};
CM.ConfigData = {};
CM.Data = {};
CM.Disp = {};
CM.Footer = {};
CM.Main = {};
CM.Options = {};
CM.Sim = {};
const CM = {
Backup: {},
Cache: {},
Config: {},
ConfigData: {},
Data: {},
Disp: {},
Footer: {},
Main: {},
Options: {},
Sim: {},
VersionMajor: '2.031',
VersionMinor: '3',
};
if (typeof CM == "undefined") {
RunCookieMonsterHeader();
}

View File

@@ -516,9 +516,15 @@ CM.Main.FixMouseY = function(target) {
}
};
/********
* Section: Variables used in Main functions */
CM.HasReplaceNativeGrimoireLaunch = false;
CM.HasReplaceNativeGrimoireDraw = false;
/**
* TODO: See if these can me removed (probably)
*/
CM.Main.lastGoldenCookieState = 0;
CM.Main.lastSpawnedGoldenCookieState = 0;
CM.Main.lastTickerFortuneState = 0;
@@ -526,6 +532,3 @@ CM.Main.lastSeasonPopupState = 0;
CM.Main.lastGardenNextStep = 0;
CM.Main.lastMagicBarFull = 0;
CM.Main.lastWrinklerCount = 0;
CM.ConfigPrefix = 'CMConfig';