优化浏览器设置Cookie、执行脚本和等待元素的功能

This commit is contained in:
fofolee
2025-01-12 10:39:24 +08:00
parent c3a07ed0b5
commit 06938cade1
3 changed files with 118 additions and 128 deletions

View File

@@ -39,7 +39,7 @@
<q-icon name="code" />
</template>
<template v-slot:append>
<q-btn dense flat icon="arrow_drop_down">
<q-btn dense flat icon="menu">
<q-menu>
<q-list dense>
<q-item
@@ -256,6 +256,9 @@ export default defineComponent({
handleInput(val, index) {
this.inputValue = val;
const item = this.allItems[index];
if (val in this.modelValue && val !== item.key) {
return;
}
const dict = { ...this.modelValue };
delete dict[item.key];
dict[val] = item.value;
@@ -265,6 +268,9 @@ export default defineComponent({
this.inputValue = "";
const value = val?.value || val;
const item = this.allItems[index];
if (value in this.modelValue && value !== item.key) {
return;
}
const dict = { ...this.modelValue };
delete dict[item.key];
dict[value] = item.value;

View File

@@ -495,6 +495,13 @@ export const macosCommands = {
width: 12,
placeholder: "输入JavaScript代码",
},
{
key: "args",
topLabel: "要传递的参数",
component: "DictEditor",
icon: "data_array",
width: 12,
},
],
},
{
@@ -737,11 +744,46 @@ export const macosCommands = {
},
{
label: "选项",
component: "DictEditor",
component: "OptionEditor",
icon: "settings",
width: 12,
options: {
optionKeys: ["expires", "path", "domain", "secure", "sameSite"],
expires: {
label: "过期时间",
component: "q-select",
icon: "timer",
width: 6,
options: [
{ label: "关闭浏览器失效", value: false },
{ label: "1小时", value: 1 },
{ label: "1天", value: 24 },
{ label: "1年", value: 24 * 365 },
],
},
path: {
label: "路径",
component: "VariableInput",
icon: "folder",
width: 6,
},
domain: {
label: "域名",
component: "VariableInput",
icon: "domain",
width: 6,
},
secure: {
label: "安全",
component: "CheckButton",
icon: "lock",
width: 6,
},
},
defaultValue: {
expires: false,
path: newVarInputVal("str", "/"),
domain: newVarInputVal("str", ""),
secure: false,
},
},
],
@@ -892,46 +934,6 @@ export const macosCommands = {
},
],
},
{
value: "quickcomposer.macos.browser.observeElement",
label: "监听元素",
desc: "监听指定元素的变化",
icon: "visibility",
config: [
{
key: "browser",
component: "ButtonGroup",
defaultValue: "Microsoft Edge",
options: [
{
label: "Edge 浏览器",
value: "Microsoft Edge",
},
{
label: "Chrome 浏览器",
value: "Google Chrome",
},
],
width: 12,
},
{
key: "selector",
label: "选择器",
component: "VariableInput",
icon: "code",
width: 12,
placeholder: "输入CSS选择器",
},
{
key: "callback",
label: "回调函数",
component: "CodeEditor",
icon: "code",
width: 12,
placeholder: "输入回调函数代码",
},
],
},
],
},
],