{"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","classNames","hover","visible","notSelectable","iconEdit","iconCut","iconCopy","iconPaste","iconDelete","iconAdd","iconQuit","determinePosition","$menu","position","css","my","at","of","offset","collision","top","outerHeight","left","outerWidth","opt","x","y","call","bottom","scrollTop","height","right","scrollLeft","width","positionSubmenu","zIndex","animation","duration","show","hide","noop","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","menuContainer","srcElement","target","originalTarget","offsetX","offsetY","Event","mousedown","is","button","mouseup","removeData","mouseenter","$related","relatedTarget","$document","closest","on","mousemove","setTimeout","off","mouseleave","clearTimeout","layerClick","root","$window","triggerAction","elementFromPoint","$layer","has","one","contextMenu","keyStop","isInput","stopPropagation","key","targetZIndex","getZIndexOfTriggerTarget","style","offsetParent","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","className","$label","accesskey","ak","aks","matched","match","RegExp","commands","hasTypes","inputs","prependTo","_icon","body","resize","nested","display","ceil","minWidth","maxWidth","addBack","$item","insertBefore","fn","operation","$o","context","isPlainObject","o","$context","_hasContext","ns","contextmenu:hide.contextMenu","prevcommand.contextMenu","nextcommand.contextMenu","contextmenu.contextMenu","mouseenter.contextMenu","mouseleave.contextMenu","mouseup.contextMenu","contextmenu:focus.contextMenu","contextmenu:blur.contextMenu","$visibleMenu","fromMenu","setInputValues","getInputValues","element"],"mappings":";;;;;;;;;;;;;;;;CAiBA,SAAWA,GACe,kBAAXC,SAAyBA,OAAOC,IAEvCD,QAAQ,UAAWD,GAGnBA,EAF0B,gBAAZG,SAENC,QAAQ,UAGRC,SAEb,SAAUC,GAET,YAu1CA,SAASC,GAAeC,GAIpB,IAAK,GAAWC,GAHZC,EAAIF,EAAIG,MAAM,OACdC,KAEKC,EAAI,EAAMJ,EAAIC,EAAEG,GAAIA,IACzBJ,EAAIA,EAAEK,OAAO,GAAGC,cAGhBH,EAAKI,KAAKP,EAGd,OAAOG,GAySX,QAASK,GAAWC,GAChB,MAAQA,GAAKC,IAAMb,EAAE,cAAgBY,EAAKC,GAAK,MAAMX,OAAUU,EAAKE,KAIxE,QAASC,GAAaC,EAAOC,EAAWC,GA2KpC,MA1KKA,KACDA,EAAU,GAGdD,EAAUE,KAAK,WACX,GAGIC,GACAC,EAJAC,EAAQtB,EAAEuB,MACVX,EAAOW,KACPC,EAAWD,KAAKC,SAASC,aAoB7B,QAfiB,UAAbD,GAAwBF,EAAMI,KAAK,2BAA2BC,SAC9DP,EAAQE,EAAMM,OACdN,EAAQA,EAAMO,WAAWC,QACzBlB,EAAOU,EAAMS,IAAI,GACjBP,EAAWZ,EAAKY,SAASC,eAWrBD,GAEJ,IAAK,OACDH,GAAQP,KAAMQ,EAAMU,KAAK,SAAUhB,UACnCE,EAAUH,EAAaM,EA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1K,GAC9B,OAAQA,EAAKiB,MACT,IAAK,OACL,IAAK,WACL,IAAK,SACDmG,EAAKsD,GAAO1K,EAAKiM,OAAOpN,KACxB,MAEJ,KAAK,WACDuI,EAAKsD,GAAO1K,EAAKiM,OAAOpF,KAAK,UAC7B,MAEJ,KAAK,QACG7G,EAAKiM,OAAOpF,KAAK,aACjBO,EAAKpH,EAAKmB,OAASnB,EAAKoB,UAMjCgG,GAwLXzI,EAAE2L,YAAY0G,SAAW,SAAUG,GAC/B,GAAIhK,GAAQxI,EAAEwS,GACVxR,IAIJ,OAFAD,GAAaC,EAAOwH,EAAM3G,YAEnBb,GAIXhB,EAAE2L,YAAYtH,SAAWA,EACzBrE,EAAE2L,YAAYvH,MAAQA,EAEtBpE,EAAE2L,YAAYxD,OAASA,EACvBnI,EAAE2L,YAAYrC,GAAKA,EACnBtJ,EAAE2L,YAAYxH,MAAQA","file":"jquery.contextMenu.min.js","sourcesContent":["/*!\n * jQuery contextMenu v2.1.0 - Plugin for simple contextMenu handling\n *\n * Version: v2.1.0\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-2016 SWIS BV and contributors\n *\n * Licensed under\n * MIT License http://www.opensource.org/licenses/mit-license\n * GPL v3 http://opensource.org/licenses/GPL-3.0\n *\n * Date: 2016-02-28T09:41:24.636Z\n */\n\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 /* jshint ignore:start */\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 orig(elems);\n };\n })($.cleanData);\n }\n /* jshint ignore:end */\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\n // Default classname configuration to be able avoid conflicts in frameworks\n classNames : {\n\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 },\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 offset = {top: y, left: x};\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 ($.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',\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: 0,\n left: this.outerWidth()\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 },\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 (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 item.visible !== 'undefined') {\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\t\t var menuContainer = (e.data.appendTo === null ? $('body') : $(e.data.appendTo));\n\t\t var srcElement = e.target || e.srcElement || e.originalTarget;\n if (e.offsetX !== undefined && e.offsetY !== undefined) {\n op.show.call($this, e.data,\n $(srcElement).offset().left - menuContainer.offset().left + e.offsetX,\n $(srcElement).offset().top - menuContainer.offset().top + e.offsetY);\n } else {\n op.show.call($this, e.data, e.pageX, e.pageY);\n }\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 e.stopImmediatePropagation();\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 root.$layer.show();\n }\n\n if (root.reposition && triggerAction) {\n if (document.elementFromPoint) {\n if (root.$trigger.is(target) || root.$trigger.has(target).length) {\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 root.$menu.trigger('contextmenu:hide');\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 (opt.zIndex === undefined) {\n opt.zIndex = 0;\n\t\t\t\t}\n var targetZIndex = 0;\n var getZIndexOfTriggerTarget = function (target) {\n\t\t\t\t\tif (target.style.zIndex !== '') {\n\t\t\t\t\t\ttargetZIndex = target.style.zIndex;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (target.offsetParent !== null && target.offsetParent !== undefined) {\n\t\t\t\t\t\t\tgetZIndexOfTriggerTarget(target.offsetParent);\n\t\t\t\t\t\t} \n\t\t\t\t\t\telse if (target.parentElement !== null && target.parentElement !== undefined) {\n\t\t\t\t\t\t\tgetZIndexOfTriggerTarget(target.parentElement);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\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 (targetZIndex > opt.zIndex) {\n return;\n\t\t\t\t}\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 opt.$menu.trigger('prevcommand');\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 opt.$menu.trigger('prevcommand');\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 opt.$menu.trigger('nextcommand');\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 opt.$menu.trigger('nextcommand');\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 opt.$menu.trigger('contextmenu:hide');\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 $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 $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-submenu, .context-menu-separator, .' + root.classNames.notSelectable)) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n if ($.isFunction(root.callbacks[key]) && Object.prototype.hasOwnProperty.call(root.callbacks, key)) {\n // item-specific callback\n callback = root.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) !== 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 $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 // 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 // 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.trigger('contextmenu:hide'); }\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 (root === undefined) {\n root = opt;\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 $name.text(item.name);\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 if (typeof item === 'string') {\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 if ($.isFunction(item.callback)) {\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) {\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 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 item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;\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 // 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', Math.ceil($menu.outerWidth()));\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 (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 || '');\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({height: $win.height(), width: $win.width(), display: 'block'})\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 (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 };\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 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 (operation === undefined) {\n this.first().trigger('contextmenu');\n } else if (operation.x !== undefined && operation.y !== undefined) {\n this.first().trigger($.Event('contextmenu', { pageX: operation.x, pageY: operation.y, mouseButton: operation.button }));\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 (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 !== document;\n }\n\n switch (operation) {\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 // 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({\n 'mouseup.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 }, '.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 /*\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 if (o.context !== context) {\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 or 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 (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 (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