File size: 11,790 Bytes
6aea680
 
 
 
 
 
 
 
 
 
 
 
 
 
3572f18
6aea680
 
 
 
 
 
 
 
3572f18
6aea680
 
 
 
97abdd9
3572f18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8511651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3572f18
 
 
 
 
97abdd9
3572f18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97abdd9
3572f18
8511651
3572f18
8511651
3572f18
 
 
 
6aea680
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97abdd9
 
 
 
 
 
 
 
 
6aea680
 
 
 
3572f18
 
 
 
 
 
 
 
 
 
 
8511651
 
 
 
 
 
 
 
3572f18
 
6aea680
 
3572f18
 
 
 
6aea680
3572f18
 
 
 
97abdd9
3572f18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6aea680
 
 
3572f18
8511651
 
 
 
 
 
 
 
 
 
97abdd9
3572f18
 
 
 
 
6aea680
3572f18
 
 
 
6aea680
3572f18
 
 
 
 
 
97abdd9
3572f18
8511651
 
 
3572f18
 
 
 
 
 
 
8511651
 
3572f18
 
 
 
8511651
3572f18
8511651
3572f18
 
8511651
3572f18
 
97abdd9
 
 
 
 
 
 
 
 
 
 
 
 
8511651
 
97abdd9
8511651
 
 
3572f18
6aea680
 
 
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<html lang="zh-TW">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hugging Face System</title>
    <style>
        :root {
            --primary-color: #007bff;
            --secondary-color: #e9ecef;
            --text-color: #343a40;
            --light-bg: #f8f9fa;
            --white-bg: #ffffff;
            --shadow-color: rgba(0, 0, 0, 0.08);
            --red-color: #dc3545;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: var(--light-bg);
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        /* 登入容器 */
        #login-container {
            width: 90%;
            max-width: 400px;
            padding: 40px;
            background-color: var(--white-bg);
            border-radius: 12px;
            box-shadow: 0 10px 30px var(--shadow-color);
            text-align: center;
        }

        #login-container h2 {
            color: var(--text-color);
            margin-bottom: 30px;
            font-size: 1.8rem;
        }

        .input-group {
            margin-bottom: 20px;
            text-align: left;
        }

        .input-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #495057;
        }

        .input-group input {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #ced4da;
            border-radius: 8px;
            font-size: 1rem;
            box-sizing: border-box;
            transition: border-color 0.3s;
        }

        .input-group input:focus {
            outline: none;
            border-color: var(--primary-color);
        }

        /* 驗證碼輸入組 */
        .captcha-group {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .captcha-group input {
            flex: 1;
        }

        #captcha-code {
            width: 100px;
            padding: 10px;
            font-size: 1.2rem;
            font-weight: bold;
            text-align: center;
            color: var(--primary-color);
            border: 1px dashed #ced4da;
            border-radius: 8px;
            background-color: #e9ecef;
        }

        #error-message {
            color: var(--red-color);
            margin-top: -10px;
            margin-bottom: 20px;
            font-weight: 500;
            visibility: hidden;
            opacity: 0;
            transition: opacity 0.3s;
        }

        #login-btn {
            width: 100%;
            padding: 12px;
            border: none;
            background-color: var(--primary-color);
            color: var(--white-bg);
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        #login-btn:hover {
            background-color: #0056b3;
        }

        /* 主系統容器 */
        #main-content {
            display: none;
            width: 100%;
            max-width: 1200px;
            flex-direction: column;
            align-items: center;
        }

        .header {
            width: 100%;
            padding: 40px 0;
            text-align: center;
        }

        .header h1 {
            color: var(--text-color);
            margin: 0;
            font-size: 2.5rem;
            font-weight: 700;
        }

        .header h3 {
            color: #6c757d;
            margin: 10px 0 0;
            font-size: 1rem;
            font-weight: 400;
        }

        .container {
            width: 90%;
            max-width: 1200px;
            background-color: var(--white-bg);
            border-radius: 12px;
            box-shadow: 0 10px 30px var(--shadow-color);
            overflow: hidden;
            margin-bottom: 40px;
        }

        .tab-container {
            display: flex;
            justify-content: flex-end;
            padding: 10px;
            background-color: var(--secondary-color);
            border-bottom: 1px solid #dee2e6;
        }

        .tab-button {
            padding: 10px 25px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            background-color: transparent;
            color: var(--text-color);
            border-radius: 50px;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .tab-button::after {
            content: '';
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 3px;
            background-color: transparent;
            transform: translateY(100%);
            transition: all 0.3s ease-out;
        }

        .tab-button:hover::after {
            background-color: var(--primary-color);
            transform: translateY(0);
        }

        .tab-button.active {
            background-color: var(--primary-color);
            color: var(--white-bg);
            box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
        }

        .tab-button.active::after {
            content: none;
        }
        
        .content-container {
            padding: 20px;
        }

        .iframe-wrapper {
            display: none;
            width: 100%;
            height: 600px;
            border-radius: 10px;
            box-shadow: 0 5px 20px var(--shadow-color);
            overflow: hidden;
            transition: all 0.5s ease;
        }
        
        .iframe-wrapper.active {
            display: block;
        }

        iframe {
            width: 100%;
            height: 100%;
            border: none;
        }

        .tab-button-logout {
            background-color: #6c757d;
            color: white;
            transition: background-color 0.3s;
        }
        .tab-button-logout:hover {
            background-color: #5a6268;
        }
    </style>
</head>
<body>

    <div id="login-container">
        <h2>系統登入</h2>
        <form id="loginForm">
            <div class="input-group">
                <label for="username">帳號</label>
                <input type="text" id="username" name="username" placeholder="請輸入帳號" required>
            </div>
            <div class="input-group">
                <label for="password">密碼</label>
                <input type="password" id="password" name="password" placeholder="請輸入密碼" required>
            </div>
            <div class="input-group">
                <label for="captcha">驗證碼</label>
                <div class="captcha-group">
                    <input type="text" id="captcha" name="captcha" placeholder="請輸入驗證碼" required>
                    <span id="captcha-code"></span>
                </div>
            </div>
            <p id="error-message">帳號、密碼或驗證碼錯誤,請重新輸入。</p>
            <button type="submit" id="login-btn">登入</button>
        </form>
    </div>

    <div id="main-content">
        <div class="header">
            <h1>Hugging Face System</h1>
            <h3>cjhuang@2025copyright</h3>
        </div>
        <div class="container">
            <div class="tab-container">
                <button class="tab-button active" onclick="showTab('tab1')">ESG爬蟲</button>
                <button class="tab-button" onclick="showTab('tab2')">GEMINI 對話機器人</button>
                <button class="tab-button tab-button-logout" onclick="goBackToLogin()">回到登入頁面</button>
            </div>
            <div class="content-container">
                <div id="tab1" class="iframe-wrapper active">
                    <iframe
                        src="https://roberta2024-0825esgscraper.hf.space"
                        frameborder="0"
                        width="850"
                        height="450"
                    ></iframe>
                </div>
                <div id="tab2" class="iframe-wrapper">
                    <iframe
                        src="https://roberta2024-geminiapi.hf.space"
                        frameborder="0"
                        width="850"
                        height="450"
                    ></iframe>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 驗證碼相關變數
        let currentCaptcha = '';

        // 生成並顯示驗證碼
        function generateCaptcha() {
            const captchaCode = Math.floor(1000 + Math.random() * 9000).toString(); // 4位數
            currentCaptcha = captchaCode;
            document.getElementById('captcha-code').textContent = captchaCode;
        }

        // 頁籤切換邏輯
        function showTab(tabId) {
            const allIframes = document.querySelectorAll('.iframe-wrapper');
            allIframes.forEach(iframe => {
                iframe.classList.remove('active');
            });

            const allButtons = document.querySelectorAll('.tab-button');
            allButtons.forEach(button => {
                button.classList.remove('active');
            });

            document.getElementById(tabId).classList.add('active');
            document.querySelector(`[onclick="showTab('${tabId}')"]`).classList.add('active');
        }

        // 登入驗證邏輯
        document.getElementById('loginForm').addEventListener('submit', function(event) {
            event.preventDefault();

            const usernameInput = document.getElementById('username').value;
            const passwordInput = document.getElementById('password').value;
            const captchaInput = document.getElementById('captcha').value;
            const errorMessage = document.getElementById('error-message');
            const loginContainer = document.getElementById('login-container');
            const mainContent = document.getElementById('main-content');

            const correctUsername = 'ROOT2025';
            const correctPassword = '123456';

            if (usernameInput === correctUsername && passwordInput === correctPassword && captchaInput === currentCaptcha) {
                // 登入成功
                errorMessage.style.visibility = 'hidden';
                errorMessage.style.opacity = '0';
                
                loginContainer.style.display = 'none';
                mainContent.style.display = 'block';
            } else {
                // 登入失敗
                errorMessage.style.visibility = 'visible';
                errorMessage.style.opacity = '1';
                generateCaptcha(); // 重新生成驗證碼
            }
        });

        // 回到登入頁面函式
        function goBackToLogin() {
            const loginContainer = document.getElementById('login-container');
            const mainContent = document.getElementById('main-content');
            const usernameInput = document.getElementById('username');
            const passwordInput = document.getElementById('password');

            mainContent.style.display = 'none';
            loginContainer.style.display = 'block';
            
            usernameInput.value = '';
            passwordInput.value = '';
            
            generateCaptcha(); // 重新生成驗證碼
        }

        // 網頁加載時,立即生成驗證碼
        document.addEventListener('DOMContentLoaded', generateCaptcha);
    </script>

</body>
</html>