Files
DzzOffice/dzz/system/scripts/contextmenu.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
11 KiB
JavaScript

/*
* @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)
*/
_contextmenu={},_contextmenu.zIndex=9999999,_contextmenu.right_ico=function(e,n){var t=(e=e||window.event).srcElement?e.srcElement:e.target;if(/input|textarea/i.test(t.tagName))return!0;var i=e.clientX,o=e.clientY;t=_explorer.sourcedata.icos[n];if(document.getElementById("right_contextmenu"))r=jQuery(document.getElementById("right_contextmenu"));else var r=jQuery('<div id="right_contextmenu" class="menu"></div>').appendTo(document.body);n+="",m=(m=(m=(m=document.getElementById("right_ico").innerHTML).replace(/\{XX\}/g,i)).replace(/\{YY\}/g,o)).replace(/\{rid\}/g,n),m=1==_selectfile.selectall.icos.length&&"folder"==t.type?m.replace(/\{fid\}/g,t.fid):m.replace(/\{fid\}/g,t.pfid),r.html(m),("shortcut"==t.type||"storage"==t.type||"pan"==t.type||_explorer.myuid<1)&&r.find(".shortcut").remove(),2==_explorer.type&&r.find(".download,.cut,.copy,.delete").remove(),_explorer.Permission("copy",t)||r.find(".copy").remove(),(!_explorer.Permission("upload",t)||_explorer.cut.icos.length<1||_selectfile.fid<1)&&r.find(".paste").remove(),_explorer.Permission("share",t)||r.find(".share").remove(),_explorer.Permission("rename",t)||r.find(".rename").remove(),_explorer.Permission("download",t)||(r.find(".download").remove(),r.find(".downpackage").remove()),_explorer.Permission("chmod",t)||r.find(".chmod").remove(),_explorer.Permission("delete",t)||(r.find(".cut").remove(),r.find(".delete").remove()),t.notdelete>0&&"app"==t.type&&(r.find(".delete").remove(),r.find(".cut").remove(),r.find(".copy").remove());var l=0;if(_selectfile.selectall.icos.length>1&&jQuery.inArray(n,_selectfile.selectall.icos)>-1){1==t.isdelete?r.find(".menu-item:not(.recover,.finallydelete)").remove():r.find(".menu-item:not(.delete,.cut,.copy,.restore,.downpackage,.property,.collect,.paste,.share,.cancleshare)").remove();for(var d=1,s=0;s<_selectfile.selectall.icos.length;s++){var c=_explorer.sourcedata.icos[_selectfile.selectall.icos[s]];if(c.collect&&(l+=1),!_explorer.Permission("download",c)){d=0;break}}d||r.find(".downpackage").remove(),r.find(".download").remove(),l==_selectfile.selectall.icos.length&&r.find(".collect .menu-text").html("取消收藏")}else t.collect&&r.find(".collect .menu-text").html("取消收藏"),r.find(".downpackage").remove();if(1==t.isdelete?r.find(".menu-item:not(.recover,.finallydelete)").remove():(r.find(".finallydelete").remove(),r.find(".recover").remove()),-1!=_selectfile.winid.indexOf("collect")&&(r.find(".cut").remove(),r.find(".copy").remove(),r.find(".paste").remove()),-1!=_selectfile.winid.indexOf("share")?r.find(".menu-item:not(.cancleshare,.editshare)").remove():r.find(".cancleshare,.editshare").remove(),-1==_selectfile.winid.indexOf("collect")&&-1==_selectfile.winid.indexOf("recent")&&-1==_selectfile.winid.indexOf("search")||r.find(".cut,.delete,.rename").remove(),r.find(".menu-item").length){var u=getExtOpen("shortcut"==t.type?t.tdata:t);if(!0===u)r.find(".openwith").remove();else if(!1===u)r.find(".openwith").remove(),r.find(".open").remove();else if(1==u.length)r.find(".openwith").remove();else if(u.length>1){var m='<span class="menu-icon icon-openwith" ></span><span class="menu-text">'+__lang.method_open+'</span><span class="menu-rightarrow"></span>';m+='<div class=" menu " style="display:none">';for(s=0;s<u.length;s++)m+='<div class="menu-item" onClick="_selectfile.Open(\''+n+"','"+u[s].extid+"');jQuery('#right_contextmenu').hide();jQuery('#shadow').hide();return false;\">",u[s].icon&&(m+='<span class="menu-icon" style="background:none"><img width="100%" height="100%" src='+u[s].icon+"></span>"),m+='<span class="menu-text">'+u[s].name+"</span>",m+="</div>";m+="</div>",r.find(".openwith").html(m)}else r.find(".openwith").remove();r.find(".menu-sep").each(function(){jQuery(this).next().first().hasClass("menu-item")&&jQuery(this).prev().first().hasClass("menu-item")||jQuery(this).remove()});var a=document.documentElement.clientWidth,p=document.documentElement.clientHeight;r.css({"z-index":_contextmenu.zIndex+1}),r.show(),r.find(">div").each(function(){var e=jQuery(this),n=e.find(".menu");if(n.length){var t=e.find(".menu-shadow");e.on("mouseover",function(){_contextmenu.ppp&&_contextmenu.ppp.hide(),_contextmenu.kkk&&_contextmenu.kkk.hide(),_contextmenu.last&&_contextmenu.last.removeClass("menu-active"),_contextmenu.kkk=t,_contextmenu.last=e,_contextmenu.ppp=n,e.addClass("menu-active");var l=e.find(".menu"),d=r.width()-1;return suby=0,i+2*r.width()>a&&(d=d-l.width()-r.width()-6),o+e.position().top+l.height()>p&&(suby=suby-l.height()+e.height()-5),l.css({left:d,top:suby,"z-index":_contextmenu.zIndex+2,display:"block"}),t.css({display:"block",zIndex:_contextmenu.zIndex+1,left:d,top:suby,width:l.outerWidth(),height:l.outerHeight()}),n.find(".menu-item").on("mouseover",function(){jQuery(this).addClass("menu-active")}),n.find(".menu-item").on("mouseout",function(){return jQuery(this).removeClass("menu-active"),!1}),!1}),e.on("mouseout",function(){return e.removeClass("menu-active"),t.hide(),n.hide(),!1})}else e.on("mouseover",function(){return _contextmenu.last&&_contextmenu.last.removeClass("menu-active"),_contextmenu.ppp&&_contextmenu.ppp.hide(),_contextmenu.kkk&&_contextmenu.kkk.hide(),jQuery(this).addClass("menu-active"),!1}),e.on("mouseout",function(){jQuery(this).removeClass("menu-active")})}),i+r.width()>a&&(i-=r.width()),o+r.height()>p&&(o-=r.height()),r.css({left:i,top:o}),jQuery(document).on("mousedown.right_contextmenu",function(e){var n=(e=e||window.event).srcElement?e.srcElement:e.target;jQuery(n).closest("#right_contextmenu").length<1&&(r.hide(),r.empty(),jQuery(document).off(".right_contextmenu"),_contextmenu.kkk=null,_contextmenu.ppp=null,_contextmenu.last=null)})}else r.hide()},_contextmenu.right_body=function(e,n){var t=(e=e||window.event).srcElement?e.srcElement:e.target;if(/input|textarea/i.test(t.tagName))return!0;var i=e.clientX,o=e.clientY,r=document.getElementById("right_body").innerHTML;if(r=(r=r.replace(/\{fid\}/g,n)).replace(/\{filemanageid\}/g,_selectfile.winid),document.getElementById("right_contextmenu"))l=jQuery(document.getElementById("right_contextmenu"));else var l=jQuery('<div id="right_contextmenu" class="menu"></div>').appendTo(document.body);l.html(r);var d=_selectfile.cons[_selectfile.winid];if(l.find("span.menu-icon-iconview[view="+d.view+"]").removeClass("dzz-check-box-outline-blank").addClass("dzz-check-box"),l.find(".menu-icon-disp").each(function(){jQuery(this).attr("disp")==d.disp?(jQuery(this).removeClass("dzz-check-box-outline-blank").addClass("dzz-check-box"),jQuery(this).next().find(".caret").removeClass("asc").removeClass("desc").addClass(d.asc>0?"asc":"desc")):(jQuery(this).addClass("dzz-check-box-outline-blank").removeClass("dzz-check-box"),jQuery(this).next().find(".caret").removeClass("asc").removeClass("desc"))}),n?(l.find(".recoverall").remove(),l.find(".deleteall").remove()):(l.find(".property").remove(),l.find(".paste").remove(),"recycle-list"!=_selectfile.winid?(l.find(".recoverall").remove(),l.find(".deleteall").remove()):(l.find(".sort .disp2").remove(),l.find(".sort .disp3").remove())),_explorer.Permission_Container("folder",n)||l.find(".newfolder").remove(),_explorer.Permission_Container("link",n)||l.find(".newlink").remove(),_explorer.Permission_Container("dzzdoc",n)||l.find(".newdzzdoc").remove(),_explorer.Permission_Container("upload",n)||l.find(".newdzzdoc").remove(),_explorer.Permission_Container("newtype",n)||(l.find(".newtext").remove(),l.find(".newdoc").remove(),l.find(".newexcel").remove(),l.find(".newpowerpoint").remove()),l.find(".create .menu-item").length<1&&l.find(".create").remove(),_explorer.cut.icos.length<1&&l.find(".paste").remove(),_explorer.Permission_Container("upload",n)?BROWSER.ie?(jQuery('<input id="right_uploadfile_'+n+'" name="files[]" tabIndex="-1" style="position: absolute;outline:none; filter: alpha(opacity=0); PADDING-BOTTOM: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Arial; font-size: 180px;height:30px;width:200px;top: 0px; cursor: pointer; right: 0px; padding-top: 0px; opacity: 0;direction:ltr;background-image:none" type="file" multiple="multiple" >').appendTo(l.find(".upload")),fileupload(jQuery("#right_uploadfile_"+n)),jQuery('<input id="right_uploadfolder_'+n+'" name="files[]" tabIndex="-1" style="position: absolute;outline:none; filter: alpha(opacity=0); PADDING-BOTTOM: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Arial; font-size: 180px;height:30px;width:200px;top: 0px; cursor: pointer; right: 0px; padding-top: 0px; opacity: 0;direction:ltr;background-image:none" type="file" multiple="multiple" >').appendTo(l.find(".uploadfolder")),fileupload(jQuery("#right_uploadfolder_"+n))):(console.log(l.find(".upload")),l.find(".upload").get(0).onclick=function(){jQuery(".js-upload-file input").trigger("click"),console.log(jQuery(".js-upload-file input")),console.log("aaaa"),l.hide()},l.find(".uploadfolder").get(0).onclick=function(){jQuery(".js-upload-folder input").trigger("click"),l.hide()}):(l.find(".upload").remove(),l.find(".uploadfolder").remove()),l.find(".create .menu>.menu-item").length<1&&l.find(".create").remove(),"share-list"==_selectfile.winid&&l.find(".menu-item").remove(),l.find(".menu-item").length<1)l.hide();else{l.find(".menu-sep").each(function(){jQuery(this).next().first().hasClass("menu-item")&&jQuery(this).prev().first().hasClass("menu-item")||jQuery(this).remove()});var s=document.documentElement.clientWidth,c=document.documentElement.clientHeight;l.css({"z-index":_contextmenu.zIndex+1}),l.show(),l.find(">div").each(function(){var e=jQuery(this),n=e.find(".menu");if(n.length){var t=e.find(".menu-shadow");e.on("mouseover",function(){_contextmenu.ppp&&_contextmenu.ppp.hide(),_contextmenu.kkk&&_contextmenu.kkk.hide(),_contextmenu.last&&_contextmenu.last.removeClass("menu-active"),_contextmenu.kkk=t,_contextmenu.last=e,_contextmenu.ppp=n,e.addClass("menu-active");var r=e.find(".menu"),d=l.width()-1;return suby=-5,i+2*l.width()>s&&(d=d-r.width()-l.width()-6),o+e.position().top+r.height()>c&&(suby=suby-r.height()+e.height()),console.log(r),r.css({left:d,top:suby,"z-index":_contextmenu.zIndex+2,display:"block"}),t.css({display:"block",zIndex:_contextmenu.zIndex+1,left:d,top:suby,width:r.outerWidth(),height:r.outerHeight()}),n.find(".menu-item").on("mouseover",function(){jQuery(this).addClass("menu-active")}),n.find(".menu-item").on("mouseout",function(){return jQuery(this).removeClass("menu-active"),!1}),!1}),e.on("mouseout",function(){return e.removeClass("menu-active"),t.hide(),n.hide(),!1})}else e.on("mouseover",function(){return _contextmenu.last&&_contextmenu.last.removeClass("menu-active"),_contextmenu.ppp&&_contextmenu.ppp.hide(),_contextmenu.kkk&&_contextmenu.kkk.hide(),jQuery(this).addClass("menu-active"),!1}),e.on("mouseout",function(){jQuery(this).removeClass("menu-active")})}),i+l.width()>s&&(i-=l.width()),o+l.height()>c&&(o-=l.height()),o<0&&(o=0),l.css({left:i,top:o}),jQuery("#shadow").css({display:"block",zIndex:_contextmenu.zIndex,left:i,top:o,width:l.outerWidth(),height:l.outerHeight()}),jQuery(document).on("mousedown.right_contextmenu",function(e){var n=(e=e||window.event).srcElement?e.srcElement:e.target;jQuery(n).closest("#right_contextmenu").length<1&&(l.hide(),jQuery("#shadow").hide(),jQuery(document).off(".right_contextmenu"),_contextmenu.kkk=null,_contextmenu.ppp=null,_contextmenu.last=null)})}};