/* *contextMenu.js v 1.0.3 *Author: Sudhanshu Yadav *s-yadav.github.com *Copyright (c) 2013 Sudhanshu Yadav. *Dual licensed under the MIT and GPL licenses */ (function(e,t,n,r){e.fn.contextMenu=function(t,n,r){"use strict";if(!i[t]){r=n;n=t;t="popup"}else if(n!=null){if(!(n instanceof Array||typeof n==="string"||n.nodeType||n.jquery)){r=n;n=null}}if(n instanceof Array&&t!="update"){t="menu"}var o=r;if(t!="update"){r=s.optionOtimizer(t,r);var o=e.extend({},e.fn.contextMenu.defaults,r);if(!o.baseTrigger){o.baseTrigger=this}}i[t].call(this,n,o);return this};e.fn.contextMenu.defaults={triggerOn:"click",displayAround:"cursor",mouseClick:"left",verAdjust:0,horAdjust:0,top:"auto",left:"auto",containment:t,winEventClose:true,sizeStyle:"auto",position:"auto",onOpen:function(e,t){},afterOpen:function(e,t){},onClose:function(e,t){}};var i={menu:function(t,n){var r=e(this);t=s.createMenuList(r,t,n);s.contextMenuBind.call(this,t,n,"menu")},popup:function(t,n){e(t).addClass("iw-contextMenu");s.contextMenuBind.call(this,t,n,"popup")},update:function(t,n){this.each(function(){var r=e(this),i=r.data("iw-menuData"),o=i.menu;if(typeof t==="object"){for(var u=0;ucHeight){if(m-menuHeight<0){if(g-cHeightcWidth){if(v-menuWidth<0){if(y-cWidthcHeight){if(m-menuHeight<0){if(g-cHeightcWidth){if(v-menuWidth<0){if(y-cWidth');for(var f=0;f'+l+"");if(p!=null&&p!=""){m.prepend('')}if(v=="true"){m.addClass("iw-mDisable")}m.bind("click",c);a.append(m);if(h){m.append('
');s.subMenu(m,h,o,i)}}if(o.index(n[0])==-1){n.append(a)}else{var g=i.containment==t?"body":i.containment;e(g).append(a)}s.onOff(e("#iw-contextMenu"+u));return"#iw-contextMenu"+u}else if(e(r).length!=0){var y=e(r);y.removeClass("iw-contextMenuCurrent").addClass("iw-contextMenu iw-cm-menu iw-contextMenu"+u).attr("menuId","iw-contextMenu"+u).css("display","none");y.find("ul").each(function(t,n){var r=e(this),u=r.parent("li");u.append('
');r.addClass("iw-contextMenuCurrent");s.subMenu(u,".iw-contextMenuCurrent",o,i)});s.onOff(e(".iw-contextMenu"+u));return".iw-contextMenu"+u}},subMenu:function(e,t,n,r){e.contextMenu("menu",t,{triggerOn:"hover",displayAround:"trigger",position:"auto",baseTrigger:n,containment:r.containment})},onOff:function(t){t.find(".iw-mOverlay").remove();t.find(".iw-mDisable").each(function(){var t=e(this);t.append('
');t.find(".iw-mOverlay").bind("click mouseenter",function(e){e.stopPropagation()})})},tempTextBox:function(){var t=e('');t.css({position:"fixed",bottom:"0px",width:"1px","font-size":"1px",outline:"none",border:"0px",left:"0px",opacity:".1",padding:"0px"});e("body").append(t)},optionOtimizer:function(e,t){if(!t){return}if(e=="menu"){if(!t.mouseClick){t.mouseClick="right"}}if(t.mouseClick=="right"&&t.triggerOn=="click"){t.triggerOn="contextmenu"}if(["hover","mouseenter","mouseover","mouseleave","mouseout","focusin","focusout"].indexOf(t.triggerOn)!=-1){t.displayAround="trigger"}return t}}})(jQuery,window,document)