/** 右键菜单模块 date:2019-02-08 License By http://easyweb.vip */
layui.define(["jquery"],function(a){var c=layui.jquery;var b={bind:function(e,d){c(e).bind("contextmenu",function(f){b.show(d,f.clientX,f.clientY,f);return false})},show:function(f,d,k,h){var g="left: "+d+"px; top: "+k+"px;";var j='
";b.remove();c("body").append(j);var i=c(".ctxMenu");if(d+i.outerWidth()>b.getPageWidth()){d-=i.outerWidth()}if(k+i.outerHeight()>b.getPageHeight()){k=k-i.outerHeight();if(k<0){k=0}}i.css({"top":k,"left":d});b.setEvents(f,h);c(".ctxMenu-item").on("mouseenter",function(p){p.stopPropagation();c(this).parent().find(".ctxMenu-sub").css("display","none");if(!c(this).hasClass("haveMore")){return}var l=c(this).find(">a");var m=c(this).find(">.ctxMenu-sub");var o=l.offset().top-c("body,html").scrollTop();var n=l.offset().left+l.outerWidth()-c("body,html").scrollLeft();if(n+m.outerWidth()>b.getPageWidth()){n=l.offset().left-m.outerWidth()}if(o+m.outerHeight()>b.getPageHeight()){o=o-m.outerHeight()+l.outerHeight();if(o<0){o=0}}c(this).find(">.ctxMenu-sub").css({"top":o,"left":n,"display":"block"})})},remove:function(){var h=parent.window.frames;for(var d=0;d.ctxMenu").remove()}catch(g){}}try{parent.layui.jquery("body>.ctxMenu").remove()}catch(g){}},setEvents:function(d,f){c(".ctxMenu").off("click").on("click","[lay-id]",function(h){var i=c(this).attr("lay-id");var g=e(i,d);g.click&&g.click(h,f)});function e(l,k){for(var j=0;j0){var g=e(l,h.subs);if(g){return g}}}}}},getHtml:function(e,d){var h="";for(var f=0;f0){h+='