{"version":3,"sources":["jquery.contextMenu.min.js"],"names":["factory","define","amd","exports","require","jQuery","$","splitAccesskey","val","k","t","split","keys","i","charAt","toUpperCase","push","inputLabel","node","id","name","menuChildren","items","$children","counter","each","label","item","$node","this","nodeName","toLowerCase","find","length","text","children","first","get","attr","disabled","callback","click","undefined","icon","type","selected","radio","value","options","html","clone","support","htmlMenuitem","window","htmlCommand","eventSelectstart","document","documentElement","ui","widget","cleanData","orig","elems","events","elem","_data","remove","triggerHandler","e","$currentTrigger","initialized","$win","namespaces","menus","types","defaults","selector","appendTo","trigger","autoHide","delay","reposition","hideOnSecondTrigger","selectableSubMenu","classNames","hover","visible","notSelectable","iconEdit","iconCut","iconCopy","iconPaste","iconDelete","iconAdd","iconQuit","iconLoadingClass","determinePosition","$menu","position","css","my","at","of","offset","collision","top","outerHeight","left","outerWidth","opt","x","y","offsetParentOffset","offsetParent","bottom","scrollTop","height","right","scrollLeft","width","call","positionSubmenu","zIndex","animation","duration","show","hide","noop","activated","hoveract","timer","pageX","pageY","zindex","$t","zin","$tt","Math","max","parseInt","parent","indexOf","prop","handle","abortevent","preventDefault","stopImmediatePropagation","contextmenu","$this","data","originalEvent","mouseButton","hasClass","build","built","extend","isEmptyObject","console","error","log","Error","$trigger","op","create","showMenu","hasOwnProperty","isFunction","currentTarget","Event","mousedown","is","button","mouseup","removeData","mouseenter","$related","relatedTarget","$document","closest","on","mousemove","setTimeout","off","mouseleave","clearTimeout","layerClick","target","root","$window","triggerAction","elementFromPoint","$layer","isContentEditable","range","createRange","sel","getSelection","selectNode","collapse","removeAllRanges","addRange","one","contextMenu","keyStop","isInput","stopPropagation","key","targetZIndex","getZIndexOfTriggerTarget","style","parentElement","keyCode","shiftKey","$selected","blur","$parent","itemdata","String","fromCharCode","accesskeys","prevItem","$s","$prev","prev","last","$round","itemMouseleave","itemMouseenter","$input","focus","nextItem","$next","next","focusInput","contextMenuRoot","blurInput","menuMouseenter","hovering","menuMouseleave","itemClick","contextMenuKey","callbacks","Object","prototype","update","inputClick","hideMenu","force","focusItem","addClass","join","not","removeClass","filter","blurItem","additionalZValue","layer","pos","createNameNode","$name","_accesskey","_beforeAccesskey","append","createTextNode","_afterAccesskey","isHtmlName","accesskey","className","$label","ak","aks","matched","match","RegExp","commands","hasTypes","inputs","prependTo","then","processPromises","_icon","substring","body","resize","nested","domMenu","display","getBoundingClientRect","ceil","minWidth","maxWidth","addBack","$item","z-index","opacity","background-color","insertBefore","promise","errorPromise","errorItem","finishPromiseProcess","bind","$menuOffset","winHeight","winScrollTop","menuHeight","overflow-x","overflow-y","fn","operation","$o","context","isPlainObject","o","$context","_hasContext","menu","ns","itemClickEvent","contextMenuItemObj","contextmenu:focus.contextMenu","contextmenu:blur.contextMenu","contextmenu.contextMenu","mouseenter.contextMenu","mouseleave.contextMenu","contextmenu:hide.contextMenu","prevcommand.contextMenu","nextcommand.contextMenu","$visibleMenu","fromMenu","setInputValues","getInputValues","element"],"mappings":"CAkBA,SAAWA,GACe,mBAAXC,QAAyBA,OAAOC,IAEvCD,QAAQ,UAAWD,GAGnBA,EAF0B,iBAAZG,QAENC,QAAQ,UAGRC,QAThB,CAWG,SAAUC,GAET,aA+/CA,SAASC,EAAeC,GAIpB,IAAK,IAAWC,EAHZC,EAAIF,EAAIG,MAAM,OACdC,KAEKC,EAAI,EAAMJ,EAAIC,EAAEG,GAAIA,IACzBJ,EAAIA,EAAEK,OAAO,GAAGC,cAGhBH,EAAKI,KAAKP,GAGd,OAAOG,EAwUX,SAASK,EAAWC,GAChB,OAAQA,EAAKC,IAAMb,EAAE,cAAgBY,EAAKC,GAAK,MAAMX,OAAUU,EAAKE,KAIxE,SAASC,EAAaC,EAAOC,EAAWC,GA0KpC,OAzKKA,IACDA,EAAU,GAGdD,EAAUE,KAAK,WACX,IAGIC,EACAC,EAJAC,EAAQtB,EAAEuB,MACVX,EAAOW,KACPC,EAAWD,KAAKC,SAASC,cAoB7B,OAfiB,UAAbD,GAAwBF,EAAMI,KAAK,2BAA2BC,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D,EAAaC,EAHDhB,EAAEsU,GAGYzS,YAEnBb,GAIXhB,EAAEoM,YAAY/H,SAAWA,EACzBrE,EAAEoM,YAAYhI,MAAQA,EAEtBpE,EAAEoM,YAAY3D,OAASA,EACvBzI,EAAEoM,YAAYxC,GAAKA,EACnB5J,EAAEoM,YAAYjI,MAAQA","file":"jquery.contextMenu.min.js","sourcesContent":["/**\n * jQuery contextMenu v2.6.3 - Plugin for simple contextMenu handling\n *\n * Version: v2.6.3\n *\n * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)\n * Web: http://swisnl.github.io/jQuery-contextMenu/\n *\n * Copyright (c) 2011-2017 SWIS BV and contributors\n *\n * Licensed under\n * MIT License http://www.opensource.org/licenses/mit-license\n *\n * Date: 2017-10-30T19:03:13.804Z\n */\n\n// jscs:disable\n/* jshint ignore:start */\n(function (factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as anonymous module.\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node / CommonJS\n factory(require('jquery'));\n } else {\n // Browser globals.\n factory(jQuery);\n }\n})(function ($) {\n\n 'use strict';\n\n // TODO: -\n // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio\n // create structure if $.support[htmlCommand || htmlMenuitem] and !opt.disableNative\n\n // determine html5 compatibility\n $.support.htmlMenuitem = ('HTMLMenuItemElement' in window);\n $.support.htmlCommand = ('HTMLCommandElement' in window);\n $.support.eventSelectstart = ('onselectstart' in document.documentElement);\n /* // should the need arise, test for css user-select\n $.support.cssUserSelect = (function(){\n var t = false,\n e = document.createElement('div');\n\n $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) {\n var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect',\n prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select';\n\n e.style.cssText = prop + ': text;';\n if (e.style[propCC] == 'text') {\n t = true;\n return false;\n }\n\n return true;\n });\n\n return t;\n })();\n */\n\n\n if (!$.ui || !$.widget) {\n // duck punch $.cleanData like jQueryUI does to get that remove event\n $.cleanData = (function (orig) {\n return function (elems) {\n var events, elem, i;\n for (i = 0; elems[i] != null; i++) {\n elem = elems[i];\n try {\n // Only trigger remove when necessary to save time\n events = $._data(elem, 'events');\n if (events && events.remove) {\n $(elem).triggerHandler('remove');\n }\n\n // Http://bugs.jquery.com/ticket/8235\n } catch (e) {\n }\n }\n orig(elems);\n };\n })($.cleanData);\n }\n /* jshint ignore:end */\n // jscs:enable\n\n var // currently active contextMenu trigger\n $currentTrigger = null,\n // is contextMenu initialized with at least one menu?\n initialized = false,\n // window handle\n $win = $(window),\n // number of registered menus\n counter = 0,\n // mapping selector to namespace\n namespaces = {},\n // mapping namespace to options\n menus = {},\n // custom command type handlers\n types = {},\n // default values\n defaults = {\n // selector of contextMenu trigger\n selector: null,\n // where to append the menu to\n appendTo: null,\n // method to trigger context menu [\"right\", \"left\", \"hover\"]\n trigger: 'right',\n // hide menu when mouse leaves trigger / menu elements\n autoHide: false,\n // ms to wait before showing a hover-triggered context menu\n delay: 200,\n // flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu\n // as long as the trigger happened on one of the trigger-element's child nodes\n reposition: true,\n // Flag denoting if a second trigger should close the menu, as long as \n // the trigger happened on one of the trigger-element's child nodes.\n // This overrides the reposition option.\n hideOnSecondTrigger: false,\n\n //ability to select submenu\n selectableSubMenu: false,\n\n // Default classname configuration to be able avoid conflicts in frameworks\n classNames: {\n hover: 'context-menu-hover', // Item hover\n disabled: 'context-menu-disabled', // Item disabled\n visible: 'context-menu-visible', // Item visible\n notSelectable: 'context-menu-not-selectable', // Item not selectable\n\n icon: 'context-menu-icon',\n iconEdit: 'context-menu-icon-edit',\n iconCut: 'context-menu-icon-cut',\n iconCopy: 'context-menu-icon-copy',\n iconPaste: 'context-menu-icon-paste',\n iconDelete: 'context-menu-icon-delete',\n iconAdd: 'context-menu-icon-add',\n iconQuit: 'context-menu-icon-quit',\n iconLoadingClass: 'context-menu-icon-loading'\n },\n\n // determine position to show menu at\n determinePosition: function ($menu) {\n // position to the lower middle of the trigger element\n if ($.ui && $.ui.position) {\n // .position() is provided as a jQuery UI utility\n // (...and it won't work on hidden elements)\n $menu.css('display', 'block').position({\n my: 'center top',\n at: 'center bottom',\n of: this,\n offset: '0 5',\n collision: 'fit'\n }).css('display', 'none');\n } else {\n // determine contextMenu position\n var offset = this.offset();\n offset.top += this.outerHeight();\n offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2;\n $menu.css(offset);\n }\n },\n // position menu\n position: function (opt, x, y) {\n var offset;\n // determine contextMenu position\n if (!x && !y) {\n opt.determinePosition.call(this, opt.$menu);\n return;\n } else if (x === 'maintain' && y === 'maintain') {\n // x and y must not be changed (after re-show on command click)\n offset = opt.$menu.position();\n } else {\n // x and y are given (by mouse event)\n var offsetParentOffset = opt.$menu.offsetParent().offset();\n offset = {top: y - offsetParentOffset.top, left: x -offsetParentOffset.left};\n }\n\n // correct offset if viewport demands it\n var bottom = $win.scrollTop() + $win.height(),\n right = $win.scrollLeft() + $win.width(),\n height = opt.$menu.outerHeight(),\n width = opt.$menu.outerWidth();\n\n if (offset.top + height > bottom) {\n offset.top -= height;\n }\n\n if (offset.top < 0) {\n offset.top = 0;\n }\n\n if (offset.left + width > right) {\n offset.left -= width;\n }\n\n if (offset.left < 0) {\n offset.left = 0;\n }\n\n opt.$menu.css(offset);\n },\n // position the sub-menu\n positionSubmenu: function ($menu) {\n if (typeof $menu === 'undefined') {\n // When user hovers over item (which has sub items) handle.focusItem will call this.\n // but the submenu does not exist yet if opt.items is a promise. just return, will\n // call positionSubmenu after promise is completed.\n return;\n }\n if ($.ui && $.ui.position) {\n // .position() is provided as a jQuery UI utility\n // (...and it won't work on hidden elements)\n $menu.css('display', 'block').position({\n my: 'left top-5',\n at: 'right top',\n of: this,\n collision: 'flipfit fit'\n }).css('display', '');\n } else {\n // determine contextMenu position\n var offset = {\n top: -9,\n left: this.outerWidth() - 5\n };\n $menu.css(offset);\n }\n },\n // offset to add to zIndex\n zIndex: 1,\n // show hide animation settings\n animation: {\n duration: 50,\n show: 'slideDown',\n hide: 'slideUp'\n },\n // events\n events: {\n show: $.noop,\n hide: $.noop,\n activated: $.noop\n },\n // default callback\n callback: null,\n // list of contextMenu items\n items: {}\n },\n // mouse position for hover activation\n hoveract = {\n timer: null,\n pageX: null,\n pageY: null\n },\n // determine zIndex\n zindex = function ($t) {\n var zin = 0,\n $tt = $t;\n\n while (true) {\n zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0);\n $tt = $tt.parent();\n if (!$tt || !$tt.length || 'html body'.indexOf($tt.prop('nodeName').toLowerCase()) > -1) {\n break;\n }\n }\n return zin;\n },\n // event handlers\n handle = {\n // abort anything\n abortevent: function (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n },\n // contextmenu show dispatcher\n contextmenu: function (e) {\n var $this = $(this);\n\n // disable actual context-menu if we are using the right mouse button as the trigger\n if (e.data.trigger === 'right') {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n // abort native-triggered events unless we're triggering on right click\n if ((e.data.trigger !== 'right' && e.data.trigger !== 'demand') && e.originalEvent) {\n return;\n }\n\n // Let the current contextmenu decide if it should show or not based on its own trigger settings\n if (typeof e.mouseButton !== 'undefined' && e.data) {\n if (!(e.data.trigger === 'left' && e.mouseButton === 0) && !(e.data.trigger === 'right' && e.mouseButton === 2)) {\n // Mouse click is not valid.\n return;\n }\n }\n\n // abort event if menu is visible for this trigger\n if ($this.hasClass('context-menu-active')) {\n return;\n }\n\n if (!$this.hasClass('context-menu-disabled')) {\n // theoretically need to fire a show event at \n // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus\n // var evt = jQuery.Event(\"show\", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this });\n // e.data.$menu.trigger(evt);\n\n $currentTrigger = $this;\n if (e.data.build) {\n var built = e.data.build($currentTrigger, e);\n // abort if build() returned false\n if (built === false) {\n return;\n }\n\n // dynamically build menu on invocation\n e.data = $.extend(true, {}, defaults, e.data, built || {});\n\n // abort if there are no items to display\n if (!e.data.items || $.isEmptyObject(e.data.items)) {\n // Note: jQuery captures and ignores errors from event handlers\n if (window.console) {\n (console.error || console.log).call(console, 'No items specified to show in contextMenu');\n }\n\n throw new Error('No Items specified');\n }\n\n // backreference for custom command type creation\n e.data.$trigger = $currentTrigger;\n\n op.create(e.data);\n }\n var showMenu = false;\n for (var item in e.data.items) {\n if (e.data.items.hasOwnProperty(item)) {\n var visible;\n if ($.isFunction(e.data.items[item].visible)) {\n visible = e.data.items[item].visible.call($(e.currentTarget), item, e.data);\n } else if (typeof e.data.items[item] !== 'undefined' && e.data.items[item].visible) {\n visible = e.data.items[item].visible === true;\n } else {\n visible = true;\n }\n if (visible) {\n showMenu = true;\n }\n }\n }\n if (showMenu) {\n // show menu\n op.show.call($this, e.data, e.pageX, e.pageY);\n }\n }\n },\n // contextMenu left-click trigger\n click: function (e) {\n e.preventDefault();\n e.stopImmediatePropagation();\n $(this).trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY}));\n },\n // contextMenu right-click trigger\n mousedown: function (e) {\n // register mouse down\n var $this = $(this);\n\n // hide any previous menus\n if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) {\n $currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide');\n }\n\n // activate on right click\n if (e.button === 2) {\n $currentTrigger = $this.data('contextMenuActive', true);\n }\n },\n // contextMenu right-click trigger\n mouseup: function (e) {\n // show menu\n var $this = $(this);\n if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) {\n e.preventDefault();\n e.stopImmediatePropagation();\n $currentTrigger = $this;\n $this.trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY}));\n }\n\n $this.removeData('contextMenuActive');\n },\n // contextMenu hover trigger\n mouseenter: function (e) {\n var $this = $(this),\n $related = $(e.relatedTarget),\n $document = $(document);\n\n // abort if we're coming from a menu\n if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {\n return;\n }\n\n // abort if a menu is shown\n if ($currentTrigger && $currentTrigger.length) {\n return;\n }\n\n hoveract.pageX = e.pageX;\n hoveract.pageY = e.pageY;\n hoveract.data = e.data;\n $document.on('mousemove.contextMenuShow', handle.mousemove);\n hoveract.timer = setTimeout(function () {\n hoveract.timer = null;\n $document.off('mousemove.contextMenuShow');\n $currentTrigger = $this;\n $this.trigger($.Event('contextmenu', {\n data: hoveract.data,\n pageX: hoveract.pageX,\n pageY: hoveract.pageY\n }));\n }, e.data.delay);\n },\n // contextMenu hover trigger\n mousemove: function (e) {\n hoveract.pageX = e.pageX;\n hoveract.pageY = e.pageY;\n },\n // contextMenu hover trigger\n mouseleave: function (e) {\n // abort if we're leaving for a menu\n var $related = $(e.relatedTarget);\n if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {\n return;\n }\n\n try {\n clearTimeout(hoveract.timer);\n } catch (e) {\n }\n\n hoveract.timer = null;\n },\n // click on layer to hide contextMenu\n layerClick: function (e) {\n var $this = $(this),\n root = $this.data('contextMenuRoot'),\n button = e.button,\n x = e.pageX,\n y = e.pageY,\n target,\n offset;\n\n e.preventDefault();\n\n setTimeout(function () {\n var $window;\n var triggerAction = ((root.trigger === 'left' && button === 0) || (root.trigger === 'right' && button === 2));\n\n // find the element that would've been clicked, wasn't the layer in the way\n if (document.elementFromPoint && root.$layer) {\n root.$layer.hide();\n target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop());\n\n // also need to try and focus this element if we're in a contenteditable area,\n // as the layer will prevent the browser mouse action we want\n if (target.isContentEditable) {\n var range = document.createRange(),\n sel = window.getSelection();\n range.selectNode(target);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n }\n $(target).trigger(e);\n root.$layer.show();\n }\n \n if (root.hideOnSecondTrigger && triggerAction && root.$menu !== null && typeof root.$menu !== 'undefined') {\n root.$menu.trigger('contextmenu:hide');\n return;\n }\n \n if (root.reposition && triggerAction) {\n if (document.elementFromPoint) {\n if (root.$trigger.is(target)) {\n root.position.call(root.$trigger, root, x, y);\n return;\n }\n } else {\n offset = root.$trigger.offset();\n $window = $(window);\n // while this looks kinda awful, it's the best way to avoid\n // unnecessarily calculating any positions\n offset.top += $window.scrollTop();\n if (offset.top <= e.pageY) {\n offset.left += $window.scrollLeft();\n if (offset.left <= e.pageX) {\n offset.bottom = offset.top + root.$trigger.outerHeight();\n if (offset.bottom >= e.pageY) {\n offset.right = offset.left + root.$trigger.outerWidth();\n if (offset.right >= e.pageX) {\n // reposition\n root.position.call(root.$trigger, root, x, y);\n return;\n }\n }\n }\n }\n }\n }\n\n if (target && triggerAction) {\n root.$trigger.one('contextmenu:hidden', function () {\n $(target).contextMenu({x: x, y: y, button: button});\n });\n }\n\n if (root !== null && typeof root !== 'undefined' && root.$menu !== null && typeof root.$menu !== 'undefined') {\n root.$menu.trigger('contextmenu:hide');\n }\n }, 50);\n },\n // key handled :hover\n keyStop: function (e, opt) {\n if (!opt.isInput) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n },\n key: function (e) {\n\n var opt = {};\n\n // Only get the data from $currentTrigger if it exists\n if ($currentTrigger) {\n opt = $currentTrigger.data('contextMenu') || {};\n }\n // If the trigger happen on a element that are above the contextmenu do this\n if (typeof opt.zIndex === 'undefined') {\n opt.zIndex = 0;\n }\n var targetZIndex = 0;\n var getZIndexOfTriggerTarget = function (target) {\n if (target.style.zIndex !== '') {\n targetZIndex = target.style.zIndex;\n } else {\n if (target.offsetParent !== null && typeof target.offsetParent !== 'undefined') {\n getZIndexOfTriggerTarget(target.offsetParent);\n }\n else if (target.parentElement !== null && typeof target.parentElement !== 'undefined') {\n getZIndexOfTriggerTarget(target.parentElement);\n }\n }\n };\n getZIndexOfTriggerTarget(e.target);\n // If targetZIndex is heigher then opt.zIndex dont progress any futher.\n // This is used to make sure that if you are using a dialog with a input / textarea / contenteditable div\n // and its above the contextmenu it wont steal keys events\n if (opt.$menu && parseInt(targetZIndex,10) > parseInt(opt.$menu.css(\"zIndex\"),10)) {\n return;\n }\n switch (e.keyCode) {\n case 9:\n case 38: // up\n handle.keyStop(e, opt);\n // if keyCode is [38 (up)] or [9 (tab) with shift]\n if (opt.isInput) {\n if (e.keyCode === 9 && e.shiftKey) {\n e.preventDefault();\n if (opt.$selected) {\n opt.$selected.find('input, textarea, select').blur();\n }\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\n opt.$menu.trigger('prevcommand');\n }\n return;\n } else if (e.keyCode === 38 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') {\n // checkboxes don't capture this key\n e.preventDefault();\n return;\n }\n } else if (e.keyCode !== 9 || e.shiftKey) {\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\n opt.$menu.trigger('prevcommand');\n }\n return;\n }\n break;\n // omitting break;\n // case 9: // tab - reached through omitted break;\n case 40: // down\n handle.keyStop(e, opt);\n if (opt.isInput) {\n if (e.keyCode === 9) {\n e.preventDefault();\n if (opt.$selected) {\n opt.$selected.find('input, textarea, select').blur();\n }\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\n opt.$menu.trigger('nextcommand');\n }\n return;\n } else if (e.keyCode === 40 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') {\n // checkboxes don't capture this key\n e.preventDefault();\n return;\n }\n } else {\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\n opt.$menu.trigger('nextcommand');\n }\n return;\n }\n break;\n\n case 37: // left\n handle.keyStop(e, opt);\n if (opt.isInput || !opt.$selected || !opt.$selected.length) {\n break;\n }\n\n if (!opt.$selected.parent().hasClass('context-menu-root')) {\n var $parent = opt.$selected.parent().parent();\n opt.$selected.trigger('contextmenu:blur');\n opt.$selected = $parent;\n return;\n }\n break;\n\n case 39: // right\n handle.keyStop(e, opt);\n if (opt.isInput || !opt.$selected || !opt.$selected.length) {\n break;\n }\n\n var itemdata = opt.$selected.data('contextMenu') || {};\n if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) {\n opt.$selected = null;\n itemdata.$selected = null;\n itemdata.$menu.trigger('nextcommand');\n return;\n }\n break;\n\n case 35: // end\n case 36: // home\n if (opt.$selected && opt.$selected.find('input, textarea, select').length) {\n return;\n } else {\n (opt.$selected && opt.$selected.parent() || opt.$menu)\n .children(':not(.' + opt.classNames.disabled + ', .' + opt.classNames.notSelectable + ')')[e.keyCode === 36 ? 'first' : 'last']()\n .trigger('contextmenu:focus');\n e.preventDefault();\n return;\n }\n break;\n\n case 13: // enter\n handle.keyStop(e, opt);\n if (opt.isInput) {\n if (opt.$selected && !opt.$selected.is('textarea, select')) {\n e.preventDefault();\n return;\n }\n break;\n }\n if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) {\n opt.$selected.trigger('mouseup');\n }\n return;\n\n case 32: // space\n case 33: // page up\n case 34: // page down\n // prevent browser from scrolling down while menu is visible\n handle.keyStop(e, opt);\n return;\n\n case 27: // esc\n handle.keyStop(e, opt);\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\n opt.$menu.trigger('contextmenu:hide');\n }\n return;\n\n default: // 0-9, a-z\n var k = (String.fromCharCode(e.keyCode)).toUpperCase();\n if (opt.accesskeys && opt.accesskeys[k]) {\n // according to the specs accesskeys must be invoked immediately\n opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu ? 'contextmenu:focus' : 'mouseup');\n return;\n }\n break;\n }\n // pass event to selected item,\n // stop propagation to avoid endless recursion\n e.stopPropagation();\n if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) {\n opt.$selected.trigger(e);\n }\n },\n // select previous possible command in menu\n prevItem: function (e) {\n e.stopPropagation();\n var opt = $(this).data('contextMenu') || {};\n var root = $(this).data('contextMenuRoot') || {};\n\n // obtain currently selected menu\n if (opt.$selected) {\n var $s = opt.$selected;\n opt = opt.$selected.parent().data('contextMenu') || {};\n opt.$selected = $s;\n }\n\n var $children = opt.$menu.children(),\n $prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(),\n $round = $prev;\n\n // skip disabled or hidden elements\n while ($prev.hasClass(root.classNames.disabled) || $prev.hasClass(root.classNames.notSelectable) || $prev.is(':hidden')) {\n if ($prev.prev().length) {\n $prev = $prev.prev();\n } else {\n $prev = $children.last();\n }\n if ($prev.is($round)) {\n // break endless loop\n return;\n }\n }\n\n // leave current\n if (opt.$selected) {\n handle.itemMouseleave.call(opt.$selected.get(0), e);\n }\n\n // activate next\n handle.itemMouseenter.call($prev.get(0), e);\n\n // focus input\n var $input = $prev.find('input, textarea, select');\n if ($input.length) {\n $input.focus();\n }\n },\n // select next possible command in menu\n nextItem: function (e) {\n e.stopPropagation();\n var opt = $(this).data('contextMenu') || {};\n var root = $(this).data('contextMenuRoot') || {};\n\n // obtain currently selected menu\n if (opt.$selected) {\n var $s = opt.$selected;\n opt = opt.$selected.parent().data('contextMenu') || {};\n opt.$selected = $s;\n }\n\n var $children = opt.$menu.children(),\n $next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(),\n $round = $next;\n\n // skip disabled\n while ($next.hasClass(root.classNames.disabled) || $next.hasClass(root.classNames.notSelectable) || $next.is(':hidden')) {\n if ($next.next().length) {\n $next = $next.next();\n } else {\n $next = $children.first();\n }\n if ($next.is($round)) {\n // break endless loop\n return;\n }\n }\n\n // leave current\n if (opt.$selected) {\n handle.itemMouseleave.call(opt.$selected.get(0), e);\n }\n\n // activate next\n handle.itemMouseenter.call($next.get(0), e);\n\n // focus input\n var $input = $next.find('input, textarea, select');\n if ($input.length) {\n $input.focus();\n }\n },\n // flag that we're inside an input so the key handler can act accordingly\n focusInput: function () {\n var $this = $(this).closest('.context-menu-item'),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot;\n\n root.$selected = opt.$selected = $this;\n root.isInput = opt.isInput = true;\n },\n // flag that we're inside an input so the key handler can act accordingly\n blurInput: function () {\n var $this = $(this).closest('.context-menu-item'),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot;\n\n root.isInput = opt.isInput = false;\n },\n // :hover on menu\n menuMouseenter: function () {\n var root = $(this).data().contextMenuRoot;\n root.hovering = true;\n },\n // :hover on menu\n menuMouseleave: function (e) {\n var root = $(this).data().contextMenuRoot;\n if (root.$layer && root.$layer.is(e.relatedTarget)) {\n root.hovering = false;\n }\n },\n // :hover done manually so key handling is possible\n itemMouseenter: function (e) {\n var $this = $(this),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot;\n\n root.hovering = true;\n\n // abort if we're re-entering\n if (e && root.$layer && root.$layer.is(e.relatedTarget)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n // make sure only one item is selected\n (opt.$menu ? opt : root).$menu\n .children('.' + root.classNames.hover).trigger('contextmenu:blur')\n .children('.hover').trigger('contextmenu:blur');\n\n if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {\n opt.$selected = null;\n return;\n }\n\n\n $this.trigger('contextmenu:focus');\n },\n // :hover done manually so key handling is possible\n itemMouseleave: function (e) {\n var $this = $(this),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot;\n\n if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) {\n if (typeof root.$selected !== 'undefined' && root.$selected !== null) {\n root.$selected.trigger('contextmenu:blur');\n }\n e.preventDefault();\n e.stopImmediatePropagation();\n root.$selected = opt.$selected = opt.$node;\n return;\n }\n\n if(opt && opt.$menu && opt.$menu.hasClass('context-menu-visible')){\n return;\n }\n\n $this.trigger('contextmenu:blur');\n },\n // contextMenu item click\n itemClick: function (e) {\n var $this = $(this),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot,\n key = data.contextMenuKey,\n callback;\n\n // abort if the key is unknown or disabled or is a menu\n if (!opt.items[key] || $this.is('.' + root.classNames.disabled + ', .context-menu-separator, .' + root.classNames.notSelectable) || ($this.is('.context-menu-submenu') && root.selectableSubMenu === false )) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n if ($.isFunction(opt.callbacks[key]) && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) {\n // item-specific callback\n callback = opt.callbacks[key];\n } else if ($.isFunction(root.callback)) {\n // default callback\n callback = root.callback;\n } else {\n // no callback, no action\n return;\n }\n\n // hide menu if callback doesn't stop that\n if (callback.call(root.$trigger, key, root, e) !== false) {\n root.$menu.trigger('contextmenu:hide');\n } else if (root.$menu.parent().length) {\n op.update.call(root.$trigger, root);\n }\n },\n // ignore click events on input elements\n inputClick: function (e) {\n e.stopImmediatePropagation();\n },\n // hide \n hideMenu: function (e, data) {\n var root = $(this).data('contextMenuRoot');\n op.hide.call(root.$trigger, root, data && data.force);\n },\n // focus \n focusItem: function (e) {\n e.stopPropagation();\n var $this = $(this),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot;\n\n if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {\n return;\n }\n\n $this\n .addClass([root.classNames.hover, root.classNames.visible].join(' '))\n // select other items and included items\n .parent().find('.context-menu-item').not($this)\n .removeClass(root.classNames.visible)\n .filter('.' + root.classNames.hover)\n .trigger('contextmenu:blur');\n\n // remember selected\n opt.$selected = root.$selected = $this;\n\n\n if(opt && opt.$node && opt.$node.hasClass('context-menu-submenu')){\n opt.$node.addClass(root.classNames.hover);\n }\n\n // position sub-menu - do after show so dumb $.ui.position can keep up\n if (opt.$node) {\n root.positionSubmenu.call(opt.$node, opt.$menu);\n }\n },\n // blur \n blurItem: function (e) {\n e.stopPropagation();\n var $this = $(this),\n data = $this.data(),\n opt = data.contextMenu,\n root = data.contextMenuRoot;\n\n if (opt.autoHide) { // for tablets and touch screens this needs to remain\n $this.removeClass(root.classNames.visible);\n }\n $this.removeClass(root.classNames.hover);\n opt.$selected = null;\n }\n },\n // operations\n op = {\n show: function (opt, x, y) {\n var $trigger = $(this),\n css = {};\n\n // hide any open menus\n $('#context-menu-layer').trigger('mousedown');\n\n // backreference for callbacks\n opt.$trigger = $trigger;\n\n // show event\n if (opt.events.show.call($trigger, opt) === false) {\n $currentTrigger = null;\n return;\n }\n\n // create or update context menu\n op.update.call($trigger, opt);\n\n // position menu\n opt.position.call($trigger, opt, x, y);\n\n // make sure we're in front\n if (opt.zIndex) {\n var additionalZValue = opt.zIndex;\n // If opt.zIndex is a function, call the function to get the right zIndex.\n if (typeof opt.zIndex === 'function') {\n additionalZValue = opt.zIndex.call($trigger, opt);\n }\n css.zIndex = zindex($trigger) + additionalZValue;\n }\n\n // add layer\n op.layer.call(opt.$menu, opt, css.zIndex);\n\n // adjust sub-menu zIndexes\n opt.$menu.find('ul').css('zIndex', css.zIndex + 1);\n\n // position and show context menu\n opt.$menu.css(css)[opt.animation.show](opt.animation.duration, function () {\n $trigger.trigger('contextmenu:visible');\n \n op.activated(opt);\n opt.events.activated();\n });\n // make options available and set state\n $trigger\n .data('contextMenu', opt)\n .addClass('context-menu-active');\n\n // register key handler\n $(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key);\n // register autoHide handler\n if (opt.autoHide) {\n // mouse position handler\n $(document).on('mousemove.contextMenuAutoHide', function (e) {\n // need to capture the offset on mousemove,\n // since the page might've been scrolled since activation\n var pos = $trigger.offset();\n pos.right = pos.left + $trigger.outerWidth();\n pos.bottom = pos.top + $trigger.outerHeight();\n\n if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) {\n /* Additional hover check after short time, you might just miss the edge of the menu */\n setTimeout(function () {\n if (!opt.hovering && opt.$menu !== null && typeof opt.$menu !== 'undefined') {\n opt.$menu.trigger('contextmenu:hide');\n }\n }, 50);\n }\n });\n }\n },\n hide: function (opt, force) {\n var $trigger = $(this);\n if (!opt) {\n opt = $trigger.data('contextMenu') || {};\n }\n\n // hide event\n if (!force && opt.events && opt.events.hide.call($trigger, opt) === false) {\n return;\n }\n\n // remove options and revert state\n $trigger\n .removeData('contextMenu')\n .removeClass('context-menu-active');\n\n if (opt.$layer) {\n // keep layer for a bit so the contextmenu event can be aborted properly by opera\n setTimeout((function ($layer) {\n return function () {\n $layer.remove();\n };\n })(opt.$layer), 10);\n\n try {\n delete opt.$layer;\n } catch (e) {\n opt.$layer = null;\n }\n }\n\n // remove handle\n $currentTrigger = null;\n // remove selected\n opt.$menu.find('.' + opt.classNames.hover).trigger('contextmenu:blur');\n opt.$selected = null;\n // collapse all submenus\n opt.$menu.find('.' + opt.classNames.visible).removeClass(opt.classNames.visible);\n // unregister key and mouse handlers\n // $(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705\n $(document).off('.contextMenuAutoHide').off('keydown.contextMenu');\n // hide menu\n if (opt.$menu) {\n opt.$menu[opt.animation.hide](opt.animation.duration, function () {\n // tear down dynamically built menu after animation is completed.\n if (opt.build) {\n opt.$menu.remove();\n $.each(opt, function (key) {\n switch (key) {\n case 'ns':\n case 'selector':\n case 'build':\n case 'trigger':\n return true;\n\n default:\n opt[key] = undefined;\n try {\n delete opt[key];\n } catch (e) {\n }\n return true;\n }\n });\n }\n\n setTimeout(function () {\n $trigger.trigger('contextmenu:hidden');\n }, 10);\n });\n }\n },\n create: function (opt, root) {\n if (typeof root === 'undefined') {\n root = opt;\n }\n\n // create contextMenu\n opt.$menu = $('
    ').addClass(opt.className || '').data({\n 'contextMenu': opt,\n 'contextMenuRoot': root\n });\n\n $.each(['callbacks', 'commands', 'inputs'], function (i, k) {\n opt[k] = {};\n if (!root[k]) {\n root[k] = {};\n }\n });\n\n if (!root.accesskeys) {\n root.accesskeys = {};\n }\n\n function createNameNode(item) {\n var $name = $('');\n if (item._accesskey) {\n if (item._beforeAccesskey) {\n $name.append(document.createTextNode(item._beforeAccesskey));\n }\n $('')\n .addClass('context-menu-accesskey')\n .text(item._accesskey)\n .appendTo($name);\n if (item._afterAccesskey) {\n $name.append(document.createTextNode(item._afterAccesskey));\n }\n } else {\n if (item.isHtmlName) {\n // restrict use with access keys\n if (typeof item.accesskey !== 'undefined') {\n throw new Error('accesskeys are not compatible with HTML names and cannot be used together in the same item');\n }\n $name.html(item.name);\n } else {\n $name.text(item.name);\n }\n }\n return $name;\n }\n\n // create contextMenu items\n $.each(opt.items, function (key, item) {\n var $t = $('
  • ').addClass(item.className || ''),\n $label = null,\n $input = null;\n\n // iOS needs to see a click-event bound to an element to actually\n // have the TouchEvents infrastructure trigger the click event\n $t.on('click', $.noop);\n\n // Make old school string seperator a real item so checks wont be\n // akward later.\n // And normalize 'cm_separator' into 'cm_seperator'.\n if (typeof item === 'string' || item.type === 'cm_separator') {\n item = {type: 'cm_seperator'};\n }\n\n item.$node = $t.data({\n 'contextMenu': opt,\n 'contextMenuRoot': root,\n 'contextMenuKey': key\n });\n\n // register accesskey\n // NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that\n if (typeof item.accesskey !== 'undefined') {\n var aks = splitAccesskey(item.accesskey);\n for (var i = 0, ak; ak = aks[i]; i++) {\n if (!root.accesskeys[ak]) {\n root.accesskeys[ak] = item;\n var matched = item.name.match(new RegExp('^(.*?)(' + ak + ')(.*)$', 'i'));\n if (matched) {\n item._beforeAccesskey = matched[1];\n item._accesskey = matched[2];\n item._afterAccesskey = matched[3];\n }\n break;\n }\n }\n }\n\n if (item.type && types[item.type]) {\n // run custom type handler\n types[item.type].call($t, item, opt, root);\n // register commands\n $.each([opt, root], function (i, k) {\n k.commands[key] = item;\n // Overwrite only if undefined or the item is appended to the root. This so it\n // doesn't overwrite callbacks of root elements if the name is the same.\n if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {\n k.callbacks[key] = item.callback;\n }\n });\n } else {\n // add label for input\n if (item.type === 'cm_seperator') {\n $t.addClass('context-menu-separator ' + root.classNames.notSelectable);\n } else if (item.type === 'html') {\n $t.addClass('context-menu-html ' + root.classNames.notSelectable);\n } else if (item.type === 'sub') {\n // We don't want to execute the next else-if if it is a sub.\n } else if (item.type) {\n $label = $('').appendTo($t);\n createNameNode(item).appendTo($label);\n\n $t.addClass('context-menu-input');\n opt.hasTypes = true;\n $.each([opt, root], function (i, k) {\n k.commands[key] = item;\n k.inputs[key] = item;\n });\n } else if (item.items) {\n item.type = 'sub';\n }\n\n switch (item.type) {\n case 'cm_seperator':\n break;\n\n case 'text':\n $input = $('')\n .attr('name', 'context-menu-input-' + key)\n .val(item.value || '')\n .appendTo($label);\n break;\n\n case 'textarea':\n $input = $('')\n .attr('name', 'context-menu-input-' + key)\n .val(item.value || '')\n .appendTo($label);\n\n if (item.height) {\n $input.height(item.height);\n }\n break;\n\n case 'checkbox':\n $input = $('')\n .attr('name', 'context-menu-input-' + key)\n .val(item.value || '')\n .prop('checked', !!item.selected)\n .prependTo($label);\n break;\n\n case 'radio':\n $input = $('')\n .attr('name', 'context-menu-input-' + item.radio)\n .val(item.value || '')\n .prop('checked', !!item.selected)\n .prependTo($label);\n break;\n\n case 'select':\n $input = $('')\n .attr('name', 'context-menu-input-' + key)\n .appendTo($label);\n if (item.options) {\n $.each(item.options, function (value, text) {\n $('').val(value).text(text).appendTo($input);\n });\n $input.val(item.selected);\n }\n break;\n\n case 'sub':\n createNameNode(item).appendTo($t);\n item.appendTo = item.$node;\n $t.data('contextMenu', item).addClass('context-menu-submenu');\n item.callback = null;\n\n // If item contains items, and this is a promise, we should create it later\n // check if subitems is of type promise. If it is a promise we need to create\n // it later, after promise has been resolved.\n if ('function' === typeof item.items.then) {\n // probably a promise, process it, when completed it will create the sub menu's.\n op.processPromises(item, root, item.items);\n } else {\n // normal submenu.\n op.create(item, root);\n }\n break;\n\n case 'html':\n $(item.html).appendTo($t);\n break;\n\n default:\n $.each([opt, root], function (i, k) {\n k.commands[key] = item;\n // Overwrite only if undefined or the item is appended to the root. This so it\n // doesn't overwrite callbacks of root elements if the name is the same.\n if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {\n k.callbacks[key] = item.callback;\n }\n });\n createNameNode(item).appendTo($t);\n break;\n }\n\n // disable key listener in \n if (item.type && item.type !== 'sub' && item.type !== 'html' && item.type !== 'cm_seperator') {\n $input\n .on('focus', handle.focusInput)\n .on('blur', handle.blurInput);\n\n if (item.events) {\n $input.on(item.events, opt);\n }\n }\n\n // add icons\n if (item.icon) {\n if ($.isFunction(item.icon)) {\n item._icon = item.icon.call(this, this, $t, key, item);\n } else {\n if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') {\n // to enable font awesome\n item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon;\n } else {\n item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;\n }\n }\n $t.addClass(item._icon);\n }\n }\n\n // cache contained elements\n item.$input = $input;\n item.$label = $label;\n\n // attach item to menu\n $t.appendTo(opt.$menu);\n\n // Disable text selection\n if (!opt.hasTypes && $.support.eventSelectstart) {\n // browsers support user-select: none,\n // IE has a special event for text-selection\n // browsers supporting neither will not be preventing text-selection\n $t.on('selectstart.disableTextSelect', handle.abortevent);\n }\n });\n // attach contextMenu to (to bypass any possible overflow:hidden issues on parents of the trigger element)\n if (!opt.$node) {\n opt.$menu.css('display', 'none').addClass('context-menu-root');\n }\n opt.$menu.appendTo(opt.appendTo || document.body);\n },\n resize: function ($menu, nested) {\n var domMenu;\n // determine widths of submenus, as CSS won't grow them automatically\n // position:absolute within position:absolute; min-width:100; max-width:200; results in width: 100;\n // kinda sucks hard...\n\n // determine width of absolutely positioned element\n $menu.css({position: 'absolute', display: 'block'});\n // don't apply yet, because that would break nested elements' widths\n $menu.data('width',\n (domMenu = $menu.get(0)).getBoundingClientRect ?\n Math.ceil(domMenu.getBoundingClientRect().width) :\n $menu.outerWidth() + 1); // outerWidth() returns rounded pixels\n // reset styles so they allow nested elements to grow/shrink naturally\n $menu.css({\n position: 'static',\n minWidth: '0px',\n maxWidth: '100000px'\n });\n // identify width of nested menus\n $menu.find('> li > ul').each(function () {\n op.resize($(this), true);\n });\n // reset and apply changes in the end because nested\n // elements' widths wouldn't be calculatable otherwise\n if (!nested) {\n $menu.find('ul').addBack().css({\n position: '',\n display: '',\n minWidth: '',\n maxWidth: ''\n }).outerWidth(function () {\n return $(this).data('width');\n });\n }\n },\n update: function (opt, root) {\n var $trigger = this;\n if (typeof root === 'undefined') {\n root = opt;\n op.resize(opt.$menu);\n }\n // re-check disabled for each item\n opt.$menu.children().each(function () {\n var $item = $(this),\n key = $item.data('contextMenuKey'),\n item = opt.items[key],\n disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true,\n visible;\n if ($.isFunction(item.visible)) {\n visible = item.visible.call($trigger, key, root);\n } else if (typeof item.visible !== 'undefined') {\n visible = item.visible === true;\n } else {\n visible = true;\n }\n $item[visible ? 'show' : 'hide']();\n\n // dis- / enable item\n $item[disabled ? 'addClass' : 'removeClass'](root.classNames.disabled);\n\n if ($.isFunction(item.icon)) {\n $item.removeClass(item._icon);\n item._icon = item.icon.call(this, $trigger, $item, key, item);\n $item.addClass(item._icon);\n }\n\n if (item.type) {\n // dis- / enable input elements\n $item.find('input, select, textarea').prop('disabled', disabled);\n\n // update input states\n switch (item.type) {\n case 'text':\n case 'textarea':\n item.$input.val(item.value || '');\n break;\n\n case 'checkbox':\n case 'radio':\n item.$input.val(item.value || '').prop('checked', !!item.selected);\n break;\n\n case 'select':\n item.$input.val((item.selected === 0 ? \"0\" : item.selected) || '');\n break;\n }\n }\n\n if (item.$menu) {\n // update sub-menu\n op.update.call($trigger, item, root);\n }\n });\n },\n layer: function (opt, zIndex) {\n // add transparent layer for click area\n // filter and background for Internet Explorer, Issue #23\n var $layer = opt.$layer = $('
    ')\n .css({\n height: $win.height(),\n width: $win.width(),\n display: 'block',\n position: 'fixed',\n 'z-index': zIndex,\n top: 0,\n left: 0,\n opacity: 0,\n filter: 'alpha(opacity=0)',\n 'background-color': '#000'\n })\n .data('contextMenuRoot', opt)\n .insertBefore(this)\n .on('contextmenu', handle.abortevent)\n .on('mousedown', handle.layerClick);\n\n // IE6 doesn't know position:fixed;\n if (typeof document.body.style.maxWidth === 'undefined') { // IE6 doesn't support maxWidth\n $layer.css({\n 'position': 'absolute',\n 'height': $(document).height()\n });\n }\n\n return $layer;\n },\n processPromises: function (opt, root, promise) {\n // Start\n opt.$node.addClass(root.classNames.iconLoadingClass);\n\n function completedPromise(opt, root, items) {\n // Completed promise (dev called promise.resolve). We now have a list of items which can\n // be used to create the rest of the context menu.\n if (typeof items === 'undefined') {\n // Null result, dev should have checked\n errorPromise(undefined);//own error object\n }\n finishPromiseProcess(opt, root, items);\n }\n\n function errorPromise(opt, root, errorItem) {\n // User called promise.reject() with an error item, if not, provide own error item.\n if (typeof errorItem === 'undefined') {\n errorItem = {\n \"error\": {\n name: \"No items and no error item\",\n icon: \"context-menu-icon context-menu-icon-quit\"\n }\n };\n if (window.console) {\n (console.error || console.log).call(console, 'When you reject a promise, provide an \"items\" object, equal to normal sub-menu items');\n }\n } else if (typeof errorItem === 'string') {\n errorItem = {\"error\": {name: errorItem}};\n }\n finishPromiseProcess(opt, root, errorItem);\n }\n\n function finishPromiseProcess(opt, root, items) {\n if (typeof root.$menu === 'undefined' || !root.$menu.is(':visible')) {\n return;\n }\n opt.$node.removeClass(root.classNames.iconLoadingClass);\n opt.items = items;\n op.create(opt, root, true); // Create submenu\n op.update(opt, root); // Correctly update position if user is already hovered over menu item\n root.positionSubmenu.call(opt.$node, opt.$menu); // positionSubmenu, will only do anything if user already hovered over menu item that just got new subitems.\n }\n\n // Wait for promise completion. .then(success, error, notify) (we don't track notify). Bind the opt\n // and root to avoid scope problems\n promise.then(completedPromise.bind(this, opt, root), errorPromise.bind(this, opt, root));\n },\n // operation that will run after contextMenu showed on screen\n activated: function(opt){\n var $menu = opt.$menu;\n var $menuOffset = $menu.offset();\n var winHeight = $(window).height();\n var winScrollTop = $(window).scrollTop();\n var menuHeight = $menu.height();\n if(menuHeight > winHeight){\n $menu.css({\n 'height' : winHeight + 'px',\n 'overflow-x': 'hidden',\n 'overflow-y': 'auto',\n 'top': winScrollTop + 'px'\n });\n } else if(($menuOffset.top < winScrollTop) || ($menuOffset.top + menuHeight > winScrollTop + winHeight)){\n $menu.css({\n 'top': '0px'\n });\n } \n }\n };\n\n // split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key\n function splitAccesskey(val) {\n var t = val.split(/\\s+/);\n var keys = [];\n\n for (var i = 0, k; k = t[i]; i++) {\n k = k.charAt(0).toUpperCase(); // first character only\n // theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it.\n // a map to look up already used access keys would be nice\n keys.push(k);\n }\n\n return keys;\n }\n\n// handle contextMenu triggers\n $.fn.contextMenu = function (operation) {\n var $t = this, $o = operation;\n if (this.length > 0) { // this is not a build on demand menu\n if (typeof operation === 'undefined') {\n this.first().trigger('contextmenu');\n } else if (typeof operation.x !== 'undefined' && typeof operation.y !== 'undefined') {\n this.first().trigger($.Event('contextmenu', {\n pageX: operation.x,\n pageY: operation.y,\n mouseButton: operation.button\n }));\n } else if (operation === 'hide') {\n var $menu = this.first().data('contextMenu') ? this.first().data('contextMenu').$menu : null;\n if ($menu) {\n $menu.trigger('contextmenu:hide');\n }\n } else if (operation === 'destroy') {\n $.contextMenu('destroy', {context: this});\n } else if ($.isPlainObject(operation)) {\n operation.context = this;\n $.contextMenu('create', operation);\n } else if (operation) {\n this.removeClass('context-menu-disabled');\n } else if (!operation) {\n this.addClass('context-menu-disabled');\n }\n } else {\n $.each(menus, function () {\n if (this.selector === $t.selector) {\n $o.data = this;\n\n $.extend($o.data, {trigger: 'demand'});\n }\n });\n\n handle.contextmenu.call($o.target, $o);\n }\n\n return this;\n };\n\n // manage contextMenu instances\n $.contextMenu = function (operation, options) {\n if (typeof operation !== 'string') {\n options = operation;\n operation = 'create';\n }\n\n if (typeof options === 'string') {\n options = {selector: options};\n } else if (typeof options === 'undefined') {\n options = {};\n }\n\n // merge with default options\n var o = $.extend(true, {}, defaults, options || {});\n var $document = $(document);\n var $context = $document;\n var _hasContext = false;\n\n if (!o.context || !o.context.length) {\n o.context = document;\n } else {\n // you never know what they throw at you...\n $context = $(o.context).first();\n o.context = $context.get(0);\n _hasContext = !$(o.context).is(document);\n }\n\n switch (operation) {\n\n case 'update':\n // Updates visibility and such\n if(_hasContext){\n op.update($context);\n } else {\n for(var menu in menus){\n if(menus.hasOwnProperty(menu)){\n op.update(menus[menu]);\n }\n }\n }\n break;\n\n case 'create':\n // no selector no joy\n if (!o.selector) {\n throw new Error('No selector specified');\n }\n // make sure internal classes are not bound to\n if (o.selector.match(/.context-menu-(list|item|input)($|\\s)/)) {\n throw new Error('Cannot bind to selector \"' + o.selector + '\" as it contains a reserved className');\n }\n if (!o.build && (!o.items || $.isEmptyObject(o.items))) {\n throw new Error('No Items specified');\n }\n counter++;\n o.ns = '.contextMenu' + counter;\n if (!_hasContext) {\n namespaces[o.selector] = o.ns;\n }\n menus[o.ns] = o;\n\n // default to right click\n if (!o.trigger) {\n o.trigger = 'right';\n }\n\n if (!initialized) {\n var itemClick = o.itemClickEvent === 'click' ? 'click.contextMenu' : 'mouseup.contextMenu';\n var contextMenuItemObj = {\n // 'mouseup.contextMenu': handle.itemClick,\n // 'click.contextMenu': handle.itemClick,\n 'contextmenu:focus.contextMenu': handle.focusItem,\n 'contextmenu:blur.contextMenu': handle.blurItem,\n 'contextmenu.contextMenu': handle.abortevent,\n 'mouseenter.contextMenu': handle.itemMouseenter,\n 'mouseleave.contextMenu': handle.itemMouseleave\n };\n contextMenuItemObj[itemClick] = handle.itemClick;\n // make sure item click is registered first\n $document\n .on({\n 'contextmenu:hide.contextMenu': handle.hideMenu,\n 'prevcommand.contextMenu': handle.prevItem,\n 'nextcommand.contextMenu': handle.nextItem,\n 'contextmenu.contextMenu': handle.abortevent,\n 'mouseenter.contextMenu': handle.menuMouseenter,\n 'mouseleave.contextMenu': handle.menuMouseleave\n }, '.context-menu-list')\n .on('mouseup.contextMenu', '.context-menu-input', handle.inputClick)\n .on(contextMenuItemObj, '.context-menu-item');\n\n initialized = true;\n }\n\n // engage native contextmenu event\n $context\n .on('contextmenu' + o.ns, o.selector, o, handle.contextmenu);\n\n if (_hasContext) {\n // add remove hook, just in case\n $context.on('remove' + o.ns, function () {\n $(this).contextMenu('destroy');\n });\n }\n\n switch (o.trigger) {\n case 'hover':\n $context\n .on('mouseenter' + o.ns, o.selector, o, handle.mouseenter)\n .on('mouseleave' + o.ns, o.selector, o, handle.mouseleave);\n break;\n\n case 'left':\n $context.on('click' + o.ns, o.selector, o, handle.click);\n break;\n\t\t\t\t case 'touchstart':\n $context.on('touchstart' + o.ns, o.selector, o, handle.click);\n break;\n /*\n default:\n // http://www.quirksmode.org/dom/events/contextmenu.html\n $document\n .on('mousedown' + o.ns, o.selector, o, handle.mousedown)\n .on('mouseup' + o.ns, o.selector, o, handle.mouseup);\n break;\n */\n }\n\n // create menu\n if (!o.build) {\n op.create(o);\n }\n break;\n\n case 'destroy':\n var $visibleMenu;\n if (_hasContext) {\n // get proper options\n var context = o.context;\n $.each(menus, function (ns, o) {\n\n if (!o) {\n return true;\n }\n\n // Is this menu equest to the context called from\n if (!$(context).is(o.selector)) {\n return true;\n }\n\n $visibleMenu = $('.context-menu-list').filter(':visible');\n if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is($(o.context).find(o.selector))) {\n $visibleMenu.trigger('contextmenu:hide', {force: true});\n }\n\n try {\n if (menus[o.ns].$menu) {\n menus[o.ns].$menu.remove();\n }\n\n delete menus[o.ns];\n } catch (e) {\n menus[o.ns] = null;\n }\n\n $(o.context).off(o.ns);\n\n return true;\n });\n } else if (!o.selector) {\n $document.off('.contextMenu .contextMenuAutoHide');\n $.each(menus, function (ns, o) {\n $(o.context).off(o.ns);\n });\n\n namespaces = {};\n menus = {};\n counter = 0;\n initialized = false;\n\n $('#context-menu-layer, .context-menu-list').remove();\n } else if (namespaces[o.selector]) {\n $visibleMenu = $('.context-menu-list').filter(':visible');\n if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) {\n $visibleMenu.trigger('contextmenu:hide', {force: true});\n }\n\n try {\n if (menus[namespaces[o.selector]].$menu) {\n menus[namespaces[o.selector]].$menu.remove();\n }\n\n delete menus[namespaces[o.selector]];\n } catch (e) {\n menus[namespaces[o.selector]] = null;\n }\n\n $document.off(namespaces[o.selector]);\n }\n break;\n\n case 'html5':\n // if and are not handled by the browser,\n // or options was a bool true,\n // initialize $.contextMenu for them\n if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options === 'boolean' && options)) {\n $('menu[type=\"context\"]').each(function () {\n if (this.id) {\n $.contextMenu({\n selector: '[contextmenu=' + this.id + ']',\n items: $.contextMenu.fromMenu(this)\n });\n }\n }).css('display', 'none');\n }\n break;\n\n default:\n throw new Error('Unknown operation \"' + operation + '\"');\n }\n\n return this;\n };\n\n// import values into commands\n $.contextMenu.setInputValues = function (opt, data) {\n if (typeof data === 'undefined') {\n data = {};\n }\n\n $.each(opt.inputs, function (key, item) {\n switch (item.type) {\n case 'text':\n case 'textarea':\n item.value = data[key] || '';\n break;\n\n case 'checkbox':\n item.selected = data[key] ? true : false;\n break;\n\n case 'radio':\n item.selected = (data[item.radio] || '') === item.value;\n break;\n\n case 'select':\n item.selected = data[key] || '';\n break;\n }\n });\n };\n\n// export values from commands\n $.contextMenu.getInputValues = function (opt, data) {\n if (typeof data === 'undefined') {\n data = {};\n }\n\n $.each(opt.inputs, function (key, item) {\n switch (item.type) {\n case 'text':\n case 'textarea':\n case 'select':\n data[key] = item.$input.val();\n break;\n\n case 'checkbox':\n data[key] = item.$input.prop('checked');\n break;\n\n case 'radio':\n if (item.$input.prop('checked')) {\n data[item.radio] = item.value;\n }\n break;\n }\n });\n\n return data;\n };\n\n// find