This repository was archived by the owner on Jan 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
48 lines (37 loc) · 1.22 KB
/
app.js
File metadata and controls
48 lines (37 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
window.APP = (function (module, $) {
"use strict";
var resizeTimerId;
// global(ish) variable for the current width of the device
var deviceWidth = $(window).resize(function () {
clearTimeout(resizeTimerId);
APP.deviceWidth = $(this).width();
resizeTimerId = setTimeout(function () {
$(window).trigger("onResizeEnd");
}, 250);
}).width();
$(function() {
var script,
loadEditor;
loadEditor = function(response){
var $codeBlock = $('.code-editor-panel__codeblock');
$('.code-editor').resizablePanels();
$codeBlock.each(function() {
var id = $(this).attr('id'),
mode = $(this).data('mode'),
thisEditor = ace.edit(id);
thisEditor.setTheme('ace/theme/chrome');
thisEditor.getSession().setMode(mode);
$(window).on('onResizePanels', function() {
thisEditor.resize();
});
});
}
if(typeof ace === 'undefined') {
script = $.getScript('//cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/ace.js').then(loadEditor)
}
else {
loadEditor();
}
});
return module;
})(window.APP || {}, window.jQuery);