ghost 4.27.1 → 4.30.0
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/content/themes/casper/assets/built/screen.css +1 -1
- package/content/themes/casper/assets/built/screen.css.map +1 -1
- package/content/themes/casper/assets/css/screen.css +1 -17
- package/content/themes/casper/package.json +1 -1
- package/content/themes/casper/partials/post-card.hbs +1 -1
- package/core/boot.js +3 -5
- package/core/built/assets/{ghost-dark-ae67fe157509b6e82c607ba560fc52e9.css → ghost-dark-1594d07a0716e0253a78234c8e42d765.css} +1 -1
- package/core/built/assets/{ghost.min-2d534cce15c43c646814b26f4beefb78.js → ghost.min-884660873d56fcc3d2a3b9fe94c9f022.js} +79 -79
- package/core/built/assets/{ghost.min-b1e58e098721e467388682a85a7c187d.css → ghost.min-c21fea11c3f431994a8ee7c47a8ed145.css} +1 -1
- package/core/built/assets/icons/audio-file.svg +5 -0
- package/core/built/assets/icons/file-download.svg +1 -0
- package/core/built/assets/icons/file-upload.svg +1 -0
- package/core/built/assets/icons/film-camera.svg +4 -0
- package/core/built/assets/icons/mute.svg +3 -0
- package/core/built/assets/icons/pause.svg +4 -0
- package/core/built/assets/icons/play.svg +3 -0
- package/core/built/assets/icons/unmute.svg +3 -0
- package/core/built/assets/{vendor.min-e433aa7d5620e7837f30e170cd43f84e.js → vendor.min-a2fd1e62ce6da8911fee8e812d8c6ceb.js} +240 -128
- package/core/frontend/apps/amp/lib/views/amp.hbs +94 -2
- package/core/frontend/services/theme-engine/i18n/i18n.js +11 -12
- package/core/frontend/services/theme-engine/i18n/index.js +1 -2
- package/core/frontend/services/theme-engine/i18n/theme-i18n.js +5 -4
- package/core/frontend/src/cards/css/audio.css +95 -30
- package/core/frontend/src/cards/css/before-after.css +47 -0
- package/core/frontend/src/cards/css/bookmark.css +6 -5
- package/core/frontend/src/cards/css/button.css +8 -7
- package/core/frontend/src/cards/css/callout.css +4 -4
- package/core/frontend/src/cards/css/file.css +126 -0
- package/core/frontend/src/cards/css/nft.css +9 -13
- package/core/frontend/src/cards/css/product.css +81 -52
- package/core/frontend/src/cards/css/toggle.css +31 -22
- package/core/frontend/src/cards/css/video.css +340 -0
- package/core/frontend/src/cards/js/audio.js +127 -128
- package/core/frontend/src/cards/js/before-after.js +41 -0
- package/core/frontend/src/cards/js/gallery.js +10 -8
- package/core/frontend/src/cards/js/toggle.js +16 -14
- package/core/frontend/src/cards/js/video.js +232 -0
- package/core/frontend/web/middleware/error-handler.js +2 -2
- package/core/frontend/web/site.js +2 -1
- package/core/server/api/canary/oembed.js +1 -2
- package/core/server/data/db/state-manager.js +5 -8
- package/core/server/lib/image/cached-image-size-from-url.js +3 -4
- package/core/server/lib/image/image-utils.js +2 -2
- package/core/server/lib/image/index.js +1 -2
- package/core/server/run-update-check.js +1 -13
- package/core/server/services/email-analytics/index.js +2 -4
- package/core/server/services/email-analytics/jobs/fetch-latest.js +2 -21
- package/core/server/services/integrations/integrations-service.js +2 -2
- package/core/server/services/invites/index.js +0 -2
- package/core/server/services/invites/invites.js +3 -3
- package/core/server/services/jobs/job-service.js +1 -1
- package/core/server/services/mega/post-email-serializer.js +3 -1
- package/core/server/services/mega/template.js +15 -11
- package/core/server/services/members/api.js +0 -1
- package/core/server/services/members/config.js +4 -7
- package/core/server/services/members/service.js +1 -4
- package/core/server/services/notifications/index.js +0 -2
- package/core/server/services/notifications/notifications.js +4 -5
- package/core/server/services/stripe/index.js +0 -2
- package/core/server/services/twitter-embed.js +2 -1
- package/core/server/web/admin/app.js +4 -2
- package/core/server/web/admin/views/default-prod.html +4 -4
- package/core/server/web/admin/views/default.html +4 -4
- package/core/server/web/api/app.js +3 -2
- package/core/server/web/api/canary/admin/app.js +4 -2
- package/core/server/web/api/canary/content/app.js +4 -2
- package/core/server/web/api/v2/admin/app.js +4 -2
- package/core/server/web/api/v2/content/app.js +4 -2
- package/core/server/web/api/v3/admin/app.js +4 -2
- package/core/server/web/api/v3/content/app.js +4 -2
- package/core/server/web/members/app.js +6 -4
- package/core/server/web/shared/middleware/index.js +0 -4
- package/core/shared/labs.js +9 -8
- package/package.json +28 -23
- package/yarn.lock +2589 -1988
- package/core/server/web/shared/middleware/error-handler.js +0 -224
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
|
|
2
|
+
.kg-video-card {
|
|
3
|
+
position: relative;
|
|
4
|
+
--seek-before-width: 0%;
|
|
5
|
+
--volume-before-width: 100%;
|
|
6
|
+
--buffered-width: 0%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.kg-video-card video {
|
|
10
|
+
display: block;
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
height: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.kg-video-container {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.kg-video-overlay {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
background-image: linear-gradient(180deg,rgba(0,0,0,0.3) 0,transparent 70%,transparent 100%);
|
|
32
|
+
z-index: 999;
|
|
33
|
+
transition: opacity .2s ease-in-out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.kg-video-large-play-icon {
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
width: 72px;
|
|
41
|
+
height: 72px;
|
|
42
|
+
padding: 0;
|
|
43
|
+
background: rgba(0, 0, 0, 0.5);
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
transition: opacity .2s ease-in-out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.kg-video-large-play-icon svg {
|
|
49
|
+
width: 20px;
|
|
50
|
+
height: auto;
|
|
51
|
+
margin-left: 2px;
|
|
52
|
+
fill: #fff;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.kg-video-player-container {
|
|
56
|
+
position: absolute;
|
|
57
|
+
bottom: 0;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 80px;
|
|
60
|
+
background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.5));
|
|
61
|
+
z-index: 999;
|
|
62
|
+
transition: opacity .2s ease-in-out;
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.kg-video-player {
|
|
67
|
+
position: absolute;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
width: 100%;
|
|
72
|
+
z-index: 9999;
|
|
73
|
+
padding: 12px 16px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.kg-video-current-time {
|
|
77
|
+
min-width: 38px;
|
|
78
|
+
padding: 0 4px;
|
|
79
|
+
color: #fff;
|
|
80
|
+
font-family: inherit;
|
|
81
|
+
font-size: .85em;
|
|
82
|
+
font-weight: 500;
|
|
83
|
+
line-height: 1.4em;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.kg-video-time {
|
|
88
|
+
color: rgba(255, 255, 255, 0.6);
|
|
89
|
+
font-family: inherit;
|
|
90
|
+
font-size: .85em;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
line-height: 1.4em;
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.kg-video-duration {
|
|
97
|
+
padding: 0 4px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.kg-video-play-icon,
|
|
101
|
+
.kg-video-pause-icon {
|
|
102
|
+
position: relative;
|
|
103
|
+
padding: 0px 4px 0 0;
|
|
104
|
+
font-size: 0;
|
|
105
|
+
background: transparent;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.kg-video-hide {
|
|
109
|
+
display: none !important;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.kg-video-hide-animated {
|
|
113
|
+
opacity: 0 !important;
|
|
114
|
+
transition: opacity .2s ease-in-out;
|
|
115
|
+
cursor: initial;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.kg-video-play-icon svg,
|
|
119
|
+
.kg-video-pause-icon svg {
|
|
120
|
+
width: 14px;
|
|
121
|
+
height: 14px;
|
|
122
|
+
fill: #fff;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.kg-video-seek-slider {
|
|
126
|
+
flex-grow: 1;
|
|
127
|
+
margin: 0 4px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (max-width: 520px) {
|
|
131
|
+
.kg-video-seek-slider {
|
|
132
|
+
display: none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.kg-video-playback-rate {
|
|
137
|
+
min-width: 37px;
|
|
138
|
+
padding: 0 4px;
|
|
139
|
+
color: #fff;
|
|
140
|
+
font-family: inherit;
|
|
141
|
+
font-size: .85em;
|
|
142
|
+
font-weight: 600;
|
|
143
|
+
line-height: 1.4em;
|
|
144
|
+
text-align: left;
|
|
145
|
+
background: transparent;
|
|
146
|
+
white-space: nowrap;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (max-width: 520px) {
|
|
150
|
+
.kg-video-playback-rate {
|
|
151
|
+
padding-left: 8px;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.kg-video-mute-icon,
|
|
156
|
+
.kg-video-unmute-icon {
|
|
157
|
+
position: relative;
|
|
158
|
+
bottom: -1px;
|
|
159
|
+
padding: 0 4px;
|
|
160
|
+
font-size: 0;
|
|
161
|
+
background: transparent;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (max-width: 520px) {
|
|
165
|
+
.kg-video-mute-icon,
|
|
166
|
+
.kg-video-unmute-icon {
|
|
167
|
+
margin-left: auto;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.kg-video-mute-icon svg,
|
|
172
|
+
.kg-video-unmute-icon svg {
|
|
173
|
+
width: 16px;
|
|
174
|
+
height: 16px;
|
|
175
|
+
fill: #fff;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.kg-video-volume-slider {
|
|
179
|
+
width: 80px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@media (max-width: 300px) {
|
|
183
|
+
.kg-video-volume-slider {
|
|
184
|
+
display: none;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.kg-video-seek-slider::before {
|
|
189
|
+
content: "";
|
|
190
|
+
position: absolute;
|
|
191
|
+
left: 0;
|
|
192
|
+
width: var(--seek-before-width) !important;
|
|
193
|
+
height: 4px;
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
background-color: #EBEEF0;
|
|
196
|
+
border-radius: 2px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.kg-video-volume-slider::before {
|
|
200
|
+
content: "";
|
|
201
|
+
position: absolute;
|
|
202
|
+
left: 0;
|
|
203
|
+
width: var(--volume-before-width) !important;
|
|
204
|
+
height: 4px;
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
background-color: #EBEEF0;
|
|
207
|
+
border-radius: 2px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Resetting browser styles
|
|
211
|
+
/* --------------------------------------------------------------- */
|
|
212
|
+
|
|
213
|
+
.kg-video-card input[type=range] {
|
|
214
|
+
position: relative;
|
|
215
|
+
-webkit-appearance: none;
|
|
216
|
+
background: transparent;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.kg-video-card input[type=range]:focus {
|
|
220
|
+
outline: none;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.kg-video-card input[type=range]::-webkit-slider-thumb {
|
|
224
|
+
-webkit-appearance: none;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.kg-video-card input[type=range]::-ms-track {
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
border-color: transparent;
|
|
230
|
+
color: transparent;
|
|
231
|
+
background: transparent;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.kg-video-card button {
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
border: 0;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.kg-video-card input[type="range"] {
|
|
242
|
+
height: auto;
|
|
243
|
+
padding: 0;
|
|
244
|
+
border: 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* Chrome & Safari styles
|
|
248
|
+
/* --------------------------------------------------------------- */
|
|
249
|
+
|
|
250
|
+
.kg-video-card input[type="range"]::-webkit-slider-runnable-track {
|
|
251
|
+
width: 100%;
|
|
252
|
+
height: 4px;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
background: rgba(255, 255, 255, 0.2);
|
|
255
|
+
border-radius: 2px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.kg-video-card input[type="range"]::-webkit-slider-thumb {
|
|
259
|
+
position: relative;
|
|
260
|
+
box-sizing: content-box;
|
|
261
|
+
width: 13px;
|
|
262
|
+
height: 13px;
|
|
263
|
+
margin: -5px 0 0 0;
|
|
264
|
+
border: 0;
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
background: #fff;
|
|
267
|
+
border-radius: 50%;
|
|
268
|
+
box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,0.24);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.kg-video-card input[type="range"]:active::-webkit-slider-thumb {
|
|
272
|
+
transform: scale(1.2);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* Firefox styles
|
|
276
|
+
/* --------------------------------------------------------------- */
|
|
277
|
+
|
|
278
|
+
.kg-video-card input[type="range"]::-moz-range-track {
|
|
279
|
+
width: 100%;
|
|
280
|
+
height: 4px;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
background: rgba(255, 255, 255, 0.2);
|
|
283
|
+
border-radius: 2px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.kg-video-card input[type="range"]::-moz-range-progress {
|
|
287
|
+
background: #EBEEF0;
|
|
288
|
+
border-radius: 2px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.kg-video-card input[type="range"]::-moz-range-thumb {
|
|
292
|
+
box-sizing: content-box;
|
|
293
|
+
width: 13px;
|
|
294
|
+
height: 13px;
|
|
295
|
+
border: 0;
|
|
296
|
+
cursor: pointer;
|
|
297
|
+
background: #fff;
|
|
298
|
+
border-radius: 50%;
|
|
299
|
+
box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,0.24);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.kg-video-card input[type="range"]:active::-moz-range-thumb {
|
|
303
|
+
transform: scale(1.2);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* Edge & IE styles
|
|
307
|
+
/* --------------------------------------------------------------- */
|
|
308
|
+
|
|
309
|
+
.kg-video-card input[type="range"]::-ms-track {
|
|
310
|
+
width: 100%;
|
|
311
|
+
height: 3px;
|
|
312
|
+
border: solid transparent;
|
|
313
|
+
color: transparent;
|
|
314
|
+
cursor: pointer;
|
|
315
|
+
background: transparent;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.kg-video-card input[type="range"]::-ms-fill-lower {
|
|
319
|
+
background: #fff;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.kg-video-card input[type="range"]::-ms-fill-upper {
|
|
323
|
+
background: #EBEEF0;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.kg-video-card input[type="range"]::-ms-thumb {
|
|
327
|
+
box-sizing: content-box;
|
|
328
|
+
width: 13px;
|
|
329
|
+
height: 13px;
|
|
330
|
+
border: 0;
|
|
331
|
+
cursor: pointer;
|
|
332
|
+
background: #fff;
|
|
333
|
+
border-radius: 50%;
|
|
334
|
+
box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,0.24);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.kg-video-card input[type="range"]:active::-ms-thumb {
|
|
338
|
+
transform: scale(1.2);
|
|
339
|
+
}
|
|
340
|
+
|
|
@@ -1,147 +1,146 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
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
|
-
raf = requestAnimationFrame(whilePlaying);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const showRangeProgress = (rangeInput) => {
|
|
43
|
-
if (rangeInput === seekSlider) {
|
|
44
|
-
audioPlayerContainer.style.setProperty('--seek-before-width', rangeInput.value / rangeInput.max * 100 + '%');
|
|
1
|
+
(function() {
|
|
2
|
+
const handleAudioPlayer = function (audioElementContainer) {
|
|
3
|
+
const audioPlayerContainer = audioElementContainer.querySelector('.kg-audio-player-container');
|
|
4
|
+
const playIconContainer = audioElementContainer.querySelector('.kg-audio-play-icon');
|
|
5
|
+
const pauseIconContainer = audioElementContainer.querySelector('.kg-audio-pause-icon');
|
|
6
|
+
const seekSlider = audioElementContainer.querySelector('.kg-audio-seek-slider');
|
|
7
|
+
const playbackRateContainer = audioElementContainer.querySelector('.kg-audio-playback-rate');
|
|
8
|
+
const muteIconContainer = audioElementContainer.querySelector('.kg-audio-mute-icon');
|
|
9
|
+
const unmuteIconContainer = audioElementContainer.querySelector('.kg-audio-unmute-icon');
|
|
10
|
+
const volumeSlider = audioElementContainer.querySelector('.kg-audio-volume-slider');
|
|
11
|
+
const audio = audioElementContainer.querySelector('audio');
|
|
12
|
+
const durationContainer = audioElementContainer.querySelector('.kg-audio-duration');
|
|
13
|
+
const currentTimeContainer = audioElementContainer.querySelector('.kg-audio-current-time');
|
|
14
|
+
let playbackRates = [{
|
|
15
|
+
rate: 0.75,
|
|
16
|
+
label: '0.7×'
|
|
17
|
+
}, {
|
|
18
|
+
rate: 1.0,
|
|
19
|
+
label: '1×'
|
|
20
|
+
}, {
|
|
21
|
+
rate: 1.25,
|
|
22
|
+
label: '1.2×'
|
|
23
|
+
}, {
|
|
24
|
+
rate: 1.75,
|
|
25
|
+
label: '1.7×'
|
|
26
|
+
}, {
|
|
27
|
+
rate: 2.0,
|
|
28
|
+
label: '2×'
|
|
29
|
+
}];
|
|
30
|
+
|
|
31
|
+
let raf = null;
|
|
32
|
+
let currentPlaybackRateIdx = 1;
|
|
33
|
+
|
|
34
|
+
const whilePlaying = () => {
|
|
35
|
+
seekSlider.value = Math.floor(audio.currentTime);
|
|
36
|
+
currentTimeContainer.textContent = calculateTime(seekSlider.value);
|
|
37
|
+
audioPlayerContainer.style.setProperty('--seek-before-width', `${seekSlider.value / seekSlider.max * 100}%`);
|
|
38
|
+
raf = requestAnimationFrame(whilePlaying);
|
|
45
39
|
}
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
|
|
41
|
+
const showRangeProgress = (rangeInput) => {
|
|
42
|
+
if (rangeInput === seekSlider) {
|
|
43
|
+
audioPlayerContainer.style.setProperty('--seek-before-width', rangeInput.value / rangeInput.max * 100 + '%');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
audioPlayerContainer.style.setProperty('--volume-before-width', rangeInput.value / rangeInput.max * 100 + '%');
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
|
-
}
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
const calculateTime = (secs) => {
|
|
51
|
+
const minutes = Math.floor(secs / 60);
|
|
52
|
+
const seconds = Math.floor(secs % 60);
|
|
53
|
+
const returnedSeconds = seconds < 10 ? `0${seconds}` : `${seconds}`;
|
|
54
|
+
return `${minutes}:${returnedSeconds}`;
|
|
55
|
+
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const displayDuration = () => {
|
|
58
|
+
durationContainer.textContent = calculateTime(audio.duration);
|
|
59
|
+
}
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const setSliderMax = () => {
|
|
62
|
+
seekSlider.max = Math.floor(audio.duration);
|
|
63
|
+
}
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const displayBufferedAmount = () => {
|
|
66
|
+
if (audio.buffered.length > 0) {
|
|
67
|
+
const bufferedAmount = Math.floor(audio.buffered.end(audio.buffered.length - 1));
|
|
68
|
+
audioPlayerContainer.style.setProperty('--buffered-width', `${(bufferedAmount / seekSlider.max) * 100}%`);
|
|
69
|
+
}
|
|
70
70
|
}
|
|
71
|
-
}
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
displayDuration();
|
|
75
|
-
setSliderMax();
|
|
76
|
-
displayBufferedAmount();
|
|
77
|
-
} else {
|
|
78
|
-
audio.addEventListener('loadedmetadata', () => {
|
|
72
|
+
if (audio.readyState > 0) {
|
|
79
73
|
displayDuration();
|
|
80
74
|
setSliderMax();
|
|
81
75
|
displayBufferedAmount();
|
|
76
|
+
} else {
|
|
77
|
+
audio.addEventListener('loadedmetadata', () => {
|
|
78
|
+
displayDuration();
|
|
79
|
+
setSliderMax();
|
|
80
|
+
displayBufferedAmount();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
playIconContainer.addEventListener('click', () => {
|
|
85
|
+
playIconContainer.classList.add("kg-audio-hide");
|
|
86
|
+
pauseIconContainer.classList.remove("kg-audio-hide");
|
|
87
|
+
audio.play();
|
|
88
|
+
requestAnimationFrame(whilePlaying);
|
|
82
89
|
});
|
|
83
|
-
}
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
requestAnimationFrame(whilePlaying);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
pauseIconContainer.addEventListener('click', () => {
|
|
93
|
-
pauseIconContainer.classList.add("kg-audio-hide");
|
|
94
|
-
playIconContainer.classList.remove("kg-audio-hide");
|
|
95
|
-
audio.pause();
|
|
96
|
-
cancelAnimationFrame(raf);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
muteIconContainer.addEventListener('click', () => {
|
|
100
|
-
muteIconContainer.classList.add("kg-audio-hide");
|
|
101
|
-
unmuteIconContainer.classList.remove("kg-audio-hide");
|
|
102
|
-
audio.muted = false;
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
unmuteIconContainer.addEventListener('click', () => {
|
|
106
|
-
unmuteIconContainer.classList.add("kg-audio-hide");
|
|
107
|
-
muteIconContainer.classList.remove("kg-audio-hide");
|
|
108
|
-
audio.muted = true;
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
playbackRateContainer.addEventListener('click', () => {
|
|
112
|
-
let nextPlaybackRate = playbackRates[(currentPlaybackRateIdx + 1) % 5];
|
|
113
|
-
currentPlaybackRateIdx = currentPlaybackRateIdx + 1;
|
|
114
|
-
audio.playbackRate = nextPlaybackRate.rate;
|
|
115
|
-
playbackRateContainer.textContent = nextPlaybackRate.label;
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
audio.addEventListener('progress', displayBufferedAmount);
|
|
119
|
-
|
|
120
|
-
seekSlider.addEventListener('input', (e) => {
|
|
121
|
-
showRangeProgress(e.target);
|
|
122
|
-
currentTimeContainer.textContent = calculateTime(seekSlider.value);
|
|
123
|
-
if (!audio.paused) {
|
|
91
|
+
pauseIconContainer.addEventListener('click', () => {
|
|
92
|
+
pauseIconContainer.classList.add("kg-audio-hide");
|
|
93
|
+
playIconContainer.classList.remove("kg-audio-hide");
|
|
94
|
+
audio.pause();
|
|
124
95
|
cancelAnimationFrame(raf);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
96
|
+
});
|
|
127
97
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
});
|
|
98
|
+
muteIconContainer.addEventListener('click', () => {
|
|
99
|
+
muteIconContainer.classList.add("kg-audio-hide");
|
|
100
|
+
unmuteIconContainer.classList.remove("kg-audio-hide");
|
|
101
|
+
audio.muted = false;
|
|
102
|
+
});
|
|
134
103
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
104
|
+
unmuteIconContainer.addEventListener('click', () => {
|
|
105
|
+
unmuteIconContainer.classList.add("kg-audio-hide");
|
|
106
|
+
muteIconContainer.classList.remove("kg-audio-hide");
|
|
107
|
+
audio.muted = true;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
playbackRateContainer.addEventListener('click', () => {
|
|
111
|
+
let nextPlaybackRate = playbackRates[(currentPlaybackRateIdx + 1) % 5];
|
|
112
|
+
currentPlaybackRateIdx = currentPlaybackRateIdx + 1;
|
|
113
|
+
audio.playbackRate = nextPlaybackRate.rate;
|
|
114
|
+
playbackRateContainer.textContent = nextPlaybackRate.label;
|
|
115
|
+
});
|
|
141
116
|
|
|
142
|
-
|
|
117
|
+
audio.addEventListener('progress', displayBufferedAmount);
|
|
143
118
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
119
|
+
seekSlider.addEventListener('input', (e) => {
|
|
120
|
+
showRangeProgress(e.target);
|
|
121
|
+
currentTimeContainer.textContent = calculateTime(seekSlider.value);
|
|
122
|
+
if (!audio.paused) {
|
|
123
|
+
cancelAnimationFrame(raf);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
147
126
|
|
|
127
|
+
seekSlider.addEventListener('change', () => {
|
|
128
|
+
audio.currentTime = seekSlider.value;
|
|
129
|
+
if (!audio.paused) {
|
|
130
|
+
requestAnimationFrame(whilePlaying);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
volumeSlider.addEventListener('input', (e) => {
|
|
135
|
+
const value = e.target.value;
|
|
136
|
+
showRangeProgress(e.target);
|
|
137
|
+
audio.volume = value / 100;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const audioCardElements = document.querySelectorAll('.kg-audio-card');
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < audioCardElements.length; i++) {
|
|
144
|
+
handleAudioPlayer(audioCardElements[i]);
|
|
145
|
+
}
|
|
146
|
+
})();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
const beforeAfterCards = [...document.querySelectorAll('.kg-before-after-card')];
|
|
3
|
+
|
|
4
|
+
for (let card of beforeAfterCards) {
|
|
5
|
+
const isFullWidth = card.classList.contains('kg-width-full');
|
|
6
|
+
const input = card.querySelector('input');
|
|
7
|
+
const overlay = card.querySelector('.kg-before-after-card-image-before');
|
|
8
|
+
const orientation = card.querySelector('div').getAttribute('data-orientation');
|
|
9
|
+
const images = [...card.querySelectorAll('img')];
|
|
10
|
+
const smallestImageWidth = Math.min(
|
|
11
|
+
...images.map(img => parseInt(img.getAttribute('width')))
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
function updateSlider() {
|
|
15
|
+
if (orientation === 'vertical') {
|
|
16
|
+
overlay.setAttribute('style', `height: ${input.value}%`);
|
|
17
|
+
} else {
|
|
18
|
+
overlay.setAttribute('style', `width: ${input.value}%`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function updateDimensions() {
|
|
23
|
+
const containerWidth = parseInt(getComputedStyle(card).getPropertyValue('width'));
|
|
24
|
+
const width = isFullWidth ? containerWidth : Math.min(smallestImageWidth, containerWidth);
|
|
25
|
+
for (let image of images) {
|
|
26
|
+
image.setAttribute('style', `width: ${width.toString()}px;`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
input.addEventListener('input', function () {
|
|
31
|
+
updateSlider();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
window.addEventListener('resize', function () {
|
|
35
|
+
updateDimensions();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
updateDimensions();
|
|
39
|
+
updateSlider();
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
images.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
(function() {
|
|
2
|
+
const images = document.querySelectorAll('.kg-gallery-image img');
|
|
3
|
+
images.forEach(function (image) {
|
|
4
|
+
const container = image.closest('.kg-gallery-image');
|
|
5
|
+
const width = image.attributes.width.value;
|
|
6
|
+
const height = image.attributes.height.value;
|
|
7
|
+
const ratio = width / height;
|
|
8
|
+
container.style.flex = ratio + ' 1 0%';
|
|
9
|
+
})
|
|
10
|
+
})();
|