-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
29 lines (25 loc) · 767 Bytes
/
popup.js
File metadata and controls
29 lines (25 loc) · 767 Bytes
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
(async () => {
console.log("hi");
const [tab] = await chrome.tabs.query({
active: true,
currentWindow: true,
});
if (!tab.url.includes("opac.regesta-imperii.de/lang_de/")) {
chrome.tabs.update({
url: "https://opac.regesta-imperii.de/lang_de/",
});
}
if (!tab.url.includes("buchbeitrag")) {
// show message in popup that extension only works for chapters
const msg = document.createElement("div");
msg.textContent = "Die extension funktioniert nur für Buchbeiträge.";
msg.style.padding = "12px";
msg.style.fontFamily = "sans-serif";
msg.style.fontSize = "14px";
document.body.appendChild(msg);
return;
}
const response = await chrome.tabs.sendMessage(tab.id, {
type: "START",
});
})();