1+ ( function ( exports ) {
2+
3+ //#region rolldown:runtime
4+ var __create = Object . create ;
5+ var __defProp = Object . defineProperty ;
6+ var __getOwnPropDesc = Object . getOwnPropertyDescriptor ;
7+ var __getOwnPropNames = Object . getOwnPropertyNames ;
8+ var __getProtoOf = Object . getPrototypeOf ;
9+ var __hasOwnProp = Object . prototype . hasOwnProperty ;
10+ var __commonJS = ( cb , mod ) => function ( ) {
11+ return mod || ( 0 , cb [ __getOwnPropNames ( cb ) [ 0 ] ] ) ( ( mod = { exports : { } } ) . exports , mod ) , mod . exports ;
12+ } ;
13+ var __copyProps = ( to , from , except , desc ) => {
14+ if ( from && typeof from === "object" || typeof from === "function" ) for ( var keys = __getOwnPropNames ( from ) , i = 0 , n = keys . length , key ; i < n ; i ++ ) {
15+ key = keys [ i ] ;
16+ if ( ! __hasOwnProp . call ( to , key ) && key !== except ) __defProp ( to , key , {
17+ get : ( ( k ) => from [ k ] ) . bind ( null , key ) ,
18+ enumerable : ! ( desc = __getOwnPropDesc ( from , key ) ) || desc . enumerable
19+ } ) ;
20+ }
21+ return to ;
22+ } ;
23+ var __toESM = ( mod , isNodeMode , target ) => ( target = mod != null ? __create ( __getProtoOf ( mod ) ) : { } , __copyProps ( isNodeMode || ! mod || ! mod . __esModule ? __defProp ( target , "default" , {
24+ value : mod ,
25+ enumerable : true
26+ } ) : target , mod ) ) ;
27+
28+ //#endregion
29+
30+ //#region solid-js/web
31+ var require_web = __commonJS ( { "solid-js/web" ( exports , module ) {
32+ module . exports = shelter . solidWeb ;
33+ } } ) ;
34+
35+ //#endregion
36+ //#region plugins/needForSpeed/icon.jsx
37+ var import_web$7 = __toESM ( require_web ( ) , 1 ) ;
38+ var import_web$8 = __toESM ( require_web ( ) , 1 ) ;
39+ const _tmpl$$1 = /*#__PURE__*/ ( 0 , import_web$7 . template ) ( `<svg xmlns="http://www.w3.org/2000/svg" height="25px" viewBox="0 -960 960 960" width="25px" fill="currentColor"><path d="m426-330 195-125q14-9 14-25t-14-25L426-630q-15-10-30.5-1.5T380-605v250q0 18 15.5 26.5T426-330ZM121-440q17 0 30.5 11t18.5 28q6 23 14.5 43.5T204-317q9 15 7.5 32T198-256q-11 11-27 10t-25-14q-22-31-37-66.5T86-400q-3-16 7.5-28t27.5-12Zm77-264q12 12 13 29t-7 31q-11 20-19.5 41T170-559q-5 17-18.5 28T121-520q-17 0-27.5-12.5T87-561q8-38 23-73.5t36-66.5q9-13 25-13.5t27 10.5Zm56 505q12-13 29.5-14t32.5 8q20 11 40.5 20t42.5 15q17 5 28 18t11 30q0 17-12.5 27T397-88q-38-8-71.5-23T260-146q-14-9-15.5-25t9.5-28Zm186-639q0 17-10.5 30T402-790q-23 6-44 14.5T317-755q-15 9-32.5 7.5T255-761q-12-12-10.5-28.5T260-815q32-20 66.5-34.5T399-872q16-3 28.5 7t12.5 27Zm360 358q0-113-69.5-199.5T553-792q-15-4-24-17t-9-29q0-16 11-26.5t25-7.5q140 28 232 137t92 255q0 146-92 255T556-88q-14 3-25-7.5T520-122q0-16 9-29t24-17q108-26 177.5-112.5T800-480Z"></path></svg>` , 4 ) ;
40+ function SpeedIcon ( ) {
41+ return ( 0 , import_web$8 . getNextElement ) ( _tmpl$$1 ) ;
42+ }
43+
44+ //#endregion
45+ //#region plugins/needForSpeed/index.jsx.scss
46+ shelter . plugin . scoped . ui . injectCss ( `._4OA9Bq_icon {
47+ cursor: pointer;
48+ color: var(--interactive-text-default);
49+ background: none;
50+ border: none;
51+ justify-content: center;
52+ align-items: center;
53+ padding: 0 6px 0 4px;
54+ display: flex;
55+ }
56+
57+ ._4OA9Bq_icon:hover {
58+ color: var(--interactive-text-hover);
59+ }
60+
61+ ._4OA9Bq_selectorWrapper {
62+ z-index: 1000;
63+ padding-bottom: 12px;
64+ position: absolute;
65+ bottom: 100%;
66+ transform: translateX(-25%)translateY(8px);
67+ }
68+
69+ ._4OA9Bq_selector {
70+ background: var(--opacity-black-80);
71+ border: 1px solid var(--border-subtle);
72+ backdrop-filter: blur(4px);
73+ border-radius: 8px;
74+ min-width: 60px;
75+ padding: 4px;
76+ overflow: hidden;
77+ }
78+
79+ ._4OA9Bq_item {
80+ cursor: pointer;
81+ color: var(--interactive-text-default);
82+ text-align: center;
83+ border-radius: 4px;
84+ align-items: center;
85+ padding: 6px 12px;
86+ }
87+
88+ ._4OA9Bq_item:hover {
89+ color: var(--interactive-text-hover);
90+ background-color: var(--border-subtle);
91+ }
92+
93+ ._4OA9Bq_item._4OA9Bq_active {
94+ color: var(--interactive-text-active);
95+ background: var(--brand-50a);
96+ font-weight: bold;
97+ }
98+ ` ) ;
99+ var index_jsx_default = {
100+ "active" : "_4OA9Bq_active" ,
101+ "item" : "_4OA9Bq_item" ,
102+ "selectorWrapper" : "_4OA9Bq_selectorWrapper" ,
103+ "selector" : "_4OA9Bq_selector" ,
104+ "icon" : "_4OA9Bq_icon"
105+ } ;
106+
107+ //#endregion
108+ //#region plugins/needForSpeed/index.jsx
109+ var import_web = __toESM ( require_web ( ) , 1 ) ;
110+ var import_web$1 = __toESM ( require_web ( ) , 1 ) ;
111+ var import_web$2 = __toESM ( require_web ( ) , 1 ) ;
112+ var import_web$3 = __toESM ( require_web ( ) , 1 ) ;
113+ var import_web$4 = __toESM ( require_web ( ) , 1 ) ;
114+ var import_web$5 = __toESM ( require_web ( ) , 1 ) ;
115+ var import_web$6 = __toESM ( require_web ( ) , 1 ) ;
116+ const _tmpl$ = /*#__PURE__*/ ( 0 , import_web . template ) ( `<div><div></div></div>` , 4 ) , _tmpl$2 = /*#__PURE__*/ ( 0 , import_web . template ) ( `<div class="nfs-speed-control"><button></button><!#><!/></div>` , 6 ) , _tmpl$3 = /*#__PURE__*/ ( 0 , import_web . template ) ( `<div><!#><!/>x</div>` , 4 ) ;
117+ const { plugin : { scoped : { observeDom } } , solid : { createSignal, Show, onCleanup } } = shelter ;
118+ const CONTROLS_QUERY = `[class*=videoControls]:not([data-nfs])` ;
119+ const CONTROLS_QUERY_UNLOAD = `[class*=videoControls][data-nfs]` ;
120+ function SpeedControlComponent ( { videoRef } ) {
121+ const [ speed , setSpeed ] = createSignal ( videoRef ?. playbackRate || 1 ) ;
122+ const [ showMenu , setShowMenu ] = createSignal ( false ) ;
123+ const speeds = [
124+ .5 ,
125+ .75 ,
126+ 1 ,
127+ 1.25 ,
128+ 1.5 ,
129+ 2
130+ ] ;
131+ const selectSpeed = ( newSpeed ) => {
132+ setSpeed ( newSpeed ) ;
133+ if ( videoRef ) videoRef . playbackRate = newSpeed ;
134+ setShowMenu ( false ) ;
135+ } ;
136+ return ( ( ) => {
137+ const _el$ = ( 0 , import_web$4 . getNextElement ) ( _tmpl$2 ) , _el$2 = _el$ . firstChild , _el$5 = _el$2 . nextSibling , [ _el$6 , _co$ ] = ( 0 , import_web$1 . getNextMarker ) ( _el$5 . nextSibling ) ;
138+ _el$ . addEventListener ( "mouseenter" , ( ) => setShowMenu ( true ) ) ;
139+ _el$ . addEventListener ( "mouseleave" , ( ) => setShowMenu ( false ) ) ;
140+ ( 0 , import_web$5 . insert ) ( _el$2 , ( 0 , import_web$6 . createComponent ) ( SpeedIcon , { } ) ) ;
141+ ( 0 , import_web$5 . insert ) ( _el$ , ( 0 , import_web$6 . createComponent ) ( Show , {
142+ get when ( ) {
143+ return showMenu ( ) ;
144+ } ,
145+ get children ( ) {
146+ const _el$3 = ( 0 , import_web$4 . getNextElement ) ( _tmpl$ ) , _el$4 = _el$3 . firstChild ;
147+ ( 0 , import_web$5 . insert ) ( _el$4 , ( ) => speeds . map ( ( s ) => ( ( ) => {
148+ const _el$7 = ( 0 , import_web$4 . getNextElement ) ( _tmpl$3 ) , _el$9 = _el$7 . firstChild , [ _el$0 , _co$2 ] = ( 0 , import_web$1 . getNextMarker ) ( _el$9 . nextSibling ) , _el$8 = _el$0 . nextSibling ;
149+ _el$7 . addEventListener ( "click" , ( ) => selectSpeed ( s ) ) ;
150+ ( 0 , import_web$5 . insert ) ( _el$7 , s , _el$0 , _co$2 ) ;
151+ ( 0 , import_web$3 . effect ) ( ( ) => ( 0 , import_web$2 . className ) ( _el$7 , `${ index_jsx_default . item } ${ s === speed ( ) ? index_jsx_default . active : "" } ` ) ) ;
152+ return _el$7 ;
153+ } ) ( ) ) ) ;
154+ ( 0 , import_web$3 . effect ) ( ( _p$ ) => {
155+ const _v$ = index_jsx_default . selectorWrapper , _v$2 = index_jsx_default . selector ;
156+ _v$ !== _p$ . _v$ && ( 0 , import_web$2 . className ) ( _el$3 , _p$ . _v$ = _v$ ) ;
157+ _v$2 !== _p$ . _v$2 && ( 0 , import_web$2 . className ) ( _el$4 , _p$ . _v$2 = _v$2 ) ;
158+ return _p$ ;
159+ } , {
160+ _v$ : undefined ,
161+ _v$2 : undefined
162+ } ) ;
163+ return _el$3 ;
164+ }
165+ } ) , _el$6 , _co$ ) ;
166+ ( 0 , import_web$3 . effect ) ( ( ) => ( 0 , import_web$2 . className ) ( _el$2 , index_jsx_default . icon ) ) ;
167+ return _el$ ;
168+ } ) ( ) ;
169+ }
170+ function patchVideoControls ( element ) {
171+ if ( element . dataset . nfs ) return ;
172+ element . dataset . nfs = true ;
173+ const volumeButton = element . querySelector ( "[class*=volumeButton]" ) . parentElement . parentElement ;
174+ const videoElement = element . parentElement . parentElement . querySelector ( "video" ) ;
175+ const speedControl = ( 0 , import_web$6 . createComponent ) ( SpeedControlComponent , { videoRef : videoElement } ) ;
176+ element . insertBefore ( speedControl , volumeButton ) ;
177+ }
178+ function onLoad ( ) {
179+ document . querySelectorAll ( CONTROLS_QUERY ) . forEach ( patchVideoControls ) ;
180+ observeDom ( CONTROLS_QUERY , patchVideoControls ) ;
181+ }
182+ function onUnload ( ) {
183+ document . querySelectorAll ( CONTROLS_QUERY_UNLOAD ) . forEach ( ( element ) => {
184+ element . removeAttribute ( "data-nfs" ) ;
185+ } ) ;
186+ document . querySelectorAll ( ".nfs-speed-control" ) . forEach ( ( element ) => {
187+ element . remove ( ) ;
188+ } ) ;
189+ }
190+
191+ //#endregion
192+ exports . onLoad = onLoad
193+ exports . onUnload = onUnload
194+ return exports ;
195+ } ) ( { } ) ;
0 commit comments