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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -22,11 +22,11 @@ function CacheColour(target, amount) {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode && Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
amount === 1 amount === 1
) { ) {
target[i].color = ColourGray; // eslint-disable-line no-param-reassign target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
return; return;
} }
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP( target[i].colour = ColourOfPP(
target[i], target[i],
BuildingGetPrice( BuildingGetPrice(
i, i,
@@ -42,7 +42,7 @@ function CacheColour(target, amount) {
j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop; j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
j++ 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 Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop = 0; // Otherwise breaks during initialization
// Calculate PP and colors // Calculate PP and colours
CachePP(CacheObjects1, 1); CachePP(CacheObjects1, 1);
CachePP(CacheObjects10, 10); CachePP(CacheObjects10, 10);
CachePP(CacheObjects100, 100); 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() * 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 {object} obj The obj of which the pp value should be checked
* @params {number} price The price of the object * @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) { export default function ColourOfPP(me, price) {
let color = ''; let colour = '';
// Colour based on PP // Colour based on PP
if (me.pp <= 0 || me.pp === Infinity) color = ColourGray; if (me.pp <= 0 || me.pp === Infinity) colour = ColourGray;
else if (me.pp < CacheMinPP) color = ColourBlue; else if (me.pp < CacheMinPP) colour = ColourBlue;
else if (me.pp === CacheMinPP) color = ColourGreen; else if (me.pp === CacheMinPP) colour = ColourGreen;
else if (me.pp < CachePPArray[10][0]) color = ColourYellow; else if (me.pp < CachePPArray[10][0]) colour = ColourYellow;
else if (me.pp < CachePPArray[20][0]) color = ColourOrange; else if (me.pp < CachePPArray[20][0]) colour = ColourOrange;
else if (me.pp < CachePPArray[30][0]) color = ColourRed; else if (me.pp < CachePPArray[30][0]) colour = ColourRed;
else color = ColourPurple; else colour = ColourPurple;
// Colour based on price in terms of CPS // Colour based on price in terms of CPS
if ( if (
@@ -40,11 +40,11 @@ export default function ColourOfPP(me, price) {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
) )
) )
color = ColourBlue; colour = ColourBlue;
} }
// Colour based on being able to purchase // Colour based on being able to purchase
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) { 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; } else CacheUpgrades[i].pp = Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity; 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'; 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 * @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) { export default function GetTimeColour(time) {
let color; let colour;
let text; let text;
if (time <= 0) { if (time <= 0) {
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat)
text = '00:00:00:00:00'; text = '00:00:00:00:00';
else text = 'Done!'; else text = 'Done!';
color = ColourGreen; colour = ColourGreen;
} else { } else {
text = FormatTime(time); text = FormatTime(time);
if (time > 300) color = ColourRed; if (time > 300) colour = ColourRed;
else if (time > 60) color = ColourOrange; else if (time > 60) colour = ColourOrange;
else color = ColourYellow; else colour = ColourYellow;
} }
return { text, color }; return { text, colour };
} }

View File

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

View File

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

View File

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

View File

@@ -27,7 +27,7 @@ export default function CMDrawHook() {
} }
} }
// Update colors // Update colours
UpdateBuildings(); UpdateBuildings();
UpdateUpgrades(); UpdateUpgrades();
UpdateUpgradeSectionsHeight(); 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. * 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() * It is called by CM.Disp.UpdateTooltipSugarLump()
* @param {string} type Sugar Lump Type. * @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) { export default function GetLumpColour(type) {
if (type === 0) { if (type === 0) {
return { text: 'Normal', color: ColourGray }; return { text: 'Normal', colour: ColourGray };
} }
if (type === 1) { if (type === 1) {
return { text: 'Bifurcated', color: ColourGreen }; return { text: 'Bifurcated', colour: ColourGreen };
} }
if (type === 2) { if (type === 2) {
return { text: 'Golden', color: ColourYellow }; return { text: 'Golden', colour: ColourYellow };
} }
if (type === 3) { if (type === 3) {
return { text: 'Meaty', color: ColourOrange }; return { text: 'Meaty', colour: ColourOrange };
} }
if (type === 4) { 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'; table.style.whiteSpace = 'nowrap';
const tbody = table.appendChild(document.createElement('tbody')); const tbody = table.appendChild(document.createElement('tbody'));
const firstCol = function (text, color) { const firstCol = function (text, colour) {
const td = document.createElement('td'); const td = document.createElement('td');
td.style.textAlign = 'right'; td.style.textAlign = 'right';
td.className = ColourTextPre + color; td.className = ColourTextPre + colour;
td.textContent = text; td.textContent = text;
return td; return td;
}; };
@@ -86,7 +86,7 @@ export function UpdateBotBar() {
2, 2,
); );
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className = l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
ColourTextPre + target[i].color; ColourTextPre + target[i].colour;
let PPString; let PPString;
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
PPString = FormatTime(Math.round(target[i].pp)); PPString = FormatTime(Math.round(target[i].pp));
@@ -96,7 +96,7 @@ export function UpdateBotBar() {
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(), (Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
); );
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className = 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) { if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[ l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count count

View File

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

View File

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

View File

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

View File

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

View File

@@ -30,7 +30,7 @@ export default function Grimoire() {
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost), CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
); );
time.textContent = timeColour.text; time.textContent = timeColour.text;
time.className = ColourTextPre + timeColour.color; time.className = ColourTextPre + timeColour.colour;
// Time left untill magic spent is recovered // Time left untill magic spent is recovered
if (spellCost <= minigame.magic) { if (spellCost <= minigame.magic) {
@@ -46,7 +46,7 @@ export default function Grimoire() {
), ),
); );
recover.textContent = recoverColour.text; 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) // 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); tooltipBox.appendChild(lumpType);
const lumpColour = GetLumpColour(Game.lumpCurrentType); const lumpColour = GetLumpColour(Game.lumpCurrentType);
lumpType.textContent = lumpColour.text; lumpType.textContent = lumpColour.text;
lumpType.className = ColourTextPre + lumpColour.color; lumpType.className = ColourTextPre + lumpColour.colour;
} else l('CMTooltipArea').style.display = 'none'; } else l('CMTooltipArea').style.display = 'none';
} }

View File

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

View File

@@ -5,25 +5,25 @@ import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour';
describe('GetTimeColour', () => { describe('GetTimeColour', () => {
it('Format when time is less than 60', () => { it('Format when time is less than 60', () => {
expect(GetTimeColour(59).color).to.deep.equal('Yellow'); expect(GetTimeColour(59).colour).to.deep.equal('Yellow');
}); });
it('Format when time is more than 60', () => { it('Format when time is more than 60', () => {
expect(GetTimeColour(61).color).to.deep.equal('Orange'); expect(GetTimeColour(61).colour).to.deep.equal('Orange');
}); });
it('Format when time is more than 300', () => { it('Format when time is more than 300', () => {
expect(GetTimeColour(301).color).to.deep.equal('Red'); expect(GetTimeColour(301).colour).to.deep.equal('Red');
}); });
describe('TimeFormat = 0', () => { describe('TimeFormat = 0', () => {
before(() => { before(() => {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 0;
}); });
it('Format when time is 0', () => { it('Format when time is 0', () => {
expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', color: 'Green' }); expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', colour: 'Green' });
}); });
it('Format when time is negative', () => { it('Format when time is negative', () => {
expect(GetTimeColour(-1)).to.deep.equal({ expect(GetTimeColour(-1)).to.deep.equal({
text: 'Done!', text: 'Done!',
color: 'Green', colour: 'Green',
}); });
}); });
}); });
@@ -34,13 +34,13 @@ describe('GetTimeColour', () => {
it('Format when time is 0', () => { it('Format when time is 0', () => {
expect(GetTimeColour(0)).to.deep.equal({ expect(GetTimeColour(0)).to.deep.equal({
text: '00:00:00:00:00', text: '00:00:00:00:00',
color: 'Green', colour: 'Green',
}); });
}); });
it('Format when time is negative', () => { it('Format when time is negative', () => {
expect(GetTimeColour(-1)).to.deep.equal({ expect(GetTimeColour(-1)).to.deep.equal({
text: '00:00:00:00:00', text: '00:00:00:00:00',
color: 'Green', colour: 'Green',
}); });
}); });
}); });