From b5ba010dfee76107209fba828245135ca2e5e674 Mon Sep 17 00:00:00 2001 From: bjorn Date: Tue, 10 Jul 2018 12:15:20 +0200 Subject: [PATCH] Add support for newer versions of Font Awesome, it now created an `` element when font-awesome 5 classes are detected. This also enabled creating a new element as return value for the `icon` callback for extra flexibility. Relates to issue #593 --- CHANGELOG.md | 6 ++++ dist/font/context-menu-icons.eot | Bin 3528 -> 3528 bytes dist/font/context-menu-icons.ttf | Bin 3320 -> 3320 bytes dist/font/context-menu-icons.woff | Bin 2180 -> 2180 bytes dist/font/context-menu-icons.woff2 | Bin 1696 -> 1700 bytes dist/jquery.contextMenu.css | 23 +++++++++++-- dist/jquery.contextMenu.js | 42 ++++++++++++++++-------- dist/jquery.contextMenu.min.css | 4 +-- dist/jquery.contextMenu.min.css.map | 2 +- dist/jquery.contextMenu.min.js | 2 +- dist/jquery.contextMenu.min.js.map | 2 +- documentation/demo/fontawesome-icons.md | 2 +- documentation/docs/font-awesome.md | 4 +++ src/jquery.contextMenu.js | 40 +++++++++++++++------- src/sass/icons/_variables.scss | 2 +- src/sass/jquery.contextMenu.scss | 19 +++++++++++ test/unit/contextmenu.test.js | 11 +++++++ 17 files changed, 124 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c0003f..8aeabc53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Changelog ## +### Unreleased + +#### Added + +* Added support for Font Awesome 5 ([Issue #593](https://github.com/swisnl/jQuery-contextMenu/issues/593)), ([Issue #593](https://github.com/swisnl/jQuery-contextMenu/issues/593)) + ### 2.6.4 #### Fixed diff --git a/dist/font/context-menu-icons.eot b/dist/font/context-menu-icons.eot index 9a5e31301d2000b3ea73f87c8ddc943366397f42..ad9d5c1788c91d6fc8f0c0e253ae4d886655c996 100644 GIT binary patch delta 57 zcmX>heL{MI4U5mG#-9@%9heL{MI4NE}j)87*v9j0^@28~!@%%Pl8Ms*(K;YWN@N5{p`3mC~ FZUCd#78n2k diff --git a/dist/font/context-menu-icons.ttf b/dist/font/context-menu-icons.ttf index 4775bb4e946757ed928d5ff1452fd89c41fd16dd..687857ebd2ee94198672054253ca8ec47492bf33 100644 GIT binary patch delta 48 wcmew%`9pF-0E^)JEmtRoOp*E7_{k@p-{va=Hwyy@T+g!5fzg{;7{71>0N3&mi~s-t delta 48 wcmew%`9pF-0E@uh&%qNzrpWw$S{e|~Z}XLbn}q=cu3ZezhS8f@7{71>0M&sJivR!s diff --git a/dist/font/context-menu-icons.woff b/dist/font/context-menu-icons.woff index 71c473a08d34e5ce9b601f24872099631d5b83c8..15de0fb9d7f176066cb2d73999d490e6d3ca721e 100644 GIT binary patch delta 61 zcmV-D0K)%-5rh$tj06$ywAHbY)deV@jc2aJ^V@u7;AUX}f$LcoIxzbGum1;Fn3xX$ Txf~2kAW;Bk5e%TSjRyAtfi4>S delta 61 zcmV-D0K)%-5rh$tj06z9^HZ^q)deWuPyKJi^V@u7;AUX}fom7TvtjiAU;huVFfkth Tayb~7K%xMNJq{JKjRyAte*+sM diff --git a/dist/font/context-menu-icons.woff2 b/dist/font/context-menu-icons.woff2 index 24e2f102353a3371edc4f84fc57543f93169540e..19f3e1788b8a9c30981057d39b40daea5623a385 100644 GIT binary patch delta 1659 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 B9FG71 diff --git a/dist/jquery.contextMenu.css b/dist/jquery.contextMenu.css index 465d222e..d138e883 100644 --- a/dist/jquery.contextMenu.css +++ b/dist/jquery.contextMenu.css @@ -12,7 +12,7 @@ * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2018-03-16T11:13:46.072Z + * Date: 2018-07-10T10:17:15.670Z */ @-webkit-keyframes cm-spin { 0% { @@ -54,8 +54,8 @@ font-style: normal; font-weight: normal; - src: url("font/context-menu-icons.eot?1s39y"); - src: url("font/context-menu-icons.eot?1s39y#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?1s39y") format("woff2"), url("font/context-menu-icons.woff?1s39y") format("woff"), url("font/context-menu-icons.ttf?1s39y") format("truetype"); + src: url("font/context-menu-icons.eot?camk"); + src: url("font/context-menu-icons.eot?camk#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?camk") format("woff2"), url("font/context-menu-icons.woff?camk") format("woff"), url("font/context-menu-icons.ttf?camk") format("truetype"); } .context-menu-icon-add:before { @@ -157,6 +157,23 @@ color: #bbb; } +.context-menu-icon.context-menu-icon--fa5 { + display: list-item; + font-family: inherit; + line-height: inherit; +} +.context-menu-icon.context-menu-icon--fa5 i { + position: absolute; + left: .5em; + color: #2980b9; +} +.context-menu-icon.context-menu-icon--fa5.context-menu-hover i { + color: #fff; +} +.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i { + color: #bbb; +} + .context-menu-list { position: absolute; display: inline-block; diff --git a/dist/jquery.contextMenu.js b/dist/jquery.contextMenu.js index 30671bc7..da8fb6f9 100755 --- a/dist/jquery.contextMenu.js +++ b/dist/jquery.contextMenu.js @@ -11,7 +11,7 @@ * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2018-03-16T11:13:45.992Z + * Date: 2018-07-10T10:17:15.594Z */ // jscs:disable @@ -116,7 +116,7 @@ // flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu // as long as the trigger happened on one of the trigger-element's child nodes reposition: true, - // Flag denoting if a second trigger should close the menu, as long as + // Flag denoting if a second trigger should close the menu, as long as // the trigger happened on one of the trigger-element's child nodes. // This overrides the reposition option. hideOnSecondTrigger: false, @@ -466,12 +466,12 @@ $(target).trigger(e); root.$layer.show(); } - + if (root.hideOnSecondTrigger && triggerAction && root.$menu !== null && typeof root.$menu !== 'undefined') { root.$menu.trigger('contextmenu:hide'); return; } - + if (root.reposition && triggerAction) { if (document.elementFromPoint) { if (root.$trigger.is(target)) { @@ -1001,7 +1001,7 @@ // position and show context menu opt.$menu.css(css)[opt.animation.show](opt.animation.duration, function () { $trigger.trigger('contextmenu:visible'); - + op.activated(opt); opt.events.activated(opt); }); @@ -1213,9 +1213,7 @@ $t.addClass('context-menu-separator ' + root.classNames.notSelectable); } else if (item.type === 'html') { $t.addClass('context-menu-html ' + root.classNames.notSelectable); - } else if (item.type === 'sub') { - // We don't want to execute the next else-if if it is a sub. - } else if (item.type) { + } else if (item.type !== 'sub' && item.type) { $label = $('').appendTo($t); createNameNode(item).appendTo($label); @@ -1330,14 +1328,27 @@ if ($.isFunction(item.icon)) { item._icon = item.icon.call(this, this, $t, key, item); } else { - if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') { + if (typeof(item.icon) === 'string' && ( + item.icon.substring(0, 4) === 'fab ' + || item.icon.substring(0, 4) === 'fas ' + || item.icon.substring(0, 4) === 'far ' + || item.icon.substring(0, 4) === 'fal ') + ) { // to enable font awesome + $t.addClass(root.classNames.icon + ' ' + root.classNames.icon + '--fa5'); + item._icon = $(''); + } else if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') { item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon; } else { item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon; } } - $t.addClass(item._icon); + + if(typeof(item._icon) === "string"){ + $t.addClass(item._icon); + } else { + $t.prepend(item._icon); + } } } @@ -1433,8 +1444,13 @@ if ($.isFunction(item.icon)) { $item.removeClass(item._icon); - item._icon = item.icon.call(this, $trigger, $item, key, item); - $item.addClass(item._icon); + var iconResult = item.icon.call(this, $trigger, $item, key, item); + if(typeof(iconResult) === "string"){ + $item.addClass(iconResult); + } else { + $item.prepend(iconResult); + } + delete iconResult; } if (item.type) { @@ -1565,7 +1581,7 @@ $menu.css({ 'top': '0px' }); - } + } } }; diff --git a/dist/jquery.contextMenu.min.css b/dist/jquery.contextMenu.min.css index 26e144eb..f69469cf 100644 --- a/dist/jquery.contextMenu.min.css +++ b/dist/jquery.contextMenu.min.css @@ -11,6 +11,6 @@ * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2018-03-16T11:13:46.072Z - */@-webkit-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@-o-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@font-face{font-family:context-menu-icons;font-style:normal;font-weight:400;src:url(font/context-menu-icons.eot?1s39y);src:url(font/context-menu-icons.eot?1s39y#iefix) format("embedded-opentype"),url(font/context-menu-icons.woff2?1s39y) format("woff2"),url(font/context-menu-icons.woff?1s39y) format("woff"),url(font/context-menu-icons.ttf?1s39y) format("truetype")}.context-menu-icon-add:before{content:"\EA01"}.context-menu-icon-copy:before{content:"\EA02"}.context-menu-icon-cut:before{content:"\EA03"}.context-menu-icon-delete:before{content:"\EA04"}.context-menu-icon-edit:before{content:"\EA05"}.context-menu-icon-loading:before{content:"\EA06"}.context-menu-icon-paste:before{content:"\EA07"}.context-menu-icon-quit:before{content:"\EA08"}.context-menu-icon::before{position:absolute;top:50%;left:0;width:2em;font-family:context-menu-icons;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon-loading:before{-webkit-animation:cm-spin 2s infinite;-o-animation:cm-spin 2s infinite;animation:cm-spin 2s infinite}.context-menu-icon.context-menu-icon--fa{display:list-item;font-family:inherit;line-height:inherit}.context-menu-icon.context-menu-icon--fa::before{position:absolute;top:50%;left:0;width:2em;font-family:FontAwesome;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-icon--fa.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before{color:#bbb}.context-menu-list{position:absolute;display:inline-block;min-width:13em;max-width:26em;padding:.25em 0;margin:.3em;font-family:inherit;font-size:inherit;list-style-type:none;background:#fff;border:1px solid #bebebe;border-radius:.2em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.5);box-shadow:0 2px 5px rgba(0,0,0,.5)}.context-menu-item{position:relative;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;padding:.2em 2em;color:#2f2f2f;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}.context-menu-separator{padding:0;margin:.35em 0;border-bottom:1px solid #e6e6e6}.context-menu-item>label>input,.context-menu-item>label>textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.context-menu-item.context-menu-hover{color:#fff;cursor:pointer;background-color:#2980b9}.context-menu-item.context-menu-disabled{color:#bbb;cursor:default;background-color:#fff}.context-menu-input.context-menu-hover{color:#2f2f2f;cursor:default}.context-menu-submenu:after{position:absolute;top:50%;right:.5em;z-index:1;width:0;height:0;content:'';border-color:transparent transparent transparent #2f2f2f;border-style:solid;border-width:.25em 0 .25em .25em;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%)}.context-menu-item.context-menu-input{padding:.3em .6em}.context-menu-input>label>*{vertical-align:top}.context-menu-input>label>input[type=checkbox],.context-menu-input>label>input[type=radio]{position:relative;top:.12em;margin-right:.4em}.context-menu-input>label{margin:0}.context-menu-input>label,.context-menu-input>label>input[type=text],.context-menu-input>label>select,.context-menu-input>label>textarea{display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.context-menu-input>label>textarea{height:7em}.context-menu-item>.context-menu-list{top:.3em;right:-.3em;display:none}.context-menu-item.context-menu-visible>.context-menu-list{display:block}.context-menu-accesskey{text-decoration:underline} + * Date: 2018-07-10T10:17:15.670Z + */@-webkit-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@-o-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@font-face{font-family:context-menu-icons;font-style:normal;font-weight:400;src:url(font/context-menu-icons.eot?camk);src:url(font/context-menu-icons.eot?camk#iefix) format("embedded-opentype"),url(font/context-menu-icons.woff2?camk) format("woff2"),url(font/context-menu-icons.woff?camk) format("woff"),url(font/context-menu-icons.ttf?camk) format("truetype")}.context-menu-icon-add:before{content:"\EA01"}.context-menu-icon-copy:before{content:"\EA02"}.context-menu-icon-cut:before{content:"\EA03"}.context-menu-icon-delete:before{content:"\EA04"}.context-menu-icon-edit:before{content:"\EA05"}.context-menu-icon-loading:before{content:"\EA06"}.context-menu-icon-paste:before{content:"\EA07"}.context-menu-icon-quit:before{content:"\EA08"}.context-menu-icon::before{position:absolute;top:50%;left:0;width:2em;font-family:context-menu-icons;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon-loading:before{-webkit-animation:cm-spin 2s infinite;-o-animation:cm-spin 2s infinite;animation:cm-spin 2s infinite}.context-menu-icon.context-menu-icon--fa{display:list-item;font-family:inherit;line-height:inherit}.context-menu-icon.context-menu-icon--fa::before{position:absolute;top:50%;left:0;width:2em;font-family:FontAwesome;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-icon--fa.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon--fa5{display:list-item;font-family:inherit;line-height:inherit}.context-menu-icon.context-menu-icon--fa5 i{position:absolute;left:.5em;color:#2980b9}.context-menu-icon.context-menu-icon--fa5.context-menu-hover i{color:#fff}.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i{color:#bbb}.context-menu-list{position:absolute;display:inline-block;min-width:13em;max-width:26em;padding:.25em 0;margin:.3em;font-family:inherit;font-size:inherit;list-style-type:none;background:#fff;border:1px solid #bebebe;border-radius:.2em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.5);box-shadow:0 2px 5px rgba(0,0,0,.5)}.context-menu-item{position:relative;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;padding:.2em 2em;color:#2f2f2f;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}.context-menu-separator{padding:0;margin:.35em 0;border-bottom:1px solid #e6e6e6}.context-menu-item>label>input,.context-menu-item>label>textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.context-menu-item.context-menu-hover{color:#fff;cursor:pointer;background-color:#2980b9}.context-menu-item.context-menu-disabled{color:#bbb;cursor:default;background-color:#fff}.context-menu-input.context-menu-hover{color:#2f2f2f;cursor:default}.context-menu-submenu:after{position:absolute;top:50%;right:.5em;z-index:1;width:0;height:0;content:'';border-color:transparent transparent transparent #2f2f2f;border-style:solid;border-width:.25em 0 .25em .25em;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%)}.context-menu-item.context-menu-input{padding:.3em .6em}.context-menu-input>label>*{vertical-align:top}.context-menu-input>label>input[type=checkbox],.context-menu-input>label>input[type=radio]{position:relative;top:.12em;margin-right:.4em}.context-menu-input>label{margin:0}.context-menu-input>label,.context-menu-input>label>input[type=text],.context-menu-input>label>select,.context-menu-input>label>textarea{display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.context-menu-input>label>textarea{height:7em}.context-menu-item>.context-menu-list{top:.3em;right:-.3em;display:none}.context-menu-item.context-menu-visible>.context-menu-list{display:block}.context-menu-accesskey{text-decoration:underline} /*# sourceMappingURL=jquery.contextMenu.min.css.map */ diff --git a/dist/jquery.contextMenu.min.css.map b/dist/jquery.contextMenu.min.css.map index 8446f931..56447a0c 100644 --- a/dist/jquery.contextMenu.min.css.map +++ b/dist/jquery.contextMenu.min.css.map @@ -1 +1 @@ -{"version":3,"sources":["jquery.contextMenu.css","jquery.contextMenu.min.css"],"names":[],"mappings":"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","file":"jquery.contextMenu.min.css","sourcesContent":["@charset \"UTF-8\";\n/*!\n * jQuery contextMenu - Plugin for simple contextMenu handling\n *\n * Version: v2.6.4\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-2018 SWIS BV and contributors\n *\n * Licensed under\n * MIT License http://www.opensource.org/licenses/mit-license\n *\n * Date: 2018-03-16T11:13:46.072Z\n */\n@keyframes cm-spin {\n 0% {\n -webkit-transform: translateY(-50%) rotate(0deg);\n transform: translateY(-50%) rotate(0deg); }\n 100% {\n -webkit-transform: translateY(-50%) rotate(359deg);\n transform: translateY(-50%) rotate(359deg); } }\n\n@font-face {\n font-family: \"context-menu-icons\";\n src: url(\"font/context-menu-icons.eot?1s39y\");\n src: url(\"font/context-menu-icons.eot?1s39y#iefix\") format(\"embedded-opentype\"), url(\"font/context-menu-icons.woff2?1s39y\") format(\"woff2\"), url(\"font/context-menu-icons.woff?1s39y\") format(\"woff\"), url(\"font/context-menu-icons.ttf?1s39y\") format(\"truetype\");\n font-weight: normal;\n font-style: normal; }\n\n.context-menu-icon-add:before {\n content: \"\\EA01\"; }\n\n.context-menu-icon-copy:before {\n content: \"\\EA02\"; }\n\n.context-menu-icon-cut:before {\n content: \"\\EA03\"; }\n\n.context-menu-icon-delete:before {\n content: \"\\EA04\"; }\n\n.context-menu-icon-edit:before {\n content: \"\\EA05\"; }\n\n.context-menu-icon-loading:before {\n content: \"\\EA06\"; }\n\n.context-menu-icon-paste:before {\n content: \"\\EA07\"; }\n\n.context-menu-icon-quit:before {\n content: \"\\EA08\"; }\n\n.context-menu-icon::before {\n color: #2980B9;\n font-family: \"context-menu-icons\";\n font-style: normal;\n font-weight: normal;\n font-size: 1em;\n left: 0;\n line-height: 1;\n position: absolute;\n text-align: center;\n top: 50%;\n transform: translateY(-50%);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n width: 2em; }\n\n.context-menu-icon.context-menu-hover:before {\n color: #FFF; }\n\n.context-menu-icon.context-menu-disabled::before {\n color: #bbbbbb; }\n\n.context-menu-icon.context-menu-icon-loading:before {\n animation: cm-spin 2s infinite; }\n\n.context-menu-icon.context-menu-icon--fa {\n display: list-item;\n font-family: inherit;\n line-height: inherit; }\n .context-menu-icon.context-menu-icon--fa::before {\n color: #2980B9;\n font-family: FontAwesome;\n font-style: normal;\n font-weight: normal;\n font-size: 1em;\n left: 0;\n line-height: 1;\n position: absolute;\n text-align: center;\n top: 50%;\n transform: translateY(-50%);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n width: 2em; }\n .context-menu-icon.context-menu-icon--fa.context-menu-hover:before {\n color: #FFF; }\n .context-menu-icon.context-menu-icon--fa.context-menu-disabled::before {\n color: #bbbbbb; }\n\n.context-menu-list {\n background: #FFF;\n border: 1px solid #bebebe;\n border-radius: 0.2em;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);\n display: inline-block;\n font-family: inherit;\n font-size: inherit;\n list-style-type: none;\n margin: 0.3em;\n max-width: 26em;\n min-width: 13em;\n padding: 0.25em 0;\n position: absolute; }\n\n.context-menu-item {\n background-color: #FFF;\n box-sizing: content-box;\n color: #2F2F2F;\n padding: 0.2em 2em;\n position: relative;\n user-select: none; }\n\n.context-menu-separator {\n border-bottom: 1px solid #e6e6e6;\n margin: 0.35em 0;\n padding: 0; }\n\n.context-menu-item > label > input,\n.context-menu-item > label > textarea {\n user-select: text; }\n\n.context-menu-item.context-menu-hover {\n background-color: #2980B9;\n color: #FFF;\n cursor: pointer; }\n\n.context-menu-item.context-menu-disabled {\n background-color: #FFF;\n color: #bbbbbb;\n cursor: default; }\n\n.context-menu-input.context-menu-hover {\n cursor: default;\n color: #2F2F2F; }\n\n.context-menu-submenu:after {\n content: '';\n border-style: solid;\n border-width: .25em 0 .25em .25em;\n border-color: transparent transparent transparent #2F2F2F;\n height: 0;\n position: absolute;\n right: .5em;\n top: 50%;\n transform: translateY(-50%);\n width: 0;\n z-index: 1; }\n\n/**\n * Inputs\n */\n.context-menu-item.context-menu-input {\n padding: .3em .6em; }\n\n/* vertically align inside labels */\n.context-menu-input > label > * {\n vertical-align: top; }\n\n/* position checkboxes and radios as icons */\n.context-menu-input > label > input[type=\"checkbox\"],\n.context-menu-input > label > input[type=\"radio\"] {\n margin-right: .4em;\n position: relative;\n top: .12em; }\n\n.context-menu-input > label {\n margin: 0; }\n\n.context-menu-input > label,\n.context-menu-input > label > input[type=\"text\"],\n.context-menu-input > label > textarea,\n.context-menu-input > label > select {\n box-sizing: border-box;\n display: block;\n width: 100%; }\n\n.context-menu-input > label > textarea {\n height: 7em; }\n\n.context-menu-item > .context-menu-list {\n display: none;\n /* re-positioned by js */\n right: -.3em;\n top: .3em; }\n\n.context-menu-item.context-menu-visible > .context-menu-list {\n display: block; }\n\n.context-menu-accesskey {\n text-decoration: underline; }\n","@charset \"UTF-8\";/*!\n * jQuery contextMenu - 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-2018 SWIS BV and contributors\n *\n * Licensed under\n * MIT License http://www.opensource.org/licenses/mit-license\n *\n * Date: 2018-03-16T11:08:31.415Z\n */@-webkit-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@-o-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@font-face{font-family:context-menu-icons;font-style:normal;font-weight:400;src:url(font/context-menu-icons.eot?4mls);src:url(font/context-menu-icons.eot?4mls#iefix) format(\"embedded-opentype\"),url(font/context-menu-icons.woff2?4mls) format(\"woff2\"),url(font/context-menu-icons.woff?4mls) format(\"woff\"),url(font/context-menu-icons.ttf?4mls) format(\"truetype\")}.context-menu-icon-add:before{content:\"\\EA01\"}.context-menu-icon-copy:before{content:\"\\EA02\"}.context-menu-icon-cut:before{content:\"\\EA03\"}.context-menu-icon-delete:before{content:\"\\EA04\"}.context-menu-icon-edit:before{content:\"\\EA05\"}.context-menu-icon-loading:before{content:\"\\EA06\"}.context-menu-icon-paste:before{content:\"\\EA07\"}.context-menu-icon-quit:before{content:\"\\EA08\"}.context-menu-icon::before{position:absolute;top:50%;left:0;width:2em;font-family:context-menu-icons;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon-loading:before{-webkit-animation:cm-spin 2s infinite;-o-animation:cm-spin 2s infinite;animation:cm-spin 2s infinite}.context-menu-icon.context-menu-icon--fa{display:list-item;font-family:inherit;line-height:inherit}.context-menu-icon.context-menu-icon--fa::before{position:absolute;top:50%;left:0;width:2em;font-family:FontAwesome;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-icon--fa.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before{color:#bbb}.context-menu-list{position:absolute;display:inline-block;min-width:13em;max-width:26em;padding:.25em 0;margin:.3em;font-family:inherit;font-size:inherit;list-style-type:none;background:#fff;border:1px solid #bebebe;border-radius:.2em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.5);box-shadow:0 2px 5px rgba(0,0,0,.5)}.context-menu-item{position:relative;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;padding:.2em 2em;color:#2f2f2f;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}.context-menu-separator{padding:0;margin:.35em 0;border-bottom:1px solid #e6e6e6}.context-menu-item>label>input,.context-menu-item>label>textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.context-menu-item.context-menu-hover{color:#fff;cursor:pointer;background-color:#2980b9}.context-menu-item.context-menu-disabled{color:#bbb;cursor:default;background-color:#fff}.context-menu-input.context-menu-hover{color:#2f2f2f;cursor:default}.context-menu-submenu:after{position:absolute;top:50%;right:.5em;z-index:1;width:0;height:0;content:'';border-color:transparent transparent transparent #2f2f2f;border-style:solid;border-width:.25em 0 .25em .25em;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%)}.context-menu-item.context-menu-input{padding:.3em .6em}.context-menu-input>label>*{vertical-align:top}.context-menu-input>label>input[type=checkbox],.context-menu-input>label>input[type=radio]{position:relative;top:.12em;margin-right:.4em}.context-menu-input>label{margin:0}.context-menu-input>label,.context-menu-input>label>input[type=text],.context-menu-input>label>select,.context-menu-input>label>textarea{display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.context-menu-input>label>textarea{height:7em}.context-menu-item>.context-menu-list{top:.3em;right:-.3em;display:none}.context-menu-item.context-menu-visible>.context-menu-list{display:block}.context-menu-accesskey{text-decoration:underline}\n/*# sourceMappingURL=jquery.contextMenu.min.css.map */\n"]} \ No newline at end of file +{"version":3,"sources":["jquery.contextMenu.css","jquery.contextMenu.min.css"],"names":[],"mappings":"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","file":"jquery.contextMenu.min.css","sourcesContent":["@charset \"UTF-8\";\n/*!\n * jQuery contextMenu - Plugin for simple contextMenu handling\n *\n * Version: v2.6.4\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-2018 SWIS BV and contributors\n *\n * Licensed under\n * MIT License http://www.opensource.org/licenses/mit-license\n *\n * Date: 2018-07-10T10:17:15.670Z\n */\n@keyframes cm-spin {\n 0% {\n -webkit-transform: translateY(-50%) rotate(0deg);\n transform: translateY(-50%) rotate(0deg); }\n 100% {\n -webkit-transform: translateY(-50%) rotate(359deg);\n transform: translateY(-50%) rotate(359deg); } }\n\n@font-face {\n font-family: \"context-menu-icons\";\n src: url(\"font/context-menu-icons.eot?camk\");\n src: url(\"font/context-menu-icons.eot?camk#iefix\") format(\"embedded-opentype\"), url(\"font/context-menu-icons.woff2?camk\") format(\"woff2\"), url(\"font/context-menu-icons.woff?camk\") format(\"woff\"), url(\"font/context-menu-icons.ttf?camk\") format(\"truetype\");\n font-weight: normal;\n font-style: normal; }\n\n.context-menu-icon-add:before {\n content: \"\\EA01\"; }\n\n.context-menu-icon-copy:before {\n content: \"\\EA02\"; }\n\n.context-menu-icon-cut:before {\n content: \"\\EA03\"; }\n\n.context-menu-icon-delete:before {\n content: \"\\EA04\"; }\n\n.context-menu-icon-edit:before {\n content: \"\\EA05\"; }\n\n.context-menu-icon-loading:before {\n content: \"\\EA06\"; }\n\n.context-menu-icon-paste:before {\n content: \"\\EA07\"; }\n\n.context-menu-icon-quit:before {\n content: \"\\EA08\"; }\n\n.context-menu-icon::before {\n color: #2980B9;\n font-family: \"context-menu-icons\";\n font-style: normal;\n font-weight: normal;\n font-size: 1em;\n left: 0;\n line-height: 1;\n position: absolute;\n text-align: center;\n top: 50%;\n transform: translateY(-50%);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n width: 2em; }\n\n.context-menu-icon.context-menu-hover:before {\n color: #FFF; }\n\n.context-menu-icon.context-menu-disabled::before {\n color: #bbbbbb; }\n\n.context-menu-icon.context-menu-icon-loading:before {\n animation: cm-spin 2s infinite; }\n\n.context-menu-icon.context-menu-icon--fa {\n display: list-item;\n font-family: inherit;\n line-height: inherit; }\n .context-menu-icon.context-menu-icon--fa::before {\n color: #2980B9;\n font-family: FontAwesome;\n font-style: normal;\n font-weight: normal;\n font-size: 1em;\n left: 0;\n line-height: 1;\n position: absolute;\n text-align: center;\n top: 50%;\n transform: translateY(-50%);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n width: 2em; }\n .context-menu-icon.context-menu-icon--fa.context-menu-hover:before {\n color: #FFF; }\n .context-menu-icon.context-menu-icon--fa.context-menu-disabled::before {\n color: #bbbbbb; }\n\n.context-menu-icon.context-menu-icon--fa5 {\n display: list-item;\n font-family: inherit;\n line-height: inherit; }\n .context-menu-icon.context-menu-icon--fa5 i {\n color: #2980B9;\n left: 0.5em;\n position: absolute; }\n .context-menu-icon.context-menu-icon--fa5.context-menu-hover i {\n color: #FFF; }\n .context-menu-icon.context-menu-icon--fa5.context-menu-disabled i {\n color: #bbbbbb; }\n\n.context-menu-list {\n background: #FFF;\n border: 1px solid #bebebe;\n border-radius: 0.2em;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);\n display: inline-block;\n font-family: inherit;\n font-size: inherit;\n list-style-type: none;\n margin: 0.3em;\n max-width: 26em;\n min-width: 13em;\n padding: 0.25em 0;\n position: absolute; }\n\n.context-menu-item {\n background-color: #FFF;\n box-sizing: content-box;\n color: #2F2F2F;\n padding: 0.2em 2em;\n position: relative;\n user-select: none; }\n\n.context-menu-separator {\n border-bottom: 1px solid #e6e6e6;\n margin: 0.35em 0;\n padding: 0; }\n\n.context-menu-item > label > input,\n.context-menu-item > label > textarea {\n user-select: text; }\n\n.context-menu-item.context-menu-hover {\n background-color: #2980B9;\n color: #FFF;\n cursor: pointer; }\n\n.context-menu-item.context-menu-disabled {\n background-color: #FFF;\n color: #bbbbbb;\n cursor: default; }\n\n.context-menu-input.context-menu-hover {\n cursor: default;\n color: #2F2F2F; }\n\n.context-menu-submenu:after {\n content: '';\n border-style: solid;\n border-width: .25em 0 .25em .25em;\n border-color: transparent transparent transparent #2F2F2F;\n height: 0;\n position: absolute;\n right: .5em;\n top: 50%;\n transform: translateY(-50%);\n width: 0;\n z-index: 1; }\n\n/**\n * Inputs\n */\n.context-menu-item.context-menu-input {\n padding: .3em .6em; }\n\n/* vertically align inside labels */\n.context-menu-input > label > * {\n vertical-align: top; }\n\n/* position checkboxes and radios as icons */\n.context-menu-input > label > input[type=\"checkbox\"],\n.context-menu-input > label > input[type=\"radio\"] {\n margin-right: .4em;\n position: relative;\n top: .12em; }\n\n.context-menu-input > label {\n margin: 0; }\n\n.context-menu-input > label,\n.context-menu-input > label > input[type=\"text\"],\n.context-menu-input > label > textarea,\n.context-menu-input > label > select {\n box-sizing: border-box;\n display: block;\n width: 100%; }\n\n.context-menu-input > label > textarea {\n height: 7em; }\n\n.context-menu-item > .context-menu-list {\n display: none;\n /* re-positioned by js */\n right: -.3em;\n top: .3em; }\n\n.context-menu-item.context-menu-visible > .context-menu-list {\n display: block; }\n\n.context-menu-accesskey {\n text-decoration: underline; }\n","@charset \"UTF-8\";/*!\n * jQuery contextMenu - Plugin for simple contextMenu handling\n *\n * Version: v2.6.4\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-2018 SWIS BV and contributors\n *\n * Licensed under\n * MIT License http://www.opensource.org/licenses/mit-license\n *\n * Date: 2018-07-10T10:08:34.534Z\n */@-webkit-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@-o-keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@keyframes cm-spin{0%{-webkit-transform:translateY(-50%) rotate(0);-o-transform:translateY(-50%) rotate(0);transform:translateY(-50%) rotate(0)}100%{-webkit-transform:translateY(-50%) rotate(359deg);-o-transform:translateY(-50%) rotate(359deg);transform:translateY(-50%) rotate(359deg)}}@font-face{font-family:context-menu-icons;font-style:normal;font-weight:400;src:url(font/context-menu-icons.eot?35qxa);src:url(font/context-menu-icons.eot?35qxa#iefix) format(\"embedded-opentype\"),url(font/context-menu-icons.woff2?35qxa) format(\"woff2\"),url(font/context-menu-icons.woff?35qxa) format(\"woff\"),url(font/context-menu-icons.ttf?35qxa) format(\"truetype\")}.context-menu-icon-add:before{content:\"\\EA01\"}.context-menu-icon-copy:before{content:\"\\EA02\"}.context-menu-icon-cut:before{content:\"\\EA03\"}.context-menu-icon-delete:before{content:\"\\EA04\"}.context-menu-icon-edit:before{content:\"\\EA05\"}.context-menu-icon-loading:before{content:\"\\EA06\"}.context-menu-icon-paste:before{content:\"\\EA07\"}.context-menu-icon-quit:before{content:\"\\EA08\"}.context-menu-icon::before{position:absolute;top:50%;left:0;width:2em;font-family:context-menu-icons;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon-loading:before{-webkit-animation:cm-spin 2s infinite;-o-animation:cm-spin 2s infinite;animation:cm-spin 2s infinite}.context-menu-icon.context-menu-icon--fa{display:list-item;font-family:inherit;line-height:inherit}.context-menu-icon.context-menu-icon--fa::before{position:absolute;top:50%;left:0;width:2em;font-family:FontAwesome;font-size:1em;font-style:normal;font-weight:400;line-height:1;color:#2980b9;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.context-menu-icon.context-menu-icon--fa.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon--fa5{display:list-item;font-family:inherit;line-height:inherit}.context-menu-icon.context-menu-icon--fa5 i{position:absolute;left:.5em;color:#2980b9}.context-menu-icon.context-menu-icon--fa5.context-menu-hover i{color:#fff}.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i{color:#bbb}.context-menu-list{position:absolute;display:inline-block;min-width:13em;max-width:26em;padding:.25em 0;margin:.3em;font-family:inherit;font-size:inherit;list-style-type:none;background:#fff;border:1px solid #bebebe;border-radius:.2em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.5);box-shadow:0 2px 5px rgba(0,0,0,.5)}.context-menu-item{position:relative;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;padding:.2em 2em;color:#2f2f2f;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}.context-menu-separator{padding:0;margin:.35em 0;border-bottom:1px solid #e6e6e6}.context-menu-item>label>input,.context-menu-item>label>textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.context-menu-item.context-menu-hover{color:#fff;cursor:pointer;background-color:#2980b9}.context-menu-item.context-menu-disabled{color:#bbb;cursor:default;background-color:#fff}.context-menu-input.context-menu-hover{color:#2f2f2f;cursor:default}.context-menu-submenu:after{position:absolute;top:50%;right:.5em;z-index:1;width:0;height:0;content:'';border-color:transparent transparent transparent #2f2f2f;border-style:solid;border-width:.25em 0 .25em .25em;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%)}.context-menu-item.context-menu-input{padding:.3em .6em}.context-menu-input>label>*{vertical-align:top}.context-menu-input>label>input[type=checkbox],.context-menu-input>label>input[type=radio]{position:relative;top:.12em;margin-right:.4em}.context-menu-input>label{margin:0}.context-menu-input>label,.context-menu-input>label>input[type=text],.context-menu-input>label>select,.context-menu-input>label>textarea{display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.context-menu-input>label>textarea{height:7em}.context-menu-item>.context-menu-list{top:.3em;right:-.3em;display:none}.context-menu-item.context-menu-visible>.context-menu-list{display:block}.context-menu-accesskey{text-decoration:underline}\n/*# sourceMappingURL=jquery.contextMenu.min.css.map */\n"]} \ No newline at end of file diff --git a/dist/jquery.contextMenu.min.js b/dist/jquery.contextMenu.min.js index 598f558a..6bed9db0 100755 --- a/dist/jquery.contextMenu.min.js +++ b/dist/jquery.contextMenu.min.js @@ -1,2 +1,2 @@ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(m){"use strict";var a;m.support.htmlMenuitem="HTMLMenuItemElement"in window,m.support.htmlCommand="HTMLCommandElement"in window,m.support.eventSelectstart="onselectstart"in document.documentElement,m.ui&&m.widget||(m.cleanData=(a=m.cleanData,function(e){var t,n,o;for(o=0;null!=e[o];o++){n=e[o];try{(t=m._data(n,"events"))&&t.remove&&m(n).triggerHandler("remove")}catch(e){}}a(e)}));var c=null,d=!1,p=m(window),f=0,h={},x={},v={},g={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,hideOnSecondTrigger:!1,selectableSubMenu:!1,classNames:{hover:"context-menu-hover",disabled:"context-menu-disabled",visible:"context-menu-visible",notSelectable:"context-menu-not-selectable",icon:"context-menu-icon",iconEdit:"context-menu-icon-edit",iconCut:"context-menu-icon-cut",iconCopy:"context-menu-icon-copy",iconPaste:"context-menu-icon-paste",iconDelete:"context-menu-icon-delete",iconAdd:"context-menu-icon-add",iconQuit:"context-menu-icon-quit",iconLoadingClass:"context-menu-icon-loading"},determinePosition:function(e){if(m.ui&&m.ui.position)e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none");else{var t=this.offset();t.top+=this.outerHeight(),t.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(t)}},position:function(e,t,n){var o;if(t||n){if("maintain"===t&&"maintain"===n)o=e.$menu.position();else{var a=e.$menu.offsetParent().offset();o={top:n-a.top,left:t-a.left}}var s=p.scrollTop()+p.height(),i=p.scrollLeft()+p.width(),c=e.$menu.outerHeight(),l=e.$menu.outerWidth();o.top+c>s&&(o.top-=c),o.top<0&&(o.top=0),o.left+l>i&&(o.left-=l),o.left<0&&(o.left=0),e.$menu.css(o)}else e.determinePosition.call(this,e.$menu)},positionSubmenu:function(e){if(void 0!==e)if(m.ui&&m.ui.position)e.css("display","block").position({my:"left top-5",at:"right top",of:this,collision:"flipfit fit"}).css("display","");else{var t={top:-9,left:this.outerWidth()-5};e.css(t)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:m.noop,hide:m.noop,activated:m.noop},callback:null,items:{}},s={timer:null,pageX:null,pageY:null},b={abortevent:function(e){e.preventDefault(),e.stopImmediatePropagation()},contextmenu:function(e){var t=m(this);if("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled"))){if(c=t,e.data.build){var n=e.data.build(c,e);if(!1===n)return;if(e.data=m.extend(!0,{},g,e.data,n||{}),!e.data.items||m.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log).call(console,"No items specified to show in contextMenu"),new Error("No Items specified");e.data.$trigger=c,$.create(e.data)}$.show.call(t,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),m(this).trigger(m.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var t=m(this);c&&c.length&&!c.is(t)&&c.data("contextMenu").$menu.trigger("contextmenu:hide"),2===e.button&&(c=t.data("contextMenuActive",!0))},mouseup:function(e){var t=m(this);t.data("contextMenuActive")&&c&&c.length&&c.is(t)&&!t.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),(c=t).trigger(m.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),t.removeData("contextMenuActive")},mouseenter:function(e){var t=m(this),n=m(e.relatedTarget),o=m(document);n.is(".context-menu-list")||n.closest(".context-menu-list").length||c&&c.length||(s.pageX=e.pageX,s.pageY=e.pageY,s.data=e.data,o.on("mousemove.contextMenuShow",b.mousemove),s.timer=setTimeout(function(){s.timer=null,o.off("mousemove.contextMenuShow"),(c=t).trigger(m.Event("contextmenu",{data:s.data,pageX:s.pageX,pageY:s.pageY}))},e.data.delay))},mousemove:function(e){s.pageX=e.pageX,s.pageY=e.pageY},mouseleave:function(e){var t=m(e.relatedTarget);if(!t.is(".context-menu-list")&&!t.closest(".context-menu-list").length){try{clearTimeout(s.timer)}catch(e){}s.timer=null}},layerClick:function(a){var s,i,c=m(this).data("contextMenuRoot"),l=a.button,r=a.pageX,u=a.pageY,d=void 0===r;a.preventDefault(),setTimeout(function(){if(d)null!=c&&null!==c.$menu&&void 0!==c.$menu&&c.$menu.trigger("contextmenu:hide");else{var e,t="left"===c.trigger&&0===l||"right"===c.trigger&&2===l;if(document.elementFromPoint&&c.$layer){if(c.$layer.hide(),(s=document.elementFromPoint(r-p.scrollLeft(),u-p.scrollTop())).isContentEditable){var n=document.createRange(),o=window.getSelection();n.selectNode(s),n.collapse(!0),o.removeAllRanges(),o.addRange(n)}m(s).trigger(a),c.$layer.show()}if(c.hideOnSecondTrigger&&t&&null!==c.$menu&&void 0!==c.$menu)c.$menu.trigger("contextmenu:hide");else{if(c.reposition&&t)if(document.elementFromPoint){if(c.$trigger.is(s))return void c.position.call(c.$trigger,c,r,u)}else if(i=c.$trigger.offset(),e=m(window),i.top+=e.scrollTop(),i.top<=a.pageY&&(i.left+=e.scrollLeft(),i.left<=a.pageX&&(i.bottom=i.top+c.$trigger.outerHeight(),i.bottom>=a.pageY&&(i.right=i.left+c.$trigger.outerWidth(),i.right>=a.pageX))))return void c.position.call(c.$trigger,c,r,u);s&&t&&c.$trigger.one("contextmenu:hidden",function(){m(s).contextMenu({x:r,y:u,button:l})}),null!=c&&null!==c.$menu&&void 0!==c.$menu&&c.$menu.trigger("contextmenu:hide")}}},50)},keyStop:function(e,t){t.isInput||e.preventDefault(),e.stopPropagation()},key:function(e){var t={};c&&(t=c.data("contextMenu")||{}),void 0===t.zIndex&&(t.zIndex=0);var n=0,o=function(e){""!==e.style.zIndex?n=e.style.zIndex:null!==e.offsetParent&&void 0!==e.offsetParent?o(e.offsetParent):null!==e.parentElement&&void 0!==e.parentElement&&o(e.parentElement)};if(o(e.target),!(t.$menu&&parseInt(n,10)>parseInt(t.$menu.css("zIndex"),10))){switch(e.keyCode){case 9:case 38:if(b.keyStop(e,t),t.isInput){if(9===e.keyCode&&e.shiftKey)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));if(38===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault()}else if(9!==e.keyCode||e.shiftKey)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));break;case 40:if(b.keyStop(e,t),!t.isInput)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(9===e.keyCode)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(40===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault();break;case 37:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;if(!t.$selected.parent().hasClass("context-menu-root")){var a=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=a)}break;case 39:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;var s=t.$selected.data("contextMenu")||{};if(s.$menu&&t.$selected.hasClass("context-menu-submenu"))return t.$selected=null,s.$selected=null,void s.$menu.trigger("nextcommand");break;case 35:case 36:return t.$selected&&t.$selected.find("input, textarea, select").length?void 0:((t.$selected&&t.$selected.parent()||t.$menu).children(":not(."+t.classNames.disabled+", ."+t.classNames.notSelectable+")")[36===e.keyCode?"first":"last"]().trigger("contextmenu:focus"),void e.preventDefault());case 13:if(b.keyStop(e,t),t.isInput){if(t.$selected&&!t.$selected.is("textarea, select"))return void e.preventDefault();break}return void(void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger("mouseup"));case 32:case 33:case 34:return void b.keyStop(e,t);case 27:return b.keyStop(e,t),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("contextmenu:hide"));default:var i=String.fromCharCode(e.keyCode).toUpperCase();if(t.accesskeys&&t.accesskeys[i])return void t.accesskeys[i].$node.trigger(t.accesskeys[i].$menu?"contextmenu:focus":"mouseup")}e.stopPropagation(),void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger(e)}},prevItem:function(e){e.stopPropagation();var t=m(this).data("contextMenu")||{},n=m(this).data("contextMenuRoot")||{};if(t.$selected){var o=t.$selected;(t=t.$selected.parent().data("contextMenu")||{}).$selected=o}for(var a=t.$menu.children(),s=t.$selected&&t.$selected.prev().length?t.$selected.prev():a.last(),i=s;s.hasClass(n.classNames.disabled)||s.hasClass(n.classNames.notSelectable)||s.is(":hidden");)if((s=s.prev().length?s.prev():a.last()).is(i))return;t.$selected&&b.itemMouseleave.call(t.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);var c=s.find("input, textarea, select");c.length&&c.focus()},nextItem:function(e){e.stopPropagation();var t=m(this).data("contextMenu")||{},n=m(this).data("contextMenuRoot")||{};if(t.$selected){var o=t.$selected;(t=t.$selected.parent().data("contextMenu")||{}).$selected=o}for(var a=t.$menu.children(),s=t.$selected&&t.$selected.next().length?t.$selected.next():a.first(),i=s;s.hasClass(n.classNames.disabled)||s.hasClass(n.classNames.notSelectable)||s.is(":hidden");)if((s=s.next().length?s.next():a.first()).is(i))return;t.$selected&&b.itemMouseleave.call(t.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);var c=s.find("input, textarea, select");c.length&&c.focus()},focusInput:function(){var e=m(this).closest(".context-menu-item"),t=e.data(),n=t.contextMenu,o=t.contextMenuRoot;o.$selected=n.$selected=e,o.isInput=n.isInput=!0},blurInput:function(){var e=m(this).closest(".context-menu-item").data(),t=e.contextMenu;e.contextMenuRoot.isInput=t.isInput=!1},menuMouseenter:function(){m(this).data().contextMenuRoot.hovering=!0},menuMouseleave:function(e){var t=m(this).data().contextMenuRoot;t.$layer&&t.$layer.is(e.relatedTarget)&&(t.hovering=!1)},itemMouseenter:function(e){var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;a.hovering=!0,e&&a.$layer&&a.$layer.is(e.relatedTarget)&&(e.preventDefault(),e.stopImmediatePropagation()),(o.$menu?o:a).$menu.children("."+a.classNames.hover).trigger("contextmenu:blur").children(".hover").trigger("contextmenu:blur"),t.hasClass(a.classNames.disabled)||t.hasClass(a.classNames.notSelectable)?o.$selected=null:t.trigger("contextmenu:focus")},itemMouseleave:function(e){var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;if(a!==o&&a.$layer&&a.$layer.is(e.relatedTarget))return void 0!==a.$selected&&null!==a.$selected&&a.$selected.trigger("contextmenu:blur"),e.preventDefault(),e.stopImmediatePropagation(),void(a.$selected=o.$selected=o.$node);o&&o.$menu&&o.$menu.hasClass("context-menu-visible")||t.trigger("contextmenu:blur")},itemClick:function(e){var t,n=m(this),o=n.data(),a=o.contextMenu,s=o.contextMenuRoot,i=o.contextMenuKey;if(!(!a.items[i]||n.is("."+s.classNames.disabled+", .context-menu-separator, ."+s.classNames.notSelectable)||n.is(".context-menu-submenu")&&!1===s.selectableSubMenu)){if(e.preventDefault(),e.stopImmediatePropagation(),m.isFunction(a.callbacks[i])&&Object.prototype.hasOwnProperty.call(a.callbacks,i))t=a.callbacks[i];else{if(!m.isFunction(s.callback))return;t=s.callback}!1!==t.call(s.$trigger,i,s,e)?s.$menu.trigger("contextmenu:hide"):s.$menu.parent().length&&$.update.call(s.$trigger,s)}},inputClick:function(e){e.stopImmediatePropagation()},hideMenu:function(e,t){var n=m(this).data("contextMenuRoot");$.hide.call(n.$trigger,n,t&&t.force)},focusItem:function(e){e.stopPropagation();var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;t.hasClass(a.classNames.disabled)||t.hasClass(a.classNames.notSelectable)||(t.addClass([a.classNames.hover,a.classNames.visible].join(" ")).parent().find(".context-menu-item").not(t).removeClass(a.classNames.visible).filter("."+a.classNames.hover).trigger("contextmenu:blur"),o.$selected=a.$selected=t,o&&o.$node&&o.$node.hasClass("context-menu-submenu")&&o.$node.addClass(a.classNames.hover),o.$node&&a.positionSubmenu.call(o.$node,o.$menu))},blurItem:function(e){e.stopPropagation();var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;o.autoHide&&t.removeClass(a.classNames.visible),t.removeClass(a.classNames.hover),o.$selected=null}},$={show:function(n,e,t){var o=m(this),a={};if(m("#context-menu-layer").trigger("mousedown"),n.$trigger=o,!1!==n.events.show.call(o,n))if(!1!==$.update.call(o,n)){if(n.position.call(o,n,e,t),n.zIndex){var s=n.zIndex;"function"==typeof n.zIndex&&(s=n.zIndex.call(o,n)),a.zIndex=function(e){for(var t=0,n=e;t=Math.max(t,parseInt(n.css("z-index"),10)||0),(n=n.parent())&&n.length&&!(-1<"html body".indexOf(n.prop("nodeName").toLowerCase())););return t}(o)+s}$.layer.call(n.$menu,n,a.zIndex),n.$menu.find("ul").css("zIndex",a.zIndex+1),n.$menu.css(a)[n.animation.show](n.animation.duration,function(){o.trigger("contextmenu:visible"),$.activated(n),n.events.activated(n)}),o.data("contextMenu",n).addClass("context-menu-active"),m(document).off("keydown.contextMenu").on("keydown.contextMenu",b.key),n.autoHide&&m(document).on("mousemove.contextMenuAutoHide",function(e){var t=o.offset();t.right=t.left+o.outerWidth(),t.bottom=t.top+o.outerHeight(),!n.$layer||n.hovering||e.pageX>=t.left&&e.pageX<=t.right&&e.pageY>=t.top&&e.pageY<=t.bottom||setTimeout(function(){n.hovering||null===n.$menu||void 0===n.$menu||n.$menu.trigger("contextmenu:hide")},50)})}else c=null;else c=null},hide:function(t,e){var n=m(this);if(t||(t=n.data("contextMenu")||{}),e||!t.events||!1!==t.events.hide.call(n,t)){if(n.removeData("contextMenu").removeClass("context-menu-active"),t.$layer){setTimeout((o=t.$layer,function(){o.remove()}),10);try{delete t.$layer}catch(e){t.$layer=null}}var o;c=null,t.$menu.find("."+t.classNames.hover).trigger("contextmenu:blur"),t.$selected=null,t.$menu.find("."+t.classNames.visible).removeClass(t.classNames.visible),m(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),t.$menu&&t.$menu[t.animation.hide](t.animation.duration,function(){t.build&&(t.$menu.remove(),m.each(t,function(e){switch(e){case"ns":case"selector":case"build":case"trigger":return!0;default:t[e]=void 0;try{delete t[e]}catch(e){}return!0}})),setTimeout(function(){n.trigger("contextmenu:hidden")},10)})}},create:function(r,u){function d(e){var t=m("");if(e._accesskey)e._beforeAccesskey&&t.append(document.createTextNode(e._beforeAccesskey)),m("").addClass("context-menu-accesskey").text(e._accesskey).appendTo(t),e._afterAccesskey&&t.append(document.createTextNode(e._afterAccesskey));else if(e.isHtmlName){if(void 0!==e.accesskey)throw new Error("accesskeys are not compatible with HTML names and cannot be used together in the same item");t.html(e.name)}else t.text(e.name);return t}void 0===u&&(u=r),r.$menu=m('
    ').addClass(r.className||"").data({contextMenu:r,contextMenuRoot:u}),m.each(["callbacks","commands","inputs"],function(e,t){r[t]={},u[t]||(u[t]={})}),u.accesskeys||(u.accesskeys={}),m.each(r.items,function(n,o){var e=m('
  • ').addClass(o.className||""),t=null,a=null;if(e.on("click",m.noop),"string"!=typeof o&&"cm_separator"!==o.type||(o={type:"cm_seperator"}),o.$node=e.data({contextMenu:r,contextMenuRoot:u,contextMenuKey:n}),void 0!==o.accesskey)for(var s,i=function(e){for(var t,n=e.split(/\s+/),o=[],a=0;t=n[a];a++)t=t.charAt(0).toUpperCase(),o.push(t);return o}(o.accesskey),c=0;s=i[c];c++)if(!u.accesskeys[s]){var l=(u.accesskeys[s]=o).name.match(new RegExp("^(.*?)("+s+")(.*)$","i"));l&&(o._beforeAccesskey=l[1],o._accesskey=l[2],o._afterAccesskey=l[3]);break}if(o.type&&v[o.type])v[o.type].call(e,o,r,u),m.each([r,u],function(e,t){t.commands[n]=o,!m.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==r.type||(t.callbacks[n]=o.callback)});else{switch("cm_seperator"===o.type?e.addClass("context-menu-separator "+u.classNames.notSelectable):"html"===o.type?e.addClass("context-menu-html "+u.classNames.notSelectable):"sub"===o.type||(o.type?(t=m("").appendTo(e),d(o).appendTo(t),e.addClass("context-menu-input"),r.hasTypes=!0,m.each([r,u],function(e,t){t.commands[n]=o,t.inputs[n]=o})):o.items&&(o.type="sub")),o.type){case"cm_seperator":break;case"text":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t);break;case"textarea":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t),o.height&&a.height(o.height);break;case"checkbox":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"radio":a=m('').attr("name","context-menu-input-"+o.radio).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"select":a=m('').attr("name","context-menu-input-"+n).appendTo(t),o.options&&(m.each(o.options,function(e,t){m("").val(e).text(t).appendTo(a)}),a.val(o.selected));break;case"sub":d(o).appendTo(e),o.appendTo=o.$node,e.data("contextMenu",o).addClass("context-menu-submenu"),o.callback=null,"function"==typeof o.items.then?$.processPromises(o,u,o.items):$.create(o,u);break;case"html":m(o.html).appendTo(e);break;default:m.each([r,u],function(e,t){t.commands[n]=o,!m.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==r.type||(t.callbacks[n]=o.callback)}),d(o).appendTo(e)}o.type&&"sub"!==o.type&&"html"!==o.type&&"cm_seperator"!==o.type&&(a.on("focus",b.focusInput).on("blur",b.blurInput),o.events&&a.on(o.events,r)),o.icon&&(m.isFunction(o.icon)?o._icon=o.icon.call(this,this,e,n,o):"string"==typeof o.icon&&"fa-"===o.icon.substring(0,3)?o._icon=u.classNames.icon+" "+u.classNames.icon+"--fa fa "+o.icon:o._icon=u.classNames.icon+" "+u.classNames.icon+"-"+o.icon,e.addClass(o._icon))}o.$input=a,o.$label=t,e.appendTo(r.$menu),!r.hasTypes&&m.support.eventSelectstart&&e.on("selectstart.disableTextSelect",b.abortevent)}),r.$node||r.$menu.css("display","none").addClass("context-menu-root"),r.$menu.appendTo(r.appendTo||document.body)},resize:function(e,t){var n;e.css({position:"absolute",display:"block"}),e.data("width",(n=e.get(0)).getBoundingClientRect?Math.ceil(n.getBoundingClientRect().width):e.outerWidth()+1),e.css({position:"static",minWidth:"0px",maxWidth:"100000px"}),e.find("> li > ul").each(function(){$.resize(m(this),!0)}),t||e.find("ul").addBack().css({position:"",display:"",minWidth:"",maxWidth:""}).outerWidth(function(){return m(this).data("width")})},update:function(s,i){var c=this;void 0===i&&(i=s,$.resize(s.$menu));var l=!1;return s.$menu.children().each(function(){var e,t=m(this),n=t.data("contextMenuKey"),o=s.items[n],a=m.isFunction(o.disabled)&&o.disabled.call(c,n,i)||!0===o.disabled;if((e=m.isFunction(o.visible)?o.visible.call(c,n,i):void 0===o.visible||!0===o.visible)&&(l=!0),t[e?"show":"hide"](),t[a?"addClass":"removeClass"](i.classNames.disabled),m.isFunction(o.icon)&&(t.removeClass(o._icon),o._icon=o.icon.call(this,c,t,n,o),t.addClass(o._icon)),o.type)switch(t.find("input, select, textarea").prop("disabled",a),o.type){case"text":case"textarea":o.$input.val(o.value||"");break;case"checkbox":case"radio":o.$input.val(o.value||"").prop("checked",!!o.selected);break;case"select":o.$input.val((0===o.selected?"0":o.selected)||"")}o.$menu&&($.update.call(c,o,i)&&(l=!0))}),l},layer:function(e,t){var n=e.$layer=m('
    ').css({height:p.height(),width:p.width(),display:"block",position:"fixed","z-index":t,top:0,left:0,opacity:0,filter:"alpha(opacity=0)","background-color":"#000"}).data("contextMenuRoot",e).insertBefore(this).on("contextmenu",b.abortevent).on("mousedown",b.layerClick);return void 0===document.body.style.maxWidth&&n.css({position:"absolute",height:m(document).height()}),n},processPromises:function(e,t,n){function o(e,t,n){void 0===n?(n={error:{name:"No items and no error item",icon:"context-menu-icon context-menu-icon-quit"}},window.console&&(console.error||console.log).call(console,'When you reject a promise, provide an "items" object, equal to normal sub-menu items')):"string"==typeof n&&(n={error:{name:n}}),a(e,t,n)}function a(e,t,n){void 0!==t.$menu&&t.$menu.is(":visible")&&(e.$node.removeClass(t.classNames.iconLoadingClass),e.items=n,$.create(e,t,!0),$.update(e,t),t.positionSubmenu.call(e.$node,e.$menu))}e.$node.addClass(t.classNames.iconLoadingClass),n.then(function(e,t,n){void 0===n&&o(void 0),a(e,t,n)}.bind(this,e,t),o.bind(this,e,t))},activated:function(e){var t=e.$menu,n=t.offset(),o=m(window).height(),a=m(window).scrollTop(),s=t.height();oa+o)&&t.css({top:"0px"})}};function l(e){return e.id&&m('label[for="'+e.id+'"]').val()||e.name}m.fn.contextMenu=function(e){var t=this,n=e;if(0s&&(o.top-=c),o.top<0&&(o.top=0),o.left+l>i&&(o.left-=l),o.left<0&&(o.left=0),e.$menu.css(o)}else e.determinePosition.call(this,e.$menu)},positionSubmenu:function(e){if(void 0!==e)if(m.ui&&m.ui.position)e.css("display","block").position({my:"left top-5",at:"right top",of:this,collision:"flipfit fit"}).css("display","");else{var t={top:-9,left:this.outerWidth()-5};e.css(t)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:m.noop,hide:m.noop,activated:m.noop},callback:null,items:{}},s={timer:null,pageX:null,pageY:null},b={abortevent:function(e){e.preventDefault(),e.stopImmediatePropagation()},contextmenu:function(e){var t=m(this);if("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled"))){if(c=t,e.data.build){var n=e.data.build(c,e);if(!1===n)return;if(e.data=m.extend(!0,{},g,e.data,n||{}),!e.data.items||m.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log).call(console,"No items specified to show in contextMenu"),new Error("No Items specified");e.data.$trigger=c,$.create(e.data)}$.show.call(t,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),m(this).trigger(m.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var t=m(this);c&&c.length&&!c.is(t)&&c.data("contextMenu").$menu.trigger("contextmenu:hide"),2===e.button&&(c=t.data("contextMenuActive",!0))},mouseup:function(e){var t=m(this);t.data("contextMenuActive")&&c&&c.length&&c.is(t)&&!t.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),(c=t).trigger(m.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),t.removeData("contextMenuActive")},mouseenter:function(e){var t=m(this),n=m(e.relatedTarget),o=m(document);n.is(".context-menu-list")||n.closest(".context-menu-list").length||c&&c.length||(s.pageX=e.pageX,s.pageY=e.pageY,s.data=e.data,o.on("mousemove.contextMenuShow",b.mousemove),s.timer=setTimeout(function(){s.timer=null,o.off("mousemove.contextMenuShow"),(c=t).trigger(m.Event("contextmenu",{data:s.data,pageX:s.pageX,pageY:s.pageY}))},e.data.delay))},mousemove:function(e){s.pageX=e.pageX,s.pageY=e.pageY},mouseleave:function(e){var t=m(e.relatedTarget);if(!t.is(".context-menu-list")&&!t.closest(".context-menu-list").length){try{clearTimeout(s.timer)}catch(e){}s.timer=null}},layerClick:function(a){var s,i,c=m(this).data("contextMenuRoot"),l=a.button,r=a.pageX,u=a.pageY,d=void 0===r;a.preventDefault(),setTimeout(function(){if(d)null!=c&&null!==c.$menu&&void 0!==c.$menu&&c.$menu.trigger("contextmenu:hide");else{var e,t="left"===c.trigger&&0===l||"right"===c.trigger&&2===l;if(document.elementFromPoint&&c.$layer){if(c.$layer.hide(),(s=document.elementFromPoint(r-p.scrollLeft(),u-p.scrollTop())).isContentEditable){var n=document.createRange(),o=window.getSelection();n.selectNode(s),n.collapse(!0),o.removeAllRanges(),o.addRange(n)}m(s).trigger(a),c.$layer.show()}if(c.hideOnSecondTrigger&&t&&null!==c.$menu&&void 0!==c.$menu)c.$menu.trigger("contextmenu:hide");else{if(c.reposition&&t)if(document.elementFromPoint){if(c.$trigger.is(s))return void c.position.call(c.$trigger,c,r,u)}else if(i=c.$trigger.offset(),e=m(window),i.top+=e.scrollTop(),i.top<=a.pageY&&(i.left+=e.scrollLeft(),i.left<=a.pageX&&(i.bottom=i.top+c.$trigger.outerHeight(),i.bottom>=a.pageY&&(i.right=i.left+c.$trigger.outerWidth(),i.right>=a.pageX))))return void c.position.call(c.$trigger,c,r,u);s&&t&&c.$trigger.one("contextmenu:hidden",function(){m(s).contextMenu({x:r,y:u,button:l})}),null!=c&&null!==c.$menu&&void 0!==c.$menu&&c.$menu.trigger("contextmenu:hide")}}},50)},keyStop:function(e,t){t.isInput||e.preventDefault(),e.stopPropagation()},key:function(e){var t={};c&&(t=c.data("contextMenu")||{}),void 0===t.zIndex&&(t.zIndex=0);var n=0,o=function(e){""!==e.style.zIndex?n=e.style.zIndex:null!==e.offsetParent&&void 0!==e.offsetParent?o(e.offsetParent):null!==e.parentElement&&void 0!==e.parentElement&&o(e.parentElement)};if(o(e.target),!(t.$menu&&parseInt(n,10)>parseInt(t.$menu.css("zIndex"),10))){switch(e.keyCode){case 9:case 38:if(b.keyStop(e,t),t.isInput){if(9===e.keyCode&&e.shiftKey)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));if(38===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault()}else if(9!==e.keyCode||e.shiftKey)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));break;case 40:if(b.keyStop(e,t),!t.isInput)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(9===e.keyCode)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(40===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault();break;case 37:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;if(!t.$selected.parent().hasClass("context-menu-root")){var a=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=a)}break;case 39:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;var s=t.$selected.data("contextMenu")||{};if(s.$menu&&t.$selected.hasClass("context-menu-submenu"))return t.$selected=null,s.$selected=null,void s.$menu.trigger("nextcommand");break;case 35:case 36:return t.$selected&&t.$selected.find("input, textarea, select").length?void 0:((t.$selected&&t.$selected.parent()||t.$menu).children(":not(."+t.classNames.disabled+", ."+t.classNames.notSelectable+")")[36===e.keyCode?"first":"last"]().trigger("contextmenu:focus"),void e.preventDefault());case 13:if(b.keyStop(e,t),t.isInput){if(t.$selected&&!t.$selected.is("textarea, select"))return void e.preventDefault();break}return void(void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger("mouseup"));case 32:case 33:case 34:return void b.keyStop(e,t);case 27:return b.keyStop(e,t),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("contextmenu:hide"));default:var i=String.fromCharCode(e.keyCode).toUpperCase();if(t.accesskeys&&t.accesskeys[i])return void t.accesskeys[i].$node.trigger(t.accesskeys[i].$menu?"contextmenu:focus":"mouseup")}e.stopPropagation(),void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger(e)}},prevItem:function(e){e.stopPropagation();var t=m(this).data("contextMenu")||{},n=m(this).data("contextMenuRoot")||{};if(t.$selected){var o=t.$selected;(t=t.$selected.parent().data("contextMenu")||{}).$selected=o}for(var a=t.$menu.children(),s=t.$selected&&t.$selected.prev().length?t.$selected.prev():a.last(),i=s;s.hasClass(n.classNames.disabled)||s.hasClass(n.classNames.notSelectable)||s.is(":hidden");)if((s=s.prev().length?s.prev():a.last()).is(i))return;t.$selected&&b.itemMouseleave.call(t.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);var c=s.find("input, textarea, select");c.length&&c.focus()},nextItem:function(e){e.stopPropagation();var t=m(this).data("contextMenu")||{},n=m(this).data("contextMenuRoot")||{};if(t.$selected){var o=t.$selected;(t=t.$selected.parent().data("contextMenu")||{}).$selected=o}for(var a=t.$menu.children(),s=t.$selected&&t.$selected.next().length?t.$selected.next():a.first(),i=s;s.hasClass(n.classNames.disabled)||s.hasClass(n.classNames.notSelectable)||s.is(":hidden");)if((s=s.next().length?s.next():a.first()).is(i))return;t.$selected&&b.itemMouseleave.call(t.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);var c=s.find("input, textarea, select");c.length&&c.focus()},focusInput:function(){var e=m(this).closest(".context-menu-item"),t=e.data(),n=t.contextMenu,o=t.contextMenuRoot;o.$selected=n.$selected=e,o.isInput=n.isInput=!0},blurInput:function(){var e=m(this).closest(".context-menu-item").data(),t=e.contextMenu;e.contextMenuRoot.isInput=t.isInput=!1},menuMouseenter:function(){m(this).data().contextMenuRoot.hovering=!0},menuMouseleave:function(e){var t=m(this).data().contextMenuRoot;t.$layer&&t.$layer.is(e.relatedTarget)&&(t.hovering=!1)},itemMouseenter:function(e){var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;a.hovering=!0,e&&a.$layer&&a.$layer.is(e.relatedTarget)&&(e.preventDefault(),e.stopImmediatePropagation()),(o.$menu?o:a).$menu.children("."+a.classNames.hover).trigger("contextmenu:blur").children(".hover").trigger("contextmenu:blur"),t.hasClass(a.classNames.disabled)||t.hasClass(a.classNames.notSelectable)?o.$selected=null:t.trigger("contextmenu:focus")},itemMouseleave:function(e){var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;if(a!==o&&a.$layer&&a.$layer.is(e.relatedTarget))return void 0!==a.$selected&&null!==a.$selected&&a.$selected.trigger("contextmenu:blur"),e.preventDefault(),e.stopImmediatePropagation(),void(a.$selected=o.$selected=o.$node);o&&o.$menu&&o.$menu.hasClass("context-menu-visible")||t.trigger("contextmenu:blur")},itemClick:function(e){var t,n=m(this),o=n.data(),a=o.contextMenu,s=o.contextMenuRoot,i=o.contextMenuKey;if(!(!a.items[i]||n.is("."+s.classNames.disabled+", .context-menu-separator, ."+s.classNames.notSelectable)||n.is(".context-menu-submenu")&&!1===s.selectableSubMenu)){if(e.preventDefault(),e.stopImmediatePropagation(),m.isFunction(a.callbacks[i])&&Object.prototype.hasOwnProperty.call(a.callbacks,i))t=a.callbacks[i];else{if(!m.isFunction(s.callback))return;t=s.callback}!1!==t.call(s.$trigger,i,s,e)?s.$menu.trigger("contextmenu:hide"):s.$menu.parent().length&&$.update.call(s.$trigger,s)}},inputClick:function(e){e.stopImmediatePropagation()},hideMenu:function(e,t){var n=m(this).data("contextMenuRoot");$.hide.call(n.$trigger,n,t&&t.force)},focusItem:function(e){e.stopPropagation();var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;t.hasClass(a.classNames.disabled)||t.hasClass(a.classNames.notSelectable)||(t.addClass([a.classNames.hover,a.classNames.visible].join(" ")).parent().find(".context-menu-item").not(t).removeClass(a.classNames.visible).filter("."+a.classNames.hover).trigger("contextmenu:blur"),o.$selected=a.$selected=t,o&&o.$node&&o.$node.hasClass("context-menu-submenu")&&o.$node.addClass(a.classNames.hover),o.$node&&a.positionSubmenu.call(o.$node,o.$menu))},blurItem:function(e){e.stopPropagation();var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;o.autoHide&&t.removeClass(a.classNames.visible),t.removeClass(a.classNames.hover),o.$selected=null}},$={show:function(n,e,t){var o=m(this),a={};if(m("#context-menu-layer").trigger("mousedown"),n.$trigger=o,!1!==n.events.show.call(o,n))if(!1!==$.update.call(o,n)){if(n.position.call(o,n,e,t),n.zIndex){var s=n.zIndex;"function"==typeof n.zIndex&&(s=n.zIndex.call(o,n)),a.zIndex=function(e){for(var t=0,n=e;t=Math.max(t,parseInt(n.css("z-index"),10)||0),(n=n.parent())&&n.length&&!(-1<"html body".indexOf(n.prop("nodeName").toLowerCase())););return t}(o)+s}$.layer.call(n.$menu,n,a.zIndex),n.$menu.find("ul").css("zIndex",a.zIndex+1),n.$menu.css(a)[n.animation.show](n.animation.duration,function(){o.trigger("contextmenu:visible"),$.activated(n),n.events.activated(n)}),o.data("contextMenu",n).addClass("context-menu-active"),m(document).off("keydown.contextMenu").on("keydown.contextMenu",b.key),n.autoHide&&m(document).on("mousemove.contextMenuAutoHide",function(e){var t=o.offset();t.right=t.left+o.outerWidth(),t.bottom=t.top+o.outerHeight(),!n.$layer||n.hovering||e.pageX>=t.left&&e.pageX<=t.right&&e.pageY>=t.top&&e.pageY<=t.bottom||setTimeout(function(){n.hovering||null===n.$menu||void 0===n.$menu||n.$menu.trigger("contextmenu:hide")},50)})}else c=null;else c=null},hide:function(t,e){var n=m(this);if(t||(t=n.data("contextMenu")||{}),e||!t.events||!1!==t.events.hide.call(n,t)){if(n.removeData("contextMenu").removeClass("context-menu-active"),t.$layer){setTimeout((o=t.$layer,function(){o.remove()}),10);try{delete t.$layer}catch(e){t.$layer=null}}var o;c=null,t.$menu.find("."+t.classNames.hover).trigger("contextmenu:blur"),t.$selected=null,t.$menu.find("."+t.classNames.visible).removeClass(t.classNames.visible),m(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),t.$menu&&t.$menu[t.animation.hide](t.animation.duration,function(){t.build&&(t.$menu.remove(),m.each(t,function(e){switch(e){case"ns":case"selector":case"build":case"trigger":return!0;default:t[e]=void 0;try{delete t[e]}catch(e){}return!0}})),setTimeout(function(){n.trigger("contextmenu:hidden")},10)})}},create:function(r,u){function d(e){var t=m("");if(e._accesskey)e._beforeAccesskey&&t.append(document.createTextNode(e._beforeAccesskey)),m("").addClass("context-menu-accesskey").text(e._accesskey).appendTo(t),e._afterAccesskey&&t.append(document.createTextNode(e._afterAccesskey));else if(e.isHtmlName){if(void 0!==e.accesskey)throw new Error("accesskeys are not compatible with HTML names and cannot be used together in the same item");t.html(e.name)}else t.text(e.name);return t}void 0===u&&(u=r),r.$menu=m('
      ').addClass(r.className||"").data({contextMenu:r,contextMenuRoot:u}),m.each(["callbacks","commands","inputs"],function(e,t){r[t]={},u[t]||(u[t]={})}),u.accesskeys||(u.accesskeys={}),m.each(r.items,function(n,o){var e=m('
    • ').addClass(o.className||""),t=null,a=null;if(e.on("click",m.noop),"string"!=typeof o&&"cm_separator"!==o.type||(o={type:"cm_seperator"}),o.$node=e.data({contextMenu:r,contextMenuRoot:u,contextMenuKey:n}),void 0!==o.accesskey)for(var s,i=function(e){for(var t,n=e.split(/\s+/),o=[],a=0;t=n[a];a++)t=t.charAt(0).toUpperCase(),o.push(t);return o}(o.accesskey),c=0;s=i[c];c++)if(!u.accesskeys[s]){var l=(u.accesskeys[s]=o).name.match(new RegExp("^(.*?)("+s+")(.*)$","i"));l&&(o._beforeAccesskey=l[1],o._accesskey=l[2],o._afterAccesskey=l[3]);break}if(o.type&&v[o.type])v[o.type].call(e,o,r,u),m.each([r,u],function(e,t){t.commands[n]=o,!m.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==r.type||(t.callbacks[n]=o.callback)});else{switch("cm_seperator"===o.type?e.addClass("context-menu-separator "+u.classNames.notSelectable):"html"===o.type?e.addClass("context-menu-html "+u.classNames.notSelectable):"sub"===o.type||(o.type?(t=m("").appendTo(e),d(o).appendTo(t),e.addClass("context-menu-input"),r.hasTypes=!0,m.each([r,u],function(e,t){t.commands[n]=o,t.inputs[n]=o})):o.items&&(o.type="sub")),o.type){case"cm_seperator":break;case"text":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t);break;case"textarea":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t),o.height&&a.height(o.height);break;case"checkbox":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"radio":a=m('').attr("name","context-menu-input-"+o.radio).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"select":a=m('').attr("name","context-menu-input-"+n).appendTo(t),o.options&&(m.each(o.options,function(e,t){m("").val(e).text(t).appendTo(a)}),a.val(o.selected));break;case"sub":d(o).appendTo(e),o.appendTo=o.$node,e.data("contextMenu",o).addClass("context-menu-submenu"),o.callback=null,"function"==typeof o.items.then?$.processPromises(o,u,o.items):$.create(o,u);break;case"html":m(o.html).appendTo(e);break;default:m.each([r,u],function(e,t){t.commands[n]=o,!m.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==r.type||(t.callbacks[n]=o.callback)}),d(o).appendTo(e)}o.type&&"sub"!==o.type&&"html"!==o.type&&"cm_seperator"!==o.type&&(a.on("focus",b.focusInput).on("blur",b.blurInput),o.events&&a.on(o.events,r)),o.icon&&(m.isFunction(o.icon)?o._icon=o.icon.call(this,this,e,n,o):"string"!=typeof o.icon||"fab "!==o.icon.substring(0,4)&&"fas "!==o.icon.substring(0,4)&&"far "!==o.icon.substring(0,4)?"string"==typeof o.icon&&"fa-"===o.icon.substring(0,3)?o._icon=u.classNames.icon+" "+u.classNames.icon+"--fa fa "+o.icon:o._icon=u.classNames.icon+" "+u.classNames.icon+"-"+o.icon:(e.addClass(u.classNames.icon+" "+u.classNames.icon+"--fa5"),o._icon=m('')),"string"==typeof o._icon?e.addClass(o._icon):e.prepend(o._icon))}o.$input=a,o.$label=t,e.appendTo(r.$menu),!r.hasTypes&&m.support.eventSelectstart&&e.on("selectstart.disableTextSelect",b.abortevent)}),r.$node||r.$menu.css("display","none").addClass("context-menu-root"),r.$menu.appendTo(r.appendTo||document.body)},resize:function(e,t){var n;e.css({position:"absolute",display:"block"}),e.data("width",(n=e.get(0)).getBoundingClientRect?Math.ceil(n.getBoundingClientRect().width):e.outerWidth()+1),e.css({position:"static",minWidth:"0px",maxWidth:"100000px"}),e.find("> li > ul").each(function(){$.resize(m(this),!0)}),t||e.find("ul").addBack().css({position:"",display:"",minWidth:"",maxWidth:""}).outerWidth(function(){return m(this).data("width")})},update:function(i,c){var l=this;void 0===c&&(c=i,$.resize(i.$menu));var r=!1;return i.$menu.children().each(function(){var e,t=m(this),n=t.data("contextMenuKey"),o=i.items[n],a=m.isFunction(o.disabled)&&o.disabled.call(l,n,c)||!0===o.disabled;if((e=m.isFunction(o.visible)?o.visible.call(l,n,c):void 0===o.visible||!0===o.visible)&&(r=!0),t[e?"show":"hide"](),t[a?"addClass":"removeClass"](c.classNames.disabled),m.isFunction(o.icon)){t.removeClass(o._icon);var s=o.icon.call(this,l,t,n,o);"string"==typeof s?t.addClass(o._icon):t.prepend(s)}if(o.type)switch(t.find("input, select, textarea").prop("disabled",a),o.type){case"text":case"textarea":o.$input.val(o.value||"");break;case"checkbox":case"radio":o.$input.val(o.value||"").prop("checked",!!o.selected);break;case"select":o.$input.val((0===o.selected?"0":o.selected)||"")}o.$menu&&($.update.call(l,o,c)&&(r=!0))}),r},layer:function(e,t){var n=e.$layer=m('
      ').css({height:p.height(),width:p.width(),display:"block",position:"fixed","z-index":t,top:0,left:0,opacity:0,filter:"alpha(opacity=0)","background-color":"#000"}).data("contextMenuRoot",e).insertBefore(this).on("contextmenu",b.abortevent).on("mousedown",b.layerClick);return void 0===document.body.style.maxWidth&&n.css({position:"absolute",height:m(document).height()}),n},processPromises:function(e,t,n){function o(e,t,n){void 0===n?(n={error:{name:"No items and no error item",icon:"context-menu-icon context-menu-icon-quit"}},window.console&&(console.error||console.log).call(console,'When you reject a promise, provide an "items" object, equal to normal sub-menu items')):"string"==typeof n&&(n={error:{name:n}}),a(e,t,n)}function a(e,t,n){void 0!==t.$menu&&t.$menu.is(":visible")&&(e.$node.removeClass(t.classNames.iconLoadingClass),e.items=n,$.create(e,t,!0),$.update(e,t),t.positionSubmenu.call(e.$node,e.$menu))}e.$node.addClass(t.classNames.iconLoadingClass),n.then(function(e,t,n){void 0===n&&o(void 0),a(e,t,n)}.bind(this,e,t),o.bind(this,e,t))},activated:function(e){var t=e.$menu,n=t.offset(),o=m(window).height(),a=m(window).scrollTop(),s=t.height();oa+o)&&t.css({top:"0px"})}};function l(e){return e.id&&m('label[for="'+e.id+'"]').val()||e.name}m.fn.contextMenu=function(e){var t=this,n=e;if(0 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 op.show.call($this, e.data, e.pageX, e.pageY);\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 fakeClick = x === undefined,\n target,\n offset;\n\n e.preventDefault();\n\n setTimeout(function () {\n // If the click is not real, things break: https://github.com/swisnl/jQuery-contextMenu/issues/132\n if(fakeClick){\n if (root !== null && typeof root !== 'undefined' && root.$menu !== null && typeof root.$menu !== 'undefined') {\n root.$menu.trigger('contextmenu:hide');\n }\n return;\n }\n\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 var hasVisibleItems = op.update.call($trigger, opt);\n if (hasVisibleItems === false) {\n $currentTrigger = null;\n return;\n }\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(opt);\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\n var hasVisibleItems = false;\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\n if (visible) {\n hasVisibleItems = true;\n }\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 var subMenuHasVisibleItems = op.update.call($trigger, item, root);\n if (subMenuHasVisibleItems) {\n hasVisibleItems = true;\n }\n }\n });\n return hasVisibleItems;\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