mirror of https://github.com/shadowfacts/type.git
Clean up stuff using jQuery.getScript
This commit is contained in:
parent
0a72bab1d5
commit
8b8e477880
18
main.js
18
main.js
|
@ -13,12 +13,8 @@ $.get({
|
|||
url: `https://raw.githubusercontent.com/${repo}/${filePath}`,
|
||||
success: (code) => {
|
||||
let lang = getLanguageByExtension(getFileExtension());
|
||||
$.get({
|
||||
url: `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`,
|
||||
success: (data) => {
|
||||
eval(data);
|
||||
setup(code, lang.mime);
|
||||
}
|
||||
$.getScript(`https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`, () => {
|
||||
setup(code, lang.mime);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -247,13 +243,9 @@ function markInvalid(pos) {
|
|||
}
|
||||
|
||||
function setLanguage(lang) {
|
||||
$.get({
|
||||
url: `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`,
|
||||
success: (data) => {
|
||||
eval(data);
|
||||
editor.setOption("mode", lang.mime);
|
||||
console.log(`Changed language to ${lang.mime}`);
|
||||
}
|
||||
$.getScript(`https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`, () => {
|
||||
editor.setOption("mode", lang.mime);
|
||||
console.log(`Changed language to ${lang.mime}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue