DeepRat commited on
Commit
c47b328
·
verified ·
1 Parent(s): 3adac07

Upload index.html

Browse files
Files changed (1) hide show
  1. static/index.html +221 -0
static/index.html ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TrueEye - Intelligent Media Literacy System</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
9
+ <script>
10
+ tailwind.config = {
11
+ darkMode: 'class',
12
+ theme: {
13
+ extend: {
14
+ colors: {
15
+ primary: '#f6ae2d',
16
+ secondary: '#4a2040',
17
+ dark: '#1a1a1a',
18
+ }
19
+ }
20
+ }
21
+ }
22
+ </script>
23
+ <style>
24
+ .markdown-content a {
25
+ color: #f6ae2d;
26
+ text-decoration: underline;
27
+ }
28
+ .markdown-content h1, .markdown-content h2, .markdown-content h3 {
29
+ color: #f6ae2d;
30
+ margin-top: 1rem;
31
+ margin-bottom: 0.5rem;
32
+ }
33
+ .markdown-content p {
34
+ margin-bottom: 1rem;
35
+ }
36
+ .markdown-content ul, .markdown-content ol {
37
+ margin-left: 1.5rem;
38
+ margin-bottom: 1rem;
39
+ }
40
+ .markdown-content code {
41
+ background-color: rgba(246, 174, 45, 0.2);
42
+ padding: 0.2rem 0.4rem;
43
+ border-radius: 0.25rem;
44
+ }
45
+ .markdown-content pre {
46
+ background-color: rgba(246, 174, 45, 0.1);
47
+ padding: 1rem;
48
+ border-radius: 0.5rem;
49
+ overflow-x: auto;
50
+ margin-bottom: 1rem;
51
+ }
52
+ .markdown-content blockquote {
53
+ border-left: 4px solid #f6ae2d;
54
+ padding-left: 1rem;
55
+ margin-left: 0;
56
+ color: #777;
57
+ margin-bottom: 1rem;
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="bg-gray-100 dark:bg-dark min-h-screen transition-colors duration-300">
62
+ <div class="container mx-auto px-4 py-8 max-w-4xl">
63
+ <header class="flex justify-between items-center mb-8">
64
+ <div>
65
+ <h1 class="text-4xl font-bold text-secondary dark:text-primary">TrueEye</h1>
66
+ <p class="text-lg text-gray-600 dark:text-gray-300">Intelligent Media Literacy System</p>
67
+ </div>
68
+ <button id="theme-toggle" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200">
69
+ <svg id="theme-icon-dark" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
70
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
71
+ </svg>
72
+ <svg id="theme-icon-light" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor">
73
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
74
+ </svg>
75
+ </button>
76
+ </header>
77
+
78
+ <main>
79
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 mb-8 transition-colors duration-300">
80
+ <div class="flex flex-col md:flex-row gap-4">
81
+ <input
82
+ id="input-url"
83
+ type="url"
84
+ placeholder="Enter URL to analyze..."
85
+ class="flex-grow px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-primary dark:bg-gray-700 dark:text-white"
86
+ >
87
+ <button
88
+ id="analyze-btn"
89
+ class="px-6 py-3 bg-primary hover:bg-yellow-500 text-secondary font-semibold rounded-lg transition-colors duration-300 flex items-center justify-center gap-2"
90
+ >
91
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
92
+ <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
93
+ </svg>
94
+ Analyze
95
+ </button>
96
+ </div>
97
+ <div id="error-message" class="mt-2 text-red-500 hidden"></div>
98
+ </div>
99
+
100
+ <div id="loading" class="hidden flex justify-center items-center py-8">
101
+ <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"></div>
102
+ </div>
103
+
104
+ <div id="result-container" class="hidden bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 transition-colors duration-300">
105
+ <h2 class="text-2xl font-semibold text-secondary dark:text-primary mb-4">Analysis Result</h2>
106
+ <div id="result" class="markdown-content text-gray-700 dark:text-gray-300"></div>
107
+ </div>
108
+ </main>
109
+
110
+ <footer class="mt-12 text-center text-gray-500 dark:text-gray-400">
111
+ <p>© 2023 TrueEye. All rights reserved.</p>
112
+ </footer>
113
+ </div>
114
+
115
+ <script>
116
+ // Theme toggle
117
+ const themeToggle = document.getElementById('theme-toggle');
118
+ const themeIconDark = document.getElementById('theme-icon-dark');
119
+ const themeIconLight = document.getElementById('theme-icon-light');
120
+
121
+ if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
122
+ document.documentElement.classList.add('dark');
123
+ themeIconLight.classList.remove('hidden');
124
+ themeIconDark.classList.add('hidden');
125
+ } else {
126
+ document.documentElement.classList.remove('dark');
127
+ themeIconLight.classList.add('hidden');
128
+ themeIconDark.classList.remove('hidden');
129
+ }
130
+
131
+ themeToggle.addEventListener('click', () => {
132
+ if (document.documentElement.classList.contains('dark')) {
133
+ document.documentElement.classList.remove('dark');
134
+ localStorage.setItem('color-theme', 'light');
135
+ themeIconLight.classList.add('hidden');
136
+ themeIconDark.classList.remove('hidden');
137
+ } else {
138
+ document.documentElement.classList.add('dark');
139
+ localStorage.setItem('color-theme', 'dark');
140
+ themeIconLight.classList.remove('hidden');
141
+ themeIconDark.classList.add('hidden');
142
+ }
143
+ });
144
+
145
+ // Analyze functionality
146
+ const analyzeBtn = document.getElementById('analyze-btn');
147
+ const inputUrl = document.getElementById('input-url');
148
+ const resultContainer = document.getElementById('result-container');
149
+ const resultDiv = document.getElementById('result');
150
+ const loadingDiv = document.getElementById('loading');
151
+ const errorMessage = document.getElementById('error-message');
152
+
153
+ analyzeBtn.addEventListener('click', async () => {
154
+ const url = inputUrl.value.trim();
155
+
156
+ if (!url) {
157
+ showError('Please enter a URL');
158
+ return;
159
+ }
160
+
161
+ if (!isValidUrl(url)) {
162
+ showError('Please enter a valid URL (include http:// or https://)');
163
+ return;
164
+ }
165
+
166
+ clearError();
167
+ loadingDiv.classList.remove('hidden');
168
+ resultContainer.classList.add('hidden');
169
+
170
+ try {
171
+ const response = await fetch('/analyze', {
172
+ method: 'POST',
173
+ headers: {
174
+ 'Content-Type': 'application/json',
175
+ },
176
+ body: JSON.stringify({ url })
177
+ });
178
+
179
+ if (!response.ok) {
180
+ throw new Error(`Server returned ${response.status}`);
181
+ }
182
+
183
+ const data = await response.json();
184
+ resultDiv.innerHTML = marked.parse(data.result);
185
+ resultContainer.classList.remove('hidden');
186
+ } catch (error) {
187
+ showError('Failed to analyze URL. Please try again later.');
188
+ console.error('Error:', error);
189
+ } finally {
190
+ loadingDiv.classList.add('hidden');
191
+ }
192
+ });
193
+
194
+ function isValidUrl(string) {
195
+ try {
196
+ new URL(string);
197
+ return true;
198
+ } catch (_) {
199
+ return false;
200
+ }
201
+ }
202
+
203
+ function showError(message) {
204
+ errorMessage.textContent = message;
205
+ errorMessage.classList.remove('hidden');
206
+ }
207
+
208
+ function clearError() {
209
+ errorMessage.textContent = '';
210
+ errorMessage.classList.add('hidden');
211
+ }
212
+
213
+ // Allow pressing Enter in the input field
214
+ inputUrl.addEventListener('keypress', (e) => {
215
+ if (e.key === 'Enter') {
216
+ analyzeBtn.click();
217
+ }
218
+ });
219
+ </script>
220
+ </body>
221
+ </html>