File tree Expand file tree Collapse file tree 1 file changed +0
-22
lines changed Expand file tree Collapse file tree 1 file changed +0
-22
lines changed Original file line number Diff line number Diff line change 1
- // content.js
2
1
3
- // Create a MutationObserver to watch for changes in the player container
4
- const observer = new MutationObserver ( mutations => {
5
- mutations . forEach ( mutation => {
6
- if (
7
- mutation . attributeName === 'aria-label' &&
8
- mutation . target . getAttribute ( 'aria-label' ) . startsWith ( 'Play' )
9
- ) {
10
- //console.log('Video started playing');
11
- chrome . runtime . sendMessage ( { action : 'videoStarted' } ) ;
12
- }
13
- } ) ;
14
- } ) ;
15
-
16
- // Find the player container element
17
- const playerContainer = document . getElementById ( 'player-container' ) ;
18
-
19
- // Start observing mutations in the player container
20
- observer . observe ( playerContainer , { attributes : true } ) ;
21
-
22
- // Log a message when the content script is loaded
23
- //console.log('Content script loaded');
You can’t perform that action at this time.
0 commit comments