index.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. <form action="/generate" method="post">
  18. <label for="vehicle">Choose a vehicle:</label>
  19. <select name="vehicle">
  20. {% for vehicle in get_vehicles()[0] %}
  21. {% if vehicle == get_vehicles()[1] %}
  22. <option value="{{vehicle}}" selected>{{vehicle}}</option>
  23. {% else %}
  24. <option value="{{vehicle}}">{{vehicle}}</option>
  25. {% endif %}
  26. {% endfor %}
  27. </select>
  28. <p/>
  29. <label for="board">Choose a board:</label>
  30. <select name="board">
  31. {% for board in get_boards()[0] %}
  32. {% if board == get_boards()[1] %}
  33. <option value="{{board}}" selected>{{board}}</option>
  34. {% else %}
  35. <option value="{{board}}">{{board}}</option>
  36. {% endif %}
  37. {% endfor %}
  38. </select>
  39. <p/>
  40. <label for="board">Select Features:</label>
  41. <ul class="collapsibleList">
  42. {% for c in get_build_categories() %}
  43. <li>{{c}}
  44. <ul>
  45. {% for f in get_build_options(c) %}
  46. <li>
  47. {% if f.default == 1 %}
  48. <input onclick='handleClick(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox" name="{{f.label}}" id="{{f.label}}" value="1" checked>
  49. {% else %}
  50. <input onclick='handleClick(this, "{{f.label}}", "{{f.dependency}}");' type="checkbox" name="{{f.label}}" id="{{f.label}}" value="1">
  51. {% endif %}
  52. {{f.description}}
  53. </li>
  54. {% endfor %}
  55. </ul>
  56. </li>
  57. {% endfor %}
  58. </ul>
  59. <br>
  60. <input type="submit" value="Generate">
  61. </form>
  62. </div>
  63. <hr>
  64. <div id="build_status"></div>
  65. <br />
  66. <script>
  67. CollapsibleLists.apply();
  68. function reload() {
  69. var output = document.getElementById('build_status');
  70. var xhr = new XMLHttpRequest();
  71. xhr.open('GET', "/builds/status.html");
  72. // disable cache, thanks to: https://stackoverflow.com/questions/22356025/force-cache-control-no-cache-in-chrome-via-xmlhttprequest-on-f5-reload
  73. xhr.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0");
  74. xhr.setRequestHeader("Expires", "Tue, 01 Jan 1980 1:00:00 GMT");
  75. xhr.setRequestHeader("Pragma", "no-cache");
  76. xhr.onload = function() {
  77. if (xhr.status == 200) {
  78. output.innerHTML = xhr.responseText;
  79. }
  80. setTimeout(reload,5000)
  81. }
  82. xhr.send();
  83. }
  84. function handleClick(cb, f_label, f_dependency) {
  85. switch (cb.name) {
  86. case f_label:
  87. if (document.getElementById(f_dependency).checked == false){
  88. document.getElementById(f_dependency).checked = cb.checked;
  89. }
  90. break;
  91. }
  92. }
  93. </script>
  94. </body>
  95. <hr>
  96. <footer>Created by Will Piper, <a href=https://github.com/ArduPilot/CustomBuild>Source Code<a>.</footer>