jumpy-lion 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,95 +1,96 @@
1
- var background = {
2
- "port": null,
3
- "message": {},
4
- "receive": function (id, callback) {
5
- if (id) {
6
- background.message[id] = callback;
7
- }
8
- },
9
- "send": function (id, data) {
10
- if (id) {
11
- chrome.runtime.sendMessage({
12
- "method": id,
13
- "data": data,
14
- "path": "popup-to-background"
15
- }, function () {
16
- return chrome.runtime.lastError;
17
- });
18
- }
19
- },
20
- "connect": function (port) {
21
- chrome.runtime.onMessage.addListener(background.listener);
22
- /* */
23
- if (port) {
24
- background.port = port;
25
- background.port.onMessage.addListener(background.listener);
26
- background.port.onDisconnect.addListener(function () {
27
- background.port = null;
28
- });
29
- }
30
- },
31
- "post": function (id, data) {
32
- if (id) {
33
- if (background.port) {
34
- background.port.postMessage({
35
- "method": id,
36
- "data": data,
37
- "path": "popup-to-background",
38
- "port": background.port.name
39
- });
40
- }
41
- }
42
- },
43
- "listener": function (e) {
44
- if (e) {
45
- for (let id in background.message) {
46
- if (background.message[id]) {
47
- if ((typeof background.message[id]) === "function") {
48
- if (e.path === "background-to-popup") {
49
- if (e.method === id) {
50
- background.message[id](e.data);
51
- }
52
- }
53
- }
54
- }
55
- }
56
- }
57
- }
58
- };
59
- var config = {
60
- "ids": [
61
- "support",
62
- "donation",
63
- "fingerprint",
64
- "notifications"
65
- ],
66
- "render": function (e) {
67
- const name = document.querySelector(".name");
68
- const notifications = document.querySelector(".notifications");
69
- /* */
70
- name.textContent = chrome.runtime.getManifest().name;
71
- notifications.textContent = e.notifications ? '☑' : '☐';
72
- },
73
- "load": function () {
74
- for (let i = 0; i < config.ids.length; i++) {
75
- const icon = document.querySelector("." + config.ids[i]);
76
- const button = document.querySelector("#" + config.ids[i]);
77
- /* */
78
- button.addEventListener("click", function (e) {
79
- background.send(e.target.id);
80
- });
81
- /* */
82
- icon.addEventListener("click", function (e) {
83
- background.send(e.target.className.replace("icon ", ''));
84
- });
85
- }
86
- /* */
87
- background.send("load");
88
- window.removeEventListener("load", config.load, false);
89
- }
90
- };
91
- background.receive("storage", config.render);
92
- background.connect(chrome.runtime.connect({ "name": "popup" }));
93
- window.addEventListener("load", config.load, false);
94
- export {};
95
- //# sourceMappingURL=popup.js.map
1
+ var background = {
2
+ "port": null,
3
+ "message": {},
4
+ "receive": function (id, callback) {
5
+ if (id) {
6
+ background.message[id] = callback;
7
+ }
8
+ },
9
+ "send": function (id, data) {
10
+ if (id) {
11
+ chrome.runtime.sendMessage({
12
+ "method": id,
13
+ "data": data,
14
+ "path": "popup-to-background"
15
+ }, function () {
16
+ return chrome.runtime.lastError;
17
+ });
18
+ }
19
+ },
20
+ "connect": function (port) {
21
+ chrome.runtime.onMessage.addListener(background.listener);
22
+ /* */
23
+ if (port) {
24
+ background.port = port;
25
+ background.port.onMessage.addListener(background.listener);
26
+ background.port.onDisconnect.addListener(function () {
27
+ background.port = null;
28
+ });
29
+ }
30
+ },
31
+ "post": function (id, data) {
32
+ if (id) {
33
+ if (background.port) {
34
+ background.port.postMessage({
35
+ "method": id,
36
+ "data": data,
37
+ "path": "popup-to-background",
38
+ "port": background.port.name
39
+ });
40
+ }
41
+ }
42
+ },
43
+ "listener": function (e) {
44
+ if (e) {
45
+ for (let id in background.message) {
46
+ if (background.message[id]) {
47
+ if ((typeof background.message[id]) === "function") {
48
+ if (e.path === "background-to-popup") {
49
+ if (e.method === id) {
50
+ background.message[id](e.data);
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ };
59
+
60
+ var config = {
61
+ "ids": [
62
+ "support",
63
+ "donation",
64
+ "fingerprint",
65
+ "notifications"
66
+ ],
67
+ "render": function (e) {
68
+ const name = document.querySelector(".name");
69
+ const notifications = document.querySelector(".notifications");
70
+ /* */
71
+ name.textContent = chrome.runtime.getManifest().name;
72
+ notifications.textContent = e.notifications ? '☑' : '☐';
73
+ },
74
+ "load": function () {
75
+ for (let i = 0; i < config.ids.length; i++) {
76
+ const icon = document.querySelector("." + config.ids[i]);
77
+ const button = document.querySelector("#" + config.ids[i]);
78
+ /* */
79
+ button.addEventListener("click", function (e) {
80
+ background.send(e.target.id);
81
+ });
82
+ /* */
83
+ icon.addEventListener("click", function (e) {
84
+ background.send(e.target.className.replace("icon ", ''));
85
+ });
86
+ }
87
+ /* */
88
+ background.send("load");
89
+ window.removeEventListener("load", config.load, false);
90
+ }
91
+ };
92
+
93
+ background.receive("storage", config.render);
94
+ background.connect(chrome.runtime.connect({"name": "popup"}));
95
+
96
+ window.addEventListener("load", config.load, false);