Sindbad~EG File Manager
{"version":3,"file":"main.min.js","sources":["../src/main.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/**\n * Javascript to initialise the Recently accessed items block.\n *\n * @module block_recentlyaccesseditems/main\n * @copyright 2018 Victor Deniz <victor@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n [\n 'jquery',\n 'block_recentlyaccesseditems/repository',\n 'core/templates',\n 'core/notification'\n ],\n function(\n $,\n Repository,\n Templates,\n Notification\n ) {\n\n var NUM_ITEMS = 9;\n\n var SELECTORS = {\n CARDDECK_CONTAINER: '[data-region=\"recentlyaccesseditems-view\"]',\n CARDDECK: '[data-region=\"recentlyaccesseditems-view-content\"]',\n };\n\n /**\n * Get recent items from backend.\n *\n * @method getRecentItems\n * @param {int} limit Only return this many results\n * @return {array} Items user most recently has accessed\n */\n var getRecentItems = function(limit) {\n return Repository.getRecentItems(limit);\n };\n\n /**\n * Render the block content.\n *\n * @method renderItems\n * @param {object} root The root element for the items view.\n * @param {array} items containing array of returned items.\n * @return {promise} Resolved with HTML and JS strings\n */\n var renderItems = function(root, items) {\n if (items.length > 0) {\n return Templates.render('block_recentlyaccesseditems/view-cards', {\n items: items\n });\n } else {\n var noitemsimgurl = root.attr('data-noitemsimgurl');\n return Templates.render('block_recentlyaccesseditems/no-items', {\n noitemsimgurl: noitemsimgurl\n });\n }\n };\n\n /**\n * Get and show the recent items into the block.\n *\n * @param {object} root The root element for the items block.\n */\n var init = function(root) {\n root = $(root);\n\n var itemsContainer = root.find(SELECTORS.CARDDECK_CONTAINER);\n var itemsContent = root.find(SELECTORS.CARDDECK);\n\n var itemsPromise = getRecentItems(NUM_ITEMS);\n\n itemsPromise.then(function(items) {\n var pageContentPromise = renderItems(itemsContainer, items);\n\n pageContentPromise.then(function(html, js) {\n return Templates.replaceNodeContents(itemsContent, html, js);\n }).catch(Notification.exception);\n return itemsPromise;\n }).catch(Notification.exception);\n };\n\n return {\n init: init\n };\n });"],"names":["define","$","Repository","Templates","Notification","SELECTORS","init","root","limit","itemsContainer","find","itemsContent","itemsPromise","getRecentItems","then","items","pageContentPromise","length","render","noitemsimgurl","attr","renderItems","html","js","replaceNodeContents","catch","exception"],"mappings":";;;;;;;AAwBAA,0CACI,CACI,SACA,yCACA,iBACA,sBAEJ,SACIC,EACAC,WACAC,UACAC,kBAKIC,6BACoB,6CADpBA,mBAEU,2DA0DP,CACHC,KAnBO,SAASC,UA9BUC,MAiCtBC,gBAFJF,KAAON,EAAEM,OAEiBG,KAAKL,8BAC3BM,aAAeJ,KAAKG,KAAKL,oBAEzBO,cApCsBJ,MAdd,EAeLN,WAAWW,eAAeL,QAqCjCI,aAAaE,MAAK,SAASC,WACnBC,mBA3BM,SAAST,KAAMQ,UACzBA,MAAME,OAAS,SACRd,UAAUe,OAAO,yCAA0C,CAC9DH,MAAOA,YAGPI,cAAgBZ,KAAKa,KAAK,6BACvBjB,UAAUe,OAAO,uCAAwC,CAC5DC,cAAeA,gBAmBME,CAAYZ,eAAgBM,cAErDC,mBAAmBF,MAAK,SAASQ,KAAMC,WAC5BpB,UAAUqB,oBAAoBb,aAAcW,KAAMC,OAC1DE,MAAMrB,aAAasB,WACfd,gBACRa,MAAMrB,aAAasB"}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists