mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 06:54:11 +08:00
refactor: 结构调整
This commit is contained in:
parent
128e974b22
commit
db9330f8fa
@ -1,3 +1,5 @@
|
|||||||
|
import { programs } from "./programs.js"
|
||||||
|
|
||||||
!function () {
|
!function () {
|
||||||
// 禁用危险函数
|
// 禁用危险函数
|
||||||
let utoolsFull = utools
|
let utoolsFull = utools
|
||||||
@ -70,6 +72,7 @@
|
|||||||
// 配置页面
|
// 配置页面
|
||||||
if (code == 'options') {
|
if (code == 'options') {
|
||||||
utools.setExpendHeight(600);
|
utools.setExpendHeight(600);
|
||||||
|
$("#quickpanel").hide()
|
||||||
// $("#options").show();
|
// $("#options").show();
|
||||||
showOptions();
|
showOptions();
|
||||||
} else if (code == 'code') {
|
} else if (code == 'code') {
|
||||||
@ -409,87 +412,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 环境
|
|
||||||
const programs = {
|
|
||||||
shell: {
|
|
||||||
bin: 'bash',
|
|
||||||
argv: '',
|
|
||||||
ext: 'sh',
|
|
||||||
color: '#89e051'
|
|
||||||
},
|
|
||||||
applescript: {
|
|
||||||
bin: 'osascript',
|
|
||||||
argv: '',
|
|
||||||
ext: 'scpt',
|
|
||||||
color: '#101F1F'
|
|
||||||
},
|
|
||||||
cmd: {
|
|
||||||
bin: '',
|
|
||||||
argv: '',
|
|
||||||
ext: 'bat',
|
|
||||||
color: '#C1F12E'
|
|
||||||
},
|
|
||||||
powershell: {
|
|
||||||
bin: 'powershell',
|
|
||||||
argv: '-NoProfile -File',
|
|
||||||
ext: 'ps1',
|
|
||||||
color: '#012456'
|
|
||||||
},
|
|
||||||
python: {
|
|
||||||
bin: 'python',
|
|
||||||
argv: '-u',
|
|
||||||
ext: 'py',
|
|
||||||
color: '#3572A5'
|
|
||||||
},
|
|
||||||
javascript: {
|
|
||||||
bin: 'node',
|
|
||||||
argv: '',
|
|
||||||
ext: 'js',
|
|
||||||
color: '#f1e05a'
|
|
||||||
},
|
|
||||||
ruby: {
|
|
||||||
bin: 'ruby',
|
|
||||||
argv: '',
|
|
||||||
ext: 'rb',
|
|
||||||
color: '#701516'
|
|
||||||
},
|
|
||||||
php: {
|
|
||||||
bin: 'php',
|
|
||||||
argv: '',
|
|
||||||
ext: 'php',
|
|
||||||
color: '#4F5D95'
|
|
||||||
},
|
|
||||||
c: {
|
|
||||||
bin: 'gcc',
|
|
||||||
argv: '-o',
|
|
||||||
ext: 'c',
|
|
||||||
color: '#555555'
|
|
||||||
},
|
|
||||||
csharp: {
|
|
||||||
bin: 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe',
|
|
||||||
argv: '/Nologo',
|
|
||||||
ext: 'cs',
|
|
||||||
color: '#178600'
|
|
||||||
},
|
|
||||||
lua: {
|
|
||||||
bin: 'lua',
|
|
||||||
argv: '',
|
|
||||||
ext: 'lua',
|
|
||||||
color: '#000080'
|
|
||||||
},
|
|
||||||
perl: {
|
|
||||||
bin: 'perl',
|
|
||||||
argv: '',
|
|
||||||
ext: 'pl',
|
|
||||||
color: '#0298c3'
|
|
||||||
},
|
|
||||||
custom: {
|
|
||||||
bin: '',
|
|
||||||
argv: '',
|
|
||||||
ext: '',
|
|
||||||
color: '#438eff'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 自动设置编码
|
// 自动设置编码
|
||||||
let autoCharset = program => {
|
let autoCharset = program => {
|
||||||
@ -900,7 +823,7 @@
|
|||||||
window.editor.setOption("mode", 'javascript');
|
window.editor.setOption("mode", 'javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
showHint = () => {
|
window.showHint = () => {
|
||||||
editor.showHint({ completeSingle: false });
|
editor.showHint({ completeSingle: false });
|
||||||
}
|
}
|
||||||
|
|
81
src/assets/js/programs.js
Normal file
81
src/assets/js/programs.js
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// 环境
|
||||||
|
export const programs = {
|
||||||
|
shell: {
|
||||||
|
bin: 'bash',
|
||||||
|
argv: '',
|
||||||
|
ext: 'sh',
|
||||||
|
color: '#89e051'
|
||||||
|
},
|
||||||
|
applescript: {
|
||||||
|
bin: 'osascript',
|
||||||
|
argv: '',
|
||||||
|
ext: 'scpt',
|
||||||
|
color: '#101F1F'
|
||||||
|
},
|
||||||
|
cmd: {
|
||||||
|
bin: '',
|
||||||
|
argv: '',
|
||||||
|
ext: 'bat',
|
||||||
|
color: '#C1F12E'
|
||||||
|
},
|
||||||
|
powershell: {
|
||||||
|
bin: 'powershell',
|
||||||
|
argv: '-NoProfile -File',
|
||||||
|
ext: 'ps1',
|
||||||
|
color: '#012456'
|
||||||
|
},
|
||||||
|
python: {
|
||||||
|
bin: 'python',
|
||||||
|
argv: '-u',
|
||||||
|
ext: 'py',
|
||||||
|
color: '#3572A5'
|
||||||
|
},
|
||||||
|
javascript: {
|
||||||
|
bin: 'node',
|
||||||
|
argv: '',
|
||||||
|
ext: 'js',
|
||||||
|
color: '#f1e05a'
|
||||||
|
},
|
||||||
|
ruby: {
|
||||||
|
bin: 'ruby',
|
||||||
|
argv: '',
|
||||||
|
ext: 'rb',
|
||||||
|
color: '#701516'
|
||||||
|
},
|
||||||
|
php: {
|
||||||
|
bin: 'php',
|
||||||
|
argv: '',
|
||||||
|
ext: 'php',
|
||||||
|
color: '#4F5D95'
|
||||||
|
},
|
||||||
|
c: {
|
||||||
|
bin: 'gcc',
|
||||||
|
argv: '-o',
|
||||||
|
ext: 'c',
|
||||||
|
color: '#555555'
|
||||||
|
},
|
||||||
|
csharp: {
|
||||||
|
bin: 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe',
|
||||||
|
argv: '/Nologo',
|
||||||
|
ext: 'cs',
|
||||||
|
color: '#178600'
|
||||||
|
},
|
||||||
|
lua: {
|
||||||
|
bin: 'lua',
|
||||||
|
argv: '',
|
||||||
|
ext: 'lua',
|
||||||
|
color: '#000080'
|
||||||
|
},
|
||||||
|
perl: {
|
||||||
|
bin: 'perl',
|
||||||
|
argv: '',
|
||||||
|
ext: 'pl',
|
||||||
|
color: '#0298c3'
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
bin: '',
|
||||||
|
argv: '',
|
||||||
|
ext: '',
|
||||||
|
color: '#438eff'
|
||||||
|
}
|
||||||
|
}
|
@ -63,7 +63,8 @@ mainScriptTag.onload = mainScriptTag.onreadystatechange = function () {
|
|||||||
modes.concat(addons).forEach(s => {
|
modes.concat(addons).forEach(s => {
|
||||||
var scriptTag = document.createElement('script');
|
var scriptTag = document.createElement('script');
|
||||||
scriptTag.setAttribute('src', s);
|
scriptTag.setAttribute('src', s);
|
||||||
|
scriptTag.setAttribute('type', 'module');
|
||||||
document.head.appendChild(scriptTag);
|
document.head.appendChild(scriptTag);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<div id="options"></div>
|
<div id="options"></div>
|
||||||
<div id="quickpanel"></div>
|
<div id="quickpanel"></div>
|
||||||
<pre id="out" class="output"></pre>
|
<pre id="out" class="output"></pre>
|
||||||
<script src="assets/index.js"></script>
|
<script type="module" src="assets/js/index.js"></script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user