mirror of
https://github.com/moodle/moodle.git
synced 2025-02-26 21:13:33 +01:00
- Create a new 'showmore' template that receives both collapsed and expanded content. Initially only the collapsed content will be displayed with a "Show more" button. When it is expanded, only the expanded content will be displayed with "Show less" button. - Add 'showmore' component to component library
11 lines
972 B
JavaScript
11 lines
972 B
JavaScript
define("core/showmore",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0;
|
|
/**
|
|
* Initializes and handles events fow 'showmore' components.
|
|
*
|
|
* @module core/showmore
|
|
* @copyright 2023 Mikel Martín <mikel@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
const Selectors_actions={toggleContent:'[data-action="toggle-content"]'},Selectors_regions={main:'[data-region="showmore"]'};let initialized=!1;_exports.init=()=>{initialized||(document.addEventListener("click",(event=>{const toggleContent=event.target.closest(Selectors_actions.toggleContent);if(toggleContent){const region=toggleContent.closest(Selectors_regions.main);region.classList.toggle("collapsed");region.querySelector(Selectors_actions.toggleContent).setAttribute("aria-expanded",!region.classList.contains("collapsed"))}})),initialized=!0)}}));
|
|
|
|
//# sourceMappingURL=showmore.min.js.map
|