{"version":3,"file":"script.min.js","sources":["https:\/\/www.virtual.facen.una.py\/gradofacen\/local\/accessibility\/widgets\/fontsize\/amd\/src\/script.js"],"sourcesContent":["\/\/ This file is part of Moodle - https:\/\/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 .\n\n\/**\n * Font size widget JS\n *\n * @module accessibility\/fontsize\n * @copyright 2023 Ponlawat Weerapanpisit \n * @license https:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport $ from 'jquery';\nimport { initrangewidget } from 'local_accessibility\/rangewidget';\nimport { saveWidgetConfig } from 'local_accessibility\/common';\n\n\/**\n * Initialisation\n * @param {number|undefined|null} userdefault\n *\/\nexport const init = (userdefault = undefined) => {\n const classnames = [\n 'accessibility-fontsize-50',\n 'accessibility-fontsize-75',\n 'accessibility-fontsize-125',\n 'accessibility-fontsize-150',\n 'accessibility-fontsize-175',\n 'accessibility-fontsize-200'\n ];\n\n $(() => {\n const $body = $('body');\n\n initrangewidget('accessibility_fontsize', async(size) => {\n $body.removeClass(classnames);\n if (parseFloat(size) === 1.0) {\n await saveWidgetConfig('fontsize', null);\n return;\n }\n const classname = 'accessibility-fontsize-' + Math.round(parseFloat(size) * 100).toString();\n if (classnames.indexOf(classname) < 0) {\n return;\n }\n $body.addClass(classname);\n await saveWidgetConfig('fontsize', size);\n }, userdefault);\n });\n};\n"],"names":["e","_jquery","__esModule","default","_exports","init","userdefault","arguments","length","undefined","classnames","$","$body","initrangewidget","async","removeClass","parseFloat","size","saveWidgetConfig","classname","Math","round","toString","indexOf","addClass"],"mappings":"4KAuBuB,IAAAA;;;;;;;kFAAvBC,SAAuBD,EAAvBC,UAAuBD,EAAAE,WAAAF,EAAAG,CAAAA,QAAAH,GAmCrBI,SAAAC,KA3BkB,WAA6B,IAA5BC,YAAWC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,QAAGE,EAC\/B,MAAMC,WAAa,CACf,4BACA,4BACA,6BACA,6BACA,6BACA,+BAGJ,EAAAC,QAAAA,UAAE,KACE,MAAMC,OAAQ,EAAAD,QAACR,SAAC,SAEhB,EAAAU,8BAAgB,0BAA0BC,aAEtC,GADAF,MAAMG,YAAYL,YACO,IAArBM,WAAWC,MAEX,kBADM,EAAAC,QAAgBA,kBAAC,WAAY,MAGvC,MAAMC,UAAY,0BAA4BC,KAAKC,MAAyB,IAAnBL,WAAWC,OAAaK,WAC7EZ,WAAWa,QAAQJ,WAAa,IAGpCP,MAAMY,SAASL,iBACT,EAAAD,QAAgBA,kBAAC,WAAYD,MAAK,GACzCX,YAAY,IAErB"}