Commit 261e382c authored by carlosperate's avatar carlosperate

Update arduino classic with warning alerts when the server component is not running.

parent 89a6a0f2
...@@ -34,6 +34,14 @@ window.addEventListener('load', function() { ...@@ -34,6 +34,14 @@ window.addEventListener('load', function() {
ArduServerCompiler.requestNewSketchLocation( ArduServerCompiler.requestNewSketchLocation(
ArduinoSettings.setSketchLocationHtml); ArduinoSettings.setSketchLocationHtml);
}); });
// Check if not running locally (including developer's local network IP)
if (document.location.hostname != "localhost" &&
document.location.hostname != "192.168.0.7") {
alert('Ardublockly not running locally\n\n' +
'For Ardublockly to work correctly, the Ardublockly server must be' +
' running locally on your computer');
}
}); });
/** /**
...@@ -42,9 +50,11 @@ window.addEventListener('load', function() { ...@@ -42,9 +50,11 @@ window.addEventListener('load', function() {
* DOM. Should contain a complete input text element. * DOM. Should contain a complete input text element.
*/ */
ArduinoSettings.setCompilerLocationHtml = function(new_el) { ArduinoSettings.setCompilerLocationHtml = function(new_el) {
var comp_loc_ip = document.getElementById('settings_compiler_location') if (new_el != null) {
if (comp_loc_ip != null) { var comp_loc_ip = document.getElementById('settings_compiler_location')
comp_loc_ip.value = new_el.value; if (comp_loc_ip != null) {
comp_loc_ip.value = new_el.value;
}
} }
}; };
...@@ -54,9 +64,11 @@ ArduinoSettings.setCompilerLocationHtml = function(new_el) { ...@@ -54,9 +64,11 @@ ArduinoSettings.setCompilerLocationHtml = function(new_el) {
* DOM. Should contain a complete input text element. * DOM. Should contain a complete input text element.
*/ */
ArduinoSettings.setSketchLocationHtml = function(new_el) { ArduinoSettings.setSketchLocationHtml = function(new_el) {
var sketch_loc_ip = document.getElementById('settings_sketch_location') if (new_el != null) {
if (sketch_loc_ip != null) { var sketch_loc_ip = document.getElementById('settings_sketch_location')
sketch_loc_ip.value = new_el.value; if (sketch_loc_ip != null) {
sketch_loc_ip.value = new_el.value;
}
} }
}; };
...@@ -67,11 +79,13 @@ ArduinoSettings.setSketchLocationHtml = function(new_el) { ...@@ -67,11 +79,13 @@ ArduinoSettings.setSketchLocationHtml = function(new_el) {
* DOM. Should contain a complete select element. * DOM. Should contain a complete select element.
*/ */
ArduinoSettings.setArduinoBoardsHtml = function(new_el) { ArduinoSettings.setArduinoBoardsHtml = function(new_el) {
var board_dropdown = document.getElementById('board') if (new_el != null) {
if (board_dropdown != null) { var board_dropdown = document.getElementById('board')
new_el.id = 'board'; if (board_dropdown != null) {
new_el.onchange = ArduinoSettings.setBoard; new_el.id = 'board';
board_dropdown.parentNode.replaceChild(new_el, board_dropdown); new_el.onchange = ArduinoSettings.setBoard;
board_dropdown.parentNode.replaceChild(new_el, board_dropdown);
}
} }
}; };
...@@ -93,11 +107,13 @@ ArduinoSettings.setBoard = function() { ...@@ -93,11 +107,13 @@ ArduinoSettings.setBoard = function() {
* DOM. Should contain a complete select element. * DOM. Should contain a complete select element.
*/ */
ArduinoSettings.setSerialPortsHtml = function(new_el) { ArduinoSettings.setSerialPortsHtml = function(new_el) {
var serial_dropdown = document.getElementById('serial_port') if (new_el != null) {
if (serial_dropdown != null) { var serial_dropdown = document.getElementById('serial_port')
new_el.id = 'serial_port'; if (serial_dropdown != null) {
new_el.onchange = ArduinoSettings.setSerial; new_el.id = 'serial_port';
serial_dropdown.parentNode.replaceChild(new_el, serial_dropdown); new_el.onchange = ArduinoSettings.setSerial;
serial_dropdown.parentNode.replaceChild(new_el, serial_dropdown);
}
} }
}; };
...@@ -119,11 +135,13 @@ ArduinoSettings.setSerial = function() { ...@@ -119,11 +135,13 @@ ArduinoSettings.setSerial = function() {
* DOM. Should contain a complete select element. * DOM. Should contain a complete select element.
*/ */
ArduinoSettings.setIdeHtml = function(new_el) { ArduinoSettings.setIdeHtml = function(new_el) {
var ide_dropdown = document.getElementById('ide_settings') if (new_el != null) {
if (ide_dropdown != null) { var ide_dropdown = document.getElementById('ide_settings')
new_el.id = 'ide_settings'; if (ide_dropdown != null) {
new_el.onchange = ArduinoSettings.setIdeSettings; new_el.id = 'ide_settings';
ide_dropdown.parentNode.replaceChild(new_el, ide_dropdown); new_el.onchange = ArduinoSettings.setIdeSettings;
ide_dropdown.parentNode.replaceChild(new_el, ide_dropdown);
}
} }
}; };
......
...@@ -118,6 +118,6 @@ ...@@ -118,6 +118,6 @@
</div> </div>
<!-- Webapp js --> <!-- Webapp js -->
<script src="arduino.js"></script> <script src="arduino_classic.js"></script>
</body> </body>
</html> </html>
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