@@ -485,7 +485,7 @@ class CommandControl {
485485 </div>
486486 </div>
487487
488- <div class="list_cell">
488+ <div class="list_cell" style="height: auto;" >
489489 <div id="id_${ COMMAND_MAIN_LIST_COUNT } _command_editor" style="height: 200px; width: 100%;"></div>
490490 </div>
491491 </div>
@@ -816,32 +816,17 @@ class ParameterBuilder {
816816
817817 /** @return {[string, string | false][] | null } */
818818 static getSelectDetail ( el ) {
819- const selectOptions = el . querySelectorAll ( ".group_list_cell.param_type_select > .list_cell" )
820- if ( selectOptions . length === 0 ) return null
821-
822- return [ ...selectOptions ]
823- . flatMap ( list => {
824- const opt = Fnc . getIsEmpty ( list . getElementsByClassName ( "param_input_select_name" ) [ 0 ] ?. value )
825- const val = Fnc . getIsEmpty ( list . getElementsByClassName ( "param_input_select_value" ) [ 0 ] ?. value )
826- if ( ! opt || ! val ) return [ ]
827-
828- return [
829- [ "option" , opt ] ,
830- [ "value" , val ] ,
831- ]
832- } )
819+ return [ ...el . querySelectorAll ( ".group_list_cell.param_type_select > .list_cell" ) ]
820+ . flatMap ( list => [
821+ [ "option" , Fnc . getIfNotEmpty ( list . querySelector ( ".param_input_select_name" ) ?. value ) ] ,
822+ [ "value" , Fnc . getIfNotEmpty ( list . querySelector ( ".param_input_select_value" ) ?. value ) ] ,
823+ ] )
833824 }
834825
835826 /** @return {[string, string | false][] | null } */
836827 static getComboDetail ( el ) {
837- const comboOptions = el . querySelectorAll ( ".group_list_cell.param_type_combo > .list_cell" )
838- if ( comboOptions . length === 0 ) return null
839-
840- return [ ...comboOptions ]
841- . map ( list => {
842- const opt = list . getElementsByClassName ( "param_input_combo_option" ) [ 0 ] ?. value
843- return [ "option" , Fnc . getIfNotEmpty ( opt ) ]
844- } )
828+ return [ ...el . querySelectorAll ( ".group_list_cell.param_type_combo > .list_cell > .param_input_combo_option" ) ]
829+ . map ( el => [ "option" , Fnc . getIfNotEmpty ( el . value ) ] )
845830 }
846831
847832 static getDetailByType ( el , type ) {
@@ -918,11 +903,11 @@ class ParameterBuilder {
918903 + [
919904 [ "param" , param ] ,
920905 [ "parent" , prepareGetValue ( "param_input_parent" ) ] ,
906+ [ "text" , prepareGetValue ( "param_input_display" ) ] ,
907+ [ "desc" , prepareGetValue ( "param_input_desc" ) ] ,
921908 [ "type" , ParameterBuilder . getTypeAttr ( type , isArray ) ] ,
922909 [ "default" , prepareGetValue ( "param_input_default" ) ] ,
923910 [ "details" , details ] ,
924- [ "text" , prepareGetValue ( "param_input_display" ) ] ,
925- [ "desc" , prepareGetValue ( "param_input_desc" ) ] ,
926911 ]
927912 . filter ( ( [ _ , v ] ) => v )
928913 . map ( ( [ n , v ] ) => {
@@ -940,7 +925,7 @@ class ParameterBuilder {
940925 . map ( ParameterBuilder . buildSingleParam )
941926 . join ( "" )
942927
943- return ls === "" ? false : ls
928+ return Fnc . getIfNotEmpty ( ls )
944929 }
945930}
946931
@@ -950,6 +935,7 @@ class CommandBuilder {
950935 static buildBlockParams ( block ) {
951936 return [ ...block . getElementsByClassName ( "command_parameter_group" ) ]
952937 . map ( ParameterBuilder . buildSingleParam )
938+ . map ( res => res . replaceAll ( "@param " , "@arg " ) )
953939 . join ( "" )
954940 }
955941
@@ -964,7 +950,7 @@ class CommandBuilder {
964950 const body = EDITOR_COMMANDS . get ( `id_${ id } _command_editor` ) ?. getValue ( ) || ""
965951
966952 return `
967- PluginManager.registerCommand(filename , "${ name } ", function ({ ${ paramsName } }){
953+ PluginManager.registerCommand(FILENAME , "${ name } ", function ({ ${ paramsName } }){
968954 ${ body . replaceAll ( "\r\n" , "\r\n " ) }
969955 })`
970956 }
@@ -1053,18 +1039,21 @@ class Builder {
10531039
10541040 static build ( ) {
10551041 const [ commandsNote , commandsCode ] = CommandBuilder . build ( )
1056- const code = commandsCode . length > 0
1057- ? `\n(()=>{
1058- const filename = document.currentScript.src.split("/").pop().replace(".js", "")
1042+ const parameterNote = ParameterBuilder . build ( )
1043+
1044+ const isHadCode = commandsCode . length > 0
1045+ const isHadParam = parameterNote . length > 0
10591046
1060- ${ commandsCode }
1061- })()`
1062- : ""
1047+ const code = `\n(()=>{`
1048+ + ( isHadCode || isHadParam ? `\n const FILENAME = document.currentScript.src.split("/").pop().replace(".js", "")` : "" )
1049+ + ( isHadParam ? "\n const PARAMETERS = PluginManager.parameters(FILENAME)" : "" )
1050+ + ( isHadCode ? `\n\n ${ commandsCode } ` : "" )
1051+ + "\n})()"
10631052
10641053 return "/**:"
10651054 + [
10661055 BasicInfoBuilder . build ( ) ,
1067- ParameterBuilder . build ( ) ,
1056+ parameterNote ,
10681057 commandsNote ,
10691058 ]
10701059 . filter ( Fnc . getIfNotEmpty )
0 commit comments