Plugin Directory

Changeset 3290026


Ignore:
Timestamp:
05/08/2025 04:25:09 PM (11 months ago)
Author:
happyprime
Message:

Update to version 3.1.0 from GitHub

Location:
show-hide-section-block
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • show-hide-section-block/tags/3.1.0/LICENSE

    r3182831 r3290026  
    11Show/Hide Section Block - a plugin for WordPress
    22
    3 Copyright 2020-2024 by Happy Prime
     3Copyright 2020-2025 by Happy Prime
    44
    55This program is free software; you can redistribute it and/or modify
  • show-hide-section-block/tags/3.1.0/build/show-hide-group/view.asset.php

    r3182831 r3290026  
    1 <?php return array('dependencies' => array(), 'version' => 'fbf381460e85f307651f');
     1<?php return array('dependencies' => array(), 'version' => 'ed66e10f70e7d917c55e');
  • show-hide-section-block/tags/3.1.0/build/show-hide-group/view.js

    r3182831 r3290026  
    1 (()=>{{const e=()=>{const e=document.querySelectorAll(".wp-block-happyprime-show-hide-group .toggle-all");e.length>0&&e.forEach((e=>e.addEventListener("click",(()=>{const t=e.parentElement.querySelectorAll("details.wp-block-happyprime-show-hide-section");"true"!==e.ariaExpanded?(t.forEach((e=>{e.setAttribute("open","true")})),e.innerText="Close All",e.ariaExpanded="true"):(t.forEach((e=>{e.removeAttribute("open")})),e.innerText="Open All",e.ariaExpanded="false")}))))};document.addEventListener("DOMContentLoaded",e)}})();
     1(()=>{{const e=()=>{const e=document.querySelectorAll(".wp-block-happyprime-show-hide-group .toggle-all");e.length>0&&e.forEach((e=>e.addEventListener("click",(()=>{const t=e.parentElement.querySelectorAll("details.wp-block-happyprime-show-hide-section");"true"!==e.ariaExpanded?(t.forEach((e=>{e.setAttribute("open","true")})),e.innerText="Close All",e.ariaExpanded="true"):(t.forEach((e=>{e.removeAttribute("open")})),e.innerText="Open All",e.ariaExpanded="false")}))))},t=()=>{if(!window.location.hash)return;const e=document.querySelector(`details.wp-block-happyprime-show-hide-section${window.location.hash}`);e&&e.setAttribute("open","true")};document.addEventListener("DOMContentLoaded",(()=>{e(),t(),window.addEventListener("hashchange",t)}))}})();
  • show-hide-section-block/tags/3.1.0/languages/show-hide-section-block.pot

    r3182831 r3290026  
    1 # Copyright (C) 2024 Happy Prime
    2 # This file is distributed under the same license as the Show / Hide Section Block plugin.
     1# Copyright (C) 2025 Happy Prime
     2# This file is distributed under the GPLv2 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Show / Hide Section Block 3.0.0\n"
     5"Project-Id-Version: Show / Hide Section Block 3.1.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/show-hide-section-block\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-11-06T05:29:22+00:00\n"
     12"POT-Creation-Date: 2025-05-08T16:18:36+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.10.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: show-hide-section-block\n"
    1616
  • show-hide-section-block/tags/3.1.0/plugin.php

    r3182831 r3290026  
    33 * Plugin Name: Show / Hide Section Block
    44 * Description: Display an accessible show/hide interface with details and summary elements.
    5  * Version: 3.0.0
     5 * Version: 3.1.0
    66 * Plugin URI: https://wordpress.org/plugins/show-hide-section-block/
    77 * Author: Happy Prime
    88 * Author URI: https://happyprime.co/
     9 * License: GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    911 * Text Domain: show-hide-section-block
    1012 * Domain Path: /languages
  • show-hide-section-block/tags/3.1.0/readme.txt

    r3182831 r3290026  
    33Tags: collapsible, details, summary
    44Requires at least: 6.4
    5 Tested up to: 6.7
    6 Stable tag: 3.0.0
     5Tested up to: 6.8
     6Stable tag: 3.1.0
    77License: GPLv2 or later
    88Requires PHP: 7.4
     
    5050## Changelog
    5151
     52### 3.1.0
     53
     54* Automatically open an associated `<details>` element when its anchor is used in a URL.
     55* Update dependencies.
     56* Confirm compatibility with WordPress 6.8.
     57* Confirm license in plugin header.
     58
    5259### 3.0.0
    5360
  • show-hide-section-block/tags/3.1.0/src/show-hide-group/index.php

    r2905805 r3290026  
    2323 * Deregister the default script handle added via WordPress via block.json.
    2424 */
    25 function deregister_default() {
     25function deregister_default(): void {
    2626    wp_deregister_script( 'happyprime-show-hide-group-view-script' );
    2727}
     
    4747
    4848/**
    49  * Enqueue the toggle script if a Show / Hide Group block exists and the
    50  * toggle attribute is set to true.
     49 * Enqueue the toggle script if a Show / Hide Group block exists and the toggle
     50 * attribute is set to true.
    5151 *
    5252 * @param string|null $pre_render   Content if previously rendered, otherwise null.
     
    5555 */
    5656function maybe_enqueue_script( $pre_render, array $parsed_block ) {
     57    $enqueued = false;
     58
     59    if ( 'happyprime/show-hide-group' !== $parsed_block['blockName'] && 'happyprime/show-hide-section' !== $parsed_block['blockName'] ) {
     60        return $pre_render;
     61    }
     62
     63    // If a group has the toggle attribute, enqueue the script to support
     64    // toggle all behaviour.
    5765    if ( 'happyprime/show-hide-group' === $parsed_block['blockName'] && isset( $parsed_block['attrs']['hasToggle'] ) && $parsed_block['attrs']['hasToggle'] ) {
    5866        wp_enqueue_script( 'happyprime-show-hide-group-view' );
     67        $enqueued = true;
     68    } elseif ( 'happyprime/show-hide-section' === $parsed_block['blockName'] ) {
     69        $inner_html = new \WP_HTML_Tag_Processor( $parsed_block['innerHTML'] );
     70
     71        // If a section has an ID attribute, enqueue the script to support
     72        // improved hash navigation.
     73        if ( $inner_html->next_tag( [ 'id' => true ] ) ) {
     74            wp_enqueue_script( 'happyprime-show-hide-section-view' );
     75            $enqueued = true;
     76        }
     77    }
     78
     79    // If we've enqueued the script, remove the filter to avoid unneccesary processing.
     80    if ( $enqueued ) {
     81        remove_filter( 'pre_render_block', __NAMESPACE__ . '\maybe_enqueue_script', 10, 2 );
    5982    }
    6083
  • show-hide-section-block/tags/3.1.0/src/show-hide-group/view.js

    r3182831 r3290026  
    3232    };
    3333
    34     document.addEventListener('DOMContentLoaded', handleToggleButton);
     34    /**
     35     * Set a details element to `open` if its corresponding hash is in the URL.
     36     *
     37     * @returns {void}
     38     */
     39    const handleHashNavigation = () => {
     40        if (!window.location.hash) {
     41            return;
     42        }
     43
     44        const targetDetails = document.querySelector(
     45            `details.wp-block-happyprime-show-hide-section${window.location.hash}`
     46        );
     47
     48        if (targetDetails) {
     49            targetDetails.setAttribute('open', 'true');
     50        }
     51    };
     52
     53    document.addEventListener('DOMContentLoaded', () => {
     54        handleToggleButton();
     55        handleHashNavigation();
     56        window.addEventListener('hashchange', handleHashNavigation);
     57    });
    3558}
  • show-hide-section-block/trunk/LICENSE

    r3182831 r3290026  
    11Show/Hide Section Block - a plugin for WordPress
    22
    3 Copyright 2020-2024 by Happy Prime
     3Copyright 2020-2025 by Happy Prime
    44
    55This program is free software; you can redistribute it and/or modify
  • show-hide-section-block/trunk/build/show-hide-group/view.asset.php

    r3182831 r3290026  
    1 <?php return array('dependencies' => array(), 'version' => 'fbf381460e85f307651f');
     1<?php return array('dependencies' => array(), 'version' => 'ed66e10f70e7d917c55e');
  • show-hide-section-block/trunk/build/show-hide-group/view.js

    r3182831 r3290026  
    1 (()=>{{const e=()=>{const e=document.querySelectorAll(".wp-block-happyprime-show-hide-group .toggle-all");e.length>0&&e.forEach((e=>e.addEventListener("click",(()=>{const t=e.parentElement.querySelectorAll("details.wp-block-happyprime-show-hide-section");"true"!==e.ariaExpanded?(t.forEach((e=>{e.setAttribute("open","true")})),e.innerText="Close All",e.ariaExpanded="true"):(t.forEach((e=>{e.removeAttribute("open")})),e.innerText="Open All",e.ariaExpanded="false")}))))};document.addEventListener("DOMContentLoaded",e)}})();
     1(()=>{{const e=()=>{const e=document.querySelectorAll(".wp-block-happyprime-show-hide-group .toggle-all");e.length>0&&e.forEach((e=>e.addEventListener("click",(()=>{const t=e.parentElement.querySelectorAll("details.wp-block-happyprime-show-hide-section");"true"!==e.ariaExpanded?(t.forEach((e=>{e.setAttribute("open","true")})),e.innerText="Close All",e.ariaExpanded="true"):(t.forEach((e=>{e.removeAttribute("open")})),e.innerText="Open All",e.ariaExpanded="false")}))))},t=()=>{if(!window.location.hash)return;const e=document.querySelector(`details.wp-block-happyprime-show-hide-section${window.location.hash}`);e&&e.setAttribute("open","true")};document.addEventListener("DOMContentLoaded",(()=>{e(),t(),window.addEventListener("hashchange",t)}))}})();
  • show-hide-section-block/trunk/languages/show-hide-section-block.pot

    r3182831 r3290026  
    1 # Copyright (C) 2024 Happy Prime
    2 # This file is distributed under the same license as the Show / Hide Section Block plugin.
     1# Copyright (C) 2025 Happy Prime
     2# This file is distributed under the GPLv2 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Show / Hide Section Block 3.0.0\n"
     5"Project-Id-Version: Show / Hide Section Block 3.1.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/show-hide-section-block\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-11-06T05:29:22+00:00\n"
     12"POT-Creation-Date: 2025-05-08T16:18:36+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.10.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: show-hide-section-block\n"
    1616
  • show-hide-section-block/trunk/plugin.php

    r3182831 r3290026  
    33 * Plugin Name: Show / Hide Section Block
    44 * Description: Display an accessible show/hide interface with details and summary elements.
    5  * Version: 3.0.0
     5 * Version: 3.1.0
    66 * Plugin URI: https://wordpress.org/plugins/show-hide-section-block/
    77 * Author: Happy Prime
    88 * Author URI: https://happyprime.co/
     9 * License: GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    911 * Text Domain: show-hide-section-block
    1012 * Domain Path: /languages
  • show-hide-section-block/trunk/readme.txt

    r3182831 r3290026  
    33Tags: collapsible, details, summary
    44Requires at least: 6.4
    5 Tested up to: 6.7
    6 Stable tag: 3.0.0
     5Tested up to: 6.8
     6Stable tag: 3.1.0
    77License: GPLv2 or later
    88Requires PHP: 7.4
     
    5050## Changelog
    5151
     52### 3.1.0
     53
     54* Automatically open an associated `<details>` element when its anchor is used in a URL.
     55* Update dependencies.
     56* Confirm compatibility with WordPress 6.8.
     57* Confirm license in plugin header.
     58
    5259### 3.0.0
    5360
  • show-hide-section-block/trunk/src/show-hide-group/index.php

    r2905805 r3290026  
    2323 * Deregister the default script handle added via WordPress via block.json.
    2424 */
    25 function deregister_default() {
     25function deregister_default(): void {
    2626    wp_deregister_script( 'happyprime-show-hide-group-view-script' );
    2727}
     
    4747
    4848/**
    49  * Enqueue the toggle script if a Show / Hide Group block exists and the
    50  * toggle attribute is set to true.
     49 * Enqueue the toggle script if a Show / Hide Group block exists and the toggle
     50 * attribute is set to true.
    5151 *
    5252 * @param string|null $pre_render   Content if previously rendered, otherwise null.
     
    5555 */
    5656function maybe_enqueue_script( $pre_render, array $parsed_block ) {
     57    $enqueued = false;
     58
     59    if ( 'happyprime/show-hide-group' !== $parsed_block['blockName'] && 'happyprime/show-hide-section' !== $parsed_block['blockName'] ) {
     60        return $pre_render;
     61    }
     62
     63    // If a group has the toggle attribute, enqueue the script to support
     64    // toggle all behaviour.
    5765    if ( 'happyprime/show-hide-group' === $parsed_block['blockName'] && isset( $parsed_block['attrs']['hasToggle'] ) && $parsed_block['attrs']['hasToggle'] ) {
    5866        wp_enqueue_script( 'happyprime-show-hide-group-view' );
     67        $enqueued = true;
     68    } elseif ( 'happyprime/show-hide-section' === $parsed_block['blockName'] ) {
     69        $inner_html = new \WP_HTML_Tag_Processor( $parsed_block['innerHTML'] );
     70
     71        // If a section has an ID attribute, enqueue the script to support
     72        // improved hash navigation.
     73        if ( $inner_html->next_tag( [ 'id' => true ] ) ) {
     74            wp_enqueue_script( 'happyprime-show-hide-section-view' );
     75            $enqueued = true;
     76        }
     77    }
     78
     79    // If we've enqueued the script, remove the filter to avoid unneccesary processing.
     80    if ( $enqueued ) {
     81        remove_filter( 'pre_render_block', __NAMESPACE__ . '\maybe_enqueue_script', 10, 2 );
    5982    }
    6083
  • show-hide-section-block/trunk/src/show-hide-group/view.js

    r3182831 r3290026  
    3232    };
    3333
    34     document.addEventListener('DOMContentLoaded', handleToggleButton);
     34    /**
     35     * Set a details element to `open` if its corresponding hash is in the URL.
     36     *
     37     * @returns {void}
     38     */
     39    const handleHashNavigation = () => {
     40        if (!window.location.hash) {
     41            return;
     42        }
     43
     44        const targetDetails = document.querySelector(
     45            `details.wp-block-happyprime-show-hide-section${window.location.hash}`
     46        );
     47
     48        if (targetDetails) {
     49            targetDetails.setAttribute('open', 'true');
     50        }
     51    };
     52
     53    document.addEventListener('DOMContentLoaded', () => {
     54        handleToggleButton();
     55        handleHashNavigation();
     56        window.addEventListener('hashchange', handleHashNavigation);
     57    });
    3558}
Note: See TracChangeset for help on using the changeset viewer.