@@ -23,40 +23,43 @@ var editor2 = window.editor2 = splitEditor.editor1;
2323new TokenTooltip(editor2);
2424
2525var timeout = null;
26- schedule = function() {
27- if(timeout != null) {
26+ var schedule = function() {
27+ if (timeout != null) {
2828 clearTimeout(timeout);
2929 }
3030 timeout = setTimeout(run, 800);
3131};
3232
3333
34- setAutorunEnabled = function(val) {
34+ var setAutorunEnabled = function(val) {
3535 if (val)
3636 editor1.on('change', schedule);
3737 else
3838 editor1.removeEventListener('change', schedule);
39- }
39+ };
4040
4141util.bindCheckbox("autorunEl", setAutorunEnabled);
4242
4343
44- docEl = document.getElementById("doc");
44+ var docEl = document.getElementById("doc");
4545util.fillDropdown(docEl, doclist.docs);
4646util.bindDropdown("doc", function(value) {
4747 doclist.loadDoc(value, function(session) {
4848 if (session) {
4949 editor2.setSession(session);
5050 }
51- })
51+ });
5252});
5353
54- modeEl = document.getElementById("modeEl");
54+ var modeEl = document.getElementById("modeEl");
5555util.fillDropdown(modeEl, modelist.modes);
5656var modeSessions = {};
5757util.bindDropdown(modeEl, function(value) {
58- if (modeSessions[value])
58+ if (modeSessions[value]) {
5959 editor1.setSession(modeSessions[value]);
60+ schedule();
61+ return;
62+ }
6063 var hp = "./lib/ace/mode/" + value + "_highlight_rules.js";
6164 net.get(hp, function(text) {
6265 text = util.stripLeadingComments(text);
@@ -67,6 +70,7 @@ util.bindDropdown(modeEl, function(value) {
6770 session.setMode("ace/mode/javascript");
6871
6972 editor1.setSession(modeSessions[value]);
73+ schedule();
7074 });
7175});
7276
0 commit comments