PS3_Toolset/fe/scripts/contextMenu-2.9.2/jquery.contextMenu.min.js

1 line
27 KiB
JavaScript
Raw Normal View History

!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(d){"use strict";var a;d.support.htmlMenuitem="HTMLMenuItemElement"in window,d.support.htmlCommand="HTMLCommandElement"in window,d.support.eventSelectstart="onselectstart"in document.documentElement,d.ui&&d.widget||(d.cleanData=(a=d.cleanData,function(e){for(var t,n,o=0;null!=e[o];o++){n=e[o];try{(t=d._data(n,"events"))&&t.remove&&d(n).triggerHandler("remove")}catch(e){}}a(e)}));var i=null,m=!1,p=d(window),f=0,h={},g={},x={},v={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,hideOnSecondTrigger:!1,selectableSubMenu:!1,classNames:{hover:"context-menu-hover",disabled:"context-menu-disabled",visible:"context-menu-visible",notSelectable:"context-menu-not-selectable",icon:"context-menu-icon",iconEdit:"context-menu-icon-edit",iconCut:"context-menu-icon-cut",iconCopy:"context-menu-icon-copy",iconPaste:"context-menu-icon-paste",iconDelete:"context-menu-icon-delete",iconAdd:"context-menu-icon-add",iconQuit:"context-menu-icon-quit",iconLoadingClass:"context-menu-icon-loading"},determinePosition:function(e){var t;d.ui&&d.ui.position?e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none"):((t=this.offset()).top+=this.outerHeight(),t.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(t))},position:function(e,t,n){var o,a,s;t||n?(o="maintain"===t&&"maintain"===n?e.$menu.position():{top:n-(s=e.$menu.offsetParent().offset()).top,left:t-s.left},a=p.scrollTop()+p.height(),n=p.scrollLeft()+p.width(),t=e.$menu.outerHeight(),s=e.$menu.outerWidth(),o.top+t>a&&(o.top-=t),o.top<0&&(o.top=0),o.left+s>n&&(o.left-=s),o.left<0&&(o.left=0),e.$menu.css(o)):e.determinePosition.call(this,e.$menu)},positionSubmenu:function(e){var t;void 0!==e&&(d.ui&&d.ui.position?e.css("display","block").position({my:"left top-5",at:"right top",of:this,collision:"flipfit fit"}).css("display",""):(t={top:-9,left:this.outerWidth()-5},e.css(t)))},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{preShow:d.noop,show:d.noop,hide:d.noop,activated:d.noop},callback:null,items:{}},s={timer:null,pageX:null,pageY:null},b={abortevent:function(e){e.preventDefault(),e.stopImmediatePropagation()},contextmenu:function(e){var t=d(this);if(!1!==e.data.events.preShow(t,e)&&("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled")))){if(i=t,e.data.build){var n=e.data.build(i,e);if(!1===n)return;if(e.data=d.extend(!0,{},v,e.data,n||{}),!e.data.items||d.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log).call(console,"No items specified to show in contextMenu"),new Error("No Items specified");e.data.$trigger=i,$.create(e.data)}$.show.call(t,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),d(this).trigger(d.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var t=d(this);i&&i.length&&!i.is(t)&&i.data("contextMenu").$menu.trigger("contextmenu:hide"),2===e.button&&(i=t.data("contextMenuActive",!0))},mouseup:function(e){var t=d(this);t.data("contextMenuActive")&&i&&i.length&&i.is(t)&&!t.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),(i=t).trigger(d.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),t.removeData("contextMenuActive")},mouseenter:function(e){var t=d(this),n=d(e.relatedTarget),o=d(document);n.is(".context-menu-list")||n.closest(".context-menu-list").length||i&&i.length||(s.pageX=e.pageX,s.pageY=e.pageY,s.data=e.data,o.on("mousemove.contextMenuShow",b.mousemove),s.timer=setTimeout(function(){s.timer=null,o.off("mousemove.contextMenuShow"),(i=t).trigger(d.Event("conte