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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fa" dir="rtl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>چت روم مینیمال</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--primary-color: #6366f1;
|
| 12 |
+
--secondary-color: #8b5cf6;
|
| 13 |
+
--background-color: #0f172a;
|
| 14 |
+
--surface-color: rgba(255, 255, 255, 0.1);
|
| 15 |
+
--glass-bg: rgba(255, 255, 255, 0.05);
|
| 16 |
+
--glass-border: rgba(255, 255, 255, 0.1);
|
| 17 |
+
--text-primary: #f1f5f9;
|
| 18 |
+
--text-secondary: #94a3b8;
|
| 19 |
+
--accent-color: #f59e0b;
|
| 20 |
+
--success-color: #10b981;
|
| 21 |
+
--danger-color: #ef4444;
|
| 22 |
+
--warning-color: #f59e0b;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
* {
|
| 26 |
+
margin: 0;
|
| 27 |
+
padding: 0;
|
| 28 |
+
box-sizing: border-box;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
body {
|
| 32 |
+
font-family: 'Vazirmatn', sans-serif;
|
| 33 |
+
background: linear-gradient(135deg, var(--background-color) 0%, #1e293b 100%);
|
| 34 |
+
color: var(--text-primary);
|
| 35 |
+
min-height: 100vh;
|
| 36 |
+
overflow-x: hidden;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.container {
|
| 40 |
+
max-width: 1200px;
|
| 41 |
+
margin: 0 auto;
|
| 42 |
+
padding: 20px;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/* Header */
|
| 46 |
+
.header {
|
| 47 |
+
text-align: center;
|
| 48 |
+
padding: 20px 0;
|
| 49 |
+
position: relative;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.header h1 {
|
| 53 |
+
font-size: 2.5rem;
|
| 54 |
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
| 55 |
+
-webkit-background-clip: text;
|
| 56 |
+
-webkit-text-fill-color: transparent;
|
| 57 |
+
margin-bottom: 10px;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.built-with {
|
| 61 |
+
position: absolute;
|
| 62 |
+
top: 20px;
|
| 63 |
+
left: 20px;
|
| 64 |
+
font-size: 0.9rem;
|
| 65 |
+
color: var(--text-secondary);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.built-with a {
|
| 69 |
+
color: var(--primary-color);
|
| 70 |
+
text-decoration: none;
|
| 71 |
+
transition: color 0.3s;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.built-with a:hover {
|
| 75 |
+
color: var(--secondary-color);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/* Auth Section */
|
| 79 |
+
.auth-section {
|
| 80 |
+
display: flex;
|
| 81 |
+
justify-content: center;
|
| 82 |
+
align-items: center;
|
| 83 |
+
min-height: 80vh;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.auth-card {
|
| 87 |
+
background: var(--glass-bg);
|
| 88 |
+
backdrop-filter: blur(10px);
|
| 89 |
+
border: 1px solid var(--glass-border);
|
| 90 |
+
border-radius: 20px;
|
| 91 |
+
padding: 40px;
|
| 92 |
+
width: 100%;
|
| 93 |
+
max-width: 400px;
|
| 94 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
| 95 |
+
animation: slideIn 0.5s ease-out;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
@keyframes slideIn {
|
| 99 |
+
from {
|
| 100 |
+
opacity: 0;
|
| 101 |
+
transform: translateY(30px);
|
| 102 |
+
}
|
| 103 |
+
to {
|
| 104 |
+
opacity: 1;
|
| 105 |
+
transform: translateY(0);
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.auth-card h2 {
|
| 110 |
+
text-align: center;
|
| 111 |
+
margin-bottom: 30px;
|
| 112 |
+
font-size: 1.8rem;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.form-group {
|
| 116 |
+
margin-bottom: 20px;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.form-group label {
|
| 120 |
+
display: block;
|
| 121 |
+
margin-bottom: 8px;
|
| 122 |
+
color: var(--text-secondary);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.form-group input {
|
| 126 |
+
width: 100%;
|
| 127 |
+
padding: 12px 20px;
|
| 128 |
+
background: rgba(255, 255, 255, 0.05);
|
| 129 |
+
border: 1px solid var(--glass-border);
|
| 130 |
+
border-radius: 10px;
|
| 131 |
+
color: var(--text-primary);
|
| 132 |
+
font-size: 1rem;
|
| 133 |
+
transition: all 0.3s;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.form-group input:focus {
|
| 137 |
+
outline: none;
|
| 138 |
+
border-color: var(--primary-color);
|
| 139 |
+
background: rgba(255, 255, 255, 0.08);
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
.btn {
|
| 143 |
+
width: 100%;
|
| 144 |
+
padding: 12px 20px;
|
| 145 |
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
| 146 |
+
border: none;
|
| 147 |
+
border-radius: 10px;
|
| 148 |
+
color: white;
|
| 149 |
+
font-size: 1rem;
|
| 150 |
+
font-weight: 600;
|
| 151 |
+
cursor: pointer;
|
| 152 |
+
transition: all 0.3s;
|
| 153 |
+
margin-top: 10px;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
.btn:hover {
|
| 157 |
+
transform: translateY(-2px);
|
| 158 |
+
box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/* Main Chat Interface */
|
| 162 |
+
.chat-interface {
|
| 163 |
+
display: none;
|
| 164 |
+
min-height: 100vh;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
.chat-container {
|
| 168 |
+
display: grid;
|
| 169 |
+
grid-template-columns: 280px 1fr;
|
| 170 |
+
gap: 20px;
|
| 171 |
+
height: calc(100vh - 120px);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
/* Sidebar */
|
| 175 |
+
.sidebar {
|
| 176 |
+
background: var(--glass-bg);
|
| 177 |
+
backdrop-filter: blur(10px);
|
| 178 |
+
border: 1px solid var(--glass-border);
|
| 179 |
+
border-radius: 20px;
|
| 180 |
+
padding: 20px;
|
| 181 |
+
display: flex;
|
| 182 |
+
flex-direction: column;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
.sidebar-header {
|
| 186 |
+
display: flex;
|
| 187 |
+
justify-content: space-between;
|
| 188 |
+
align-items: center;
|
| 189 |
+
margin-bottom: 20px;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.sidebar-header h3 {
|
| 193 |
+
font-size: 1.2rem;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.add-room-btn {
|
| 197 |
+
background: var(--primary-color);
|
| 198 |
+
border: none;
|
| 199 |
+
border-radius: 50%;
|
| 200 |
+
width: 40px;
|
| 201 |
+
height: 40px;
|
| 202 |
+
display: flex;
|
| 203 |
+
align-items: center;
|
| 204 |
+
justify-content: center;
|
| 205 |
+
color: white;
|
| 206 |
+
cursor: pointer;
|
| 207 |
+
transition: all 0.3s;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
.add-room-btn:hover {
|
| 211 |
+
background: var(--secondary-color);
|
| 212 |
+
transform: rotate(90deg);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
.rooms-list {
|
| 216 |
+
flex: 1;
|
| 217 |
+
overflow-y: auto;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.room-item {
|
| 221 |
+
background: rgba(255, 255, 255, 0.05);
|
| 222 |
+
border-radius: 12px;
|
| 223 |
+
padding: 15px;
|
| 224 |
+
margin-bottom: 10px;
|
| 225 |
+
cursor: pointer;
|
| 226 |
+
transition: all 0.3s;
|
| 227 |
+
display: flex;
|
| 228 |
+
justify-content: space-between;
|
| 229 |
+
align-items: center;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
.room-item:hover {
|
| 233 |
+
background: rgba(255, 255, 255, 0.1);
|
| 234 |
+
transform: translateX(5px);
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
.room-item.active {
|
| 238 |
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.room-info {
|
| 242 |
+
flex: 1;
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
.room-name {
|
| 246 |
+
font-weight: 600;
|
| 247 |
+
margin-bottom: 5px;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
.room-members {
|
| 251 |
+
font-size: 0.85rem;
|
| 252 |
+
color: var(--text-secondary);
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
.room-actions {
|
| 256 |
+
display: flex;
|
| 257 |
+
gap: 10px;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
.room-actions button {
|
| 261 |
+
background: transparent;
|
| 262 |
+
border: none;
|
| 263 |
+
color: var(--text-secondary);
|
| 264 |
+
cursor: pointer;
|
| 265 |
+
padding: 5px;
|
| 266 |
+
border-radius: 5px;
|
| 267 |
+
transition: all 0.3s;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
.room-actions button:hover {
|
| 271 |
+
background: rgba(255, 255, 255, 0.1);
|
| 272 |
+
color: var(--text-primary);
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
/* Chat Area */
|
| 276 |
+
.chat-area {
|
| 277 |
+
display: flex;
|
| 278 |
+
flex-direction: column;
|
| 279 |
+
background: var(--background-color);
|
| 280 |
+
border-radius: 20px;
|
| 281 |
+
overflow: hidden;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.chat-header {
|
| 285 |
+
background: var(--glass-bg);
|
| 286 |
+
backdrop-filter: blur(10px);
|
| 287 |
+
border-bottom: 1px solid var(--glass-border);
|
| 288 |
+
padding: 15px 20px;
|
| 289 |
+
display: flex;
|
| 290 |
+
justify-content: space-between;
|
| 291 |
+
align-items: center;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
.chat-header-info {
|
| 295 |
+
display: flex;
|
| 296 |
+
align-items: center;
|
| 297 |
+
gap: 15px;
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
.chat-header-info h3 {
|
| 301 |
+
font-size: 1.2rem;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
.chat-actions {
|
| 305 |
+
display: flex;
|
| 306 |
+
gap: 10px;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
.chat-actions button {
|
| 310 |
+
background: transparent;
|
| 311 |
+
border: none;
|
| 312 |
+
color: var(--text-secondary);
|
| 313 |
+
cursor: pointer;
|
| 314 |
+
padding: 8px;
|
| 315 |
+
border-radius: 8px;
|
| 316 |
+
transition: all 0.3s;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
.chat-actions button:hover {
|
| 320 |
+
background: rgba(255, 255, 255, 0.1);
|
| 321 |
+
color: var(--text-primary);
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
.messages-container {
|
| 325 |
+
flex: 1;
|
| 326 |
+
overflow-y: auto;
|
| 327 |
+
padding: 20px;
|
| 328 |
+
display: flex;
|
| 329 |
+
flex-direction: column;
|
| 330 |
+
gap: 15px;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
.message {
|
| 334 |
+
max-width: 70%;
|
| 335 |
+
padding: 12px 16px;
|
| 336 |
+
border-radius: 18px;
|
| 337 |
+
animation: fadeIn 0.3s ease-out;
|
| 338 |
+
position: relative;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
@keyframes fadeIn {
|
| 342 |
+
from {
|
| 343 |
+
opacity: 0;
|
| 344 |
+
transform: translateY(10px);
|
| 345 |
+
}
|
| 346 |
+
to {
|
| 347 |
+
opacity: 1;
|
| 348 |
+
transform: translateY(0);
|
| 349 |
+
}
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
.message.received {
|
| 353 |
+
align-self: flex-start;
|
| 354 |
+
background: var(--glass-bg);
|
| 355 |
+
border: 1px solid var(--glass-border);
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
.message.sent {
|
| 359 |
+
align-self: flex-end;
|
| 360 |
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
.message-header {
|
| 364 |
+
display: flex;
|
| 365 |
+
justify-content: space-between;
|
| 366 |
+
margin-bottom: 8px;
|
| 367 |
+
font-size: 0.85rem;
|
| 368 |
+
color: var(--text-secondary);
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
.message-content {
|
| 372 |
+
word-wrap: break-word;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
.message-reactions {
|
| 376 |
+
display: flex;
|
| 377 |
+
gap: 5px;
|
| 378 |
+
margin-top: 8px;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
.reaction {
|
| 382 |
+
background: rgba(255, 255, 255, 0.1);
|
| 383 |
+
border-radius: 50%;
|
| 384 |
+
width: 24px;
|
| 385 |
+
height: 24px;
|
| 386 |
+
display: flex;
|
| 387 |
+
align-items: center;
|
| 388 |
+
justify-content: center;
|
| 389 |
+
font-size: 0.85rem;
|
| 390 |
+
cursor: pointer;
|
| 391 |
+
transition: all 0.3s;
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
.reaction:hover {
|
| 395 |
+
transform: scale(1.2);
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
.message-actions {
|
| 399 |
+
position: absolute;
|
| 400 |
+
top: -10px;
|
| 401 |
+
right: -10px;
|
| 402 |
+
display: flex;
|
| 403 |
+
gap: 5px;
|
| 404 |
+
opacity: 0;
|
| 405 |
+
transition: opacity 0.3s;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
.message:hover .message-actions {
|
| 409 |
+
opacity: 1;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
.message-actions button {
|
| 413 |
+
background: rgba(255, 255, 255, 0.1);
|
| 414 |
+
border: none;
|
| 415 |
+
border-radius: 50%;
|
| 416 |
+
width: 28px;
|
| 417 |
+
height: 28px;
|
| 418 |
+
display: flex;
|
| 419 |
+
align-items: center;
|
| 420 |
+
justify-content: center;
|
| 421 |
+
cursor: pointer;
|
| 422 |
+
transition: all 0.3s;
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
.message-actions button:hover {
|
| 426 |
+
background: rgba(255, 255, 255, 0.2);
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
/* Input Area */
|
| 430 |
+
.input-area {
|
| 431 |
+
padding: 20px;
|
| 432 |
+
background: var(--glass-bg);
|
| 433 |
+
backdrop-filter: blur(10px);
|
| 434 |
+
border-top: 1px solid var(--glass-border);
|
| 435 |
+
display: flex;
|
| 436 |
+
gap: 10px;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
.input-wrapper {
|
| 440 |
+
flex: 1;
|
| 441 |
+
display: flex;
|
| 442 |
+
gap: 10px;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
.input-wrapper input {
|
| 446 |
+
flex: 1;
|
| 447 |
+
padding: 12px 20px;
|
| 448 |
+
background: rgba(255, 255, 255, 0.05);
|
| 449 |
+
border: 1px solid var(--glass-border);
|
| 450 |
+
border-radius: 25px;
|
| 451 |
+
color: var(--text-primary);
|
| 452 |
+
font-size: 1rem;
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
.input-wrapper input:focus {
|
| 456 |
+
outline: none;
|
| 457 |
+
border-color: var(--primary-color);
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
.input-actions {
|
| 461 |
+
display: flex;
|
| 462 |
+
gap: 10px;
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
.input-actions button {
|
| 466 |
+
background: transparent;
|
| 467 |
+
border: none;
|
| 468 |
+
color: var(--text-secondary);
|
| 469 |
+
cursor: pointer;
|
| 470 |
+
padding: 10px;
|
| 471 |
+
border-radius: 50%;
|
| 472 |
+
transition: all 0.3s;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
.input-actions button:hover {
|
| 476 |
+
background: rgba(255, 255, 255, 0.1);
|
| 477 |
+
color: var(--text-primary);
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
/* Modal */
|
| 481 |
+
.modal {
|
| 482 |
+
display: none;
|
| 483 |
+
position: fixed;
|
| 484 |
+
top: 0;
|
| 485 |
+
left: 0;
|
| 486 |
+
width: 100%;
|
| 487 |
+
height: 100%;
|
| 488 |
+
background: rgba(0, 0, 0, 0.5);
|
| 489 |
+
backdrop-filter: blur(5px);
|
| 490 |
+
z-index: 1000;
|
| 491 |
+
align-items: center;
|
| 492 |
+
justify-content: center;
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
.modal.active {
|
| 496 |
+
display: flex;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
.modal-content {
|
| 500 |
+
background: var(--glass-bg);
|
| 501 |
+
backdrop-filter: blur(10px);
|
| 502 |
+
border: 1px solid var(--glass-border);
|
| 503 |
+
border-radius: 20px;
|
| 504 |
+
padding: 30px;
|
| 505 |
+
width: 90%;
|
| 506 |
+
max-width: 500px;
|
| 507 |
+
animation: modalSlideIn 0.3s ease-out;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
@keyframes modalSlideIn {
|
| 511 |
+
from {
|
| 512 |
+
opacity: 0;
|
| 513 |
+
transform: scale(0.9);
|
| 514 |
+
}
|
| 515 |
+
to {
|
| 516 |
+
opacity: 1;
|
| 517 |
+
transform: scale(1);
|
| 518 |
+
}
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
.modal-header {
|
| 522 |
+
display: flex;
|
| 523 |
+
justify-content: space-between;
|
| 524 |
+
align-items: center;
|
| 525 |
+
margin-bottom: 20px;
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
.modal-header h2 {
|
| 529 |
+
font-size: 1.5rem;
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
.modal-close {
|
| 533 |
+
background: transparent;
|
| 534 |
+
border: none;
|
| 535 |
+
color: var(--text-secondary);
|
| 536 |
+
font-size: 1.5rem;
|
| 537 |
+
cursor: pointer;
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
/* Reactions Panel */
|
| 541 |
+
.reactions-panel {
|
| 542 |
+
display: none;
|
| 543 |
+
position: absolute;
|
| 544 |
+
bottom: 100%;
|
| 545 |
+
right: 0;
|
| 546 |
+
background: var(--glass-bg);
|
| 547 |
+
backdrop-filter: blur(10px);
|
| 548 |
+
border: 1px solid var(--glass-border);
|
| 549 |
+
border-radius: 12px;
|
| 550 |
+
padding: 10px;
|
| 551 |
+
gap: 10px;
|
| 552 |
+
z-index: 100;
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
.reactions-panel.active {
|
| 556 |
+
display: flex;
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
.reaction-btn {
|
| 560 |
+
width: 36px;
|
| 561 |
+
height: 36px;
|
| 562 |
+
background: rgba(255, 255, 255, 0.1);
|
| 563 |
+
border: none;
|
| 564 |
+
border-radius: 50%;
|
| 565 |
+
display: flex;
|
| 566 |
+
align-items: center;
|
| 567 |
+
justify-content: center;
|
| 568 |
+
cursor: pointer;
|
| 569 |
+
transition: all 0.3s;
|
| 570 |
+
}
|
| 571 |
+
|
| 572 |
+
.reaction-btn:hover {
|
| 573 |
+
background: rgba(255, 255, 255, 0.2);
|
| 574 |
+
transform: scale(1.1);
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
/* Responsive Design */
|
| 578 |
+
@media (max-width: 768px) {
|
| 579 |
+
.chat-container {
|
| 580 |
+
grid-template-columns: 1fr;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
.sidebar {
|
| 584 |
+
display: none;
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
.auth-card {
|
| 588 |
+
padding: 30px;
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
.header h1 {
|
| 592 |
+
font-size: 2rem;
|
| 593 |
+
}
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
/* Loading Spinner */
|
| 597 |
+
.spinner {
|
| 598 |
+
width: 40px;
|
| 599 |
+
height: 40px;
|
| 600 |
+
border: 4px solid rgba(255, 255, 255, 0.1);
|
| 601 |
+
border-top: 4px solid var(--primary-color);
|
| 602 |
+
border-radius: 50%;
|
| 603 |
+
animation: spin 1s linear infinite;
|
| 604 |
+
margin: 20px auto;
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
@keyframes spin {
|
| 608 |
+
0% { transform: rotate(0deg); }
|
| 609 |
+
100% { transform: rotate(360deg); }
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
/* Toast Notification */
|
| 613 |
+
.toast {
|
| 614 |
+
position: fixed;
|
| 615 |
+
bottom: 20px;
|
| 616 |
+
right: 20px;
|
| 617 |
+
background: var(--glass-bg);
|
| 618 |
+
backdrop-filter: blur(10px);
|
| 619 |
+
border: 1px solid var(--glass-border);
|
| 620 |
+
border-radius: 10px;
|
| 621 |
+
padding: 15px 20px;
|
| 622 |
+
display: flex;
|
| 623 |
+
align-items: center;
|
| 624 |
+
gap: 10px;
|
| 625 |
+
transform: translateX(400px);
|
| 626 |
+
transition: transform 0.3s ease-out;
|
| 627 |
+
z-index: 1000;
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
.toast.show {
|
| 631 |
+
transform: translateX(0);
|
| 632 |
+
}
|
| 633 |
+
</style>
|
| 634 |
+
</head>
|
| 635 |
+
<body>
|
| 636 |
+
<div class="container">
|
| 637 |
+
<div class="header">
|
| 638 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with">Built with anycoder</a>
|
| 639 |
+
<h1>چت روم مینیمال</h1>
|
| 640 |
+
</div>
|
| 641 |
+
|
| 642 |
+
<!-- Authentication Section -->
|
| 643 |
+
<div class="auth-section" id="authSection">
|
| 644 |
+
<div class="auth-card">
|
| 645 |
+
<h2>ورود به چت روم</h2>
|
| 646 |
+
<div class="form-group">
|
| 647 |
+
<label for="phoneNumber">شماره موبایل</label>
|
| 648 |
+
<input type="tel" id="phoneNumber" placeholder="09xxxxxxxxx" maxlength="11">
|
| 649 |
+
</div>
|
| 650 |
+
<button class="btn" onclick="authenticate()">تایید و ورود</button>
|
| 651 |
+
</div>
|
| 652 |
+
</div>
|
| 653 |
+
|
| 654 |
+
<!-- Main Chat Interface -->
|
| 655 |
+
<div class="chat-interface" id="chatInterface">
|
| 656 |
+
<div class="chat-container">
|
| 657 |
+
<!-- Sidebar -->
|
| 658 |
+
<div class="sidebar">
|
| 659 |
+
<div class="sidebar-header">
|
| 660 |
+
<h3>اتاقهای چت</h3>
|
| 661 |
+
<button class="add-room-btn" onclick="showCreateRoomModal()">
|
| 662 |
+
<i class="fas fa-plus"></i>
|
| 663 |
+
</button>
|
| 664 |
+
</div>
|
| 665 |
+
<div class="rooms-list" id="roomsList">
|
| 666 |
+
<!-- Rooms will be dynamically added here -->
|
| 667 |
+
</div>
|
| 668 |
+
</div>
|
| 669 |
+
|
| 670 |
+
<!-- Chat Area -->
|
| 671 |
+
<div class="chat-area">
|
| 672 |
+
<div class="chat-header">
|
| 673 |
+
<div class="chat-header-info">
|
| 674 |
+
<div class="room-info">
|
| 675 |
+
<h3 id="currentRoomName">انتخاب یک اتاق</h3>
|
| 676 |
+
<span id="currentRoomMembers" class="room-members">0 عضو</span>
|
| 677 |
+
</div>
|
| 678 |
+
</div>
|
| 679 |
+
<div class="chat-actions">
|
| 680 |
+
<button onclick="copyRoomLink()">
|
| 681 |
+
<i class="fas fa-link"></i>
|
| 682 |
+
</button>
|
| 683 |
+
<button onclick="showRoomInfo()">
|
| 684 |
+
<i class="fas fa-info-circle"></i>
|
| 685 |
+
</button>
|
| 686 |
+
</div>
|
| 687 |
+
</div>
|
| 688 |
+
<div class="messages-container" id="messagesContainer">
|
| 689 |
+
<!-- Messages will be dynamically added here -->
|
| 690 |
+
</div>
|
| 691 |
+
<div class="input-area">
|
| 692 |
+
<div class="input-wrapper">
|
| 693 |
+
<input type="text" id="messageInput" placeholder="پیام خود را بنویسید..." onkeypress="handleKeyPress(event)">
|
| 694 |
+
<div class="input-actions">
|
| 695 |
+
<button onclick="attachFile()">
|
| 696 |
+
<i class="fas fa-paperclip"></i>
|
| 697 |
+
</button>
|
| 698 |
+
<button onclick="showReactions()">
|
| 699 |
+
<i class="fas fa-smile"></i>
|
| 700 |
+
</button>
|
| 701 |
+
</div>
|
| 702 |
+
</div>
|
| 703 |
+
<button class="btn" onclick="sendMessage()">ارسال</button>
|
| 704 |
+
</div>
|
| 705 |
+
</div>
|
| 706 |
+
</div>
|
| 707 |
+
</div>
|
| 708 |
+
</div>
|
| 709 |
+
|
| 710 |
+
<!-- Create Room Modal -->
|
| 711 |
+
<div class="modal" id="createRoomModal">
|
| 712 |
+
<div class="modal-content">
|
| 713 |
+
<div class="modal-header">
|
| 714 |
+
<h2>ساخت اتاق جدید</h2>
|
| 715 |
+
<button class="modal-close" onclick="closeCreateRoomModal()">×</button>
|
| 716 |
+
</div>
|
| 717 |
+
<div class="form-group">
|
| 718 |
+
<label for="roomName">نام اتاق</label>
|
| 719 |
+
<input type="text" id="roomName" placeholder="نام اتاق را وارد کنید">
|
| 720 |
+
</div>
|
| 721 |
+
<button class="btn" onclick="createRoom()">ایجاد اتاق</button>
|
| 722 |
+
</div>
|
| 723 |
+
</div>
|
| 724 |
+
|
| 725 |
+
<!-- Reactions Panel -->
|
| 726 |
+
<div class="reactions-panel" id="reactionsPanel">
|
| 727 |
+
<button class="reaction-btn" onclick="addReaction('😀')">😀</button>
|
| 728 |
+
<button class="reaction-btn" onclick="addReaction('❤️')">❤️</button>
|
| 729 |
+
<button class="reaction-btn" onclick="addReaction('👍')">👍</button>
|
| 730 |
+
<button class="reaction-btn" onclick="addReaction('😂')">😂</button>
|
| 731 |
+
<button class="reaction-btn" onclick="addReaction('🎉')">🎉</button>
|
| 732 |
+
<button class="reaction-btn" onclick="addReaction('🔥')">🔥</button>
|
| 733 |
+
</div>
|
| 734 |
+
|
| 735 |
+
<!-- Toast Notification -->
|
| 736 |
+
<div class="toast" id="toast">
|
| 737 |
+
<i class="fas fa-check-circle"></i>
|
| 738 |
+
<span id="toastMessage">پیام موفقیتآمیز</span>
|
| 739 |
+
</div>
|
| 740 |
+
|
| 741 |
+
<script>
|
| 742 |
+
// Global Variables
|
| 743 |
+
let currentUser = null;
|
| 744 |
+
let currentRoom = null;
|
| 745 |
+
let rooms = [];
|
| 746 |
+
let messages = {};
|
| 747 |
+
let reactions = {};
|
| 748 |
+
|
| 749 |
+
// Authentication
|
| 750 |
+
function authenticate() {
|
| 751 |
+
const phoneNumber = document.getElementById('phoneNumber').value;
|
| 752 |
+
if (phoneNumber && phoneNumber.length === 11 && phoneNumber.startsWith('09')) {
|
| 753 |
+
currentUser = {
|
| 754 |
+
id: Date.now(),
|
| 755 |
+
phone: phoneNumber,
|
| 756 |
+
name: `کاربر ${phoneNumber.slice(-4)}`
|
| 757 |
+
};
|
| 758 |
+
showToast('ورود موفقیتآمیز');
|
| 759 |
+
showChatInterface();
|
| 760 |
+
} else {
|
| 761 |
+
showToast('لطفاً شماره موبایل معتبر وارد کنید', 'error');
|
| 762 |
+
}
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
function showChatInterface() {
|
| 766 |
+
document.getElementById('authSection').style.display = 'none';
|
| 767 |
+
document.getElementById('chatInterface').style.display = 'block';
|
| 768 |
+
loadRooms();
|
| 769 |
+
}
|
| 770 |
+
|
| 771 |
+
// Room Management
|
| 772 |
+
function loadRooms() {
|
| 773 |
+
// Simulate loading rooms
|
| 774 |
+
rooms = [
|
| 775 |
+
{ id: 1, name: 'اتاق عمومی', members: 3 },
|
| 776 |
+
{ id: 2, name: 'گروه دوستان', members: 5 },
|
| 777 |
+
{ id: 3, name: 'تیم کاری', members: 8 }
|
| 778 |
+
];
|
| 779 |
+
renderRooms();
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
function renderRooms() {
|
| 783 |
+
const roomsList = document.getElementById('roomsList');
|
| 784 |
+
roomsList.innerHTML = '';
|
| 785 |
+
rooms.forEach(room => {
|
| 786 |
+
const roomElement = document.createElement('div');
|
| 787 |
+
roomElement.className = 'room-item';
|
| 788 |
+
roomElement.innerHTML = `
|
| 789 |
+
<div class="room-info">
|
| 790 |
+
<div class="room-name">${room.name}</div>
|
| 791 |
+
<div class="room-members">${room.members} عضو</div>
|
| 792 |
+
</div>
|
| 793 |
+
<div class="room-actions">
|
| 794 |
+
<button onclick="joinRoom(${room.id})"><i class="fas fa-sign-in-alt"></i></button>
|
| 795 |
+
<button onclick="deleteRoom(${room.id})"><i class="fas fa-trash"></i></button>
|
| 796 |
+
</div>
|
| 797 |
+
`;
|
| 798 |
+
roomElement.onclick = () => selectRoom(room);
|
| 799 |
+
roomsList.appendChild(roomElement);
|
| 800 |
+
});
|
| 801 |
+
}
|
| 802 |
+
|
| 803 |
+
function selectRoom(room) {
|
| 804 |
+
currentRoom = room;
|
| 805 |
+
document.getElementById('currentRoomName').textContent = room.name;
|
| 806 |
+
document.getElementById('currentRoomMembers').textContent = `${room.members} عضو`;
|
| 807 |
+
|
| 808 |
+
// Update active room
|
| 809 |
+
document.querySelectorAll('.room-item').forEach(item => {
|
| 810 |
+
item.classList.remove('active');
|
| 811 |
+
});
|
| 812 |
+
event.currentTarget.classList.add('active');
|
| 813 |
+
|
| 814 |
+
loadMessages(room.id);
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
function joinRoom(roomId) {
|
| 818 |
+
const room = rooms.find(r => r.id === roomId);
|
| 819 |
+
selectRoom(room);
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
function deleteRoom(roomId) {
|
| 823 |
+
rooms = rooms.filter(r => r.id !== roomId);
|
| 824 |
+
renderRooms();
|
| 825 |
+
showToast('اتاق حذف شد');
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
function showCreateRoomModal() {
|
| 829 |
+
document.getElementById('createRoomModal').classList.add('active');
|
| 830 |
+
}
|
| 831 |
+
|
| 832 |
+
function closeCreateRoomModal() {
|
| 833 |
+
document.getElementById('createRoomModal').classList.remove('active');
|
| 834 |
+
document.getElementById('roomName').value = '';
|
| 835 |
+
}
|
| 836 |
+
|
| 837 |
+
function createRoom() {
|
| 838 |
+
const roomName = document.getElementById('roomName').value;
|
| 839 |
+
if (roomName && rooms.length < 3) {
|
| 840 |
+
const newRoom = {
|
| 841 |
+
id: Date.now(),
|
| 842 |
+
name: roomName,
|
| 843 |
+
members: 1
|
| 844 |
+
};
|
| 845 |
+
rooms.push(newRoom);
|
| 846 |
+
renderRooms();
|
| 847 |
+
closeCreateRoomModal();
|
| 848 |
+
showToast('اتاق با موفقیت ایجاد شد');
|
| 849 |
+
} else if (rooms.length >= 3) {
|
| 850 |
+
showToast('حداکثر ۳ اتاق میتوانید ایجاد کنید', 'warning');
|
| 851 |
+
} else {
|
| 852 |
+
showToast('لطفاً نام اتاق را وارد کنید', 'error');
|
| 853 |
+
}
|
| 854 |
+
}
|
| 855 |
+
|
| 856 |
+
// Message System
|
| 857 |
+
function loadMessages(roomId) {
|
| 858 |
+
// Simulate loading messages
|
| 859 |
+
if (!messages[roomId]) {
|
| 860 |
+
messages[roomId] = [
|
| 861 |
+
{ id: 1, sender: 'کاربر 1234', content: 'سلام! خوش آمدید به اتاق', time: '10:30', type: 'received' },
|
| 862 |
+
{ id: 2, sender: currentUser.name, content: 'سلام! ممنون', time: '10:32', type: 'sent' },
|
| 863 |
+
{ id: 3, sender: 'کاربر 5678', content: 'خوشحال شدم که اینجا هستید', time: '10:35', type: 'received' }
|
| 864 |
+
];
|
| 865 |
+
}
|
| 866 |
+
renderMessages(roomId);
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
function renderMessages(roomId) {
|
| 870 |
+
const messagesContainer = document.getElementById('messagesContainer');
|
| 871 |
+
messagesContainer.innerHTML = '';
|
| 872 |
+
messages[roomId].forEach(message => {
|
| 873 |
+
const messageElement = createMessageElement(message);
|
| 874 |
+
messagesContainer.appendChild(messageElement);
|
| 875 |
+
});
|
| 876 |
+
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
| 877 |
+
}
|
| 878 |
+
|
| 879 |
+
function createMessageElement(message) {
|
| 880 |
+
const messageDiv = document.createElement('div');
|
| 881 |
+
messageDiv.className = `message ${message.type}`;
|
| 882 |
+
messageDiv.innerHTML = `
|
| 883 |
+
<div class="message-header">
|
| 884 |
+
<span>${message.sender}</span>
|
| 885 |
+
<span>${message.time}</span>
|
| 886 |
+
</div>
|
| 887 |
+
<div class="message-content">${message.content}</div>
|
| 888 |
+
<div class="message-reactions">
|
| 889 |
+
${message.reactions ? message.reactions.map(r =>
|
| 890 |
+
`<div class="reaction">${r}</div>`
|
| 891 |
+
).join('') : ''}
|
| 892 |
+
</div>
|
| 893 |
+
<div class="message-actions">
|
| 894 |
+
<button onclick="replyToMessage(${message.id})"><i class="fas fa-reply"></i></button>
|
| 895 |
+
<button onclick="deleteMessage(${message.id})"><i class="fas fa-trash"></i></button>
|
| 896 |
+
</div>
|
| 897 |
+
`;
|
| 898 |
+
return messageDiv;
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
function sendMessage() {
|
| 902 |
+
const input = document.getElementById('messageInput');
|
| 903 |
+
const content = input.value.trim();
|
| 904 |
+
if (content && currentRoom) {
|
| 905 |
+
const newMessage = {
|
| 906 |
+
id: Date.now(),
|
| 907 |
+
sender: currentUser.name,
|
| 908 |
+
content: content,
|
| 909 |
+
time: new Date().toLocaleTimeString('fa-IR', { hour: '2-digit', minute: '2-digit' }),
|
| 910 |
+
type: 'sent'
|
| 911 |
+
};
|
| 912 |
+
if (!messages[currentRoom.id]) {
|
| 913 |
+
messages[currentRoom.id] = [];
|
| 914 |
+
}
|
| 915 |
+
messages[currentRoom.id].push(newMessage);
|
| 916 |
+
renderMessages(currentRoom.id);
|
| 917 |
+
input.value = '';
|
| 918 |
+
showToast('پیام ارسال شد');
|
| 919 |
+
}
|
| 920 |
+
}
|
| 921 |
+
|
| 922 |
+
function handleKeyPress(event) {
|
| 923 |
+
if (event.key === 'Enter') {
|
| 924 |
+
sendMessage();
|
| 925 |
+
}
|
| 926 |
+
}
|
| 927 |
+
|
| 928 |
+
function replyToMessage(messageId) {
|
| 929 |
+
const input = document.getElementById('messageInput');
|
| 930 |
+
input.value = `@${messageId} `;
|
| 931 |
+
input.focus();
|
| 932 |
+
showToast('در حال پاسخ به پیام...');
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
function deleteMessage(messageId) {
|
| 936 |
+
if (currentRoom) {
|
| 937 |
+
messages[currentRoom.id] = messages[currentRoom.id].filter(m => m.id !== messageId);
|
| 938 |
+
renderMessages(currentRoom.id);
|
| 939 |
+
showToast('پیام حذف شد');
|
| 940 |
+
}
|
| 941 |
+
}
|
| 942 |
+
|
| 943 |
+
// Reactions System
|
| 944 |
+
function showReactions() {
|
| 945 |
+
const panel = document.getElementById('reactionsPanel');
|
| 946 |
+
panel.classList.toggle('active');
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
function addReaction(emoji) {
|
| 950 |
+
if (currentRoom) {
|
| 951 |
+
const lastMessage = messages[currentRoom.id][messages[currentRoom.id].length - 1];
|
| 952 |
+
if (lastMessage) {
|
| 953 |
+
if (!lastMessage.reactions) {
|
| 954 |
+
lastMessage.reactions = [];
|
| 955 |
+
}
|
| 956 |
+
lastMessage.reactions.push(emoji);
|
| 957 |
+
renderMessages(currentRoom.id);
|
| 958 |
+
showToast('واکنش اضافه شد');
|
| 959 |
+
}
|
| 960 |
+
}
|
| 961 |
+
document.getElementById('reactionsPanel').classList.remove('active');
|
| 962 |
+
}
|
| 963 |
+
|
| 964 |
+
// UI Functions
|
| 965 |
+
function copyRoomLink() {
|
| 966 |
+
if (currentRoom) {
|
| 967 |
+
const link = `https://chatroom.com/room/${currentRoom.id}`;
|
| 968 |
+
navigator.clipboard.writeText(link).then(() => {
|
| 969 |
+
showToast('لینک اتاق کپی شد');
|
| 970 |
+
});
|
| 971 |
+
}
|
| 972 |
+
}
|
| 973 |
+
|
| 974 |
+
function showRoomInfo() {
|
| 975 |
+
if (currentRoom) {
|
| 976 |
+
showToast(`اطلاعات اتاق: ${currentRoom.name} - ${currentRoom.members} عضو`);
|
| 977 |
+
}
|
| 978 |
+
}
|
| 979 |
+
|
| 980 |
+
function attachFile() {
|
| 981 |
+
showToast('فایل پیوست شده است');
|
| 982 |
+
}
|
| 983 |
+
|
| 984 |
+
// Toast Notification
|
| 985 |
+
function showToast(message, type = 'success') {
|
| 986 |
+
const toast = document.getElementById('toast');
|
| 987 |
+
const toastMessage = document.getElementById('toastMessage');
|
| 988 |
+
const icon = toast.querySelector('i');
|
| 989 |
+
|
| 990 |
+
toastMessage.textContent = message;
|
| 991 |
+
|
| 992 |
+
// Set icon based on type
|
| 993 |
+
icon.className = type === 'error' ? 'fas fa-exclamation-circle' :
|
| 994 |
+
type === 'warning' ? 'fas fa-exclamation-triangle' :
|
| 995 |
+
'fas fa-check-circle';
|
| 996 |
+
|
| 997 |
+
toast.classList.add('show');
|
| 998 |
+
setTimeout(() => {
|
| 999 |
+
toast.classList.remove('show');
|
| 1000 |
+
}, 3000);
|
| 1001 |
+
}
|
| 1002 |
+
|
| 1003 |
+
// Touch Gestures (simulated)
|
| 1004 |
+
let touchStartX = 0;
|
| 1005 |
+
let touchEndX = 0;
|
| 1006 |
+
|
| 1007 |
+
document.addEventListener('touchstart', e => {
|
| 1008 |
+
touchStartX = e.changedTouches[0].screenX;
|
| 1009 |
+
});
|
| 1010 |
+
|
| 1011 |
+
document.addEventListener('touchend', e => {
|
| 1012 |
+
touchEndX = e.changedTouches[0].screenX;
|
| 1013 |
+
handleSwipe();
|
| 1014 |
+
});
|
| 1015 |
+
|
| 1016 |
+
function handleSwipe() {
|
| 1017 |
+
if (touchEndX < touchStartX - 50) {
|
| 1018 |
+
// Swipe left - show sidebar on mobile
|
| 1019 |
+
if (window.innerWidth <= 768) {
|
| 1020 |
+
document.querySelector('.sidebar').style.display = 'flex';
|
| 1021 |
+
}
|
| 1022 |
+
}
|
| 1023 |
+
if (touchEndX > touchStartX + 50) {
|
| 1024 |
+
// Swipe right - hide sidebar on mobile
|
| 1025 |
+
if (window.innerWidth <= 768) {
|
| 1026 |
+
document.querySelector('.sidebar').style.display = 'none';
|
| 1027 |
+
}
|
| 1028 |
+
}
|
| 1029 |
+
}
|
| 1030 |
+
|
| 1031 |
+
// Long press simulation
|
| 1032 |
+
let pressTimer;
|
| 1033 |
+
document.addEventListener('mousedown', e => {
|
| 1034 |
+
pressTimer = setTimeout(() => {
|
| 1035 |
+
// Long press action
|
| 1036 |
+
if (e.target.closest('.message')) {
|
| 1037 |
+
e.target.closest('.message').querySelector('.message-actions').style.opacity = '1';
|
| 1038 |
+
}
|
| 1039 |
+
}, 500);
|
| 1040 |
+
});
|
| 1041 |
+
|
| 1042 |
+
document.addEventListener('mouseup', () => {
|
| 1043 |
+
clearTimeout(pressTimer);
|
| 1044 |
+
});
|
| 1045 |
+
|
| 1046 |
+
// Initialize
|
| 1047 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 1048 |
+
// Add some initial messages to make it look populated
|
| 1049 |
+
if (!messages[1]) {
|
| 1050 |
+
messages[1] = [
|
| 1051 |
+
{ id: 1, sender: 'کاربر 1234', content: 'سلام! خوش آمدید به اتاق', time: '10:30', type: 'received' },
|
| 1052 |
+
{ id: 2, sender: 'کاربر 5678', content: 'خوشحال شدم که اینجا هستید', time: '10:35', type: 'received' }
|
| 1053 |
+
];
|
| 1054 |
+
}
|
| 1055 |
+
});
|
| 1056 |
+
</script>
|
| 1057 |
+
</body>
|
| 1058 |
+
</html>
|