Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{"version":3,"file":"defaultcustom.min.js","sources":["../src/defaultcustom.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 * Functionality for the form element defaultcustom\n *\n * @module     core_form/defaultcustom\n * @copyright  2017 Marina Glancy\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since      3.3\n */\ndefine(['jquery'], function($) {\n    var onChangeSelect = function(event) {\n        var element = $(event.target),\n            defaultvalue = JSON.parse(element.attr('data-defaultvalue')),\n            customvalue = JSON.parse(element.attr('data-customvalue')),\n            type = element.attr('data-type'),\n            form = element.closest('form'),\n            elementName = element.attr('name').replace(/\\[customize\\]$/, '[value]'),\n            newvalue = element.prop('checked') ? customvalue : defaultvalue;\n\n        if (type === 'text') {\n            form.find('[name=\"' + elementName + '\"]').val(newvalue);\n        } else if (type === 'date_selector') {\n            form.find('[name=\"' + elementName + '[day]\"]').val(newvalue.day);\n            form.find('[name=\"' + elementName + '[month]\"]').val(newvalue.month);\n            form.find('[name=\"' + elementName + '[year]\"]').val(newvalue.year);\n        } else if (type === 'date_time_selector') {\n            form.find('[name=\"' + elementName + '[day]\"]').val(newvalue.day);\n            form.find('[name=\"' + elementName + '[month]\"]').val(newvalue.month);\n            form.find('[name=\"' + elementName + '[year]\"]').val(newvalue.year);\n            form.find('[name=\"' + elementName + '[hour]\"]').val(newvalue.hour);\n            form.find('[name=\"' + elementName + '[minute]\"]').val(newvalue.minute);\n        }\n    };\n\n    var selector = 'input[data-defaultcustom=true]';\n    $('body').on('change', selector, onChangeSelect);\n});\n"],"names":["define","$","on","event","element","target","defaultvalue","JSON","parse","attr","customvalue","type","form","closest","elementName","replace","newvalue","prop","find","val","day","month","year","hour","minute"],"mappings":";;;;;;;;AAuBAA,iCAAO,CAAC,WAAW,SAASC,GA0BxBA,EAAE,QAAQC,GAAG,SADE,kCAxBM,SAASC,WACtBC,QAAUH,EAAEE,MAAME,QAClBC,aAAeC,KAAKC,MAAMJ,QAAQK,KAAK,sBACvCC,YAAcH,KAAKC,MAAMJ,QAAQK,KAAK,qBACtCE,KAAOP,QAAQK,KAAK,aACpBG,KAAOR,QAAQS,QAAQ,QACvBC,YAAcV,QAAQK,KAAK,QAAQM,QAAQ,iBAAkB,WAC7DC,SAAWZ,QAAQa,KAAK,WAAaP,YAAcJ,aAE1C,SAATK,KACAC,KAAKM,KAAK,UAAYJ,YAAc,MAAMK,IAAIH,UAC9B,kBAATL,MACPC,KAAKM,KAAK,UAAYJ,YAAc,WAAWK,IAAIH,SAASI,KAC5DR,KAAKM,KAAK,UAAYJ,YAAc,aAAaK,IAAIH,SAASK,OAC9DT,KAAKM,KAAK,UAAYJ,YAAc,YAAYK,IAAIH,SAASM,OAC7C,uBAATX,OACPC,KAAKM,KAAK,UAAYJ,YAAc,WAAWK,IAAIH,SAASI,KAC5DR,KAAKM,KAAK,UAAYJ,YAAc,aAAaK,IAAIH,SAASK,OAC9DT,KAAKM,KAAK,UAAYJ,YAAc,YAAYK,IAAIH,SAASM,MAC7DV,KAAKM,KAAK,UAAYJ,YAAc,YAAYK,IAAIH,SAASO,MAC7DX,KAAKM,KAAK,UAAYJ,YAAc,cAAcK,IAAIH,SAASQ"}