wineater-bot 3.0.13 → 3.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wineater-chatbot.mjs +68 -15
- package/dist/wineater-chatbot.umd.js +68 -15
- package/package.json +1 -1
- package/src/js/widget-styles.js +67 -14
- package/src/js/widget.js +43 -43
|
@@ -6862,7 +6862,7 @@ const Ra = `
|
|
|
6862
6862
|
box-sizing: border-box;
|
|
6863
6863
|
z-index: 10000;
|
|
6864
6864
|
max-width: 1200px;
|
|
6865
|
-
min-width:
|
|
6865
|
+
min-width: 1024px;
|
|
6866
6866
|
min-height: 500px;
|
|
6867
6867
|
margin: 40px auto;
|
|
6868
6868
|
}
|
|
@@ -6905,6 +6905,7 @@ width: 100%;
|
|
|
6905
6905
|
color: #666;
|
|
6906
6906
|
margin-top: 8px;
|
|
6907
6907
|
text-align: center;
|
|
6908
|
+
padding: 0 15%;
|
|
6908
6909
|
}
|
|
6909
6910
|
|
|
6910
6911
|
/* Поле ввода */
|
|
@@ -7000,6 +7001,11 @@ width: 100%;
|
|
|
7000
7001
|
}
|
|
7001
7002
|
|
|
7002
7003
|
/* Карточка рекомендации */
|
|
7004
|
+
|
|
7005
|
+
.bar-widget #wine-placeholder {
|
|
7006
|
+
min-height: 0;
|
|
7007
|
+
}
|
|
7008
|
+
|
|
7003
7009
|
.wine-recommendation-tile {
|
|
7004
7010
|
display: flex;
|
|
7005
7011
|
padding: 16px;
|
|
@@ -7013,6 +7019,18 @@ width: 100%;
|
|
|
7013
7019
|
cursor: pointer;
|
|
7014
7020
|
}
|
|
7015
7021
|
|
|
7022
|
+
.wine-recommendation-tile img {
|
|
7023
|
+
width: 100%;
|
|
7024
|
+
height: auto;
|
|
7025
|
+
border-radius: 8px;
|
|
7026
|
+
margin-bottom: 8px;
|
|
7027
|
+
}
|
|
7028
|
+
|
|
7029
|
+
.wine-recommendation-tile:hover {
|
|
7030
|
+
transform: scale(1.05);
|
|
7031
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
|
|
7032
|
+
}
|
|
7033
|
+
|
|
7016
7034
|
#loading-indicator {
|
|
7017
7035
|
position: absolute;
|
|
7018
7036
|
top: 50%;
|
|
@@ -7047,25 +7065,25 @@ width: 100%;
|
|
|
7047
7065
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
|
|
7048
7066
|
}
|
|
7049
7067
|
|
|
7068
|
+
/* Стиль для Somm Selection */
|
|
7050
7069
|
.somm-selection {
|
|
7051
7070
|
position: relative;
|
|
7052
|
-
border: 2px solid #FFD700;
|
|
7053
|
-
background: linear-gradient(white, #FFF8DC);
|
|
7054
|
-
box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
|
|
7071
|
+
border: 2px solid #FFD700;
|
|
7072
|
+
background: linear-gradient(white, #FFF8DC);
|
|
7073
|
+
box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
|
|
7055
7074
|
}
|
|
7056
7075
|
|
|
7057
|
-
/* Подпись Somm Selection */
|
|
7058
7076
|
.somm-selection-badge {
|
|
7059
7077
|
position: absolute;
|
|
7060
7078
|
top: -10px;
|
|
7061
7079
|
left: 10px;
|
|
7062
|
-
background: linear-gradient(90deg, #FFD700, #FFB800);
|
|
7080
|
+
background: linear-gradient(90deg, #FFD700, #FFB800);
|
|
7063
7081
|
color: #FFF;
|
|
7064
7082
|
font-size: 12px;
|
|
7065
7083
|
font-weight: bold;
|
|
7066
7084
|
padding: 4px 8px;
|
|
7067
7085
|
border-radius: 4px;
|
|
7068
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
7086
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
7069
7087
|
}
|
|
7070
7088
|
|
|
7071
7089
|
/* Изображение */
|
|
@@ -7078,22 +7096,19 @@ width: 100%;
|
|
|
7078
7096
|
|
|
7079
7097
|
/* Детали карточки */
|
|
7080
7098
|
.tile-details {
|
|
7081
|
-
|
|
7082
|
-
color: #333;
|
|
7083
|
-
flex: 1;
|
|
7099
|
+
text-align: left;
|
|
7084
7100
|
}
|
|
7085
7101
|
|
|
7086
7102
|
.tile-details strong {
|
|
7087
|
-
|
|
7088
|
-
font-size: 18px;
|
|
7103
|
+
font-size: 16px;
|
|
7089
7104
|
margin-bottom: 4px;
|
|
7090
7105
|
font-weight: bold;
|
|
7091
|
-
|
|
7106
|
+
display: block;
|
|
7092
7107
|
}
|
|
7093
7108
|
|
|
7094
7109
|
.tile-details p {
|
|
7110
|
+
font-size: 14px;
|
|
7095
7111
|
margin: 4px 0;
|
|
7096
|
-
color: #555;
|
|
7097
7112
|
}
|
|
7098
7113
|
|
|
7099
7114
|
.tile-details a {
|
|
@@ -7268,6 +7283,44 @@ width: 100%;
|
|
|
7268
7283
|
box-shadow: 0 4px 8px rgba(123, 43, 235, 0.15);
|
|
7269
7284
|
}
|
|
7270
7285
|
|
|
7286
|
+
/* Адаптивность для мобильных устройств */
|
|
7287
|
+
@media screen and (max-width: 768px) {
|
|
7288
|
+
#wine-widget-container {
|
|
7289
|
+
flex-direction: column;
|
|
7290
|
+
padding: 16px;
|
|
7291
|
+
min-width: 100vw;
|
|
7292
|
+
}
|
|
7293
|
+
|
|
7294
|
+
#wine-placeholder {
|
|
7295
|
+
display: flex;
|
|
7296
|
+
gap: 8px;
|
|
7297
|
+
overflow-x: auto;
|
|
7298
|
+
scroll-snap-type: x mandatory;
|
|
7299
|
+
padding: 8px 0;
|
|
7300
|
+
width: 100%;
|
|
7301
|
+
min-width: calc(100vw - 32px);
|
|
7302
|
+
}
|
|
7303
|
+
|
|
7304
|
+
#wine-widget-header p {
|
|
7305
|
+
display: none;
|
|
7306
|
+
}
|
|
7307
|
+
|
|
7308
|
+
.wine-recommendation-tile {
|
|
7309
|
+
width: 200px;
|
|
7310
|
+
text-align: center;
|
|
7311
|
+
}
|
|
7312
|
+
|
|
7313
|
+
.tile-details {
|
|
7314
|
+
text-align: center;
|
|
7315
|
+
}
|
|
7316
|
+
|
|
7317
|
+
.wine-recommendation-tile {
|
|
7318
|
+
flex: 0 0 auto;
|
|
7319
|
+
scroll-snap-align: center;
|
|
7320
|
+
width: 240px;
|
|
7321
|
+
display: block;
|
|
7322
|
+
}
|
|
7323
|
+
}
|
|
7271
7324
|
|
|
7272
7325
|
|
|
7273
7326
|
.hidden {
|
|
@@ -7670,7 +7723,7 @@ class La {
|
|
|
7670
7723
|
e.insertAdjacentHTML("beforeend", n), this.addEventListenersStoreVersion();
|
|
7671
7724
|
} else {
|
|
7672
7725
|
const n = `
|
|
7673
|
-
<div id="wine-widget-container">
|
|
7726
|
+
<div id="wine-widget-container" class="bar-widget">
|
|
7674
7727
|
<div id="wine-widget-right">
|
|
7675
7728
|
${fn.dishGroups.map((s) => `
|
|
7676
7729
|
<!-- Обёртка группы -->
|
|
@@ -674,7 +674,7 @@ If you're using serverside rendering in your app, make sure that tracker is load
|
|
|
674
674
|
box-sizing: border-box;
|
|
675
675
|
z-index: 10000;
|
|
676
676
|
max-width: 1200px;
|
|
677
|
-
min-width:
|
|
677
|
+
min-width: 1024px;
|
|
678
678
|
min-height: 500px;
|
|
679
679
|
margin: 40px auto;
|
|
680
680
|
}
|
|
@@ -717,6 +717,7 @@ width: 100%;
|
|
|
717
717
|
color: #666;
|
|
718
718
|
margin-top: 8px;
|
|
719
719
|
text-align: center;
|
|
720
|
+
padding: 0 15%;
|
|
720
721
|
}
|
|
721
722
|
|
|
722
723
|
/* Поле ввода */
|
|
@@ -812,6 +813,11 @@ width: 100%;
|
|
|
812
813
|
}
|
|
813
814
|
|
|
814
815
|
/* Карточка рекомендации */
|
|
816
|
+
|
|
817
|
+
.bar-widget #wine-placeholder {
|
|
818
|
+
min-height: 0;
|
|
819
|
+
}
|
|
820
|
+
|
|
815
821
|
.wine-recommendation-tile {
|
|
816
822
|
display: flex;
|
|
817
823
|
padding: 16px;
|
|
@@ -825,6 +831,18 @@ width: 100%;
|
|
|
825
831
|
cursor: pointer;
|
|
826
832
|
}
|
|
827
833
|
|
|
834
|
+
.wine-recommendation-tile img {
|
|
835
|
+
width: 100%;
|
|
836
|
+
height: auto;
|
|
837
|
+
border-radius: 8px;
|
|
838
|
+
margin-bottom: 8px;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.wine-recommendation-tile:hover {
|
|
842
|
+
transform: scale(1.05);
|
|
843
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
|
|
844
|
+
}
|
|
845
|
+
|
|
828
846
|
#loading-indicator {
|
|
829
847
|
position: absolute;
|
|
830
848
|
top: 50%;
|
|
@@ -859,25 +877,25 @@ width: 100%;
|
|
|
859
877
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
|
|
860
878
|
}
|
|
861
879
|
|
|
880
|
+
/* Стиль для Somm Selection */
|
|
862
881
|
.somm-selection {
|
|
863
882
|
position: relative;
|
|
864
|
-
border: 2px solid #FFD700;
|
|
865
|
-
background: linear-gradient(white, #FFF8DC);
|
|
866
|
-
box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
|
|
883
|
+
border: 2px solid #FFD700;
|
|
884
|
+
background: linear-gradient(white, #FFF8DC);
|
|
885
|
+
box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
|
|
867
886
|
}
|
|
868
887
|
|
|
869
|
-
/* Подпись Somm Selection */
|
|
870
888
|
.somm-selection-badge {
|
|
871
889
|
position: absolute;
|
|
872
890
|
top: -10px;
|
|
873
891
|
left: 10px;
|
|
874
|
-
background: linear-gradient(90deg, #FFD700, #FFB800);
|
|
892
|
+
background: linear-gradient(90deg, #FFD700, #FFB800);
|
|
875
893
|
color: #FFF;
|
|
876
894
|
font-size: 12px;
|
|
877
895
|
font-weight: bold;
|
|
878
896
|
padding: 4px 8px;
|
|
879
897
|
border-radius: 4px;
|
|
880
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
898
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
881
899
|
}
|
|
882
900
|
|
|
883
901
|
/* Изображение */
|
|
@@ -890,22 +908,19 @@ width: 100%;
|
|
|
890
908
|
|
|
891
909
|
/* Детали карточки */
|
|
892
910
|
.tile-details {
|
|
893
|
-
|
|
894
|
-
color: #333;
|
|
895
|
-
flex: 1;
|
|
911
|
+
text-align: left;
|
|
896
912
|
}
|
|
897
913
|
|
|
898
914
|
.tile-details strong {
|
|
899
|
-
|
|
900
|
-
font-size: 18px;
|
|
915
|
+
font-size: 16px;
|
|
901
916
|
margin-bottom: 4px;
|
|
902
917
|
font-weight: bold;
|
|
903
|
-
|
|
918
|
+
display: block;
|
|
904
919
|
}
|
|
905
920
|
|
|
906
921
|
.tile-details p {
|
|
922
|
+
font-size: 14px;
|
|
907
923
|
margin: 4px 0;
|
|
908
|
-
color: #555;
|
|
909
924
|
}
|
|
910
925
|
|
|
911
926
|
.tile-details a {
|
|
@@ -1080,6 +1095,44 @@ width: 100%;
|
|
|
1080
1095
|
box-shadow: 0 4px 8px rgba(123, 43, 235, 0.15);
|
|
1081
1096
|
}
|
|
1082
1097
|
|
|
1098
|
+
/* Адаптивность для мобильных устройств */
|
|
1099
|
+
@media screen and (max-width: 768px) {
|
|
1100
|
+
#wine-widget-container {
|
|
1101
|
+
flex-direction: column;
|
|
1102
|
+
padding: 16px;
|
|
1103
|
+
min-width: 100vw;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
#wine-placeholder {
|
|
1107
|
+
display: flex;
|
|
1108
|
+
gap: 8px;
|
|
1109
|
+
overflow-x: auto;
|
|
1110
|
+
scroll-snap-type: x mandatory;
|
|
1111
|
+
padding: 8px 0;
|
|
1112
|
+
width: 100%;
|
|
1113
|
+
min-width: calc(100vw - 32px);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
#wine-widget-header p {
|
|
1117
|
+
display: none;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
.wine-recommendation-tile {
|
|
1121
|
+
width: 200px;
|
|
1122
|
+
text-align: center;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
.tile-details {
|
|
1126
|
+
text-align: center;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
.wine-recommendation-tile {
|
|
1130
|
+
flex: 0 0 auto;
|
|
1131
|
+
scroll-snap-align: center;
|
|
1132
|
+
width: 240px;
|
|
1133
|
+
display: block;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1083
1136
|
|
|
1084
1137
|
|
|
1085
1138
|
.hidden {
|
|
@@ -1113,7 +1166,7 @@ width: 100%;
|
|
|
1113
1166
|
</div>
|
|
1114
1167
|
</div>
|
|
1115
1168
|
`;e.insertAdjacentHTML("beforeend",n),this.addEventListenersStoreVersion()}else{const n=`
|
|
1116
|
-
<div id="wine-widget-container">
|
|
1169
|
+
<div id="wine-widget-container" class="bar-widget">
|
|
1117
1170
|
<div id="wine-widget-right">
|
|
1118
1171
|
${kn.dishGroups.map(s=>`
|
|
1119
1172
|
<!-- Обёртка группы -->
|
package/package.json
CHANGED
package/src/js/widget-styles.js
CHANGED
|
@@ -12,7 +12,7 @@ const widgetStyles = `
|
|
|
12
12
|
box-sizing: border-box;
|
|
13
13
|
z-index: 10000;
|
|
14
14
|
max-width: 1200px;
|
|
15
|
-
min-width:
|
|
15
|
+
min-width: 1024px;
|
|
16
16
|
min-height: 500px;
|
|
17
17
|
margin: 40px auto;
|
|
18
18
|
}
|
|
@@ -55,6 +55,7 @@ width: 100%;
|
|
|
55
55
|
color: #666;
|
|
56
56
|
margin-top: 8px;
|
|
57
57
|
text-align: center;
|
|
58
|
+
padding: 0 15%;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/* Поле ввода */
|
|
@@ -150,6 +151,11 @@ width: 100%;
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
/* Карточка рекомендации */
|
|
154
|
+
|
|
155
|
+
.bar-widget #wine-placeholder {
|
|
156
|
+
min-height: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
.wine-recommendation-tile {
|
|
154
160
|
display: flex;
|
|
155
161
|
padding: 16px;
|
|
@@ -163,6 +169,18 @@ width: 100%;
|
|
|
163
169
|
cursor: pointer;
|
|
164
170
|
}
|
|
165
171
|
|
|
172
|
+
.wine-recommendation-tile img {
|
|
173
|
+
width: 100%;
|
|
174
|
+
height: auto;
|
|
175
|
+
border-radius: 8px;
|
|
176
|
+
margin-bottom: 8px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.wine-recommendation-tile:hover {
|
|
180
|
+
transform: scale(1.05);
|
|
181
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
|
|
182
|
+
}
|
|
183
|
+
|
|
166
184
|
#loading-indicator {
|
|
167
185
|
position: absolute;
|
|
168
186
|
top: 50%;
|
|
@@ -197,25 +215,25 @@ width: 100%;
|
|
|
197
215
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
|
|
198
216
|
}
|
|
199
217
|
|
|
218
|
+
/* Стиль для Somm Selection */
|
|
200
219
|
.somm-selection {
|
|
201
220
|
position: relative;
|
|
202
|
-
border: 2px solid #FFD700;
|
|
203
|
-
background: linear-gradient(white, #FFF8DC);
|
|
204
|
-
box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
|
|
221
|
+
border: 2px solid #FFD700;
|
|
222
|
+
background: linear-gradient(white, #FFF8DC);
|
|
223
|
+
box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
|
|
205
224
|
}
|
|
206
225
|
|
|
207
|
-
/* Подпись Somm Selection */
|
|
208
226
|
.somm-selection-badge {
|
|
209
227
|
position: absolute;
|
|
210
228
|
top: -10px;
|
|
211
229
|
left: 10px;
|
|
212
|
-
background: linear-gradient(90deg, #FFD700, #FFB800);
|
|
230
|
+
background: linear-gradient(90deg, #FFD700, #FFB800);
|
|
213
231
|
color: #FFF;
|
|
214
232
|
font-size: 12px;
|
|
215
233
|
font-weight: bold;
|
|
216
234
|
padding: 4px 8px;
|
|
217
235
|
border-radius: 4px;
|
|
218
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
236
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
219
237
|
}
|
|
220
238
|
|
|
221
239
|
/* Изображение */
|
|
@@ -228,22 +246,19 @@ width: 100%;
|
|
|
228
246
|
|
|
229
247
|
/* Детали карточки */
|
|
230
248
|
.tile-details {
|
|
231
|
-
|
|
232
|
-
color: #333;
|
|
233
|
-
flex: 1;
|
|
249
|
+
text-align: left;
|
|
234
250
|
}
|
|
235
251
|
|
|
236
252
|
.tile-details strong {
|
|
237
|
-
|
|
238
|
-
font-size: 18px;
|
|
253
|
+
font-size: 16px;
|
|
239
254
|
margin-bottom: 4px;
|
|
240
255
|
font-weight: bold;
|
|
241
|
-
|
|
256
|
+
display: block;
|
|
242
257
|
}
|
|
243
258
|
|
|
244
259
|
.tile-details p {
|
|
260
|
+
font-size: 14px;
|
|
245
261
|
margin: 4px 0;
|
|
246
|
-
color: #555;
|
|
247
262
|
}
|
|
248
263
|
|
|
249
264
|
.tile-details a {
|
|
@@ -418,6 +433,44 @@ width: 100%;
|
|
|
418
433
|
box-shadow: 0 4px 8px rgba(123, 43, 235, 0.15);
|
|
419
434
|
}
|
|
420
435
|
|
|
436
|
+
/* Адаптивность для мобильных устройств */
|
|
437
|
+
@media screen and (max-width: 768px) {
|
|
438
|
+
#wine-widget-container {
|
|
439
|
+
flex-direction: column;
|
|
440
|
+
padding: 16px;
|
|
441
|
+
min-width: 100vw;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
#wine-placeholder {
|
|
445
|
+
display: flex;
|
|
446
|
+
gap: 8px;
|
|
447
|
+
overflow-x: auto;
|
|
448
|
+
scroll-snap-type: x mandatory;
|
|
449
|
+
padding: 8px 0;
|
|
450
|
+
width: 100%;
|
|
451
|
+
min-width: calc(100vw - 32px);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
#wine-widget-header p {
|
|
455
|
+
display: none;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.wine-recommendation-tile {
|
|
459
|
+
width: 200px;
|
|
460
|
+
text-align: center;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.tile-details {
|
|
464
|
+
text-align: center;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.wine-recommendation-tile {
|
|
468
|
+
flex: 0 0 auto;
|
|
469
|
+
scroll-snap-align: center;
|
|
470
|
+
width: 240px;
|
|
471
|
+
display: block;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
421
474
|
|
|
422
475
|
|
|
423
476
|
.hidden {
|
package/src/js/widget.js
CHANGED
|
@@ -71,7 +71,7 @@ export class WineWidget {
|
|
|
71
71
|
this.addEventListenersStoreVersion();
|
|
72
72
|
} else {
|
|
73
73
|
const barHTML = `
|
|
74
|
-
<div id="wine-widget-container">
|
|
74
|
+
<div id="wine-widget-container" class="bar-widget">
|
|
75
75
|
<div id="wine-widget-right">
|
|
76
76
|
${barConfig.dishGroups.map(group => `
|
|
77
77
|
<!-- Обёртка группы -->
|
|
@@ -383,49 +383,49 @@ export class WineWidget {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
initializeSearchAnimation() {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
} else {
|
|
401
|
-
setTimeout(typeEffect, 100); // Скорость ввода
|
|
402
|
-
}
|
|
386
|
+
const searchInput = document.getElementById('wine-search-input');
|
|
387
|
+
const suggestions = translator.translate('placeholderSuggestions');
|
|
388
|
+
let index = 0;
|
|
389
|
+
let charIndex = 0;
|
|
390
|
+
let typingForward = true;
|
|
391
|
+
let isInputFocused = false;
|
|
392
|
+
|
|
393
|
+
const typeEffect = () => {
|
|
394
|
+
if (isInputFocused) return; // Если фокус в поле ввода, эффект останавливается
|
|
395
|
+
if (typingForward) {
|
|
396
|
+
searchInput.placeholder = suggestions[index].substring(0, charIndex++);
|
|
397
|
+
if (charIndex > suggestions[index].length) {
|
|
398
|
+
typingForward = false;
|
|
399
|
+
setTimeout(typeEffect, 2000); // Пауза после завершения строки
|
|
403
400
|
} else {
|
|
404
|
-
|
|
405
|
-
if (charIndex < 0) {
|
|
406
|
-
typingForward = true;
|
|
407
|
-
index = (index + 1) % suggestions.length; // Переход к следующей подсказке
|
|
408
|
-
setTimeout(typeEffect, 500); // Пауза перед началом следующей строки
|
|
409
|
-
} else {
|
|
410
|
-
setTimeout(typeEffect, 50); // Скорость удаления
|
|
411
|
-
}
|
|
401
|
+
setTimeout(typeEffect, 100); // Скорость ввода
|
|
412
402
|
}
|
|
413
|
-
}
|
|
414
|
-
|
|
403
|
+
} else {
|
|
404
|
+
searchInput.placeholder = suggestions[index].substring(0, charIndex--);
|
|
405
|
+
if (charIndex < 0) {
|
|
406
|
+
typingForward = true;
|
|
407
|
+
index = (index + 1) % suggestions.length; // Переход к следующей подсказке
|
|
408
|
+
setTimeout(typeEffect, 500); // Пауза перед началом следующей строки
|
|
409
|
+
} else {
|
|
410
|
+
setTimeout(typeEffect, 50); // Скорость удаления
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
typeEffect();
|
|
416
|
+
|
|
417
|
+
// Очистка строки и остановка эффекта при фокусе
|
|
418
|
+
searchInput.addEventListener('focus', () => {
|
|
419
|
+
searchInput.placeholder = '';
|
|
420
|
+
isInputFocused = true; // Останавливаем эффект
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
// Возобновление эффекта при потере фокуса
|
|
424
|
+
searchInput.addEventListener('blur', () => {
|
|
425
|
+
isInputFocused = false; // Возобновляем эффект
|
|
426
|
+
charIndex = 0;
|
|
427
|
+
typingForward = true;
|
|
415
428
|
typeEffect();
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
searchInput.addEventListener('focus', () => {
|
|
419
|
-
searchInput.placeholder = '';
|
|
420
|
-
isInputFocused = true; // Останавливаем эффект
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
// Возобновление эффекта при потере фокуса
|
|
424
|
-
searchInput.addEventListener('blur', () => {
|
|
425
|
-
isInputFocused = false; // Возобновляем эффект
|
|
426
|
-
charIndex = 0;
|
|
427
|
-
typingForward = true;
|
|
428
|
-
typeEffect();
|
|
429
|
-
});
|
|
430
|
-
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
431
|
}
|