diff --git a/admin/tool/componentlibrary/amd/build/jsrunner.min.js b/admin/tool/componentlibrary/amd/build/jsrunner.min.js index 3e6c1ede1be..727d94d0ff2 100644 --- a/admin/tool/componentlibrary/amd/build/jsrunner.min.js +++ b/admin/tool/componentlibrary/amd/build/jsrunner.min.js @@ -1,2 +1,2 @@ -define ("tool_componentlibrary/jsrunner",["exports","tool_componentlibrary/selectors"],function(_exports,_selectors){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.jsRunner=void 0;_selectors=_interopRequireDefault(_selectors);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var jsRunner=function(){var compLib=document.querySelector(_selectors.default.componentlibrary);compLib.querySelectorAll(_selectors.default.jscode).forEach(function(runjs){eval(runjs.innerHTML)})};_exports.jsRunner=jsRunner}); +define ("tool_componentlibrary/jsrunner",["exports","tool_componentlibrary/selectors"],function(_exports,_selectors){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.jsRunner=void 0;_selectors=_interopRequireDefault(_selectors);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var jsRunner=function(){var compLib=document.querySelector(_selectors.default.componentlibrary);compLib.querySelectorAll(_selectors.default.jscode).forEach(function(runjs){eval(runjs.innerText)})};_exports.jsRunner=jsRunner}); //# sourceMappingURL=jsrunner.min.js.map diff --git a/admin/tool/componentlibrary/amd/build/jsrunner.min.js.map b/admin/tool/componentlibrary/amd/build/jsrunner.min.js.map index 3137d7a70b9..fbad8f1fe76 100644 --- a/admin/tool/componentlibrary/amd/build/jsrunner.min.js.map +++ b/admin/tool/componentlibrary/amd/build/jsrunner.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/jsrunner.js"],"names":["jsRunner","compLib","document","querySelector","selectors","componentlibrary","querySelectorAll","jscode","forEach","runjs","eval","innerHTML"],"mappings":"mNAuBA,8C,wEAUO,GAAMA,CAAAA,QAAQ,CAAG,UAAM,CAC1B,GAAMC,CAAAA,OAAO,CAAGC,QAAQ,CAACC,aAAT,CAAuBC,mBAAUC,gBAAjC,CAAhB,CACAJ,OAAO,CAACK,gBAAR,CAAyBF,mBAAUG,MAAnC,EAA2CC,OAA3C,CAAmD,SAAAC,KAAK,CAAI,CACxDC,IAAI,CAACD,KAAK,CAACE,SAAP,CACP,CAFD,CAGH,CALM,C","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 * Run the JS required for example code to work in the library.\n *\n * @module tool_componentlibrary/jsrunner\n * @copyright 2021 Bas Brands \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or 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 eval(runjs.innerHTML); // eslint-disable-line no-eval\n });\n};\n"],"file":"jsrunner.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/jsrunner.js"],"names":["jsRunner","compLib","document","querySelector","selectors","componentlibrary","querySelectorAll","jscode","forEach","runjs","eval","innerText"],"mappings":"mNAuBA,8C,wEAUO,GAAMA,CAAAA,QAAQ,CAAG,UAAM,CAC1B,GAAMC,CAAAA,OAAO,CAAGC,QAAQ,CAACC,aAAT,CAAuBC,mBAAUC,gBAAjC,CAAhB,CACAJ,OAAO,CAACK,gBAAR,CAAyBF,mBAAUG,MAAnC,EAA2CC,OAA3C,CAAmD,SAAAC,KAAK,CAAI,CACxDC,IAAI,CAACD,KAAK,CAACE,SAAP,CACP,CAFD,CAGH,CALM,C","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 * Run the JS required for example code to work in the library.\n *\n * @module tool_componentlibrary/jsrunner\n * @copyright 2021 Bas Brands \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or 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 eval(runjs.innerText); // eslint-disable-line no-eval\n });\n};\n"],"file":"jsrunner.min.js"} \ No newline at end of file diff --git a/admin/tool/componentlibrary/amd/src/jsrunner.js b/admin/tool/componentlibrary/amd/src/jsrunner.js index ccef9f6a132..f36c7188414 100644 --- a/admin/tool/componentlibrary/amd/src/jsrunner.js +++ b/admin/tool/componentlibrary/amd/src/jsrunner.js @@ -34,6 +34,6 @@ import selectors from 'tool_componentlibrary/selectors'; export const jsRunner = () => { const compLib = document.querySelector(selectors.componentlibrary); compLib.querySelectorAll(selectors.jscode).forEach(runjs => { - eval(runjs.innerHTML); // eslint-disable-line no-eval + eval(runjs.innerText); // eslint-disable-line no-eval }); };