'use strict';var_createClass=function(){functiondefineProperties(target,props){for(vari=0;i<props.length;i++){vardescriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if('value'indescriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}returnfunction(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);returnConstructor}}();function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError('Cannot call a class as a function')}}varActionsClass=function(){functionActionsClass(element,menu){_classCallCheck(this,ActionsClass);this.element=element;this.menu=menu}_createClass(ActionsClass,[{key:'destroy',value:functiondestroy(){this.element=undefined}},{key:'folder',value:functionfolder(path){varinputValue=void0;if(path){inputValue=path}else{varnameBlock=$(this.element).find('td[data-identifier="name"]');varcurrentName=decodeURIComponent(nameBlock.data('name'));varcurrentPath=decodeURIComponent(nameBlock.data('path'));if($(this.element).data('type')==='file'){inputValue=currentPath}else{inputValue=''+currentPath+currentName+'/'}}swal({type:'input',title:'Create Folder',text:'Please enter the path and folder name below.',showCancelButton:true,showConfirmButton:true,closeOnConfirm:false,showLoaderOnConfirm:true,inputValue:inputValue},function(val){$.ajax({type:'POST',headers:{'X-Access-Token':Pterodactyl.server.daemonSecret,'X-Access-Server':Pterodactyl.server.uuid},contentType:'application/json; charset=utf-8',url:Pterodactyl.node.scheme+'://'+Pterodactyl.node.fqdn+':'+Pterodactyl.node.daemonListen+'/server/file/folder',timeout:10000,data:JSON.stringify({path:val})}).done(function(data){swal.close();Files.list()}).fail(function(jqXHR){console.error(jqXHR);varerror='An error occured while trying to process this request.';if(typeofjqXHR.responseJSON!=='undefined'&&typeofjqXHR.responseJSON.error!=='undefined'){error=jqXHR.responseJSON.error}swal({type:'error',title:'',text:error})})})}},{key:'move',value:functionmove(){varnameBlock=$(this.element).find('td[data-identifier="name"]');varcurrentName=decodeURIComponent(nameBlock.attr('data-name'));varcurrentPath=decodeURIComponent(nameBlock.data('path'));swal({type:'input',title:'Move File',text:'Please enter the new path for the file below.',showCancelButton:true,showConfirmButton:true,closeOnConfirm:false,showLoaderOnConfirm:true,inputValue:''+currentPath+currentName},function(val){$.ajax({type:'POST',headers:{'X-Access-Token':Pterodactyl.server.daemonSecret,'X-Access-Server':Pterodactyl.server.uuid},contentType:'application/json; charset=utf-8',url:Pterodactyl.node.scheme+'://'+Pterodactyl.node.fqdn+':'+Pterodactyl.node.daemonListen+'/server/file/move',timeout:10000,data:JSON.stringify({from:''+currentPath+currentName,to:''+val})}).done(function(data){nameBlock.parent().addClass('warning').delay(200).fadeOut();swal.close()}).fail(function(jqXHR){console.error(jqXHR);varerror='An error occured while trying to process this request.';if(typeofjqXHR.responseJSON!=='undefined'&&typeofjqXHR.responseJSON.error!=='undefined'){error=jqXHR.responseJSON.error}swal({type:'error',title:'',text:error})})})}},{key:'rename',value:functionrename(){varnameBlock=$(this.element).find('td[data-identifier="name"]');varcurrentLink=nameBlock.find('a');varcurrentName=decodeURIComponent(nameBlock.attr('data-name'));varattachEditor='\n <input class="form-control input-sm" type="text" value="'+currentName+'" />\n <span class="input-loader"><i class="fa fa-refresh fa-spin fa-fw"></i></span>\n ';nameBlock.html(attachEditor);varinputField=nameBlock.find('input');varinputLoader=nameBlock.find('.input-loader');inputField.focus();inputField.on('blur keydown',function(e){if(e.type==='keydown'&&e.which===27||e.type==='blur'||e.type==='keydown'&&e.which===13&¤tName===inputField.val()){if(!_.isEmpty(currentLink)){nameBlock.html(c
'use strict';var_typeof=typeofSymbol==='function'&&typeofSymbol.iterator==='symbol'?function(obj){returntypeofobj}:function(obj){returnobj&&typeofSymbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeofobj};var_createClass=function(){functiondefineProperties(target,props){for(vari=0;i<props.length;i++){vardescriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if('value'indescriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}returnfunction(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);returnConstructor}}();function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError('Cannot call a class as a function')}}varFileManager=function(){functionFileManager(){_classCallCheck(this,FileManager);this.list(this.decodeHash())}_createClass(FileManager,[{key:'list',value:functionlist(path,next){var_this=this;if(_.isUndefined(path)){path=this.decodeHash()}this.loader(true);$.ajax({type:'POST',url:Pterodactyl.meta.directoryList,headers:{'X-CSRF-Token':Pterodactyl.meta.csrftoken},data:{directory:path}}).done(function(data){_this.loader(false);$('#load_files').slideUp(10).html(data).slideDown(10,function(){ContextMenu.run();_this.reloadFilesButton();_this.addFolderButton();if(_.isFunction(next)){returnnext()}});$('#internal_alert').slideUp();if((typeofSiofu==='undefined'?'undefined':_typeof(Siofu))==='object'){Siofu.listenOnInput(document.getElementById('files_touch_target'))}}).fail(function(jqXHR){_this.loader(false);if(_.isFunction(next)){returnnext(newError('Failed to load file listing.'))}swal({type:'error',title:'File Error',text:jqXHR.responseText||'An error occured while attempting to process this request. Please try again.'});console.error(jqXHR)})}},{key:'loader',value:functionloader(show){if(show){$('.file-overlay').fadeIn(100)}else{$('.file-overlay').fadeOut(100)}}},{key:'reloadFilesButton',value:functionreloadFilesButton(){var_this2=this;$('i[data-action="reload-files"]').unbind().on('click',function(){$('i[data-action="reload-files"]').addClass('fa-spin');_this2.list()})}},{key:'addFolderButton',value:functionaddFolderButton(){$('[data-action="add-folder"]').unbind().on('click',function(){newActionsClass().folder($('#file_listing').data('current-dir')||'/')})}},{key:'decodeHash',value:functiondecodeHash(){returndecodeURIComponent(window.location.hash.substring(1))}}]);returnFileManager}();window.Files=newFileManager;