mirror of
https://github.com/moodle/moodle.git
synced 2025-02-28 05:54:55 +01:00
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.
1 line
11 KiB
Plaintext
1 line
11 KiB
Plaintext
{"version":3,"file":"participants.min.js","sources":["../src/participants.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 * Some UI stuff for participants page.\n * This is also used by the report/participants/index.php because it has the same functionality.\n *\n * @module core_user/participants\n * @copyright 2017 Damyon Wiese\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as DynamicTable from 'core_table/dynamic';\nimport * as Str from 'core/str';\nimport CheckboxToggleAll from 'core/checkbox-toggleall';\nimport CustomEvents from 'core/custom_interaction_events';\nimport DynamicTableSelectors from 'core_table/local/dynamic/selectors';\nimport ModalEvents from 'core/modal_events';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport jQuery from 'jquery';\nimport {showAddNote, showSendMessage} from 'core_user/local/participants/bulkactions';\nimport 'core/inplace_editable';\n\nconst Selectors = {\n bulkActionSelect: \"#formactionid\",\n bulkUserSelectedCheckBoxes: \"input[data-togglegroup='participants-table'][data-toggle='slave']:checked\",\n checkCountButton: \"#checkall\",\n showCountText: '[data-region=\"participant-count\"]',\n showCountToggle: '[data-action=\"showcount\"]',\n stateHelpIcon: '[data-region=\"state-help-icon\"]',\n tableForm: uniqueId => `form[data-table-unique-id=\"${uniqueId}\"]`,\n};\n\nexport const init = ({\n uniqueid,\n noteStateNames = {},\n}) => {\n const root = document.querySelector(Selectors.tableForm(uniqueid));\n const getTableFromUniqueId = uniqueId => root.querySelector(DynamicTableSelectors.main.fromRegionId(uniqueId));\n\n /**\n * Private method.\n *\n * @method registerEventListeners\n * @private\n */\n const registerEventListeners = () => {\n CustomEvents.define(Selectors.bulkActionSelect, [CustomEvents.events.accessibleChange]);\n jQuery(Selectors.bulkActionSelect).on(CustomEvents.events.accessibleChange, e => {\n const bulkActionSelect = e.target.closest('select');\n const action = bulkActionSelect.value;\n const tableRoot = getTableFromUniqueId(uniqueid);\n const checkboxes = tableRoot.querySelectorAll(Selectors.bulkUserSelectedCheckBoxes);\n const pendingPromise = new Pending('core_user/participants:bulkActionSelect');\n\n if (action.indexOf('#') !== -1) {\n e.preventDefault();\n\n const ids = [];\n checkboxes.forEach(checkbox => {\n ids.push(checkbox.getAttribute('name').replace('user', ''));\n });\n\n let bulkAction;\n if (action === '#messageselect') {\n bulkAction = showSendMessage(ids);\n } else if (action === '#addgroupnote') {\n bulkAction = showAddNote(\n root.dataset.courseId,\n ids,\n noteStateNames,\n root.querySelector(Selectors.stateHelpIcon)\n );\n }\n\n if (bulkAction) {\n const pendingBulkAction = new Pending('core_user/participants:bulkActionSelected');\n bulkAction\n .then(modal => {\n modal.getRoot().on(ModalEvents.hidden, () => {\n // Focus on the action select when the dialog is closed.\n bulkActionSelect.focus();\n });\n\n pendingBulkAction.resolve();\n return modal;\n })\n .catch(Notification.exception);\n }\n } else if (action !== '' && checkboxes.length) {\n bulkActionSelect.form.submit();\n }\n\n resetBulkAction(bulkActionSelect);\n pendingPromise.resolve();\n });\n\n root.addEventListener('click', e => {\n // Handle clicking of the \"Select all\" actions.\n const checkCountButton = root.querySelector(Selectors.checkCountButton);\n const checkCountButtonClicked = checkCountButton && checkCountButton.contains(e.target);\n\n if (checkCountButtonClicked) {\n e.preventDefault();\n\n const tableRoot = getTableFromUniqueId(uniqueid);\n\n DynamicTable.setPageSize(tableRoot, checkCountButton.dataset.targetPageSize)\n .then(tableRoot => {\n // Update the toggle state.\n CheckboxToggleAll.setGroupState(root, 'participants-table', true);\n\n return tableRoot;\n })\n .catch(Notification.exception);\n }\n });\n\n // When the content is refreshed, update the row counts in various places.\n root.addEventListener(DynamicTable.Events.tableContentRefreshed, e => {\n const checkCountButton = root.querySelector(Selectors.checkCountButton);\n\n const tableRoot = e.target;\n\n const defaultPageSize = parseInt(tableRoot.dataset.tableDefaultPerPage, 10);\n const currentPageSize = parseInt(tableRoot.dataset.tablePageSize, 10);\n const totalRowCount = parseInt(tableRoot.dataset.tableTotalRows, 10);\n\n CheckboxToggleAll.updateSlavesFromMasterState(root, 'participants-table');\n\n const pageCountStrings = [\n {\n key: 'countparticipantsfound',\n component: 'core_user',\n param: totalRowCount,\n },\n ];\n\n if (totalRowCount <= defaultPageSize) {\n if (checkCountButton) {\n checkCountButton.classList.add('hidden');\n }\n } else if (totalRowCount <= currentPageSize) {\n // The are fewer than the current page size.\n pageCountStrings.push({\n key: 'selectalluserswithcount',\n component: 'core',\n param: defaultPageSize,\n });\n\n if (checkCountButton) {\n // The 'Check all [x]' button is only visible when there are values to set.\n checkCountButton.classList.add('hidden');\n }\n } else {\n pageCountStrings.push({\n key: 'selectalluserswithcount',\n component: 'core',\n param: totalRowCount,\n });\n\n if (checkCountButton) {\n checkCountButton.classList.remove('hidden');\n }\n }\n\n Str.get_strings(pageCountStrings)\n .then(([showingParticipantCountString, selectCountString]) => {\n const showingParticipantCount = root.querySelector(Selectors.showCountText);\n showingParticipantCount.innerHTML = showingParticipantCountString;\n\n if (selectCountString && checkCountButton) {\n checkCountButton.value = selectCountString;\n }\n\n return;\n })\n .catch(Notification.exception);\n });\n };\n\n const resetBulkAction = bulkActionSelect => {\n bulkActionSelect.value = '';\n };\n\n registerEventListeners();\n};\n"],"names":["Selectors","uniqueId","_ref","uniqueid","noteStateNames","root","document","querySelector","getTableFromUniqueId","DynamicTableSelectors","main","fromRegionId","resetBulkAction","bulkActionSelect","value","define","CustomEvents","events","accessibleChange","on","e","target","closest","action","checkboxes","querySelectorAll","pendingPromise","Pending","indexOf","preventDefault","ids","bulkAction","forEach","checkbox","push","getAttribute","replace","dataset","courseId","pendingBulkAction","then","modal","getRoot","ModalEvents","hidden","focus","resolve","catch","Notification","exception","length","form","submit","addEventListener","checkCountButton","contains","tableRoot","DynamicTable","setPageSize","targetPageSize","setGroupState","Events","tableContentRefreshed","defaultPageSize","parseInt","tableDefaultPerPage","currentPageSize","tablePageSize","totalRowCount","tableTotalRows","updateSlavesFromMasterState","pageCountStrings","key","component","param","classList","add","remove","Str","get_strings","_ref2","showingParticipantCountString","selectCountString","innerHTML"],"mappings":";;;;;;;;giBAoCMA,2BACgB,gBADhBA,qCAE0B,4EAF1BA,2BAGgB,YAHhBA,wBAIa,oCAJbA,wBAMa,kCANbA,oBAOSC,+CAA0CA,6BAGrCC,WAACC,SACjBA,SADiBC,eAEjBA,eAAiB,eAEXC,KAAOC,SAASC,cAAcP,oBAAoBG,WAClDK,qBAAuBP,UAAYI,KAAKE,cAAcE,mBAAsBC,KAAKC,aAAaV,WA+I9FW,gBAAkBC,mBACpBA,iBAAiBC,MAAQ,uCAvIZC,OAAOf,2BAA4B,CAACgB,mCAAaC,OAAOC,uCAC9DlB,4BAA4BmB,GAAGH,mCAAaC,OAAOC,kBAAkBE,UAClEP,iBAAmBO,EAAEC,OAAOC,QAAQ,UACpCC,OAASV,iBAAiBC,MAE1BU,WADYhB,qBAAqBL,UACVsB,iBAAiBzB,sCACxC0B,eAA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