engine_test.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Blockpy/Kennel/Silicon</title>
  6. <link rel="stylesheet" href="libs/bootstrap.min.css">
  7. <link rel="stylesheet" href="libs/codemirror/codemirror.css">
  8. <link rel="stylesheet" href="libs/font-awesome.min.css">
  9. <link rel="stylesheet" href="libs/summernote/summernote.css">
  10. <link rel="stylesheet" href="libs/multi-select.css">
  11. <link rel="stylesheet" href="src/blockpy.css">
  12. <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">-->
  13. <!-- JQuery, D3, Math.js, Bootstrap -->
  14. <script type="text/javascript" src="libs/jquery.js"></script>
  15. <script type="text/javascript" src="libs/jquery-ui.min.js"></script>
  16. <script type="text/javascript" src="libs/jquery.hotkeys.js"></script>
  17. <script type="text/javascript" src="libs/jquery.multi-select.js"></script>
  18. <script type="text/javascript" src="libs/d3.min.js"></script>
  19. <script type="text/javascript" src="libs/math.0.19.0.min.js"></script>
  20. <script type="text/javascript" src="libs/bootstrap.min.js"></script>
  21. <script type="text/javascript" src="libs/bootstrap-wysiwyg.js"></script>
  22. <script type="text/javascript" src="libs/mindmup-editabletable.js"></script>
  23. <script type="text/javascript" src="libs/codemirror/codemirror.js"></script>
  24. <script type="text/javascript" src="libs/codemirror/python.js"></script>
  25. <script type="text/javascript" src="libs/codemirror/htmlmixed.js"></script>
  26. <script type="text/javascript" src="libs/codemirror/xml.js"></script>
  27. <script type="text/javascript" src="libs/knockout-3.4.0.js"></script>
  28. <script type="text/javascript" src="libs/stringify.js"></script>
  29. <!-- Summernote, a rich text editor -->
  30. <script type="text/javascript" src="libs/summernote/summernote.min.js"></script>
  31. <script type="text/javascript" src="libs/summernote/summernote-ext-hint.js"></script>
  32. <script type="text/javascript" src="libs/summernote/summernote-ext-video.js"></script>
  33. <!-- Skulpt -->
  34. <script type="text/javascript" src="skulpt/dist/skulpt.min.js"></script>
  35. <script type="text/javascript" src="skulpt/dist/skulpt-stdlib.js"></script>
  36. <!-- Source Code -->
  37. <script type="text/javascript" src="src/utilities.js"></script>
  38. <script type="text/javascript" src="src/python_errors.js"></script>
  39. <script type="text/javascript" src="src/ast_node_visitor.js"></script>
  40. <script type="text/javascript" src="src/abstract_interpreter.js"></script>
  41. <script type="text/javascript" src="src/pytifa.js"></script>
  42. <script type="text/javascript" src="src/abstract_interpreter_definitions.js"></script>
  43. <script type="text/javascript" src="src/abstract_interpreter_tests.js"></script>
  44. <script type="text/javascript" src="src/dialog.js"></script>
  45. <script type="text/javascript" src="src/storage.js"></script>
  46. <script type="text/javascript" src="src/printer.js"></script>
  47. <script type="text/javascript" src="src/server.js"></script>
  48. <script type="text/javascript" src="src/corgis.js"></script>
  49. <script type="text/javascript" src="src/feedback.js"></script>
  50. <script type="text/javascript" src="src/sk_mod_instructor_extended.js"></script>
  51. <script type="text/javascript" src="src/sk_mod_instructor.js"></script>
  52. <script type="text/javascript" src="src/engine.js"></script>
  53. <!-- CORGIS -->
  54. <!--<script type="text/javascript" src="test_corgis/blockpy/school_scores/school_scores_dataset.js"></script>
  55. <script type="text/javascript" src="test_corgis/blockpy/school_scores/school_scores_blockly.js"></script>
  56. <script type="text/javascript" src="test_corgis/blockpy/school_scores/school_scores_skulpt.js"></script>-->
  57. <!--<script type="text/javascript" src="test_corgis/blockpy/tate/tate_blockly.js"></script>
  58. <script type="text/javascript" src="test_corgis/blockpy/tate/tate_skulpt.js"></script>
  59. <script type="text/javascript" src="test_corgis/blockpy/tate/tate_dataset.js"></script>-->
  60. <style>
  61. </style>
  62. <script>
  63. $(document).ready(function() {
  64. var trace = function() {
  65. };
  66. trace.removeAll = x => x;
  67. mockFeedback = {
  68. 'isFeedbackVisible': x => true,
  69. 'clear': x => x,
  70. //'presentFeedback': x => blockpy.BlockPyFeedback.prototype.presentFeedback.bind(mockFeedback)(x),
  71. 'presentFeedback': x => x, //console.log(Sk.executionReports.instructor.complaint),
  72. 'presentAnalyzerFeedback': x => BlockPyFeedback.prototype.presentAnalyzerFeedback.bind(mockFeedback)(x),
  73. 'instructorFeedback': (name, message, line) => name, //console.log(name, message, line),
  74. }
  75. main = {
  76. 'components': {
  77. 'printer': {
  78. 'print': e => this.printed.push(e.slice(0, -1)), //console.log("PRINTED", e),
  79. 'printHtml': e => this.printed.push(e),
  80. 'resetPrinter': e => this.printed = [], //console.log("PRINTER RESET"),
  81. 'getConfiguration': BlockPyPrinter.getDisabledConfiguration,
  82. },
  83. 'editor': {
  84. 'triggerOnChange': 0
  85. },
  86. 'server': {
  87. 'logEvent': x => x,
  88. 'markSuccess': x => x,
  89. },
  90. 'feedback': mockFeedback,
  91. 'toolbar': {
  92. }
  93. },
  94. 'model': {
  95. 'execution': {
  96. 'reports': {},
  97. 'suppressions': {},
  98. 'status': v => this['status'] = v,
  99. 'trace': trace,
  100. 'step': x => x,
  101. 'last_step': x => x,
  102. 'line_number': x => x,
  103. 'show_trace': x => x,
  104. 'output': v => this.printed
  105. },
  106. 'programs': {
  107. '__main__': v => 'a = "Words"\nprint(a)',
  108. 'give_feedback': v => 'from instructor import *\ngently("You have failed.")\ngently("Not bad!")',
  109. },
  110. 'settings': {
  111. 'disable_timeout': x => false,
  112. 'mute_printer': x => this['mute_printer'] = x,
  113. }
  114. }
  115. };
  116. main.components.feedback.main = main;
  117. engine = new BlockPyEngine(main);
  118. Sk.afterSingleExecution = engine.step.bind(engine);
  119. function inIframe () {
  120. try {
  121. return window.self !== window.top;
  122. } catch (e) {
  123. return true;
  124. }
  125. }
  126. if (inIframe()) {
  127. $("#blockpy-container").width("100%");
  128. }
  129. });
  130. </script>
  131. </head>
  132. <body>
  133. <div style="width:900px; margin:0 auto;" id='blockpy-container'> <!-- 900px -->
  134. <div id="blockpy-div" style='height:100%'></div>
  135. </div>
  136. <div id="blockpy-div2" style='height:100%'></div>
  137. <script>
  138. function getQueryParams(){
  139. try{
  140. url = window.location.href;
  141. query_str = url.substr(url.indexOf('?')+1, url.length-1);
  142. r_params = query_str.split('&');
  143. params = {}
  144. for( i in r_params){
  145. param = r_params[i].split('=');
  146. params[ param[0] ] = param[1];
  147. }
  148. return params;
  149. }
  150. catch(e){
  151. return {};
  152. }
  153. }
  154. </script>
  155. <!-- Google Analytics -->
  156. <script>
  157. switch(window.location.protocol) {
  158. case 'file:':
  159. break;
  160. default:
  161. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  162. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  163. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  164. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  165. ga('create', 'UA-38802329-2', 'auto');
  166. ga('send', 'pageview');
  167. }
  168. </script>
  169. </body>
  170. </html>