Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit 7f10356

Browse files
author
dastaple
committed
Disable buttons until we are connected.
1 parent 7bfbec7 commit 7f10356

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

app/start.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,15 @@ BounceUI.prototype.setup_menu = function() {
292292
});
293293
$('#scan').click(() => _ui.start_scan());
294294
this.connectMenu = $('#connections');
295-
296-
$('#play').click( ()=>_ui.run());
297-
$('#stop').click( ()=>_ui.currentMcu.stop());
298295
};
299296

297+
BounceUI.prototype.enable_connected_menu_items_ = function() {
298+
$('#play').removeClass('disabled');
299+
$('#stop').removeClass('disabled');
300+
$('#play').click( ()=>this.run());
301+
$('#stop').click( ()=>this.currentMcu.stop());
302+
};
303+
300304
BounceUI.prototype.new_document = function() {
301305
/* todo - request confirmation */
302306
this._is_preparing = true;
@@ -350,6 +354,7 @@ BounceUI.prototype.start_scan = function() {
350354
mcu_console.writeLine("Connecting.. outer");
351355
_ui.connect_menu_item_clicked_(connectItem, mcu);
352356
_ui.connectMenu.hide();
357+
_ui.enable_connected_menu_items_();
353358
return false;
354359
});
355360
});

bounce.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,19 @@ html, body {
8888
padding-bottom: 20px;
8989
margin: 0;
9090
}
91+
92+
.layered-button.disabled, .layered-button.disabled > i, .layered-button.disabled > control, .layered-button.disabled > :hover, .layered-button.disabled:hover {
93+
color: darkgray;
94+
background-color: lightgray;
95+
}
96+
9197
.layered-button > i {
9298
padding: 4px;
9399
}
94100
.layered-button > .control {
95101
display: inline;
96102
font-size: 1em;
97103
border-left: 2px solid black;
98-
color: darkgray;
99104
}
100105
.layered-button > .control:hover {
101106
color: white;

bounce_window.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
<ul id="connections" class="toggle-list">
3838
</ul>
3939
</div>
40-
<div id="play" class="layered-button">
40+
<div id="play" class="layered-button disabled">
4141
<i class="fa fa-play" aria-hidden="true"></i>
4242
</div>
43-
<div id="stop" class="layered-button">
43+
<div id="stop" class="layered-button disabled">
4444
<i class="fa fa-stop" aria-hidden="true"></i>
4545
</div>
4646

0 commit comments

Comments
 (0)