[achievement]A better classification choice
-
Some of the liquidsource custom build versions have special classifications (for example, there is no "Fun" classification, or other classifications can be used), resulting in poor compatibility with js
If you have encountered the above situations or want to make your js more compatible, you can try to add my code to make your js more compatibleStep 1
add var JOptionPane = Java.type("javax.swing.JOptionPane"); at the beginning
It allows you to use Java pop-up styleStep 2
add two arrays
var listshowchoose = ["按钮(push-button)", "列表(tabulation)"];
var choose = ["World", "Fun", "Movement", "Render", "Combat", "Player", "Misc", "Exploit", "自定义(Custom)"];
They are used to keep the classification we needStep 3
Use the Java pop-up window to obtain the required display form
var listshowset = JOptionPane.showOptionDialog(null,"请选择展示形式(Please select a presentation form):","形式选择(Presentation form)",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,listshowchoose,listshowchoose[0]);
var listshow = listshowchoose[listshowset]Step 4
Use judgment to display different Java pop-up forms
And finally transfer the string to chooselist
The key to this step is that different Java pop-up formats output different value types
Some need to access the array again
if(listshow == "按钮(push-button)") {
var chooseset = JOptionPane.showOptionDialog(null,"请选择分类(Please select a classification):","分类(classify)",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,choose,choose[0]);
var chooselist = choose[chooseset]
}else{
var chooselist = JOptionPane.showInputDialog(null,"请选择分类(Please select a classification):","分类(classify)",JOptionPane.QUESTION_MESSAGE,null,choose,choose[0]);
}
Step 5
Implement user-defined classification in the judgment of Java pop-up window
if(chooselist == "自定义(Custom)") {
var chooselist = JOptionPane.showInputDialog(null,"请输入自定义名称(Please enter a custom name):","请首字母大写(The first letter should be capitalized)",JOptionPane.WARNING_MESSAGE);
}Step 6
Change the original category to chooselist
this.getCategory = function () {
return chooselist;
}Step 7
final result
var JOptionPane = Java.type("javax.swing.JOptionPane");
// Classification List
var listshowchoose = ["按钮(push-button)", "列表(tabulation)"];
var choose = ["World", "Fun", "Movement", "Render", "Combat", "Player", "Misc", "Exploit", "自定义(Custom)"];var listshowset = JOptionPane.showOptionDialog(null,"请选择展示形式(Please select a presentation form):","形式选择(Presentation form)",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,listshowchoose,listshowchoose[0]);
var listshow = listshowchoose[listshowset]if(listshow == "按钮(push-button)") {
var chooseset = JOptionPane.showOptionDialog(null,"请选择分类(Please select a classification):","分类(classify)",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,choose,choose[0]);
var chooselist = choose[chooseset]
if(chooselist == "自定义(Custom)") {
var chooselist = JOptionPane.showInputDialog(null,"请输入自定义名称(Please enter a custom name):","请首字母大写(The first letter should be capitalized)",JOptionPane.WARNING_MESSAGE);
}
}else{
var chooselist = JOptionPane.showInputDialog(null,"请选择分类(Please select a classification):","分类(classify)",JOptionPane.QUESTION_MESSAGE,null,choose,choose[0]);
if(chooselist == "自定义(Custom)") {
var chooselist = JOptionPane.showInputDialog(null,"请输入自定义名称(Please enter a custom name):","请首字母大写(The first letter should be capitalized)",JOptionPane.WARNING_MESSAGE);
}
}this.getCategory = function () {
return chooselist;
}I hope you like it!
Thank you