AutorÃa | Ultima modificación | Ver Log |
{"version":3,"file":"jsrunner.min.js","sources":["../src/jsrunner.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 * Run the JS required for example code to work in the library.\n *\n * @module tool_componentlibrary/jsrunner\n * @copyright 2021 Bas Brands <bas@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 o
r later\n */\n\nimport selectors from 'tool_componentlibrary/selectors';\n\n/**\n * The Hugo shortcodes changes the JavaScript in markdownfiles from\n * the Moodle mustache {{js}} code... {{/js}} syntax into a div with\n * attribute data-action='runjs'. See hugo/site/layouts/shortcodes/example.html.\n * This code fetches and runs the JavaScript content.\n *\n * @method\n */\nexport const jsRunner = () => {\n const compLib = document.querySelector(selectors.componentlibrary);\n compLib.querySelectorAll(selectors.jscode).forEach(runjs => {\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.innerHTML = runjs.textContent;\n document.head.appendChild(script);\n });\n};\n"],"names":["document","querySelector","selectors","componentlibrary","querySelectorAll","jscode","forEach","runjs","script","createElement","type","innerHTML","textContent","head","appendChild"],"mappings":";;;;;;;sKAiCwB,KACJA,SAASC,cAAcC,mBAAUC,kBACzCC,iBAAiBF,mBAA
UG,QAAQC,SAAQC,cACzCC,OAASR,SAASS,cAAc,UACtCD,OAAOE,KAAO,kBACdF,OAAOG,UAAYJ,MAAMK,YACzBZ,SAASa,KAAKC,YAAYN"}