| 1 |
(function () { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
/** |
| 5 |
* Styled List — frontend script |
| 6 |
* |
| 7 |
* The block is primarily CSS-driven. This script handles: |
| 8 |
* 1. Hover background colour — we read the CSS var and apply it so |
| 9 |
* browsers that don't support CSS colour-mix still get the effect. |
| 10 |
* 2. A small entrance animation (optional — only when the wrap has |
| 11 |
* data-animate="1", reserved for future use via the editor toggle). |
| 12 |
*/ |
| 13 |
|
| 14 |
function toArray(nl) { |
| 15 |
return Array.prototype.slice.call(nl || []); |
| 16 |
} |
| 17 |
|
| 18 |
function initStyledList(wrap) { |
| 19 |
// Nothing interactive is required right now. |
| 20 |
// The hover state and dividers are handled entirely via CSS. |
| 21 |
// This function is intentionally kept for future extension points |
| 22 |
// (e.g. animate-on-scroll, click-to-expand description, etc.). |
| 23 |
} |
| 24 |
|
| 25 |
function init() { |
| 26 |
toArray(document.querySelectorAll('.bkbg-sl-wrap')).forEach(initStyledList); |
| 27 |
} |
| 28 |
|
| 29 |
if (document.readyState === 'loading') { |
| 30 |
document.addEventListener('DOMContentLoaded', init); |
| 31 |
} else { |
| 32 |
init(); |
| 33 |
} |
| 34 |
})(); |
| 35 |
|