First commit
Browse files- app.py +1 -1
- static/script.js +1 -0
- templates/client.html +1 -1
- templates/index.html +16 -0
app.py
CHANGED
|
@@ -19,7 +19,7 @@ participants = {}
|
|
| 19 |
|
| 20 |
@app.route('/')
|
| 21 |
def index():
|
| 22 |
-
return
|
| 23 |
|
| 24 |
@app.route('/client')
|
| 25 |
def client():
|
|
|
|
| 19 |
|
| 20 |
@app.route('/')
|
| 21 |
def index():
|
| 22 |
+
return render_template('index.html')
|
| 23 |
|
| 24 |
@app.route('/client')
|
| 25 |
def client():
|
static/script.js
CHANGED
|
@@ -9,6 +9,7 @@ function joinQuiz() {
|
|
| 9 |
document.getElementById('logged-user').textContent = username;
|
| 10 |
document.getElementById('quiz-content').style.display = 'block';
|
| 11 |
document.getElementById('waiting-message').style.display = 'block';
|
|
|
|
| 12 |
}
|
| 13 |
|
| 14 |
socket.on('update_participants', (data) => {
|
|
|
|
| 9 |
document.getElementById('logged-user').textContent = username;
|
| 10 |
document.getElementById('quiz-content').style.display = 'block';
|
| 11 |
document.getElementById('waiting-message').style.display = 'block';
|
| 12 |
+
document.getElementById('join-title').style.display = 'none';
|
| 13 |
}
|
| 14 |
|
| 15 |
socket.on('update_participants', (data) => {
|
templates/client.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div class="container">
|
| 11 |
-
<h2>Join the Quiz</h2>
|
| 12 |
<input type="text" id="username" placeholder="Enter your name" class="form-control">
|
| 13 |
<button onclick="joinQuiz()" class="btn btn-primary mt-2">Join</button>
|
| 14 |
<div id="quiz-content" style="display: none;">
|
|
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div class="container">
|
| 11 |
+
<h2 id="join-title">Join the Quiz</h2>
|
| 12 |
<input type="text" id="username" placeholder="Enter your name" class="form-control">
|
| 13 |
<button onclick="joinQuiz()" class="btn btn-primary mt-2">Join</button>
|
| 14 |
<div id="quiz-content" style="display: none;">
|
templates/index.html
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Quiz Application</title>
|
| 7 |
+
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div class="container text-center">
|
| 11 |
+
<h1 class="mt-5">Real-Time Quiz Application</h1>
|
| 12 |
+
<button onclick="window.location.href='/client'" class="btn btn-primary mt-3">Join as Client</button>
|
| 13 |
+
<button onclick="window.location.href='/host'" class="btn btn-success mt-3">Join as Host</button>
|
| 14 |
+
</div>
|
| 15 |
+
</body>
|
| 16 |
+
</html>
|