From 1a249a48ea2271529b9ec8d7535253b0257d6b74 Mon Sep 17 00:00:00 2001 From: yukineko <27853966+hideki0403@users.noreply.github.com> Date: Wed, 20 Jul 2022 23:07:53 +0900 Subject: [PATCH 1/3] =?UTF-8?q?change:=20=E5=88=9D=E6=9C=9F=E7=8A=B6?= =?UTF-8?q?=E6=85=8B=E3=81=A7=E3=83=8D=E3=82=BF=E3=83=90=E3=83=AC=E6=B3=A8?= =?UTF-8?q?=E6=84=8F=E3=82=A6=E3=82=A3=E3=83=B3=E3=83=89=E3=82=A6=E3=82=92?= =?UTF-8?q?=E9=96=8B=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/main.js b/src/common/main.js index 2830df3..f374c5f 100644 --- a/src/common/main.js +++ b/src/common/main.js @@ -15,7 +15,7 @@ const betterJapanese = { replaceBuildings: true, replaceCSS: true, replaceNews: true, - showSpoilerAlert: false, + showSpoilerAlert: true, numberJP: true, shortFormatJP: false, secondFormatJP: true, From 0f3cb658a8f1117e8e3dc6e5859087c6a5c3fd63 Mon Sep 17 00:00:00 2001 From: yukineko <27853966+hideki0403@users.noreply.github.com> Date: Thu, 21 Jul 2022 00:22:42 +0900 Subject: [PATCH 2/3] =?UTF-8?q?change:=20=E5=8D=98=E4=BD=8D=E6=97=A5?= =?UTF-8?q?=E6=9C=AC=E8=AA=9E=E5=8C=96=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/main.js | 78 ++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/src/common/main.js b/src/common/main.js index f374c5f..07facc0 100644 --- a/src/common/main.js +++ b/src/common/main.js @@ -4,7 +4,6 @@ const betterJapanese = { config: { hash: '0', replaceJP: true, - replaceBeautify: true, replaceTime: true, replaceBackgroundName: true, replaceMarketQuote: true, @@ -184,48 +183,46 @@ const betterJapanese = { // 塵劫記用の単位 betterJapanese.formats.short = [...betterJapanese.formats.prefix, '阿僧祇', '那由多', '不可思議', '無量大数'] - // 設定の「日本語訳の改善」がOFFになっている場合はここから下は実行しない (ニュース欄やアップデート履歴が壊れる) - if (!betterJapanese.config.replaceJP) return - // 設定によって日本語単位を使用するように変更、同時にカンマ区切りも場合によって変更 - if (betterJapanese.config.replaceBeautify) { - // 本家の挿入関数に追加 - numberFormatters = [ - formatEveryThirdPower(formatShort), - formatEveryThirdPower(formatLong), - rawFormatter, - betterJapanese.formatEveryFourthPower() - ] - - if (!betterJapanese.origins.beautify) betterJapanese.origins.beautify = Beautify - Beautify = function(val, floats) { - let negative = (val < 0) - let decimal = '' - let fixed = val.toFixed(floats) - if (floats > 0 && Math.abs(val) < 1000 && Math.floor(fixed) != fixed) decimal = '.' + (fixed.toString()).split('.')[1] - val = Math.floor(Math.abs(val)) - if (floats > 0 && fixed == val + 1) val++ - let format = Game.prefs.format ? 2 : betterJapanese.config.numberJP ? 3 : 1 - let formatter = numberFormatters[format] - let output = (val.toString().indexOf('e+') != -1 && format == 2) ? val.toPrecision(3).toString() : formatter(val).toString() - if (Game.prefs.format || (betterJapanese.config.numberJP && betterJapanese.config.secondFormatJP)) { - output = output.replace(/\B(?=(\d{3})+(?!\d))/g, ',') - } else { - output = output.replace(/^(\d)(\d{3})/, '$1,$2') - } - if (output == '0') negative = false - return negative ? '-' + output : output + decimal + if (!betterJapanese.origins.beautify) betterJapanese.origins.beautify = Beautify + Beautify = function(val, floats) { + let negative = (val < 0) + let decimal = '' + let fixed = val.toFixed(floats) + if (floats > 0 && Math.abs(val) < 1000 && Math.floor(fixed) != fixed) decimal = '.' + (fixed.toString()).split('.')[1] + val = Math.floor(Math.abs(val)) + if (floats > 0 && fixed == val + 1) val++ + let format = Game.prefs.format ? 2 : betterJapanese.config.numberJP ? 3 : 1 + let formatter = numberFormatters[format] + let output = (val.toString().indexOf('e+') != -1 && format == 2) ? val.toPrecision(3).toString() : formatter(val).toString() + if (Game.prefs.format || (betterJapanese.config.numberJP && betterJapanese.config.secondFormatJP)) { + output = output.replace(/\B(?=(\d{3})+(?!\d))/g, ',') + } else { + output = output.replace(/^(\d)(\d{3})/, '$1,$2') } - - // 指数表記の場合表示が崩れる現象を修正 - if (!betterJapanese.origins.simpleBeautify) betterJapanese.origins.simpleBeautify = SimpleBeautify - SimpleBeautify = function(val) { - if (val.toString().indexOf('e+') >= 0) { - return val.toString().replace(/(?<=.)(\d{3})(?=\d)/g, '$1,') - } - return betterJapanese.origins.simpleBeautify(val) + if (output == '0') negative = false + return negative ? '-' + output : output + decimal + } + + // 本家の挿入関数に追加 + numberFormatters = [ + formatEveryThirdPower(formatShort), + formatEveryThirdPower(formatLong), + rawFormatter, + betterJapanese.formatEveryFourthPower() + ] + + // 指数表記の場合表示が崩れる現象を修正 + if (!betterJapanese.origins.simpleBeautify) betterJapanese.origins.simpleBeautify = SimpleBeautify + SimpleBeautify = function(val) { + if (val.toString().indexOf('e+') >= 0) { + return val.toString().replace(/(?<=.)(\d{3})(?=\d)/g, '$1,') } + return betterJapanese.origins.simpleBeautify(val) } + + // 設定の「日本語訳の改善」がOFFになっている場合はここから下は実行しない (ニュース欄やアップデート履歴が壊れる) + if (!betterJapanese.config.replaceJP) return // 時間表記からカンマを取り除く if (betterJapanese.config.replaceTime) { @@ -567,6 +564,7 @@ const betterJapanese = { Game.Prompt(`
「日本語訳の改善」がオフのため、下記の設定はすべてオフとして処理されます。
' : ''}