%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/ava/theme/boost/amd/build/
Upload File :
Create Path :
Current File : /home/vacivi36/ava/theme/boost/amd/build/sticky-footer.min.js.map

{"version":3,"file":"sticky-footer.min.js","sources":["../src/sticky-footer.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Sticky footer module.\n *\n * @module     theme_boost/sticky-footer\n * @copyright  2022 Ferran Recio <ferran@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Pending from 'core/pending';\n\nconst SELECTORS = {\n    STICKYFOOTER: '.stickyfooter',\n    PAGE: '#page',\n};\n\nconst CLASSES = {\n    HASSTICKYFOOTER: 'hasstickyfooter',\n};\n\nlet initialized = false;\n\nlet previousScrollPosition = 0;\n\n/**\n * Return the current page scroll position.\n * @package\n * @returns {number} the current scroll position\n */\nconst getScrollPosition = () => {\n    const page = document.querySelector(SELECTORS.PAGE);\n    if (page) {\n        return page.scrollTop;\n    }\n    return window.pageYOffset;\n};\n\n/**\n * Scroll handler.\n * @package\n */\nconst scrollSpy = () => {\n    // Ignore scroll if page size is not small.\n    if (document.body.clientWidth >= 768) {\n        return;\n    }\n    // Detect if scroll is going down.\n    let scrollPosition = getScrollPosition();\n    if (scrollPosition > previousScrollPosition) {\n        disableStickyFooter();\n    } else {\n        enableStickyFooter();\n    }\n    previousScrollPosition = scrollPosition;\n};\n\n/**\n * Enable sticky footer in the page.\n */\nexport const enableStickyFooter = () => {\n    // We need some seconds to make sure the CSS animation is ready.\n    const pendingPromise = new Pending('theme_boost/sticky-footer:enabling');\n    const footer = document.querySelector(SELECTORS.STICKYFOOTER);\n    const page = document.querySelector(SELECTORS.PAGE);\n    if (footer && page) {\n        document.body.classList.add(CLASSES.HASSTICKYFOOTER);\n        page.classList.add(CLASSES.HASSTICKYFOOTER);\n    }\n    setTimeout(() => pendingPromise.resolve(), 1000);\n};\n\n/**\n * Disable sticky footer in the page.\n */\nexport const disableStickyFooter = () => {\n    document.body.classList.remove(CLASSES.HASSTICKYFOOTER);\n    const page = document.querySelector(SELECTORS.PAGE);\n    page?.classList.remove(CLASSES.HASSTICKYFOOTER);\n};\n\n/**\n * Initialize the module.\n */\nexport const init = () => {\n    // Prevent sticky footer in behat.\n    if (initialized || document.body.classList.contains('behat-site')) {\n        return;\n    }\n    initialized = true;\n    enableStickyFooter();\n    const content = document.querySelector(SELECTORS.PAGE) ?? document.body;\n    content.addEventListener(\"scroll\", scrollSpy);\n};\n"],"names":["SELECTORS","CLASSES","initialized","previousScrollPosition","scrollSpy","document","body","clientWidth","scrollPosition","page","querySelector","scrollTop","window","pageYOffset","getScrollPosition","disableStickyFooter","enableStickyFooter","pendingPromise","Pending","footer","classList","add","setTimeout","resolve","remove","contains","addEventListener"],"mappings":";;;;;;;2MAyBMA,uBACY,gBADZA,eAEI,QAGJC,wBACe,sBAGjBC,aAAc,EAEdC,uBAAyB,QAmBvBC,UAAY,QAEVC,SAASC,KAAKC,aAAe,eAI7BC,eAlBkB,YAChBC,KAAOJ,SAASK,cAAcV,uBAChCS,KACOA,KAAKE,UAETC,OAAOC,aAaOC,GACjBN,eAAiBL,uBACjBY,sBAEAC,qBAEJb,uBAAyBK,gBAMhBQ,mBAAqB,WAExBC,eAAiB,IAAIC,iBAAQ,sCAC7BC,OAASd,SAASK,cAAcV,wBAChCS,KAAOJ,SAASK,cAAcV,gBAChCmB,QAAUV,OACVJ,SAASC,KAAKc,UAAUC,IAAIpB,yBAC5BQ,KAAKW,UAAUC,IAAIpB,0BAEvBqB,YAAW,IAAML,eAAeM,WAAW,2DAMlCR,oBAAsB,KAC/BV,SAASC,KAAKc,UAAUI,OAAOvB,+BACzBQ,KAAOJ,SAASK,cAAcV,gBACpCS,MAAAA,MAAAA,KAAMW,UAAUI,OAAOvB,yFAMP,kCAEZC,aAAeG,SAASC,KAAKc,UAAUK,SAAS,qBAGpDvB,aAAc,EACdc,oDACgBX,SAASK,cAAcV,uEAAmBK,SAASC,MAC3DoB,iBAAiB,SAAUtB"}

Zerion Mini Shell 1.0