Hma47 commited on
Commit
8a845b2
·
verified ·
1 Parent(s): feca960

Upload 4 files

Browse files
Apache License.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2025 Shift Mind AI Labs
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "🟩 CompareMatrix Pro – Intelligent Content Analysis & Comparison"
3
+ emoji: "🟩"
4
+ colorFrom: "green"
5
+ colorTo: "red"
6
+ sdk: "static"
7
+ sdk_version: "0.1.0"
8
+ app_file: "index.html"
9
+ pinned: false
10
+ ---
11
+
12
+ # 🟩 CompareMatrix Pro – Intelligent Content Analysis & Comparison
13
+ **Developed by Shift Mind AI Labs**
14
+
15
+ CompareMatrix Pro is an open-source, privacy-first platform for deep, professional content comparison and analysis. Instantly generate a visually rich, multi-aspect comparison matrix (with inline HTML/CSS) between any two texts—across 90+ languages—using your own API key for complete privacy.
16
+
17
+ ---
18
+
19
+ ## 🚀 Features
20
+
21
+ - **Multi-Aspect Comparison Matrix:**
22
+ Instantly analyzes two pieces of content and generates a comprehensive comparison table (theme, audience, strengths, weaknesses, structure, etc.).
23
+ - **Professional Visuals:**
24
+ Outputs a fully styled, readable HTML table for copy/paste, reports, or LMS integration.
25
+ - **Any Language, Any Content:**
26
+ Works with essays, reports, articles, student work, business docs—supports 90+ languages.
27
+ - **Instant Translation:**
28
+ Full multilingual UI and output (OpenAI API required, never leaves your device).
29
+ - **Privacy-First:**
30
+ API keys and content never leave your device; no accounts, no server, no tracking.
31
+ - **Responsive, Accessible UI:**
32
+ Clean, modern design, keyboard shortcuts, and RTL support.
33
+
34
+ ---
35
+
36
+ ## 🛠 How to Use
37
+
38
+ 1. **Open the tool** in your browser (no installation or login).
39
+ 2. **Choose your language** and enter your OpenAI API key (used only locally).
40
+ 3. **Paste or type Content A and Content B** (minimum 50 characters each).
41
+ 4. **Click “Generate Intelligent Comparison Matrix”** (or press Ctrl+Enter).
42
+ 5. **View and copy** the full HTML comparison table for your needs.
43
+ 6. **Switch language** or clear translation cache at any time.
44
+
45
+ ---
46
+
47
+ ## 👩‍🏫 For Educators: Classroom & PD Applications
48
+
49
+ - **Compare student assignments, drafts, or model answers.**
50
+ - **Support formative assessment** and feedback—show differences in arguments, style, evidence, and clarity.
51
+ - **Use as a collaborative activity**—students compare sources, news, or projects.
52
+ - **Professional development:** Analyze lesson plans, emails, or communications.
53
+ - **Multilingual feedback:** Instantly translate for ELLs or international programs.
54
+
55
+ ---
56
+
57
+ ## 👨‍🎓 For Students: Learning Benefits
58
+
59
+ - **Critical Thinking:**
60
+ See strengths/weaknesses, organization, and unique features side by side.
61
+ - **Self-Assessment:**
62
+ Compare your work with exemplars or peers and reflect on improvements.
63
+ - **Cross-Language Comparison:**
64
+ Supports native language and English—great for bilingual classes.
65
+
66
+ ---
67
+
68
+ ## 🔐 Data Privacy
69
+
70
+ - Your API key and all content remain **only in your browser**.
71
+ - Nothing is transmitted to Shift Mind AI Labs, Hugging Face, or any third party.
72
+
73
+ ---
74
+
75
+ ## 📄 License
76
+
77
+ Licensed under the [Apache License 2.0](./LICENSE).
78
+
79
+ ---
80
+
81
+ ## 🧠 About Shift Mind AI Labs
82
+
83
+ Shift Mind AI Labs builds open-source, ethical AI tools for global education, analysis, and lifelong learning.
84
+
85
+ 🌐 https://www.shiftmind.io
86
+ ✉️ info@shiftmind.io
87
+
88
+ ---
89
+
90
+ ## 🙌 Contributing
91
+
92
+ Pull requests, suggestions, and partnerships are welcome!
93
+ For school pilots, integrations, or research: **info@shiftmind.io**
94
+
95
+ ---
96
+
97
+ *Transforming content comparison for education, research, and professional analysis—securely and accessibly.*
index.html ADDED
@@ -0,0 +1,1573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" dir="ltr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>CompareMatrix Pro - Intelligent Content Analysis</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7
+ <style>
8
+ :root {
9
+ --primary: #059669;
10
+ --secondary: #10b981;
11
+ --accent: #34d399;
12
+ --background: #f8fafc;
13
+ --surface: #ffffff;
14
+ --text: #1e293b;
15
+ --text-secondary: #64748b;
16
+ --border: #e2e8f0;
17
+ --success: #10b981;
18
+ --warning: #f59e0b;
19
+ --error: #ef4444;
20
+ --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
21
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
22
+ }
23
+
24
+ * {
25
+ box-sizing: border-box;
26
+ margin: 0;
27
+ padding: 0;
28
+ }
29
+
30
+ body {
31
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
32
+ background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
33
+ color: var(--text);
34
+ line-height: 1.6;
35
+ min-height: 100vh;
36
+ padding: 15px;
37
+ transition: all 0.3s ease;
38
+ }
39
+
40
+ /* RTL Support */
41
+ [dir="rtl"] {
42
+ text-align: right;
43
+ }
44
+
45
+ [dir="rtl"] .container {
46
+ direction: rtl;
47
+ }
48
+
49
+ [dir="rtl"] .api-key-section {
50
+ margin: 15px 15px 15px auto;
51
+ }
52
+
53
+ [dir="rtl"] .content-grid {
54
+ direction: rtl;
55
+ }
56
+
57
+ [dir="rtl"] .generate-btn {
58
+ direction: rtl;
59
+ }
60
+
61
+ /* Language Selection Landing */
62
+ .language-landing {
63
+ display: block;
64
+ max-width: 600px;
65
+ margin: 50px auto;
66
+ background: var(--surface);
67
+ border-radius: 16px;
68
+ box-shadow: var(--shadow-lg);
69
+ padding: 40px;
70
+ text-align: center;
71
+ }
72
+
73
+ .language-landing h1 {
74
+ font-size: 2.5rem;
75
+ font-weight: 800;
76
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
77
+ -webkit-background-clip: text;
78
+ -webkit-text-fill-color: transparent;
79
+ background-clip: text;
80
+ margin-bottom: 15px;
81
+ }
82
+
83
+ .language-landing p {
84
+ font-size: 1.1rem;
85
+ color: var(--text-secondary);
86
+ margin-bottom: 30px;
87
+ }
88
+
89
+ .language-selector {
90
+ margin-bottom: 25px;
91
+ }
92
+
93
+ .language-selector label {
94
+ display: block;
95
+ margin-bottom: 10px;
96
+ font-weight: 600;
97
+ color: var(--text);
98
+ font-size: 1.1rem;
99
+ }
100
+
101
+ .language-selector select {
102
+ width: 100%;
103
+ padding: 15px 20px;
104
+ border: 2px solid var(--border);
105
+ border-radius: 12px;
106
+ font-size: 1.1rem;
107
+ font-family: inherit;
108
+ background: var(--surface);
109
+ transition: all 0.2s ease;
110
+ margin-bottom: 20px;
111
+ }
112
+
113
+ .language-selector select:focus {
114
+ outline: none;
115
+ border-color: var(--primary);
116
+ box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
117
+ }
118
+
119
+ .api-key-landing {
120
+ margin-bottom: 25px;
121
+ }
122
+
123
+ .api-key-landing label {
124
+ display: block;
125
+ margin-bottom: 10px;
126
+ font-weight: 600;
127
+ color: var(--text);
128
+ font-size: 1.1rem;
129
+ }
130
+
131
+ .api-key-landing input {
132
+ width: 100%;
133
+ padding: 15px 20px;
134
+ border: 2px solid var(--border);
135
+ border-radius: 12px;
136
+ font-size: 1.1rem;
137
+ background: var(--surface);
138
+ transition: all 0.2s ease;
139
+ font-family: 'Courier New', monospace;
140
+ }
141
+
142
+ .api-key-landing input:focus {
143
+ outline: none;
144
+ border-color: var(--primary);
145
+ box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
146
+ }
147
+
148
+ .start-btn {
149
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
150
+ color: white;
151
+ padding: 18px 40px;
152
+ border: none;
153
+ border-radius: 12px;
154
+ font-size: 1.2rem;
155
+ font-weight: 700;
156
+ cursor: pointer;
157
+ transition: all 0.3s ease;
158
+ width: 100%;
159
+ }
160
+
161
+ .start-btn:hover {
162
+ transform: translateY(-2px);
163
+ box-shadow: 0 12px 24px -8px rgba(5, 150, 105, 0.4);
164
+ }
165
+
166
+ .start-btn:disabled {
167
+ opacity: 0.7;
168
+ cursor: not-allowed;
169
+ transform: none;
170
+ }
171
+
172
+ /* Cache Management Section */
173
+ .cache-management {
174
+ background: rgba(5, 150, 105, 0.05);
175
+ border: 1px solid rgba(5, 150, 105, 0.1);
176
+ border-radius: 12px;
177
+ padding: 20px;
178
+ margin-bottom: 25px;
179
+ text-align: center;
180
+ }
181
+
182
+ .cache-management h3 {
183
+ color: var(--primary);
184
+ margin-bottom: 15px;
185
+ font-size: 1.1rem;
186
+ font-weight: 600;
187
+ }
188
+
189
+ .cache-status-display {
190
+ background: rgba(16, 185, 129, 0.1);
191
+ border: 1px solid rgba(16, 185, 129, 0.2);
192
+ color: var(--success);
193
+ padding: 12px 16px;
194
+ border-radius: 8px;
195
+ margin-bottom: 15px;
196
+ font-size: 0.9rem;
197
+ font-weight: 500;
198
+ }
199
+
200
+ .cache-status-display.no-cache {
201
+ background: rgba(100, 116, 139, 0.1);
202
+ border-color: rgba(100, 116, 139, 0.2);
203
+ color: var(--text-secondary);
204
+ }
205
+
206
+ .clear-cache-btn {
207
+ background: linear-gradient(135deg, var(--warning) 0%, #f59e0b 100%);
208
+ color: white;
209
+ padding: 12px 24px;
210
+ border: none;
211
+ border-radius: 8px;
212
+ font-size: 0.9rem;
213
+ font-weight: 600;
214
+ cursor: pointer;
215
+ transition: all 0.3s ease;
216
+ }
217
+
218
+ .clear-cache-btn:hover {
219
+ transform: translateY(-1px);
220
+ box-shadow: 0 6px 12px -4px rgba(245, 158, 11, 0.4);
221
+ }
222
+
223
+ .clear-cache-btn:disabled {
224
+ opacity: 0.5;
225
+ cursor: not-allowed;
226
+ transform: none;
227
+ }
228
+
229
+ /* Cache Status Indicator */
230
+ .cache-status {
231
+ background: rgba(16, 185, 129, 0.1);
232
+ border: 1px solid rgba(16, 185, 129, 0.2);
233
+ color: var(--success);
234
+ padding: 8px 12px;
235
+ border-radius: 6px;
236
+ margin-bottom: 15px;
237
+ font-size: 0.85rem;
238
+ text-align: center;
239
+ font-weight: 500;
240
+ display: none;
241
+ }
242
+
243
+ .cache-status.cached {
244
+ display: block;
245
+ }
246
+
247
+ .cache-status.translating {
248
+ background: rgba(5, 150, 105, 0.1);
249
+ border-color: rgba(5, 150, 105, 0.2);
250
+ color: var(--primary);
251
+ }
252
+
253
+ /* Translation Loading Overlay */
254
+ .translation-overlay {
255
+ position: fixed;
256
+ top: 0;
257
+ left: 0;
258
+ width: 100%;
259
+ height: 100%;
260
+ background: rgba(5, 150, 105, 0.9);
261
+ display: none;
262
+ justify-content: center;
263
+ align-items: center;
264
+ z-index: 10000;
265
+ color: white;
266
+ text-align: center;
267
+ }
268
+
269
+ .translation-content {
270
+ background: rgba(255, 255, 255, 0.1);
271
+ padding: 40px;
272
+ border-radius: 16px;
273
+ backdrop-filter: blur(10px);
274
+ }
275
+
276
+ .translation-spinner {
277
+ width: 50px;
278
+ height: 50px;
279
+ border: 4px solid rgba(255, 255, 255, 0.3);
280
+ border-radius: 50%;
281
+ border-top-color: white;
282
+ animation: spin 1s ease-in-out infinite;
283
+ margin: 0 auto 20px;
284
+ }
285
+
286
+ /* Main Application (Hidden Initially) */
287
+ .main-app {
288
+ display: none;
289
+ }
290
+
291
+ .container {
292
+ max-width: 1000px;
293
+ margin: 0 auto;
294
+ background: var(--surface);
295
+ border-radius: 16px;
296
+ box-shadow: var(--shadow-lg);
297
+ overflow: hidden;
298
+ position: relative;
299
+ }
300
+
301
+ /* API Key Section - Static Position Top Left */
302
+ .api-key-section {
303
+ background: rgba(5, 150, 105, 0.05);
304
+ border: 1px solid rgba(5, 150, 105, 0.1);
305
+ border-radius: 8px;
306
+ padding: 12px;
307
+ margin: 15px;
308
+ max-width: 280px;
309
+ }
310
+
311
+ .api-key-section label {
312
+ font-size: 12px;
313
+ font-weight: 600;
314
+ color: var(--primary);
315
+ margin-bottom: 6px;
316
+ display: block;
317
+ }
318
+
319
+ .api-key-section input {
320
+ width: 100%;
321
+ padding: 8px 12px;
322
+ border: 1px solid var(--border);
323
+ border-radius: 6px;
324
+ font-size: 14px;
325
+ background: var(--surface);
326
+ transition: all 0.2s ease;
327
+ font-family: 'Courier New', monospace;
328
+ }
329
+
330
+ .api-key-section input:focus {
331
+ outline: none;
332
+ border-color: var(--primary);
333
+ box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
334
+ }
335
+
336
+ /* Language Switcher in Main App */
337
+ .language-switcher {
338
+ position: absolute;
339
+ top: 15px;
340
+ right: 15px;
341
+ display: flex;
342
+ gap: 10px;
343
+ align-items: center;
344
+ }
345
+
346
+ [dir="rtl"] .language-switcher {
347
+ right: auto;
348
+ left: 15px;
349
+ }
350
+
351
+ .language-switch-btn {
352
+ background: rgba(5, 150, 105, 0.05);
353
+ border: 1px solid rgba(5, 150, 105, 0.1);
354
+ border-radius: 8px;
355
+ padding: 8px 12px;
356
+ font-size: 12px;
357
+ cursor: pointer;
358
+ transition: all 0.2s ease;
359
+ color: var(--primary);
360
+ font-weight: 500;
361
+ }
362
+
363
+ .language-switch-btn:hover {
364
+ background: rgba(5, 150, 105, 0.1);
365
+ }
366
+
367
+ .mini-clear-cache {
368
+ background: rgba(245, 158, 11, 0.1);
369
+ border: 1px solid rgba(245, 158, 11, 0.2);
370
+ color: var(--warning);
371
+ padding: 6px 10px;
372
+ border-radius: 6px;
373
+ font-size: 11px;
374
+ cursor: pointer;
375
+ transition: all 0.2s ease;
376
+ font-weight: 500;
377
+ }
378
+
379
+ .mini-clear-cache:hover {
380
+ background: rgba(245, 158, 11, 0.2);
381
+ }
382
+
383
+ /* Main Content */
384
+ .main-content {
385
+ padding: 20px 30px 30px;
386
+ }
387
+
388
+ /* Header */
389
+ .header {
390
+ text-align: center;
391
+ margin-bottom: 25px;
392
+ padding-bottom: 20px;
393
+ border-bottom: 2px solid var(--border);
394
+ }
395
+
396
+ .header h1 {
397
+ font-size: 2.5rem;
398
+ font-weight: 800;
399
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
400
+ -webkit-background-clip: text;
401
+ -webkit-text-fill-color: transparent;
402
+ background-clip: text;
403
+ margin-bottom: 8px;
404
+ }
405
+
406
+ .header .subtitle {
407
+ font-size: 1.1rem;
408
+ color: var(--text-secondary);
409
+ font-weight: 500;
410
+ }
411
+
412
+ /* Content Input Sections */
413
+ .content-grid {
414
+ display: grid;
415
+ grid-template-columns: 1fr 1fr;
416
+ gap: 20px;
417
+ margin-bottom: 25px;
418
+ }
419
+
420
+ .content-section {
421
+ background: var(--surface);
422
+ border: 1px solid var(--border);
423
+ border-radius: 12px;
424
+ padding: 20px;
425
+ transition: all 0.3s ease;
426
+ box-shadow: var(--shadow);
427
+ }
428
+
429
+ .content-section:hover {
430
+ border-color: var(--primary);
431
+ box-shadow: 0 8px 25px -8px rgba(5, 150, 105, 0.3);
432
+ }
433
+
434
+ .content-section h3 {
435
+ font-size: 1.1rem;
436
+ font-weight: 700;
437
+ color: var(--primary);
438
+ margin-bottom: 8px;
439
+ display: flex;
440
+ align-items: center;
441
+ gap: 8px;
442
+ }
443
+
444
+ .content-section .description {
445
+ font-size: 0.9rem;
446
+ color: var(--text-secondary);
447
+ margin-bottom: 12px;
448
+ }
449
+
450
+ /* Form Elements */
451
+ label {
452
+ display: block;
453
+ margin-bottom: 6px;
454
+ font-weight: 600;
455
+ color: var(--text);
456
+ font-size: 0.95rem;
457
+ }
458
+
459
+ textarea {
460
+ width: 100%;
461
+ padding: 12px 16px;
462
+ border: 2px solid var(--border);
463
+ border-radius: 8px;
464
+ font-size: 1rem;
465
+ font-family: inherit;
466
+ background: var(--surface);
467
+ transition: all 0.2s ease;
468
+ resize: vertical;
469
+ min-height: 120px;
470
+ }
471
+
472
+ textarea:focus {
473
+ outline: none;
474
+ border-color: var(--primary);
475
+ box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
476
+ }
477
+
478
+ /* Character Counter */
479
+ .char-counter {
480
+ font-size: 0.8rem;
481
+ color: var(--text-secondary);
482
+ text-align: right;
483
+ margin-top: 4px;
484
+ }
485
+
486
+ [dir="rtl"] .char-counter {
487
+ text-align: left;
488
+ }
489
+
490
+ /* Generate Button */
491
+ .generate-btn {
492
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
493
+ color: white;
494
+ padding: 16px 32px;
495
+ border: none;
496
+ border-radius: 12px;
497
+ font-size: 1.1rem;
498
+ font-weight: 700;
499
+ cursor: pointer;
500
+ transition: all 0.3s ease;
501
+ display: block;
502
+ margin: 25px auto;
503
+ min-width: 250px;
504
+ position: relative;
505
+ overflow: hidden;
506
+ }
507
+
508
+ .generate-btn:hover {
509
+ transform: translateY(-2px);
510
+ box-shadow: 0 12px 24px -8px rgba(5, 150, 105, 0.4);
511
+ }
512
+
513
+ .generate-btn:active {
514
+ transform: translateY(0);
515
+ }
516
+
517
+ .generate-btn:disabled {
518
+ opacity: 0.7;
519
+ cursor: not-allowed;
520
+ transform: none;
521
+ }
522
+
523
+ /* Loading Spinner */
524
+ .spinner {
525
+ display: none;
526
+ width: 20px;
527
+ height: 20px;
528
+ border: 2px solid rgba(255, 255, 255, 0.3);
529
+ border-radius: 50%;
530
+ border-top-color: white;
531
+ animation: spin 1s ease-in-out infinite;
532
+ margin-right: 8px;
533
+ }
534
+
535
+ [dir="rtl"] .spinner {
536
+ margin-right: 0;
537
+ margin-left: 8px;
538
+ }
539
+
540
+ @keyframes spin {
541
+ to { transform: rotate(360deg); }
542
+ }
543
+
544
+ /* Output Section */
545
+ .output-section {
546
+ margin-top: 30px;
547
+ }
548
+
549
+ .output-section h2 {
550
+ font-size: 1.5rem;
551
+ font-weight: 700;
552
+ color: var(--primary);
553
+ margin-bottom: 15px;
554
+ display: flex;
555
+ align-items: center;
556
+ gap: 8px;
557
+ }
558
+
559
+ .output-area {
560
+ background: var(--surface);
561
+ border: 2px solid var(--border);
562
+ border-radius: 12px;
563
+ padding: 20px;
564
+ min-height: 200px;
565
+ transition: all 0.3s ease;
566
+ position: relative;
567
+ overflow-x: auto;
568
+ }
569
+
570
+ .output-area:empty::before {
571
+ content: "Your detailed comparison matrix will appear here...";
572
+ color: var(--text-secondary);
573
+ font-style: italic;
574
+ }
575
+
576
+ /* Matrix Table Styling */
577
+ .output-area table {
578
+ width: 100%;
579
+ border-collapse: collapse;
580
+ margin: 0;
581
+ font-family: inherit;
582
+ }
583
+
584
+ .output-area th,
585
+ .output-area td {
586
+ padding: 12px 16px;
587
+ text-align: left;
588
+ border: 1px solid var(--border);
589
+ }
590
+
591
+ .output-area th {
592
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
593
+ color: white;
594
+ font-weight: 600;
595
+ }
596
+
597
+ .output-area tr:nth-child(even) {
598
+ background: rgba(5, 150, 105, 0.02);
599
+ }
600
+
601
+ .output-area tr:hover {
602
+ background: rgba(5, 150, 105, 0.05);
603
+ }
604
+
605
+ /* Error Messages */
606
+ .error-message {
607
+ background: rgba(239, 68, 68, 0.1);
608
+ border: 1px solid rgba(239, 68, 68, 0.2);
609
+ color: var(--error);
610
+ padding: 12px 16px;
611
+ border-radius: 8px;
612
+ margin: 10px 0;
613
+ font-size: 0.9rem;
614
+ display: none;
615
+ }
616
+
617
+ /* Footer */
618
+ .footer {
619
+ text-align: center;
620
+ padding: 20px;
621
+ background: rgba(5, 150, 105, 0.05);
622
+ border-top: 1px solid var(--border);
623
+ color: var(--text-secondary);
624
+ font-size: 0.9rem;
625
+ }
626
+
627
+ /* Responsive Design */
628
+ @media (max-width: 768px) {
629
+ body {
630
+ padding: 10px;
631
+ }
632
+
633
+ .language-landing {
634
+ margin: 20px auto;
635
+ padding: 30px 20px;
636
+ }
637
+
638
+ .api-key-section {
639
+ margin: 10px;
640
+ max-width: none;
641
+ }
642
+
643
+ .language-switcher {
644
+ position: relative;
645
+ top: auto;
646
+ right: auto;
647
+ margin-bottom: 15px;
648
+ justify-content: center;
649
+ }
650
+
651
+ .main-content {
652
+ padding: 15px 20px 20px;
653
+ }
654
+
655
+ .header h1 {
656
+ font-size: 2rem;
657
+ }
658
+
659
+ .content-grid {
660
+ grid-template-columns: 1fr;
661
+ gap: 15px;
662
+ }
663
+
664
+ .content-section {
665
+ padding: 15px;
666
+ }
667
+
668
+ .generate-btn {
669
+ width: 100%;
670
+ margin: 20px 0;
671
+ }
672
+
673
+ .output-area {
674
+ padding: 15px;
675
+ }
676
+ }
677
+
678
+ @media (max-width: 480px) {
679
+ .language-landing h1 {
680
+ font-size: 2rem;
681
+ }
682
+
683
+ .header h1 {
684
+ font-size: 1.8rem;
685
+ }
686
+
687
+ .content-section {
688
+ padding: 12px;
689
+ }
690
+ }
691
+
692
+ /* Dark mode support */
693
+ @media (prefers-color-scheme: dark) {
694
+ :root {
695
+ --background: #0f172a;
696
+ --surface: #1e293b;
697
+ --text: #f1f5f9;
698
+ --text-secondary: #94a3b8;
699
+ --border: #334155;
700
+ }
701
+
702
+ body {
703
+ background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
704
+ }
705
+ }
706
+ </style>
707
+ </head>
708
+ <body>
709
+ <!-- Translation Loading Overlay -->
710
+ <div class="translation-overlay" id="translationOverlay">
711
+ <div class="translation-content">
712
+ <div class="translation-spinner"></div>
713
+ <h2 id="translationTitle">Translating Interface...</h2>
714
+ <p id="translationMessage">Please wait while we translate the interface to your selected language.</p>
715
+ </div>
716
+ </div>
717
+
718
+ <!-- Language Selection Landing Page -->
719
+ <div class="language-landing" id="languageLanding">
720
+ <h1 data-translate="app_title">CompareMatrix Pro</h1>
721
+ <p data-translate="welcome_message">Welcome! Please select your preferred language and enter your API key to get started.</p>
722
+
723
+ <!-- Cache Status Indicator -->
724
+ <div class="cache-status" id="cacheStatus">
725
+ 💾 Translations cached - instant loading!
726
+ </div>
727
+
728
+ <!-- Cache Management Section -->
729
+ <div class="cache-management" id="cacheManagement">
730
+ <h3 data-translate="cache_management_title">🗂️ Translation Cache Management</h3>
731
+ <div class="cache-status-display" id="cacheStatusDisplay">
732
+ <span data-translate="cache_status_checking">Checking cache status...</span>
733
+ </div>
734
+ <button class="clear-cache-btn" id="clearCacheBtn" data-translate="clear_cache_button">
735
+ 🗑️ Clear All Cached Translations
736
+ </button>
737
+ </div>
738
+
739
+ <div class="language-selector">
740
+ <label for="languageSelect" data-translate="select_language">🌐 Select Language</label>
741
+ <select id="languageSelect">
742
+ <option value="en">🇺🇸 English</option>
743
+ <option value="es">🇪🇸 Español (Spanish)</option>
744
+ <option value="fr">🇫🇷 Français (French)</option>
745
+ <option value="de">🇩🇪 Deutsch (German)</option>
746
+ <option value="zh">🇨🇳 中文 (Chinese)</option>
747
+ <option value="ja">🇯🇵 日本語 (Japanese)</option>
748
+ <option value="ko">🇰🇷 한국어 (Korean)</option>
749
+ <option value="pt">🇵🇹 Português (Portuguese)</option>
750
+ <option value="it">🇮🇹 Italiano (Italian)</option>
751
+ <option value="ar">🇸🇦 العربية (Arabic)</option>
752
+ <option value="ru">🇷🇺 Русский (Russian)</option>
753
+ <option value="hi">🇮🇳 हिन्दी (Hindi)</option>
754
+ <option value="bn">🇧🇩 বাংলা (Bengali)</option>
755
+ <option value="ur">🇵🇰 اردو (Urdu)</option>
756
+ <option value="tr">🇹🇷 Türkçe (Turkish)</option>
757
+ <option value="pl">🇵🇱 Polski (Polish)</option>
758
+ <option value="nl">🇳🇱 Nederlands (Dutch)</option>
759
+ <option value="sv">🇸🇪 Svenska (Swedish)</option>
760
+ <option value="da">🇩🇰 Dansk (Danish)</option>
761
+ <option value="no">🇳🇴 Norsk (Norwegian)</option>
762
+ <option value="fi">🇫🇮 Suomi (Finnish)</option>
763
+ <option value="is">🇮🇸 Íslenska (Icelandic)</option>
764
+ <option value="cs">🇨🇿 Čeština (Czech)</option>
765
+ <option value="sk">🇸🇰 Slovenčina (Slovak)</option>
766
+ <option value="hu">🇭🇺 Magyar (Hungarian)</option>
767
+ <option value="ro">🇷🇴 Română (Romanian)</option>
768
+ <option value="bg">🇧🇬 Български (Bulgarian)</option>
769
+ <option value="hr">🇭🇷 Hrvatski (Croatian)</option>
770
+ <option value="sr">🇷🇸 Српски (Serbian)</option>
771
+ <option value="sl">🇸🇮 Slovenščina (Slovenian)</option>
772
+ <option value="mk">🇲🇰 Македонски (Macedonian)</option>
773
+ <option value="sq">🇦🇱 Shqip (Albanian)</option>
774
+ <option value="lv">🇱🇻 Latviešu (Latvian)</option>
775
+ <option value="lt">🇱🇹 Lietuvių (Lithuanian)</option>
776
+ <option value="et">🇪🇪 Eesti (Estonian)</option>
777
+ <option value="mt">🇲🇹 Malti (Maltese)</option>
778
+ <option value="ga">🇮🇪 Gaeilge (Irish)</option>
779
+ <option value="cy">🏴󠁧󠁢󠁷󠁬󠁳󠁿 Cymraeg (Welsh)</option>
780
+ <option value="eu">🏴󠁥󠁳󠁰󠁶󠁿 Euskera (Basque)</option>
781
+ <option value="ca">🏴󠁥󠁳󠁣󠁴󠁿 Català (Catalan)</option>
782
+ <option value="gl">🏴󠁥󠁳󠁧󠁡󠁿 Galego (Galician)</option>
783
+ <option value="el">🇬🇷 Ελληνικά (Greek)</option>
784
+ <option value="he">🇮🇱 עברית (Hebrew)</option>
785
+ <option value="fa">🇮🇷 فارسی (Persian)</option>
786
+ <option value="ps">🇦🇫 پښتو (Pashto)</option>
787
+ <option value="ku">🏴󠁩󠁱󠁫󠁲󠁿 کوردی (Kurdish)</option>
788
+ <option value="az">🇦🇿 Azərbaycan (Azerbaijani)</option>
789
+ <option value="kk">🇰🇿 Қазақша (Kazakh)</option>
790
+ <option value="ky">🇰🇬 Кыргызча (Kyrgyz)</option>
791
+ <option value="uz">🇺🇿 O'zbek (Uzbek)</option>
792
+ <option value="tk">🇹🇲 Türkmen (Turkmen)</option>
793
+ <option value="tg">🇹🇯 Тоҷикӣ (Tajik)</option>
794
+ <option value="mn">🇲🇳 Монгол (Mongolian)</option>
795
+ <option value="ka">🇬🇪 ქართული (Georgian)</option>
796
+ <option value="hy">🇦🇲 Հայերեն (Armenian)</option>
797
+ <option value="th">🇹🇭 ไทย (Thai)</option>
798
+ <option value="vi">🇻🇳 Tiếng Việt (Vietnamese)</option>
799
+ <option value="lo">🇱🇦 ລາວ (Lao)</option>
800
+ <option value="km">🇰🇭 ខ្មែរ (Khmer)</option>
801
+ <option value="my">🇲🇲 မြန်မာ (Myanmar)</option>
802
+ <option value="si">🇱🇰 සිංහල (Sinhala)</option>
803
+ <option value="ta">🇱🇰 தமிழ் (Tamil)</option>
804
+ <option value="te">🇮🇳 తెలుగు (Telugu)</option>
805
+ <option value="kn">🇮🇳 ಕನ್ನಡ (Kannada)</option>
806
+ <option value="ml">🇮🇳 മലയാളം (Malayalam)</option>
807
+ <option value="gu">🇮🇳 ગુજરાતી (Gujarati)</option>
808
+ <option value="pa">🇮🇳 ਪੰਜਾਬੀ (Punjabi)</option>
809
+ <option value="or">🇮🇳 ଓଡ଼ିଆ (Odia)</option>
810
+ <option value="as">🇮🇳 অসমীয়া (Assamese)</option>
811
+ <option value="ne">🇳🇵 नेपाली (Nepali)</option>
812
+ <option value="dz">🇧🇹 རྫོང་ཁ (Dzongkha)</option>
813
+ <option value="bo">🏔️ བོད་ཡིག (Tibetan)</option>
814
+ <option value="id">🇮🇩 Bahasa Indonesia</option>
815
+ <option value="ms">🇲🇾 Bahasa Melayu (Malay)</option>
816
+ <option value="tl">🇵🇭 Filipino (Tagalog)</option>
817
+ <option value="ceb">🇵🇭 Cebuano</option>
818
+ <option value="haw">🏝️ ʻŌlelo Hawaiʻi (Hawaiian)</option>
819
+ <option value="mi">🇳🇿 Te Reo Māori (Maori)</option>
820
+ <option value="sm">🇼🇸 Gagana Samoa (Samoan)</option>
821
+ <option value="to">🇹🇴 Lea Fakatonga (Tongan)</option>
822
+ <option value="fj">🇫🇯 Na Vosa Vakaviti (Fijian)</option>
823
+ <option value="mg">🇲🇬 Malagasy</option>
824
+ <option value="sw">🇰🇪 Kiswahili (Swahili)</option>
825
+ <option value="zu">🇿🇦 isiZulu (Zulu)</option>
826
+ <option value="xh">🇿🇦 isiXhosa (Xhosa)</option>
827
+ <option value="af">🇿🇦 Afrikaans</option>
828
+ <option value="st">🇱🇸 Sesotho (Southern Sotho)</option>
829
+ <option value="tn">🇧🇼 Setswana (Tswana)</option>
830
+ <option value="ss">🇸🇿 siSwati (Swati)</option>
831
+ <option value="ve">🇿🇦 Tshivenḓa (Venda)</option>
832
+ <option value="ts">🇿🇦 Xitsonga (Tsonga)</option>
833
+ <option value="nr">🇿🇦 isiNdebele (Southern Ndebele)</option>
834
+ <option value="am">🇪🇹 አማርኛ (Amharic)</option>
835
+ <option value="ti">🇪🇷 ትግርኛ (Tigrinya)</option>
836
+ <option value="om">🇪🇹 Afaan Oromoo (Oromo)</option>
837
+ <option value="so">🇸🇴 Soomaali (Somali)</option>
838
+ <option value="ha">🇳🇬 Hausa</option>
839
+ <option value="yo">🇳🇬 Yorùbá (Yoruba)</option>
840
+ <option value="ig">🇳🇬 Igbo</option>
841
+ <option value="ff">🇸🇳 Fulfulde (Fulani)</option>
842
+ <option value="wo">🇸🇳 Wolof</option>
843
+ <option value="bm">🇲🇱 Bamanankan (Bambara)</option>
844
+ <option value="rn">🇧🇮 Kirundi (Rundi)</option>
845
+ <option value="rw">🇷🇼 Kinyarwanda (Rwanda)</option>
846
+ <option value="lg">🇺🇬 Luganda</option>
847
+ <option value="ny">🇲🇼 Chichewa (Nyanja)</option>
848
+ <option value="sn">🇿🇼 chiShona (Shona)</option>
849
+ <option value="nd">🇿🇼 isiNdebele (Northern Ndebele)</option>
850
+ </select>
851
+ </div>
852
+
853
+ <div class="api-key-landing">
854
+ <label for="apiKeyLanding" data-translate="api_key_label">🔑 OpenAI API Key</label>
855
+ <input type="password" id="apiKeyLanding" placeholder="Enter your OpenAI API key" data-translate-placeholder="api_key_placeholder">
856
+ </div>
857
+
858
+ <button class="start-btn" id="startBtn" data-translate="start_button">🚀 Start Content Analysis</button>
859
+ </div>
860
+
861
+ <!-- Main Application -->
862
+ <div class="main-app" id="mainApp">
863
+ <div class="container">
864
+ <!-- Language Switcher -->
865
+ <div class="language-switcher" id="languageSwitcher">
866
+ <div class="language-switch-btn" onclick="showLanguageLanding()">
867
+ <span data-translate="change_language">🌐 Change Language</span>
868
+ </div>
869
+ <div class="mini-clear-cache" onclick="clearAllTranslationCache()" title="Clear translation cache">
870
+ <span data-translate="clear_cache_mini">🗑️ Clear Cache</span>
871
+ </div>
872
+ </div>
873
+
874
+ <!-- API Key Section - Static Position Top Left -->
875
+ <div class="api-key-section">
876
+ <label for="apiKey" data-translate="api_key_short">🔑 API Key</label>
877
+ <input type="password" id="apiKey" data-translate-placeholder="api_key_placeholder" autocomplete="off">
878
+ </div>
879
+
880
+ <div class="main-content">
881
+ <!-- Header -->
882
+ <div class="header">
883
+ <h1 data-translate="app_title">CompareMatrix Pro</h1>
884
+ <p class="subtitle" data-translate="app_subtitle">Intelligent Content Analysis & Comparison Platform</p>
885
+ </div>
886
+
887
+ <!-- Content Input Grid -->
888
+ <div class="content-grid">
889
+ <div class="content-section">
890
+ <h3 data-translate="content_a_title">📄 Content A</h3>
891
+ <p class="description" data-translate="content_a_desc">Enter the first piece of content for comparison</p>
892
+ <textarea id="content1" data-translate-placeholder="content_a_placeholder" required></textarea>
893
+ <div class="char-counter" id="counter1">0 <span data-translate="characters">characters</span></div>
894
+ </div>
895
+
896
+ <div class="content-section">
897
+ <h3 data-translate="content_b_title">📄 Content B</h3>
898
+ <p class="description" data-translate="content_b_desc">Enter the second piece of content for comparison</p>
899
+ <textarea id="content2" data-translate-placeholder="content_b_placeholder" required></textarea>
900
+ <div class="char-counter" id="counter2">0 <span data-translate="characters">characters</span></div>
901
+ </div>
902
+ </div>
903
+
904
+ <!-- Error Message -->
905
+ <div class="error-message" id="errorMessage"></div>
906
+
907
+ <!-- Generate Button -->
908
+ <button class="generate-btn" id="generateMatrixBtn">
909
+ <span class="spinner" id="spinner"></span>
910
+ <span id="buttonText" data-translate="generate_button">🔍 Generate Intelligent Comparison Matrix</span>
911
+ </button>
912
+
913
+ <!-- Output Section -->
914
+ <div class="output-section">
915
+ <h2 data-translate="output_title">📊 Comparison Matrix Results</h2>
916
+ <div class="output-area" id="matrixOutput"></div>
917
+ </div>
918
+ </div>
919
+
920
+ <!-- Footer -->
921
+ <div class="footer">
922
+ Created by Shift Mind AI Labs
923
+ </div>
924
+ </div>
925
+ </div>
926
+
927
+ <script>
928
+ // RTL languages list
929
+ const rtlLanguages = ['ar', 'he', 'fa', 'ur', 'ps', 'ku'];
930
+
931
+ // Current language and API key
932
+ let currentLanguage = 'en';
933
+ let currentApiKey = '';
934
+
935
+ // Language names mapping
936
+ const languageNames = {
937
+ en: 'English', es: 'Spanish', fr: 'French', de: 'German', zh: 'Chinese',
938
+ ja: 'Japanese', ko: 'Korean', pt: 'Portuguese', it: 'Italian', ar: 'Arabic',
939
+ ru: 'Russian', hi: 'Hindi', bn: 'Bengali', ur: 'Urdu', tr: 'Turkish',
940
+ pl: 'Polish', nl: 'Dutch', sv: 'Swedish', da: 'Danish', no: 'Norwegian',
941
+ fi: 'Finnish', is: 'Icelandic', cs: 'Czech', sk: 'Slovak', hu: 'Hungarian',
942
+ ro: 'Romanian', bg: 'Bulgarian', hr: 'Croatian', sr: 'Serbian', sl: 'Slovenian',
943
+ mk: 'Macedonian', sq: 'Albanian', lv: 'Latvian', lt: 'Lithuanian', et: 'Estonian',
944
+ mt: 'Maltese', ga: 'Irish', cy: 'Welsh', eu: 'Basque', ca: 'Catalan',
945
+ gl: 'Galician', el: 'Greek', he: 'Hebrew', fa: 'Persian', ps: 'Pashto',
946
+ ku: 'Kurdish', az: 'Azerbaijani', kk: 'Kazakh', ky: 'Kyrgyz', uz: 'Uzbek',
947
+ tk: 'Turkmen', tg: 'Tajik', mn: 'Mongolian', ka: 'Georgian', hy: 'Armenian',
948
+ th: 'Thai', vi: 'Vietnamese', lo: 'Lao', km: 'Khmer', my: 'Myanmar',
949
+ si: 'Sinhala', ta: 'Tamil', te: 'Telugu', kn: 'Kannada', ml: 'Malayalam',
950
+ gu: 'Gujarati', pa: 'Punjabi', or: 'Odia', as: 'Assamese', ne: 'Nepali',
951
+ dz: 'Dzongkha', bo: 'Tibetan', id: 'Indonesian', ms: 'Malay', tl: 'Filipino',
952
+ ceb: 'Cebuano', haw: 'Hawaiian', mi: 'Maori', sm: 'Samoan', to: 'Tongan',
953
+ fj: 'Fijian', mg: 'Malagasy', sw: 'Swahili', zu: 'Zulu', xh: 'Xhosa',
954
+ af: 'Afrikaans', st: 'Southern Sotho', tn: 'Tswana', ss: 'Swati', ve: 'Venda',
955
+ ts: 'Tsonga', nr: 'Southern Ndebele', am: 'Amharic', ti: 'Tigrinya', om: 'Oromo',
956
+ so: 'Somali', ha: 'Hausa', yo: 'Yoruba', ig: 'Igbo', ff: 'Fulani',
957
+ wo: 'Wolof', bm: 'Bambara', rn: 'Rundi', rw: 'Rwanda', lg: 'Luganda',
958
+ ny: 'Chichewa', sn: 'Shona', nd: 'Northern Ndebele'
959
+ };
960
+
961
+ // Translation cache management
962
+ const CACHE_PREFIX = 'comparematrix_translations_';
963
+ const CACHE_VERSION = '1.0';
964
+
965
+ // Check if translations are cached for a language
966
+ function isLanguageCached(language) {
967
+ const cacheKey = CACHE_PREFIX + language;
968
+ const cached = localStorage.getItem(cacheKey);
969
+ return cached !== null;
970
+ }
971
+
972
+ // Save translations to cache
973
+ function saveTranslationsToCache(language, translations) {
974
+ const cacheKey = CACHE_PREFIX + language;
975
+ const cacheData = {
976
+ version: CACHE_VERSION,
977
+ timestamp: Date.now(),
978
+ translations: translations
979
+ };
980
+ localStorage.setItem(cacheKey, JSON.stringify(cacheData));
981
+ console.log(`Translations cached for ${language}`);
982
+ }
983
+
984
+ // Load translations from cache
985
+ function loadTranslationsFromCache(language) {
986
+ const cacheKey = CACHE_PREFIX + language;
987
+ const cached = localStorage.getItem(cacheKey);
988
+
989
+ if (cached) {
990
+ try {
991
+ const cacheData = JSON.parse(cached);
992
+ if (cacheData.version === CACHE_VERSION) {
993
+ console.log(`Translations loaded from cache for ${language}`);
994
+ return cacheData.translations;
995
+ }
996
+ } catch (error) {
997
+ console.error('Error parsing cached translations:', error);
998
+ }
999
+ }
1000
+ return null;
1001
+ }
1002
+
1003
+ // Get all cached languages
1004
+ function getCachedLanguages() {
1005
+ const cachedLanguages = [];
1006
+ for (let i = 0; i < localStorage.length; i++) {
1007
+ const key = localStorage.key(i);
1008
+ if (key && key.startsWith(CACHE_PREFIX)) {
1009
+ const language = key.replace(CACHE_PREFIX, '');
1010
+ cachedLanguages.push(language);
1011
+ }
1012
+ }
1013
+ return cachedLanguages;
1014
+ }
1015
+
1016
+ // Clear all translation cache
1017
+ function clearAllTranslationCache() {
1018
+ const cachedLanguages = getCachedLanguages();
1019
+
1020
+ if (cachedLanguages.length === 0) {
1021
+ alert('No cached translations to clear.');
1022
+ return;
1023
+ }
1024
+
1025
+ const languageList = cachedLanguages.map(lang => languageNames[lang] || lang).join(', ');
1026
+ const confirmMessage = `Are you sure you want to clear all cached translations?\n\nCached languages: ${languageList}\n\nThis will require re-downloading translations when switching languages.`;
1027
+
1028
+ if (confirm(confirmMessage)) {
1029
+ // Clear all translation caches
1030
+ cachedLanguages.forEach(language => {
1031
+ const cacheKey = CACHE_PREFIX + language;
1032
+ localStorage.removeItem(cacheKey);
1033
+ });
1034
+
1035
+ // Update cache status
1036
+ updateCacheStatus(currentLanguage);
1037
+ updateCacheStatusDisplay();
1038
+
1039
+ alert(`Cache cleared successfully!\n\n${cachedLanguages.length} language(s) removed from cache.`);
1040
+
1041
+ // Ask if user wants to reload current language translations
1042
+ if (currentLanguage !== 'en' && cachedLanguages.includes(currentLanguage)) {
1043
+ if (confirm('Would you like to reload the current language translations?')) {
1044
+ applyLanguage(currentLanguage);
1045
+ }
1046
+ }
1047
+ }
1048
+ }
1049
+
1050
+ // Update cache status indicator
1051
+ function updateCacheStatus(language) {
1052
+ const cacheStatus = document.getElementById('cacheStatus');
1053
+ const isCached = isLanguageCached(language);
1054
+
1055
+ if (language === 'en') {
1056
+ cacheStatus.classList.remove('cached', 'translating');
1057
+ return;
1058
+ }
1059
+
1060
+ if (isCached) {
1061
+ cacheStatus.textContent = '💾 Translations cached - instant loading!';
1062
+ cacheStatus.classList.add('cached');
1063
+ cacheStatus.classList.remove('translating');
1064
+ } else {
1065
+ cacheStatus.textContent = '🔄 First time translation - will be cached for future use';
1066
+ cacheStatus.classList.add('translating');
1067
+ cacheStatus.classList.remove('cached');
1068
+ }
1069
+ }
1070
+
1071
+ // Update cache status display in management section
1072
+ function updateCacheStatusDisplay() {
1073
+ const cacheStatusDisplay = document.getElementById('cacheStatusDisplay');
1074
+ const clearCacheBtn = document.getElementById('clearCacheBtn');
1075
+ const cachedLanguages = getCachedLanguages();
1076
+
1077
+ if (cachedLanguages.length === 0) {
1078
+ cacheStatusDisplay.textContent = '📭 No cached translations';
1079
+ cacheStatusDisplay.className = 'cache-status-display no-cache';
1080
+ clearCacheBtn.disabled = true;
1081
+ } else {
1082
+ const languageList = cachedLanguages.map(lang => languageNames[lang] || lang).join(', ');
1083
+ cacheStatusDisplay.textContent = `💾 ${cachedLanguages.length} language(s) cached: ${languageList}`;
1084
+ cacheStatusDisplay.className = 'cache-status-display';
1085
+ clearCacheBtn.disabled = false;
1086
+ }
1087
+ }
1088
+
1089
+ // Initialize the application
1090
+ function initializeApp() {
1091
+ // Load saved language and API key
1092
+ const savedLanguage = localStorage.getItem('comparematrix_language') || 'en';
1093
+ const savedApiKey = localStorage.getItem('comparematrix_api_key') || '';
1094
+
1095
+ currentLanguage = savedLanguage;
1096
+ currentApiKey = savedApiKey;
1097
+
1098
+ // Set language selector
1099
+ document.getElementById('languageSelect').value = currentLanguage;
1100
+ document.getElementById('apiKeyLanding').value = currentApiKey;
1101
+
1102
+ // Apply direction for current language
1103
+ applyDirection(currentLanguage);
1104
+
1105
+ // Update cache status
1106
+ updateCacheStatus(currentLanguage);
1107
+ updateCacheStatusDisplay();
1108
+
1109
+ // Show appropriate screen
1110
+ if (currentApiKey && currentLanguage) {
1111
+ showMainApp();
1112
+ } else {
1113
+ showLanguageLanding();
1114
+ }
1115
+ }
1116
+
1117
+ // Apply language direction
1118
+ function applyDirection(language) {
1119
+ currentLanguage = language;
1120
+
1121
+ // Set document language and direction
1122
+ document.documentElement.lang = language;
1123
+ document.documentElement.dir = rtlLanguages.includes(language) ? 'rtl' : 'ltr';
1124
+
1125
+ // Save language preference
1126
+ localStorage.setItem('comparematrix_language', language);
1127
+
1128
+ // Update cache status
1129
+ updateCacheStatus(language);
1130
+ }
1131
+
1132
+ // API call function for translation
1133
+ async function translateText(text, targetLanguage) {
1134
+ if (!currentApiKey) {
1135
+ throw new Error('API key is required for translation');
1136
+ }
1137
+
1138
+ const languageName = languageNames[targetLanguage] || 'English';
1139
+
1140
+ const prompt = `Translate the following text to ${languageName}. Provide ONLY the exact translation without any explanations, additional information, or formatting:
1141
+
1142
+ "${text}"`;
1143
+
1144
+ const payload = {
1145
+ model: "gpt-4o-mini",
1146
+ messages: [{ role: "user", content: prompt }],
1147
+ max_tokens: 500,
1148
+ temperature: 0.1
1149
+ };
1150
+
1151
+ const response = await fetch("https://api.openai.com/v1/chat/completions", {
1152
+ method: "POST",
1153
+ headers: {
1154
+ "Content-Type": "application/json",
1155
+ "Authorization": `Bearer ${currentApiKey}`
1156
+ },
1157
+ body: JSON.stringify(payload)
1158
+ });
1159
+
1160
+ if (!response.ok) {
1161
+ const errorData = await response.json();
1162
+ throw new Error(errorData.error?.message || "Translation API request failed");
1163
+ }
1164
+
1165
+ const data = await response.json();
1166
+ return data.choices[0].message.content.trim();
1167
+ }
1168
+
1169
+ // Apply cached translations to UI
1170
+ function applyCachedTranslations(translations) {
1171
+ // Apply text translations
1172
+ Object.keys(translations.texts).forEach(originalText => {
1173
+ const translation = translations.texts[originalText];
1174
+ const elements = document.querySelectorAll(`[data-translate]`);
1175
+
1176
+ elements.forEach(element => {
1177
+ const originalElementText = element.getAttribute('data-original-text') || element.textContent;
1178
+ if (originalElementText === originalText) {
1179
+ element.textContent = translation;
1180
+ }
1181
+ });
1182
+ });
1183
+
1184
+ // Apply placeholder translations
1185
+ Object.keys(translations.placeholders).forEach(originalPlaceholder => {
1186
+ const translation = translations.placeholders[originalPlaceholder];
1187
+ const elements = document.querySelectorAll(`[data-translate-placeholder]`);
1188
+
1189
+ elements.forEach(element => {
1190
+ const originalElementPlaceholder = element.getAttribute('data-original-placeholder') || element.placeholder;
1191
+ if (originalElementPlaceholder === originalPlaceholder) {
1192
+ element.placeholder = translation;
1193
+ }
1194
+ });
1195
+ });
1196
+ }
1197
+
1198
+ // Translate all UI elements
1199
+ async function translateInterface(targetLanguage) {
1200
+ if (targetLanguage === 'en') {
1201
+ // No translation needed for English
1202
+ return;
1203
+ }
1204
+
1205
+ // Check if translations are cached
1206
+ const cachedTranslations = loadTranslationsFromCache(targetLanguage);
1207
+ if (cachedTranslations) {
1208
+ // Use cached translations
1209
+ console.log('Using cached translations for', targetLanguage);
1210
+ applyCachedTranslations(cachedTranslations);
1211
+ return;
1212
+ }
1213
+
1214
+ // Need to translate via API
1215
+ showTranslationOverlay();
1216
+
1217
+ try {
1218
+ // Get all elements with data-translate attribute
1219
+ const elements = document.querySelectorAll('[data-translate]');
1220
+ const placeholderElements = document.querySelectorAll('[data-translate-placeholder]');
1221
+
1222
+ // Collect all texts to translate
1223
+ const textsToTranslate = [];
1224
+ const placeholdersToTranslate = [];
1225
+ const elementMap = new Map();
1226
+
1227
+ elements.forEach(element => {
1228
+ const originalText = element.getAttribute('data-original-text') || element.textContent;
1229
+ if (!element.getAttribute('data-original-text')) {
1230
+ element.setAttribute('data-original-text', originalText);
1231
+ }
1232
+ textsToTranslate.push(originalText);
1233
+ elementMap.set(originalText, element);
1234
+ });
1235
+
1236
+ placeholderElements.forEach(element => {
1237
+ const originalPlaceholder = element.getAttribute('data-original-placeholder') || element.placeholder;
1238
+ if (!element.getAttribute('data-original-placeholder')) {
1239
+ element.setAttribute('data-original-placeholder', originalPlaceholder);
1240
+ }
1241
+ placeholdersToTranslate.push(originalPlaceholder);
1242
+ elementMap.set(originalPlaceholder, element);
1243
+ });
1244
+
1245
+ // Prepare cache structure
1246
+ const translationsCache = {
1247
+ texts: {},
1248
+ placeholders: {}
1249
+ };
1250
+
1251
+ // Translate texts in batches
1252
+ const batchSize = 10;
1253
+ const allTexts = [...textsToTranslate, ...placeholdersToTranslate];
1254
+
1255
+ for (let i = 0; i < allTexts.length; i += batchSize) {
1256
+ const batch = allTexts.slice(i, i + batchSize);
1257
+
1258
+ // Update progress
1259
+ updateTranslationProgress(i, allTexts.length);
1260
+
1261
+ // Translate batch
1262
+ const translations = await Promise.all(
1263
+ batch.map(text => translateText(text, targetLanguage))
1264
+ );
1265
+
1266
+ // Apply translations and cache them
1267
+ batch.forEach((originalText, index) => {
1268
+ const element = elementMap.get(originalText);
1269
+ const translation = translations[index];
1270
+
1271
+ if (element.hasAttribute('data-translate')) {
1272
+ element.textContent = translation;
1273
+ translationsCache.texts[originalText] = translation;
1274
+ } else if (element.hasAttribute('data-translate-placeholder')) {
1275
+ element.placeholder = translation;
1276
+ translationsCache.placeholders[originalText] = translation;
1277
+ }
1278
+ });
1279
+ }
1280
+
1281
+ // Save translations to cache
1282
+ saveTranslationsToCache(targetLanguage, translationsCache);
1283
+
1284
+ // Update cache status
1285
+ updateCacheStatus(targetLanguage);
1286
+ updateCacheStatusDisplay();
1287
+
1288
+ } catch (error) {
1289
+ console.error('Translation error:', error);
1290
+ showError('Translation failed: ' + error.message);
1291
+ } finally {
1292
+ hideTranslationOverlay();
1293
+ }
1294
+ }
1295
+
1296
+ // Show translation overlay
1297
+ function showTranslationOverlay() {
1298
+ document.getElementById('translationOverlay').style.display = 'flex';
1299
+ }
1300
+
1301
+ // Hide translation overlay
1302
+ function hideTranslationOverlay() {
1303
+ document.getElementById('translationOverlay').style.display = 'none';
1304
+ }
1305
+
1306
+ // Update translation progress
1307
+ function updateTranslationProgress(current, total) {
1308
+ const percentage = Math.round((current / total) * 100);
1309
+ document.getElementById('translationMessage').textContent =
1310
+ `Translating interface... ${percentage}% complete (will be cached for future use)`;
1311
+ }
1312
+
1313
+ // Apply language with API translation or cache
1314
+ async function applyLanguage(language) {
1315
+ applyDirection(language);
1316
+
1317
+ if (language !== 'en') {
1318
+ await translateInterface(language);
1319
+ }
1320
+ }
1321
+
1322
+ // Show language landing page
1323
+ function showLanguageLanding() {
1324
+ document.getElementById('languageLanding').style.display = 'block';
1325
+ document.getElementById('mainApp').style.display = 'none';
1326
+ }
1327
+
1328
+ // Show main application
1329
+ function showMainApp() {
1330
+ document.getElementById('languageLanding').style.display = 'none';
1331
+ document.getElementById('mainApp').style.display = 'block';
1332
+
1333
+ // Set API key in main app
1334
+ document.getElementById('apiKey').value = currentApiKey;
1335
+ }
1336
+
1337
+ // Start button click handler
1338
+ document.getElementById('startBtn').addEventListener('click', async function() {
1339
+ const selectedLanguage = document.getElementById('languageSelect').value;
1340
+ const apiKey = document.getElementById('apiKeyLanding').value.trim();
1341
+
1342
+ if (!apiKey) {
1343
+ alert('Please enter your OpenAI API key');
1344
+ return;
1345
+ }
1346
+
1347
+ currentLanguage = selectedLanguage;
1348
+ currentApiKey = apiKey;
1349
+
1350
+ // Save API key
1351
+ localStorage.setItem('comparematrix_api_key', apiKey);
1352
+
1353
+ // Apply language with translation (cached or API)
1354
+ await applyLanguage(selectedLanguage);
1355
+
1356
+ // Show main app
1357
+ showMainApp();
1358
+ });
1359
+
1360
+ // Language selector change handler
1361
+ document.getElementById('languageSelect').addEventListener('change', async function() {
1362
+ const selectedLanguage = this.value;
1363
+ updateCacheStatus(selectedLanguage);
1364
+
1365
+ if (currentApiKey) {
1366
+ await applyLanguage(selectedLanguage);
1367
+ } else {
1368
+ applyDirection(selectedLanguage);
1369
+ }
1370
+ });
1371
+
1372
+ // Clear cache button handler
1373
+ document.getElementById('clearCacheBtn').addEventListener('click', clearAllTranslationCache);
1374
+
1375
+ // Character counters
1376
+ function updateCharCounter(textareaId, counterId) {
1377
+ const textarea = document.getElementById(textareaId);
1378
+ const counter = document.getElementById(counterId);
1379
+
1380
+ textarea.addEventListener('input', function() {
1381
+ const count = this.value.length;
1382
+ const charactersText = counter.querySelector('[data-translate="characters"]')?.textContent || 'characters';
1383
+ counter.innerHTML = `${count} <span data-translate="characters">${charactersText}</span>`;
1384
+
1385
+ if (count > 5000) {
1386
+ counter.style.color = 'var(--warning)';
1387
+ } else {
1388
+ counter.style.color = 'var(--text-secondary)';
1389
+ }
1390
+ });
1391
+ }
1392
+
1393
+ updateCharCounter('content1', 'counter1');
1394
+ updateCharCounter('content2', 'counter2');
1395
+
1396
+ // Error handling
1397
+ function showError(message) {
1398
+ const errorDiv = document.getElementById('errorMessage');
1399
+ errorDiv.textContent = message;
1400
+ errorDiv.style.display = 'block';
1401
+ setTimeout(() => {
1402
+ errorDiv.style.display = 'none';
1403
+ }, 5000);
1404
+ }
1405
+
1406
+ // API call function for content analysis
1407
+ async function callAPI(prompt) {
1408
+ const apiKey = currentApiKey;
1409
+
1410
+ if (!apiKey) {
1411
+ throw new Error('Please enter your OpenAI API key');
1412
+ }
1413
+
1414
+ const payload = {
1415
+ model: "gpt-4o-mini",
1416
+ messages: [{ role: "user", content: prompt }],
1417
+ max_tokens: 3000,
1418
+ temperature: 0.3
1419
+ };
1420
+
1421
+ const response = await fetch("https://api.openai.com/v1/chat/completions", {
1422
+ method: "POST",
1423
+ headers: {
1424
+ "Content-Type": "application/json",
1425
+ "Authorization": `Bearer ${apiKey}`
1426
+ },
1427
+ body: JSON.stringify(payload)
1428
+ });
1429
+
1430
+ if (!response.ok) {
1431
+ const errorData = await response.json();
1432
+ throw new Error(errorData.error?.message || "API request failed");
1433
+ }
1434
+
1435
+ const data = await response.json();
1436
+ return data.choices[0].message.content;
1437
+ }
1438
+
1439
+ // Build comparison matrix prompt
1440
+ function buildComparisonPrompt() {
1441
+ const content1 = document.getElementById('content1').value.trim();
1442
+ const content2 = document.getElementById('content2').value.trim();
1443
+ const languageName = languageNames[currentLanguage] || 'English';
1444
+
1445
+ return `You are an expert content analyst tasked with creating a comprehensive comparison matrix between two pieces of content. Please analyze the following content inputs and generate a detailed, professional comparison matrix in ${languageName} language.
1446
+
1447
+ **Content A:**
1448
+ ${content1}
1449
+
1450
+ **Content B:**
1451
+ ${content2}
1452
+
1453
+ **Instructions:**
1454
+ 1. Create a complete HTML table with inline CSS styling that looks professional and appealing
1455
+ 2. The table should have clear headers: "Comparison Aspect", "Content A", "Content B", and "Analysis Notes"
1456
+ 3. Include at least 8-12 comparison aspects such as:
1457
+ - Main Theme/Purpose
1458
+ - Target Audience
1459
+ - Tone & Style
1460
+ - Key Arguments/Points
1461
+ - Evidence/Support
1462
+ - Structure & Organization
1463
+ - Strengths
1464
+ - Weaknesses
1465
+ - Unique Features
1466
+ - Practical Applications
1467
+ - Overall Quality
1468
+ - Recommendations
1469
+
1470
+ 4. Use professional styling with:
1471
+ - Clean borders and spacing
1472
+ - Alternating row colors for readability
1473
+ - Header styling with background colors
1474
+ - Responsive design considerations
1475
+
1476
+ 5. Provide detailed, insightful analysis in each cell
1477
+ 6. Do not include any markdown symbols (*, #, etc.) - only clean HTML
1478
+ 7. Ensure the table is complete and self-contained
1479
+ 8. Write ENTIRELY in ${languageName} language
1480
+
1481
+ Generate only the HTML table with inline CSS - no additional text or explanations.`;
1482
+ }
1483
+
1484
+ // Validation function
1485
+ function validateInputs() {
1486
+ const content1 = document.getElementById('content1').value.trim();
1487
+ const content2 = document.getElementById('content2').value.trim();
1488
+
1489
+ if (!content1) {
1490
+ document.getElementById('content1').focus();
1491
+ throw new Error('Please enter Content A for comparison');
1492
+ }
1493
+
1494
+ if (!content2) {
1495
+ document.getElementById('content2').focus();
1496
+ throw new Error('Please enter Content B for comparison');
1497
+ }
1498
+
1499
+ if (content1.length < 50) {
1500
+ document.getElementById('content1').focus();
1501
+ throw new Error('Content A should be at least 50 characters for meaningful comparison');
1502
+ }
1503
+
1504
+ if (content2.length < 50) {
1505
+ document.getElementById('content2').focus();
1506
+ throw new Error('Content B should be at least 50 characters for meaningful comparison');
1507
+ }
1508
+ }
1509
+
1510
+ // Generate comparison matrix
1511
+ document.getElementById('generateMatrixBtn').addEventListener('click', async function() {
1512
+ const button = this;
1513
+ const buttonText = document.getElementById('buttonText');
1514
+ const spinner = document.getElementById('spinner');
1515
+ const outputArea = document.getElementById('matrixOutput');
1516
+
1517
+ try {
1518
+ // Validate inputs
1519
+ validateInputs();
1520
+
1521
+ // Update button state
1522
+ button.disabled = true;
1523
+ spinner.style.display = 'inline-block';
1524
+ buttonText.textContent = 'Analyzing Content...';
1525
+
1526
+ // Clear previous output
1527
+ outputArea.innerHTML = '';
1528
+
1529
+ // Build prompt and call API
1530
+ const prompt = buildComparisonPrompt();
1531
+ const result = await callAPI(prompt);
1532
+
1533
+ // Display result
1534
+ outputArea.innerHTML = result;
1535
+
1536
+ } catch (error) {
1537
+ showError(error.message);
1538
+ outputArea.innerHTML = '';
1539
+ } finally {
1540
+ // Reset button state
1541
+ button.disabled = false;
1542
+ spinner.style.display = 'none';
1543
+ buttonText.textContent = '🔍 Generate Intelligent Comparison Matrix';
1544
+ }
1545
+ });
1546
+
1547
+ // Keyboard shortcut for generation
1548
+ document.addEventListener('keydown', function(e) {
1549
+ if (e.ctrlKey && e.key === 'Enter') {
1550
+ e.preventDefault();
1551
+ document.getElementById('generateMatrixBtn').click();
1552
+ }
1553
+ });
1554
+
1555
+ // API key sync between landing and main app
1556
+ document.getElementById('apiKeyLanding').addEventListener('input', function() {
1557
+ currentApiKey = this.value;
1558
+ localStorage.setItem('comparematrix_api_key', this.value);
1559
+ document.getElementById('apiKey').value = this.value;
1560
+ });
1561
+
1562
+ document.getElementById('apiKey').addEventListener('input', function() {
1563
+ currentApiKey = this.value;
1564
+ localStorage.setItem('comparematrix_api_key', this.value);
1565
+ document.getElementById('apiKeyLanding').value = this.value;
1566
+ });
1567
+
1568
+ // Initialize the application when page loads
1569
+ document.addEventListener('DOMContentLoaded', initializeApp);
1570
+ </script>
1571
+ </body>
1572
+ </html>
1573
+
📘 Educator & Student Guide Compare.txt ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 📘 Educator & Student Guide: CompareMatrix Pro
2
+ 1. Purpose & Impact
3
+ CompareMatrix Pro empowers learners and teachers to critically analyze any two pieces of content—from essays to business documents—through a detailed, multi-aspect matrix. Output is visually rich, professional, and instantly available in 90+ languages.
4
+
5
+ 2. Step-by-Step Instructions
6
+ A. Setup
7
+ Open the tool (locally or via Hugging Face Space).
8
+
9
+ Select your preferred language (RTL/LTR supported).
10
+
11
+ Enter your OpenAI API key (used only in your browser).
12
+
13
+ B. Input Content
14
+ Paste/type Content A and Content B (minimum 50 characters each for robust analysis).
15
+
16
+ For best results, use full essays, reports, student work, or project documents.
17
+
18
+ C. Generate Comparison Matrix
19
+ Click “Generate Intelligent Comparison Matrix”
20
+ (or press Ctrl+Enter for quick access).
21
+
22
+ The tool will:
23
+
24
+ Build a professional HTML table (no markdown, no extra code).
25
+
26
+ Analyze 8–12 aspects: Theme, Purpose, Audience, Tone, Arguments, Evidence, Strengths, Weaknesses, Structure, Applications, Recommendations, Overall Quality, and more.
27
+
28
+ Output is styled for readability (colors, headers, alternating rows, etc.).
29
+
30
+ D. Review, Copy, and Share
31
+ Read the matrix directly in the browser.
32
+
33
+ Copy/paste into documents, LMS, or reports as HTML (retains full styling).
34
+
35
+ Switch UI/output language for instant bilingual analysis.
36
+
37
+ 3. For Educators: Lesson Ideas
38
+ Model Analysis: Compare student vs. model answers, or two student drafts.
39
+
40
+ Peer Review: Have students use the tool to compare and critique each other's work.
41
+
42
+ Source Evaluation: Analyze two news articles, essays, or scientific abstracts.
43
+
44
+ Differentiation: Output can be instantly translated, supporting all learners.
45
+
46
+ Professional Use: PD workshops—compare lesson plans, policies, or feedback letters.
47
+
48
+ 4. For Students: Self-Improvement Tasks
49
+ Draft Comparison: Compare your first and final drafts for writing growth.
50
+
51
+ Research: Analyze two sources for bias, coverage, or reliability.
52
+
53
+ Group Work: Use as a consensus-building tool for project writing.
54
+
55
+ Bilingual Analysis: See strengths and gaps in both your languages.
56
+
57
+ 5. Best Practices & Tips
58
+ Be detailed: The more complete your inputs, the more robust the matrix.
59
+
60
+ Use for all content types: Essays, code explanations, technical docs, reports, letters, or presentations.
61
+
62
+ Leverage the multilingual UI: Great for ELLs, IB, or international classrooms.
63
+
64
+ Privacy first: All data is processed in-browser; nothing leaves your device.
65
+
66
+ 6. Troubleshooting & Support
67
+ If output is empty or short, increase input length/detail.
68
+
69
+ API errors? Double-check your OpenAI API key and usage limits.
70
+
71
+ Translation slow? First use in a language may take time (caches for next time).
72
+
73
+ For help or new features: info@shiftmind.io | www.shiftmind.io
74
+
75
+ With CompareMatrix Pro, everyone can become a skilled content analyst—securely, accessibly, and in any language.
76
+