mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-07-23 11:49:39 +08:00
添加自定义语言
This commit is contained in:
parent
13e8c1ed71
commit
7c63df1641
@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
#### v0.0.2
|
#### v0.0.2
|
||||||
|
|
||||||
|
- 可以自定义语言
|
||||||
- 修复uTools更新后进入插件空白的BUG
|
- 修复uTools更新后进入插件空白的BUG
|
||||||
- 添加Linux支持
|
- 添加Linux支持
|
||||||
- 修复导入BUG
|
- 修复导入BUG
|
||||||
-
|
- 修复说明为空时无法启用命令的BUG
|
||||||
- 添加全部导出和全部删除的功能
|
- 添加全部导出和全部删除的功能
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
utools.onPluginEnter(({ code, type, payload }) => {
|
utools.onPluginEnter(({ code, type, payload }) => {
|
||||||
checkUpdate();
|
// checkUpdate();
|
||||||
// 配置页面
|
// 配置页面
|
||||||
if (code == 'options') {
|
if (code == 'options') {
|
||||||
utools.setExpendHeight(600);
|
utools.setExpendHeight(600);
|
||||||
@ -12,8 +12,12 @@ utools.onPluginEnter(({ code, type, payload }) => {
|
|||||||
$("#options").hide();
|
$("#options").hide();
|
||||||
$("#out").show();
|
$("#out").show();
|
||||||
var db = utools.db.get('customFts').data[code],
|
var db = utools.db.get('customFts').data[code],
|
||||||
cmd = db.cmd,
|
cmd = db.cmd;
|
||||||
|
if (db.program == "custom") {
|
||||||
|
option = db.customOptions;
|
||||||
|
} else {
|
||||||
option = programs[db.program];
|
option = programs[db.program];
|
||||||
|
}
|
||||||
// 通过主输入框直接进入
|
// 通过主输入框直接进入
|
||||||
if (type == 'over') cmd = cmd.replace(/\{\{input\}\}/mg, payload);
|
if (type == 'over') cmd = cmd.replace(/\{\{input\}\}/mg, payload);
|
||||||
// 无输出的批处理
|
// 无输出的批处理
|
||||||
|
@ -249,6 +249,11 @@
|
|||||||
color: #bd3523;
|
color: #bd3523;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#options #customize input#custombin, #options #customize input#customarg, #options #customize input#customext {
|
||||||
|
margin-left: 5px;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
#options #customize {
|
#options #customize {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -126,7 +126,12 @@ programs = {
|
|||||||
bin: 'perl',
|
bin: 'perl',
|
||||||
agrv: '',
|
agrv: '',
|
||||||
ext: 'pl'
|
ext: 'pl'
|
||||||
}
|
},
|
||||||
|
custom: {
|
||||||
|
bin: '',
|
||||||
|
agrv: '',
|
||||||
|
ext: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showOptions = () => {
|
showOptions = () => {
|
||||||
@ -216,12 +221,11 @@ showCustomize = () => {
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="word">脚 本</span>
|
<span class="word">脚 本</span>
|
||||||
<!--
|
<span>
|
||||||
<select id="codec">
|
<input type="text" id="custombin" style="display: none;" placeholder="解释器绝对路径">
|
||||||
<option value="gbk">GBK 编码</option>
|
<input type="text" id="customarg" style="display: none;" placeholder="参数">
|
||||||
<option value="utf8">UTF8 编码</option>
|
<input type="text" id="customext" style="display: none;" placeholder="脚本后缀,不含.">
|
||||||
</select>
|
</span>
|
||||||
-->
|
|
||||||
</p>
|
</p>
|
||||||
<p><textarea id="cmd" placeholder="可以直接拖放脚本文件至此处"></textarea></p>
|
<p><textarea id="cmd" placeholder="可以直接拖放脚本文件至此处"></textarea></p>
|
||||||
<p>
|
<p>
|
||||||
@ -300,6 +304,11 @@ $("#options").on('click', '.editBtn', function () {
|
|||||||
let mode = data.program;
|
let mode = data.program;
|
||||||
let iconame = basename(data.features.icon);
|
let iconame = basename(data.features.icon);
|
||||||
if (iconame != `${mode}.png`) $('#iconame').val(iconame);
|
if (iconame != `${mode}.png`) $('#iconame').val(iconame);
|
||||||
|
if (mode == 'custom') {
|
||||||
|
$('#custombin').show().val(data.customOptions.bin);
|
||||||
|
$('#customarg').show().val(data.customOptions.args);
|
||||||
|
$('#customext').show().val(data.customOptions.ext);
|
||||||
|
}
|
||||||
mode == 'applescript' && (mode = 'shell');
|
mode == 'applescript' && (mode = 'shell');
|
||||||
mode == 'cmd' && (mode = 'powershell');
|
mode == 'cmd' && (mode = 'powershell');
|
||||||
window.editor.setOption("mode", mode);
|
window.editor.setOption("mode", mode);
|
||||||
@ -405,6 +414,13 @@ $("#options").on('click', '.saveBtn', function () {
|
|||||||
base64Ico: base64ico,
|
base64Ico: base64ico,
|
||||||
noKeyword: noKeyword
|
noKeyword: noKeyword
|
||||||
}
|
}
|
||||||
|
if (program == 'custom') {
|
||||||
|
pushData.customOptions = {
|
||||||
|
"bin": $('#custombin').val(),
|
||||||
|
"args": $('#customarg').val(),
|
||||||
|
"ext": $('#customext').val()
|
||||||
|
}
|
||||||
|
}
|
||||||
putCustomFts(code, pushData);
|
putCustomFts(code, pushData);
|
||||||
showOptions();
|
showOptions();
|
||||||
}
|
}
|
||||||
@ -414,6 +430,15 @@ $("#options").on('click', '.saveBtn', function () {
|
|||||||
$("#options").on('change', '#program', function () {
|
$("#options").on('change', '#program', function () {
|
||||||
let mode = $(this).val();
|
let mode = $(this).val();
|
||||||
if (!$("#iconame").val()) $("#icon").attr('src', `logo/${mode}.png`);
|
if (!$("#iconame").val()) $("#icon").attr('src', `logo/${mode}.png`);
|
||||||
|
if (mode == 'custom') {
|
||||||
|
$('#custombin').show();
|
||||||
|
$('#customarg').show();
|
||||||
|
$('#customext').show();
|
||||||
|
} else {
|
||||||
|
$('#custombin').hide();
|
||||||
|
$('#customarg').hide();
|
||||||
|
$('#customext').hide();
|
||||||
|
}
|
||||||
mode == 'applescript' && (mode = 'shell');
|
mode == 'applescript' && (mode = 'shell');
|
||||||
mode == 'cmd' && (mode = 'powershell');
|
mode == 'cmd' && (mode = 'powershell');
|
||||||
window.editor.setOption("mode", mode);
|
window.editor.setOption("mode", mode);
|
||||||
|
BIN
logo/custom.png
Normal file
BIN
logo/custom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user