添加脚本参数

This commit is contained in:
fofolee
2020-06-25 20:14:06 +08:00
parent a5610f367b
commit f365f7986b
4 changed files with 75 additions and 28 deletions

View File

@@ -1,12 +1,20 @@
utools.onPluginEnter(async ({ code, type, payload }) => {
utools.onPluginOut(() => {
var program = $('#program').val();
$("#options").empty()
$("#out").empty()
if (code == "code") {
var cmd = window.editor.getValue();
putDB('history', { cmd: cmd, program: program }, 'codeHistory')
var program = $('#program').val(),
scptarg = $('#scptarg').val(),
customoptions;
if (program == 'custom') customoptions = {
custombin: $('#custombin').val(),
customarg: $('#customarg').val(),
customext: $('#customext').val(),
customcodec: $('#customcodec').val()
}
putDB('history', { cmd: cmd, program: program, scptarg: scptarg, customoptions: customoptions }, 'codeHistory')
}
$("#options").empty()
$("#out").empty()
})
// 配置页面
if (code == 'options') {
@@ -31,6 +39,7 @@ utools.onPluginEnter(async ({ code, type, payload }) => {
}else{
option = programs[db.program];
}
option.scptarg = db.scptarg
cmd = special(cmd);
// 正则
if (type == 'regex') cmd = cmd.replace(/\{\{input\}\}/mg, payload);