Eran Goldman-Malka 5 rokov pred
rodič
commit
cc16730038

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 7 - 0
server/css/bootstrap.min.css


+ 79 - 0
server/index.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+  <title>Editor</title>
+  <style link rel="stylesheet" href="css/bootstrap.min.css">
+  <style type="text/css" media="screen">
+    body {
+        overflow: hidden;
+    }
+
+    #editor {
+	height: 300px;
+	width: 45%;
+    }
+  </style>
+</head>
+<body>
+<div class="container-fluid">
+  <div class="row">
+        <div class="col-xs-6 col-md-6">
+<!--            <div class="panel panel-default">
+              <div class="panel-heading">
+                <h3 class="panel-title">Editor</h3>
+              </div>
+              <div class="panel-body"> -->
+                <div id="editor"></div>
+<!--              </div>
+            </div>
+            <div class="text-center">---End of editor---</div> -->
+	</div>
+	<div class="col-xs-6 col-md-6">
+  	  <p> snippets </p>
+	</div>
+    </div>
+  <div class="row">
+    <div class="col-md-4">
+      <button id="run" type="button" class="btn btn-success btn-lg">Run</button>	
+    </div>
+    <div class="col-md-4">
+    </div>
+    <div class="col-md-4">
+    </div>
+  </div>
+</div>
+<script src="js/jquery-3.3.1.min.js"></script>
+<script src="js/bootstrap.bundle.min.js"></script>
+<script src="js/ace.js" type="text/javascript" charset="utf-8"></script>
+<script src="js/ext-language_tools.js"></script>
+<script>
+    // trigger extension
+    ace.require("ace/ext/language_tools");
+    var editor = ace.edit("editor");
+    editor.session.setMode("ace/mode/python");
+    editor.setTheme("ace/theme/dracula");
+    // enable autocompletion and snippets
+    editor.setOptions({
+        enableBasicAutocompletion: true,
+        enableSnippets: true,
+        enableLiveAutocompletion: false
+    });
+  var ws = new WebSocket('ws://localhost:8080/');
+//  ws.onopen = function() {
+//      };
+//      ws.onclose = function() {
+//        document.body.style.backgroundColor = null;
+//      };
+//      ws.onmessage = function(event) {
+//        document.getElementById('count').textContent = event.data;
+//      };
+
+$("#run").click(function(){
+ws.send(editor.session.getValue())
+ws.send('go')
+})
+    </script>
+</body>
+</html>

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 21315 - 0
server/js/ace.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 7 - 0
server/js/bootstrap.bundle.min.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 8 - 0
server/js/ext-language_tools.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2 - 0
server/js/jquery-3.3.1.min.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 8 - 0
server/js/mode-python.js


+ 16 - 0
server/js/show_own_source.js

@@ -0,0 +1,16 @@
+if (typeof ace == "undefined" && typeof require == "undefined") {
+    document.body.innerHTML = "<p style='padding: 20px 50px;'>couldn't find ace.js file, <br>"
+        + "to build it run <code>node Makefile.dryice.js full<code>"
+} else if (typeof ace == "undefined" && typeof require != "undefined") {
+    require(["ace/ace"], setValue)
+} else {
+    require = ace.require;
+    setValue()
+}
+
+function setValue() {
+    require("ace/lib/net").get(document.baseURI, function(t){
+        var el = document.getElementById("editor");
+        el.env.editor.setValue(t, 1);
+    })
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 8 - 0
server/js/snippets/python.js


+ 8 - 0
server/js/snippets/text.js

@@ -0,0 +1,8 @@
+ace.define("ace/snippets/text",["require","exports","module"],function(e,t,n){"use strict";t.snippetText=undefined,t.scope="text"});                (function() {
+                    ace.require(["ace/snippets/text"], function(m) {
+                        if (typeof module == "object" && typeof exports == "object" && module) {
+                            module.exports = m;
+                        }
+                    });
+                })();
+            

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 8 - 0
server/js/theme-dracula.js


+ 49 - 0
server/socketScript.py

@@ -0,0 +1,49 @@
+#!/usr/bin/python
+from sys import stdout, stdin, exit
+import sys
+import traceback
+
+import os
+
+lockFile = "/var/lock/socketLock"
+c = ""
+
+#  exists = os.path.isfile(lockFile)
+#  if exists:
+#      stdout.write("socket is already connected.")
+#      stdout.flush()
+#      exit()
+#  else:
+#      with open(lockFile, 'a'):
+#          os.utime(lockFile, None)
+#      # Store configuration file values
+
+while True:
+    s = stdin.readline().replace('\n','')  #  raw_input()
+    if s == 'exit':
+#        os.remove(lockFile)
+        exit()
+    if s == 'go':
+        description='source string'
+        try:
+            exec(c)
+            stdout.flush()
+            c = ""
+        except SyntaxError as err:
+            error_class = err.__class__.__name__
+            detail = err.args[0]
+            line_number = err.lineno
+            stdout.write(("%s at line %d of %s: %s\n\n" % (error_class, line_number, description, detail)))
+            stdout.flush()
+            c = ""
+        except Exception as err:
+            error_class = err.__class__.__name__
+            detail = err.args[0]
+            cl, exc, tb = sys.exc_info()
+            line_number = traceback.extract_tb(tb)[-1][1]
+            stdout.write(("%s at line %d of %s: %s\n\n" % (error_class, line_number, description, detail)))
+            stdout.flush()
+            c = ""
+    else:
+        s.replace('print','stdout.write')
+        c += s + '\n'

BIN
server/websocketd