-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworker.js
More file actions
21 lines (19 loc) · 673 Bytes
/
worker.js
File metadata and controls
21 lines (19 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
chrome.runtime.onMessage.addListener(async (msg, sender, sendResponse) => {
if(msg.type === 'execute-script') {
// Get the current tab.
const tabs = await chrome.tabs.query({ active: !0, currentWindow: !0 });
const tabId = tabs[0];
await chrome.scripting.executeScript({
target: { tabId: tabId.id },
function: () => {
// Apply the style change in the current tab
const logo = document.querySelector('img[alt="Google"]');
if (logo) {
logo.style.transition = 'transform 2s';
logo.style.transform = 'rotate(360deg)';
}
}
});
}
sendResponse(true);
})