uweb/searchurl/ace.js~
2021-09-06 13:54:12 +08:00

24 lines
560 B
JavaScript

var editor;
onload=function(){
function getMode(filename){
var ext = filename.split('.').pop();
var prefix = "ace/mode/";
if(!ext) return prefix + "text";
switch (ext) {
case "js":
return prefix + "javascript";
}
return prefix + ext;
}
editor = ace.edit("editor");
editor.setTheme("ace/theme/clouds");
editor.setShowPrintMargin(false);
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
editor.session.setMode(getMode(location.href));
}