Skip to content

Commit

Permalink
Merge pull request #26 from hideki0403/develop
Browse files Browse the repository at this point in the history
release: v1.2.1
  • Loading branch information
hideki0403 authored Jun 18, 2022
2 parents db36b91 + 7741592 commit f2ef1ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion locales/ja.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>%1%</b> more powerful.": "クリックによる生産が <b>%1%</b> より強くなる。",
"All cookie production <b>multiplied by %1</b>.": "生産量が <b>%1倍</b> になる。",
"+%1 CpS": "CpS +%1",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "better-japanese",
"version": "1.2.0",
"version": "1.2.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
18 changes: 8 additions & 10 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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]
Expand Down

0 comments on commit f2ef1ba

Please sign in to comment.