{"version":3,"file":"main.min.js","sources":["https:\/\/udearroba.udea.edu.co\/externos\/course\/format\/onetopic\/amd\/src\/main.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 .\n\n\/*\n * @package format_onetopic\n * @copyright 2021 David Herney Bernal - cirano\n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\nimport * as OneLine from 'format_onetopic\/oneline';\nimport $ from 'jquery';\nimport ModalFactory from 'core\/modal_factory';\nimport {get_string as getString} from 'core\/str';\n\n\/**\n * Component initialization.\n *\n * @method init\n * @param {string} formattype The course format type: 0: default, 1: vertical, 2: oneline.\n * @param {object} icons A list of usable icons: left arrow, right arrow.\n *\/\nexport const init = (formattype, icons) => {\n\n if (formattype == 2) {\n OneLine.load(icons);\n }\n\n var infotitle = getString('aboutresource', 'format_onetopic');\n\n $('.format-onetopic .onetopic .iconwithhelp').each(function() {\n var $node = $(this);\n $node.on('click', function(e) {\n e.preventDefault();\n var $content = $node.find('.iconwithhelp-content');\n\n if ($content.data('modal')) {\n $content.data('modal').show();\n return;\n }\n\n var title = $content.data('title');\n\n if (!title) {\n title = infotitle;\n }\n\n \/\/ Show the content in a modal window.\n ModalFactory.create({\n 'title': title,\n 'body': ''\n }).done(function(modal) {\n\n var contenthtml = $content.html();\n\n \/\/ Uncomment html in contenthtml. The comment is used in order to load content with tags not inline.\n contenthtml = contenthtml.replace(\/\/g, function(match, p1) {\n return p1;\n });\n\n var $modalBody = modal.getBody();\n $modalBody.append(contenthtml);\n modal.show();\n $content.data('modal', modal);\n });\n });\n });\n\n};"],"names":["formattype","icons","OneLine","load","infotitle","each","$node","this","on","e","preventDefault","$content","find","data","show","title","create","done","modal","contenthtml","html","replace","match","p1","getBody","append"],"mappings":";;;;;2HAgCoB,CAACA,WAAYC,SAEX,GAAdD,YACAE,QAAQC,KAAKF,WAGbG,WAAY,mBAAU,gBAAiB,uCAEzC,4CAA4CC,MAAK,eAC3CC,OAAQ,mBAAEC,MACdD,MAAME,GAAG,SAAS,SAASC,GACvBA,EAAEC,qBACEC,SAAWL,MAAMM,KAAK,4BAEtBD,SAASE,KAAK,SACdF,SAASE,KAAK,SAASC,gBAIvBC,MAAQJ,SAASE,KAAK,SAErBE,QACDA,MAAQX,kCAICY,OAAO,OACPD,WACD,KACTE,MAAK,SAASC,WAETC,YAAcR,SAASS,OAG3BD,YAAcA,YAAYE,QAAQ,sBAAsB,SAASC,MAAOC,WAC7DA,MAGML,MAAMM,UACZC,OAAON,aAClBD,MAAMJ,OACNH,SAASE,KAAK,QAASK"}