Change to "color" to "colour"

This commit is contained in:
Daniël van Noord
2021-07-25 14:42:21 +02:00
parent 65eff470cf
commit d0ddc93f7c
20 changed files with 99 additions and 99 deletions

View File

@@ -22,11 +22,11 @@ function CacheColour(target, amount) {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
amount === 1
) {
target[i].color = ColourGray; // eslint-disable-line no-param-reassign
target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
return;
}
// eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP(
target[i].colour = ColourOfPP(
target[i],
BuildingGetPrice(
i,
@@ -42,7 +42,7 @@ function CacheColour(target, amount) {
j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
j++
) {
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
if (target[i].pp === CachePPArray[j][0]) target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
}
});
}
@@ -84,7 +84,7 @@ export default function CacheBuildingsPP() {
)
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop = 0; // Otherwise breaks during initialization
// Calculate PP and colors
// Calculate PP and colours
CachePP(CacheObjects1, 1);
CachePP(CacheObjects10, 10);
CachePP(CacheObjects100, 100);

View File

@@ -15,18 +15,18 @@ import { CacheMinPP, CachePPArray } from '../VariablesAndData';
* It is called by CM.Cache.CacheBuildingsPP(), CM.Cache.CacheBuildingsBulkPP() and CM.Cache.CacheUpgradePP()
* @params {object} obj The obj of which the pp value should be checked
* @params {number} price The price of the object
* @returns {string} color The colour assosciated with the pp value
* @returns {string} colour The colour assosciated with the pp value
*/
export default function ColourOfPP(me, price) {
let color = '';
let colour = '';
// Colour based on PP
if (me.pp <= 0 || me.pp === Infinity) color = ColourGray;
else if (me.pp < CacheMinPP) color = ColourBlue;
else if (me.pp === CacheMinPP) color = ColourGreen;
else if (me.pp < CachePPArray[10][0]) color = ColourYellow;
else if (me.pp < CachePPArray[20][0]) color = ColourOrange;
else if (me.pp < CachePPArray[30][0]) color = ColourRed;
else color = ColourPurple;
if (me.pp <= 0 || me.pp === Infinity) colour = ColourGray;
else if (me.pp < CacheMinPP) colour = ColourBlue;
else if (me.pp === CacheMinPP) colour = ColourGreen;
else if (me.pp < CachePPArray[10][0]) colour = ColourYellow;
else if (me.pp < CachePPArray[20][0]) colour = ColourOrange;
else if (me.pp < CachePPArray[30][0]) colour = ColourRed;
else colour = ColourPurple;
// Colour based on price in terms of CPS
if (
@@ -40,11 +40,11 @@ export default function ColourOfPP(me, price) {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
)
)
color = ColourBlue;
colour = ColourBlue;
}
// Colour based on being able to purchase
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
if (price - Game.cookies > 0) color = ColourRed;
if (price - Game.cookies > 0) colour = ColourRed;
}
return color;
return colour;
}

View File

@@ -16,6 +16,6 @@ export default function CacheUpgradePP() {
} else CacheUpgrades[i].pp = Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
CacheUpgrades[i].color = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
CacheUpgrades[i].colour = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
});
}

View File

@@ -2,23 +2,23 @@ import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../Variables
import FormatTime from './FormatTime';
/**
* This function returns the color to be used for time-strings
* This function returns the colour to be used for time-strings
* @param {number} time Time to be coloured
* @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array
* @returns {{string, string}} {text, colour} Both the formatted time and colour as strings in an array
*/
export default function GetTimeColour(time) {
let color;
let colour;
let text;
if (time <= 0) {
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat)
text = '00:00:00:00:00';
else text = 'Done!';
color = ColourGreen;
colour = ColourGreen;
} else {
text = FormatTime(time);
if (time > 300) color = ColourRed;
else if (time > 60) color = ColourOrange;
else color = ColourYellow;
if (time > 300) colour = ColourRed;
else if (time > 60) colour = ColourOrange;
else colour = ColourYellow;
}
return { text, color };
return { text, colour };
}

View File

@@ -39,7 +39,7 @@ export default function UpdateBuildings() {
Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
`Colour${target[i].color}`
`Colour${target[i].colour}`
];
});
l(`storeBulk${CacheMinPPBulk}`).style.color =
@@ -89,14 +89,14 @@ export default function UpdateBuildings() {
const o = {};
o.name = k;
o.pp = CacheObjects1[k].pp;
o.color = CacheObjects1[k].color;
o.colour = CacheObjects1[k].colour;
return o;
});
// Sort by pp colour group, then by pp.
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
? a.pp - b.pp
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
);
} else if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 2
@@ -105,14 +105,14 @@ export default function UpdateBuildings() {
const o = {};
o.name = k;
o.pp = target[k].pp;
o.color = target[k].color;
o.colour = target[k].colour;
return o;
});
// Sort by pp colour group, then by pp.
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
? a.pp - b.pp
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
);
} else if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 3

View File

@@ -24,11 +24,11 @@ function CreateUpgradeBarLegend() {
title.textContent = 'Legend';
legend.appendChild(title);
const legendLine = function (color, text) {
const legendLine = function (colour, text) {
const div = document.createElement('div');
div.style.verticalAlign = 'middle';
const span = document.createElement('span');
span.className = ColourBackPre + color;
span.className = ColourBackPre + colour;
span.style.display = 'inline-block';
span.style.height = '10px';
span.style.width = '10px';
@@ -70,10 +70,10 @@ export default function CreateUpgradeBar() {
Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');
};
const upgradeNumber = function (id, color) {
const upgradeNumber = function (id, colour) {
const span = document.createElement('span');
span.id = id;
span.className = ColourTextPre + color;
span.className = ColourTextPre + colour;
span.style.width = '14.28571428571429%';
span.style.display = 'inline-block';
span.textContent = '0';

View File

@@ -33,7 +33,7 @@ export default function UpdateUpgrades() {
let addedColour = false;
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].colour;
addedColour = true;
break;
}
@@ -42,16 +42,16 @@ export default function UpdateUpgrades() {
const div = document.createElement('div');
div.style.width = '10px';
div.style.height = '10px';
div.className = ColourBackPre + CacheUpgrades[me.name].color;
div.className = ColourBackPre + CacheUpgrades[me.name].colour;
l(`upgrade${i}`).appendChild(div);
}
if (CacheUpgrades[me.name].color === ColourBlue) blue += 1;
else if (CacheUpgrades[me.name].color === ColourGreen) green += 1;
else if (CacheUpgrades[me.name].color === ColourYellow) yellow += 1;
else if (CacheUpgrades[me.name].color === ColourOrange) orange += 1;
else if (CacheUpgrades[me.name].color === ColourRed) red += 1;
else if (CacheUpgrades[me.name].color === ColourPurple) purple += 1;
else if (CacheUpgrades[me.name].color === ColourGray) gray += 1;
if (CacheUpgrades[me.name].colour === ColourBlue) blue += 1;
else if (CacheUpgrades[me.name].colour === ColourGreen) green += 1;
else if (CacheUpgrades[me.name].colour === ColourYellow) yellow += 1;
else if (CacheUpgrades[me.name].colour === ColourOrange) orange += 1;
else if (CacheUpgrades[me.name].colour === ColourRed) red += 1;
else if (CacheUpgrades[me.name].colour === ColourPurple) purple += 1;
else if (CacheUpgrades[me.name].colour === ColourGray) gray += 1;
});
l('CMUpgradeBarBlue').textContent = blue;
@@ -71,16 +71,16 @@ export default function UpdateUpgrades() {
o.name = Game.UpgradesInStore[x].name;
o.price = Game.UpgradesInStore[x].basePrice;
o.pp = CacheUpgrades[o.name].pp;
o.color = CacheUpgrades[o.name].color;
o.colour = CacheUpgrades[o.name].colour;
arr.push(o);
}
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades) {
// Sort by pp colour group, then by pp.
arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
? a.pp - b.pp
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
);
} else {
arr.sort((a, b) => a.price - b.price);

View File

@@ -27,7 +27,7 @@ export default function CMDrawHook() {
}
}
// Update colors
// Update colours
UpdateBuildings();
UpdateUpgrades();
UpdateUpgradeSectionsHeight();

View File

@@ -11,23 +11,23 @@ import {
* This function returns Name and Colour as object for sugar lump type that is given as input param.
* It is called by CM.Disp.UpdateTooltipSugarLump()
* @param {string} type Sugar Lump Type.
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
* @returns {{string}, {string}} text, colour An array containing the text and display-colour of the sugar lump
*/
export default function GetLumpColour(type) {
if (type === 0) {
return { text: 'Normal', color: ColourGray };
return { text: 'Normal', colour: ColourGray };
}
if (type === 1) {
return { text: 'Bifurcated', color: ColourGreen };
return { text: 'Bifurcated', colour: ColourGreen };
}
if (type === 2) {
return { text: 'Golden', color: ColourYellow };
return { text: 'Golden', colour: ColourYellow };
}
if (type === 3) {
return { text: 'Meaty', color: ColourOrange };
return { text: 'Meaty', colour: ColourOrange };
}
if (type === 4) {
return { text: 'Caramelized', color: ColourPurple };
return { text: 'Caramelized', colour: ColourPurple };
}
return { text: 'Unknown Sugar Lump', color: ColourRed };
return { text: 'Unknown Sugar Lump', colour: ColourRed };
}

View File

@@ -33,10 +33,10 @@ export function CreateBotBar() {
table.style.whiteSpace = 'nowrap';
const tbody = table.appendChild(document.createElement('tbody'));
const firstCol = function (text, color) {
const firstCol = function (text, colour) {
const td = document.createElement('td');
td.style.textAlign = 'right';
td.className = ColourTextPre + color;
td.className = ColourTextPre + colour;
td.textContent = text;
return td;
};
@@ -86,7 +86,7 @@ export function UpdateBotBar() {
2,
);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
ColourTextPre + target[i].color;
ColourTextPre + target[i].colour;
let PPString;
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
PPString = FormatTime(Math.round(target[i].pp));
@@ -96,7 +96,7 @@ export function UpdateBotBar() {
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
);
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
ColourTextPre + timeColour.color;
ColourTextPre + timeColour.colour;
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count

View File

@@ -6,7 +6,7 @@ import { ColourBackPre, ColourBlue, ColourTextPre } from '../VariablesAndData';
* This function creates an indivudual timer for the timer bar
* @param {string} id An id to identify the timer
* @param {string} name The title of the timer
* @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer
* @param [{{string}, {string}}, ...] bars ([id, colour]) The id and colours of individual parts of the timer
*/
export function CreateTimer(id, name, bars) {
const timerBar = document.createElement('div');
@@ -36,20 +36,20 @@ export function CreateTimer(id, name, bars) {
div.appendChild(type);
for (let i = 0; i < bars.length; i++) {
const colorBar = document.createElement('span');
colorBar.id = bars[i].id;
colorBar.style.display = 'inline-block';
colorBar.style.height = '10px';
colorBar.style.verticalAlign = 'text-top';
colorBar.style.textAlign = 'center';
const colourBar = document.createElement('span');
colourBar.id = bars[i].id;
colourBar.style.display = 'inline-block';
colourBar.style.height = '10px';
colourBar.style.verticalAlign = 'text-top';
colourBar.style.textAlign = 'center';
if (bars.length - 1 === i) {
colorBar.style.borderTopRightRadius = '10px';
colorBar.style.borderBottomRightRadius = '10px';
colourBar.style.borderTopRightRadius = '10px';
colourBar.style.borderBottomRightRadius = '10px';
}
if (typeof bars[i].color !== 'undefined') {
colorBar.className = ColourBackPre + bars[i].color;
if (typeof bars[i].colour !== 'undefined') {
colourBar.className = ColourBackPre + bars[i].colour;
}
div.appendChild(colorBar);
div.appendChild(colourBar);
}
const timer = document.createElement('span');

View File

@@ -26,21 +26,21 @@ export function CreateTimerBar() {
// Create standard Autosave bar
const CMTimerBarAutosave = CreateTimer('CMTimerBarAutosave', 'Autosave', [
{ id: 'CMTimerBarAutosaveBar', color: ColourPurple },
{ id: 'CMTimerBarAutosaveBar', colour: ColourPurple },
]);
TimerBar.appendChild(CMTimerBarAutosave);
// Create standard Golden Cookie bar
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
{ id: 'CMTimerBarGCMinBar', color: ColourGray },
{ id: 'CMTimerBarGCBar', color: ColourPurple },
{ id: 'CMTimerBarGCMinBar', colour: ColourGray },
{ id: 'CMTimerBarGCBar', colour: ColourPurple },
]);
TimerBar.appendChild(CMTimerBarGC);
// Create standard Reindeer bar
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
{ id: 'CMTimerBarRenMinBar', color: ColourGray },
{ id: 'CMTimerBarRenBar', color: ColourOrange },
{ id: 'CMTimerBarRenMinBar', colour: ColourGray },
{ id: 'CMTimerBarRenBar', colour: ColourOrange },
]);
TimerBar.appendChild(CMTimerBarRen);
const TimerBarBuffTimers = document.createElement('div');
@@ -171,7 +171,7 @@ export function UpdateTimerBar() {
]);
timer.style.display = '';
let classColour = '';
// Gives specific timers specific colors
// Gives specific timers specific colours
if (typeof BuffColours[Game.buffs[i].name] !== 'undefined') {
classColour = BuffColours[Game.buffs[i].name];
} else classColour = ColourPurple;

View File

@@ -53,18 +53,18 @@ export function TooltipCreateWarningSection() {
TooltipWarn.style.bottom = 'auto';
TooltipWarn.id = 'CMDispTooltipWarningParent';
const create = function (boxId, color, labelTextFront, labelTextBack, deficitId) {
const create = function (boxId, colour, labelTextFront, labelTextBack, deficitId) {
const box = document.createElement('div');
box.id = boxId;
box.style.display = 'none';
box.style.transition = 'opacity 0.1s ease-out';
box.className = ColourBorderPre + color;
box.className = ColourBorderPre + colour;
box.style.padding = '2px';
box.style.background = '#000 url(img/darkNoise.png)';
const labelDiv = document.createElement('div');
box.appendChild(labelDiv);
const labelSpan = document.createElement('span');
labelSpan.className = ColourTextPre + color;
labelSpan.className = ColourTextPre + colour;
labelSpan.style.fontWeight = 'bold';
labelSpan.textContent = labelTextFront;
labelDiv.appendChild(labelSpan);

View File

@@ -62,11 +62,11 @@ export default function Building() {
: '.'
}01% of income)`;
}
l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].color;
l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].colour;
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].color;
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].colour;
const timeColour = GetTimeColour(
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
);
@@ -74,7 +74,7 @@ export default function Building() {
if (timeColour.text === 'Done!' && Game.cookies < target[TooltipName].price) {
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
} else l('CMTooltipTime').textContent = timeColour.text;
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
l('CMTooltipTime').className = ColourTextPre + timeColour.colour;
}
// Add "production left till next achievement"-bar

View File

@@ -30,7 +30,7 @@ export default function Grimoire() {
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
);
time.textContent = timeColour.text;
time.className = ColourTextPre + timeColour.color;
time.className = ColourTextPre + timeColour.colour;
// Time left untill magic spent is recovered
if (spellCost <= minigame.magic) {
@@ -46,7 +46,7 @@ export default function Grimoire() {
),
);
recover.textContent = recoverColour.text;
recover.className = ColourTextPre + recoverColour.color;
recover.className = ColourTextPre + recoverColour.colour;
}
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)

View File

@@ -16,6 +16,6 @@ export default function SugarLump() {
tooltipBox.appendChild(lumpType);
const lumpColour = GetLumpColour(Game.lumpCurrentType);
lumpType.textContent = lumpColour.text;
lumpType.className = ColourTextPre + lumpColour.color;
lumpType.className = ColourTextPre + lumpColour.colour;
} else l('CMTooltipArea').style.display = 'none';
}

View File

@@ -47,7 +47,7 @@ export default function Upgrade() {
}01% of income)`;
}
l('CMTooltipBorder').className =
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].colour;
}
// If clicking power upgrade
@@ -73,7 +73,7 @@ export default function Upgrade() {
2,
);
l('CMTooltipPP').className =
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].colour;
}
const timeColour = GetTimeColour(
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
@@ -85,7 +85,7 @@ export default function Upgrade() {
) {
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
} else l('CMTooltipTime').textContent = timeColour.text;
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
l('CMTooltipTime').className = ColourTextPre + timeColour.colour;
// Add extra info to Chocolate egg tooltip
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {