Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

meshviewer_index.html 7.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright (c) 2012 The Native Client Authors. All rights reserved.
  5. Use of this source code is governed by a BSD-style license that can be
  6. found in the LICENSE file.
  7. -->
  8. <head>
  9. <style type="text/css">
  10. body
  11. {
  12. font:12px Consolas;
  13. }
  14. button
  15. {
  16. font:14px Consolas;
  17. }
  18. textarea
  19. {
  20. font:14px Consolas;
  21. }
  22. #id_div_progress_status
  23. {
  24. font:12px Consolas;
  25. }
  26. #id_div_progress
  27. {
  28. position: absolute;
  29. top: 20%;
  30. left: 30%;
  31. right: 30%;
  32. z-index: 3;
  33. background-color:white;
  34. border:1px solid #000000;
  35. }
  36. progress
  37. {
  38. background-color: #f3f3f3;
  39. border: 0;
  40. height: 18px;
  41. width: 200px;
  42. border-radius: 9px;
  43. }
  44. progress::-webkit-progress-bar
  45. {
  46. background-color: #f3f3f3;
  47. border: 1px solid #000000;
  48. padding: 2px 2px;
  49. height: 20px;
  50. border-radius: 0px;
  51. }
  52. progress::-webkit-progress-value
  53. {
  54. background-color: #22BB22;
  55. border: 0px;
  56. height: 14px;
  57. border-radius: 0px;
  58. }
  59. #id_div_listener
  60. {
  61. position: relative;
  62. }
  63. #id_div_frame_embed
  64. {
  65. position: absolute;
  66. top: 2px;
  67. left: 2px;
  68. z-index: -1;
  69. }
  70. #BGCanvas
  71. {
  72. border:1px solid #000000;
  73. }
  74. #id_div_helper_cmd_0
  75. {
  76. margin-left: 5px;
  77. }
  78. </style>
  79. <title>Mesh Viewer NaCl</title>
  80. </head>
  81. <script type="text/javascript">
  82. //Base data Setup
  83. g_div_frame_embed_save = '';
  84. g_div_frame_embed = null; // Global application object.
  85. g_embed_nacl_module = null; // Global application object.
  86. g_txtarea_code_src = null;
  87. g_div_helper_cmd = [null, null];
  88. g_div_helper_args = null;
  89. g_div_helper_cmnt = null;
  90. g_div_helper_vars = null;
  91. g_div_alphabet = null;
  92. g_div_progress = null;
  93. g_div_progress_status = null;
  94. g_progress_bar = null;
  95. g_var_progress_bar = -1;
  96. g_frame_embed = null;
  97. function GetNaClListenerDiv() { return g_frame_embed.contentDocument.getElementById('id_div_embed_data'); }
  98. function GetNaClModuleVar() { return g_embed_nacl_module; }
  99. function InitNaClModuleVar() { g_embed_nacl_module = g_frame_embed.contentDocument.getElementById('id_embed_nacl_module'); }
  100. function GetTextAreaCodeSrc() { return g_txtarea_code_src; }
  101. function GetDivProgress() { return g_div_progress; }
  102. function GetProgressBar() { return g_progress_bar; }
  103. function GetDivProgressStatus() { return g_div_progress_status; }
  104. function GetDivEmbedData() { return g_div_frame_embed; }
  105. function GetDivEmbedDataSave() { return g_div_frame_embed_save; }
  106. function GetFrameData() { return g_frame_embed; }
  107. function IsUsingNaCl() { return true; }
  108. </script>
  109. <script src="./type_dictionnary.js"></script>
  110. <script type="text/javascript">
  111. var EasyMeshDict = new TypeDictionnary("EasyMesh");
  112. function GetCmdDictionnary() { return EasyMeshDict; }
  113. </script>
  114. <script src="./easy_mesh_dictionnary.js"></script>
  115. <script src="./nacl_loading.js"></script>
  116. <script type="text/javascript">
  117. //Base init for all datas
  118. function Init()
  119. {
  120. alert('INIT PROUT');
  121. //Init frame variable first.
  122. g_frame_embed = document.getElementById('id_frame_embed');
  123. //This is in an iframe.
  124. g_div_frame_embed = g_frame_embed.contentDocument.getElementById('id_div_frame_embed');
  125. //The rest of these are in this page.
  126. g_txtarea_code_src = document.getElementById('id_txtarea_code_src');
  127. g_div_helper_cmd[0] = document.getElementById('id_div_helper_cmd_0');
  128. g_div_helper_cmd[1] = document.getElementById('id_div_helper_cmd_1');
  129. g_div_helper_args = document.getElementById('id_div_helper_args');
  130. g_div_helper_cmnt = document.getElementById('id_div_helper_cmnt');
  131. g_div_helper_vars = document.getElementById('id_div_helper_vars');
  132. g_div_alphabet = document.getElementById('id_div_alphabet');
  133. g_div_progress = document.getElementById('id_div_progress');
  134. g_div_progress_status = document.getElementById('id_div_progress_status');
  135. g_progress_bar = document.getElementById('id_progress_bar');
  136. //Pulg here any cookie update
  137. if (!g_txtarea_code_src.value)
  138. g_txtarea_code_src.value = "//This is a comment\nsc#f8f afcb 1 1 1 0";
  139. //Fill the TOC
  140. if (!g_div_alphabet.innerHTML)
  141. {
  142. g_div_alphabet.innerHTML = '&nbsp;Table of content<br>&nbsp;[';
  143. var new_toc = BuildTOC(true);
  144. var pattern = new RegExp("^[a-zA-Z\.]");
  145. while (pattern.test(new_toc))
  146. new_toc = new_toc.replace(pattern, "<b>$&");
  147. pattern = new RegExp("[a-zA-Z\.]$");
  148. while (pattern.test(new_toc))
  149. new_toc = new_toc.replace(pattern, "$&</b>");
  150. pattern = new RegExp("([a-zA-Z])([\.])");
  151. while (pattern.test(new_toc))
  152. new_toc = new_toc.replace(pattern, "$1</b>$2");
  153. pattern = new RegExp("([\.])([a-zA-Z])");
  154. while (pattern.test(new_toc))
  155. new_toc = new_toc.replace(pattern, "$1<b>$2");
  156. g_div_alphabet.innerHTML += new_toc + ']&nbsp;<br>&nbsp;';
  157. }
  158. //Tick has been done, start Tick
  159. window.setTimeout("Tick()", 200);
  160. }
  161. function Tick()
  162. {
  163. window.setTimeout("Tick()", 100);
  164. var text_src = g_txtarea_code_src;
  165. var div_cmds = g_div_helper_cmd;
  166. var div_args = g_div_helper_args;
  167. var div_cmnt = g_div_helper_cmnt;
  168. var div_vars = g_div_helper_vars;
  169. CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src);
  170. }
  171. </script>
  172. <body>
  173. <h1>Mesh Viewer : Native Client version.</h1>
  174. <p>
  175. <div id="final_div">
  176. <div id="id_div_listener" align="center" style="width:770px;height:200px">
  177. <canvas id="BGCanvas" width="772" height="202"></canvas>
  178. <div id="id_div_progress">
  179. <br>&nbsp;
  180. <progress id="id_progress_bar" align="left"></progress>
  181. <div id="id_div_progress_status">....</div>&nbsp;
  182. </div>
  183. <div id="id_div_frame_embed">
  184. <iframe onload="Init(); PageDidLoad();" id="id_frame_embed" src="meshviewer_nacl.html" width=770 height=200 frameborder=0 scrolling=no></iframe>
  185. </div>
  186. </div>
  187. </div>
  188. </p>
  189. <div><button onclick="SendMessageToModule()">Send Mesh Command !</button></div>
  190. <table border="0" cellpadding="0" cellspacing="0">
  191. <tr>
  192. <td>
  193. <div id="bouton">
  194. <textarea autofocus id="id_txtarea_code_src" rows="6" cols="94" style="font: 14px Consolas; resize: none;"></textarea>
  195. </div>
  196. </td>
  197. <td valign="top" rowspan="3">&nbsp;</td>
  198. <td valign="top" rowspan="3">
  199. <div><b><u>Variable Types usage :</u></b></div>
  200. <div id="id_div_helper_vars"></div>
  201. </td>
  202. </tr>
  203. <tr>
  204. <td>
  205. <div id="id_div_alphabet"></div>
  206. </td>
  207. </tr>
  208. <tr>
  209. <td valign="top">
  210. <table border="0" cellpadding="0" cellspacing="0">
  211. <tr>
  212. <td valign="top"><div id="id_div_helper_cmd_0"></div></td>
  213. <td valign="top"><div id="id_div_helper_cmd_1"></div></td>
  214. <td valign="top"><div id="id_div_helper_args" ></div></td>
  215. <td valign="top"><div id="id_div_helper_cmnt" ></div></td>
  216. </tr>
  217. </table>
  218. </td>
  219. </tr>
  220. </table>
  221. </body>
  222. </html>