Skip to content

Commit 6ae31c4

Browse files
author
Povilas Kanapickas
committed
Gadgets/Coliru: fix a bug in disabling button click handlers
1 parent dcafccf commit 6ae31c4

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

gadgets/coliru_compiler.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,31 +157,33 @@ function Editor(root) {
157157
this.editor.getSession().setValue(this.source_code);
158158
};
159159

160+
this.el.run_btn.click(function() {
161+
if (!this.el.run_btn.hasClass('coliru-btn-disabled')) {
162+
this.compile_now();
163+
}
164+
}.bind(this));
165+
this.el.share_btn.click(function() {
166+
if (!this.el.share_btn.hasClass('coliru-btn-disabled')) {
167+
this.share();
168+
}
169+
}.bind(this));
170+
this.el.exit_btn.click(function() {
171+
if (!this.el.exit_btn.hasClass('coliru-btn-disabled')) {
172+
this.restore_orig();
173+
}
174+
}.bind(this));
175+
160176
this.enable_ui = function(value) {
161177
this.editor.setReadOnly(!value);
162178

163179
if (value) {
164180
this.el.run_btn.removeClass('coliru-btn-disabled');
165181
this.el.share_btn.removeClass('coliru-btn-disabled');
166182
this.el.exit_btn.removeClass('coliru-btn-disabled');
167-
168-
this.el.run_btn.click(function() {
169-
this.compile_now();
170-
}.bind(this));
171-
this.el.share_btn.click(function() {
172-
this.share();
173-
}.bind(this));
174-
this.el.exit_btn.click(function() {
175-
this.restore_orig();
176-
}.bind(this));
177183
} else {
178184
this.el.run_btn.addClass('coliru-btn-disabled');
179185
this.el.share_btn.addClass('coliru-btn-disabled');
180186
this.el.exit_btn.addClass('coliru-btn-disabled');
181-
182-
this.el.run_btn.click(false);
183-
this.el.share_btn.click(false);
184-
this.el.exit_btn.click(false);
185187
}
186188
};
187189

0 commit comments

Comments
 (0)