@cap.js/widget 0.1.36 → 0.1.38

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.
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
1
  {
2
2
  "name": "@cap.js/widget",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "Client-side widget for Cap, a lightweight, modern open-source CAPTCHA alternative designed using SHA-256 PoW.",
5
5
  "keywords": [
6
- "security",
7
- "detection",
8
- "prevention",
9
- "defense",
10
- "protection",
6
+ "algorithm",
11
7
  "anti-abuse",
12
8
  "anti-automation",
13
9
  "anti-bot",
14
10
  "anti-ddos",
15
11
  "anti-dos",
16
12
  "anti-exploitation",
17
- "anti-spam",
18
13
  "anti-scraping",
14
+ "anti-spam",
19
15
  "attack-mitigation",
20
- "protocol",
16
+ "bots",
17
+ "captcha-alternative",
21
18
  "client-server",
22
- "computational-puzzle",
23
19
  "complexity",
24
- "puzzle",
20
+ "computational-puzzle",
25
21
  "crypto",
26
22
  "cryptographic",
27
- "algorithm",
28
23
  "cybersecurity",
29
24
  "ddos",
25
+ "defense",
26
+ "detection",
27
+ "filtering",
30
28
  "hashcash",
31
29
  "hcaptcha",
32
- "captcha-alternative",
33
- "verification",
34
30
  "invisible",
35
31
  "pow",
32
+ "prevention",
36
33
  "proof-of-work",
34
+ "protection",
35
+ "protocol",
36
+ "puzzle",
37
37
  "recaptcha",
38
+ "security",
38
39
  "spam",
39
- "bots",
40
- "filtering",
41
- "turing-test"
40
+ "turing-test",
41
+ "verification"
42
42
  ],
43
43
  "homepage": "https://github.com/tiagozip/cap#readme",
44
44
  "bugs": {
45
45
  "url": "https://github.com/tiagozip/cap/issues"
46
46
  },
47
+ "license": "Apache-2.0",
48
+ "author": "Tiago",
47
49
  "repository": {
48
50
  "type": "git",
49
51
  "url": "git+https://github.com/tiagozip/cap.git"
50
52
  },
51
- "license": "Apache-2.0",
52
- "author": "Tiago",
53
53
  "type": "commonjs",
54
54
  "main": "cap.min.js",
55
55
  "types": "cap.d.ts"
@@ -8,17 +8,17 @@
8
8
 
9
9
  setTimeout(() => {
10
10
  element.onclick = null;
11
- handlers.forEach((h) => element.removeEventListener("click", h));
11
+ handlers.forEach((h) => {
12
+ return element.removeEventListener("click", h);
13
+ });
12
14
  element.onclick = (e) => handleClick(e, element, capWidget, handlers);
13
15
  }, 50);
14
16
  };
15
17
 
16
18
  element.onclick = null;
17
19
 
18
- const offset =
19
- parseInt(element.getAttribute("data-cap-floating-offset")) || 8;
20
- const position =
21
- element.getAttribute("data-cap-floating-position") || "top";
20
+ const offset = parseInt(element.getAttribute("data-cap-floating-offset")) || 8;
21
+ const position = element.getAttribute("data-cap-floating-position") || "top";
22
22
  const rect = element.getBoundingClientRect();
23
23
 
24
24
  Object.assign(capWidget.style, {
@@ -45,12 +45,12 @@
45
45
  if (position === "top") {
46
46
  capWidget.style.top = `${Math.max(
47
47
  window.scrollY,
48
- rect.top - capWidget.offsetHeight - offset + window.scrollY
48
+ rect.top - capWidget.offsetHeight - offset + window.scrollY,
49
49
  )}px`;
50
50
  } else {
51
51
  capWidget.style.top = `${Math.min(
52
52
  rect.bottom + offset + window.scrollY,
53
- window.innerHeight - capWidget.offsetHeight + window.scrollY
53
+ window.innerHeight - capWidget.offsetHeight + window.scrollY,
54
54
  )}px`;
55
55
  }
56
56
 
@@ -82,23 +82,21 @@
82
82
 
83
83
  const capWidget = document.querySelector(capWidgetSelector);
84
84
  if (!document.contains(capWidget) && !capWidget.solve) {
85
- throw new Error(
86
- `[cap floating] "${capWidgetSelector}" doesn't exist or isn't a Cap widget`
87
- );
85
+ throw new Error(`[cap floating] "${capWidgetSelector}" doesn't exist or isn't a Cap widget`);
88
86
  }
89
87
 
90
88
  capWidget.style.display = "none";
91
89
  const handlers = [element.onclick].filter(Boolean);
92
90
 
93
91
  if (typeof getEventListeners === "function") {
94
- handlers.push(
95
- ...(getEventListeners(element).click || []).map((l) => l.listener)
96
- );
92
+ handlers.push(...(getEventListeners(element).click || []).map((l) => l.listener));
97
93
  }
98
94
 
99
95
  if (handlers.length) {
100
96
  element.onclick = null;
101
- handlers.forEach((h) => element.removeEventListener("click", h));
97
+ handlers.forEach((h) => {
98
+ return element.removeEventListener("click", h);
99
+ });
102
100
  }
103
101
 
104
102
  element.addEventListener("click", (e) => {
@@ -119,7 +117,7 @@
119
117
  mutations.forEach((mutation) =>
120
118
  mutation.addedNodes.forEach((node) => {
121
119
  if (node.nodeType === Node.ELEMENT_NODE) init(node);
122
- })
123
- )
120
+ }),
121
+ ),
124
122
  ).observe(document.body, { childList: true, subtree: true });
125
123
  })();
package/src/cap.css CHANGED
@@ -47,6 +47,10 @@
47
47
  color: var(--cap-color, #212121);
48
48
  }
49
49
 
50
+ .captcha:not([data-state]):active {
51
+ transform: scale(0.97);
52
+ }
53
+
50
54
  .captcha:hover {
51
55
  filter: brightness(98%);
52
56
  }
@@ -229,3 +233,16 @@
229
233
  text-decoration-thickness: 0.08em;
230
234
  z-index: 6;
231
235
  }
236
+
237
+ .cap-troubleshoot-link {
238
+ color: #0066cc;
239
+ text-decoration: underline;
240
+ text-underline-offset: 0.15em;
241
+ text-decoration-thickness: 0.08em;
242
+ cursor: pointer;
243
+ font-weight: 500;
244
+ font-size: inherit;
245
+ }
246
+ .cap-troubleshoot-link:hover {
247
+ opacity: 0.8;
248
+ }