%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/bitnami/apps/moodle/htdocs.backup/message/amd/build/
Upload File :
Create Path :
Current File : /opt/bitnami/apps/moodle/htdocs.backup/message/amd/build/message_drawer_lazy_load_list.min.js.map

{"version":3,"sources":["../src/message_drawer_lazy_load_list.js"],"names":["define","$","CustomEvents","SELECTORS","ROOT","LOADING_ICON_CONTAINER","CONTENT_CONTAINER","EMPTY_MESSAGE","PLACEHOLDER","startLoading","root","attr","stopLoading","isLoading","getUserId","getContentContainer","find","showLoadingIcon","removeClass","hideLoadingIcon","addClass","showEmptyMessage","showPlaceholder","hidePlaceholder","showContent","hideContent","hasLoadedAll","setLoadedAll","value","canLoadMore","loadAndRender","loadCallback","renderCallback","userId","then","items","length","contentContainer","catch","initialLoadAndRender","empty","registerEventListeners","events","scrollBottom","on","show","getRoot","containerElement","hideEmptyMessage"],"mappings":"AAuBAA,OAAM,8CACN,CACI,QADJ,CAEI,gCAFJ,CADM,CAKN,SACIC,CADJ,CAEIC,CAFJ,CAGE,IAEMC,CAAAA,CAAS,CAAG,CACZC,IAAI,CAAE,kCADM,CAEZC,sBAAsB,CAAE,0CAFZ,CAGZC,iBAAiB,CAAE,qCAHP,CAIZC,aAAa,CAAE,2CAJH,CAKZC,WAAW,CAAE,yCALD,CAFlB,CAeMC,CAAY,CAAG,SAASC,CAAT,CAAe,CAC9BA,CAAI,CAACC,IAAL,CAAU,cAAV,IACH,CAjBH,CAwBMC,CAAW,CAAG,SAASF,CAAT,CAAe,CAC7BA,CAAI,CAACC,IAAL,CAAU,cAAV,IACH,CA1BH,CAkCME,CAAS,CAAG,SAASH,CAAT,CAAe,CAC3B,MAAqC,MAA9B,GAAAA,CAAI,CAACC,IAAL,CAAU,cAAV,CACV,CApCH,CA4CMG,CAAS,CAAG,SAASJ,CAAT,CAAe,CAC3B,MAAOA,CAAAA,CAAI,CAACC,IAAL,CAAU,cAAV,CACV,CA9CH,CAsDMI,CAAmB,CAAG,SAASL,CAAT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AqBC,CAArB,CAApB,CACAtB,CAAI,CAACC,IAAL,CAAU,WAAV,IACH,CACJ,CAEM,CAEHI,mBAAmB,CAAEA,CAFlB,CAGH+B,OAAO,CAhOG,QAAVA,CAAAA,OAAU,CAASC,CAAT,CAA2B,CACrC,MAAOA,CAAAA,CAAgB,CAAC/B,IAAjB,CAAsBb,CAAS,CAACC,IAAhC,CACV,CA2NM,CAIHuB,YAAY,CAAEA,CAJX,CAKHN,gBAAgB,CAAEA,CALf,CAMH2B,gBAAgB,CA/LG,QAAnBA,CAAAA,gBAAmB,CAAStC,CAAT,CAAe,CAClCA,CAAI,CAACM,IAAL,CAAUb,CAAS,CAACI,aAApB,EAAmCa,QAAnC,CAA4C,QAA5C,CACH,CAuLM,CAOHI,WAAW,CAAEA,CAPV,CAQHC,WAAW,CAAEA,CARV,CAUV,CA/SK,CAAN","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 * Lazy loaded list of items.\n *\n * @module     core_message/message_drawer_lazy_load_list\n * @package    message\n * @copyright  2018 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n    'jquery',\n    'core/custom_interaction_events'\n],\nfunction(\n    $,\n    CustomEvents\n) {\n\n    var SELECTORS = {\n        ROOT: '[data-region=\"lazy-load-list\"]',\n        LOADING_ICON_CONTAINER: '[data-region=\"loading-icon-container\"]',\n        CONTENT_CONTAINER: '[data-region=\"content-container\"]',\n        EMPTY_MESSAGE: '[data-region=\"empty-message-container\"]',\n        PLACEHOLDER: '[data-region=\"placeholder-container\"]'\n    };\n\n    /**\n     * Flag element as loading.\n     *\n     * @param {Object} root The section container element.\n     */\n    var startLoading = function(root) {\n        root.attr('data-loading', true);\n    };\n\n    /**\n     * Flag element as not loading.\n     *\n     * @param {Object} root The section container element.\n     */\n    var stopLoading = function(root) {\n        root.attr('data-loading', false);\n    };\n\n    /**\n     * Check if the element is loading.\n     *\n     * @param {Object} root The section container element.\n     * @return {Bool}\n     */\n    var isLoading = function(root) {\n        return root.attr('data-loading') === 'true';\n    };\n\n    /**\n     * Get user id\n     *\n     * @param  {Object} root The section container element.\n     * @return {Number} Logged in user id.\n     */\n    var getUserId = function(root) {\n        return root.attr('data-user-id');\n    };\n\n    /**\n     * Get the section content container element.\n     *\n     * @param  {Object} root The section container element.\n     * @return {Object} The section content container element.\n     */\n    var getContentContainer = function(root) {\n        return root.find(SELECTORS.CONTENT_CONTAINER);\n    };\n\n    /**\n     * Get the root element.\n     *\n     * @param  {Object} containerElement The container element to search in.\n     * @return {Object} The list root element.\n     */\n    var getRoot = function(containerElement) {\n        return containerElement.find(SELECTORS.ROOT);\n    };\n\n    /**\n     * Show the loading icon.\n     *\n     * @param {Object} root The section container element.\n     */\n    var showLoadingIcon = function(root) {\n        root.find(SELECTORS.LOADING_ICON_CONTAINER).removeClass('hidden');\n    };\n\n    /**\n     * Hide the loading icon.\n     *\n     * @param {Object} root The section container element.\n     */\n    var hideLoadingIcon = function(root) {\n        root.find(SELECTORS.LOADING_ICON_CONTAINER).addClass('hidden');\n    };\n\n    /**\n     * Show the empty message.\n     *\n     * @param {Object} root The section container element.\n     */\n    var showEmptyMessage = function(root) {\n        root.find(SELECTORS.EMPTY_MESSAGE).removeClass('hidden');\n    };\n\n    /**\n     * Hide the empty message.\n     *\n     * @param {Object} root The section container element.\n     */\n    var hideEmptyMessage = function(root) {\n        root.find(SELECTORS.EMPTY_MESSAGE).addClass('hidden');\n    };\n\n    /**\n     * Show the placeholder element.\n     *\n     * @param {Object} root The section container element.\n     */\n    var showPlaceholder = function(root) {\n        root.find(SELECTORS.PLACEHOLDER).removeClass('hidden');\n    };\n\n    /**\n     * Hide the placeholder element.\n     *\n     * @param {Object} root The section container element.\n     */\n    var hidePlaceholder = function(root) {\n        root.find(SELECTORS.PLACEHOLDER).addClass('hidden');\n    };\n\n    /**\n     * Show the section content container.\n     *\n     * @param {Object} root The section container element.\n     */\n    var showContent = function(root) {\n        getContentContainer(root).removeClass('hidden');\n    };\n\n    /**\n     * Hide the section content container.\n     *\n     * @param {Object} root The section container element.\n     */\n    var hideContent = function(root) {\n        getContentContainer(root).addClass('hidden');\n    };\n\n    /**\n     * If the section has loaded all content.\n     *\n     * @param {Object} root The section container element.\n     * @return {Bool}\n     */\n    var hasLoadedAll = function(root) {\n        return root.attr('data-loaded-all') == 'true';\n    };\n\n    /**\n     * If the section has loaded all content.\n     *\n     * @param {Object} root The section container element.\n     * @param {Bool} value If all items have been loaded.\n     */\n    var setLoadedAll = function(root, value) {\n        root.attr('data-loaded-all', value);\n    };\n\n    /**\n     * If the section can load more items.\n     *\n     * @param {Object} root The section container element.\n     * @return {Bool}\n     */\n    var canLoadMore = function(root) {\n        return !hasLoadedAll(root) && !isLoading(root);\n    };\n\n    /**\n     * Load all items in this container from callback and render them.\n     *\n     * @param {Object} root The section container element.\n     * @param {Function} loadCallback The callback to load items.\n     * @param {Function} renderCallback The callback to render the results.\n     * @return {Object} jQuery promise\n     */\n    var loadAndRender = function(root, loadCallback, renderCallback) {\n        var userId = getUserId(root);\n        startLoading(root);\n\n        return loadCallback(root, userId)\n            .then(function(items) {\n                if (items.length > 0) {\n                    var contentContainer = getContentContainer(root);\n                    return renderCallback(contentContainer, items, userId)\n                        .then(function() {\n                            return items;\n                        });\n                } else {\n                    return items;\n                }\n            })\n            .then(function(items) {\n                stopLoading(root);\n                root.attr('data-seen', true);\n\n                if (!items.length) {\n                    setLoadedAll(root, true);\n                }\n\n                return items;\n            })\n            .catch(function() {\n                stopLoading(root);\n                root.attr('data-seen', true);\n                return;\n            });\n    };\n\n    /**\n     * First load of this section.\n     *\n     * @param {Object} root The section container element.\n     * @param {Function} loadCallback The callback to load items.\n     * @param {Function} renderCallback The callback to render the results.\n     * @return {Object} promise\n     */\n    var initialLoadAndRender = function(root, loadCallback, renderCallback) {\n        getContentContainer(root).empty();\n        showPlaceholder(root);\n        hideContent(root);\n        return loadAndRender(root, loadCallback, renderCallback)\n            .then(function(items) {\n                hidePlaceholder(root);\n\n                if (!items.length) {\n                    showEmptyMessage(root);\n                } else {\n                    showContent(root);\n                }\n\n                return;\n            })\n            .catch(function() {\n                hidePlaceholder(root);\n                showContent(root);\n                return;\n            });\n    };\n\n    /**\n     * Listen to, and handle events in this section.\n     *\n     * @param {Object} root The section container element.\n     * @param {Function} loadCallback The callback to load items.\n     * @param {Function} renderCallback The callback to render the results.\n     */\n    var registerEventListeners = function(root, loadCallback, renderCallback) {\n        CustomEvents.define(root, [\n            CustomEvents.events.scrollBottom\n        ]);\n\n        root.on(CustomEvents.events.scrollBottom, function() {\n            if (canLoadMore(root)) {\n                showLoadingIcon(root);\n                loadAndRender(root, loadCallback, renderCallback)\n                    .then(function() {\n                        return hideLoadingIcon(root);\n                    })\n                    .catch(function() {\n                        return hideLoadingIcon(root);\n                    });\n            }\n        });\n    };\n\n    /**\n     * Setup the section.\n     *\n     * @param {Object} root The section container element.\n     * @param {Function} loadCallback The callback to load items.\n     * @param {Function} renderCallback The callback to render the results.\n     */\n    var show = function(root, loadCallback, renderCallback) {\n        root = $(root);\n\n        if (!root.attr('data-init')) {\n            registerEventListeners(root, loadCallback, renderCallback);\n            initialLoadAndRender(root, loadCallback, renderCallback);\n            root.attr('data-init', true);\n        }\n    };\n\n    return {\n        show: show,\n        getContentContainer: getContentContainer,\n        getRoot: getRoot,\n        setLoadedAll: setLoadedAll,\n        showEmptyMessage: showEmptyMessage,\n        hideEmptyMessage: hideEmptyMessage,\n        showContent: showContent,\n        hideContent: hideContent\n    };\n});\n"],"file":"message_drawer_lazy_load_list.min.js"}

Zerion Mini Shell 1.0