Sindbad~EG File Manager

Current Path : /var/www/html/ceade.tocsa.com.py/mod/forum/amd/build/local/grades/local/grader/
Upload File :
Current File : /var/www/html/ceade.tocsa.com.py/mod/forum/amd/build/local/grades/local/grader/user_picker.min.js

define("mod_forum/local/grades/local/grader/user_picker",["exports","core/templates","./user_picker/selectors","core/str"],(function(_exports,_templates,_selectors,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter((function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable}))),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach((function(key){_defineProperty(target,key,source[key])})):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach((function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}))}return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _slicedToArray(arr,i){return function(arr){if(Array.isArray(arr))return arr}(arr)||function(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null==_i)return;var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_templates=_interopRequireDefault(_templates),_selectors=_interopRequireDefault(_selectors);var _ref2,UserPicker=function(){function UserPicker(userList,showUserCallback,preChangeUserCallback){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,UserPicker),this.userList=userList,this.showUserCallback=showUserCallback,this.preChangeUserCallback=preChangeUserCallback,this.currentUserIndex=0,this.render=this.render.bind(this),this.setUserId=this.setUserId.bind(this)}var Constructor,protoProps,staticProps,_showUser,_render;return Constructor=UserPicker,protoProps=[{key:"setUserId",value:function(userId){var userIndex=this.userList.findIndex((function(user){return user.id===parseInt(userId)}));if(-1===userIndex)throw Error("User with id ".concat(userId," not found"));this.currentUserIndex=userIndex}},{key:"render",value:(_render=_asyncToGenerator(regeneratorRuntime.mark((function _callee(){var _yield$this$renderNav,html,js;return regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return this.root=document.createElement("div"),_context.next=3,this.renderNavigator();case 3:return _yield$this$renderNav=_context.sent,html=_yield$this$renderNav.html,js=_yield$this$renderNav.js,_templates.default.replaceNodeContents(this.root,html,js),_context.next=9,this.showUser(this.currentUser);case 9:this.registerEventListeners();case 10:case"end":return _context.stop()}}),_callee,this)}))),function(){return _render.apply(this,arguments)})},{key:"renderNavigator",value:function(){return _templates.default.renderForPromise("".concat("mod_forum/local/grades/local/grader","/user_picker"),{})}},{key:"renderUserChange",value:function(context){return _templates.default.renderForPromise("".concat("mod_forum/local/grades/local/grader","/user_picker/user"),context)}},{key:"showUser",value:(_showUser=_asyncToGenerator(regeneratorRuntime.mark((function _callee2(user){var _yield$Promise$all,_yield$Promise$all2,_yield$Promise$all2$,html,js,userRegion,currentUserRegion;return regeneratorRuntime.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return _context2.next=2,Promise.all([this.renderUserChange(user),this.showUserCallback(user)]);case 2:return _yield$Promise$all=_context2.sent,_yield$Promise$all2=_slicedToArray(_yield$Promise$all,1),_yield$Promise$all2$=_yield$Promise$all2[0],html=_yield$Promise$all2$.html,js=_yield$Promise$all2$.js,userRegion=this.root.querySelector(_selectors.default.regions.userRegion),_templates.default.replaceNodeContents(userRegion,html,js),currentUserRegion=this.root.querySelector(_selectors.default.regions.currentUser),_context2.next=12,(0,_str.get_string)("nowgradinguser","mod_forum",user.fullname);case 12:currentUserRegion.textContent=_context2.sent;case 13:case"end":return _context2.stop()}}),_callee2,this)}))),function(_x){return _showUser.apply(this,arguments)})},{key:"registerEventListeners",value:function(){var _ref,_this=this;this.root.addEventListener("click",(_ref=_asyncToGenerator(regeneratorRuntime.mark((function _callee3(e){var button;return regeneratorRuntime.wrap((function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:if(!(button=e.target.closest(_selectors.default.actions.changeUser))){_context3.next=9;break}return _context3.next=4,_this.preChangeUserCallback(_this.currentUser);case 4:if(_context3.sent.failed){_context3.next=9;break}return _this.updateIndex(parseInt(button.dataset.direction)),_context3.next=9,_this.showUser(_this.currentUser);case 9:case"end":return _context3.stop()}}),_callee3)}))),function(_x2){return _ref.apply(this,arguments)}))}},{key:"updateIndex",value:function(direction){return this.currentUserIndex+=direction,this.currentUserIndex<0?this.currentUserIndex=this.userList.length-1:this.currentUserIndex>this.userList.length-1&&(this.currentUserIndex=0),this.currentUserIndex}},{key:"currentUser",get:function(){return _objectSpread(_objectSpread({},this.userList[this.currentUserIndex]),{},{total:this.userList.length,displayIndex:this.currentUserIndex+1})}},{key:"rootNode",get:function(){return this.root}}],protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),UserPicker}(),_default=(_ref2=_asyncToGenerator(regeneratorRuntime.mark((function _callee4(users,showUserCallback,preChangeUserCallback){var _ref3,_ref3$initialUserId,initialUserId,userPicker,_args4=arguments;return regeneratorRuntime.wrap((function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:return _ref3=_args4.length>3&&void 0!==_args4[3]?_args4[3]:{},_ref3$initialUserId=_ref3.initialUserId,initialUserId=void 0===_ref3$initialUserId?null:_ref3$initialUserId,userPicker=new UserPicker(users,showUserCallback,preChangeUserCallback),initialUserId&&userPicker.setUserId(initialUserId),_context4.next=5,userPicker.render();case 5:return _context4.abrupt("return",userPicker);case 6:case"end":return _context4.stop()}}),_callee4)}))),function(_x3,_x4,_x5){return _ref2.apply(this,arguments)});return _exports.default=_default,_exports.default}));

//# sourceMappingURL=user_picker.min.js.map

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists