CVNSS commited on
Commit
640cdb9
·
verified ·
1 Parent(s): eee3a5b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +35 -54
index.html CHANGED
@@ -7,68 +7,60 @@
7
  <style>
8
  :root { --primary:#1a73e8; --bg:#f5f6f8; --text:#202124; }
9
  * { box-sizing: border-box; }
10
- body {
11
  margin:0; font-family: Arial, "Segoe UI", system-ui, -apple-system, sans-serif;
12
  background:var(--bg); color:var(--text); display:flex; flex-direction:column; min-height:100vh;
13
  }
14
- header { background:var(--primary); color:#fff; padding:16px 20px; font-size:20px; font-weight:600; text-align:center; }
15
- .card {
16
- width: min(940px, 92vw); margin: 28px auto; background:#fff; border-radius:12px;
17
- box-shadow:0 6px 18px rgba(0,0,0,.08); padding:22px;
18
- }
19
- h2 { margin:0 0 14px 0; font-weight:600; }
20
- .row { display:flex; gap:10px; flex-wrap:wrap; }
21
- input[type="text"]{
22
- flex:1 1 260px; padding:12px 14px; font-size:16px; border:1px solid #d6d9dd; border-radius:8px; outline: none;
23
- }
24
  input[type="text"]:focus{ border-color:var(--primary); }
25
- button{
26
- padding:12px 16px; border:none; border-radius:8px; background:var(--primary); color:#fff;
27
- font-weight:600; cursor:pointer;
28
- }
29
  button.secondary{ background:#5f6368; }
30
  button.ghost{ background:#e9eef6; color:#174ea6; }
31
- #app { display:none; }
32
- .top-info { display:flex; gap:10px; align-items:center; margin-bottom:10px; }
33
- .pill { background:#eef3fd; color:#174ea6; padding:6px 10px; border-radius:999px; font-size:14px; }
34
- .chat-wrap { position:relative; border:1px solid #e3e6ea; border-radius:10px; overflow:hidden; }
35
- iframe { width:100%; height:72vh; min-height:520px; border:0; display:block; background:#fff; }
36
 
37
- /* ====== OVERLAYS che phần thừa trong tlk.io ====== */
38
- /* Che vùng trên cùng (form "Wanna join?") */
 
 
 
39
  .ov-top{
40
  position:absolute; left:0; right:0; top:0;
41
- height:200px; /* tăng/giảm nếu cần 180–240 */
42
- background:#fff; z-index:3; pointer-events:auto;
43
- box-shadow: 0 10px 10px -10px rgba(0,0,0,.15);
44
  }
45
  /* Che cột phải (online, branding, patron…) */
46
  .ov-right{
47
  position:absolute; top:0; right:0; bottom:0;
48
- width:min(260px, 24vw); /* chỉnh 220–300px tùy màn hình */
49
  background:#fff; z-index:2; pointer-events:none;
50
- box-shadow: -8px 0 10px -10px rgba(0,0,0,.15);
51
- }
52
- /* Che chân trang tlk.io (nếu có) */
53
- .ov-bottom{
54
- position:absolute; left:0; right:0; bottom:0;
55
- height:110px; background:#fff; z-index:2; pointer-events:none;
56
- box-shadow: 0 -8px 10px -10px rgba(0,0,0,.12);
57
  }
58
-
59
- footer { margin-top:auto; text-align:center; color:#6c727a; font-size:13px; padding:16px; }
60
  </style>
61
  </head>
62
  <body>
63
  <header>💬 Chat CVNSS4.0</header>
64
 
65
- <!-- Màn hình nhập tên + tạo phòng -->
66
  <section id="gate" class="card">
67
- <h2>Tham gia phòng chat ngay</h2>
68
  <div class="row">
69
  <input id="nickname" type="text" placeholder="Nhập tên của bạn…" />
70
  <button id="goBtn">Vào Chat</button>
71
  </div>
 
 
 
72
 
73
  <div style="margin-top:16px; display:flex; gap:10px; align-items:center; flex-wrap:wrap;">
74
  <button class="ghost" id="mkRoom">✨ Tạo phòng bí mật</button>
@@ -79,14 +71,10 @@
79
 
80
  <!-- Khung chat -->
81
  <section id="app" class="card">
82
- <div class="top-info">
83
- <div id="roomPill" class="pill"></div>
84
- <!-- Không hiển thị nick pill để khỏi thấy "Long" ở ngoài -->
85
- </div>
86
  <div class="chat-wrap">
87
  <div class="ov-top"></div>
88
  <div class="ov-right"></div>
89
- <div class="ov-bottom"></div>
90
  <iframe id="tlk" title="tlk.io chat"></iframe>
91
  </div>
92
  </section>
@@ -96,28 +84,21 @@
96
  </footer>
97
 
98
  <script>
99
- // ── Params & state ──────────────────────────────────────────────
100
- const q = new URLSearchParams(location.search);
101
- let room = (q.get("room") || "cvnss4-0").trim().toLowerCase();
102
  document.getElementById('roomPill').textContent = "Phòng: " + room;
103
 
104
- // ── Join flow (UI đi thẳng vào chat) ────────────────────────────
105
  document.getElementById('goBtn').onclick = () => {
106
  const name = (document.getElementById('nickname').value || "").trim() || "Guest";
107
  document.getElementById('gate').style.display = 'none';
108
  document.getElementById('app').style.display = 'block';
109
-
110
- // Nạp iframe — thêm nickname để prefill (nếu tlk.io còn hỗ trợ)
111
  const url = "https://tlk.io/" + encodeURIComponent(room) + "?nickname=" + encodeURIComponent(name);
112
  document.getElementById('tlk').src = url;
113
-
114
- // Cuộn nhẹ sau 2s để che kỹ form, nếu layout tlk thay đổi
115
- setTimeout(() => {
116
- try { document.getElementById('tlk').contentWindow.scrollTo(0, 260); } catch(e) {}
117
- }, 2000);
118
  };
119
 
120
- // ── Tạo phòng bí mật copy link ───────────────────────────────
121
  document.getElementById('mkRoom').onclick = () => {
122
  const rnd = Math.random().toString(36).slice(2,8);
123
  const newRoom = `cvnss4-0-${rnd}`;
 
7
  <style>
8
  :root { --primary:#1a73e8; --bg:#f5f6f8; --text:#202124; }
9
  * { box-sizing: border-box; }
10
+ body{
11
  margin:0; font-family: Arial, "Segoe UI", system-ui, -apple-system, sans-serif;
12
  background:var(--bg); color:var(--text); display:flex; flex-direction:column; min-height:100vh;
13
  }
14
+ header{ background:var(--primary); color:#fff; padding:16px 20px; font-size:20px; font-weight:600; text-align:center; }
15
+ .card{ width:min(940px,92vw); margin:28px auto; background:#fff; border-radius:12px;
16
+ box-shadow:0 6px 18px rgba(0,0,0,.08); padding:22px; }
17
+ h2{ margin:0 0 14px 0; font-weight:600; }
18
+ .row{ display:flex; gap:10px; flex-wrap:wrap; }
19
+ input[type="text"]{ flex:1 1 260px; padding:12px 14px; font-size:16px;
20
+ border:1px solid #d6d9dd; border-radius:8px; outline:none; }
 
 
 
21
  input[type="text"]:focus{ border-color:var(--primary); }
22
+ button{ padding:12px 16px; border:none; border-radius:8px; background:var(--primary);
23
+ color:#fff; font-weight:600; cursor:pointer; }
 
 
24
  button.secondary{ background:#5f6368; }
25
  button.ghost{ background:#e9eef6; color:#174ea6; }
26
+ #app{ display:none; }
27
+ .pill{ background:#eef3fd; color:#174ea6; padding:6px 10px; border-radius:999px; font-size:14px; display:inline-block; margin-bottom:10px; }
 
 
 
28
 
29
+ .chat-wrap{ position:relative; border:1px solid #e3e6ea; border-radius:10px; overflow:hidden; }
30
+ iframe{ width:100%; height:72vh; min-height:520px; border:0; display:block; background:#fff; }
31
+
32
+ /* ====== OVERLAYS: chỉ che header + cột phải, không che join box & đáy ====== */
33
+ /* Che header tlk (đám mây, title) nhưng để lộ khung Join ở giữa */
34
  .ov-top{
35
  position:absolute; left:0; right:0; top:0;
36
+ height:70px; /* nhỏ lại để thấy khung Join */
37
+ background:#fff; z-index:3; pointer-events:none;
38
+ box-shadow: 0 8px 10px -10px rgba(0,0,0,.12);
39
  }
40
  /* Che cột phải (online, branding, patron…) */
41
  .ov-right{
42
  position:absolute; top:0; right:0; bottom:0;
43
+ width:min(260px, 24vw); /* chỉnh 220–300 nếu còn hở */
44
  background:#fff; z-index:2; pointer-events:none;
45
+ box-shadow: -8px 0 10px -10px rgba(0,0,0,.12);
 
 
 
 
 
 
46
  }
47
+ /* KHÔNG dùng ov-bottom để giữ ô nhập chat ở đáy */
48
+ footer{ margin-top:auto; text-align:center; color:#6c727a; font-size:13px; padding:16px; }
49
  </style>
50
  </head>
51
  <body>
52
  <header>💬 Chat CVNSS4.0</header>
53
 
54
+ <!-- Cửa vào: nhập tên + tạo phòng riêng -->
55
  <section id="gate" class="card">
56
+ <h2>Tham gia phòng chat</h2>
57
  <div class="row">
58
  <input id="nickname" type="text" placeholder="Nhập tên của bạn…" />
59
  <button id="goBtn">Vào Chat</button>
60
  </div>
61
+ <div style="margin-top:8px; color:#5f6368; font-size:14px;">
62
+ 👉 Sau khi bấm <b>Vào Chat</b>, ô tên trong khung sẽ được điền sẵn — bạn chỉ cần nhấn <b>Enter</b> để join.
63
+ </div>
64
 
65
  <div style="margin-top:16px; display:flex; gap:10px; align-items:center; flex-wrap:wrap;">
66
  <button class="ghost" id="mkRoom">✨ Tạo phòng bí mật</button>
 
71
 
72
  <!-- Khung chat -->
73
  <section id="app" class="card">
74
+ <span id="roomPill" class="pill"></span>
 
 
 
75
  <div class="chat-wrap">
76
  <div class="ov-top"></div>
77
  <div class="ov-right"></div>
 
78
  <iframe id="tlk" title="tlk.io chat"></iframe>
79
  </div>
80
  </section>
 
84
  </footer>
85
 
86
  <script>
87
+ // Lấy room từ URL (?room=...), mặc định: cvnss4-0
88
+ const qs = new URLSearchParams(location.search);
89
+ let room = (qs.get("room") || "cvnss4-0").trim().toLowerCase();
90
  document.getElementById('roomPill').textContent = "Phòng: " + room;
91
 
92
+ // Join: load iframe, prefill nickname (vẫn cần Enter 1 lần trong khung)
93
  document.getElementById('goBtn').onclick = () => {
94
  const name = (document.getElementById('nickname').value || "").trim() || "Guest";
95
  document.getElementById('gate').style.display = 'none';
96
  document.getElementById('app').style.display = 'block';
 
 
97
  const url = "https://tlk.io/" + encodeURIComponent(room) + "?nickname=" + encodeURIComponent(name);
98
  document.getElementById('tlk').src = url;
 
 
 
 
 
99
  };
100
 
101
+ // Tạo phòng bí mật & copy link
102
  document.getElementById('mkRoom').onclick = () => {
103
  const rnd = Math.random().toString(36).slice(2,8);
104
  const newRoom = `cvnss4-0-${rnd}`;