-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
22 lines (19 loc) · 707 Bytes
/
Copy pathpopup.js
File metadata and controls
22 lines (19 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let element = document.getElementById("button");
element.addEventListener('click', function () {
chrome.tabs.query({}, function (tabs) {
console.log("\n/////////////////////\n");
tabs.forEach(function (tab) {
if (tab.url === "https://web.whatsapp.com/") {
console.log(tab.url, " ", tab.id);
chrome.tabs.executeScript(tab.id, {
//file: 'script.js'
code: 'document.getElementsByTagName("body")[0].classList.toggle("dark");'
});
}
});
});
if (element.innerHTML === "Light")
element.innerHTML = "Dark";
else
element.innerHTML = "Light";
});