From 168c9afa0ea86f39cac7b5b20f7d10e05235bcc3 Mon Sep 17 00:00:00 2001 From: Yaroslavik Date: Sat, 10 Nov 2018 22:19:05 +0200 Subject: [PATCH] Names for optional mods --- Launcher/runtime/dialog/overlay/options/options.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Launcher/runtime/dialog/overlay/options/options.js b/Launcher/runtime/dialog/overlay/options/options.js index 5ad2fc0e..6b7ca736 100644 --- a/Launcher/runtime/dialog/overlay/options/options.js +++ b/Launcher/runtime/dialog/overlay/options/options.js @@ -59,7 +59,17 @@ function updateOptional() var list = profile.getOptional(); var checkboxlist = new java.util.ArrayList; list.forEach(function(modfile,i,arr) { - var testMod = new javafx.scene.control.CheckBox(modfile.string); + var modName = modfile.string; + if(optModNames.modName[modfile.string] != null){ + modName = optModNames.modName[modfile.string]; + } else if(optModNames.optAutoModName) { + //Попытка автоматически создать представляемое имя модификации. + modName = modName.replace(new RegExp("(.*?(\/))",'g'),''); + modName = modName.replace(new RegExp("(-|_|[\\d]|\\+).*",'g'),''); + //Первая буква - заглавная + modName = modName[0].toUpperCase() + modName.slice(1); + } + var testMod = new javafx.scene.control.CheckBox(modName); testMod.setSelected(modfile.mark); testMod.setOnAction(function(event) { @@ -78,4 +88,4 @@ function updateOptional() checkboxlist.add(testMod); }); holder.getChildren().addAll(checkboxlist); -} \ No newline at end of file +}