mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-03-16 22:10:31 +00:00
31 lines
890 B
JavaScript
31 lines
890 B
JavaScript
// Generated by CoffeeScript 1.6.3
|
|
(function() {
|
|
var fOnLoad;
|
|
|
|
fOnLoad = function() {
|
|
var editor;
|
|
document.title = 'Event Forge!';
|
|
$('#pagetitle').text('Invoke your custom event!');
|
|
editor = ace.edit("editor");
|
|
editor.setTheme("ace/theme/monokai");
|
|
editor.getSession().setMode("ace/mode/json");
|
|
editor.setShowPrintMargin(false);
|
|
return $('#but_submit').click(function() {
|
|
var data, err;
|
|
try {
|
|
data = JSON.parse(editor.getValue());
|
|
return $.post('/event', data).done(function(data) {
|
|
return alert(data);
|
|
}).fail(function(err) {
|
|
return alert('Posting of event failed: ' + err.responseText);
|
|
});
|
|
} catch (_error) {
|
|
err = _error;
|
|
return alert('You have errors in your JSON object!');
|
|
}
|
|
});
|
|
};
|
|
|
|
window.addEventListener('load', fOnLoad, true);
|
|
|
|
}).call(this);
|