-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeow.js
57 lines (48 loc) · 1.34 KB
/
meow.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Track if the plugin is active
*/
var uwuify = true
var face = document.getElementById("uwu-face")
var textBox = document.getElementById("uwu-dialogue")
var toggle = document.getElementById("uwu-toggle")
/* Track button toggle */
toggle.addEventListener("click", function(e) {
uwuify = !uwuify
togglePlugin()
})
function togglePlugin() {
if (uwuify) {
uwuMode()
} else {
boringMode()
}
sendToScraper()
chrome.storage.sync.set({"active": uwuify})
}
function boringMode() {
face.textContent = "(:()"
textBox.innerHTML = "*sobbing*<br>Hooman wants boring website :("
toggle.textContent = "o Yes to UwU o"
textBox.classList.add("no-uwu")
toggle.classList.remove("no-uwu")
}
function uwuMode() {
face.textContent = "o(UwU)o"
textBox.innerHTML = "*nuzzles*<br>*changes your website cutely*"
toggle.textContent = "no UwU"
textBox.classList.remove("no-uwu")
toggle.classList.add("no-uwu")
}
/* Update the scraper if the plugin is active */
function sendToScraper() {
chrome.tabs.query({}, (tabs) => {
for (var i=0; i < tabs.length; ++i) {
chrome.tabs.sendMessage(tabs[i].id, {msg: "toggled", data: uwuify})
}
})
}
/* Get user settings */
chrome.storage.sync.get(["active"], function(data) {
uwuify = data.active
togglePlugin()
})