From bbfeb5ec1636eaf74b540ea9bad57c815861a3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 17 Apr 2024 15:30:24 +0800 Subject: [PATCH] =?UTF-8?q?UA=E5=90=8D=E5=8D=95=E6=94=AF=E6=8C=81=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=94=AE=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/user-agent-config-box.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/web/public/js/components/server/user-agent-config-box.js b/web/public/js/components/server/user-agent-config-box.js index bad3f485..33ad182a 100644 --- a/web/public/js/components/server/user-agent-config-box.js +++ b/web/public/js/components/server/user-agent-config-box.js @@ -19,7 +19,8 @@ Vue.component("user-agent-config-box", { keywords: [], action: "deny" }, - moreOptionsVisible: false + moreOptionsVisible: false, + batchKeywords: "" } }, methods: { @@ -34,6 +35,10 @@ Vue.component("user-agent-config-box", { }, add: function () { this.isAdding = true + let that = this + setTimeout(function () { + that.$refs.batchKeywords.focus() + }) }, confirm: function () { if (this.addingFilter.action == "deny") { @@ -61,9 +66,18 @@ Vue.component("user-agent-config-box", { keywords: [], action: "deny" } + this.batchKeywords = "" }, changeKeywords: function (keywords) { - this.addingFilter.keywords = keywords + let arr = keywords.split(/\n/) + let resultKeywords = [] + arr.forEach(function (keyword){ + keyword = keyword.trim() + if (!resultKeywords.$contains(keyword)) { + resultKeywords.push(keyword) + } + }) + this.addingFilter.keywords = resultKeywords }, showMoreOptions: function () { this.moreOptionsVisible = !this.moreOptionsVisible @@ -119,8 +133,8 @@ Vue.component("user-agent-config-box", { UA关键词 - -

不区分大小写,比如Chrome;支持*通配符,比如*Firefox*;也支持空的关键词,表示空UserAgent。

+ +

每行一个关键词;不区分大小写,比如Chrome;支持*通配符,比如*Firefox*;也支持空行关键词,表示空UserAgent。