Commit 4c121dea authored by carlosperate's avatar carlosperate

Add titles to the IDE buttons to clarify functionality.

Closes #20.
parent 18f1968d
...@@ -256,6 +256,10 @@ Ardublockly.ideButtonLeftAction = Ardublockly.ideSendOpen; ...@@ -256,6 +256,10 @@ Ardublockly.ideButtonLeftAction = Ardublockly.ideSendOpen;
/** Initialises the IDE buttons with the default option from the server. */ /** Initialises the IDE buttons with the default option from the server. */
Ardublockly.initialiseIdeButtons = function() { Ardublockly.initialiseIdeButtons = function() {
document.getElementById('button_ide_left').title = 'Open Sketch in IDE';
document.getElementById('button_ide_middle').title = 'Verify the Sketch';
document.getElementById('button_ide_large').title =
'Upload Sketch to the Arduino';
ArdublocklyServer.requestIdeOptions(function(jsonResponse) { ArdublocklyServer.requestIdeOptions(function(jsonResponse) {
if (jsonResponse != null) { if (jsonResponse != null) {
var parsedJson = JSON.parse(jsonResponse); var parsedJson = JSON.parse(jsonResponse);
...@@ -274,21 +278,36 @@ Ardublockly.initialiseIdeButtons = function() { ...@@ -274,21 +278,36 @@ Ardublockly.initialiseIdeButtons = function() {
* in the settings modal: 'upload', 'verify', or 'open'. * in the settings modal: 'upload', 'verify', or 'open'.
*/ */
Ardublockly.changeIdeButtons = function(value) { Ardublockly.changeIdeButtons = function(value) {
var largeButton = document.getElementById('button_ide_large');
var middleButton = document.getElementById('button_ide_middle');
var leftButton = document.getElementById('button_ide_left');
var openTitle = 'Open Sketch in IDE';
var verifyTitle = 'Verify the Sketch';
var uploadTitle = 'Upload Sketch to the Arduino';
if (value === 'upload') { if (value === 'upload') {
Ardublockly.changeIdeButtonsDesign(value); Ardublockly.changeIdeButtonsDesign(value);
Ardublockly.ideButtonLeftAction = Ardublockly.ideSendOpen; Ardublockly.ideButtonLeftAction = Ardublockly.ideSendOpen;
Ardublockly.ideButtonMiddleAction = Ardublockly.ideSendVerify; Ardublockly.ideButtonMiddleAction = Ardublockly.ideSendVerify;
Ardublockly.ideButtonLargeAction = Ardublockly.ideSendUpload; Ardublockly.ideButtonLargeAction = Ardublockly.ideSendUpload;
leftButton.title = openTitle;
middleButton.title = verifyTitle;
largeButton.title = uploadTitle;
} else if (value === 'verify') { } else if (value === 'verify') {
Ardublockly.changeIdeButtonsDesign(value); Ardublockly.changeIdeButtonsDesign(value);
Ardublockly.ideButtonLeftAction = Ardublockly.ideSendOpen; Ardublockly.ideButtonLeftAction = Ardublockly.ideSendOpen;
Ardublockly.ideButtonMiddleAction = Ardublockly.ideSendUpload; Ardublockly.ideButtonMiddleAction = Ardublockly.ideSendUpload;
Ardublockly.ideButtonLargeAction = Ardublockly.ideSendVerify; Ardublockly.ideButtonLargeAction = Ardublockly.ideSendVerify;
leftButton.title = openTitle;
middleButton.title = uploadTitle;
largeButton.title = verifyTitle;
} else if (value === 'open') { } else if (value === 'open') {
Ardublockly.changeIdeButtonsDesign(value); Ardublockly.changeIdeButtonsDesign(value);
Ardublockly.ideButtonLeftAction = Ardublockly.ideSendVerify; Ardublockly.ideButtonLeftAction = Ardublockly.ideSendVerify;
Ardublockly.ideButtonMiddleAction = Ardublockly.ideSendUpload; Ardublockly.ideButtonMiddleAction = Ardublockly.ideSendUpload;
Ardublockly.ideButtonLargeAction = Ardublockly.ideSendOpen; Ardublockly.ideButtonLargeAction = Ardublockly.ideSendOpen;
leftButton.title = verifyTitle;
middleButton.title = uploadTitle;
largeButton.title = openTitle;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment