{"version":3,"file":"notice.min.js","sources":["https:\/\/udl.id\/theme\/remui\/amd\/src\/notice.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 .\n\n\/**\n * @module theme_remui\/notice\n * @copyright (c) 2023 WisdmLabs (https:\/\/wisdmlabs.com\/)\n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\n\"use strict\";\ndefine(['jquery'], function($) {\n var SELECTORS = {\n CONTAINER: '.edwiser-notice'\n };\n\n \/**\n * Show custom notice\n * @param {String} message Message to show in notice\n * @param {String} type Type of message [success|info|warning|danger]. Default success\n * @param {Number} time For how long notice will appear. Default 1500\n *\/\n var show = function(message, type, time) {\n \/\/ Reinitialize type and time if is not set.\n type = type || 'success';\n time = time || 1500;\n\n \/\/ Create notice alert.\n var notice = $('
<\/div>');\n $(SELECTORS.CONTAINER).show().append(notice);\n notice.text(message)\n .addClass('alert alert-' + type)\n .css({\n width: 'fit-content',\n 'margin-left': 'auto',\n 'margin-right': 'auto'\n })\n \/\/ Show notice alert.\n .fadeIn('slow');\n setTimeout(function() {\n notice.fadeOut('slow', function() {\n notice.remove();\n if ($(SELECTORS.CONTAINER).is(':empty')) {\n $(SELECTORS.CONTAINER).hide();\n }\n });\n }, time);\n };\n\n \/**\n * Show success notice\n * @param {String} message Message to show in notice\n * @param {Number} time For how long notice will appear. Default 1500\n *\/\n var success = function(message, time) {\n time = time || 1500;\n show(message, 'success', time);\n };\n\n \/**\n * Show info notice\n * @param {String} message Message to show in notice\n * @param {Number} time For how long notice will appear. Default 1500\n *\/\n var info = function(message, time) {\n time = time || 1500;\n show(message, 'info', time);\n };\n\n return {\n success: success,\n info: info\n };\n});\n"],"names":["define","$","SELECTORS","show","message","type","time","notice","append","text","addClass","css","width","fadeIn","setTimeout","fadeOut","remove","is","hide","success","info"],"mappings":";;;;;AAsBAA,4BAAO,CAAC,WAAW,SAASC,OACpBC,oBACW,kBASXC,KAAO,SAASC,QAASC,KAAMC,MAE\/BD,KAAOA,MAAQ,UACfC,KAAOA,MAAQ,SAGXC,OAASN,EAAE,eACfA,EAAEC,qBAAqBC,OAAOK,OAAOD,QACrCA,OAAOE,KAAKL,SACXM,SAAS,eAAiBL,MAC1BM,IAAI,CACDC,MAAO,4BACQ,sBACC,SAGnBC,OAAO,QACRC,YAAW,WACPP,OAAOQ,QAAQ,QAAQ,WACnBR,OAAOS,SACHf,EAAEC,qBAAqBe,GAAG,WAC1BhB,EAAEC,qBAAqBgB,YAGhCZ,aAuBA,CACHa,QAhBU,SAASf,QAASE,MAE5BH,KAAKC,QAAS,UADdE,KAAOA,MAAQ,OAgBfc,KAPO,SAAShB,QAASE,MAEzBH,KAAKC,QAAS,OADdE,KAAOA,MAAQ"}