abdelhaqueidali commited on
Commit
ec4b059
·
verified ·
1 Parent(s): e8acdac

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +50 -365
index.html CHANGED
@@ -3,378 +3,63 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>AmsnflSkkil</title>
7
- <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Tifinagh&display=swap" rel="stylesheet">
8
  <style>
9
- body {
10
- font-family: Arial, sans-serif;
11
- background-color: #f0f0f0;
 
 
 
12
  }
13
 
14
- .container {
15
- max-width: 800px;
16
- margin: 40px auto;
17
- padding: 20px;
18
- background-color: #fff;
19
- border: 1px solid #ddd;
20
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
21
- }
22
-
23
- .converter {
24
- display: flex;
25
- flex-direction: column;
26
- align-items: center;
27
- }
28
-
29
- textarea {
30
- width: 95%;
31
- height: 100px;
32
- padding: 10px;
33
- font-size: 16px;
34
- margin-bottom: 20px;
35
- font-family: 'Noto Sans Tifinagh', sans-serif;
36
- }
37
-
38
- button {
39
- width: 49%;
40
- padding: 10px;
41
- font-size: 16px;
42
- background-color: #4CAF50;
43
- color: #fff;
44
- border: none;
45
- cursor: pointer;
46
- margin-bottom: 20px;
47
- }
48
-
49
- button:hover {
50
- background-color: #3e8e41;
51
- }
52
-
53
- .buttons-container {
54
- display: flex;
55
- justify-content: space-between;
56
  width: 100%;
57
- margin-bottom: 20px;
58
- }
59
-
60
- /* Toggle Switch */
61
- .toggle-container {
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
- margin-bottom: 20px;
66
- }
67
-
68
- .switch {
69
- position: relative;
70
- display: inline-block;
71
- width: 60px;
72
- height: 34px;
73
- margin: 0 10px;
74
- }
75
-
76
- .switch input {
77
- opacity: 0;
78
- width: 0;
79
- height: 0;
80
- }
81
-
82
- .slider {
83
- position: absolute;
84
- cursor: pointer;
85
- top: 0;
86
- left: 0;
87
- right: 0;
88
- bottom: 0;
89
- background-color: #2196F3;
90
- -webkit-transition: .4s;
91
- transition: .4s;
92
- }
93
-
94
- .slider:before {
95
- position: absolute;
96
- content: "";
97
- height: 26px;
98
- width: 26px;
99
- left: 4px;
100
- bottom: 4px;
101
- background-color: white;
102
- -webkit-transition: .4s;
103
- transition: .4s;
104
- }
105
-
106
- input:checked + .slider {
107
- background-color: #2196F3;
108
- }
109
-
110
- input:focus + .slider {
111
- box-shadow: 0 0 1px #2196F3;
112
- }
113
-
114
- input:checked + .slider:before {
115
- -webkit-transform: translateX(26px);
116
- -ms-transform: translateX(26px);
117
- transform: translateX(26px);
118
- }
119
-
120
- /* Rounded sliders */
121
- .slider.round {
122
- border-radius: 34px;
123
- }
124
-
125
- .slider.round:before {
126
- border-radius: 50%;
127
- }
128
-
129
- /* Labels for the toggle */
130
- .toggle-label {
131
- font-size: 16px;
132
- }
133
-
134
- /* Script Labels */
135
- .script-label {
136
- display: inline-block;
137
- padding: 5px 15px;
138
- margin-bottom: 5px;
139
- font-weight: bold;
140
- background-color: #e9e9e9;
141
- border-radius: 4px;
142
- border: 1px solid #ccc;
143
- box-shadow: 0 1px 3px rgba(0,0,0,0.1);
144
- }
145
-
146
- .script-selection {
147
- margin-bottom: 20px;
148
- text-align: center;
149
- }
150
-
151
- /* E-removal option */
152
- .option-container {
153
- display: flex;
154
- align-items: center;
155
- margin-bottom: 15px;
156
- }
157
-
158
- .option-checkbox {
159
- margin-right: 10px;
160
- }
161
-
162
- .option-label {
163
- font-size: 14px;
164
- }
165
-
166
- /* Hide e-removal option when converting from Tifinagh */
167
- .hidden {
168
- display: none;
169
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  </style>
171
  </head>
172
  <body>
173
- <div class="container">
174
- <h1>AmsnflSkkil</h1>
175
- <div class="converter">
176
- <div class="script-label" id="source-script-label">Tifinagh</div>
177
- <textarea id="input" placeholder="Enter text to convert"></textarea>
178
- <div class="buttons-container">
179
- <button id="paste-btn">Paste</button>
180
- <button id="copy-btn">Copy</button>
181
- </div>
182
-
183
- <div class="script-selection">
184
- <div class="toggle-container">
185
- <span class="toggle-label">Tifinagh</span>
186
- <label class="switch">
187
- <input type="checkbox" id="script-toggle">
188
- <span class="slider round"></span>
189
- </label>
190
- <span class="toggle-label">Latin</span>
191
- </div>
192
- </div>
193
-
194
- <!-- E-removal option (initially hidden) -->
195
- <div class="option-container hidden" id="e-removal-option">
196
- <input type="checkbox" id="remove-e-checkbox" class="option-checkbox" checked>
197
- <label for="remove-e-checkbox" class="option-label">
198
- Remove letter "e" (except between identical letters)
199
- </label>
200
- </div>
201
-
202
- <div class="script-label" id="target-script-label">Latin</div>
203
- <textarea id="output" placeholder="Converted text" readonly></textarea>
204
- </div>
205
- </div>
206
-
207
- <script>
208
- // Initialize script labels
209
- let sourceScript = 'tifinagh';
210
- let targetScript = 'latin';
211
-
212
- // Update the labels based on toggle state
213
- function updateScriptLabels() {
214
- document.getElementById('source-script-label').textContent = sourceScript.charAt(0).toUpperCase() + sourceScript.slice(1);
215
- document.getElementById('target-script-label').textContent = targetScript.charAt(0).toUpperCase() + targetScript.slice(1);
216
-
217
- // Show or hide e-removal option based on conversion direction
218
- const eRemovalOption = document.getElementById('e-removal-option');
219
- if (sourceScript === 'latin' && targetScript === 'tifinagh') {
220
- eRemovalOption.classList.remove('hidden');
221
- } else {
222
- eRemovalOption.classList.add('hidden');
223
- }
224
- }
225
-
226
- // Toggle event handler
227
- document.getElementById('script-toggle').addEventListener('change', function() {
228
- if (this.checked) {
229
- sourceScript = 'latin';
230
- targetScript = 'tifinagh';
231
- } else {
232
- sourceScript = 'tifinagh';
233
- targetScript = 'latin';
234
- }
235
- updateScriptLabels();
236
- // Trigger conversion with new script settings
237
- convertInput();
238
- });
239
-
240
- // E-removal checkbox change event handler - trigger conversion when changed
241
- document.getElementById('remove-e-checkbox').addEventListener('change', function() {
242
- convertInput();
243
- });
244
-
245
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 'ⵇ', 'i': 'ⵉ', 'j': 'ⵊ', 'l': 'ⵍ',
261
- 'm': 'ⵎ', 'n': 'ⵏ', 'u': 'ⵓ', 'r': 'ⵔ', 'ṛ': 'ⵕ', 'ɣ': 'ⵖ', 's': 'ⵙ', 'ṣ': 'ⵚ',
262
- 'c': 'ⵛ', 't': 'ⵜ', 'ṭ': 'ⵟ', 'w': 'ⵡ', 'y': 'ⵢ', 'z': 'ⵣ', 'ẓ': 'ⵥ', 'ʷ': 'ⵯ',
263
- // Custom Latin to Tifinagh mappings
264
- 'ḇ': 'ⴲ', 'ḡ': 'ⴴ', 'ǧ': 'ⴵ', 'ḏ': 'ⴸ', 'ḏ̣': 'ⴺ',
265
- 'p': 'ⵒ', 'ṯ': 'ⵝ', 'č': 'ⵞ', 'v': 'ⵠ', 'é': 'ⴻ', 'o': 'ⵓ', 'ř': 'ⵍ', 'ε': 'ⵄ', 'γ': 'ⵖ', 'ᵒ': 'ⵯ'
266
- };
267
-
268
- let result = '';
269
-
270
- if (fromScript === 'tifinagh' && toScript === 'latin') {
271
- for (let i = 0; i < text.length; i++) {
272
- result += tifinaghToLatinMap[text[i]] || text[i];
273
- }
274
- } else if (fromScript === 'latin' && toScript === 'tifinagh') {
275
- // Check if e-removal is enabled
276
- const removeE = document.getElementById('remove-e-checkbox').checked;
277
-
278
- if (removeE) {
279
- // Process text for e-removal before conversion
280
- text = removeLetterE(text.toLowerCase());
281
- } else {
282
- text = text.toLowerCase();
283
- }
284
-
285
- for (let i = 0; i < text.length; i++) {
286
- // Handling custom multi-character mappings like 'ng'
287
- if (i + 1 < text.length && latinToTifinaghMap[text[i] + text[i + 1]]) {
288
- result += latinToTifinaghMap[text[i] + text[i + 1]];
289
- i++; // Skip the next character as it's part of a custom mapping
290
- } else {
291
- result += latinToTifinaghMap[text[i]] || text[i];
292
- }
293
- }
294
- } else {
295
- result = 'Invalid script conversion';
296
- }
297
-
298
- return result;
299
- }
300
-
301
- // Function to remove letter 'e' according to specified rules
302
- function removeLetterE(text) {
303
- if (!text) return '';
304
-
305
- // Split text into words
306
- const words = text.split(/\s+/);
307
-
308
- // Process each word
309
- const processedWords = words.map(word => {
310
- if (word.length <= 1) return word;
311
-
312
- let result = '';
313
-
314
- for (let i = 0; i < word.length; i++) {
315
- // Skip 'e' at the start of the word
316
- if (i === 0 && word[i] === 'e') {
317
- continue;
318
- }
319
-
320
- // Skip 'e' at the end of the word
321
- if (i === word.length - 1 && word[i] === 'e') {
322
- continue;
323
- }
324
-
325
- // Keep 'e' between identical letters
326
- if (word[i] === 'e' && i > 0 && i < word.length - 1) {
327
- if (word[i-1] === word[i+1]) {
328
- result += word[i];
329
- }
330
- // Otherwise skip 'e' between different letters
331
- } else {
332
- result += word[i];
333
- }
334
- }
335
-
336
- return result;
337
- });
338
-
339
- // Join the processed words back
340
- return processedWords.join(' ');
341
- }
342
-
343
- // Live conversion function - called on input changes
344
- function convertInput() {
345
- const inputText = document.getElementById('input').value;
346
- const outputText = convertScript(inputText, sourceScript, targetScript);
347
- document.getElementById('output').value = outputText;
348
- }
349
-
350
- // Add input event listener for live conversion
351
- document.getElementById('input').addEventListener('input', convertInput);
352
-
353
- document.getElementById('paste-btn').addEventListener('click', function() {
354
- navigator.clipboard.readText()
355
- .then(text => {
356
- document.getElementById('input').value = text;
357
- // Trigger conversion after pasting
358
- convertInput();
359
- })
360
- .catch(err => {
361
- console.error('Failed to read clipboard contents: ', err);
362
- });
363
- });
364
-
365
- document.getElementById('copy-btn').addEventListener('click', function() {
366
- const outputText = document.getElementById('output').value;
367
- navigator.clipboard.writeText(outputText)
368
- .then(() => {
369
- console.log('Text copied to clipboard');
370
- })
371
- .catch(err => {
372
- console.error('Failed to copy text: ', err);
373
- });
374
- });
375
-
376
- // Initialize the labels on page load
377
- updateScriptLabels();
378
- </script>
379
  </body>
380
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
 
6
  <style>
7
+ /* Reset default margin and padding */
8
+ body, html {
9
+ margin: 0;
10
+ padding: 0;
11
+ height: 100%; /* Make sure body and html take up the full height */
12
+ overflow: hidden; /* Prevent scrollbars on the outer page */
13
  }
14
 
15
+ /* Style the iframe to take up the entire viewport */
16
+ iframe {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  width: 100%;
18
+ height: 100%;
19
+ border: none; /* Remove default iframe border */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
+
22
+ /* Reset default margin and padding */
23
+ body, html {
24
+ margin: 0;
25
+ padding: 0;
26
+ height: 100%; /* Make sure body and html take up the full height */
27
+ overflow: hidden; /* Prevent scrollbars on the outer page */
28
+ }
29
+
30
+ /* Style the iframe to take up the entire viewport */
31
+ iframe {
32
+ width: 100%;
33
+ height: 100%;
34
+ border: none; /* Remove default iframe border */
35
+ }
36
+
37
+ /* Style for the div containing the links */
38
+ div {
39
+ text-align: center; /* Center the links horizontally */
40
+ background-color: #f0f0f0; /* Light gray background (optional) */
41
+ padding: 10px; /* Add some padding around the links */
42
+ position: relative; /* Important for z-index to work */
43
+ z-index: 2; /* Ensure the div is above the iframe */
44
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow (optional) */
45
+ }
46
+
47
+ /* Style for the links themselves (optional) */
48
+ div a {
49
+ margin: 0 10px; /* Add some horizontal spacing between links */
50
+ color: #007bff; /* Blue link color (adjust as desired) */
51
+ text-decoration: none; /* Remove underline (optional) */
52
+ }
53
+
54
+ div a:hover {
55
+ text-decoration: underline; /* Add underline on hover (optional) */
56
+ }
57
  </style>
58
  </head>
59
  <body>
60
+ <div style="text-align: center;">
61
+ <a href="https://abdelhaqueidali.github.io/Amazigh-Scripts-Converter/">Original webpage</a> <a href="https://github.com/abdelhaqueidali/Amazigh-Scripts-Converter">Original Repository</a>
62
+ </div>
63
+ <iframe src="https://abdelhaqueidali.github.io/Amazigh-Scripts-Converter/"></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  </body>
65
  </html>