Commit 422ae35e authored by carlosperate's avatar carlosperate

Fixing minor bugs due to renames and added server checks.

parent e0166b63
...@@ -50,7 +50,7 @@ ArduServerCompiler.ajaxPostForm = function(url, params, callback) { ...@@ -50,7 +50,7 @@ ArduServerCompiler.ajaxPostForm = function(url, params, callback) {
/** /**
* Sends plain data to the ArduBlocklyServer using Ajax * Sends plain data to the ArduBlocklyServer using Ajax
* @param {!string} url Requester URL * @param {!string} url Requester URL
* @param {!string} params Form parameters in the "var=x&var2=y" format * @param {!string} data Plain text currently used to send Arduino code only.
* @param {!function} callback Request callback function. * @param {!function} callback Request callback function.
* @return False if an error occurred * @return False if an error occurred
*/ */
...@@ -75,7 +75,7 @@ ArduServerCompiler.ajaxPostPlain = function(url, data, callback) { ...@@ -75,7 +75,7 @@ ArduServerCompiler.ajaxPostPlain = function(url, data, callback) {
// Send the data // Send the data
try { try {
request.send(params); request.send(data);
} catch(e) { } catch(e) {
// The request will fail if opening the html directly on a browser, so // The request will fail if opening the html directly on a browser, so
// let's just send the callback nullified and the front end will deal. // let's just send the callback nullified and the front end will deal.
...@@ -110,7 +110,7 @@ ArduServerCompiler.createAjaxRequest = function() { ...@@ -110,7 +110,7 @@ ArduServerCompiler.createAjaxRequest = function() {
} }
} }
return request; return request;
} };
/** /**
* Creates an HTML element based on the JSON data received from the server. * Creates an HTML element based on the JSON data received from the server.
......
...@@ -321,9 +321,9 @@ ArduinoMaterial.setIdeSettings = function() { ...@@ -321,9 +321,9 @@ ArduinoMaterial.setIdeSettings = function() {
*/ */
ArduinoMaterial.sendCode = function() { ArduinoMaterial.sendCode = function() {
toast('Sending sketch to Arduino IDE...', 4000); toast('Sending sketch to Arduino IDE...', 4000);
ArduinoMaterial.runButtonSpinner(true);
ArduServerCompiler.sendSketchToServer( ArduServerCompiler.sendSketchToServer(
ArduinoMaterial.generateArduino(), ArduinoMaterial.sendCodeReturn); ArduinoMaterial.generateArduino(), ArduinoMaterial.sendCodeReturn);
ArduinoMaterial.runButtonSpinner(true);
}; };
/** /**
......
...@@ -42,6 +42,7 @@ ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) { ...@@ -42,6 +42,7 @@ ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) {
} }
} }
} }
// If file run locally Internet explorer fails here // If file run locally Internet explorer fails here
try { try {
request.open("GET", toolbox_path, true); request.open("GET", toolbox_path, true);
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</div> </div>
<!-- General Alert: Content is loaded using Javascript to display alerts --> <!-- General Alert: Content is loaded using Javascript to display alerts -->
<div id="not_running_dialog" class="modal modal-fixed-footer"> <div id="not_running_dialog" class="modal modal-fixed-footer" style="height:50%!important">
<div class="modal-content"> <div class="modal-content">
<h4 id="gen_alert_title">Ardublockly not running locally</h4> <h4 id="gen_alert_title">Ardublockly not running locally</h4>
<p>For Ardublockly to work correctly, the Ardublockly server must be <p>For Ardublockly to work correctly, the Ardublockly server must be
......
...@@ -139,7 +139,7 @@ ArduinoClassic.init = function() { ...@@ -139,7 +139,7 @@ ArduinoClassic.init = function() {
document.location.hostname != "192.168.0.7") { document.location.hostname != "192.168.0.7") {
alert('Ardublockly not running locally\n\n' + alert('Ardublockly not running locally\n\n' +
'For Ardublockly to work correctly, the Ardublockly server must be' + 'For Ardublockly to work correctly, the Ardublockly server must be' +
' running locally on your computer'); ' running locally on your computer.');
} }
}; };
window.addEventListener('load', ArduinoClassic.init); window.addEventListener('load', ArduinoClassic.init);
...@@ -182,12 +182,18 @@ ArduinoClassic.loadToArduino = function() { ...@@ -182,12 +182,18 @@ ArduinoClassic.loadToArduino = function() {
* Send the Arduino Code to the ArduServerCompiler to process * Send the Arduino Code to the ArduServerCompiler to process
*/ */
ArduinoClassic.loadToArduinoReturn = function(data_back_el) { ArduinoClassic.loadToArduinoReturn = function(data_back_el) {
// edit modal with new content if (data_back_el != null) {
var modal = document.getElementById('modal_content'); // edit modal with new content
modal.innerHTML = ''; var modal = document.getElementById('modal_content');
modal.appendChild(data_back_el); modal.innerHTML = '';
// display modal modal.appendChild(data_back_el);
document.getElementById('modal_toggle').checked = true; // display modal
document.getElementById('modal_toggle').checked = true;
} else {
alert('Ardublockly not running locally\n\n' +
'To load the blocks code into an Arduino the For Ardublockly ' +
'server must be running locally on your computer.');
}
}; };
/** /**
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<link rel="stylesheet" href="../../demos/prettify.css"> <link rel="stylesheet" href="../../demos/prettify.css">
<script src="../../demos/prettify.js"></script> <script src="../../demos/prettify.js"></script>
<!-- FileSaver from arduino materia app --> <!-- FileSaver from arduino materia app -->
<script src="../arduino_material/js_libs/FileSaver.min.js"></script> <script src="../arduino/js_libs/FileSaver.min.js"></script>
</head> </head>
<body> <body>
......
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