diff --git a/locales/ja.json5 b/locales/ja.json5 index 2b2eb48..5ac3c9c 100644 --- a/locales/ja.json5 +++ b/locales/ja.json5 @@ -591,7 +591,7 @@ "Show": "表示", "Hide": "非表示", "Names in white were submitted by our supporters on Patreon.": "白い名前はPatreonの支援者を示しています。", - "You can also press %1 to bulk-buy or sell %2 of a building at a time, or %3 for %4.": "%1を押すことで%2個単位で、%3を押すことで%3個単位でまとめ買い、まとめ売りができます。", + "You can also press %1 to bulk-buy or sell %2 of a building at a time, or %3 for %4.": "%1を押すことで%2個単位で、%3を押すことで%4個単位でまとめ買い、まとめ売りができます。", "Clicking is %1% more powerful.": "クリックによる生産が %1% より強くなる。", "All cookie production multiplied by %1.": "生産量が %1倍 になる。", "+%1 CpS": "CpS +%1", diff --git a/package-lock.json b/package-lock.json index e52c0b5..06f06e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "better-japanese", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "better-japanese", - "version": "1.2.0", + "version": "1.2.1", "license": "ISC", "devDependencies": { "chokidar": "^3.5.3", diff --git a/package.json b/package.json index 747d48f..ebad490 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-japanese", - "version": "1.2.0", + "version": "1.2.1", "description": "", "main": "index.js", "scripts": { diff --git a/src/main.js b/src/main.js index a9fe398..8cfceb4 100644 --- a/src/main.js +++ b/src/main.js @@ -244,7 +244,6 @@ var betterJapanese = { // infinityの場合は無限大を返す if (!isFinite(value)) return '無限大'// loc("Infinity") - if (value > 10 ** (prefixes.length * suffixes.length * 4)) { return value.toPrecision(3).toString() } @@ -261,15 +260,14 @@ var betterJapanese = { if (second) { // 第二単位を付ける - if (preIndex) { - return Math.floor(dispNum / 10000) + prefixes[preIndex] + (dispNum % 10000) + prefixes[preIndex - 1] + suffixes[sufIndex] - } else { - if (sufIndex) { - return Math.floor(dispNum / 10000) + suffixes[sufIndex] + (dispNum % 10000) + prefixes[prefixes.length - 1] + suffixes[sufIndex - 1] - } else { - return value - } - } + if (!preIndex && !sufIndex) return value + + let str = Math.floor(dispNum / 10000) + (preIndex ? prefixes[preIndex] : suffixes[sufIndex]) + if (dispNum % 10000) str += (dispNum % 10000) + prefixes[preIndex ? preIndex - 1 : prefixes.length - 1] + str += suffixes[preIndex ? sufIndex : sufIndex - 1] + + return str !== 'NaN' ? str : value.toPrecision(3).toString() + } else { // 第二単位を付けない return Math.round(value * 10000 / (10 ** (numeral * 4))) / 10000 + prefixes[preIndex] + suffixes[sufIndex]