This commit is contained in:
Daniël van Noord
2021-03-14 13:18:56 +01:00
parent 1bffb58782
commit 5f864d9055
6 changed files with 11 additions and 8 deletions

2
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,2 @@
{
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -27,11 +27,8 @@ export function Beautify(num, floats, forced) {
if (num === 0) { if (num === 0) {
return num.toString(); return num.toString();
} if (num > 0.001 && num < CMOptions.ScaleCutoff) { } if (num > 0.001 && num < CMOptions.ScaleCutoff) {
answer = num.toFixed(2); if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
if (CMOptions.ScaleSeparator) answer = answer.toLocaleString('nl'); else answer = num.toLocaleString('en');
for (let i = 0; i < 3; i++) {
if (answer[answer.length - 1] === '0' || answer[answer.length - 1] === '.') answer = answer.slice(0, -1);
}
return answer; return answer;
} if (CMOptions.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8 } if (CMOptions.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8
answer = num.toExponential(decimals).toString().replace('e', 'E'); answer = num.toExponential(decimals).toString().replace('e', 'E');

View File

@@ -1,4 +1,5 @@
import { CMOptions } from '../Config/VariablesAndData'; import { CMOptions } from '../Config/VariablesAndData';
import { Beautify } from './BeautifyAndFormatting/BeautifyFormatting';
import UpdateBuildings from './BuildingsUpgrades/Buildings'; import UpdateBuildings from './BuildingsUpgrades/Buildings';
import UpdateUpgrades from './BuildingsUpgrades/Upgrades'; import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
import { UpdateBotBar } from './InfoBars/BottomBar'; import { UpdateBotBar } from './InfoBars/BottomBar';
@@ -42,4 +43,7 @@ export default function Draw() {
// Change menu refresh interval // Change menu refresh interval
RefreshMenu(); RefreshMenu();
// Replace Cookies counter because Orteil uses very weird code to "pad" it...
l('cookies').innerHTML = l('cookies').innerHTML.replace(/.*(?=<br>)/i, Beautify(Game.cookies));
} }