Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/fragment.min.js.map |
{"version":3,"sources":["../src/fragment.js"],"names":["define","$","ajax","loadFragment","component","callback","contextid","params","formattedparams","index","push","name","value","call","methodname","args","promise","Deferred","then","data","jsNodes","javascript","allScript","each","scriptNode","tagName","prop","toLowerCase","attr","exists","s","encodeURI","text","resolve","html","fail","ex","reject"],"mappings":"AAyBAA,OAAM,iBAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAY9C,GAAIC,CAAAA,CAAY,CAAG,QAAfA,CAAAA,YAAe,CAASC,CAAT,CAAoBC,CAApB,CAA8BC,CAA9B,CAAyCC,CAAzC,CAAiD,CAEhE,GAAIC,CAAAA,CAAe,CAAG,EAAtB,CACA,IAAK,GAAIC,CAAAA,CAAT,GAAkBF,CAAAA,CAAlB,CAA0B,CACtBC,CAAe,CAACE,IAAhB,CAAqB,CACjBC,IAAI,CAAEF,CADW,CAEjBG,KAAK,CAAEL,CAAM,CAACE,CAAD,CAFI,CAArB,CAIH,CAED,MAAOP,CAAAA,CAAI,CAACW,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,mBADE,CAEdC,IAAI,CAAE,CACFX,SAAS,CAAEA,CADT,CAEFC,QAAQ,CAAEA,CAFR,CAGFC,SAAS,CAAEA,CAHT,CAIFS,IAAI,CAAEP,CAJJ,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,CAnBD,CAqBA,MAAyC,CAarCL,YAAY,CAAE,sBAASC,CAAT,CAAoBC,CAApB,CAA8BC,CAA9B,CAAyCC,CAAzC,CAAiD,CAC3D,GAAIS,CAAAA,CAAO,CAAGf,CAAC,CAACgB,QAAF,EAAd,CACAd,CAAY,CAACC,CAAD,CAAYC,CAAZ,CAAsBC,CAAtB,CAAiCC,CAAjC,CAAZ,CAAqDW,IAArD,CAA0D,SAASC,CAAT,CA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A,MAAOpB,CAAAA,CAAO,CAACA,OAAR,EACV,CAlDoC,CAoD5C,CArFK,CAAN","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 * A way to call HTML fragments to be inserted as required via JavaScript.\n *\n * @module core/fragment\n * @class fragment\n * @package core\n * @copyright 2016 Adrian Greeve <adrian@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 3.1\n */\ndefine(['jquery', 'core/ajax'], function($, ajax) {\n\n /**\n * Loads an HTML fragment through a callback.\n *\n * @method loadFragment\n * @param {string} component Component where callback is located.\n * @param {string} callback Callback function name.\n * @param {integer} contextid Context ID of the fragment.\n * @param {object} params Parameters for the callback.\n * @return {Promise} JQuery promise object resolved when the fragment has been loaded.\n */\n var loadFragment = function(component, callback, contextid, params) {\n // Change params into required webservice format.\n var formattedparams = [];\n for (var index in params) {\n formattedparams.push({\n name: index,\n value: params[index]\n });\n }\n\n return ajax.call([{\n methodname: 'core_get_fragment',\n args: {\n component: component,\n callback: callback,\n contextid: contextid,\n args: formattedparams\n }\n }])[0];\n };\n\n return /** @alias module:core/fragment */{\n /**\n * Appends HTML and JavaScript fragments to specified nodes.\n * Callbacks called by this AMD module are responsible for doing the appropriate security checks\n * to access the information that is returned. This only does minimal validation on the context.\n *\n * @method fragmentAppend\n * @param {string} component Component where callback is located.\n * @param {string} callback Callback function name.\n * @param {integer} contextid Context ID of the fragment.\n * @param {object} params Parameters for the callback.\n * @return {Deferred} new promise that is resolved with the html and js.\n */\n loadFragment: function(component, callback, contextid, params) {\n var promise = $.Deferred();\n loadFragment(component, callback, contextid, params).then(function(data) {\n var jsNodes = $(data.javascript);\n var allScript = '';\n jsNodes.each(function(index, scriptNode) {\n scriptNode = $(scriptNode);\n var tagName = scriptNode.prop('tagName');\n if (tagName && (tagName.toLowerCase() == 'script')) {\n if (scriptNode.attr('src')) {\n // We only reload the script if it was not loaded already.\n var exists = false;\n $('script').each(function(index, s) {\n if ($(s).attr('src') == scriptNode.attr('src')) {\n exists = true;\n }\n return !exists;\n });\n if (!exists) {\n allScript += ' { ';\n allScript += ' node = document.createElement(\"script\"); ';\n allScript += ' node.type = \"text/javascript\"; ';\n allScript += ' node.src = decodeURI(\"' + encodeURI(scriptNode.attr('src')) + '\"); ';\n allScript += ' document.getElementsByTagName(\"head\")[0].appendChild(node); ';\n allScript += ' } ';\n }\n } else {\n allScript += ' ' + scriptNode.text();\n }\n }\n });\n promise.resolve(data.html, allScript);\n return;\n }).fail(function(ex) {\n promise.reject(ex);\n });\n return promise.promise();\n }\n };\n});\n"],"file":"fragment.min.js"}