File: /var/www/html/demo.sumar.com.py/mod/pulse/amd/build/completion.min.js.map
{"version":3,"file":"completion.min.js","sources":["../src/completion.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 * Module javascript to place the placeholders.\n * Modified version of IOMAD Email template emailvars.\n *\n * @module mod_pulse/completion\n * @category Classes - autoloading\n * @copyright 2021, bdecent gmbh bdecent.de\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['core/fragment'], function(Fragment) {\n\n return {\n\n /**\n * Update completion buttons for each activity based on user role.\n * This will load the template using fragment.\n */\n updatecompletionbuttons: function() {\n var instances = document.getElementsByClassName('modtype_pulse');\n var modules = []; var moduleid;\n for (var i = 0; i < instances.length; i++) {\n var instance = instances[i];\n var id = instance.getAttribute('id');\n moduleid = parseInt(id.replace('module-', ''));\n modules.push(moduleid);\n }\n var params = {modules: JSON.stringify(modules)};\n if (modules.length > 0) {\n let completionbuttons = Fragment.loadFragment('mod_pulse', 'completionbuttons', 1, params);\n var approvebtn, element, referenceNode, completioncontent;\n completionbuttons.then((data) => {\n data = JSON.parse(data);\n for (var k in data) {\n approvebtn = data[k];\n element = document.getElementById('module-' + k);\n referenceNode = element.getElementsByClassName('contentwithoutlink')[0];\n completioncontent = document.createElement('div');\n completioncontent.innerHTML = approvebtn;\n completioncontent.classList.add('pulse-completion-btn');\n referenceNode.parentNode.insertBefore(completioncontent, referenceNode.nextSibling);\n }\n return true;\n }).fail();\n }\n },\n\n /**\n * If the page is course view page then call the completion buttons to insert.\n */\n init: function() {\n if (document.body.classList.contains('path-course-view')) {\n this.updatecompletionbuttons();\n }\n },\n\n };\n});\n"],"names":["define","Fragment","updatecompletionbuttons","moduleid","instances","document","getElementsByClassName","modules","i","length","id","getAttribute","parseInt","replace","push","params","JSON","stringify","approvebtn","element","referenceNode","completioncontent","loadFragment","then","data","k","parse","getElementById","createElement","innerHTML","classList","add","parentNode","insertBefore","nextSibling","fail","init","body","contains"],"mappings":";;;;;;;;;AAyBAA,8BAAO,CAAC,kBAAkB,SAASC,gBAExB,CAMHC,wBAAyB,mBAECC,SADlBC,UAAYC,SAASC,uBAAuB,iBAC5CC,QAAU,GACLC,EAAI,EAAGA,EAAIJ,UAAUK,OAAQD,IAAK,KAEnCE,GADWN,UAAUI,GACPG,aAAa,MAC/BR,SAAWS,SAASF,GAAGG,QAAQ,UAAW,KAC1CN,QAAQO,KAAKX,cAEbY,OAAS,CAACR,QAAUS,KAAKC,UAAUV,aACnCA,QAAQE,OAAS,EAAG,KAEhBS,WAAYC,QAASC,cAAeC,kBADhBpB,SAASqB,aAAa,YAAa,oBAAqB,EAAGP,QAEjEQ,MAAMC,WAEf,IAAIC,KADTD,KAAOR,KAAKU,MAAMF,MAEdN,WAAaM,KAAKC,GAClBN,QAAUd,SAASsB,eAAe,UAAYF,GAC9CL,cAAgBD,QAAQb,uBAAuB,sBAAsB,IACrEe,kBAAoBhB,SAASuB,cAAc,QACzBC,UAAYX,WAC9BG,kBAAkBS,UAAUC,IAAI,wBAChCX,cAAcY,WAAWC,aAAaZ,kBAAmBD,cAAcc,oBAEpE,KACRC,SAOXC,KAAM,WACE/B,SAASgC,KAAKP,UAAUQ,SAAS,0BAC5BpC"}