"use strict"; /* * @copyright Leyun internet Technology(Shanghai)Co.,Ltd * @license http://www.dzzoffice.com/licenses/license.txt * @package DzzOffice * @link http://www.dzzoffice.com * @author zyx(zyx@dzz.cc) */var _explorer={};function checkAll(e,r,t,o,a){o=o||"chkall";for(var l=0;l ';$(".select-address div.address-field").html(o)},_explorer.address_resize=function(e){var r=jQuery(".address-container"),t=jQuery(".address-field"),o=r.width(),a=o,l=0;t.find("li").each(function(){l+=jQuery(this).outerWidth(!0)});var s=isNaN(parseInt(t.css("left")))?o-l:parseInt(t.css("left"));"left"===e?((s+=a)>=0&&(s=0,r.removeClass("arrow-left")),s>o-l?r.addClass("arrow-right"):r.removeClass("arrow-right"),s<0?r.addClass("arrow-left"):r.removeClass("arrow-left"),t.animate({left:s,right:"auto"},500)):"right"===e?((s-=a)<=o-l&&(s=o-l,r.removeClass("arrow-right")),s>o-l?r.addClass("arrow-right"):r.removeClass("arrow-right"),s<0?r.addClass("arrow-left"):r.removeClass("arrow-left"),t.animate({left:s,right:"auto"},500)):(l>o+21?r.removeClass("arrow-right").addClass("arrow-left"):r.removeClass("arrow-right").removeClass("arrow-left"),t.css({left:"auto",right:0}))},_explorer.topNav_init=function(){$(document).off("click.address-left-arrow").on("click.address-left-arrow",".address-left-arrow",function(){return _explorer.address_resize("left"),!1}),$(document).off("click.address-right-arrow").on("click.address-right-arrow",".address-right-arrow",function(){return _explorer.address_resize("right"),!1}),$(document).off("click.routes").on("click.routes",".address-container .routes",function(){var e="",r=$(this).text().replace(/(^\s*)|(\s*$)/g,""),t="",o=[];return/[::]/.test(r)&&(t=(o=r.split(/[::]/))[0],r=o[1]),$(this).closest("li").prevAll().find("a").each(function(){e+=$(this).text().replace(/(^\s*)|(\s*$)/g,"")+"/"}),"/"!==(e+=r).charAt(e.length-1)&&(e+="/"),_explorer.routerule(e,t),!1}),$(document).off("keyup.referer_path").on("keyup.referer_path",".address-container .referer_path",function(e){if(13===e.keyCode){var r=$(this).val(),t=!1;switch(r=r.replace(/\\/g,"/",r)){case"我的网盘":_explorer.routerule(r);break;case"动态":t="dynamic";break;case"回收站":t="recycle";break;case"分享":t="share";break;case"收藏":t="collection";break;case"最近使用":t="recent";break;case"文件夹权限":t="perm";break;case"功能管理":t="app";break;case"图片":case"文档":r="类型:"+r}var o=[],a="";return/[::]/.test(r)?(a=(o=r.split(/[::]/))[0],"/"!==(r=o[1]).charAt(r.length-1)&&(r+="/"),_explorer.routerule(r,a),!1):t?(location.hash=t,!1):("/"!==r.charAt(r.length-1)&&(r+="/"),_explorer.routerule(r),!1)}})},_explorer.routerule=function(e,r){var t={name:e};if(r)switch(r){case"群组":t.prefix="g";break;case"机构":t.prefix="o";break;case"类型":t.prefix="c"}return $.post(_explorer.appUrl+"&do=ajax&operation=getfid",t,function(e){if(e.success){var r="";r=isNaN(parseInt(e.success.gid))?"home&fid="+e.success.fid:"group&gid="+e.success.gid+(e.success.fid?"&fid="+e.success.fid:""),location.hash=r}},"json"),!1},_explorer.hashHandler=function(){var e=location.hash;return(e=e.replace(/^#/i,""))||(e=_explorer.defaultselect,_explorer.jstree_select(e)),e!==_explorer.hash&&(e!==_explorer.hash?(_explorer.getRightContent(e,$("#middleconMenu")),_explorer.hash=e):_explorer.hash=e,!1)},_explorer.loading=function(e,r){"hide"===r?e.find(".rightLoading").remove():e.append('
')},_explorer.getRightContent=function(e,r){_explorer.loading(r),_explorer.rightLoading=1,$(".document-data").removeClass("actives"),$('[data-hash="'+e+'"]').addClass("actives");var t=_explorer.appUrl+"&do=file&"+e;jQuery("#middleconMenu").load(t,function(){$(document).trigger("ajaxLoad.middleContent",[e])})},_explorer.jstree_select=function(e){e||(e=location.hash.replace("#","")),e||(e=$("#position").find("li[flag='home']").attr("hashs"));var r=e.replace(/&(.+?)$/gi,""),t=_explorer.getUrlParam(e,"fid");if("group"===r){var o=_explorer.getUrlParam(e,"gid");_explorer.open_node_by_id(t,o)}else"home"===r?_explorer.open_node_by_id(t):$("#position").length>0&&$("#position").jstree(!0).deselect_all()},_explorer.open_node_by_id=function(e,r){var t=$("#position").jstree(!0),o=null;if(e)o=t.get_node("#f_"+e)||t.get_node("#u_"+e);else{if(!r)return void t.deselect_all();o=t.get_node("#g_"+r)||t.get_node("#gid_"+r)}if(o){t.deselect_all();for(var a=t.get_selected(),l=0;l-1&&document.getElementById(t[o+1])?_explorer.open_node_bg(e,document.getElementById(t[o+1]),t):(e.deselect_all(),e.select_node(r))})},_explorer.getUrlParam=function(e,r){if(!r)return e;var t=new RegExp("(^|&)"+r+"=([^&]*)(&|$)");if(!e)return"";var o=e.match(t);return null!==o?decodeURIComponent(o[2]):void 0},_explorer.setHeight=function(e){var r=document.documentElement.clientHeight;e.each(function(){var e=$(this),t=e.offset(),o=r-t.top;e.css("height",o)})},_explorer.Scroll=function(e){var r=document.documentElement.clientHeight;e||(e=$(".scroll-y")),e.each(function(){var e=$(this),t=e.offset(),o=r-t.top;e.data("subtractor")&&(o-=e.data("subtractor")),e.css({overflow:"auto",height:o,position:"relative"}),new PerfectScrollbar(this)})},_explorer.image_resize=function(e,r,t){r=r||jQuery(e).parent().width(),t=t||jQuery(e).parents(".icoimgContainer").parent().height(),imgReady(e.src,function(){var o=this.width,a=this.height,l=0,s=0;o>0&&a>0&&(o/a>1?(l=o>r?parseInt(r):o,s=o>r?parseInt(t):l*a/o,e.style.width=l+"px",e.style.height=s+"px"):(s=a>t?parseInt(t):a,l=a>t?parseInt(r):s*o/a,e.style.width=l+"px",e.style.height="auto"),l<32&&s<32&&jQuery(e).addClass("image_tosmall").css({padding:(t-s)/2-1+"px "+((r-l)/2-1)+"px"})),jQuery(e).show()})},_explorer.icoimgError=function(e,r,t){r=r||jQuery(e).parent().width(),t=t||jQuery(e).parent().height(),jQuery(e).attr("error")&&imgReady(jQuery(e).attr("error"),function(){var o=this.width,a=this.height,l=0,s=0;if(o>0&&a>0){o/a>1?s=(l=o>r?parseInt(r):o)*a/o:l=(s=a>t?parseInt(t):a)*o/a,l<32&&s<32&&jQuery(e).addClass("image_tosmall").css({padding:(t-s)/2-1+"px "+((r-l)/2-1)+"px"});try{e.style.width=l+"px",e.style.height=s+"px"}catch(e){}e.src=jQuery(e).attr("error"),jQuery(e).show()}},function(){},function(){e.onerror=null,e.src="dzz/images/default/icodefault.png",jQuery(e).show()})},jQuery(window).resize(function(){_explorer.Scroll()});