Current Path : /var/www/ljmtc/cbt/grade/amd/build/grades/grader/gradingpanel/ |
Current File : /var/www/ljmtc/cbt/grade/amd/build/grades/grader/gradingpanel/comparison.min.js.map |
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/comparison.js"],"names":["fillInitialValues","form","Array","prototype","forEach","call","elements","input","type","dataset","initialValue","JSON","stringify","checked","value","options","option","selected","compareData","result","some"],"mappings":"2LAwBO,GAAMA,CAAAA,CAAiB,CAAG,SAACC,CAAD,CAAU,CACvCC,KAAK,CAACC,SAAN,CAAgBC,OAAhB,CAAwBC,IAAxB,CAA6BJ,CAAI,CAACK,QAAlC,CAA4C,SAACC,CAAD,CAAW,CACnD,GAAmB,QAAf,GAAAA,CAAK,CAACC,IAAN,EAA0C,QAAf,GAAAD,CAAK,CAACC,IAArC,CAAwD,CAEvD,CAFD,IAEO,IAAmB,OAAf,GAAAD,CAAK,CAACC,IAAN,EAAyC,UAAf,GAAAD,CAAK,CAACC,IAApC,CAAyD,CAC5DD,CAAK,CAACE,OAAN,CAAcC,YAAd,CAA6BC,IAAI,CAACC,SAAL,CAAeL,CAAK,CAACM,OAArB,CAChC,CAFM,IAEA,IAA2B,WAAvB,QAAON,CAAAA,CAAK,CAACO,KAAjB,CAAwC,CAC3CP,CAAK,CAACE,OAAN,CAAcC,YAAd,CAA6BC,IAAI,CAACC,SAAL,CAAeL,CAAK,CAACO,KAArB,CAChC,CAFM,IAEA,IAAmB,YAAf,GAAAP,CAAK,CAACC,IAAV,CAAiC,CACpCN,KAAK,CAACC,SAAN,CAAgBC,OAAhB,CAAwBC,IAAxB,CAA6BE,CAAK,CAACQ,OAAnC,CAA4C,SAACC,CAAD,CAAY,CACpDA,CAAM,CAACP,OAAP,CAAeC,YAAf,CAA8BC,IAAI,CAACC,SAAL,CAAeI,CAAM,CAACC,QAAtB,CACjC,CAFD,CAGH,CACL,CAZA,CAaH,CAdM,C,oCAyBoB,QAAdC,CAAAA,WAAc,CAACjB,CAAD,CAAU,CACjC,G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,MAAOkB,CAAAA,CACV,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 * Compare a given form's values and its previously set data attributes.\n *\n * @module core_grades/grades/grader/gradingpanel/comparison\n * @package core_grades\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nexport const fillInitialValues = (form) => {\n Array.prototype.forEach.call(form.elements, (input) => {\n if (input.type === 'submit' || input.type === 'button') {\n return;\n } else if (input.type === 'radio' || input.type === 'checkbox') {\n input.dataset.initialValue = JSON.stringify(input.checked);\n } else if (typeof input.value !== 'undefined') {\n input.dataset.initialValue = JSON.stringify(input.value);\n } else if (input.type === 'select-one') {\n Array.prototype.forEach.call(input.options, (option) => {\n option.dataset.initialValue = JSON.stringify(option.selected);\n });\n }\n });\n};\n\n\n/**\n * Compare the form data with the initial form data from when the form was set up.\n *\n * If values have changed, return a truthy value.\n *\n * @param {HTMLElement} form\n * @return {Boolean}\n */\nexport const compareData = (form) => {\n const result = Array.prototype.some.call(form.elements, (input) => {\n if (input.type === 'submit' || input.type === 'button') {\n return false;\n } else if (input.type === 'radio' || input.type === 'checkbox') {\n if (typeof input.dataset.initialValue !== 'undefined') {\n return input.dataset.initialValue !== JSON.stringify(input.checked);\n }\n } else if (typeof input.value !== 'undefined') {\n if (typeof input.dataset.initialValue !== 'undefined') {\n return input.dataset.initialValue !== JSON.stringify(input.value);\n }\n } else if (input.type === 'select-one') {\n return Array.prototype.some.call(input.options, (option) => {\n if (typeof option.dataset.initialValue !== 'undefined') {\n return option.dataset.initialValue !== JSON.stringify(option.selected);\n }\n\n return false;\n });\n }\n\n // No value found to check. Assume that there were changes.\n return true;\n });\n\n // Fill the initial values again as the form may not be reloaded.\n fillInitialValues(form);\n\n return result;\n};\n"],"file":"comparison.min.js"}