1
|
(function($) {
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
Drupal.behaviors.slideUpDown = {
|
7
|
attach: function(context, settings) {
|
8
|
$('body').addClass('has-js');
|
9
|
var editor = ace.edit("editor");
|
10
|
editor.getSession().setUseWorker(false);
|
11
|
editor.setTheme("ace/theme/chrome");
|
12
|
editor.getSession().setMode("ace/mode/css");
|
13
|
|
14
|
editor.getSession().on('change', function(e) {
|
15
|
setTextareaValue();
|
16
|
});
|
17
|
|
18
|
var setTextareaValue = function() {
|
19
|
$('#edit-css-text').val(editor.getValue());
|
20
|
}
|
21
|
|
22
|
$('.disable-ace').click(function() {
|
23
|
var $this = $(this);
|
24
|
$this.toggleClass('ace-disabled');
|
25
|
$text = $this.text() == 'Disable syntax highlighter' ? 'Enable syntax highlighter' : 'Disable syntax highlighter';
|
26
|
$this.text($text);
|
27
|
$('.form-item-css-text .form-textarea-wrapper, .ace-editor').toggle();
|
28
|
});
|
29
|
|
30
|
}
|
31
|
}
|
32
|
|
33
|
})(jQuery)
|