index.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!doctype html>
  2. <head>
  3. <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/main.css') }}">
  4. <script type="text/javascript" src="{{ url_for('static', filename='js/CollapsibleLists.js')}}"></script>
  5. <title>ArduPilot Custom Firmware Builder</title>
  6. </head>
  7. <body onload="javascript: reload()">
  8. <div id="main">
  9. <a href="https://custom.ardupilot.org/">
  10. <div id="logo">
  11. </div>
  12. </a>
  13. <div id="menu">
  14. <h2>ArduPilot Custom Firmware Builder</h2>
  15. <br><b>This site is EXPERIMENTAL</b>
  16. <p>Please select the required options for the custom firmware build.</p>
  17. <textarea style="float:right" readonly>hello</textarea>
  18. <form action="/generate" method="post">
  19. <label for="vehicle">Choose a vehicle:</label>
  20. <select name="vehicle">
  21. {% for vehicle in get_vehicles()[0] %}
  22. {% if vehicle == get_vehicles()[1] %}
  23. <option value="{{vehicle}}" selected>{{vehicle}}</option>
  24. {% else %}
  25. <option value="{{vehicle}}">{{vehicle}}</option>
  26. {% endif %}
  27. {% endfor %}
  28. </select>
  29. <p/>
  30. <label for="board">Choose a board:</label>
  31. <select name="board">
  32. {% for board in get_boards()[0] %}
  33. {% if board == get_boards()[1] %}
  34. <option value="{{board}}" selected>{{board}}</option>
  35. {% else %}
  36. <option value="{{board}}">{{board}}</option>
  37. {% endif %}
  38. {% endfor %}
  39. </select>
  40. <p/>
  41. <label for="board">Select Features:</label>
  42. <ul class="collapsibleList">
  43. {% for c in get_build_categories() %}
  44. <li>{{c}}
  45. <ul>
  46. {% for f in get_build_options(c) %}
  47. <li>
  48. {% if f.default == 1 %}
  49. <input onclick='dependencies(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox" name="{{f.label}}" id="{{f.label}}" value="1" checked>
  50. {% else %}
  51. <input onclick='dependencies(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox" name="{{f.label}}" id="{{f.label}}" value="1">
  52. {% endif %}
  53. {{f.description}}
  54. </li>
  55. {% endfor %}
  56. </ul>
  57. </li>
  58. {% endfor %}
  59. </ul>
  60. <br>
  61. <input type="submit" value="Generate">
  62. </form>
  63. </div>
  64. <hr>
  65. <div id="build_status"></div>
  66. <br />
  67. <p id="demo"></p>
  68. <p id="demo2"></p>
  69. <script>
  70. CollapsibleLists.apply();
  71. function reload() {
  72. var output = document.getElementById('build_status');
  73. var xhr = new XMLHttpRequest();
  74. xhr.open('GET', "/builds/status.html");
  75. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  76. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  77. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  78. xhr.setRequestHeader("Pragma", "no-cache");
  79. xhr.onload = function() {
  80. if (xhr.status == 200) {
  81. output.innerHTML = xhr.responseText;
  82. }
  83. setTimeout(reload,5000)
  84. }
  85. xhr.send();
  86. }
  87. function dependencies(cb, f_label, f_dependency1) {
  88. switch (cb.name) {
  89. case f_label:
  90. const f_dependency = f_dependency1.split(",")
  91. var arrayLength = f_dependency.length;
  92. for (var i = 0; i < arrayLength; i++) {
  93. if (document.getElementById(f_dependency[i]).checked == false){
  94. document.getElementById(f_dependency[i]).checked = cb.checked;
  95. }
  96. }
  97. break;
  98. }
  99. }
  100. </script>
  101. </body>
  102. <hr>
  103. <footer>Created by Will Piper, <a href=https://github.com/ArduPilot/CustomBuild>Source Code<a>.</footer>