{"version":3,"file":"script.min.js","sources":["https:\/\/moodle.a2u.fr\/local\/accessibility\/widgets\/fontface\/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 face widget JS\n *\n * @module accessibility\/fontface\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 { saveWidgetConfig } from 'local_accessibility\/common';\n\n\/**\n * Initialisation\n *\/\nexport const init = () => {\n $(() => {\n const $body = $('body');\n const $container = $('#accessibility_fontface-container');\n if (!$container.length) {\n return;\n }\n\n const $classbuttons = $container.find('.accessibility_fontface-classbtn');\n const classes = [...$classbuttons].map(x => $(x).attr('data-value')).filter(x => x).map(x => 'accessibility-fontface-' + x);\n if (!classes.length) {\n return;\n }\n\n $classbuttons.on('click', async(e) => {\n const fontfacename = $(e.target).attr('data-value');\n const classname = 'accessibility-fontface-' + fontfacename;\n $body.removeClass(classes);\n $body.addClass(classname);\n await saveWidgetConfig('fontface', fontfacename);\n });\n\n const $resetbutton = $container.find('.accessibility_fontface-resetbtn');\n if ($resetbutton.length) {\n $resetbutton.on('click', async() => {\n $body.removeClass(classes);\n await saveWidgetConfig('fontface', null);\n });\n }\n });\n};\n"],"names":["$body","$container","length","$classbuttons","find","classes","map","x","attr","filter","on","async","fontfacename","e","target","classname","removeClass","addClass","$resetbutton"],"mappings":";;;;;;;wJA6BoB,0BACd,WACQA,OAAQ,mBAAE,QACVC,YAAa,mBAAE,yCAChBA,WAAWC,oBAIVC,cAAgBF,WAAWG,KAAK,oCAChCC,QAAU,IAAIF,eAAeG,KAAIC,IAAK,mBAAEA,GAAGC,KAAK,gBAAeC,QAAOF,GAAKA,IAAGD,KAAIC,GAAK,0BAA4BA,QACpHF,QAAQH,cAIbC,cAAcO,GAAG,SAASC,MAAAA,UAChBC,cAAe,mBAAEC,EAAEC,QAAQN,KAAK,cAChCO,UAAY,0BAA4BH,aAC9CZ,MAAMgB,YAAYX,SAClBL,MAAMiB,SAASF,iBACT,4BAAiB,WAAYH,uBAGjCM,aAAejB,WAAWG,KAAK,oCACjCc,aAAahB,QACbgB,aAAaR,GAAG,SAASC,UACrBX,MAAMgB,YAAYX,eACZ,4BAAiB,WAAY"}