This commit is contained in:
lealife
2015-10-27 23:04:39 +08:00
parent 29244c247e
commit 263c03291e
21 changed files with 1037 additions and 294 deletions

View File

@ -1 +1 @@
.b-m-mpanel{background:url(images/contextmenu/menu_bg.gif) left repeat-y #fff;border:1px solid #ccc;position:absolute;padding:2px 0;z-index:99997;left:0;top:0;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box;overflow:auto}.b-m-split{height:6px;background:url(images/contextmenu/m_splitLine.gif) center repeat-x;font-size:0;margin:0 2px}.b-m-idisable,.b-m-ifocus,.b-m-item{padding:4px 10px 4px 4px;cursor:default;line-height:100%}.b-m-idisable{color:grey}.b-m-arrow,.b-m-ibody{overflow:hidden;text-overflow:ellipsis}.b-m-arrow{background:url(images/contextmenu/m_arrow.gif) right no-repeat}.b-m-idisable .b-m-arrow{background:0 0}.b-m-idisable img,.b-m-ifocus img,.b-m-item img{margin-right:8px;width:16px}.b-m-ifocus{background-color:#CDE3F6}.b-m-idisable img{visibility:hidden}.c-text{display:inline-block;padding-left:3px}.b-m-icon{width:23px;padding-left:3px}
.b-m-mpanel{background:url(images/contextmenu/menu_bg.gif) left repeat-y #fff;border:1px solid #ccc;position:absolute;padding:2px 0;z-index:99997;left:0;top:0;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box;overflow:auto}.b-m-split{height:6px;background:url(images/contextmenu/m_splitLine.gif) center repeat-x;font-size:0;margin:0 2px}.b-m-idisable,.b-m-ifocus,.b-m-item{padding:4px 10px 4px 4px;cursor:default;line-height:1.2}.b-m-idisable{color:grey}.b-m-arrow,.b-m-ibody{overflow:hidden;text-overflow:ellipsis}.b-m-arrow{background:url(images/contextmenu/m_arrow.gif) right no-repeat}.b-m-idisable .b-m-arrow{background:0 0}.b-m-idisable img,.b-m-ifocus img,.b-m-item img{margin-right:8px;width:16px}.b-m-ifocus{background-color:#CDE3F6}.b-m-idisable img{visibility:hidden}.c-text{display:inline-block;padding-left:3px}.b-m-icon{width:23px;padding-left:3px}

View File

@ -22,7 +22,7 @@
{
padding: 4px 10px 4px 4px;
cursor: default;
line-height:100%;
line-height:1.2;
}
.b-m-idisable
{

View File

@ -180,20 +180,22 @@ LEA.cmroot = 1;
pos.left = (pos.left + width + mwidth > bwidth) ? (pos.left - mwidth < 0 ? 0 : pos.left - mwidth) : pos.left + width;
pos.top = (pos.top + mheight > bheight) ? (pos.top - mheight + (width > 0 ? 25 : 0) < 0 ? 0 : pos.top - mheight + (width > 0 ? 25 : 0)) : pos.top;
$(this).css(pos).show().css("max-height", bheight);
showGroups.push(this.gidx);
};
//to hide menu
var hideMenuPane = function() {
var alias = null;
// console.log('showGroups: ' + showGroups.length)
for (var i = showGroups.length - 1; i >= 0; i--) {
if (showGroups[i] == this.gidx)
break;
alias = showGroups.pop();
groups[alias].style.display = "none";
mitems[alias] && (mitems[alias].className = "b-m-item");
} //Endfor
//CollectGarbage();
}
};
function applyRule(rule) {
/*
@ -216,19 +218,17 @@ LEA.cmroot = 1;
/* to show menu */
function showMenu(e, menutarget) {
// 先隐藏之前的
hideMenuPane();
removeContextmenuClass();
target = menutarget;
showMenuGroup.call(groups[cmroot], { left: e.pageX, top: e.pageY }, 0);
// life
if(!$(target).hasClass("item-active")) {
$(target).addClass("contextmenu-hover");
// 在该target上添加contextmenu-hover
if(target && !$(target).hasClass("item-active")) {
$(target).addClass("contextmenu-hover");
}
// life , 之前是mousedown
$(document).one('click', function() {
hideMenuPane();
// life
$(target).removeClass("contextmenu-hover");
})
}
// 初始化
@ -263,7 +263,17 @@ LEA.cmroot = 1;
var me = $(option.parent).on('contextmenu', option.children, function(e){
onShowMenu.call(this, e);
});
function removeContextmenuClass() {
Note.$itemList.find('li').removeClass('contextmenu-hover');
}
// life , 之前是document, 绑定document即使stopPro也会执行到这里
$('body').on('click', function(e) {
removeContextmenuClass();
hideMenuPane();
});
//to apply rule
if (option.rule) {
applyRule(option.rule);