From d3ce2c16e7c46376672116f2a92e800261ecb4bb Mon Sep 17 00:00:00 2001 From: snoringriceball Date: Thu, 7 Apr 2022 06:25:19 +0800 Subject: [PATCH] changed scope of injected script --- src/background.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/background.ts b/src/background.ts index fbabd1b..d178613 100644 --- a/src/background.ts +++ b/src/background.ts @@ -1,6 +1,5 @@ 'use strict'; -import internal from "stream"; import LocalAlarm from "./LocalAlarm"; @@ -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); @@ -98,7 +97,7 @@ chrome.tabs.onReplaced.addListener((addedTabId, removedTabId) => { modifyTabId(addedTabId, removedTabId); }); -async function togglePlaybackState() { +const togglePlaybackState = () => { // youtube music let musicButton = document.getElementsByClassName('play-pause-button')[0]; if (!musicButton) {