define ("tool_lifecycle/tablebulkactions",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=function(){vara=document.querySelectorAll("input[name=\"procerror-select\"]"),b=document.querySelectorAll("*[data-lifecycle-action]");b.forEach(function(b){b.onclick=function(c){c.preventDefault();vard=[{k:"action",v:b.getAttribute("data-lifecycle-action")},{k:"sesskey",v:M.cfg.sesskey}];if("1"===b.getAttribute("data-lifecycle-forall")){d.push({k:"all",v:"1"});e(window.location,d)}else{a.forEach(function(a){if(a.checked){d.push({k:"id[]",v:a.value})}});e(window.location,d)}}})};functionb(a){if("undefined"==typeofSymbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(a=c(a))){varb=0,d=function(){};return{s:d,n:functionn(){if(b>=a.length)return{done:!0};return{done:!1,value:a[b++]}},e:functione(a){throwa},f:d}}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}vare,f=!0,g=!1,h;return{s:functions(){e=a[Symbol.iterator]()},n:functionn(){vara=e.next();f=a.done;returna},e:functione(a){g=!0;h=a},f:functionf(){try{if(!f&&null!=e.return)e.return()}finally{if(g)throwh}}}}functionc(a,b){if(!a)return;if("string"==typeofa)returnd(a,b);varc=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)returnArray.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))returnd(a,b)}functiond(a,b){if(null==b||b>a.length)b=a.length;for(varc=0,d=Array(b);c<b;c++){d[c]=a[c]}returnd}functione(a,c){vard=document.createElement("form");document.body.appendChild(d);d.method="post";d.action=a;vare=b(c),f;try{for(e.s();!(f=e.n()).done;){varg=f.value,h=document.createElement("input");h.type="hidden";h.name=g.k;h.value=g.v;d.appendChild(h)}}catch(a){e.e(a)}finally{e.f()}d.submit()}});
define("tool_lifecycle/tablebulkactions",["exports"],(function(_exports){function_createForOfIteratorHelper(o,allowArrayLike){varit="undefined"!=typeofSymbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=function(o,minLen){if(!o)return;if("string"==typeofo)return_arrayLikeToArray(o,minLen);varn=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)returnArray.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return_arrayLikeToArray(o,minLen)}(o))||allowArrayLike&&o&&"number"==typeofo.length){it&&(o=it);vari=0,F=function(){};return{s:F,n:function(){returni>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function(_e){throw_e},f:F}}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}varerr,normalCompletion=!0,didErr=!1;return{s:function(){it=it.call(o)},n:function(){varstep=it.next();returnnormalCompletion=step.done,step},e:function(_e2){didErr=!0,err=_e2},f:function(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throwerr}}}}function_arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(vari=0,arr2=newArray(len);i<len;i++)arr2[i]=arr[i];returnarr2}
/**
* Javascript controller for checkboxed table.
* @module tool_lifecycle/tablebulkactions
* @copyright 2021 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
{"version":3,"sources":["../src/tablebulkactions.js"],"names":["checkboxes","document","querySelectorAll","action","forEach","a","onclick","e","preventDefault","data","k","v","getAttribute","M","cfg","sesskey","push","redirectPost","window","location","c","checked","value","url","form","createElement","body","appendChild","method","pair","input","type","name","submit"],"mappings":"uIA6CO,UAAgB,IACbA,CAAAA,CAAU,CAAGC,QAAQ,CAACC,gBAAT,CAA0B,kCAA1B,CADA,CAGbC,CAAM,CAAGF,QAAQ,CAACC,gBAAT,CAA0B,0BAA1B,CAHI,CAInBC,CAAM,CAACC,OAAP,CAAe,S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,CAErBK,CAAK,CAACC,IAAN,CAAa,QAAb,CACAD,CAAK,CAACE,IAAN,CAAaH,CAAI,CAACnB,CAAlB,CACAoB,CAAK,CAACR,KAAN,CAAcO,CAAI,CAAClB,CAAnB,CACAa,CAAI,CAACG,WAAL,CAAiBG,CAAjB,CACH,CAX4B,+BAY7BN,CAAI,CAACS,MAAL,EACH,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 <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript controller for checkboxed table.\n * @module tool_lifecycle/tablebulkactions\n * @copyright 2021 Justus Dieckmann WWU\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Helper function to redirect via POST\n * @param {String} url redirect to\n * @param {Array} data redirect with data\n */\nfunction redirectPost(url, data) {\n const form = document.createElement('form');\n document.body.appendChild(form);\n form.method = 'post';\n form.action = url;\n for (const pair of data) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = pair.k;\n input.value = pair.v;\n form.appendChild(input);\n }\n form.submit();\n}\n\n/**\n * Init function\n */\nexport function init() {\n const checkboxes = document.querySelectorAll('input[name=\"procerror-select\"]');\n\n const action = document.querySelectorAll('*[data-lifecycle-action]');\n action.forEach((a) => {\n a.onclick = (e) => {\n e.preventDefault();\n let data = [\n {k: 'action', v: a.getAttribute('data-lifecycle-action')},\n {k: 'sesskey', v: M.cfg.sesskey}\n ];\n if (a.getAttribute('data-lifecycle-forall') === '1') {\n data.push({k: 'all', v: '1'});\n redirectPost(window.location, data);\n } else {\n checkboxes.forEach((c) => {\n if (c.checked) {\n data.push({k: 'id[]', v: c.value});\n }\n });\n redirectPost(window.location, data);\n }\n };\n });\n}"],"file":"tablebulkactions.min.js"}
\ No newline at end of file
{"version":3,"file":"tablebulkactions.min.js","sources":["../src/tablebulkactions.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 * Javascript controller for checkboxed table.\n * @module tool_lifecycle/tablebulkactions\n * @copyright 2021 Justus Dieckmann WWU\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Helper function to redirect via POST\n * @param {String} url redirect to\n * @param {Array} data redirect with data\n */\nfunction redirectPost(url, data) {\n const form = document.createElement('form');\n document.body.appendChild(form);\n form.method = 'post';\n form.action = url;\n for (const pair of data) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = pair.k;\n input.value = pair.v;\n form.appendChild(input);\n }\n form.submit();\n}\n\n/**\n * Init function\n */\nexport function init() {\n const checkboxes = document.querySelectorAll('input[name=\"procerror-select\"]');\n\n const action = document.querySelectorAll('*[data-lifecycle-action]');\n action.forEach((a) => {\n a.onclick = (e) => {\n e.preventDefault();\n let data = [\n {k: 'action', v: a.getAttribute('data-lifecycle-action')},\n {k: 'sesskey', v: M.cfg.sesskey}\n ];\n if (a.getAttribute('data-lifecycle-forall') === '1') {\n data.push({k: 'all', v: '1'});\n redirectPost(window.location, data);\n } else {\n checkboxes.forEach((c) => {\n if (c.checked) {\n data.push({k: 'id[]', v: c.value});\n }\n });\n redirectPost(window.location, data);\n }\n };\n });\n}"],"names":["redirectPost","url","data","form","document","createElement","body","appendChild","method","action","pair","input","type","name","k","value","v","submit","checkboxes","querySelectorAll","forEach","a","onclick","e","preventDefault","getAttribute","M","cfg","sesskey","push","window","location","c","checked"],"mappings":";;;;;;cA2BSA,aAAaC,IAAKC,UACjBC,KAAOC,SAASC,cAAc,QACpCD,SAASE,KAAKC,YAAYJ,MAC1BA,KAAKK,OAAS,OACdL,KAAKM,OAASR,mDACKC,yDAAM,KAAdQ,iBACDC,MAAQP,SAASC,cAAc,SACrCM,MAAMC,KAAO,SACbD,MAAME,KAAOH,KAAKI,EAClBH,MAAMI,MAAQL,KAAKM,EACnBb,KAAKI,YAAYI,0DAErBR,KAAKc,8FAOCC,WAAad,SAASe,iBAAiB,kCAE9Bf,SAASe,iBAAiB,4BAClCC,SAAQ,SAACC,GACZA,EAAEC,QAAU,SAACC,GACTA,EAAEC,qBACEtB,KAAO,CACP,CAACY,EAAG,SAAUE,EAAGK,EAAEI,aAAa,0BAChC,CAACX,EAAG,UAAWE,EAAGU,EAAEC,IAAIC,UAEoB,MAA5CP,EAAEI,aAAa,0BACfvB,KAAK2B,KAAK,CAACf,EAAG,MAAOE,EAAG,MACxBhB,aAAa8B,OAAOC,SAAU7B,QAE9BgB,WAAWE,SAAQ,SAACY,GACZA,EAAEC,SACF/B,KAAK2B,KAAK,CAACf,EAAG,OAAQE,EAAGgB,EAAEjB,WAGnCf,aAAa8B,OAAOC,SAAU7B"}