-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
36 lines (30 loc) · 993 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
async function getActiveTabURL() {
const tabs = await chrome.tabs.query({
currentWindow: true,
active: true
});
return tabs[0];
}
const OnResult = (result) => {};
async function OnChangeLogo() {
const activeTab = await getActiveTabURL();
var message = {
type: "changeLogo"
}
chrome.tabs.sendMessage(activeTab.id, message, OnResult);
}
document.addEventListener("DOMContentLoaded", async() => {
const activeTab = await getActiveTabURL();
var container = document.getElementsByName("container")[0];
if (activeTab.url.includes("twitter.com")) {
OnChangeLogo();
container.innerHTML = '';
var button = document.createElement('button');
button.onclick = OnChangeLogo;
button.classList.add("button-17")
button.innerHTML = "수동 되돌리기";
container.appendChild(button);
} else {
containter.innerHTML = '트위터에서만 사용 가능합니다.'
}
});