Commit 4c11a38f authored by Romain Courteaud's avatar Romain Courteaud

erp5_officejs_drone_simulator: jslint

parent 81707283
(function (window, RSVP, rJS, domsugar, document, Blob) { /*jslint indent: 2, maxlen: 100*/
/*global window, rJS, domsugar, document, Blob*/
(function (window, rJS, domsugar, document, Blob) {
"use strict"; "use strict";
//Default values //Default values
...@@ -143,7 +145,7 @@ ...@@ -143,7 +145,7 @@
}) })
.declareMethod('render', function render() { .declareMethod('render', function render() {
var gadget = this, query; var gadget = this;//, query;
return gadget.getDeclaredGadget('form_view') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
return form_gadget.render({ return form_gadget.render({
...@@ -326,13 +328,13 @@ ...@@ -326,13 +328,13 @@
group_list: [[ group_list: [[
"left", "left",
[["my_simulation_speed"], ["my_simulation_time"], [["my_simulation_speed"], ["my_simulation_time"],
["my_drone_speed"], ["my_drone_acceleration"], ["my_drone_speed"], ["my_drone_acceleration"],
["my_number_of_drones"], ["my_map_height"], ["my_start_AMSL"]] ["my_number_of_drones"], ["my_map_height"], ["my_start_AMSL"]]
],[ ], [
"right", "right",
[["my_minimum_latitud"], ["my_maximum_latitud"], [["my_minimum_latitud"], ["my_maximum_latitud"],
["my_minimum_longitud"], ["my_maximum_longitud"], ["my_minimum_longitud"], ["my_maximum_longitud"],
["my_init_pos_lat"], ["my_init_pos_lon"], ["my_init_pos_z"]] ["my_init_pos_lat"], ["my_init_pos_lon"], ["my_init_pos_z"]]
], [ ], [
"bottom", "bottom",
[["my_script"]] [["my_script"]]
...@@ -361,10 +363,13 @@ ...@@ -361,10 +363,13 @@
return simulator.render(); return simulator.render();
}) })
.push(function () { .push(function () {
for (var i = 0; i < options.number_of_drones; i += 1) { var i,
DRONE_LIST[i] = {"id": i, "type": "DroneAaileFixeAPI", "script_content": options.script}; game_parameters_json;
for (i = 0; i < options.number_of_drones; i += 1) {
DRONE_LIST[i] = {"id": i, "type": "DroneAaileFixeAPI",
"script_content": options.script};
} }
var game_parameters_json = { game_parameters_json = {
"drone": { "drone": {
"maxAcceleration": parseFloat(options.drone_acceleration), "maxAcceleration": parseFloat(options.drone_acceleration),
"maxSpeed": parseFloat(options.drone_speed) "maxSpeed": parseFloat(options.drone_speed)
...@@ -399,16 +404,22 @@ ...@@ -399,16 +404,22 @@
}); });
}) })
.push(function (result_list) { .push(function (result_list) {
for (var i = 0; i < result_list.length; i += 1) { var i,
var log_content = result_list[i].join('\n').replaceAll(",", ";"), log_content,
blob = new Blob([log_content], {type: 'text/plain'}), blob,
a = domsugar('a', { a,
text: 'Download Simulation LOG ' + i, log,
download: 'simulation_log.txt', div;
href: window.URL.createObjectURL(blob) for (i = 0; i < result_list.length; i += 1) {
}), log_content = result_list[i].join('\n').replaceAll(",", ";");
log = domsugar('textarea', { value: log_content }), blob = new Blob([log_content], {type: 'text/plain'});
div = domsugar('div', [a]); a = domsugar('a', {
text: 'Download Simulation LOG ' + i,
download: 'simulation_log.txt',
href: window.URL.createObjectURL(blob)
});
log = domsugar('textarea', { value: log_content });
div = domsugar('div', [a]);
a.dataset.downloadurl = ['text/plain', a.download, a.dataset.downloadurl = ['text/plain', a.download,
a.href].join(':'); a.href].join(':');
document.querySelector('.container').appendChild(div); document.querySelector('.container').appendChild(div);
...@@ -417,4 +428,4 @@ ...@@ -417,4 +428,4 @@
}); });
}); });
}(window, RSVP, rJS, domsugar, document, Blob)); }(window, rJS, domsugar, document, Blob));
\ No newline at end of file \ No newline at end of file
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1004.26821.17898.13209</string> </value> <value> <string>1004.32372.28972.29115</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1668799702.5</float> <float>1669130240.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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