Sindbad~EG File Manager
{"version":3,"file":"dndupload-lazy.min.js","sources":["../src/dndupload-lazy.js"],"sourcesContent":["/**\n * 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 * @package\n * @author David Castro <david.castro@openlms.net>\n * @copyright Copyright (c) 2017 Open LMS\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module theme_snap/dndupload-lazy\n */\ndefine(['jquery', 'core/yui', 'theme_snap/util'],\n function($, YUI, util) {\n var self = this;\n\n self.dndupload = null;\n\n /**\n * Initialising function.\n * @param {array} options The course dnd options\n */\n self.init = function(options) {\n util.whenTrue(\n function() {\n return typeof (M.course_dndupload) !== 'undefined';\n },\n function() {\n self.dndupload = M.course_dndupload;\n // Adding YUI 3 requirements here.\n YUI.use('node', 'event', 'json', 'anim', 'moodle-core-notification-alert', function(Y) {\n self.decorateCourseDNDUpload(Y, options);\n });\n\n }, true);\n };\n\n /**\n * Decorates the file handlers of course drag and drop widget.\n * @param {object} Y\n * @param {object} options\n */\n self.decorateCourseDNDUpload = function(Y, options) {\n // Add the statically added file handlers.\n /* global themeSnapCourseFileHandlers */\n if (typeof(themeSnapCourseFileHandlers) != \"undefined\" && themeSnapCourseFileHandlers) {\n options.handlers = themeSnapCourseFileHandlers;\n } else {\n options.handlers = {};\n }\n\n // Rebuild file handlers without annoying label handler.\n var extensions = ['gif', 'jpe', 'jpg', 'jpeg', 'png', 'svg', 'svgz', 'webp', 'mp3'];\n var newfilehandlers = [];\n for (var h in options.handlers.filehandlers) {\n var handler = options.handlers.filehandlers[h];\n if (handler && handler.module) {\n // Prevent label img dialog from showing.\n if (handler.module !== 'label' || extensions.indexOf(handler.extension.toLowerCase()) === -1) {\n newfilehandlers.push(handler);\n }\n }\n }\n options.handlers.filehandlers = newfilehandlers;\n\n self.dndupload.init(Y, options);\n\n $('.js-snap-drop-file').change(function() {\n var sectionnumber = $(this).attr('id').replace('snap-drop-file-', '');\n var section = Y.one('#section-' + sectionnumber);\n\n var file;\n for (var i = 0; i < this.files.length; i++) {\n // Get file and trigger upload.\n file = this.files.item(i);\n self.dndupload.handle_file(file, section, sectionnumber);\n\n }\n });\n\n var targetAnimImgs = document.querySelectorAll('div.content');\n var configAnimImgs = {childList: true, subtree: true};\n var observerAnimImgs = new MutationObserver(function() {\n util.processAnimatedImages();\n });\n targetAnimImgs.forEach(target => observerAnimImgs.observe(target, configAnimImgs));\n };\n\n return {\n init: self.init\n };\n }\n);\n"],"names":["define","$","YUI","util","self","this","dndupload","init","options","whenTrue","M","course_dndupload","use","Y","decorateCourseDNDUpload","themeSnapCourseFileHandlers","handlers","extensions","newfilehandlers","h","filehandlers","handler","module","indexOf","extension","toLowerCase","push","change","file","sectionnumber","attr","replace","section","one","i","files","length","item","handle_file","targetAnimImgs","document","querySelectorAll","configAnimImgs","childList","subtree","observerAnimImgs","MutationObserver","processAnimatedImages","forEach","target","observe"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBAA,mCAAO,CAAC,SAAU,WAAY,oBAC1B,SAASC,EAAGC,IAAKC,UACTC,KAAOC,YAEXD,KAAKE,UAAY,KAMjBF,KAAKG,KAAO,SAASC,SACjBL,KAAKM,UACD,uBAC2C,IAAxBC,EAAEC,oBAErB,WACIP,KAAKE,UAAYI,EAAEC,iBAEnBT,IAAIU,IAAI,OAAQ,QAAS,OAAQ,OAAQ,kCAAkC,SAASC,GAChFT,KAAKU,wBAAwBD,EAAGL,eAGrC,IAQXJ,KAAKU,wBAA0B,SAASD,EAAGL,SAGI,oBAAhC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