Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
quicker
提交
91b965fa
quicker
项目概览
gitcode_dev
/
quicker
上一次同步 大约 2 年
通知
6
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
quicker
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
91b965fa
编写于
7月 20, 2021
作者:
M
muwoo
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feat-new'
上级
d303a97f
88699311
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
72 addition
and
30 deletion
+72
-30
src/renderer/pages/search/subpages/settings.vue
src/renderer/pages/search/subpages/settings.vue
+0
-11
static/plugins/superPanel/index.html
static/plugins/superPanel/index.html
+60
-4
static/plugins/superPanel/index.js
static/plugins/superPanel/index.js
+12
-15
未找到文件。
src/renderer/pages/search/subpages/settings.vue
浏览文件 @
91b965fa
...
...
@@ -55,17 +55,6 @@
<div
class=
"title"
>
长按以下设置的毫秒响应
</div>
<a-slider
:step=
"100"
v-model:value=
"config.superPanel.mouseDownTime"
:min=
"200"
:max=
"1000"
/>
</div>
<div
class=
"setting-item"
>
<div
class=
"title"
>
百度搜索配置
</div>
<a-form
:label-col=
"
{ span: 3 }" :wrapper-col="{ span: 14 }">
<a-form-item
label=
"appid"
>
<a-input
v-model:value=
"config.superPanel.baiduAPI.appid"
/>
</a-form-item>
<a-form-item
label=
"key"
>
<a-input
v-model:value=
"config.superPanel.baiduAPI.key"
/>
</a-form-item>
</a-form>
</div>
<img
width=
"100%"
src=
"https://static.91jkys.com/upload/202107/02/fa4a5c614234409fb32ddda70cb900aa.jpg"
/>
</div>
<div
v-if=
"currentSelect[0] === 2"
>
...
...
static/plugins/superPanel/index.html
浏览文件 @
91b965fa
...
...
@@ -79,6 +79,50 @@
display
:
flex
;
align-items
:
center
;
}
.spinner
{
padding-left
:
10px
;
}
.spinner
>
div
{
width
:
10px
;
height
:
10px
;
background-color
:
#ddd
;
border-radius
:
100%
;
display
:
inline-block
;
-webkit-animation
:
bouncedelay
1.4s
infinite
ease-in-out
;
animation
:
bouncedelay
1.4s
infinite
ease-in-out
;
/* Prevent first frame from flickering when animation starts */
-webkit-animation-fill-mode
:
both
;
animation-fill-mode
:
both
;
}
.spinner
.bounce1
{
-webkit-animation-delay
:
-0.32s
;
animation-delay
:
-0.32s
;
}
.spinner
.bounce2
{
-webkit-animation-delay
:
-0.16s
;
animation-delay
:
-0.16s
;
}
@-webkit-keyframes
bouncedelay
{
0
%,
80
%,
100
%
{
-webkit-transform
:
scale
(
0.0
)
}
40
%
{
-webkit-transform
:
scale
(
1.0
)
}
}
@keyframes
bouncedelay
{
0
%,
80
%,
100
%
{
transform
:
scale
(
0.0
);
-webkit-transform
:
scale
(
0.0
);
}
40
%
{
transform
:
scale
(
1.0
);
-webkit-transform
:
scale
(
1.0
);
}
}
</style>
<script
src=
"./index.js"
type=
"module"
></script>
<body>
...
...
@@ -87,10 +131,22 @@
<span
class=
"img"
><img
src=
"./assets/logo.png"
/></span>
<span
class=
"text"
v-if=
"selectData.text && selectData.text.length"
>
选择的文本 {{selectData.text.length}} 个
</span>
</div>
<div
class=
"translate"
v-if=
"selectData.translate"
>
<div
class=
"trans-item"
v-for=
"trans in selectData.translate"
>
<div>
{{trans.src}}
</div>
<div>
n. {{trans.dst}}
</div>
<div
class=
"spinner"
v-if=
"loading"
>
<div
class=
"bounce1"
></div>
<div
class=
"bounce2"
></div>
<div
class=
"bounce3"
></div>
</div>
<div
class=
"translate"
v-if=
"selectData.translate && !loading"
>
<div>
{{selectData.translate.src}}
</div>
<div
v-if=
"selectData.translate.basic"
>
<div
v-for=
"item in selectData.translate.basic.explains"
>
{{item}}
</div>
</div>
<div
v-else
>
<div
v-for=
"item in selectData.translate.transition"
>
{{item}}
</div>
</div>
</div>
<div
@
click=
"() => commonClick(op, selectData.fileUrl)"
class=
"options-item"
v-for=
"op in targetOptions"
>
...
...
static/plugins/superPanel/index.js
浏览文件 @
91b965fa
const
{
ipcRenderer
,
nativeImage
,
remote
,
clipboard
}
=
require
(
'
electron
'
)
const
md5
=
require
(
"
md5
"
);
const
rp
=
require
(
"
request-promise
"
);
const
isChinese
=
require
(
'
is-chinese
'
);
const
path
=
require
(
'
path
'
);
const
fs
=
require
(
'
fs
'
);
const
{
spawn
}
=
require
(
'
child_process
'
);
const
mineType
=
require
(
"
mime-types
"
);
const
opConfig
=
remote
.
getGlobal
(
'
opConfig
'
);
new
Vue
({
el
:
'
#app
'
,
data
:
{
...
...
@@ -66,6 +62,7 @@ new Vue({
]
},
targetOptions
:
[],
loading
:
false
,
},
created
()
{
// 简单唤起超级面板
...
...
@@ -74,9 +71,9 @@ new Vue({
const
ext
=
path
.
extname
(
this
.
selectData
.
fileUrl
);
// 剪切板只有文本时,显示翻译
if
(
!
this
.
selectData
.
fileUrl
)
{
this
.
loading
=
true
;
const
word
=
this
.
selectData
.
text
;
const
isCh
=
isChinese
(
word
);
this
.
translate
(
word
,
isCh
?
'
en
'
:
'
zh
'
);
this
.
translate
(
word
);
this
.
targetOptions
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
options
.
translate
));
(
this
.
selectData
.
optionPlugin
||
[]).
forEach
(
plugin
=>
{
plugin
.
features
.
forEach
(
fe
=>
{
...
...
@@ -172,20 +169,20 @@ new Vue({
},
methods
:
{
translate
(
msg
,
to
)
{
const
{
appid
,
key
}
=
opConfig
.
get
().
superPanel
.
baiduAPI
;
if
(
!
appid
||
!
key
)
return
;
const
q
=
msg
;
const
salt
=
parseInt
(
Math
.
random
()
*
1000000000
);
//加盐
const
sign
=
md5
(
appid
+
q
+
salt
+
key
);
//生成签名
translate
(
msg
)
{
const
params
=
encodeURI
(
`q=
${
q
}
&from=auto&to=
${
to
}
&appid=
${
appid
}
&salt=
${
salt
}
&sign=
${
sign
}
`
`q=
${
msg
}
&keyfrom=neverland&key=969918857&type=data&doctype=json&version=1.1
`
);
const
options
=
{
uri
:
`http
s://fanyi-api.baidu.com/api/trans/vip/translate
?
${
params
}
`
,
uri
:
`http
://fanyi.youdao.com/openapi.do
?
${
params
}
`
,
};
return
rp
(
options
).
then
((
res
)
=>
{
this
.
$set
(
this
.
selectData
,
'
translate
'
,
JSON
.
parse
(
res
).
trans_result
)
this
.
$set
(
this
.
selectData
,
'
translate
'
,
{
...
JSON
.
parse
(
res
),
src
:
msg
,
});
}).
finally
(()
=>
{
this
.
loading
=
false
;
})
},
commonClick
(
item
,
fileUrl
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录