diff --git a/src/assets/index.js b/src/assets/js/index.js similarity index 95% rename from src/assets/index.js rename to src/assets/js/index.js index 669dec9..2d82307 100644 --- a/src/assets/index.js +++ b/src/assets/js/index.js @@ -1,3 +1,5 @@ +import { programs } from "./programs.js" + !function () { // 禁用危险函数 let utoolsFull = utools @@ -70,6 +72,7 @@ // 配置页面 if (code == 'options') { utools.setExpendHeight(600); + $("#quickpanel").hide() // $("#options").show(); showOptions(); } 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 => { @@ -900,7 +823,7 @@ window.editor.setOption("mode", 'javascript'); } - showHint = () => { + window.showHint = () => { editor.showHint({ completeSingle: false }); } diff --git a/src/assets/js/programs.js b/src/assets/js/programs.js new file mode 100644 index 0000000..9bf2c94 --- /dev/null +++ b/src/assets/js/programs.js @@ -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' + } +} diff --git a/src/assets/plugins/codemirrorloader.js b/src/assets/plugins/codemirrorloader.js index a44b621..b453b44 100644 --- a/src/assets/plugins/codemirrorloader.js +++ b/src/assets/plugins/codemirrorloader.js @@ -63,7 +63,8 @@ mainScriptTag.onload = mainScriptTag.onreadystatechange = function () { modes.concat(addons).forEach(s => { var scriptTag = document.createElement('script'); scriptTag.setAttribute('src', s); + scriptTag.setAttribute('type', 'module'); document.head.appendChild(scriptTag); }) } -} \ No newline at end of file +} diff --git a/src/index.html b/src/index.html index b236da6..5fa2f4a 100755 --- a/src/index.html +++ b/src/index.html @@ -24,7 +24,7 @@
- +