roles
This commit is contained in:
parent
e06d304064
commit
c8e3125c5d
10 changed files with 759 additions and 250 deletions
|
@ -30,6 +30,15 @@ class Buttons implements OptionsElement<unknown>{
|
|||
this.buttonList = buttonList;
|
||||
const htmlarea = document.createElement("div");
|
||||
htmlarea.classList.add("flexgrow");
|
||||
const buttonTable = this.generateButtons(htmlarea);
|
||||
if(this.buttons[0]){
|
||||
this.generateHTMLArea(this.buttons[0][1], htmlarea);
|
||||
}
|
||||
buttonList.append(buttonTable);
|
||||
buttonList.append(htmlarea);
|
||||
return buttonList;
|
||||
}
|
||||
generateButtons(optionsArea:HTMLElement){
|
||||
const buttonTable = document.createElement("div");
|
||||
buttonTable.classList.add("settingbuttons");
|
||||
for(const thing of this.buttons){
|
||||
|
@ -37,24 +46,21 @@ class Buttons implements OptionsElement<unknown>{
|
|||
button.classList.add("SettingsButton");
|
||||
button.textContent = thing[0];
|
||||
button.onclick = _=>{
|
||||
this.generateHTMLArea(thing[1], htmlarea);
|
||||
this.generateHTMLArea(thing[1], optionsArea);
|
||||
if(this.warndiv){
|
||||
this.warndiv.remove();
|
||||
}
|
||||
};
|
||||
buttonTable.append(button);
|
||||
}
|
||||
this.generateHTMLArea(this.buttons[0][1], htmlarea);
|
||||
buttonList.append(buttonTable);
|
||||
buttonList.append(htmlarea);
|
||||
return buttonList;
|
||||
return buttonTable;
|
||||
}
|
||||
handleString(str: string): HTMLElement{
|
||||
const div = document.createElement("span");
|
||||
div.textContent = str;
|
||||
return div;
|
||||
}
|
||||
private generateHTMLArea(
|
||||
generateHTMLArea(
|
||||
buttonInfo: Options | string,
|
||||
htmlarea: HTMLElement
|
||||
){
|
||||
|
@ -1066,6 +1072,10 @@ class Form implements OptionsElement<object>{
|
|||
this.owner.changed();
|
||||
}
|
||||
}
|
||||
preprocessor:(obj:Object)=>void=()=>{};
|
||||
addPreprocessor(func:(obj:Object)=>void){
|
||||
this.preprocessor=func;
|
||||
}
|
||||
async submit(){
|
||||
if(this.options.subOptions){
|
||||
this.options.subOptions.submit();
|
||||
|
@ -1130,6 +1140,7 @@ class Form implements OptionsElement<object>{
|
|||
}
|
||||
console.log("middle2");
|
||||
await Promise.allSettled(promises);
|
||||
this.preprocessor(build);
|
||||
if(this.fetchURL !== ""){
|
||||
fetch(this.fetchURL, {
|
||||
method: this.method,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue