PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.7
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.7
2.0.13 2.0.12 2.0.11 2.0.10 2.0.9 trunk 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
blockenberg / blocks / link-in-bio / frontend.js

frontend.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.7, at blocks/link-in-bio/frontend.js

33 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function () {
2 'use strict';
3
4 /* Link in Bio — minimal frontend: hover is CSS only; this script
5 adds optional click analytics hook and keyboard accessibility. */
6
7 document.addEventListener('DOMContentLoaded', function () {
8 document.querySelectorAll('.bkbg-lib-wrapper').forEach(function (wrapper) {
9 var links = wrapper.querySelectorAll('.bkbg-lib-btn');
10
11 links.forEach(function (link) {
12 /* Keyboard: Enter / Space already works for <a> natively.
13 This is a safety net for any edge cases. */
14 link.addEventListener('keydown', function (e) {
15 if (e.key === 'Enter' || e.key === ' ') {
16 e.preventDefault();
17 link.click();
18 }
19 });
20
21 /* Fire custom event so developers can hook analytics */
22 link.addEventListener('click', function () {
23 var event = new CustomEvent('bkbg:lib:click', {
24 bubbles: true,
25 detail: { label: link.textContent.trim(), href: link.href }
26 });
27 link.dispatchEvent(event);
28 });
29 });
30 });
31 });
32 })();
33