function create_text_file(){$("#textfile_create_area").parent().parent().remove();var e=$("#lang_filename").val()+':
';bootbox.dialog(e,[{label:$("#cancel").val(),"class":"btn"},{label:$("#ok").val(),"class":"btn-inverse",callback:function(){var e=$("#create_text_file_name").val(),a=$("#textfile_create_area").val();if(null!==e){e=fix_filename(e);var t=$("#sub_folder").val()+$("#fldr_value").val()+e,i=$("#cur_dir_thumb").val()+e;$.ajax({type:"POST",url:"execute.php?action=create_file",data:{path:t,path_thumb:i,name:e,new_content:a}}).done(function(e){""!=e&&bootbox.alert(e,function(e){setTimeout(function(){window.location.href=$("#refresh").attr("href")+"&"+(new Date).getTime()},500)})})}}}],{header:$("#lang_new_file").val()})}function edit_text_file(e){$("#textfile_edit_area").parent().parent().remove();var a=e.find(".rename-file").attr("data-thumb"),t=e.find(".rename-file").attr("data-path");$.ajax({type:"POST",url:"ajax_calls.php?action=get_file&sub_action=edit",data:{path:t}}).done(function(i){bootbox.dialog(i,[{label:$("#cancel").val(),"class":"btn"},{label:$("#ok").val(),"class":"btn-inverse",callback:function(){var e=$("#textfile_edit_area").val();$.ajax({type:"POST",url:"execute.php?action=save_text_file",data:{path:t,path_thumb:a,new_content:e}}).done(function(e){""!=e&&bootbox.alert(e)})}}],{header:e.find(".name_download").val()})})}function change_lang(){$.ajax({type:"POST",url:"ajax_calls.php?action=get_lang",data:{}}).done(function(e){bootbox.dialog(e,[{label:$("#cancel").val(),"class":"btn"},{label:$("#ok").val(),"class":"btn-inverse",callback:function(){var e=$("#new_lang_select option:selected").val();$.ajax({type:"POST",url:"ajax_calls.php?action=change_lang",data:{choosen_lang:e}}).done(function(e){""!=e?bootbox.alert(e):setTimeout(function(){window.location.href=$("#refresh").attr("href")+"&"+(new Date).getTime()},500)})}}],{header:$("#lang_lang_change").val()})})}function chmod(e){if($("#files_permission_start").parent().parent().remove(),e.hasClass("directory"))var a=e.find(".rename-folder").attr("data-thumb"),t=e.find(".rename-folder").attr("data-path");else var a=e.find(".rename-file").attr("data-thumb"),t=e.find(".rename-file").attr("data-path");$.ajax({type:"POST",url:"ajax_calls.php?action=chmod",data:{path:t,path_thumb:a}}).done(function(e){bootbox.dialog(e,[{label:$("#cancel").val(),"class":"btn"},{label:$("#ok").val(),"class":"btn-inverse",callback:function(){var e=$("#chmod_form #chmod_value").val();if(""!=e&&"undefined"!=typeof e){var i=$("#chmod_form input[name=apply_recursive]:checked").val();(""==i||"undefined"==typeof i)&&(i="none"),$.ajax({type:"POST",url:"execute.php?action=chmod",data:{path:t,path_thumb:a,new_mode:e,is_recursive:i}}).done(function(e){""!=e&&bootbox.alert(e)})}}}],{header:$("#lang_file_permission").val()})})}function chmod_logic(e){var a=[];if(a.user=0,a.group=0,a.all=0,"undefined"!=typeof e&&1==e){var t=$("#chmod_form #chmod_value").val();a.user=t.substr(0,1),a.group=t.substr(1,1),a.all=t.substr(2,1),$.each(a,function(e){(""==a[e]||0==$.isNumeric(a[e])||parseInt(a[e])<0||parseInt(a[e])>7)&&(a[e]="0")}),$("#chmod_form input:checkbox").each(function(){var e=$(this).attr("data-group"),t=$(this).attr("data-value");chmod_logic_helper(a[e],t)?$(this).prop("checked",!0):$(this).prop("checked",!1)})}else $("#chmod_form input:checkbox:checked").each(function(){var e=$(this).attr("data-group"),t=$(this).attr("data-value");a[e]=parseInt(a[e])+parseInt(t)}),$("#chmod_form #chmod_value").val(a.user.toString()+a.group.toString()+a.all.toString())}function chmod_logic_helper(e,a){var t=[];return t[1]=[1,3,5,7],t[2]=[2,3,6,7],t[4]=[4,5,6,7],e=parseInt(e),a=parseInt(a),-1!=$.inArray(e,t[a])?!0:!1}function clear_clipboard(){bootbox.confirm($("#lang_clear_clipboard_confirm").val(),$("#cancel").val(),$("#ok").val(),function(e){1==e&&$.ajax({type:"POST",url:"ajax_calls.php?action=clear_clipboard",data:{}}).done(function(e){""!=e?bootbox.alert(e):$("#clipboard").val("0"),toggle_clipboard(!1)})})}function copy_cut_clicked(e,a){if("copy"==a||"cut"==a){if(e.hasClass("directory"))var t=e.find(".rename-folder").attr("data-thumb"),i=e.find(".rename-folder").attr("data-path");else var t=e.find(".rename-file").attr("data-thumb"),i=e.find(".rename-file").attr("data-path");$.ajax({type:"POST",url:"ajax_calls.php?action=copy_cut",data:{path:i,path_thumb:t,sub_action:a}}).done(function(e){""!=e?bootbox.alert(e):($("#clipboard").val("1"),toggle_clipboard(!0))})}}function paste_to_this_dir(e){bootbox.confirm($("#lang_paste_confirm").val(),$("#cancel").val(),$("#ok").val(),function(a){if(1==a){if("undefined"!=typeof e)var t=e.find(".rename-folder").attr("data-path"),i=e.find(".rename-folder").attr("data-thumb");else var t=$("#sub_folder").val()+$("#fldr_value").val(),i=$("#cur_dir_thumb").val();$.ajax({type:"POST",url:"execute.php?action=paste_clipboard",data:{path:t,path_thumb:i}}).done(function(e){""!=e?bootbox.alert(e):($("#clipboard").val("0"),toggle_clipboard(!1),setTimeout(function(){window.location.href=$("#refresh").attr("href")+"&"+(new Date).getTime()},300))})}})}function drag_n_drop_paste(e,a){if(e.hasClass("directory"))var t=e.find(".rename-folder").attr("data-thumb"),i=e.find(".rename-folder").attr("data-path");else var t=e.find(".rename-file").attr("data-thumb"),i=e.find(".rename-file").attr("data-path");$.ajax({type:"POST",url:"ajax_calls.php?action=copy_cut",data:{path:i,path_thumb:t,sub_action:"cut"}}).done(function(t){if(""!=t)bootbox.alert(t);else{if("undefined"!=typeof a)if(a.hasClass("back-directory"))var i=a.find(".path").val(),n=a.find(".path_thumb").val();else var i=a.find(".rename-folder").attr("data-path"),n=a.find(".rename-folder").attr("data-thumb");else var i=$("#sub_folder").val()+$("#fldr_value").val(),n=$("#cur_dir_thumb").val();$.ajax({type:"POST",url:"execute.php?action=paste_clipboard",data:{path:i,path_thumb:n}}).done(function(a){""!=a?bootbox.alert(a):($("#clipboard").val("0"),toggle_clipboard(!1),e.parent().remove())})}})}function toggle_clipboard(e){1==e?$(".paste-here-btn, .clear-clipboard-btn").removeClass("disabled"):$(".paste-here-btn, .clear-clipboard-btn").addClass("disabled")}function fix_colums(e){var a=$(".breadcrumb").width()+e;if($(".uploader").css("width",a),$("#view").val()>0){if(1==$("#view").val())$("ul.grid li, ul.grid figure").css("width","100%");else{var t=Math.floor(a/380);0==t&&(t=1,$("h4").css("font-size",12)),a=Math.floor(a/t-3),$("ul.grid li, ul.grid figure").css("width",a)}$("#help").hide()}else Modernizr.touch&&$("#help").show()}function swipe_reaction(e,a,t,i,n){var r=$(this);0==$("#view").val()&&(1==r.attr("toggle")?(r.attr("toggle",0),r.animate({top:"0px"},{queue:!1,duration:300})):(r.attr("toggle",1),r.animate({top:"-30px"},{queue:!1,duration:300})))}function encodeURL(e){for(var a=e.split("/"),t=3;t-1?o='':$.inArray(l,d)>-1?o='":$.inArray(l,c)>-1?("mp3"==l&&(l="mpeg"),o='"):o=''+r+"",1==$("#crossdomain").val()?t.postMessage({sender:"responsivefilemanager",url:s,field_id:null,html:o},"*"):parent.tinymce.majorVersion<4?(parent.tinymce.activeEditor.execCommand("mceInsertContent",!1,o),parent.tinymce.activeEditor.windowManager.close(parent.tinymce.activeEditor.windowManager.params.mce_window_id)):(parent.tinymce.activeEditor.insertContent(o),parent.tinymce.activeEditor.windowManager.close())}function apply_link(e,a){if(1==$("#popup").val())var t=window.opener;else var t=window.parent;var i=$("#cur_dir").val();i=i.replace("\\","/");var n=$("#base_url").val(),r=encodeURL(n+i+e);if(""!=a)if(1==$("#crossdomain").val())t.postMessage({sender:"responsivefilemanager",url:r,field_id:a},"*");else{var l=$("#"+a,t.document);l.val(r).trigger("change"),"function"==typeof t.responsive_filemanager_callback&&t.responsive_filemanager_callback(a),close_window()}else apply_any(r)}function apply_img(e,a){if(1==$("#popup").val())var t=window.opener;else var t=window.parent;var i=$("#cur_dir").val();i=i.replace("\\","/");var n=$("#base_url").val(),r=encodeURL(n+i+e);if(""!=a)if(1==$("#crossdomain").val())t.postMessage({sender:"responsivefilemanager",url:r,field_id:a},"*");else{var l=$("#"+a,t.document);l.val(r).trigger("change"),"function"==typeof t.responsive_filemanager_callback&&t.responsive_filemanager_callback(a),close_window()}else apply_any(r)}function apply_video(e,a){if(1==$("#popup").val())var t=window.opener;else var t=window.parent;var i=$("#cur_dir").val();i=i.replace("\\","/");var n=$("#base_url").val(),r=encodeURL(n+i+e);if(""!=a)if(1==$("#crossdomain").val())t.postMessage({sender:"responsivefilemanager",url:r,field_id:a},"*");else{var l=$("#"+a,t.document);l.val(r).trigger("change"),"function"==typeof t.responsive_filemanager_callback&&t.responsive_filemanager_callback(a),close_window()}else apply_any(r)}function apply_none(e,a){var t=$('li[data-name="'+e+'"]').find(".preview");if(""!=t.html()&&void 0!==t.html())$("#full-img").attr("src",decodeURIComponent(t.attr("data-url"))),0==t.hasClass("disabled")&&(show_animation(),$("#previewLightbox").lightbox());else{var t=$('li[data-name="'+e+'"]').find("a.file-preview-btn");if(""!=t.html()&&void 0!==t.html())$.ajax({url:t.attr("data-url"),success:function(e){bootbox.alert(e)}});else{var t=$('li[data-name="'+e+'"]').find(".modalAV");$("#previewAV").removeData("modal"),$("#previewAV").modal({backdrop:"static",keyboard:!1}),t.hasClass("audio")?$(".body-preview").css("height","80px"):$(".body-preview").css("height","345px"),$.ajax({url:decodeURIComponent(t.attr("data-url")),success:function(e){$(".body-preview").html(e)}})}}}function apply_any(e){return 1==$("#crossdomain").val()?window.parent.postMessage({sender:"responsivefilemanager",url:e,field_id:null},"*"):parent.tinymce.majorVersion<4?(parent.tinymce.activeEditor.windowManager.params.setUrl(e),parent.tinymce.activeEditor.windowManager.close(parent.tinymce.activeEditor.windowManager.params.mce_window_id)):(parent.tinymce.activeEditor.windowManager.getParams().setUrl(e),parent.tinymce.activeEditor.windowManager.close()),!1}function close_window(){1==$("#popup").val()?window.close():"undefined"!=typeof parent.jQuery&&parent.jQuery?parent.jQuery.fancybox.close():parent.$.fancybox.close()}function apply_file_duplicate(e,a){var t=e.parent().parent().parent().parent();t.after(""+t.html()+"");var i=t.next();apply_file_rename(i.find("figure"),a);var n=i.find(".download-form"),r="form"+(new Date).getTime();n.attr("id",r),n.find(".tip-right").attr("onclick","$('#"+r+"').submit();")}function apply_file_rename(e,a){e.attr("data-name",a),e.parent().attr("data-name",a),e.find("h4").find("a").text(a);var t=e.find("a.link"),i=t.attr("data-file"),n=i.substring(i.lastIndexOf("/")+1),r=i.substring(i.lastIndexOf(".")+1);t.each(function(){$(this).attr("data-file",encodeURIComponent(a+"."+r))}),e.find("img").each(function(){var e=$(this).attr("src");$(this).attr("src",e.replace(n,a+"."+r)+"?time="+(new Date).getTime()),$(this).attr("alt",a+" thumbnails")});var l=e.find("a.preview"),i=l.attr("data-url");"undefined"!=typeof i&&i&&l.attr("data-url",i.replace(encodeURIComponent(n),encodeURIComponent(a+"."+r))),e.parent().attr("data-name",a+"."+r),e.attr("data-name",a+"."+r),e.find(".name_download").val(a+"."+r);var o=e.find("a.rename-file"),c=e.find("a.delete-file"),d=o.attr("data-path"),s=o.attr("data-thumb"),f=d.replace(n,a+"."+r),p=s.replace(n,a+"."+r);o.attr("data-path",f),o.attr("data-thumb",p),c.attr("data-path",f),c.attr("data-thumb",p)}function apply_folder_rename(e,a){e.attr("data-name",a),e.find("figure").attr("data-name",a);var t=e.find("h4").find("a").text();e.find("h4 > a").text(a);var i=e.find(".folder-link"),n=i.attr("href"),r=$("#fldr_value").val(),l=n.replace("fldr="+r+encodeURIComponent(t),"fldr="+r+encodeURIComponent(a));i.each(function(){$(this).attr("href",l)});var o=e.find("a.delete-folder"),c=e.find("a.rename-folder"),d=c.attr("data-path"),s=c.attr("data-thumb"),f=d.lastIndexOf("/"),p=d.substr(0,f+1)+a;o.attr("data-path",p),c.attr("data-path",p);var f=s.lastIndexOf("/"),p=s.substr(0,f+1)+a;o.attr("data-thumb",p),c.attr("data-thumb",p)}function replace_last(e,a,t){var i=new RegExp(a+"$");return e.replace(i,t)}function replaceDiacritics(e){for(var e,a=[/[\300-\306]/g,/[\340-\346]/g,/[\310-\313]/g,/[\350-\353]/g,/[\314-\317]/g,/[\354-\357]/g,/[\322-\330]/g,/[\362-\370]/g,/[\331-\334]/g,/[\371-\374]/g,/[\321]/g,/[\361]/g,/[\307]/g,/[\347]/g],t=["A","a","E","e","I","i","O","o","U","u","N","n","C","c"],i=0;i]+(>|$)/g,""),$.trim(e)):null}function execute_action(e,a,t,i,n,r){null!==i&&(i=fix_filename(i),$.ajax({type:"POST",url:"execute.php?action="+e,data:{path:a,path_thumb:t,name:i.replace("/","")}}).done(function(e){return""!=e?(bootbox.alert(e),!1):(""!=r&&window[r](n,i),!0)}))}function sortUnorderedList(e,a,t){"string"==typeof e&&(e=$(e));var i=e.find("li.dir"),n=e.find("li.file"),r=[],l=[],o=[],c=[];$.each(i,function(e){var a=$(this),i=a.find(t).val();if($.isNumeric(i))for(i=parseFloat(i);"undefined"!=typeof r[i]&&r[i];)i=parseFloat(parseFloat(i)+parseFloat(.001));else i=i+"a"+a.find("h4 a").attr("data-file");r[i]=a.html(),l.push(i)}),$.each(n,function(e){var a=$(this),i=a.find(t).val();if($.isNumeric(i))for(i=parseFloat(i);"undefined"!=typeof o[i]&&o[i];)i=parseFloat(parseFloat(i)+parseFloat(.001));else i=i+"a"+a.find("h4 a").attr("data-file");o[i]=a.html(),c.push(i)}),$.isNumeric(l[0])?l.sort(function(e,a){return parseFloat(e)-parseFloat(a)}):l.sort(),$.isNumeric(c[0])?c.sort(function(e,a){return parseFloat(e)-parseFloat(a)}):c.sort(),a&&(l.reverse(),c.reverse()),$.each(i,function(e){var a=$(this);a.html(r[l[e]])}),$.each(n,function(e){var a=$(this);a.html(o[c[e]])})}function show_animation(){$("#loading_container").css("display","block"),$("#loading").css("opacity",".7")}function hide_animation(){$("#loading_container").fadeOut()}function launchEditor(e,a){return featherEditor.launch({image:e,url:a}),!1}var version="9.7.1",active_contextmenu=!0;$(document).ready(function(){function e(e){window[e.attr("data-function")](e.attr("data-file"),e.attr("data-field_id"))}active_contextmenu&&($.contextMenu({selector:"figure:not(.back-directory), .list-view2 figure:not(.back-directory)",autoHide:!0,build:function(e){e.addClass("selected");var a={callback:function(a,t){switch(a){case"copy_url":var i="";i+=$("#base_url").val()+$("#cur_dir").val(),add=e.find("a.link").attr("data-file"),""!=add&&null!=add&&(i+=add),add=e.find("h4 a.folder-link").attr("data-file"),""!=add&&null!=add&&(i+=add),bootbox.alert('URL:
');break;case"unzip":var i=$("#sub_folder").val()+$("#fldr_value").val()+e.find("a.link").attr("data-file");$.ajax({type:"POST",url:"ajax_calls.php?action=extract",data:{path:i}}).done(function(e){""!=e?bootbox.alert(e):window.location.href=$("#refresh").attr("href")+"&"+(new Date).getTime()});break;case"edit_img":var n=e.attr("data-name"),r=$("#base_url_true").val()+$("#cur_dir").val()+n;$("#aviary_img").attr("data-name",n),$("#aviary_img").attr("src",r).load(launchEditor("aviary_img",r));break;case"duplicate":var l=e.find("h4").text().trim();bootbox.prompt($("#lang_duplicate").val(),$("#cancel").val(),$("#ok").val(),function(a){if(null!==a&&(a=fix_filename(a),a!=l)){var t=e.find(".rename-file");execute_action("duplicate_file",t.attr("data-path"),t.attr("data-thumb"),a,t,"apply_file_duplicate")}},l);break;case"copy":copy_cut_clicked(e,"copy");break;case"cut":copy_cut_clicked(e,"cut");break;case"paste":paste_to_this_dir();break;case"chmod":chmod(e);break;case"edit_text_file":edit_text_file(e)}},items:{}};return(e.find(".img-precontainer-mini .filetype").hasClass("png")||e.find(".img-precontainer-mini .filetype").hasClass("jpg")||e.find(".img-precontainer-mini .filetype").hasClass("jpeg"))&&image_editor&&(a.items.edit_img={name:$("#lang_edit_image").val(),icon:"edit_img",disabled:!1}),a.items.copy_url={name:$("#lang_show_url").val(),icon:"url",disabled:!1},(e.find(".img-precontainer-mini .filetype").hasClass("zip")||e.find(".img-precontainer-mini .filetype").hasClass("tar")||e.find(".img-precontainer-mini .filetype").hasClass("gz"))&&(a.items.unzip={name:$("#lang_extract").val(),icon:"extract",disabled:!1}),e.find(".img-precontainer-mini .filetype").hasClass("edit-text-file-allowed")&&(a.items.edit_text_file={name:$("#lang_edit_file").val(),icon:"edit",disabled:!1}),e.hasClass("directory")||1!=$("#duplicate").val()||(a.items.duplicate={name:$("#lang_duplicate").val(),icon:"duplicate",disabled:!1}),e.hasClass("directory")||1!=$("#copy_cut_files_allowed").val()?e.hasClass("directory")&&1==$("#copy_cut_dirs_allowed").val()&&(a.items.copy={name:$("#lang_copy").val(),icon:"copy",disabled:!1},a.items.cut={name:$("#lang_cut").val(),icon:"cut",disabled:!1}):(a.items.copy={name:$("#lang_copy").val(),icon:"copy",disabled:!1},a.items.cut={name:$("#lang_cut").val(),icon:"cut",disabled:!1}),0==$("#clipboard").val()||e.hasClass("directory")||(a.items.paste={name:$("#lang_paste_here").val(),icon:"clipboard-apply",disabled:!1}),e.hasClass("directory")||1!=$("#chmod_files_allowed").val()?e.hasClass("directory")&&1==$("#chmod_dirs_allowed").val()&&(a.items.chmod={name:$("#lang_file_permission").val(),icon:"key",disabled:!1}):a.items.chmod={name:$("#lang_file_permission").val(),icon:"key",disabled:!1},a.items.sep="----",a.items.info={name:""+$("#lang_file_info").val()+"",disabled:!0},a.items.name={name:e.attr("data-name"),icon:"label",disabled:!0},"img"==e.attr("data-type")&&(a.items.dimension={name:e.find(".img-dimension").html(),icon:"dimension",disabled:!0}),a.items.size={name:e.find(".file-size").html(),icon:"size",disabled:!0},a.items.date={name:e.find(".file-date").html(),icon:"date",disabled:!0},a},events:{hide:function(e){$("figure").removeClass("selected")}}}),$(document).on("contextmenu",function(e){return $(e.target).is("figure")?void 0:!1})),$("#full-img").on("click",function(){$("#previewLightbox").lightbox("hide")}),$("ul.grid").on("click",".modalAV",function(e){_this=$(this),e.preventDefault(),$("#previewAV").removeData("modal"),$("#previewAV").modal({backdrop:"static",keyboard:!1}),_this.hasClass("audio")?$(".body-preview").css("height","80px"):$(".body-preview").css("height","345px"),$.ajax({url:_this.attr("data-url"),success:function(e){$(".body-preview").html(e)}})}),$("ul.grid").on("click",".file-preview-btn",function(e){_this=$(this),e.preventDefault(),$.ajax({url:_this.attr("data-url"),success:function(e){bootbox.alert(e)}})}),$("input[name=radio-sort]").on("click",function(){var e=$(this).attr("data-item");$(".filters label").removeClass("btn-inverse"),$(".filters label").find("i").removeClass("icon-white"),$("#filter-input").val(""),$("#"+e).addClass("btn-inverse"),$("#"+e).find("i").addClass("icon-white"),"ff-item-type-all"==e?$(".grid li").show(300):$(this).is(":checked")&&($(".grid li").not("."+e).hide(300),$(".grid li."+e).show(300))});var a=function(){var e=0;return function(a,t){clearTimeout(e),e=setTimeout(a,t)}}();if(parseInt($("#file_number").val())>parseInt($("#file_number_limit_js").val()))var t=!1;else var t=!0;$("#filter-input").on("keyup",function(){$(".filters label").removeClass("btn-inverse"),$(".filters label").find("i").removeClass("icon-white"),$("#ff-item-type-all").addClass("btn-inverse"),$("#ff-item-type-all").find("i").addClass("icon-white");var e=fix_filename($(this).val());$(this).val(e),a(function(){t&&$("ul.grid li").each(function(){var a=$(this);""!=e&&-1==a.attr("data-name").toString().toLowerCase().indexOf(e.toLowerCase())?a.hide(100):a.show(100)})},300)}).keypress(function(e){13==e.which&&$("#filter").trigger("click")}),$("#filter").on("click",function(){var e=fix_filename($("#filter-input").val());window.location.href=$("#current_url").val()+"&filter="+e}),$("#info").on("click",function(){bootbox.alert('
RESPONSIVE filemanager v.'+version+'
responsivefilemanager.com
Copyright © Tecrail - Alberto Peripolli. All rights reserved.
License
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
')}),$("#change_lang_btn").on("click",function(){change_lang()}),$("#uploader-btn").on("click",function(){var e=$("#sub_folder").val()+$("#fldr_value").val()+"/";e=e.substring(0,e.length-1),$("#iframe-container").html($("",{name:"JUpload",id:"uploader_frame",src:"uploader/index.php?path="+e,frameborder:0,width:"100%",height:360}))}),$(".upload-btn").on("click",function(){$(".uploader").show(500)});var i="true"===$("#descending").val();$(".sorter").on("click",function(){_this=$(this),i=$("#sort_by").val()===_this.attr("data-sort")?!i:!0,t?($.ajax({url:"ajax_calls.php?action=sort&sort_by="+_this.attr("data-sort")+"&descending="+i}).done(function(e){}),sortUnorderedList("ul.grid",i,"."+_this.attr("data-sort")),$(" a.sorter").removeClass("descending").removeClass("ascending"),$(".sort-"+_this.attr("data-sort")).addClass(i?"descending":"ascending"),$("#sort_by").val(_this.attr("data-sort")),$("#descending").val(i)):window.location.href=$("#current_url").val()+"&sort_by="+_this.attr("data-sort")+"&descending="+i}),$(".close-uploader").on("click",function(){$(".uploader").hide(500),setTimeout(function(){window.location.href=$("#refresh").attr("href")+"&"+(new Date).getTime()},420)}),$("ul.grid").on("click",".preview",function(){var e=$(this);return $("#full-img").attr("src",decodeURIComponent(e.attr("data-url"))),0==e.hasClass("disabled")&&show_animation(),!0}),$("body").on("keypress",function(e){var a=String.fromCharCode(e.which);return"'"==a||'"'==a||"\\"==a||"/"==a?!1:void 0}),$("ul.grid").on("click",".rename-file",function(){var e=$(this),a=e.parent().parent().parent(),t=a.find("h4"),i=$.trim(t.text());bootbox.prompt($("#rename").val(),$("#cancel").val(),$("#ok").val(),function(t){null!==t&&(t=fix_filename(t),t!=i&&execute_action("rename_file",e.attr("data-path"),e.attr("data-thumb"),t,a,"apply_file_rename"))},i)}),$("ul.grid").on("click",".rename-folder",function(){var e=$(this),a=e.parent().parent().parent(),t=a.find("h4"),i=$.trim(t.text());bootbox.prompt($("#rename").val(),$("#cancel").val(),$("#ok").val(),function(t){null!==t&&(t=fix_filename(t).replace(".",""),t!=i&&execute_action("rename_folder",e.attr("data-path"),e.attr("data-thumb"),t,a,"apply_folder_rename"))},i)}),$("ul.grid").on("click",".delete-file",function(){var e=$(this);bootbox.confirm(e.attr("data-confirm"),$("#cancel").val(),$("#ok").val(),function(a){1==a&&(execute_action("delete_file",e.attr("data-path"),e.attr("data-thumb"),"","",""),e.parent().parent().parent().parent().remove())})}),$("ul.grid").on("click",".delete-folder",function(){var e=$(this);bootbox.confirm(e.attr("data-confirm"),$("#cancel").val(),$("#ok").val(),function(a){1==a&&(execute_action("delete_folder",e.attr("data-path"),e.attr("data-thumb"),"","",""),e.parent().parent().parent().remove())})}),$(".create-file-btn").on("click",function(){create_text_file()}),$(".new-folder").on("click",function(){bootbox.prompt($("#insert_folder_name").val(),$("#cancel").val(),$("#ok").val(),function(e){if(null!==e){e=fix_filename(e).replace(".","");var a=$("#sub_folder").val()+$("#fldr_value").val()+e,t=$("#cur_dir_thumb").val()+e;$.ajax({type:"POST",url:"execute.php?action=create_folder",data:{path:a,path_thumb:t}}).done(function(e){setTimeout(function(){window.location.href=$("#refresh").attr("href")+"&"+(new Date).getTime()},300)})}},$("#new_folder").val())}),$(".view-controller button").on("click",function(){var e=$(this);$(".view-controller button").removeClass("btn-inverse"),$(".view-controller i").removeClass("icon-white"),e.addClass("btn-inverse"),e.find("i").addClass("icon-white"),$.ajax({url:"ajax_calls.php?action=view&type="+e.attr("data-value")}).done(function(e){""!=e&&bootbox.alert(e)}),"undefined"!=typeof $("ul.grid")[0]&&$("ul.grid")[0]&&($("ul.grid")[0].className=$("ul.grid")[0].className.replace(/\blist-view.*?\b/g,"")),"undefined"!=typeof $(".sorter-container")[0]&&$(".sorter-container")[0]&&($(".sorter-container")[0].className=$(".sorter-container")[0].className.replace(/\blist-view.*?\b/g,""));var a=e.attr("data-value");$("#view").val(a),$("ul.grid").addClass("list-view"+a),$(".sorter-container").addClass("list-view"+a),e.attr("data-value")>=1?fix_colums(14):($("ul.grid li").css("width",126),$("ul.grid figure").css("width",122))}),Modernizr.touch?($("#help").show(),$(".box:not(.no-effect)").swipe({swipeLeft:swipe_reaction,swipeRight:swipe_reaction,threshold:30})):($(".tip").tooltip({placement:"bottom"}),$(".tip-top").tooltip({placement:"top"}),$(".tip-left").tooltip({placement:"left"}),$(".tip-right").tooltip({placement:"right"}),$("body").addClass("no-touch")),$(".paste-here-btn").on("click",function(){0==$(this).hasClass("disabled")&&paste_to_this_dir()}),$(".clear-clipboard-btn").on("click",function(){0==$(this).hasClass("disabled")&&clear_clipboard()}),Modernizr.csstransforms||($("figure").on("mouseover",function(){0==$("#view").val()&&$("#main-item-container").hasClass("no-effect-slide")===!1&&$(this).find(".box:not(.no-effect)").animate({top:"-26px"},{queue:!1,duration:300})}),$("figure").on("mouseout",function(){0==$("#view").val()&&$(this).find(".box:not(.no-effect)").animate({top:"0px"},{queue:!1,duration:300})})),$(window).resize(function(){fix_colums(28)}),fix_colums(14),$("ul.grid .link").on("click",function(){e($(this))}),$("ul.grid div.box").on("click",function(a){var t=$(this).find(".link");if(0!==t.length)e(t);else{var i=$(this).find(".folder-link");0!==i.length&&(document.location=$(i).prop("href"))}}),toggle_clipboard(1==$("#clipboard").val()?!0:!1),$("li.dir, li.file").draggable({distance:20,cursor:"move",helper:function(){$(this).find("figure").find(".box").css("top","0px");var e=$(this).clone().css("z-index",1e3).find(".box").css("box-shadow","none").css("-webkit-box-shadow","none").parent().parent();return $(this).addClass("selected"),e},start:function(){0==$("#view").val()&&$("#main-item-container").addClass("no-effect-slide")},stop:function(){$(this).removeClass("selected"),0==$("#view").val()&&$("#main-item-container").removeClass("no-effect-slide")}}),$("li.dir,li.back").droppable({accept:"ul.grid li",activeClass:"ui-state-highlight",hoverClass:"ui-state-hover",drop:function(e,a){drag_n_drop_paste(a.draggable.find("figure"),$(this).find("figure"))}}),$(document).on("keyup","#chmod_form #chmod_value",function(){chmod_logic(!0)}),$(document).on("focusout","#chmod_form #chmod_value",function(){var e=$("#chmod_form #chmod_value").val();if(null==e.match(/^[0-7]{3}$/)){var a=$("#chmod_form #chmod_value").attr("data-def-value");$("#chmod_form #chmod_value").val(a),chmod_logic(!0)}})});