turtle-web-editor/js/app.js

26 lines
762 B
JavaScript
Raw Normal View History

2015-07-14 19:23:35 +02:00
$("#btn_validate").click( function () {
$("#warnings").html("");
$("#errors").html("");
$("#results").html("");
2020-04-29 16:09:29 +02:00
validate(editor.getValue(), function (feedback) {
2015-07-14 19:23:35 +02:00
$.each(feedback.warnings, function (index, warning) {
$("#warnings").append($('<li id="warning' + index + '">').text(warning));
2015-07-14 19:23:35 +02:00
});
$.each(feedback.errors, function (index, error) {
$("#errors").append($('<li id="error' + index + '">').text(error));
2015-07-14 19:23:35 +02:00
});
if (feedback.errors.length === 0 && feedback.warnings.length === 0) {
$("#results").append("Congrats! Your syntax is correct.");
2015-07-14 19:23:35 +02:00
}
});
});
2020-04-29 15:43:06 +02:00
var editor = CodeMirror.fromTextArea(document.getElementById("ta_turtle"), {
lineNumbers: true,
mode: 'turtle',
theme: 'default'
});