joermd commited on
Commit
f1350ea
·
verified ·
1 Parent(s): 36480a4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +177 -39
index.html CHANGED
@@ -5,40 +5,187 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>محادثة صوتية</title>
7
  <style>
8
- /* ... Previous CSS styles ... */
9
- .wave-container {
10
- position: fixed;
11
- bottom: 100px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  width: 100%;
13
- height: 100px;
14
  display: flex;
 
15
  justify-content: center;
16
  align-items: center;
17
- gap: 8px;
18
- opacity: 0;
19
- transition: opacity 0.3s ease;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
- .wave-container.active {
23
- opacity: 1;
 
 
 
 
 
 
24
  }
25
 
26
  .wave {
27
- width: 8px;
28
- height: 40px;
29
- background: #ffffff;
30
- border-radius: 4px;
31
- animation: wave 1s ease-in-out infinite;
32
  }
33
 
34
  .wave:nth-child(2) { animation-delay: 0.1s; }
35
  .wave:nth-child(3) { animation-delay: 0.2s; }
36
  .wave:nth-child(4) { animation-delay: 0.3s; }
37
  .wave:nth-child(5) { animation-delay: 0.4s; }
 
 
 
38
 
39
- @keyframes wave {
40
- 0%, 100% { transform: scaleY(0.3); }
41
- 50% { transform: scaleY(1); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
  </style>
44
  </head>
@@ -50,18 +197,20 @@
50
  <button class="record-button" id="recordButton">
51
  <div class="inner-circle"></div>
52
  </button>
 
 
 
 
 
 
 
 
 
 
 
53
  </div>
54
  <div class="status-text" id="statusText">انقر للبدء في التسجيل</div>
55
 
56
- <!-- إضافة حاوية الموجات الصوتية -->
57
- <div class="wave-container" id="waveContainer">
58
- <div class="wave"></div>
59
- <div class="wave"></div>
60
- <div class="wave"></div>
61
- <div class="wave"></div>
62
- <div class="wave"></div>
63
- </div>
64
-
65
  <div class="code-section" id="codeSection">
66
  <div class="message-container">
67
  <div class="message-label">ما قلته:</div>
@@ -90,7 +239,7 @@
90
  const voiceSelect = document.getElementById('voiceSelect');
91
  const toggleCodeButton = document.getElementById('toggleCode');
92
  const codeSection = document.getElementById('codeSection');
93
- const waveContainer = document.getElementById('waveContainer');
94
 
95
  let isRecording = false;
96
 
@@ -108,7 +257,6 @@
108
  const voices = speechSynthesis.getVoices();
109
  voiceSelect.innerHTML = '<option value="">اختر صوت رجل عربي فصحى</option>';
110
 
111
- // تحسين اختيار الأصوات العربية للرجال
112
  voices.forEach((voice, index) => {
113
  if (voice.lang.includes('ar') && (voice.name.includes('Male') || voice.name.includes('رجل'))) {
114
  const option = document.createElement('option');
@@ -121,7 +269,6 @@
121
  }
122
  });
123
 
124
- // إذا لم يتم العثور على أصوات عربية، اختر أول صوت رجل متاح
125
  if (voiceSelect.options.length === 1) {
126
  voices.forEach((voice, index) => {
127
  if (voice.name.includes('Male')) {
@@ -161,15 +308,7 @@
161
  utterance.lang = 'ar-SA';
162
  utterance.rate = 1;
163
  utterance.pitch = 1;
164
-
165
- // إظهار الموجات الصوتية عند بدء الكلام
166
- waveContainer.classList.add('active');
167
 
168
- utterance.onend = () => {
169
- // إخفاء الموجات الصوتية عند انتهاء الكلام
170
- waveContainer.classList.remove('active');
171
- };
172
-
173
  speechSynthesis.speak(utterance);
174
  } catch (error) {
175
  modelResponse.textContent = 'حدث خطأ في الاتصال بالنموذج';
@@ -198,7 +337,6 @@
198
  statusText.textContent = 'جارٍ التسجيل... انقر للإيقاف';
199
  spokenText.textContent = '';
200
  modelResponse.textContent = '';
201
- waveContainer.classList.remove('active');
202
  } else {
203
  recognition.stop();
204
  isRecording = false;
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>محادثة صوتية</title>
7
  <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 0;
11
+ padding: 0;
12
+ background: #f0f2f5;
13
+ min-height: 100vh;
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ }
18
+ .container {
19
+ width: 100%;
20
+ min-height: 100vh;
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ position: relative;
25
+ }
26
+ .record-button-container {
27
  width: 100%;
28
+ height: 100vh;
29
  display: flex;
30
+ flex-direction: column;
31
  justify-content: center;
32
  align-items: center;
33
+ background: linear-gradient(135deg, #6e8efb, #4a6cf7);
34
+ }
35
+ .record-button {
36
+ width: 60vmin; /* تصغير حجم الزر */
37
+ height: 60vmin; /* تصغير حجم الزر */
38
+ border-radius: 50%;
39
+ background: rgba(255, 255, 255, 0.1);
40
+ border: none;
41
+ cursor: pointer;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ position: relative;
46
+ transition: all 0.3s ease;
47
+ box-shadow: 0 10px 30px rgba(0,0,0,0.2);
48
+ backdrop-filter: blur(5px);
49
+ }
50
+ .record-button:hover {
51
+ transform: scale(1.02);
52
+ box-shadow: 0 15px 40px rgba(0,0,0,0.3);
53
+ }
54
+ .record-button.recording {
55
+ background: rgba(255, 68, 68, 0.2);
56
+ animation: pulse 2s infinite;
57
+ }
58
+ .record-button.recording .inner-circle {
59
+ background: #ff4444;
60
+ transform: scale(0.8);
61
+ }
62
+ .inner-circle {
63
+ width: 40%;
64
+ height: 40%;
65
+ background: #ffffff;
66
+ border-radius: 50%;
67
+ transition: all 0.3s ease;
68
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
69
  }
70
 
71
+ /* موجات صوتية تحت الزر */
72
+ .wave-container {
73
+ margin-top: 30px;
74
+ display: flex;
75
+ justify-content: center;
76
+ align-items: center;
77
+ gap: 5px;
78
+ height: 50px;
79
  }
80
 
81
  .wave {
82
+ width: 4px;
83
+ height: 20px;
84
+ background: rgba(255, 255, 255, 0.6);
85
+ border-radius: 2px;
86
+ animation: waveAnimation 1s ease-in-out infinite;
87
  }
88
 
89
  .wave:nth-child(2) { animation-delay: 0.1s; }
90
  .wave:nth-child(3) { animation-delay: 0.2s; }
91
  .wave:nth-child(4) { animation-delay: 0.3s; }
92
  .wave:nth-child(5) { animation-delay: 0.4s; }
93
+ .wave:nth-child(6) { animation-delay: 0.5s; }
94
+ .wave:nth-child(7) { animation-delay: 0.6s; }
95
+ .wave:nth-child(8) { animation-delay: 0.7s; }
96
 
97
+ @keyframes waveAnimation {
98
+ 0%, 100% { transform: scaleY(0.5); }
99
+ 50% { transform: scaleY(2); }
100
+ }
101
+
102
+ .status-text {
103
+ position: absolute;
104
+ bottom: 10%;
105
+ text-align: center;
106
+ color: white;
107
+ font-size: 1.5rem;
108
+ font-weight: bold;
109
+ text-shadow: 0 2px 4px rgba(0,0,0,0.2);
110
+ }
111
+
112
+ /* باقي الأنماط الأصلية */
113
+ .toggle-code-button {
114
+ position: fixed;
115
+ top: 20px;
116
+ right: 20px;
117
+ padding: 10px 20px;
118
+ background: rgba(255, 255, 255, 0.2);
119
+ border: none;
120
+ border-radius: 25px;
121
+ color: white;
122
+ cursor: pointer;
123
+ backdrop-filter: blur(5px);
124
+ transition: all 0.3s ease;
125
+ z-index: 1000;
126
+ }
127
+ .toggle-code-button:hover {
128
+ background: rgba(255, 255, 255, 0.3);
129
+ }
130
+ .code-section {
131
+ display: none;
132
+ position: fixed;
133
+ top: 0;
134
+ left: 0;
135
+ width: 100%;
136
+ height: 100%;
137
+ background: rgba(0, 0, 0, 0.95);
138
+ z-index: 999;
139
+ overflow-y: auto;
140
+ padding: 20px;
141
+ box-sizing: border-box;
142
+ }
143
+ .code-section.visible {
144
+ display: block;
145
+ }
146
+ .message-container {
147
+ background: rgba(255, 255, 255, 0.1);
148
+ padding: 15px;
149
+ border-radius: 15px;
150
+ margin: 10px;
151
+ backdrop-filter: blur(5px);
152
+ color: white;
153
+ width: 90%;
154
+ max-width: 600px;
155
+ }
156
+ .message-label {
157
+ font-weight: bold;
158
+ margin-bottom: 8px;
159
+ }
160
+ .message-content {
161
+ padding: 10px;
162
+ background: rgba(255, 255, 255, 0.05);
163
+ border-radius: 8px;
164
+ min-height: 40px;
165
+ }
166
+ .voice-settings {
167
+ position: fixed;
168
+ bottom: 20px;
169
+ width: 90%;
170
+ max-width: 600px;
171
+ padding: 15px;
172
+ background: rgba(255, 255, 255, 0.1);
173
+ border-radius: 15px;
174
+ backdrop-filter: blur(5px);
175
+ }
176
+ select {
177
+ width: 100%;
178
+ padding: 12px;
179
+ border-radius: 10px;
180
+ border: 1px solid rgba(255, 255, 255, 0.2);
181
+ background: rgba(255, 255, 255, 0.1);
182
+ color: white;
183
+ font-size: 16px;
184
+ }
185
+ @keyframes pulse {
186
+ 0% { transform: scale(1); }
187
+ 50% { transform: scale(1.05); }
188
+ 100% { transform: scale(1); }
189
  }
190
  </style>
191
  </head>
 
197
  <button class="record-button" id="recordButton">
198
  <div class="inner-circle"></div>
199
  </button>
200
+ <!-- إضافة الموجات الصوتية تحت الزر -->
201
+ <div class="wave-container">
202
+ <div class="wave"></div>
203
+ <div class="wave"></div>
204
+ <div class="wave"></div>
205
+ <div class="wave"></div>
206
+ <div class="wave"></div>
207
+ <div class="wave"></div>
208
+ <div class="wave"></div>
209
+ <div class="wave"></div>
210
+ </div>
211
  </div>
212
  <div class="status-text" id="statusText">انقر للبدء في التسجيل</div>
213
 
 
 
 
 
 
 
 
 
 
214
  <div class="code-section" id="codeSection">
215
  <div class="message-container">
216
  <div class="message-label">ما قلته:</div>
 
239
  const voiceSelect = document.getElementById('voiceSelect');
240
  const toggleCodeButton = document.getElementById('toggleCode');
241
  const codeSection = document.getElementById('codeSection');
242
+ const waveContainer = document.querySelector('.wave-container');
243
 
244
  let isRecording = false;
245
 
 
257
  const voices = speechSynthesis.getVoices();
258
  voiceSelect.innerHTML = '<option value="">اختر صوت رجل عربي فصحى</option>';
259
 
 
260
  voices.forEach((voice, index) => {
261
  if (voice.lang.includes('ar') && (voice.name.includes('Male') || voice.name.includes('رجل'))) {
262
  const option = document.createElement('option');
 
269
  }
270
  });
271
 
 
272
  if (voiceSelect.options.length === 1) {
273
  voices.forEach((voice, index) => {
274
  if (voice.name.includes('Male')) {
 
308
  utterance.lang = 'ar-SA';
309
  utterance.rate = 1;
310
  utterance.pitch = 1;
 
 
 
311
 
 
 
 
 
 
312
  speechSynthesis.speak(utterance);
313
  } catch (error) {
314
  modelResponse.textContent = 'حدث خطأ في الاتصال بالنموذج';
 
337
  statusText.textContent = 'جارٍ التسجيل... انقر للإيقاف';
338
  spokenText.textContent = '';
339
  modelResponse.textContent = '';
 
340
  } else {
341
  recognition.stop();
342
  isRecording = false;