From cc435d6ceff266f06e1cf3e577e9e3caa88384e8 Mon Sep 17 00:00:00 2001 From: Brian Schiller Date: Fri, 29 Sep 2017 14:45:26 -0600 Subject: [PATCH] Don't show a red border if saving is not enabled --- runestone/activecode/js/activecode.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/runestone/activecode/js/activecode.js b/runestone/activecode/js/activecode.js index b3780416c..55e329128 100755 --- a/runestone/activecode/js/activecode.js +++ b/runestone/activecode/js/activecode.js @@ -100,15 +100,18 @@ ActiveCode.prototype.createEditor = function (index) { }); */ - // give the user a visual cue that they have changed but not saved - editor.on('change', (function () { - if (editor.acEditEvent == false || editor.acEditEvent === undefined) { - $(editor.getWrapperElement()).css('border-top', '2px solid #b43232'); - $(editor.getWrapperElement()).css('border-bottom', '2px solid #b43232'); - this.logBookEvent({'event': 'activecode', 'act': 'edit', 'div_id': this.divid}); + if (this.useRunestoneServices) { + // give the user a visual cue that they have changed but not saved + // but only if it's *possible* to save + editor.on('change', (function () { + if (useRunestoneServiceseditor.acEditEvent == false || editor.acEditEvent === undefined) { + $(editor.getWrapperElement()).css('border-top', '2px solid #b43232'); + $(editor.getWrapperElement()).css('border-bottom', '2px solid #b43232'); + this.logBookEvent({'event': 'activecode', 'act': 'edit', 'div_id': this.divid}); + } + editor.acEditEvent = true; + }).bind(this)); // use bind to preserve *this* inside the on handler. } - editor.acEditEvent = true; - }).bind(this)); // use bind to preserve *this* inside the on handler. this.editor = editor; if (this.hidecode) {