Merge pull request #640 from DanielNoord/fix/fixes

Fixed #638 and #636
This commit is contained in:
Daniël van Noord
2021-03-14 13:35:47 +01:00
committed by GitHub
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) {
return num.toString();
} if (num > 0.001 && num < CMOptions.ScaleCutoff) {
answer = num.toFixed(2);
if (CMOptions.ScaleSeparator) answer = answer.toLocaleString('nl');
for (let i = 0; i < 3; i++) {
if (answer[answer.length - 1] === '0' || answer[answer.length - 1] === '.') answer = answer.slice(0, -1);
}
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
else answer = num.toLocaleString('en');
return answer;
} if (CMOptions.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8
answer = num.toExponential(decimals).toString().replace('e', 'E');

View File

@@ -1,4 +1,5 @@
import { CMOptions } from '../Config/VariablesAndData';
import { Beautify } from './BeautifyAndFormatting/BeautifyFormatting';
import UpdateBuildings from './BuildingsUpgrades/Buildings';
import UpdateUpgrades from './BuildingsUpgrades/Upgrades';
import { UpdateBotBar } from './InfoBars/BottomBar';
@@ -42,4 +43,7 @@ export default function Draw() {
// Change menu refresh interval
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));
}