# king-addons/51.1.83/includes/widgets/Woo_Archive_Description/script.js

King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder, version 51.1.83. 54 lines.

- Page: https://pluginprobe.com/plugins/king-addons/51.1.83/code/includes/widgets/Woo_Archive_Description/script.js
- Raw: https://pluginprobe.com/plugins/king-addons/51.1.83/raw/includes/widgets/Woo_Archive_Description/script.js
- Modified: 2026-09-16T13:52:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/king-addons/51.1.83/code/includes/widgets/Woo_Archive_Description/script.js#L10-L20`.

```javascript
/**
 * Woo Archive Description widget behaviour.
 *
 * Expands a trimmed description when the "Read more" control is used. The
 * markup ships both the trimmed and the full text; this only swaps which one
 * is visible.
 */
(function () {
    'use strict';

    const BOUND = 'kaArchiveDescriptionBound';

    const bind = (wrap) => {
        if (!wrap || !wrap.dataset || wrap.dataset[BOUND] === '1') {
            return;
        }

        const button = wrap.querySelector('.ka-woo-archive-description__readmore');
        const short = wrap.querySelector('.ka-woo-archive-description__short');
        const full = wrap.querySelector('.ka-woo-archive-description__full');
        if (!button || !short || !full) {
            return;
        }

        wrap.dataset[BOUND] = '1';
        const moreLabel = button.textContent;
        const lessLabel = button.dataset.lessText || '';

        button.addEventListener('click', () => {
            const expanded = button.getAttribute('aria-expanded') === 'true';
            short.hidden = !expanded;
            full.hidden = expanded;
            button.setAttribute('aria-expanded', expanded ? 'false' : 'true');
            if (lessLabel) {
                button.textContent = expanded ? moreLabel : lessLabel;
            }
        });
    };

    const init = (scope) => {
        const root = scope && scope.querySelectorAll ? scope : document;
        root.querySelectorAll('[data-ka-expandable="1"]').forEach(bind);
    };

    document.addEventListener('DOMContentLoaded', () => init(document));

    if (window.elementorFrontend && window.elementorFrontend.hooks) {
        window.elementorFrontend.hooks.addAction(
            'frontend/element_ready/woo_archive_description.default',
            (scope) => init(scope && scope[0] ? scope[0] : document)
        );
    }
})();

```
