26
26
// @match http*://*.vlive.tv/video/*
27
27
// @match http*://*.vlive.tv/post/*
28
28
// @match http*://*.now.naver.com/*
29
- // @match http*://*.weverse.io/*
29
+ // @match http*://weverse.io/*
30
+ // @match https*://tv.naver.com/*
30
31
// @noframes
31
32
// dummy grant to enable sandboxing
32
33
// @grant GM_getValue
@@ -113,7 +114,7 @@ import {
113
114
import {
114
115
getPlatform ,
115
116
getVideoPlatformHooks ,
116
- getVideoPlatformSelectors ,
117
+ videoPlatformSelectors ,
117
118
VideoPlatformHooks ,
118
119
VideoPlatforms ,
119
120
} from './platforms/platforms' ;
@@ -122,6 +123,7 @@ import { disableCommonBlockers, enableCommonBlockers } from './platforms/blocker
122
123
const ytClipperCSS = readFileSync ( __dirname + '/ui/css/yt-clipper.css' , 'utf8' ) ;
123
124
const vliveCSS = readFileSync ( __dirname + '/platforms/css/vlive.css' , 'utf8' ) ;
124
125
const naver_now_watchCSS = readFileSync ( __dirname + '/platforms/css/naver_now_watch.css' , 'utf8' ) ;
126
+ const naver_tvCSS = readFileSync ( __dirname + '/platforms/css/naver_tv.css' , 'utf8' ) ;
125
127
const weverseCSS = readFileSync ( __dirname + '/platforms/css/weverse.css' , 'utf8' ) ;
126
128
const shortcutsTable = readFileSync ( __dirname + '/ui/shortcuts-table/shortcuts-table.html' , 'utf8' ) ;
127
129
const shortcutsTableStyle = readFileSync (
@@ -370,6 +372,7 @@ async function loadytClipper() {
370
372
if ( platform === VideoPlatforms . vlive ) injectCSS ( vliveCSS , 'vlive-css' ) ;
371
373
if ( platform === VideoPlatforms . naver_now_watch ) injectCSS ( naver_now_watchCSS , 'naver-now-css' ) ;
372
374
if ( platform === VideoPlatforms . weverse ) injectCSS ( weverseCSS , 'weverse-css' ) ;
375
+ if ( platform === VideoPlatforms . naver_tv ) injectCSS ( naver_tvCSS , 'naver-tv-css' ) ;
373
376
initHooks ( ) ;
374
377
initVideoInfo ( ) ;
375
378
initObservers ( ) ;
@@ -516,7 +519,7 @@ async function loadytClipper() {
516
519
document . body . addEventListener ( 'wheel' , inheritCropPointCrop , { passive : false } ) ;
517
520
}
518
521
519
- const selectors = getVideoPlatformSelectors ( platform ) ;
522
+ const selectors = videoPlatformSelectors [ platform ] ;
520
523
521
524
player = await retryUntilTruthyResult ( ( ) => document . querySelector ( selectors . player ) ) ;
522
525
video = await retryUntilTruthyResult ( ( ) => player . querySelector ( selectors . video ) ) ;
@@ -558,7 +561,6 @@ async function loadytClipper() {
558
561
videoInfo . title = playerData . title ;
559
562
videoInfo . fps = getFPS ( ) ;
560
563
video . seekTo = ( time ) => player . seekTo ( time ) ;
561
-
562
564
} else if ( platform === VideoPlatforms . vlive ) {
563
565
const location = window . location ;
564
566
@@ -574,16 +576,24 @@ async function loadytClipper() {
574
576
575
577
videoInfo . fps = getFPS ( ) ;
576
578
video . seekTo = ( time ) => ( video . currentTime = time ) ;
577
-
578
579
} else if ( platform === VideoPlatforms . naver_now_watch ) {
579
580
videoInfo . id = location . pathname . split ( '/' ) [ 2 ] ;
580
- videoInfo . title = document . querySelector ( 'h2[class*=ArticleSection_article_title]' ) ?. textContent
581
+ videoInfo . title = document . querySelector (
582
+ 'h2[class*=ArticleSection_article_title]'
583
+ ) ?. textContent ;
584
+ videoInfo . fps = getFPS ( ) ;
585
+ video . seekTo = ( time ) => ( video . currentTime = time ) ;
586
+ } else if ( platform === VideoPlatforms . naver_tv ) {
587
+ videoInfo . id = location . pathname . split ( '/' ) [ 2 ] ;
588
+ videoInfo . title = document . querySelector (
589
+ 'h2[class*=ArticleSection_article_title]'
590
+ ) ?. textContent ;
581
591
videoInfo . fps = getFPS ( ) ;
582
592
video . seekTo = ( time ) => ( video . currentTime = time ) ;
583
593
} else if ( platform === VideoPlatforms . weverse ) {
584
- videoInfo . title = document . querySelector ( 'h2[class*=TitleView_title]' ) ?. textContent
594
+ videoInfo . title = document . querySelector ( 'h2[class*=TitleView_title]' ) ?. textContent ;
585
595
586
- if ( location . pathname . includes ( 'media' ) || ( location . pathname . includes ( 'live' ) ) ) {
596
+ if ( location . pathname . includes ( 'media' ) || location . pathname . includes ( 'live' ) ) {
587
597
if ( videoInfo . id == null ) videoInfo . id = location . pathname . split ( '/' ) [ 3 ] ;
588
598
}
589
599
videoInfo . fps = getFPS ( ) ;
@@ -596,7 +606,6 @@ async function loadytClipper() {
596
606
}
597
607
}
598
608
599
-
600
609
function initObservers ( ) {
601
610
new ResizeObserver ( resizeCropOverlay ) . observe ( hooks . videoContainer ) ;
602
611
}
@@ -826,7 +835,7 @@ async function loadytClipper() {
826
835
<svg id="start-marker-numberings"></svg>
827
836
<svg id="end-marker-numberings"></svg>
828
837
` ;
829
- hooks . markersDiv . appendChild ( markersDiv ) ;
838
+
830
839
markersSvg = markersDiv . children [ 0 ] as SVGSVGElement ;
831
840
selectedMarkerPairOverlay = markersDiv . children [ 1 ] as SVGSVGElement ;
832
841
@@ -836,9 +845,21 @@ async function loadytClipper() {
836
845
<svg id="start-marker-numberings"></svg>
837
846
<svg id="end-marker-numberings"></svg>
838
847
` ;
839
- hooks . markerNumberingsDiv . appendChild ( markerNumberingsDiv ) ;
840
848
startMarkerNumberings = markerNumberingsDiv . children [ 0 ] as SVGSVGElement ;
841
849
endMarkerNumberings = markerNumberingsDiv . children [ 1 ] as SVGSVGElement ;
850
+
851
+ if (
852
+ [ VideoPlatforms . weverse , VideoPlatforms . naver_now_watch , VideoPlatforms . naver_tv ] . includes (
853
+ platform
854
+ )
855
+ ) {
856
+ hooks . markersDiv . prepend ( markersDiv ) ;
857
+ hooks . markerNumberingsDiv . prepend ( markerNumberingsDiv ) ;
858
+ } else {
859
+ hooks . markersDiv . appendChild ( markersDiv ) ;
860
+ hooks . markerNumberingsDiv . appendChild ( markerNumberingsDiv ) ;
861
+ }
862
+
842
863
videoInfo . fps = getFPS ( ) ;
843
864
}
844
865
@@ -3433,7 +3454,20 @@ async function loadytClipper() {
3433
3454
function injectToggleShortcutsTableButton ( ) {
3434
3455
shortcutsTableToggleButton = htmlToElement ( shortcutsTableToggleButtonHTML ) as HTMLButtonElement ;
3435
3456
shortcutsTableToggleButton . onclick = toggleShortcutsTable ;
3436
- if ( platform === VideoPlatforms . naver_now_watch ) shortcutsTableToggleButton . classList . add ( 'pzp-pc__subtitle-button' ) ;
3457
+
3458
+ if (
3459
+ [ VideoPlatforms . weverse , VideoPlatforms . naver_now_watch , VideoPlatforms . naver_tv ] . includes (
3460
+ platform
3461
+ )
3462
+ ) {
3463
+ shortcutsTableToggleButton . classList . add (
3464
+ 'pzp-button' ,
3465
+ 'pzp-subtitle-button' ,
3466
+ 'pzp-pc-subtitle-button' ,
3467
+ 'pzp-pc__subtitle-button'
3468
+ ) ;
3469
+ }
3470
+
3437
3471
hooks . shortcutsTableButton . insertAdjacentElement ( 'afterbegin' , shortcutsTableToggleButton ) ;
3438
3472
}
3439
3473
@@ -3902,10 +3936,10 @@ async function loadytClipper() {
3902
3936
isCropOverlayVisible = false ;
3903
3937
}
3904
3938
3905
-
3906
3939
function hidePlayerControls ( ) {
3907
3940
hooks . controls . originalDisplay = hooks . controls . originalDisplay ?? hooks . controls . style . display ;
3908
- hooks . controlsGradient . originalDisplay = hooks . controlsGradient . originalDisplay ?? hooks . controlsGradient . style . display ;
3941
+ hooks . controlsGradient . originalDisplay =
3942
+ hooks . controlsGradient . originalDisplay ?? hooks . controlsGradient . style . display ;
3909
3943
3910
3944
hooks . controls . style . display = 'none' ;
3911
3945
hooks . controlsGradient . style . display = 'none' ;
0 commit comments