Skip to content

Commit

Permalink
changed scope of injected script
Browse files Browse the repository at this point in the history
  • Loading branch information
snoringriceball committed Apr 6, 2022
1 parent 7129b40 commit d3ce2c1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

import internal from "stream";
import LocalAlarm from "./LocalAlarm";


Expand Down Expand Up @@ -84,7 +83,7 @@ chrome.alarms.onAlarm.addListener(async (alarm) => {
const localAlarm = await findLocalAlarmByName(alarm.name);
if (!localAlarm) throw new Error(`Could not find alarm called ${alarm.name}`);
await chrome.scripting.executeScript({
target: { tabId: localAlarm.tabId, allFrames: true },
target: { tabId: localAlarm.tabId },
func: togglePlaybackState
});
deleteLocalAlarm(localAlarm.tabId);
Expand All @@ -98,7 +97,7 @@ chrome.tabs.onReplaced.addListener((addedTabId, removedTabId) => {
modifyTabId(addedTabId, removedTabId);
});

async function togglePlaybackState() {
const togglePlaybackState = () => {
// youtube music
let musicButton = <HTMLButtonElement>document.getElementsByClassName('play-pause-button')[0];
if (!musicButton) {
Expand Down

0 comments on commit d3ce2c1

Please sign in to comment.