mirror of https://github.com/masayuki0812/c3.git
Quite good looking graph derived from d3.js
http://c3js.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1003 B
37 lines
1003 B
7 years ago
|
= javascript_include_tag "ace/ace.js"
|
||
|
= javascript_include_tag "ace/mode-javascript.js"
|
||
|
= javascript_include_tag "ace/theme-tomorrow.js"
|
||
|
:javascript
|
||
|
var editor = ace.edit('#{type}-editor'),
|
||
|
error = document.getElementById('ace-error');
|
||
|
|
||
|
function debounce(func, wait) {
|
||
|
var timeout;
|
||
|
return function() {
|
||
|
var context = this, args = arguments;
|
||
|
var later = function() {
|
||
|
func.apply(context, args);
|
||
|
};
|
||
|
clearTimeout(timeout);
|
||
|
timeout = setTimeout(later, wait);
|
||
|
};
|
||
|
};
|
||
|
|
||
|
editor.on('change', debounce(function(e) {
|
||
|
try {
|
||
|
eval(editor.getValue());
|
||
|
error.innerHTML = '';
|
||
|
}
|
||
|
catch(e) {
|
||
|
error.innerHTML = e;
|
||
|
}
|
||
|
}, 300));
|
||
|
|
||
|
editor.setOption("maxLines", 100);
|
||
|
editor.setOption("showLineNumbers", false);
|
||
|
editor.setOption("showGutter", false);
|
||
|
|
||
|
editor.setTheme("ace/theme/tomorrow");
|
||
|
editor.getSession().setMode("ace/mode/#{type}");
|
||
|
editor.commands.removeCommand('gotoline') // Disables the override of Command-L
|