One directly change the function of the new, before an element input does not change
2 the function of the default Settings, input can synchronize changes
Changed the default 3, and then modify the new, input can change
Alt + enter setup interface Y
The test script code
https://greasyfork.org/zh-CN/scripts/426697-%E6%B5%8B%E8%AF%95%E9%BC%A0%E6%A0%87%E6%8B%96%E6%8B%BD/code
Set the interface
The function arg2html (argument, type, TRK) {
Let the HTML=", "
Argu, I, rand, trackTxt, name,
ArgValue=https://bbs.csdn.net/topics/[],
AgrDetail=[],
The description,
SelectName;
If (typeof argument==="object")
Argu=argument;
The else
Argu=JSON. Parse (argument);
TrackTxt=TRK | | ';
Name=argu. Name;
HTML +=` & lt; Span> The ${name} & lt;/span> If (argu. Arg. Length & gt; 0 {
ArgValue=https://bbs.csdn.net/topics/trackTxt? Argu. Arg: [];
AgrDetail=fnLocal. Arg [name]. Arg.
Description=fnLocal. Arg [name]. The description (CFG) language);
For (I in agrDetail) {
Rand=Math. Floor (Math. The random () * 1000);
The switch (agrDetail [I]. Slice (0, 5)) {
Case 'input' :
HTML +='& lt; Span> ';
break;
Case 'selec:
SelectName=agrDetail [I]. The split (' : '). The pop ();
HTML +=` & lt; Span> `;
In the options for (let k [selectName]) {
HTML +=` & lt; Option value=https://bbs.csdn.net/topics/${options [selectName] [k]} ${sel (argValue [I], the options [selectName] [k])}> ${k}
Update functions add listening in
The function updateConfigUi (e) {
Let the name=attr (e. arget, 'name');
The switch (name) {
Default:
If (name==="alias") {
UpdateFns (e. arget. ParentElement);
} else if (name==="fnCheckbox" | | name==="fnSelect") {
Window. The addEventListener (' change ', formChange, false);
}
return;
}
Storage. The set (CFG, CFG);
}
The function formChange (event) {
If (event. Target. TagName==='SELECT') {
.//the event target. PreviousElementSibling. Value=https://bbs.csdn.net/topics/event.target.value;
If (event. Target. PreviousElementSibling!==null) {//input element display value judgment before the element
. The event target. PreviousElementSibling. Value=https://bbs.csdn.net/topics/event.target.value;
}
UpdateFns (event. The target. The parentElement. ParentElement. ParentElement);
}
}