mirror of
https://github.com/moodle/moodle.git
synced 2025-02-27 21:43:23 +01:00
New event in core/sticky-footer that is fired when the sticky footer has been enabled or disabled. Leveraging this event, modules can create event listeners and execute actions once the sticky footer has been toggled.
14 lines
2.2 KiB
JavaScript
14 lines
2.2 KiB
JavaScript
define("core/sticky-footer",["exports","core/event_dispatcher"],(function(_exports,_event_dispatcher){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.registerManager=_exports.init=_exports.eventTypes=_exports.enableStickyFooter=_exports.disableStickyFooter=_exports.SELECTORS=void 0;
|
|
/**
|
|
* Sticky footer wrapper module.
|
|
*
|
|
* Themes are responsible for implementing the sticky footer. However,
|
|
* modules can interact with the sticky footer using this module.
|
|
*
|
|
* @module core/sticky-footer
|
|
* @copyright 2023 Ferran Recio <ferran@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
let manager={},enabled=!1,initialized=!1;const SELECTORS={STICKYFOOTER:".stickyfooter"};_exports.SELECTORS=SELECTORS;const CLASSES_INVISIBLE="v-hidden",eventTypes={stickyFooterStateChanged:"core/stickyfooter_state_changed"};_exports.eventTypes=eventTypes;const enableStickyFooter=()=>{var _document$querySelect;(enabled=!0,void 0!==manager.enableStickyFooter)?(manager.enableStickyFooter(),notifyStickyFooterStateChange(!0)):null===(_document$querySelect=document.querySelector(SELECTORS.STICKYFOOTER))||void 0===_document$querySelect||_document$querySelect.classList.remove(CLASSES_INVISIBLE)};_exports.enableStickyFooter=enableStickyFooter;const disableStickyFooter=()=>{var _document$querySelect2;(enabled=!1,void 0!==manager.disableStickyFooter)?(manager.disableStickyFooter(),notifyStickyFooterStateChange(!1)):null===(_document$querySelect2=document.querySelector(SELECTORS.STICKYFOOTER))||void 0===_document$querySelect2||_document$querySelect2.classList.add(CLASSES_INVISIBLE)};_exports.disableStickyFooter=disableStickyFooter;_exports.registerManager=themeManager=>{manager=themeManager,enabled&&enableStickyFooter()};_exports.init=()=>{var _document$querySelect3;if(initialized)return;initialized=!0;(null===(_document$querySelect3=document.querySelector(SELECTORS.STICKYFOOTER))||void 0===_document$querySelect3?void 0:_document$querySelect3.dataset.disable)?disableStickyFooter():enableStickyFooter()};const notifyStickyFooterStateChange=enabled=>{(0,_event_dispatcher.dispatchEvent)(eventTypes.stickyFooterStateChanged,{enabled:enabled},document,{cancelable:!1})}}));
|
|
|
|
//# sourceMappingURL=sticky-footer.min.js.map
|