-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
34 lines (29 loc) · 1 KB
/
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
var goodsites = [
"https://music.youtube.com",
"https://open.spotify.com/",
"https://www.urbandictionary.com/define.php?term=Porn",
"https://www.urbandictionary.com/define.php?term=Pornhub",
];
function randomsite() {
if (isPopupOpen) {
window.open(goodsites[Math.floor(Math.random() * goodsites.length)], "_blank");
}
};
// Get the current count from storage, or set it to 0 if it doesn't exist
chrome.storage.sync.get("count", function (result) {
let count = result.count || 0;
document.getElementById("count").textContent = count;
});
// Update the count in the popup whenever it changes in storage
chrome.storage.onChanged.addListener(function (changes, namespace) {
if (namespace === "sync" && changes.count) {
document.getElementById("count").textContent = changes.count.newValue;
}
});
/*
function isopen() {
const views = chrome.extension.getViews({ type: 'popup' });
return views.length > 0;
};*/
/*
document.getElementsByClassName("click").addEventListener("click", randomsite());*/