Files
DzzOffice/dzz/system/scripts/explorer.js
小胡 1b15bba102 V1.88.5更新内容:
核心功能修复与优化
1. 网盘空间管理优化:
    修复了删除网盘文件后,剩余空间未正确更新的问题,确保用户空间显示准确。
2. 机构用户导航体验提升:
    优化了机构用户在使用中的导航栏返回逻辑,提升了用户在不同页面间跳转时的流畅性和一致性。
用户体验与界面改进
1. 登录页面样式优化:
    解决了登录页面样式重复引用的问题,提升了页面加载速度和用户体验。
2. 移动端界面适配:
    优化了移动端界面的头部名称居中显示,增强了在不同移动设备上的视觉一致性。
3. 卡片显示效果调整:
    修改了卡片的显示效果,使信息展示更加美观和易于阅读。
性能与稳定性提升
1. JS代码压缩问题修复:
    修复了压缩JS代码过程中导致的报错问题,确保了应用的稳定性和性能。
2. 压缩css、js代码优化前端性能
    对前端的CSS和JS代码进行了压缩处理,减少了文件体积,加快了加载速度,从而提升了前端性能。
插件与系统升级
1. jstree插件升级:
    升级了jstree插件版本,解决了在某些使用场景中无法选中节点的问题,提升了用户与树形结构交互的可靠性。
2. 应用市场UI优化:
    对应用市场界面进行了UI优化,提升了应用展示的美观度和易用性,使用户能够更方便地查找和安装所需的应用。
2024-07-22 18:17:27 +08:00

8 lines
9.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"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<r.elements.length;l++){var s=r.elements[l];"option"===e&&"radio"===s.type&&s.value===t&&!0!==s.disabled?s.checked=!0:"value"===e&&"checkbox"===s.type&&s.getAttribute("chkvalue")===t?s.checked=r.elements[o].checked:"prefix"===e&&s.name&&s.name!==o&&(!t||t&&s.name.match(t))&&(s.checked=r.elements[o].checked,a&&(s.parentNode&&"li"===s.parentNode.tagName.toLowerCase()&&(s.parentNode.className=s.checked?"checked":""),s.parentNode.parentNode&&"div"===s.parentNode.parentNode.tagName.toLowerCase()&&(s.parentNode.parentNode.className=s.checked?"item checked":"item")))}}function dfire(e){jQuery(document).trigger(e)}(_explorer=function(e){if(_explorer.space=e.space,_explorer.myuid=e.myuid,_explorer.formhash=e.formhash,_explorer.extopen=e.extopen||{},_explorer.sourcedata=e.sourcedata||[],_explorer.type=e.fileselectiontype||0,_explorer.defaultselect=e.defaultselect,_explorer.allowcreate=e.allowcreate,_explorer.mulitype=e.mulitype||0,_explorer.permfilter=e.permfilter||"",1==_explorer.type&&(_explorer.permfilter=e.permfilter?e.permfilter:"write"),2==_explorer.type?_explorer.allowselecttype={folder:["文件夹",["folder"],"selected"]}:_explorer.allowselecttype=e.allowselecttype||"",e.allowselecttype)for(var r in e.allowselecttype)"selected"==e.allowselecttype[r][2]&&(_explorer.defaultexttype=e.allowselecttype[r][1].join(",").toLowerCase());else _explorer.defaultexttype="";_explorer.defaultfilename=e.defaultfilename||"",_explorer.thame=e.thame||{},_explorer.infoRequest=0,_explorer.deletefinally=e.deletefinally||0,_explorer.cut=e.cut||{iscut:0,icos:[]}}).appUrl="index.php?mod=system&op=fileselection",_explorer.hash="",_explorer.getConfig=function(e,r){$.getJSON(e+"&t="+(new Date).getTime(),function(e){new _explorer(e),_explorer.hashHandler(),_explorer.initEvents(),"function"==typeof r&&r(e)})},_explorer.initEvents=function(){$(window).on("hashchange",function(){_explorer.hashHandler()}),$(document).off("click.document-data").on("click.document-data",".document-data",function(){location.hash=jQuery(this).data("hash")}),$(document).off("ajaxLoad.middleContent").on("ajaxLoad.middleContent",function(){location.hash.replace(/^#/i,"").replace(/&(.+?)$/gi,"");_explorer.topNav_init(),_explorer.address_resize(),_explorer.setHeight($(".height-100")),$(".scroll-100").length&&(_explorer.scroll_100=new PerfectScrollbar(".scroll-100"))})},_explorer.createMenuSwidth=function(e){var r=!1,t=!1;_explorer.allowcreate&&(_explorer.Permission_Container("upload",e)&&2!=_explorer.type?($("#createmenu").find("li").not(".folderPermMust").removeClass("hide"),r=!0):$("#createmenu").find("li").not(".folderPermMust").addClass("hide"),_explorer.Permission_Container("folder",e)?(jQuery("#createmenu").find("li.folderPermMust").removeClass("hide"),t=!0):jQuery("#createmenu").find("li.folderPermMust").addClass("hide"),r||t?($("#createmenu").removeClass("hide"),$("#exampleColorDropdown2").removeClass("hide")):($("#createmenu").addClass("hide"),$("#exampleColorDropdown2").addClass("hide")),$(".divider").each(function(){$(this).prev("li:visible").length<1&&$(this).remove()}))},_explorer.set_address=function(e){var r=e;$(".select-address input.inputaddress").val(r);var t=r.split("\\"),o="";for(var a in t)o+=' <li class="routes"> <a href="javascript:;">'+t[a]+'</a> <span class="dzz dzz-chevron-right"></span></li>';$(".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('<div class="rightLoading"></div>')},_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<a.length;l++)a[l]!==o.id&&t.deselect_node("#"+a[l]);t.select_node(o)}else $.post(_explorer.appUrl+"&op=filelist&do=getParentsArr",{fid:e,gid:r},function(e){var r=t.get_node("#"+e[0]);_explorer.open_node_bg(t,r,e)},"json")},_explorer.open_node_bg=function(e,r,t){e.open_node(r,function(r){var o=jQuery.inArray(r.id,t);o<t.length&&o>-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()});