-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
300 lines (277 loc) · 16.9 KB
/
index.html
File metadata and controls
300 lines (277 loc) · 16.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QuickPoll - Real-time Voting</title>
<link rel="stylesheet" href="/styles.css?v=2.7">
<link rel="stylesheet" href="/email-auth-styles.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
</head>
<body>
<div id="app">
<!-- Header -->
<header class="header">
<div class="container">
<h1 class="logo">QuickPoll</h1>
<nav class="nav">
<button id="sign-in-btn" class="btn btn-primary">Sign In</button>
<div id="user-info" class="user-info" style="display: none;">
<span class="user-icon">✉️</span>
<span id="user-email"></span>
<button id="sign-out-btn" class="btn btn-small btn-secondary">Sign Out</button>
</div>
</nav>
</div>
</header>
<!-- Email Authentication Modal -->
<div id="email-auth-modal" class="modal-overlay" style="display: none;">
<div class="modal-content">
<div class="modal-header">
<h3>📧 Email Authentication Required</h3>
<button id="close-modal" class="close-btn">×</button>
</div>
<div class="modal-body">
<p>This poll requires email verification to ensure one vote per person.</p>
<form id="email-auth-form" novalidate>
<div class="form-group">
<label for="voter-email">Your Email Address:</label>
<input type="email" id="voter-email" name="email"
placeholder="Enter your email address"
novalidate>
</div>
<div class="form-group">
<label for="voter-name">Your Name (Optional):</label>
<input type="text" id="voter-name" name="name"
placeholder="Enter your name">
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Sign In</button>
<button type="button" id="cancel-auth" class="btn btn-secondary">Cancel</button>
</div>
</form>
</div>
</div>
</div>
<!-- Main Content -->
<main class="main">
<!-- Landing Page -->
<div id="landing-page" class="page active">
<div class="container">
<div class="hero">
<h2>Create Real-time Voting Contests</h2>
<p>Enable your audience to participate in ranking, rating, and poll voting contests from any device.</p>
<!-- Active Poll Notice for Landing Page -->
<div id="active-poll-voting-notice" class="active-poll-notice" style="display: none;">
<h4>📊 Active Poll Available</h4>
<p id="active-poll-title"></p>
<p>There's an active poll you can participate in!</p>
<div class="active-poll-actions">
<button id="vote-in-active-poll-btn" class="btn btn-large btn-primary">Vote Now</button>
<button id="view-active-poll-results-btn" class="btn btn-large btn-secondary">View Results</button>
</div>
</div>
<div class="hero-buttons">
<button id="create-ranking-btn" class="btn btn-large btn-primary">Create Ranking Poll</button>
<button id="create-rating-btn" class="btn btn-large btn-primary">Create Rating Poll</button>
<button id="create-poll-btn-hero" class="btn btn-large btn-primary">Create Simple Poll</button>
</div>
</div>
</div>
</div>
<!-- Create Poll Page -->
<div id="create-page" class="page">
<div class="container">
<h2>Create Your Poll</h2>
<form id="poll-form" class="poll-form">
<div class="form-group">
<label for="poll-title">Poll Title</label>
<input type="text" id="poll-title" name="title" required placeholder="Enter poll title">
</div>
<div class="form-group">
<label for="poll-description">Description (Optional)</label>
<textarea id="poll-description" name="description" placeholder="Enter poll description"></textarea>
</div>
<div class="form-group">
<label for="poll-type">Poll Type</label>
<select id="poll-type" name="type" required>
<option value="simple">Simple Poll (Yes/No or Multiple Choice)</option>
<option value="rating">Rating Poll (1-5 stars)</option>
<option value="ranking">Ranking Poll (Drag to rank)</option>
</select>
</div>
<!-- Authentication Settings -->
<div class="form-group">
<label for="require-auth">Authentication Settings</label>
<div class="auth-options">
<label class="radio-option">
<input type="radio" name="auth-mode" value="anonymous">
<span>Anonymous Voting (One vote per device/session)</span>
</label>
<label class="radio-option">
<input type="radio" name="auth-mode" value="email" checked>
<span>📧 Email Authentication (One vote per email address)</span>
</label>
</div>
<div id="auth-requirement-note" class="help-text" style="display: none; margin-top: 10px;">
<div id="auth-signed-in-note" style="display: none;">
<strong>✅ Ready!</strong> You are signed in and can create an authenticated poll. Only you will be able to view the results.
</div>
<div id="auth-not-signed-in-note" style="display: none;">
<strong>⚠️ Sign In Required:</strong> You must be signed in to create an authenticated poll.
<button type="button" id="sign-in-now-btn" class="btn btn-small btn-primary" style="margin-left: 10px;">Sign In Now</button>
</div>
</div>
</div>
<!-- Valid Email Addresses (for authenticated polls) -->
<div id="valid-emails-container" class="form-group" style="display: none;">
<label for="valid-emails">Valid Email Addresses (Optional)</label>
<textarea id="valid-emails" name="validEmails" rows="4"
placeholder="Enter email addresses (one per line) user1@example.com user2@example.com Leave empty to allow any email address"></textarea>
<small class="help-text">If specified, only these email addresses will be allowed to vote. Leave empty to allow any email.</small>
</div>
<div id="options-container" class="form-group">
<label>Options</label>
<!-- Template Options -->
<div class="template-options">
<label class="template-label">Quick Templates:</label>
<div class="template-buttons">
<label class="radio-option template-option">
<input type="radio" name="template" value="custom" checked>
<span>Custom Options</span>
</label>
<label class="radio-option template-option">
<input type="radio" name="template" value="yes-no">
<span>Yes / No</span>
</label>
<label class="radio-option template-option">
<input type="radio" name="template" value="approve-disapprove">
<span>Approve / Disapprove / Abstain</span>
</label>
<label class="radio-option template-option">
<input type="radio" name="template" value="agree-disagree">
<span>Agree / Disagree / Neutral</span>
</label>
<label class="radio-option template-option">
<input type="radio" name="template" value="satisfaction">
<span>Very Satisfied / Satisfied / Neutral / Dissatisfied / Very Dissatisfied</span>
</label>
</div>
</div>
<div id="options-list">
<div class="option-input">
<input type="text" name="option" placeholder="Option 1" required>
<button type="button" class="btn btn-small btn-danger remove-option">Remove</button>
</div>
<div class="option-input">
<input type="text" name="option" placeholder="Option 2" required>
<button type="button" class="btn btn-small btn-danger remove-option">Remove</button>
</div>
</div>
<button type="button" id="add-option-btn" class="btn btn-small btn-secondary">Add Option</button>
</div>
<div class="form-actions">
<button type="button" id="back-to-home" class="btn btn-secondary">Back</button>
<button type="submit" class="btn btn-primary">Create Poll</button>
</div>
</form>
</div>
</div>
<!-- Vote Page -->
<div id="vote-page" class="page">
<div class="container">
<div id="vote-content">
<!-- Dynamic content will be inserted here -->
</div>
</div>
</div>
<!-- Results Page -->
<div id="results-page" class="page">
<div class="container">
<div id="results-content">
<!-- Dynamic content will be inserted here -->
</div>
</div>
</div>
<!-- Poll Created Page -->
<div id="poll-created-page" class="page">
<div class="container">
<div class="success-message">
<h2>Poll Created Successfully!</h2>
<!-- Poll Status Info -->
<div id="poll-status-info" class="poll-status-info" style="display: none;">
<div class="status-box">
<h4 id="poll-status-title">📊 Poll Status</h4>
<div id="poll-status-content">
<p><strong>Status:</strong> <span id="poll-status-indicator"></span></p>
<p><strong>Title:</strong> <span id="poll-title-display"></span></p>
<p><strong>Created:</strong> <span id="poll-created-display"></span></p>
</div>
</div>
</div>
<!-- GitHub Gist Info -->
<div id="gist-info" class="gist-info" style="display: none;">
<h4>🔗 Stored on GitHub</h4>
<p>This poll is stored as a private GitHub Gist: <a id="gist-link" href="#" target="_blank" class="gist-link">View Gist</a></p>
</div>
<p>Share these links with your audience:</p>
<!-- QR Code Section -->
<div class="qr-code-section">
<h4>📱 Quick Access QR Code</h4>
<div class="qr-code-container">
<img id="voting-qr-code" src="" alt="QR Code for Voting Link" style="display: none;">
<div id="qr-loading" class="qr-loading">Generating QR code...</div>
</div>
<p class="qr-description">Scan with your phone to vote instantly</p>
</div>
<div class="link-container">
<div class="link-group">
<label>Voting Link:</label>
<div class="link-display">
<input type="text" id="voting-link" readonly>
<button id="copy-voting-link" class="btn btn-small btn-secondary">Copy</button>
</div>
</div>
<div class="link-group">
<label>Results Link:</label>
<div class="link-display">
<input type="text" id="results-link" readonly>
<button id="copy-results-link" class="btn btn-small btn-secondary">Copy</button>
</div>
</div>
</div>
<div id="auth-info" class="auth-info" style="display: none;">
<div class="info-box">
<h4>📧 Email Authentication Enabled</h4>
<p>Voters will need to provide their email address to participate. This ensures:</p>
<ul>
<li>One vote per email address</li>
<li>Verified voter participation</li>
<li>Prevention of duplicate voting</li>
<li id="email-restriction-info" style="display: none;">Only specified email addresses can vote</li>
</ul>
</div>
</div>
<div class="form-actions">
<button id="view-results-now" class="btn btn-primary">View Results</button>
<button id="close-poll" class="btn btn-danger">Close Poll</button>
<button id="create-new-poll-btn" class="btn btn-success" style="display: none;">Create New Poll</button>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="footer">
<div class="container">
<p>© 2025 QuickPoll. Real-time voting made simple and secure.</p>
<p><small>All poll data is securely stored with real-time vote sharing.</small></p>
</div>
</footer>
</div>
<!-- Scripts -->
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>
<script src="/email-auth-script.js?v=2.9"></script>
<script src="/server-client-script.js?v=2.9"></script>
</body>
</html>