Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/blocks/timeline/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/blocks/timeline/amd/build/view_nav.min.js.map

{"version":3,"sources":["../src/view_nav.js"],"names":["define","$","CustomEvents","View","Ajax","Notification","SELECTORS","TIMELINE_DAY_FILTER","TIMELINE_DAY_FILTER_OPTION","TIMELINE_VIEW_SELECTOR","DATA_DAYS_OFFSET","DATA_DAYS_LIMIT","updateUserPreferences","type","value","call","methodname","args","preferences","fail","exception","registerTimelineDaySelector","root","timelineViewRoot","timelineDaySelectorContainer","find","events","activate","on","e","data","filtername","currentTarget","option","target","closest","attr","daysOffset","daysLimit","elementsWithDaysOffset","removeAttr","reset","originalEvent","preventDefault","registerViewSelector","viewSelector","shown","removeClass","init"],"mappings":"AAuBAA,OAAM,2BACN,CACI,QADJ,CAEI,gCAFJ,CAGI,qBAHJ,CAII,WAJJ,CAKI,mBALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,8BADT,CAEZC,0BAA0B,CAAE,aAFhB,CAGZC,sBAAsB,CAAE,iCAHZ,CAIZC,gBAAgB,CAAE,oBAJN,CAKZC,eAAe,CAAE,mBALL,CAFlB,CAgBMC,CAAqB,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAsB,CAa9CV,CAAI,CAACW,IAAL,CAAU,CAZI,CACVC,UAAU,CAAE,mCADF,CAEVC,IAAI,CAAE,CACFC,WAAW,CAAE,CACT,CACIL,IAAI,CAAEA,CADV,CAEIC,KAAK,CAAEA,CAFX,CADS,CADX,CAFI,CAYJ,CAAV,EAAqB,CAArB,EACKK,IADL,CACUd,CAAY,CAACe,SADvB,CAEH,CA/BH,CAuCMC,CAA2B,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAiC,CAC/D,GAAIC,CAAAA,CAA4B,CAAGF,C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xD,GAAIsB,CAAAA,CAAY,CAAGvB,CAAI,CAACG,IAAL,CAAUnB,CAAS,CAACG,sBAApB,CAAnB,CAIAoC,CAAY,CAACjB,EAAb,CAAgB,oBAAhB,CAAsC,SAASC,CAAT,CAAY,CAC9C1B,CAAI,CAAC2C,KAAL,CAAWvB,CAAX,EACAtB,CAAC,CAAC4B,CAAC,CAACK,MAAH,CAAD,CAAYa,WAAZ,CAAwB,QAAxB,CACH,CAHD,EAOA7C,CAAY,CAACF,MAAb,CAAoB6C,CAApB,CAAkC,CAAC3C,CAAY,CAACwB,MAAb,CAAoBC,QAArB,CAAlC,EACAkB,CAAY,CAACjB,EAAb,CAAgB1B,CAAY,CAACwB,MAAb,CAAoBC,QAApC,CAA8C,qBAA9C,CAAqE,SAASE,CAAT,CAAY,IACzEE,CAAAA,CAAU,CAAG9B,CAAC,CAAC4B,CAAC,CAACG,aAAH,CAAD,CAAmBF,IAAnB,CAAwB,YAAxB,CAD4D,CAG7ElB,CAAqB,CADV,qCACU,CAAOmB,CAAP,CACxB,CAJD,CAKH,CA5GH,CA2HE,MAAO,CACHiB,IAAI,CAPG,QAAPA,CAAAA,IAAO,CAAS1B,CAAT,CAAeC,CAAf,CAAiC,CACxCD,CAAI,CAAGrB,CAAC,CAACqB,CAAD,CAAR,CACAD,CAA2B,CAACC,CAAD,CAAOC,CAAP,CAA3B,CACAqB,CAAoB,CAACtB,CAAD,CAAOC,CAAP,CACvB,CAEM,CAGV,CA5IK,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 * Manage the timeline view navigation for the timeline block.\n *\n * @package    block_timeline\n * @copyright  2018 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n    'jquery',\n    'core/custom_interaction_events',\n    'block_timeline/view',\n    'core/ajax',\n    'core/notification'\n],\nfunction(\n    $,\n    CustomEvents,\n    View,\n    Ajax,\n    Notification\n) {\n\n    var SELECTORS = {\n        TIMELINE_DAY_FILTER: '[data-region=\"day-filter\"]',\n        TIMELINE_DAY_FILTER_OPTION: '[data-from]',\n        TIMELINE_VIEW_SELECTOR: '[data-region=\"view-selector\"]',\n        DATA_DAYS_OFFSET: '[data-days-offset]',\n        DATA_DAYS_LIMIT: '[data-days-limit]',\n    };\n\n    /**\n     * Generic handler to persist user preferences\n     *\n     * @param {string} type The name of the attribute you're updating\n     * @param {string} value The value of the attribute you're updating\n     */\n    var updateUserPreferences = function(type, value) {\n        var request = {\n            methodname: 'core_user_update_user_preferences',\n            args: {\n                preferences: [\n                    {\n                        type: type,\n                        value: value\n                    }\n                ]\n            }\n        };\n\n        Ajax.call([request])[0]\n            .fail(Notification.exception);\n    };\n\n    /**\n     * Event listener for the day selector (\"Next 7 days\", \"Next 30 days\", etc).\n     *\n     * @param {object} root The root element for the timeline block\n     * @param {object} timelineViewRoot The root element for the timeline view\n     */\n    var registerTimelineDaySelector = function(root, timelineViewRoot) {\n        var timelineDaySelectorContainer = root.find(SELECTORS.TIMELINE_DAY_FILTER);\n\n        CustomEvents.define(timelineDaySelectorContainer, [CustomEvents.events.activate]);\n        timelineDaySelectorContainer.on(\n            CustomEvents.events.activate,\n            SELECTORS.TIMELINE_DAY_FILTER_OPTION,\n            function(e, data) {\n                // Update the user preference\n                var filtername = $(e.currentTarget).data('filtername');\n                var type = 'block_timeline_user_filter_preference';\n                updateUserPreferences(type, filtername);\n\n                var option = $(e.target).closest(SELECTORS.TIMELINE_DAY_FILTER_OPTION);\n\n                if (option.attr('aria-current') == 'true') {\n                    // If it's already active then we don't need to do anything.\n                    return;\n                }\n\n                var daysOffset = option.attr('data-from');\n                var daysLimit = option.attr('data-to');\n                var elementsWithDaysOffset = root.find(SELECTORS.DATA_DAYS_OFFSET);\n\n                elementsWithDaysOffset.attr('data-days-offset', daysOffset);\n\n                if (daysLimit != undefined) {\n                    elementsWithDaysOffset.attr('data-days-limit', daysLimit);\n                } else {\n                    elementsWithDaysOffset.removeAttr('data-days-limit');\n                }\n\n                // Reset the views to reinitialise the event lists now that we've\n                // updated the day limits.\n                View.reset(timelineViewRoot);\n\n                data.originalEvent.preventDefault();\n            }\n        );\n    };\n\n    /**\n     * Event listener for the \"sort\" button in the timeline navigation that allows for\n     * changing between the timeline dates and courses views.\n     *\n     * On a view change we tell the timeline view module that the view has been shown\n     * so that it can handle how to display the appropriate view.\n     *\n     * @param {object} root The root element for the timeline block\n     * @param {object} timelineViewRoot The root element for the timeline view\n     */\n    var registerViewSelector = function(root, timelineViewRoot) {\n        var viewSelector = root.find(SELECTORS.TIMELINE_VIEW_SELECTOR);\n\n        // Listen for when the user changes tab so that we can show the first set of courses\n        // and load their events when they request the sort by courses view for the first time.\n        viewSelector.on('shown shown.bs.tab', function(e) {\n            View.shown(timelineViewRoot);\n            $(e.target).removeClass('active');\n        });\n\n\n        // Event selector for user_sort\n        CustomEvents.define(viewSelector, [CustomEvents.events.activate]);\n        viewSelector.on(CustomEvents.events.activate, \"[data-toggle='tab']\", function(e) {\n            var filtername = $(e.currentTarget).data('filtername');\n            var type = 'block_timeline_user_sort_preference';\n            updateUserPreferences(type, filtername);\n        });\n    };\n\n    /**\n     * Initialise the timeline view navigation by adding event listeners to\n     * the navigation elements.\n     *\n     * @param {object} root The root element for the timeline block\n     * @param {object} timelineViewRoot The root element for the timeline view\n     */\n    var init = function(root, timelineViewRoot) {\n        root = $(root);\n        registerTimelineDaySelector(root, timelineViewRoot);\n        registerViewSelector(root, timelineViewRoot);\n    };\n\n    return {\n        init: init\n    };\n});\n"],"file":"view_nav.min.js"}