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) {
/**
* Sends plain data to the ArduBlocklyServer using Ajax
* @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.
* @return False if an error occurred
*/
......@@ -75,7 +75,7 @@ ArduServerCompiler.ajaxPostPlain = function(url, data, callback) {
// Send the data
try {
request.send(params);
request.send(data);
} catch(e) {
// 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.
......@@ -110,7 +110,7 @@ ArduServerCompiler.createAjaxRequest = function() {
}
}
return request;
}
};
/**
* Creates an HTML element based on the JSON data received from the server.
......
......@@ -321,9 +321,9 @@ ArduinoMaterial.setIdeSettings = function() {
*/
ArduinoMaterial.sendCode = function() {
toast('Sending sketch to Arduino IDE...', 4000);
ArduinoMaterial.runButtonSpinner(true);
ArduServerCompiler.sendSketchToServer(
ArduinoMaterial.generateArduino(), ArduinoMaterial.sendCodeReturn);
ArduinoMaterial.runButtonSpinner(true);
};
/**
......
......@@ -42,6 +42,7 @@ ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) {
}
}
}
// If file run locally Internet explorer fails here
try {
request.open("GET", toolbox_path, true);
......
......@@ -238,7 +238,7 @@
</div>
<!-- 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">
<h4 id="gen_alert_title">Ardublockly not running locally</h4>
<p>For Ardublockly to work correctly, the Ardublockly server must be
......
......@@ -139,7 +139,7 @@ ArduinoClassic.init = function() {
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');
' running locally on your computer.');
}
};
window.addEventListener('load', ArduinoClassic.init);
......@@ -182,12 +182,18 @@ ArduinoClassic.loadToArduino = function() {
* Send the Arduino Code to the ArduServerCompiler to process
*/
ArduinoClassic.loadToArduinoReturn = function(data_back_el) {
// edit modal with new content
var modal = document.getElementById('modal_content');
modal.innerHTML = '';
modal.appendChild(data_back_el);
// display modal
document.getElementById('modal_toggle').checked = true;
if (data_back_el != null) {
// edit modal with new content
var modal = document.getElementById('modal_content');
modal.innerHTML = '';
modal.appendChild(data_back_el);
// 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 @@
<link rel="stylesheet" href="../../demos/prettify.css">
<script src="../../demos/prettify.js"></script>
<!-- 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>
<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