Skip to content

Commit

Permalink
Attempted to pass data between js and py
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingMaster121 committed May 14, 2024
1 parent e348d18 commit a145e8a
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 15 deletions.
Empty file added .gitignore
Empty file.
4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 17 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion docs/interactive_map.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Helps to create the boxes that each of the buttoned hyperlinks are in

.search_bar {
display: flex;
padding-top: 10px;
}

.search_bar input {
Expand All @@ -60,6 +59,10 @@ Helps to create the boxes that each of the buttoned hyperlinks are in
font-size: 25px;
}

.map_destination {
padding: 0px;
}

body {
font-family: 'Inter';
}
Expand Down
15 changes: 15 additions & 0 deletions docs/interactive_map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const spawner = require('child_process').spawn;

function runPythonScript() {
var room_value = document.getElementById("room_search").value;
var search_filter = document.getElementById("search_type").value;
var data_to_python = [room_value, search_filter];

if(event.key==='Enter') {
const python_process = spawner('python', ['./python/test.py', JSON.stringify(data_to_python)]);

python_process.stdout.on('data', (data) => {
alert("Data has been received");
});
}
}
10 changes: 10 additions & 0 deletions docs/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PHS Interactive Map - Login</title>
</head>
<body>

</body>
</html>
7 changes: 5 additions & 2 deletions docs/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Inter'>
<link rel="stylesheet" href="interactive_map.css">
<script src="interactive_map.js"></script>
<title>PHS Interactive Map - Map</title>
</head>
<body>
Expand All @@ -24,12 +25,14 @@
</nav>
</div>

<p class="map_destination">Destination:</p>
<div class="search_bar">
<select name="search_type">
<select id="search_type">
<option value="teacher_name">Teacher Name</option>
<option value="room_number">Room Number</option>
<option value="room_name">Room Name</option>
</select>
<input type="text" placeholder="Search">
<input type="text" id="room_search" placeholder="Search" onkeydown="runPythonScript()">
</div>
</body>
</html>
5 changes: 5 additions & 0 deletions docs/python/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys
import json
import ast

print("Hello World!")

0 comments on commit a145e8a

Please sign in to comment.