@banou/ftube 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +44 -2
- package/__yt_engine__/engine.html +9 -0
- package/app.webmanifest +31 -0
- package/assets/account-BL8Hv7lS.js +157 -0
- package/assets/account-By94iboj.js +1 -0
- package/assets/account-DfiXzypA-YE6OyKjK.js +1 -0
- package/assets/account-generation-BP_-Qyck-BOth6YQ_.js +1 -0
- package/assets/agent-source-E4g0cDzU.js +1 -0
- package/assets/api-1NDCtwel-CAaxX8P1.js +3 -0
- package/assets/binary-encoding-By5K7InN.js +1 -0
- package/assets/build-CNn3bm6X.js +1 -0
- package/assets/busy-C1JPjoZ_-CJ0641jK.js +1 -0
- package/assets/cards-Csel8naI.js +2334 -0
- package/assets/channel-B5f9YTIf.js +1160 -0
- package/assets/client-version-D9kIz6Gz.js +1 -0
- package/assets/comments-CJp9O808.js +612 -0
- package/assets/dislikes-DH5jCVEY.js +1 -0
- package/assets/dist-7VpLCl1k.js +1 -0
- package/assets/dist-BOrL1gYg.js +2 -0
- package/assets/downloads-CMXDjA_E.js +191 -0
- package/assets/egress.worker-DopXr5uP.js +104 -0
- package/assets/engine-B_kFyW7L.js +2 -0
- package/assets/feed-channels-Dg2mvF5x.js +251 -0
- package/assets/feed-groups-CnyR4sOO.js +160 -0
- package/assets/feed-history-BDAGG9N5.js +368 -0
- package/assets/feed-playlists-DcGR2AL6.js +167 -0
- package/assets/feed-subscriptions-Sm3tKz4P.js +165 -0
- package/assets/feed-you-lxbqknXX.js +110 -0
- package/assets/formats-CDwXfKnr.js +1 -0
- package/assets/frame-BrGNSf3s.js +2 -0
- package/assets/fs-CjRTQ7Nu.js +1 -0
- package/assets/fs-CwRtKje1-CBsYhX2-.js +1 -0
- package/assets/fullscreen-view-BLgosU84.js +269 -0
- package/assets/group-C00s0aT7.js +183 -0
- package/assets/groups-button-CvVnqwlu.js +25 -0
- package/assets/hashtag-CCIhITaL.js +115 -0
- package/assets/icons-DKsqNLSs.js +1 -0
- package/assets/index-A5dHbptn.css +1 -0
- package/assets/index-DwsYJ-bu.js +1328 -0
- package/assets/lib-h0P14ZFl.js +70 -0
- package/assets/linkify-B6hdFhsL.js +1 -0
- package/assets/packages-C3w3tSjj-BCtDk0vj.js +1 -0
- package/assets/party-CUcxsJDF.js +180 -0
- package/assets/playlist-DF7wsidw.js +521 -0
- package/assets/playlist-card-Btoc7D8f.js +91 -0
- package/assets/playlist-panel-D97BwT1f.js +199 -0
- package/assets/post-CQ9mfVos.js +39 -0
- package/assets/post-card-ZUQixO1G.js +76 -0
- package/assets/privacy-hkbqXFeB.js +46 -0
- package/assets/protobuf-BXZ2dCCc.js +1 -0
- package/assets/read-more-BhddUSlS.js +20 -0
- package/assets/rich-text-07paR5O3.js +25 -0
- package/assets/roboto-cyrillic-ext-BCp_3N7R.woff2 +0 -0
- package/assets/roboto-cyrillic-fOt7epNf.woff2 +0 -0
- package/assets/roboto-greek-DlT9XTxE.woff2 +0 -0
- package/assets/roboto-greek-ext-Bgw4czJT.woff2 +0 -0
- package/assets/roboto-latin-ccAYIvAh.woff2 +0 -0
- package/assets/roboto-latin-ext-DYIxWhlt.woff2 +0 -0
- package/assets/roboto-math-4a3xuzGk.woff2 +0 -0
- package/assets/roboto-symbols-B7iHSfaG.woff2 +0 -0
- package/assets/roboto-vietnamese-_f1XEJpo.woff2 +0 -0
- package/assets/rooms-B-AvBY-c-FNDqRDHE.js +1 -0
- package/assets/rooms-B91zuirR.js +1 -0
- package/assets/save-menu-DF1WKqSE.js +462 -0
- package/assets/search-Cx5IpDtZ.js +1026 -0
- package/assets/settings-kESE_uBm.js +99 -0
- package/assets/shaka-BwT9pJcV.js +36 -0
- package/assets/share-dialog-Cp0BJ6bg.js +156 -0
- package/assets/shorts-BxDB7m0c.js +686 -0
- package/assets/shorts-grid-Bgbkl5dP.js +11 -0
- package/assets/sign-in-Bx3zmj-m.js +97 -0
- package/assets/signed-out-prompt-CEAx65kq.js +79 -0
- package/assets/signin-DkI8Ogzz.js +18 -0
- package/assets/social-bXt3vmd4.js +1 -0
- package/assets/video-card-compact-r-K4XyDb.js +190 -0
- package/assets/watch-CkxSP1IA.js +1802 -0
- package/assets/web-BNanCsH5.js +43 -0
- package/favicon.ico +0 -0
- package/favicon.svg +5 -0
- package/icons/icon-192.png +0 -0
- package/icons/icon-512.png +0 -0
- package/index-Bj-Q3X8Q.js +4120 -0
- package/index.html +32 -0
- package/package.json +45 -4
- package/store/background.webp +0 -0
- package/store/channel.webp +0 -0
- package/store/cover.webp +0 -0
- package/store/phone.webp +0 -0
- package/store/search.webp +0 -0
- package/store/watch.webp +0 -0
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
import{p as e,s as t,x as n}from"./dist-BOrL1gYg.js";import{C as r,Ft as i,H as a,It as o,J as s,K as c,L as l,M as u,V as d,a as f,an as p,i as m,in as h,jt as ee,kt as te,ln as g,n as _,o as v,on as y,sn as b,tn as x,yt as S}from"./icons-DKsqNLSs.js";import{C,a as w,c as T,g as E,k as D,o as O,ot as k,p as ne,s as A,w as re,y as j}from"./sign-in-Bx3zmj-m.js";import{$ as M,En as ie,Et as ae,K as oe,Mt as se,Y as N,cn as P,ct as ce,et as F,fn as I,gn as le,j as ue,mn as L,on as R,rn as z,sn as B,yn as V}from"./cards-Csel8naI.js";import{f as H,n as U,p as de,s as fe}from"../index-Bj-Q3X8Q.js";import{t as pe}from"./comments-CJp9O808.js";import{n as W,r as G,t as me}from"./share-dialog-Cp0BJ6bg.js";import{t as K}from"./dislikes-DH5jCVEY.js";b();var he=k`
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
border-radius: 12px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
background: #000;
|
|
8
|
+
|
|
9
|
+
&:fullscreen {
|
|
10
|
+
border-radius: 0;
|
|
11
|
+
|
|
12
|
+
video::-webkit-media-text-track-container {
|
|
13
|
+
transform: translateY(-2.4rem);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
video,
|
|
18
|
+
.poster {
|
|
19
|
+
display: block;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
/* The box is 9:16 and so is a well-formed short, so this is a no-op for the
|
|
23
|
+
common case. It matters for the shorts that are not: plenty are uploaded
|
|
24
|
+
1:1 or 16:9, and covering would crop their edges away rather than
|
|
25
|
+
letting them letterbox. */
|
|
26
|
+
object-fit: contain;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Lifts native WebVTT cues above the bottom metadata overlay and scrubber. */
|
|
30
|
+
video::-webkit-media-text-track-container {
|
|
31
|
+
transform: translateY(-13.6rem);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.poster {
|
|
35
|
+
position: absolute;
|
|
36
|
+
inset: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.spinner {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 50%;
|
|
42
|
+
left: 50%;
|
|
43
|
+
width: 3.6rem;
|
|
44
|
+
height: 3.6rem;
|
|
45
|
+
margin: -1.8rem 0 0 -1.8rem;
|
|
46
|
+
border: 0.3rem solid rgba(255, 255, 255, 0.25);
|
|
47
|
+
border-top-color: #ffffff;
|
|
48
|
+
border-radius: 50%;
|
|
49
|
+
animation: shorts-spin 0.8s linear infinite;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes shorts-spin {
|
|
54
|
+
to {
|
|
55
|
+
transform: rotate(360deg);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* In the middle like the spinner, since the title overlay owns the bottom edge. */
|
|
60
|
+
.status {
|
|
61
|
+
position: absolute;
|
|
62
|
+
inset: 50% 1.2rem auto;
|
|
63
|
+
transform: translateY(-50%);
|
|
64
|
+
color: var(--text-on-media);
|
|
65
|
+
font: 500 1.3rem/1.4 system-ui, sans-serif;
|
|
66
|
+
text-shadow: 0 1px 4px #000;
|
|
67
|
+
text-align: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.paused-glyph {
|
|
71
|
+
position: absolute;
|
|
72
|
+
inset: 0;
|
|
73
|
+
display: grid;
|
|
74
|
+
place-items: center;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.paused-glyph .badge {
|
|
79
|
+
display: grid;
|
|
80
|
+
place-items: center;
|
|
81
|
+
width: 6.4rem;
|
|
82
|
+
height: 6.4rem;
|
|
83
|
+
border-radius: 50%;
|
|
84
|
+
background: rgba(0, 0, 0, 0.55);
|
|
85
|
+
color: #fff;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Top overlay bar matching youtube.com Shorts: Play/Pause and expanding volume
|
|
89
|
+
pill on the left, Full screen on the right. */
|
|
90
|
+
.top-bar {
|
|
91
|
+
position: absolute;
|
|
92
|
+
inset: 0 0 auto 0;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
padding: 1.2rem;
|
|
97
|
+
background: linear-gradient(rgba(0, 0, 0, 0.48), transparent);
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
z-index: 2;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.top-group {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 0.8rem;
|
|
106
|
+
pointer-events: auto;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.control-btn {
|
|
110
|
+
display: grid;
|
|
111
|
+
place-items: center;
|
|
112
|
+
width: 4.8rem;
|
|
113
|
+
height: 4.8rem;
|
|
114
|
+
padding: 0;
|
|
115
|
+
border: none;
|
|
116
|
+
border-radius: 50%;
|
|
117
|
+
background: rgba(0, 0, 0, 0.55);
|
|
118
|
+
color: var(--text-on-media, #fff);
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.control-btn:hover {
|
|
124
|
+
background: rgba(0, 0, 0, 0.78);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.control-btn.captions-on {
|
|
128
|
+
background: rgba(255, 255, 255, 0.92);
|
|
129
|
+
color: #0f0f0f;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.control-btn.captions-on:hover {
|
|
133
|
+
background: #fff;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.volume-pill {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
height: 4.8rem;
|
|
140
|
+
border-radius: 2.4rem;
|
|
141
|
+
background: rgba(0, 0, 0, 0.55);
|
|
142
|
+
transition: background 0.15s ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.volume-pill:hover,
|
|
146
|
+
.volume-pill:focus-within {
|
|
147
|
+
background: rgba(0, 0, 0, 0.78);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.volume-pill .control-btn {
|
|
151
|
+
background: transparent;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.volume-pill .control-btn:hover {
|
|
155
|
+
background: transparent;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.volume-slider {
|
|
159
|
+
width: 0;
|
|
160
|
+
height: 4.8rem;
|
|
161
|
+
margin: 0;
|
|
162
|
+
padding: 0;
|
|
163
|
+
opacity: 0;
|
|
164
|
+
appearance: none;
|
|
165
|
+
background: transparent;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
transition: width 0.18s cubic-bezier(0, 0, 0.2, 1), opacity 0.15s ease, margin-right 0.18s cubic-bezier(0, 0, 0.2, 1);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.volume-pill:hover .volume-slider,
|
|
171
|
+
.volume-pill:focus-within .volume-slider {
|
|
172
|
+
width: 7.2rem;
|
|
173
|
+
opacity: 1;
|
|
174
|
+
margin-right: 1.4rem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.volume-slider::-webkit-slider-runnable-track {
|
|
178
|
+
height: 0.2rem;
|
|
179
|
+
border-radius: 0.1rem;
|
|
180
|
+
background: linear-gradient(to right, #ffffff var(--fill), rgba(255, 255, 255, 0.25) var(--fill));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.volume-slider::-webkit-slider-thumb {
|
|
184
|
+
appearance: none;
|
|
185
|
+
width: 1.2rem;
|
|
186
|
+
height: 1.2rem;
|
|
187
|
+
margin-top: -0.5rem;
|
|
188
|
+
border: none;
|
|
189
|
+
border-radius: 50%;
|
|
190
|
+
background: #fff;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.volume-slider::-moz-range-track {
|
|
194
|
+
height: 0.2rem;
|
|
195
|
+
border: none;
|
|
196
|
+
border-radius: 0.1rem;
|
|
197
|
+
background: rgba(255, 255, 255, 0.25);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.volume-slider::-moz-range-progress {
|
|
201
|
+
height: 0.2rem;
|
|
202
|
+
border-radius: 0.1rem;
|
|
203
|
+
background: #fff;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.volume-slider::-moz-range-thumb {
|
|
207
|
+
width: 1.2rem;
|
|
208
|
+
height: 1.2rem;
|
|
209
|
+
border: none;
|
|
210
|
+
border-radius: 50%;
|
|
211
|
+
background: #fff;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.volume-slider:focus-visible {
|
|
215
|
+
outline: none;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.volume-slider:focus-visible::-webkit-slider-thumb {
|
|
219
|
+
box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.45);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.volume-slider:focus-visible::-moz-range-thumb {
|
|
223
|
+
box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.45);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Full-bleed progress line pinned to the bottom edge, the way the Shorts
|
|
227
|
+
player shows position. It is a scrubber, so it takes pointer events while
|
|
228
|
+
the surrounding surface stays a play/pause target. */
|
|
229
|
+
.scrubber {
|
|
230
|
+
position: absolute;
|
|
231
|
+
inset: auto 0 0 0;
|
|
232
|
+
height: 1.6rem;
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: flex-end;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
touch-action: none;
|
|
237
|
+
z-index: 2;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.scrubber .track {
|
|
241
|
+
position: relative;
|
|
242
|
+
width: 100%;
|
|
243
|
+
height: 0.3rem;
|
|
244
|
+
background: rgba(255, 255, 255, 0.3);
|
|
245
|
+
transition: height 0.1s ease;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.scrubber:hover .track,
|
|
249
|
+
.scrubber.scrubbing .track {
|
|
250
|
+
height: 0.5rem;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.scrubber .fill {
|
|
254
|
+
position: relative;
|
|
255
|
+
height: 100%;
|
|
256
|
+
background: var(--brand, #f00);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.scrubber .fill::after {
|
|
260
|
+
content: '';
|
|
261
|
+
position: absolute;
|
|
262
|
+
right: -0.6rem;
|
|
263
|
+
top: 50%;
|
|
264
|
+
width: 1.2rem;
|
|
265
|
+
height: 1.2rem;
|
|
266
|
+
border-radius: 50%;
|
|
267
|
+
background: var(--brand, #f00);
|
|
268
|
+
transform: translateY(-50%) scale(0);
|
|
269
|
+
transition: transform 0.12s ease;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.scrubber:hover .fill::after,
|
|
273
|
+
.scrubber.scrubbing .fill::after {
|
|
274
|
+
transform: translateY(-50%) scale(1);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@media (max-width: 600px) {
|
|
278
|
+
.control-btn {
|
|
279
|
+
width: 4rem;
|
|
280
|
+
height: 4rem;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.volume-pill {
|
|
284
|
+
height: 4rem;
|
|
285
|
+
border-radius: 2rem;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
`,ge=({muted:e,volume:t})=>A(e||t===0?m:t<.5?v:f,{size:22,strokeWidth:1.75}),_e=30,ve=4,ye=e=>{let t=H(e);return .05*Math.min(t.width,t.height)},be=e=>k`
|
|
289
|
+
video::cue {
|
|
290
|
+
${e};
|
|
291
|
+
}
|
|
292
|
+
`,xe=({videoId:r,poster:c,active:d,preload:f=!1,shortcutsDisabled:m,onReady:ee,onRefused:te})=>{let g=x(null),_=x(null),v=x(void 0),b=x(d);b.current=d;let S=x(ee);S.current=ee;let C=x(te);C.current=te;let E=d||f,[D,O]=y(!1),[k,re]=y(!1),[j,M]=y(``),[ie,ae]=y(void 0),[oe,N]=y(!1),ce=p(()=>N(!1),[]),[F,ue]=y(!1),[L,z]=y(()=>R().muted),[V,H]=y(()=>R().volume),[U,fe]=y(!1),[pe,W]=y(0),[G,me]=y(!1),[K,xe]=y(0),[q,J]=y([]),[Y,Se]=y([]),[X,Z]=y(void 0),Ce=x(void 0);X&&(Ce.current=X);let[we,Te]=y(``);h(()=>{E||xe(0)},[E]),h(()=>{let e=_.current;if(!e||!d)return;let t=()=>Te(I(R(),ye(e)));t();let n=new ResizeObserver(t);n.observe(e),e.addEventListener(`resize`,t);let r=B(t);return()=>{n.disconnect(),e.removeEventListener(`resize`,t),r()}},[d,K]),h(()=>{let e=()=>fe(document.fullscreenElement===g.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),h(()=>{let e=_.current;if(!e||!E){N(!1);return}let t=R();e.volume=t.volume,e.muted=t.muted,H(t.volume),z(t.muted),e.loop=!0;let i=new AbortController,a,o,s;O(!1),re(!1),M(``),ae(void 0),N(!1),J([]),Se([]),Z(void 0),Ce.current=void 0;let c=()=>{!i.signal.aborted&&e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&re(!0)};e.addEventListener(`loadeddata`,c),e.addEventListener(`canplay`,c),e.addEventListener(`playing`,c);let l=e=>{if(i.signal.aborted||s!==void 0)return;let t=e instanceof Error?e.message:String(e),r=n(e);if(r?.final===!0){b.current?C.current?C.current():M(r.title):ae(r.title);return}if(K>=2||t===`youtube: live streams are not playable in this client yet`){M(t);return}s=setTimeout(()=>{i.signal.aborted||xe(e=>e+1)},400)},u=le();return u.catch(()=>{}),(async()=>{let n=await ne();if(i.signal.aborted)return;let s=e.getBoundingClientRect(),d=s.width>0&&s.height>0?{width:Math.ceil(s.width*devicePixelRatio),height:Math.ceil(s.height*devicePixelRatio)}:void 0,f=d?Math.max(360,d.height):1080,p=d?{cover:d}:void 0,m=p?n.openPlayback(r,f,void 0,t.stableVolume,p):n.openPlayback(r,f,void 0,t.stableVolume);m.catch(()=>{}),o={api:n,promise:m};let{startShakaPlayback:h}=await u;i.signal.aborted||(o=void 0,a=await h({api:n,video:e,videoId:r,stableVolume:t.stableVolume,startTime:0,autoPlay:!1,bufferingGoal:b.current?_e:ve,maxHeight:f,pinVideoFormat:!0,openOptions:p,sessionPromise:m,signal:i.signal,onError:l,onAutoplayMuted:()=>{!i.signal.aborted&&b.current&&N(!0)}}),!i.signal.aborted&&(v.current=a,J(a.captionTracks),Se(a.translationLanguages),O(!0),c()))})().catch(l),()=>{if(i.abort(),clearTimeout(s),e.removeEventListener(`loadeddata`,c),e.removeEventListener(`canplay`,c),e.removeEventListener(`playing`,c),v.current=void 0,O(!1),re(!1),ae(void 0),N(!1),J([]),Se([]),Z(void 0),Ce.current=void 0,S.current?.(!1),o){let{api:e,promise:t}=o;t.then(t=>e.closePlayback(t.id)).catch(()=>{})}a?.destroy()}},[r,E,K]),h(()=>{let t=_.current,n=v.current;if(!t||!n||!D)return;if(!d){t.pause(),t.currentTime>0&&(t.currentTime=0),W(0),N(!1),Z(void 0),n.selectCaption(void 0).catch(()=>{}),n.player.configure({streaming:{bufferingGoal:ve}});return}let r=!1,i=R();t.volume=i.volume,t.muted=i.muted,H(i.volume),z(i.muted),N(!1),ue(!1),n.player.configure({streaming:{bufferingGoal:_e}});let a=e(n.captionTracks,n.translationLanguages,i,navigator.language);if(Z(a),a){let e=n.selectCaption;e(a.trackId,a.translateTo).catch(()=>{if(r)return;if(!a.translateTo){Z(e=>e?.trackId===a.trackId&&!e.translateTo?void 0:e);return}let t={trackId:a.trackId};Z(e=>e?.trackId===a.trackId&&e.translateTo===a.translateTo?t:e),e(t.trackId).catch(()=>{r||Z(e=>e?.trackId===t.trackId&&!e.translateTo?void 0:e)})})}else n.selectCaption(void 0).catch(()=>{});return t.currentTime>0&&(t.currentTime=0,W(0)),n.play().finally(()=>{r?t.pause():ue(t.paused)}),()=>{r=!0}},[d,D]),h(()=>{D&&k&&S.current?.(!0)},[D,k]),h(()=>{d&&ie!==void 0&&(C.current?C.current():M(ie))},[d,ie]),h(()=>{let e=_.current;if(!e)return;let t=()=>{ue(e.paused),z(e.muted),H(e.volume)},n=()=>{if(G)return;let t=e.duration;W(Number.isFinite(t)&&t>0?e.currentTime/t:0)};return e.addEventListener(`play`,t),e.addEventListener(`pause`,t),e.addEventListener(`volumechange`,t),e.addEventListener(`timeupdate`,n),()=>{e.removeEventListener(`play`,t),e.removeEventListener(`pause`,t),e.removeEventListener(`volumechange`,t),e.removeEventListener(`timeupdate`,n)}},[G,K]);let Ee=e=>{let t=_.current,n=e.currentTarget;if(!t||!n||!Number.isFinite(t.duration))return;let r=n.getBoundingClientRect(),i=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));W(i),t.currentTime=i*t.duration},De=p(()=>{let e=_.current;e&&b.current&&(e.paused?e.play().catch(()=>{}):e.pause())},[]),Oe=p(()=>{let e=_.current,t=!(e?e.muted||e.volume===0:L||V===0),n=!t&&(e?.volume??V)===0?1:e?.volume??V;e&&(e.volume=n,e.muted=t),z(t),H(n),P({muted:t,volume:n})},[L,V]),ke=e=>{let t=Number(e.currentTarget.value);if(!Number.isFinite(t))return;let n=t===0,r=_.current;r&&(r.volume=t,r.muted=n),H(t),z(n),P({volume:t,muted:n})},Ae=p(()=>{document.fullscreenElement===g.current?document.exitFullscreen().catch(()=>{}):g.current?.requestFullscreen?.().catch(()=>{})},[]),je=p(e=>{let t=v.current;if(!e){Z(void 0),P({captionsEnabled:!1}),t?.selectCaption(void 0).catch(()=>{});return}if(e.translateTo){t?.selectCaption(e.trackId,e.translateTo).then(()=>{Z(e),P({captionsEnabled:!0,captionsLanguage:e.translateTo})},()=>{w(`Auto-translate is not available right now`)});return}Z(e);let n=q.find(t=>t.id===e.trackId);n&&P({captionsEnabled:!0,captionsLanguage:n.languageCode}),t?.selectCaption(e.trackId).catch(()=>{Z(t=>t?.trackId===e.trackId&&!t.translateTo?void 0:t),w(`Subtitles are not available for this video right now`)})},[q]),Me=p(()=>{if(q.length===0)return;if(X){je(void 0);return}let e=Ce.current,n=e&&q.some(t=>t.id===e.trackId)&&(!e.translateTo||Y.some(t=>t.languageCode===e.translateTo))?e:(()=>{let e=t(q,navigator.language);return e?{trackId:e.id}:void 0})();n&&je(n)},[je,X,q,Y]);h(()=>{if(!d||m)return;let e=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||se(e.target))return;let t=e.key.toLowerCase();if(t===`k`||e.key===` `&&!(e.target instanceof HTMLElement&&e.target.closest(`button, a, input, select`)))e.preventDefault(),De();else if(t===`m`)e.preventDefault(),Oe();else if(t===`c`&&q.length>0)e.preventDefault(),Me();else if(t===`f`)e.preventDefault(),Ae();else if(e.key===`ArrowLeft`||e.key===`ArrowRight`){let t=_.current;if(!t||!Number.isFinite(t.duration))return;e.preventDefault();let n=e.key===`ArrowRight`?5:-5;t.currentTime=Math.min(t.duration,Math.max(0,t.currentTime+n))}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,m,q.length,De,Oe,Me,Ae]);let Q=L?0:V,$=d?j:``;return T(`div`,{ref:g,css:we?[he,be(we)]:he,onClick:De,children:[c&&!k?A(`img`,{className:`poster`,src:c,alt:``}):void 0,A(`video`,{ref:_,playsInline:!0,preload:`auto`},K),d&&!k&&!$?A(`div`,{className:`spinner`}):void 0,$?A(`p`,{className:`status`,children:$}):void 0,d&&D&&F?A(`div`,{className:`paused-glyph`,children:A(`span`,{className:`badge`,children:A(u,{size:30,fill:`currentColor`,strokeWidth:1.5})})}):void 0,$?void 0:T(`div`,{className:`top-bar`,children:[T(`div`,{className:`top-group`,onClick:e=>e.stopPropagation(),children:[A(`button`,{type:`button`,className:`control-btn`,"aria-label":F?`Play`:`Pause`,title:F?`Play (k)`:`Pause (k)`,onClick:De,children:A(F?u:l,{size:22,fill:`currentColor`,strokeWidth:1.5})}),T(`div`,{className:`volume-pill`,children:[A(`button`,{type:`button`,className:`control-btn mute`,"aria-label":Q===0?`Unmute`:`Mute`,title:Q===0?`Unmute (m)`:`Mute (m)`,onClick:Oe,children:A(ge,{muted:L,volume:V})}),A(`input`,{type:`range`,className:`volume-slider`,min:0,max:1,step:.01,value:Q,"aria-label":`Volume`,"aria-valuetext":`${Math.round(Q*100)}%`,style:{"--fill":`calc(0.6rem + ${Q} * (100% - 1.2rem))`},onInput:ke})]})]}),T(`div`,{className:`top-group`,onClick:e=>e.stopPropagation(),children:[q.length>0?A(`button`,{type:`button`,className:X?`control-btn captions-on`:`control-btn`,"aria-label":X?`Subtitles/closed captions off`:`Subtitles/closed captions`,"aria-pressed":!!X,title:`Subtitles/closed captions (c)`,onClick:Me,children:A(X?i:o,{size:22,strokeWidth:1.75})}):void 0,A(`button`,{type:`button`,className:`control-btn`,"aria-label":U?`Exit full screen`:`Full screen`,title:U?`Exit full screen (f)`:`Full screen (f)`,onClick:Ae,children:A(U?a:s,{size:20,strokeWidth:1.75})})]})]}),d&&oe&&!$&&_.current?A(de,{video:_.current,placement:`shorts`,onDismiss:ce}):void 0,D?A(`div`,{className:G?`scrubber scrubbing`:`scrubber`,onClick:e=>e.stopPropagation(),onPointerDown:e=>{e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),me(!0),Ee(e)},onPointerMove:e=>{G&&Ee(e)},onPointerUp:e=>{e.currentTarget.releasePointerCapture(e.pointerId),me(!1)},children:A(`div`,{className:`track`,children:A(`div`,{className:`fill`,style:{width:`${pe*100}%`}})})}):void 0]})};b();var q=E(`
|
|
293
|
+
query ShortsFeed($seed: ID, $sequence: String, $cursor: String) {
|
|
294
|
+
shorts(seed: $seed, sequence: $sequence, cursor: $cursor) {
|
|
295
|
+
items { id poster title }
|
|
296
|
+
cursor
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
`),J=E(`
|
|
300
|
+
query ShortMeta($id: ID!) {
|
|
301
|
+
watch(id: $id) {
|
|
302
|
+
id
|
|
303
|
+
title
|
|
304
|
+
viewCountText
|
|
305
|
+
likeCountText
|
|
306
|
+
commentCountText
|
|
307
|
+
likeStatus
|
|
308
|
+
channel { id name avatar handle isSubscribed notificationLevel isVerified isVerifiedArtist }
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
`),Y=k`
|
|
312
|
+
/* Owns the viewport below the header: the pager scrolls itself rather than
|
|
313
|
+
the document, so snapping is not fighting the page's own scroll. */
|
|
314
|
+
height: calc(100vh - var(--header-height));
|
|
315
|
+
overflow-y: auto;
|
|
316
|
+
overflow-x: hidden;
|
|
317
|
+
scroll-snap-type: y mandatory;
|
|
318
|
+
overscroll-behavior-y: contain;
|
|
319
|
+
scrollbar-width: none;
|
|
320
|
+
|
|
321
|
+
&::-webkit-scrollbar {
|
|
322
|
+
display: none;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.slide {
|
|
326
|
+
height: 100%;
|
|
327
|
+
scroll-snap-align: center;
|
|
328
|
+
scroll-snap-stop: always;
|
|
329
|
+
display: flex;
|
|
330
|
+
align-items: center;
|
|
331
|
+
justify-content: center;
|
|
332
|
+
gap: 1.6rem;
|
|
333
|
+
padding: 1.2rem 0;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/* A Short's video and its buttons, positioned so that below the breakpoint
|
|
337
|
+
the buttons sit on that Short's video. Uses the full slide height below
|
|
338
|
+
the header, matching youtube.com's Shorts stage (984px at 1440x1080). */
|
|
339
|
+
.reel {
|
|
340
|
+
position: relative;
|
|
341
|
+
display: flex;
|
|
342
|
+
align-items: stretch;
|
|
343
|
+
gap: 1.6rem;
|
|
344
|
+
height: 100%;
|
|
345
|
+
max-width: 100%;
|
|
346
|
+
flex: none;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* The 9:16 box IS the player element, so the quality the player asks for is
|
|
350
|
+
derived from the size the video is actually shown at. Sizing the element to
|
|
351
|
+
the whole slide and letterboxing inside it would make it request a stream
|
|
352
|
+
far larger than any pixel on screen. */
|
|
353
|
+
.stage {
|
|
354
|
+
position: relative;
|
|
355
|
+
height: 100%;
|
|
356
|
+
aspect-ratio: 9 / 16;
|
|
357
|
+
max-width: calc(100vw - 10rem);
|
|
358
|
+
flex: none;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.rail {
|
|
362
|
+
display: flex;
|
|
363
|
+
flex-direction: column;
|
|
364
|
+
justify-content: flex-end;
|
|
365
|
+
align-items: center;
|
|
366
|
+
gap: 1.6rem;
|
|
367
|
+
padding-bottom: 0.4rem;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.rail-button {
|
|
371
|
+
display: flex;
|
|
372
|
+
flex-direction: column;
|
|
373
|
+
align-items: center;
|
|
374
|
+
gap: 0.4rem;
|
|
375
|
+
padding: 0;
|
|
376
|
+
border: none;
|
|
377
|
+
background: transparent;
|
|
378
|
+
color: var(--text-primary);
|
|
379
|
+
font-size: 1.3rem;
|
|
380
|
+
font-weight: 500;
|
|
381
|
+
line-height: 1.8rem;
|
|
382
|
+
cursor: pointer;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.rail-button .glyph {
|
|
386
|
+
display: grid;
|
|
387
|
+
place-items: center;
|
|
388
|
+
width: 4.8rem;
|
|
389
|
+
height: 4.8rem;
|
|
390
|
+
border-radius: 50%;
|
|
391
|
+
background: var(--bg-chip);
|
|
392
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.rail-button:hover .glyph {
|
|
396
|
+
background: var(--bg-chip-hover);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.rail-button.on .glyph {
|
|
400
|
+
background: var(--bg-inverse);
|
|
401
|
+
color: var(--text-inverse);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.rail-channel {
|
|
405
|
+
display: block;
|
|
406
|
+
width: 4rem;
|
|
407
|
+
height: 4rem;
|
|
408
|
+
border-radius: 0.8rem;
|
|
409
|
+
overflow: hidden;
|
|
410
|
+
background: var(--bg-chip);
|
|
411
|
+
border: 1px solid var(--border-subtle);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.rail-channel img {
|
|
415
|
+
display: block;
|
|
416
|
+
width: 100%;
|
|
417
|
+
height: 100%;
|
|
418
|
+
object-fit: cover;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.meta {
|
|
422
|
+
position: absolute;
|
|
423
|
+
inset: auto 0 0 0;
|
|
424
|
+
display: flex;
|
|
425
|
+
flex-direction: column;
|
|
426
|
+
gap: 0.8rem;
|
|
427
|
+
padding: 5.6rem 1.6rem 2.4rem;
|
|
428
|
+
/* The scrubber owns the bottom edge, so this overlay must not swallow the
|
|
429
|
+
pointer before it gets there. */
|
|
430
|
+
pointer-events: none;
|
|
431
|
+
background: linear-gradient(transparent, rgba(0, 0, 0, 0.38) 40%, rgba(0, 0, 0, 0.78));
|
|
432
|
+
color: #fff;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.meta a,
|
|
436
|
+
.meta button {
|
|
437
|
+
pointer-events: auto;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.byline {
|
|
441
|
+
display: flex;
|
|
442
|
+
align-items: center;
|
|
443
|
+
flex-wrap: wrap;
|
|
444
|
+
gap: 0.8rem;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.byline .avatar-link {
|
|
448
|
+
flex: none;
|
|
449
|
+
width: 3.6rem;
|
|
450
|
+
height: 3.6rem;
|
|
451
|
+
border-radius: 50%;
|
|
452
|
+
overflow: hidden;
|
|
453
|
+
background: rgba(255, 255, 255, 0.18);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.byline .avatar-link img {
|
|
457
|
+
display: block;
|
|
458
|
+
width: 100%;
|
|
459
|
+
height: 100%;
|
|
460
|
+
object-fit: cover;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.byline .name {
|
|
464
|
+
display: inline-flex;
|
|
465
|
+
align-items: center;
|
|
466
|
+
gap: 0.4rem;
|
|
467
|
+
color: #fff;
|
|
468
|
+
font-size: 1.4rem;
|
|
469
|
+
font-weight: 700;
|
|
470
|
+
text-decoration: none;
|
|
471
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.short-title {
|
|
475
|
+
margin: 0;
|
|
476
|
+
font-size: 1.4rem;
|
|
477
|
+
font-weight: 500;
|
|
478
|
+
line-height: 1.9rem;
|
|
479
|
+
/* Two lines, the way the Shorts overlay clamps: a long title otherwise
|
|
480
|
+
covers the video it belongs to. */
|
|
481
|
+
display: -webkit-box;
|
|
482
|
+
-webkit-line-clamp: 2;
|
|
483
|
+
-webkit-box-orient: vertical;
|
|
484
|
+
overflow: hidden;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.views {
|
|
488
|
+
margin: 0;
|
|
489
|
+
font-size: 1.2rem;
|
|
490
|
+
color: rgba(255, 255, 255, 0.8);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.comments-panel {
|
|
494
|
+
position: relative;
|
|
495
|
+
display: flex;
|
|
496
|
+
flex-direction: column;
|
|
497
|
+
width: 42rem;
|
|
498
|
+
max-width: 100%;
|
|
499
|
+
height: 100%;
|
|
500
|
+
border-radius: 1.2rem;
|
|
501
|
+
background: var(--bg-elevated, var(--bg-subtle));
|
|
502
|
+
overflow: hidden;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.comments-scrim {
|
|
506
|
+
display: none;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.comments-panel header {
|
|
510
|
+
display: flex;
|
|
511
|
+
align-items: center;
|
|
512
|
+
justify-content: space-between;
|
|
513
|
+
padding: 1.6rem;
|
|
514
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
515
|
+
font-size: 1.6rem;
|
|
516
|
+
font-weight: 700;
|
|
517
|
+
color: var(--text-primary);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.comments-title {
|
|
521
|
+
display: flex;
|
|
522
|
+
align-items: baseline;
|
|
523
|
+
gap: 0.8rem;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.comments-count {
|
|
527
|
+
font-size: 1.4rem;
|
|
528
|
+
font-weight: 400;
|
|
529
|
+
color: var(--text-secondary);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.comments-panel .body {
|
|
533
|
+
flex: 1;
|
|
534
|
+
overflow-y: auto;
|
|
535
|
+
padding: 0 1.6rem 1.6rem;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.icon-button {
|
|
539
|
+
display: grid;
|
|
540
|
+
place-items: center;
|
|
541
|
+
width: 4rem;
|
|
542
|
+
height: 4rem;
|
|
543
|
+
border: none;
|
|
544
|
+
border-radius: 50%;
|
|
545
|
+
background: transparent;
|
|
546
|
+
color: var(--text-primary);
|
|
547
|
+
cursor: pointer;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.notice,
|
|
551
|
+
.empty {
|
|
552
|
+
display: grid;
|
|
553
|
+
place-items: center;
|
|
554
|
+
height: 100%;
|
|
555
|
+
padding: 2.4rem;
|
|
556
|
+
color: var(--text-secondary);
|
|
557
|
+
font-size: 1.4rem;
|
|
558
|
+
text-align: center;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.empty h2 {
|
|
562
|
+
margin: 0;
|
|
563
|
+
color: var(--text-primary);
|
|
564
|
+
font-size: 2rem;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/* Fixed to the viewport's right edge, where youtube.com keeps them, rather
|
|
568
|
+
than to a slide: the pager scrolls under them. */
|
|
569
|
+
.pager {
|
|
570
|
+
position: fixed;
|
|
571
|
+
right: 2.4rem;
|
|
572
|
+
top: 50%;
|
|
573
|
+
transform: translateY(-50%);
|
|
574
|
+
display: flex;
|
|
575
|
+
flex-direction: column;
|
|
576
|
+
gap: 1.6rem;
|
|
577
|
+
z-index: 2;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.pager button {
|
|
581
|
+
display: grid;
|
|
582
|
+
place-items: center;
|
|
583
|
+
width: 5.6rem;
|
|
584
|
+
height: 5.6rem;
|
|
585
|
+
border: none;
|
|
586
|
+
border-radius: 50%;
|
|
587
|
+
background: var(--bg-subtle);
|
|
588
|
+
color: var(--text-primary);
|
|
589
|
+
cursor: pointer;
|
|
590
|
+
transition: background 0.15s ease;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.pager button:hover:not(:disabled) {
|
|
594
|
+
background: var(--bg-hover, var(--border-subtle));
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.pager button:disabled {
|
|
598
|
+
visibility: hidden;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/* With the comments open and a full-height stage, the slide reaches under the
|
|
602
|
+
pager below this width, which would cover the comments. */
|
|
603
|
+
@media (max-width: 1560px) {
|
|
604
|
+
&.comments-open .pager {
|
|
605
|
+
display: none;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
@media (max-width: 900px) {
|
|
610
|
+
/* a wheel over the comments sheet's backdrop would otherwise move to the next Short */
|
|
611
|
+
&.comments-open {
|
|
612
|
+
overflow-y: hidden;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.stage {
|
|
616
|
+
max-width: 100%;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.rail {
|
|
620
|
+
/* Below the breakpoint the rail sits on top of the video, which is where
|
|
621
|
+
it lives on a phone anyway. */
|
|
622
|
+
position: absolute;
|
|
623
|
+
right: 0.8rem;
|
|
624
|
+
bottom: 2.0rem;
|
|
625
|
+
gap: 1.0rem;
|
|
626
|
+
padding: 0;
|
|
627
|
+
z-index: 1;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.meta {
|
|
631
|
+
padding: 4.8rem 6.4rem 2.0rem 1.2rem;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.rail-button {
|
|
635
|
+
gap: 0.2rem;
|
|
636
|
+
color: #fff;
|
|
637
|
+
font-size: 1.2rem;
|
|
638
|
+
line-height: 1.5rem;
|
|
639
|
+
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.rail-button .glyph {
|
|
643
|
+
width: 4.2rem;
|
|
644
|
+
height: 4.2rem;
|
|
645
|
+
border: 1px solid rgba(255, 255, 255, 0.14);
|
|
646
|
+
background: rgba(0, 0, 0, 0.5);
|
|
647
|
+
color: #fff;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.rail-button.on .glyph {
|
|
651
|
+
border-color: transparent;
|
|
652
|
+
background: #fff;
|
|
653
|
+
color: #0f0f0f;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.rail-channel {
|
|
657
|
+
width: 3.4rem;
|
|
658
|
+
height: 3.4rem;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.pager {
|
|
662
|
+
display: none;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/* A sheet over the Short, as youtube.com opens it at this width (measured
|
|
666
|
+
2026-11-10): about three quarters of the height below the header, at
|
|
667
|
+
most 48rem wide, closed by a tap beside it. */
|
|
668
|
+
.comments-scrim {
|
|
669
|
+
display: block;
|
|
670
|
+
position: fixed;
|
|
671
|
+
inset: 0;
|
|
672
|
+
z-index: var(--z-dialog);
|
|
673
|
+
background: var(--bg-scrim);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.comments-panel {
|
|
677
|
+
position: fixed;
|
|
678
|
+
inset: calc(var(--header-height) + 11%) 0 10%;
|
|
679
|
+
z-index: var(--z-dialog);
|
|
680
|
+
width: auto;
|
|
681
|
+
max-width: 48rem;
|
|
682
|
+
height: auto;
|
|
683
|
+
margin: 0 auto;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
`,Se=({id:e,poster:t,fallbackTitle:n,active:i,preload:a,shortcutsDisabled:o,onReady:s,onComments:l,onShare:u,onCommentCount:f,onTitle:p,onRefused:m})=>{let[,ee]=C(),[{data:te}]=D({query:J,variables:{id:e},pause:!i&&!a}),g=te?.watch,_=g?.title||n||void 0,{rate:v,rating:y,presses:b,burst:x}=G(e,g?.likeStatus),w=K(i||a?e:``),E=g?.likeStatus===`LIKE`,O=g?.likeStatus===`DISLIKE`,k=g?.channel?.handle?g.channel.handle.startsWith(`@`)?g.channel.handle:`@${g.channel.handle}`:void 0;return h(()=>{i&&f?.(g?.commentCountText??void 0)},[i,g?.commentCountText,f]),h(()=>{i&&p?.(_)},[i,_,p]),T(`div`,{className:`reel`,children:[T(`div`,{className:`stage`,children:[A(xe,{videoId:e,poster:t??void 0,active:i,preload:a,shortcutsDisabled:o,onReady:s,onRefused:m}),T(`div`,{className:`meta`,children:[T(`div`,{className:`byline`,children:[g?.channel?.avatar?A(j,{className:`avatar-link`,href:`/channel/${g.channel.id}`,"aria-label":g.channel.name,children:A(`img`,{src:g.channel.avatar,alt:``,loading:`lazy`})}):void 0,g?.channel?T(j,{className:`name`,href:`/channel/${g.channel.id}`,children:[k??g.channel.name,A(z,{channel:g.channel,size:14})]}):void 0,A(oe,{channelId:g?.channel?.id,subscribed:g?.channel?.isSubscribed,notificationLevel:g?.channel?.notificationLevel})]}),A(`p`,{className:`short-title`,children:_??``}),g?.viewCountText?A(`p`,{className:`views`,children:g.viewCountText}):void 0]})]}),T(`div`,{className:`rail`,children:[T(`button`,{type:`button`,className:E?`rail-button on`:`rail-button`,"aria-pressed":E,"aria-label":`Like`,disabled:y,onClick:()=>v(`LIKE`),children:[A(`span`,{className:`glyph`,children:A(W,{status:`LIKE`,size:24,on:E,presses:b(`LIKE`),burst:x(`LIKE`)})}),g?.likeCountText??`Like`]}),T(`button`,{type:`button`,className:O?`rail-button on`:`rail-button`,"aria-pressed":O,"aria-label":`Dislike`,disabled:y,onClick:()=>v(`DISLIKE`),children:[A(`span`,{className:`glyph`,children:A(W,{status:`DISLIKE`,size:24,on:O,presses:b(`DISLIKE`),burst:x(`DISLIKE`)})}),w===void 0?`Dislike`:V(w)]}),T(`button`,{type:`button`,className:`rail-button`,"aria-label":`Comments`,onClick:l,children:[A(`span`,{className:`glyph`,children:A(c,{size:24,strokeWidth:1.5})}),g?.commentCountText??`Comments`]}),T(`button`,{type:`button`,className:`rail-button`,"aria-label":`Share`,onClick:u,children:[A(`span`,{className:`glyph`,children:A(r,{size:24,strokeWidth:1.5})}),`Share`]}),A(M,{label:`More actions`,align:`start`,side:`above`,trigger:A(`button`,{type:`button`,className:`rail-button`,"aria-label":`More actions`,children:A(`span`,{className:`glyph`,children:A(S,{size:24,strokeWidth:1.5})})}),children:A(F,{icon:d,label:`Open in the full player`,onSelect:()=>ee(`/watch?v=${encodeURIComponent(e)}`)})}),g?.channel?.avatar?A(j,{className:`rail-channel`,href:`/channel/${g.channel.id}`,"aria-label":g.channel.name,children:A(`img`,{src:g.channel.avatar,alt:``,loading:`lazy`})}):void 0]})]})},X=()=>{let[,e]=re(`/shorts/:videoId`),[t]=y(()=>e?.videoId?ie(e.videoId):void 0),[n]=y(()=>fe(history.state));t&&L(t);let r=x(null),[i,a]=y([]),[o,s]=y(t),[c,l]=y(()=>new Set),[u,d]=y(!1),[f,m]=y(void 0),[v,b]=y(void 0),[S,C]=y(void 0),[w,E]=y(()=>new Set),k=p((e,t)=>{l(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),[{data:ne,error:j,fetching:M},oe]=D({query:q,variables:{seed:t,sequence:n,cursor:i[i.length-1]?.cursor}}),P=ne?.shorts,{items:F}=ue({pages:P?[...i,P]:i,key:e=>e.id}),I=g(()=>!t||F.some(e=>e.id===t)?F:[{id:t,poster:null,title:null},...F],[t,F]).filter(e=>!w.has(e.id)),le=g(()=>I.find(e=>e.id===o),[I,o]);U((le?v:void 0)||`Shorts`),h(()=>ce(),[]);let R=p(()=>{!P?.cursor||M||j||a(e=>e[e.length-1]===P?e:[...e,P])},[P,M,j]);h(()=>{!o&&I[0]&&s(I[0].id)},[I,o]),h(()=>{let e=r.current;if(!e)return;let t=new IntersectionObserver(e=>{let t=(e.filter(e=>e.isIntersecting).sort((e,t)=>t.intersectionRatio-e.intersectionRatio)[0]?.target)?.dataset.shortId;t&&s(t)},{root:e,threshold:.6});for(let n of e.querySelectorAll(`[data-short-id]`))t.observe(n);return()=>t.disconnect()},[I.length]),h(()=>{let e=I.findIndex(e=>e.id===o);e>=0&&e>=I.length-3&&R()},[o,I,R]),h(()=>{if(!o)return;let e=ae(o);location.pathname!==e&&history.replaceState(null,``,e)},[o]);let z=I.findIndex(e=>e.id===o),B=e=>{let t=I[z+e];t&&r.current?.querySelector(`[data-short-id="${CSS.escape(t.id)}"]`)?.scrollIntoView({behavior:`smooth`})},V=x({step:B,sharing:S});if(V.current={step:B,sharing:S},h(()=>{let e=e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||se(e.target)||V.current.sharing||(e.preventDefault(),V.current.step(e.key===`ArrowDown`?1:-1)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),M&&I.length===0)return A(`main`,{css:Y,children:A(`p`,{className:`notice`,children:`Loading Shorts…`})});if(j&&I.length===0)return A(`main`,{css:Y,children:A(N,{error:j,reexecute:oe})});if(I.length===0)return A(`main`,{css:Y,children:A(`div`,{className:`empty`,children:A(`h2`,{children:`No Shorts right now`})})});let H=!!(o&&c.has(o));return T(`main`,{css:Y,className:u?`comments-open`:void 0,ref:r,children:[I.map((e,n)=>{let r=e.id===o,i=z>=0&&n===z+1&&(H||c.has(e.id));return T(`section`,{className:`slide`,"data-short-id":e.id,children:[A(Se,{id:e.id,poster:e.poster,fallbackTitle:e.title,active:r,preload:i,shortcutsDisabled:!!S,onReady:t=>k(e.id,t),onComments:()=>d(e=>!e),onShare:()=>C(e.id),onCommentCount:m,onTitle:b,onRefused:e.id===t?void 0:()=>E(t=>new Set(t).add(e.id))}),u&&r?T(O,{children:[A(`div`,{className:`comments-scrim`,onClick:()=>d(!1)}),T(`aside`,{className:`comments-panel`,"aria-label":`Comments`,children:[T(`header`,{children:[T(`span`,{className:`comments-title`,children:[`Comments`,f?A(`span`,{className:`comments-count`,children:f}):void 0]}),A(`button`,{type:`button`,className:`icon-button`,"aria-label":`Close comments`,onClick:()=>d(!1),children:A(_,{size:24,strokeWidth:1.5})})]}),A(`div`,{className:`body`,children:A(pe,{videoId:e.id})})]})]}):void 0]},e.id)}),S?A(me,{videoId:S,title:I.find(e=>e.id===S)?.title??void 0,short:!0,onClose:()=>C(void 0)}):void 0,le===void 0&&M?A(`p`,{className:`notice`,children:`Loading more…`}):void 0,T(`div`,{className:`pager`,children:[A(`button`,{type:`button`,"aria-label":`Previous short`,disabled:z<=0,onClick:()=>B(-1),children:A(te,{size:24,strokeWidth:1.5})}),A(`button`,{type:`button`,"aria-label":`Next short`,disabled:z>=I.length-1,onClick:()=>B(1),children:A(ee,{size:24,strokeWidth:1.5})})]})]})};export{X as default};
|