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}`,
|
url: `https://raw.githubusercontent.com/${repo}/${filePath}`,
|
||||||
success: (code) => {
|
success: (code) => {
|
||||||
let lang = getLanguageByExtension(getFileExtension());
|
let lang = getLanguageByExtension(getFileExtension());
|
||||||
$.get({
|
$.getScript(`https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`, () => {
|
||||||
url: `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`,
|
setup(code, lang.mime);
|
||||||
success: (data) => {
|
|
||||||
eval(data);
|
|
||||||
setup(code, lang.mime);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -247,13 +243,9 @@ function markInvalid(pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLanguage(lang) {
|
function setLanguage(lang) {
|
||||||
$.get({
|
$.getScript(`https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`, () => {
|
||||||
url: `https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.19.0/mode/${lang.file}/${lang.file}.min.js`,
|
editor.setOption("mode", lang.mime);
|
||||||
success: (data) => {
|
console.log(`Changed language to ${lang.mime}`);
|
||||||
eval(data);
|
|
||||||
editor.setOption("mode", lang.mime);
|
|
||||||
console.log(`Changed language to ${lang.mime}`);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue