-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidepanel.html
More file actions
177 lines (151 loc) · 5.9 KB
/
sidepanel.html
File metadata and controls
177 lines (151 loc) · 5.9 KB
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
<!-- sidepanel.html -->
<!DOCTYPE html>
<html>
<head>
<title>AI Translator</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="./style.css">
</head>
<body class="light">
<div class="header">
<h2>AI Translator</h2>
<div class="header-controls">
<button class="icon-btn" id="helpBtn" title="Help">
<i class="fas fa-question-circle"></i>
</button>
<button class="icon-btn" id="themeBtn" title="Toggle theme">
<i class="fas fa-adjust"></i>
</button>
</div>
</div>
<div class="content">
<div class="tabs">
<button class="tab active" data-tab="auth">
<i class="fas fa-lock"></i> Auth
</button>
<button class="tab" data-tab="translate">
<i class="fas fa-language"></i> Translate
</button>
<button class="tab" data-tab="history">
<i class="fas fa-history"></i> History
</button>
</div>
<div class="tab-content active" id="auth-tab">
<div class="auth-container">
<h3>API Authentication</h3>
<div class="auth-status" id="authStatus" style="display: none;"></div>
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" placeholder="Enter username">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" placeholder="Enter password">
</div>
<div class="form-group checkbox">
<input type="checkbox" id="rememberMe" checked>
<label for="rememberMe">Remember me on this device</label>
</div>
<div class="auth-buttons">
<button class="btn-primary" id="loginBtn">
<i class="fas fa-sign-in-alt"></i> Login
</button>
<button class="btn-secondary" id="logoutBtn" style="display: none;">
<i class="fas fa-sign-out-alt"></i> Logout
</button>
</div>
<div class="connection-status" id="connectionStatus">
<i class="fas fa-circle"></i> Not connected
</div>
</div>
</div>
<div class="tab-content" id="translate-tab">
<div class="toggle-container">
<label class="toggle-label">
<i class="fas fa-bolt"></i>
<span>Auto-detect selected text</span>
</label>
<label class="toggle-switch">
<input type="checkbox" id="autoDetect">
<span class="slider"></span>
</label>
</div>
<div class="section">
<div class="input-container">
<textarea id="inputText" placeholder="Enter or select text to translate..."></textarea>
<button class="clear-input-btn" id="clearInputBtn" title="Clear text">
<i class="fas fa-times"></i>
</button>
</div>
<div class="language-dropdown">
<div class="dropdown-header" id="dropdownHeader">
<span id="selectedLang">Darija (Moroccan Arabic)</span>
<i class="fas fa-chevron-down dropdown-arrow" id="dropdownArrow"></i>
</div>
<div class="dropdown-content" id="dropdownContent">
<input type="text" class="dropdown-search" id="langSearch" placeholder="Search languages...">
<div id="langList"></div>
</div>
</div>
<select id="toLang" style="display: none;">
<option value="darija">Darija (Moroccan Arabic)</option>
<option value="arabic">Arabic</option>
<option value="english">English</option>
<option value="french">French</option>
<option value="spanish">Spanish</option>
</select>
<button class="translate-btn" id="translateBtn">
<i class="fas fa-exchange-alt"></i> Translate
</button>
<div class="status-indicator" id="status" style="display: none;"></div>
</div>
<div class="result-container" id="resultContainer">
<div class="result" id="result"></div>
<button class="copy-btn" id="copyBtn">
<i class="far fa-copy"></i> Copy
</button>
</div>
</div>
<div class="tab-content" id="history-tab">
<div id="historyList"></div>
<button class="clear-btn" id="clearHistory" style="display: none;">Clear History</button>
</div>
</div>
<div class="help-modal" id="helpModal">
<div class="help-content">
<div class="help-header">
<h3>How to Use</h3>
<button class="icon-btn" id="closeHelp">
<i class="fas fa-times"></i>
</button>
</div>
<div class="help-section">
<h4><i class="fas fa-language"></i> Basic Translation</h4>
<p>Type or paste text into the input box, select your target language, and click Translate.</p>
</div>
<div class="help-section">
<h4><i class="fas fa-bolt"></i> Auto-Detect Mode</h4>
<p>Enable the toggle to automatically capture selected text from any webpage and place it in the translation
box.</p>
</div>
<div class="help-section">
<h4><i class="fas fa-history"></i> Translation History</h4>
<p>View your recent translations in the History tab. Click any item to translate it again.</p>
</div>
<div class="help-section">
<h4><i class="fas fa-moon"></i> Dark Mode</h4>
<p>Click the theme icon in the header to switch between light and dark modes.</p>
</div>
<div class="help-section">
<h4><i class="fas fa-keyboard"></i> Keyboard Shortcuts</h4>
<p>• Ctrl/Cmd + Enter: Translate<br>• Esc: Clear input</p>
</div>
<div class="help-section">
<h4><i class="fas fa-cog"></i> API Connection</h4>
<p>Make sure your translation service is running at:<br>http://localhost:8080/translation-service</p>
</div>
</div>
</div>
<script src="sidepanel.js"></script>
</body>
</html>