Sindbad~EG File Manager
{"version":3,"file":"course_conditionals-lazy.min.js","sources":["../src/course_conditionals-lazy.js"],"sourcesContent":["/**\n * 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 * @package\n * @copyright Copyright (c) 2016 Open LMS (https://www.openlms.net)\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Course conditionals function.\n */\ndefine(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'theme_snap/ajax_notification'],\n function($, ajax, notification, templates, ajaxNotify) {\n\n // Main function.\n var init = function(courseConfig) {\n var currentlyUnavailableSections = courseConfig.unavailablesections.map(Number),\n currentlyUnavailableMods = courseConfig.unavailablemods.map(Number);\n\n $(document).on(\"snapModuleCompletionChange\",\n function() {\n ajax.call([\n {\n methodname: 'theme_snap_course_completion',\n args: {\n courseshortname: courseConfig.shortname,\n unavailablesections: currentlyUnavailableSections.join(','),\n unavailablemods: currentlyUnavailableMods.join(',')\n },\n done: function(response) {\n /**\n * Update elements with newly available / unavailable html.\n * Elements can either be sections or modules.\n *\n * @param {object} changedHTML - response json\n * @param {string} typeKey - string (either 'section' or 'module')\n */\n var updateModOrSectionHTML = function(changedHTML, typeKey) {\n if (!Object.keys(changedHTML).length) {\n // There are no newly available elements which require updating.\n return;\n }\n for (var i in changedHTML) {\n var item = changedHTML[i];\n var id = item.id ? item.id : item.number;\n var html = item.html;\n var baseSelector = '#' + typeKey + '-' + id;\n $(baseSelector).replaceWith(html);\n }\n };\n\n // Update newly available sections with released html.\n updateModOrSectionHTML(response.changedsectionhtml, 'section');\n\n // Update newly available modules with released html.\n updateModOrSectionHTML(response.changedmodhtml, 'module');\n\n // Update TOC.\n templates.render('theme_snap/course_toc', response.toc)\n .done(function(result) {\n $('#course-toc').html($(result).html());\n $(document).trigger('snapTOCReplaced');\n });\n\n // Update current state.\n currentlyUnavailableSections = response.unavailablesections.split(',').map(Number);\n currentlyUnavailableMods = response.unavailablemods.split(',').map(Number);\n\n },\n fail: function(response) {\n ajaxNotify.ifErrorShowBestMsg(response);\n }\n }\n ], true, true);\n }\n );\n };\n return init;\n }\n);\n"],"names":["define","$","ajax","notification","templates","ajaxNotify","courseConfig","currentlyUnavailableSections","unavailablesections","map","Number","currentlyUnavailableMods","unavailablemods","document","on","call","methodname","args","courseshortname","shortname","join","done","response","updateModOrSectionHTML","changedHTML","typeKey","Object","keys","length","i","item","id","number","html","replaceWith","changedsectionhtml","changedmodhtml","render","toc","result","trigger","split","fail","ifErrorShowBestMsg"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBAA,6CAAO,CAAC,SAAU,YAAa,oBAAqB,iBAAkB,iCAClE,SAASC,EAAGC,KAAMC,aAAcC,UAAWC,mBAG5B,SAASC,kBACZC,6BAA+BD,aAAaE,oBAAoBC,IAAIC,QACxEC,yBAA2BL,aAAaM,gBAAgBH,IAAIC,QAE5DT,EAAEY,UAAUC,GAAG,8BACX,WACIZ,KAAKa,KAAK,CACN,CACIC,WAAY,+BACZC,KAAM,CACFC,gBAAiBZ,aAAaa,UAC9BX,oBAAqBD,6BAA6Ba,KAAK,KACvDR,gBAAiBD,yBAAyBS,KAAK,MAEnDC,KAAM,SAASC,cAQPC,uBAAyB,SAASC,YAAaC,YAC1CC,OAAOC,KAAKH,aAAaI,WAIzB,IAAIC,KAAKL,YAAa,KACnBM,KAAON,YAAYK,GACnBE,GAAKD,KAAKC,GAAKD,KAAKC,GAAKD,KAAKE,OAC9BC,KAAOH,KAAKG,KAEhBhC,EADmB,IAAMwB,QAAU,IAAMM,IACzBG,YAAYD,QAKpCV,uBAAuBD,SAASa,mBAAoB,WAGpDZ,uBAAuBD,SAASc,eAAgB,UAGhDhC,UAAUiC,OAAO,wBAAyBf,SAASgB,KAC9CjB,MAAK,SAASkB,QACXtC,EAAE,eAAegC,KAAKhC,EAAEsC,QAAQN,QAChChC,EAAEY,UAAU2B,QAAQ,sBAI5BjC,6BAA+Be,SAASd,oBAAoBiC,MAAM,KAAKhC,IAAIC,QAC3EC,yBAA2BW,SAASV,gBAAgB6B,MAAM,KAAKhC,IAAIC,SAGvEgC,KAAM,SAASpB,UACXjB,WAAWsC,mBAAmBrB,cAGvC,GAAM"}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists