1
0
mirror of https://github.com/moodle/moodle.git synced 2025-03-31 05:52:51 +02:00
moodle/lib/amd/build/fragment.min.js.map
Andrew Nicols e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00

1 line
6.5 KiB
Plaintext

{"version":3,"file":"fragment.min.js","sources":["../src/fragment.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 * A way to call HTML fragments to be inserted as required via JavaScript.\n *\n * @module core/fragment\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 /**\n * Converts the JS that was received from collecting JS requirements on the $PAGE so it can be added to the existing page\n *\n * @param {string} js\n * @return {string}\n */\n var processCollectedJavascript = function(js) {\n var jsNodes = $(js);\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 return allScript;\n };\n\n return {\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 promise.resolve(data.html, processCollectedJavascript(data.javascript));\n }).fail(function(ex) {\n promise.reject(ex);\n });\n return promise.promise();\n },\n\n /**\n * Converts the JS that was received from collecting JS requirements on the $PAGE so it can be added to the existing page\n *\n * @param {string} js\n * @return {string}\n */\n processCollectedJavascript: function(js) {\n return processCollectedJavascript(js);\n }\n };\n});\n"],"names":["define","$","ajax","processCollectedJavascript","js","jsNodes","allScript","each","index","scriptNode","tagName","prop","toLowerCase","attr","exists","s","encodeURI","text","loadFragment","component","callback","contextid","params","promise","Deferred","formattedparams","push","name","value","call","methodname","args","then","data","resolve","html","javascript","fail","ex","reject"],"mappings":";;;;;;;;AAuBAA,uBAAO,CAAC,SAAU,cAAc,SAASC,EAAGC,UAuCpCC,2BAA6B,SAASC,QAClCC,QAAUJ,EAAEG,IACZE,UAAY,UAChBD,QAAQE,MAAK,SAASC,MAAOC,gBAErBC,SADJD,WAAaR,EAAEQ,aACUE,KAAK,cAC1BD,SAAqC,UAAzBA,QAAQE,iBAChBH,WAAWI,KAAK,OAAQ,KAEpBC,QAAS,EACbb,EAAE,UAAUM,MAAK,SAASC,MAAOO,UACzBd,EAAEc,GAAGF,KAAK,QAAUJ,WAAWI,KAAK,SACpCC,QAAS,IAELA,UAEPA,SACDR,WAAa,MACbA,WAAa,6CACbA,WAAa,mCACbA,WAAa,0BAA4BU,UAAUP,WAAWI,KAAK,QAAU,OAC7EP,WAAa,gEACbA,WAAa,YAGjBA,WAAa,IAAMG,WAAWQ,UAInCX,iBAGJ,CAaHY,aAAc,SAASC,UAAWC,SAAUC,UAAWC,YAC/CC,QAAUtB,EAAEuB,kBAzEL,SAASL,UAAWC,SAAUC,UAAWC,YAEpDG,gBAAkB,OACjB,IAAIjB,SAASc,OACdG,gBAAgBC,KAAK,CACjBC,KAAMnB,MACNoB,MAAON,OAAOd,gBAIfN,KAAK2B,KAAK,CAAC,CACdC,WAAY,oBACZC,KAAM,CACFZ,UAAWA,UACXC,SAAUA,SACVC,UAAWA,UACXU,KAAMN,oBAEV,GAwDAP,CAAaC,UAAWC,SAAUC,UAAWC,QAAQU,MAAK,SAASC,MAC/DV,QAAQW,QAAQD,KAAKE,KAAMhC,2BAA2B8B,KAAKG,gBAC5DC,MAAK,SAASC,IACbf,QAAQgB,OAAOD,OAEZf,QAAQA,WASnBpB,2BAA4B,SAASC,WAC1BD,2BAA2BC"}