diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f94773..028b4c34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ ## Changelog ## -### Unreleased +### 2.9.1 +* Fix error when closing the menu by clicking on the page without any element under that click point. (fixes #717) * Upgrades dependencies ### 2.9.0 diff --git a/dist/font/context-menu-icons.eot b/dist/font/context-menu-icons.eot index 5db8a5fb..896c5b02 100644 Binary files a/dist/font/context-menu-icons.eot and b/dist/font/context-menu-icons.eot differ diff --git a/dist/font/context-menu-icons.ttf b/dist/font/context-menu-icons.ttf index 4127c6b4..6ecdf1b5 100644 Binary files a/dist/font/context-menu-icons.ttf and b/dist/font/context-menu-icons.ttf differ diff --git a/dist/font/context-menu-icons.woff b/dist/font/context-menu-icons.woff index 5ac72ec7..a37f8556 100644 Binary files a/dist/font/context-menu-icons.woff and b/dist/font/context-menu-icons.woff differ diff --git a/dist/font/context-menu-icons.woff2 b/dist/font/context-menu-icons.woff2 index 17530166..b3ca8d1c 100644 Binary files a/dist/font/context-menu-icons.woff2 and b/dist/font/context-menu-icons.woff2 differ diff --git a/dist/jquery.contextMenu.css b/dist/jquery.contextMenu.css index c7fc0902..26528f8a 100644 --- a/dist/jquery.contextMenu.css +++ b/dist/jquery.contextMenu.css @@ -7,12 +7,12 @@ * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) * Web: http://swisnl.github.io/jQuery-contextMenu/ * - * Copyright (c) 2011-2019 SWIS BV and contributors + * Copyright (c) 2011-2020 SWIS BV and contributors * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2019-10-13T13:09:56.297Z + * Date: 2020-05-06T18:55:06.258Z */ @-webkit-keyframes cm-spin { 0% { @@ -54,8 +54,8 @@ font-style: normal; font-weight: normal; - src: url("font/context-menu-icons.eot?4f0ru"); - src: url("font/context-menu-icons.eot?4f0ru#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?4f0ru") format("woff2"), url("font/context-menu-icons.woff?4f0ru") format("woff"), url("font/context-menu-icons.ttf?4f0ru") format("truetype"); + src: url("font/context-menu-icons.eot?33lxn"); + src: url("font/context-menu-icons.eot?33lxn#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?33lxn") format("woff2"), url("font/context-menu-icons.woff?33lxn") format("woff"), url("font/context-menu-icons.ttf?33lxn") format("truetype"); } .context-menu-icon-add:before { diff --git a/dist/jquery.contextMenu.js b/dist/jquery.contextMenu.js index 58370f6e..53da21dc 100755 --- a/dist/jquery.contextMenu.js +++ b/dist/jquery.contextMenu.js @@ -6,12 +6,12 @@ * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) * Web: http://swisnl.github.io/jQuery-contextMenu/ * - * Copyright (c) 2011-2019 SWIS BV and contributors + * Copyright (c) 2011-2020 SWIS BV and contributors * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2019-10-13T13:09:56.900Z + * Date: 2020-05-06T18:55:06.721Z */ // jscs:disable @@ -461,7 +461,7 @@ // also need to try and focus this element if we're in a contenteditable area, // as the layer will prevent the browser mouse action we want - if (target.isContentEditable) { + if (target !== null && target.isContentEditable) { var range = document.createRange(), sel = window.getSelection(); range.selectNode(target); diff --git a/dist/jquery.contextMenu.min.css b/dist/jquery.contextMenu.min.css index d6f15b32..e388ca11 100644 --- a/dist/jquery.contextMenu.min.css +++ b/dist/jquery.contextMenu.min.css @@ -6,11 +6,11 @@ * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) * Web: http://swisnl.github.io/jQuery-contextMenu/ * - * Copyright (c) 2011-2019 SWIS BV and contributors + * Copyright (c) 2011-2020 SWIS BV and contributors * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * - * Date: 2019-10-13T13:09:56.297Z - */@-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?4f0ru);src:url(font/context-menu-icons.eot?4f0ru#iefix) format("embedded-opentype"),url(font/context-menu-icons.woff2?4f0ru) format("woff2"),url(font/context-menu-icons.woff?4f0ru) format("woff"),url(font/context-menu-icons.ttf?4f0ru) 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,.context-menu-icon.context-menu-icon--fa5 svg{position:absolute;top:.3em;left:.5em;color:#2980b9}.context-menu-icon.context-menu-icon--fa5.context-menu-hover>i,.context-menu-icon.context-menu-icon--fa5.context-menu-hover>svg{color:#fff}.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i,.context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg{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: 2020-05-06T18:55:06.258Z + */@-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?33lxn);src:url(font/context-menu-icons.eot?33lxn#iefix) format("embedded-opentype"),url(font/context-menu-icons.woff2?33lxn) format("woff2"),url(font/context-menu-icons.woff?33lxn) format("woff"),url(font/context-menu-icons.ttf?33lxn) 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,.context-menu-icon.context-menu-icon--fa5 svg{position:absolute;top:.3em;left:.5em;color:#2980b9}.context-menu-icon.context-menu-icon--fa5.context-menu-hover>i,.context-menu-icon.context-menu-icon--fa5.context-menu-hover>svg{color:#fff}.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i,.context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg{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 3125100b..07fb4d25 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":"iBACA;;;;;;;;;;;;;;AAeA,2BACE,GACE,kBAAA,iBAAA,UACA,UAAA,iBAAA,UCEF,KDCE,kBAAA,iBAAA,eANJ,UAAA,iBAAA,gBCUA,sBACE,GDPA,kBAAA,iBAAA,UACE,aAAA,iBAAA,UACA,UAAA,iBAAA,UANJ,KACE,kBAAA,iBAAA,eACE,aAAA,iBAAA,eACA,UAAA,iBAAA,gBCmBJ,mBACE,GACE,kBDlBA,iBAAA,UCmBK,aAAc,iBAAiB,UDjBxC,UAAA,iBAAA,UAEE,KACA,kBAAA,iBAAA,eACA,aAAmB,iBAAA,eACnB,UAAoB,iBAAA,gBCsBtB,WDjBA,YAAA,mBACE,WAAA,OCmBA,YAAa,IDhBb,IAAA,uCCmBA,IAAK,6CAA+C,2BAA2B,CAAE,yCAA2C,eAAe,CAAE,wCAA0C,cAAc,CAAE,uCAAyC,mBAGlP,8BDjBA,QAAA,QAGA,+BACE,QAAA,QCqBF,8BACE,QAAS,QAGX,iCDjBA,QAAA,QCqBA,+BDjBE,QAAA,QCqBF,kCDjBE,QAAA,QCqBF,gCACE,QDnBA,QCsBF,+BDpBE,QAAA,QAGF,2BACE,SAAA,SCsBA,IAAK,IDpBP,KAAA,EACE,MAAA,ICsBA,YAAa,mBDpBf,UAAA,IACE,WAAA,OCsBA,YDtBA,ICuBA,YDvBA,ECwBA,MAAO,QDtBT,WAAA,OACE,kBAAkB,iBAClB,cAAA,iBACA,aAAA,iBACA,UAAA,iBCyBA,uBDvBE,YCwBF,wBDvBoB,UC0BtB,6CACE,MDvBE,KC0BJ,iDACE,MDvBE,KC0BJ,oDACE,kBD1BE,QAAA,GAAA,SACA,aAAA,QAAA,GAAA,SACA,UAAY,QAAA,GAAA,SC6BhB,yCACE,QD1BE,UC2BF,YAAa,QDzBf,YAAA,QC4BA,iDDzBE,SAAA,SACA,IAAA,IC2BA,KD1BE,EC2BF,MD1BE,IC2BF,YD1BE,YC2BF,UD1BE,IACF,WAAA,OC2BA,YD1Ba,IACb,YAAA,EC2BA,MD1BE,QC2BF,WAAY,ODzBd,kBAAA,iBACE,cAAgB,iBAChB,aAAA,iBACA,UAAA,iBC4BA,uBD3BA,YACA,wBAAqB,UC6BvB,mED1BE,MAAA,KC6BF,uED1BE,MAAA,KC8BF,0CD1BA,QAAA,UACE,YAAA,QACA,YAAA,QC6BF,4CD7ByB,8CACvB,SAAA,SACA,IAAA,KACA,KAAA,KACA,MAAA,QC+BF,+DD/BmB,iECgCjB,MAAO,KD9BT,kEAAA,oEACE,MAAA,KCmCF,mBD/BA,SAAA,SCiCE,QAAS,aD/BT,UAAA,KCiCA,UDjCA,KCkCA,QDlCA,MAAA,ECmCA,ODnCA,KCoCA,YAAa,QDlCf,UAAA,QACE,gBAAA,KACA,WAAW,KACX,OAAA,IAAA,MAAiB,QCoCjB,cAAe,KDlCjB,mBAAA,EAAA,IAAA,IAAA,eACE,WAAA,EAAsB,IAAA,IAAA,eCsCxB,mBDlCA,SAAA,SACE,mBAAe,YACf,gBAAgB,YCoCR,WAAY,YDlCtB,QAAA,KAAA,IACE,MAAA,QACA,oBAAmB,KACnB,iBAAA,KACA,gBAAA,KACA,YAAS,KACT,iBAAkB,KCsCpB,wBACE,QDpCA,ECqCA,ODrCA,MAAA,ECsCA,cDtCA,IAAA,MAAA,QCyCF,+BDrCA,kCCuCE,oBAAqB,KDrCrB,iBAAA,KACF,gBAAA,KACE,YAAoB,KAGtB,sCACE,MAAA,KCuCA,OAAQ,QDrCV,iBAAA,QCyCA,yCDrCE,MAAA,KACA,OAAA,QCuCA,iBAAkB,KAGpB,uCDrCA,MAAA,QCuCE,OAAQ,QAGV,4BACE,SDvCA,SCwCA,IAAK,IDvCL,MAAA,KACA,QAAA,ECyCA,MAAO,EDvCT,OAAA,EACE,QAAA,GCyCA,aAAc,YAAY,YAAY,YAAY,QDvCpD,aAAA,MACE,aAAa,MAAA,EAAA,MAAA,MACb,kBAAA,iBACA,cAAY,iBACZ,aAAW,iBCyCH,UAAW,iBAMrB,sCACE,QAAS,KAAK,KAIhB,4BACE,eAAgB,IAIlB,+CACA,4CACE,SAAU,SACV,IAAK,MACL,aAAc,KAGhB,0BACE,OAAQ,EAGV,0BACA,2CAEA,iCADA,mCAEE,QAAS,MACT,MAAO,KACP,mBAAoB,WACjB,gBAAiB,WACZ,WAAY,WAGtB,mCACE,OAAQ,IAGV,sCACE,IAAK,KAEL,MAAO,MACP,QAAS,KAGX,2DACE,QAAS,MAGX,wBACE,gBAAiB","file":"jquery.contextMenu.min.css","sourcesContent":["@charset \"UTF-8\";\n/*!\r\n * jQuery contextMenu - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.9.0\r\n *\r\n * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)\r\n * Web: http://swisnl.github.io/jQuery-contextMenu/\r\n *\r\n * Copyright (c) 2011-2019 SWIS BV and contributors\r\n *\r\n * Licensed under\r\n * MIT License http://www.opensource.org/licenses/mit-license\r\n *\r\n * Date: 2019-10-13T13:09:56.297Z\r\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?4f0ru\");\n src: url(\"font/context-menu-icons.eot?4f0ru#iefix\") format(\"embedded-opentype\"), url(\"font/context-menu-icons.woff2?4f0ru\") format(\"woff2\"), url(\"font/context-menu-icons.woff?4f0ru\") format(\"woff\"), url(\"font/context-menu-icons.ttf?4f0ru\") 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, .context-menu-icon.context-menu-icon--fa5 svg {\n color: #2980B9;\n left: 0.5em;\n position: absolute;\n top: 0.3em; }\n .context-menu-icon.context-menu-icon--fa5.context-menu-hover > i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover > svg {\n color: #FFF; }\n .context-menu-icon.context-menu-icon--fa5.context-menu-disabled i, .context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg {\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/**\r\n * Inputs\r\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\";/*!\r\n * jQuery contextMenu - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.8.1\r\n *\r\n * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)\r\n * Web: http://swisnl.github.io/jQuery-contextMenu/\r\n *\r\n * Copyright (c) 2011-2019 SWIS BV and contributors\r\n *\r\n * Licensed under\r\n * MIT License http://www.opensource.org/licenses/mit-license\r\n *\r\n * Date: 2019-10-06T14:19:04.540Z\r\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?1zyug);src:url(font/context-menu-icons.eot?1zyug#iefix) format(\"embedded-opentype\"),url(font/context-menu-icons.woff2?1zyug) format(\"woff2\"),url(font/context-menu-icons.woff?1zyug) format(\"woff\"),url(font/context-menu-icons.ttf?1zyug) 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,.context-menu-icon.context-menu-icon--fa5 svg{position:absolute;top:.3em;left:.5em;color:#2980b9}.context-menu-icon.context-menu-icon--fa5.context-menu-hover>i,.context-menu-icon.context-menu-icon--fa5.context-menu-hover>svg{color:#fff}.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i,.context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg{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}\r\n/*# sourceMappingURL=jquery.contextMenu.min.css.map */\r\n"]} \ No newline at end of file +{"version":3,"sources":["jquery.contextMenu.css","jquery.contextMenu.min.css"],"names":[],"mappings":"iBACA;;;;;;;;;;;;;;AAeA,2BACE,GACE,kBAAA,iBAAA,UACA,UAAA,iBAAA,UCEF,KDCE,kBAAA,iBAAA,eANJ,UAAA,iBAAA,gBCUA,sBACE,GDPA,kBAAA,iBAAA,UACE,aAAA,iBAAA,UACA,UAAA,iBAAA,UANJ,KACE,kBAAA,iBAAA,eACE,aAAA,iBAAA,eACA,UAAA,iBAAA,gBCmBJ,mBACE,GACE,kBDlBA,iBAAA,UCmBK,aAAc,iBAAiB,UDjBxC,UAAA,iBAAA,UAEE,KACA,kBAAA,iBAAA,eACA,aAAmB,iBAAA,eACnB,UAAoB,iBAAA,gBCsBtB,WDjBA,YAAA,mBACE,WAAA,OCmBA,YAAa,IDhBb,IAAA,uCCmBA,IAAK,6CAA+C,2BAA2B,CAAE,yCAA2C,eAAe,CAAE,wCAA0C,cAAc,CAAE,uCAAyC,mBAGlP,8BDjBA,QAAA,QAGA,+BACE,QAAA,QCqBF,8BACE,QAAS,QAGX,iCDjBA,QAAA,QCqBA,+BDjBE,QAAA,QCqBF,kCDjBE,QAAA,QCqBF,gCACE,QDnBA,QCsBF,+BDpBE,QAAA,QAGF,2BACE,SAAA,SCsBA,IAAK,IDpBP,KAAA,EACE,MAAA,ICsBA,YAAa,mBDpBf,UAAA,IACE,WAAA,OCsBA,YDtBA,ICuBA,YDvBA,ECwBA,MAAO,QDtBT,WAAA,OACE,kBAAkB,iBAClB,cAAA,iBACA,aAAA,iBACA,UAAA,iBCyBA,uBDvBE,YCwBF,wBDvBoB,UC0BtB,6CACE,MDvBE,KC0BJ,iDACE,MDvBE,KC0BJ,oDACE,kBD1BE,QAAA,GAAA,SACA,aAAA,QAAA,GAAA,SACA,UAAY,QAAA,GAAA,SC6BhB,yCACE,QD1BE,UC2BF,YAAa,QDzBf,YAAA,QC4BA,iDDzBE,SAAA,SACA,IAAA,IC2BA,KD1BE,EC2BF,MD1BE,IC2BF,YD1BE,YC2BF,UD1BE,IACF,WAAA,OC2BA,YD1Ba,IACb,YAAA,EC2BA,MD1BE,QC2BF,WAAY,ODzBd,kBAAA,iBACE,cAAgB,iBAChB,aAAA,iBACA,UAAA,iBC4BA,uBD3BA,YACA,wBAAqB,UC6BvB,mED1BE,MAAA,KC6BF,uED1BE,MAAA,KC8BF,0CD1BA,QAAA,UACE,YAAA,QACA,YAAA,QC6BF,4CD7ByB,8CACvB,SAAA,SACA,IAAA,KACA,KAAA,KACA,MAAA,QC+BF,+DD/BmB,iECgCjB,MAAO,KD9BT,kEAAA,oEACE,MAAA,KCmCF,mBD/BA,SAAA,SCiCE,QAAS,aD/BT,UAAA,KCiCA,UDjCA,KCkCA,QDlCA,MAAA,ECmCA,ODnCA,KCoCA,YAAa,QDlCf,UAAA,QACE,gBAAA,KACA,WAAW,KACX,OAAA,IAAA,MAAiB,QCoCjB,cAAe,KDlCjB,mBAAA,EAAA,IAAA,IAAA,eACE,WAAA,EAAsB,IAAA,IAAA,eCsCxB,mBDlCA,SAAA,SACE,mBAAe,YACf,gBAAgB,YCoCR,WAAY,YDlCtB,QAAA,KAAA,IACE,MAAA,QACA,oBAAmB,KACnB,iBAAA,KACA,gBAAA,KACA,YAAS,KACT,iBAAkB,KCsCpB,wBACE,QDpCA,ECqCA,ODrCA,MAAA,ECsCA,cDtCA,IAAA,MAAA,QCyCF,+BDrCA,kCCuCE,oBAAqB,KDrCrB,iBAAA,KACF,gBAAA,KACE,YAAoB,KAGtB,sCACE,MAAA,KCuCA,OAAQ,QDrCV,iBAAA,QCyCA,yCDrCE,MAAA,KACA,OAAA,QCuCA,iBAAkB,KAGpB,uCDrCA,MAAA,QCuCE,OAAQ,QAGV,4BACE,SDvCA,SCwCA,IAAK,IDvCL,MAAA,KACA,QAAA,ECyCA,MAAO,EDvCT,OAAA,EACE,QAAA,GCyCA,aAAc,YAAY,YAAY,YAAY,QDvCpD,aAAA,MACE,aAAa,MAAA,EAAA,MAAA,MACb,kBAAA,iBACA,cAAY,iBACZ,aAAW,iBCyCH,UAAW,iBAMrB,sCACE,QAAS,KAAK,KAIhB,4BACE,eAAgB,IAIlB,+CACA,4CACE,SAAU,SACV,IAAK,MACL,aAAc,KAGhB,0BACE,OAAQ,EAGV,0BACA,2CAEA,iCADA,mCAEE,QAAS,MACT,MAAO,KACP,mBAAoB,WACjB,gBAAiB,WACZ,WAAY,WAGtB,mCACE,OAAQ,IAGV,sCACE,IAAK,KAEL,MAAO,MACP,QAAS,KAGX,2DACE,QAAS,MAGX,wBACE,gBAAiB","file":"jquery.contextMenu.min.css","sourcesContent":["@charset \"UTF-8\";\n/*!\r\n * jQuery contextMenu - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.9.0\r\n *\r\n * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)\r\n * Web: http://swisnl.github.io/jQuery-contextMenu/\r\n *\r\n * Copyright (c) 2011-2020 SWIS BV and contributors\r\n *\r\n * Licensed under\r\n * MIT License http://www.opensource.org/licenses/mit-license\r\n *\r\n * Date: 2020-05-06T18:55:06.258Z\r\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?33lxn\");\n src: url(\"font/context-menu-icons.eot?33lxn#iefix\") format(\"embedded-opentype\"), url(\"font/context-menu-icons.woff2?33lxn\") format(\"woff2\"), url(\"font/context-menu-icons.woff?33lxn\") format(\"woff\"), url(\"font/context-menu-icons.ttf?33lxn\") 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, .context-menu-icon.context-menu-icon--fa5 svg {\n color: #2980B9;\n left: 0.5em;\n position: absolute;\n top: 0.3em; }\n .context-menu-icon.context-menu-icon--fa5.context-menu-hover > i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover > svg {\n color: #FFF; }\n .context-menu-icon.context-menu-icon--fa5.context-menu-disabled i, .context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg {\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/**\r\n * Inputs\r\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\";/*!\r\n * jQuery contextMenu - Plugin for simple contextMenu handling\r\n *\r\n * Version: v2.9.0\r\n *\r\n * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)\r\n * Web: http://swisnl.github.io/jQuery-contextMenu/\r\n *\r\n * Copyright (c) 2011-2020 SWIS BV and contributors\r\n *\r\n * Licensed under\r\n * MIT License http://www.opensource.org/licenses/mit-license\r\n *\r\n * Date: 2020-05-06T18:54:49.824Z\r\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?4f0ru);src:url(font/context-menu-icons.eot?4f0ru#iefix) format(\"embedded-opentype\"),url(font/context-menu-icons.woff2?4f0ru) format(\"woff2\"),url(font/context-menu-icons.woff?4f0ru) format(\"woff\"),url(font/context-menu-icons.ttf?4f0ru) 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,.context-menu-icon.context-menu-icon--fa5 svg{position:absolute;top:.3em;left:.5em;color:#2980b9}.context-menu-icon.context-menu-icon--fa5.context-menu-hover>i,.context-menu-icon.context-menu-icon--fa5.context-menu-hover>svg{color:#fff}.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i,.context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg{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}\r\n/*# sourceMappingURL=jquery.contextMenu.min.css.map */\r\n"]} \ No newline at end of file diff --git a/dist/jquery.contextMenu.min.js b/dist/jquery.contextMenu.min.js index 4eb9d854..fe325228 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:{preShow:m.noop,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(!1!==e.data.events.preShow(t,e)&&("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled")))){if(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"))break;var a=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=a);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}),r.dataAttr&&m.each(r.dataAttr,function(e,t){r.$menu.attr("data-"+r.key,t)}),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)&&"fad "!==o.icon.substring(0,4)&&"far "!==o.icon.substring(0,4)&&"fal "!==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(s):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:a+"px"})}};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:{preShow:m.noop,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(!1!==e.data.events.preShow(t,e)&&("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled")))){if(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(),null!==(s=document.elementFromPoint(r-p.scrollLeft(),u-p.scrollTop()))&&s.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"))break;var a=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=a);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}),r.dataAttr&&m.each(r.dataAttr,function(e,t){r.$menu.attr("data-"+r.key,t)}),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)&&"fad "!==o.icon.substring(0,4)&&"far "!==o.icon.substring(0,4)&&"fal "!==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(s):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:a+"px"})}};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\r\n\r\n // determine html5 compatibility\r\n $.support.htmlMenuitem = ('HTMLMenuItemElement' in window);\r\n $.support.htmlCommand = ('HTMLCommandElement' in window);\r\n $.support.eventSelectstart = ('onselectstart' in document.documentElement);\r\n /* // should the need arise, test for css user-select\r\n $.support.cssUserSelect = (function(){\r\n var t = false,\r\n e = document.createElement('div');\r\n\r\n $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) {\r\n var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect',\r\n prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select';\r\n\r\n e.style.cssText = prop + ': text;';\r\n if (e.style[propCC] == 'text') {\r\n t = true;\r\n return false;\r\n }\r\n\r\n return true;\r\n });\r\n\r\n return t;\r\n })();\r\n */\r\n\r\n\r\n if (!$.ui || !$.widget) {\r\n // duck punch $.cleanData like jQueryUI does to get that remove event\r\n $.cleanData = (function (orig) {\r\n return function (elems) {\r\n var events, elem, i;\r\n for (i = 0; elems[i] != null; i++) {\r\n elem = elems[i];\r\n try {\r\n // Only trigger remove when necessary to save time\r\n events = $._data(elem, 'events');\r\n if (events && events.remove) {\r\n $(elem).triggerHandler('remove');\r\n }\r\n\r\n // Http://bugs.jquery.com/ticket/8235\r\n } catch (e) {\r\n }\r\n }\r\n orig(elems);\r\n };\r\n })($.cleanData);\r\n }\r\n /* jshint ignore:end */\r\n // jscs:enable\r\n\r\n var // currently active contextMenu trigger\r\n $currentTrigger = null,\r\n // is contextMenu initialized with at least one menu?\r\n initialized = false,\r\n // window handle\r\n $win = $(window),\r\n // number of registered menus\r\n counter = 0,\r\n // mapping selector to namespace\r\n namespaces = {},\r\n // mapping namespace to options\r\n menus = {},\r\n // custom command type handlers\r\n types = {},\r\n // default values\r\n defaults = {\r\n // selector of contextMenu trigger\r\n selector: null,\r\n // where to append the menu to\r\n appendTo: null,\r\n // method to trigger context menu [\"right\", \"left\", \"hover\"]\r\n trigger: 'right',\r\n // hide menu when mouse leaves trigger / menu elements\r\n autoHide: false,\r\n // ms to wait before showing a hover-triggered context menu\r\n delay: 200,\r\n // flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu\r\n // as long as the trigger happened on one of the trigger-element's child nodes\r\n reposition: true,\r\n // Flag denoting if a second trigger should close the menu, as long as\r\n // the trigger happened on one of the trigger-element's child nodes.\r\n // This overrides the reposition option.\r\n hideOnSecondTrigger: false,\r\n\r\n //ability to select submenu\r\n selectableSubMenu: false,\r\n\r\n // Default classname configuration to be able avoid conflicts in frameworks\r\n classNames: {\r\n hover: 'context-menu-hover', // Item hover\r\n disabled: 'context-menu-disabled', // Item disabled\r\n visible: 'context-menu-visible', // Item visible\r\n notSelectable: 'context-menu-not-selectable', // Item not selectable\r\n\r\n icon: 'context-menu-icon',\r\n iconEdit: 'context-menu-icon-edit',\r\n iconCut: 'context-menu-icon-cut',\r\n iconCopy: 'context-menu-icon-copy',\r\n iconPaste: 'context-menu-icon-paste',\r\n iconDelete: 'context-menu-icon-delete',\r\n iconAdd: 'context-menu-icon-add',\r\n iconQuit: 'context-menu-icon-quit',\r\n iconLoadingClass: 'context-menu-icon-loading'\r\n },\r\n\r\n // determine position to show menu at\r\n determinePosition: function ($menu) {\r\n // position to the lower middle of the trigger element\r\n if ($.ui && $.ui.position) {\r\n // .position() is provided as a jQuery UI utility\r\n // (...and it won't work on hidden elements)\r\n $menu.css('display', 'block').position({\r\n my: 'center top',\r\n at: 'center bottom',\r\n of: this,\r\n offset: '0 5',\r\n collision: 'fit'\r\n }).css('display', 'none');\r\n } else {\r\n // determine contextMenu position\r\n var offset = this.offset();\r\n offset.top += this.outerHeight();\r\n offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2;\r\n $menu.css(offset);\r\n }\r\n },\r\n // position menu\r\n position: function (opt, x, y) {\r\n var offset;\r\n // determine contextMenu position\r\n if (!x && !y) {\r\n opt.determinePosition.call(this, opt.$menu);\r\n return;\r\n } else if (x === 'maintain' && y === 'maintain') {\r\n // x and y must not be changed (after re-show on command click)\r\n offset = opt.$menu.position();\r\n } else {\r\n // x and y are given (by mouse event)\r\n var offsetParentOffset = opt.$menu.offsetParent().offset();\r\n offset = {top: y - offsetParentOffset.top, left: x -offsetParentOffset.left};\r\n }\r\n\r\n // correct offset if viewport demands it\r\n var bottom = $win.scrollTop() + $win.height(),\r\n right = $win.scrollLeft() + $win.width(),\r\n height = opt.$menu.outerHeight(),\r\n width = opt.$menu.outerWidth();\r\n\r\n if (offset.top + height > bottom) {\r\n offset.top -= height;\r\n }\r\n\r\n if (offset.top < 0) {\r\n offset.top = 0;\r\n }\r\n\r\n if (offset.left + width > right) {\r\n offset.left -= width;\r\n }\r\n\r\n if (offset.left < 0) {\r\n offset.left = 0;\r\n }\r\n\r\n opt.$menu.css(offset);\r\n },\r\n // position the sub-menu\r\n positionSubmenu: function ($menu) {\r\n if (typeof $menu === 'undefined') {\r\n // When user hovers over item (which has sub items) handle.focusItem will call this.\r\n // but the submenu does not exist yet if opt.items is a promise. just return, will\r\n // call positionSubmenu after promise is completed.\r\n return;\r\n }\r\n if ($.ui && $.ui.position) {\r\n // .position() is provided as a jQuery UI utility\r\n // (...and it won't work on hidden elements)\r\n $menu.css('display', 'block').position({\r\n my: 'left top-5',\r\n at: 'right top',\r\n of: this,\r\n collision: 'flipfit fit'\r\n }).css('display', '');\r\n } else {\r\n // determine contextMenu position\r\n var offset = {\r\n top: -9,\r\n left: this.outerWidth() - 5\r\n };\r\n $menu.css(offset);\r\n }\r\n },\r\n // offset to add to zIndex\r\n zIndex: 1,\r\n // show hide animation settings\r\n animation: {\r\n duration: 50,\r\n show: 'slideDown',\r\n hide: 'slideUp'\r\n },\r\n // events\r\n events: {\r\n preShow: $.noop,\r\n show: $.noop,\r\n hide: $.noop,\r\n activated: $.noop\r\n },\r\n // default callback\r\n callback: null,\r\n // list of contextMenu items\r\n items: {}\r\n },\r\n // mouse position for hover activation\r\n hoveract = {\r\n timer: null,\r\n pageX: null,\r\n pageY: null\r\n },\r\n // determine zIndex\r\n zindex = function ($t) {\r\n var zin = 0,\r\n $tt = $t;\r\n\r\n while (true) {\r\n zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0);\r\n $tt = $tt.parent();\r\n if (!$tt || !$tt.length || 'html body'.indexOf($tt.prop('nodeName').toLowerCase()) > -1) {\r\n break;\r\n }\r\n }\r\n return zin;\r\n },\r\n // event handlers\r\n handle = {\r\n // abort anything\r\n abortevent: function (e) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n },\r\n // contextmenu show dispatcher\r\n contextmenu: function (e) {\r\n var $this = $(this);\r\n\r\n //Show browser context-menu when preShow returns false\r\n if (e.data.events.preShow($this,e) === false) {\r\n return;\r\n }\r\n\r\n // disable actual context-menu if we are using the right mouse button as the trigger\r\n if (e.data.trigger === 'right') {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n }\r\n\r\n // abort native-triggered events unless we're triggering on right click\r\n if ((e.data.trigger !== 'right' && e.data.trigger !== 'demand') && e.originalEvent) {\r\n return;\r\n }\r\n\r\n // Let the current contextmenu decide if it should show or not based on its own trigger settings\r\n if (typeof e.mouseButton !== 'undefined' && e.data) {\r\n if (!(e.data.trigger === 'left' && e.mouseButton === 0) && !(e.data.trigger === 'right' && e.mouseButton === 2)) {\r\n // Mouse click is not valid.\r\n return;\r\n }\r\n }\r\n\r\n // abort event if menu is visible for this trigger\r\n if ($this.hasClass('context-menu-active')) {\r\n return;\r\n }\r\n\r\n if (!$this.hasClass('context-menu-disabled')) {\r\n // theoretically need to fire a show event at \r\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus\r\n // var evt = jQuery.Event(\"show\", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this });\r\n // e.data.$menu.trigger(evt);\r\n\r\n $currentTrigger = $this;\r\n if (e.data.build) {\r\n var built = e.data.build($currentTrigger, e);\r\n // abort if build() returned false\r\n if (built === false) {\r\n return;\r\n }\r\n\r\n // dynamically build menu on invocation\r\n e.data = $.extend(true, {}, defaults, e.data, built || {});\r\n\r\n // abort if there are no items to display\r\n if (!e.data.items || $.isEmptyObject(e.data.items)) {\r\n // Note: jQuery captures and ignores errors from event handlers\r\n if (window.console) {\r\n (console.error || console.log).call(console, 'No items specified to show in contextMenu');\r\n }\r\n\r\n throw new Error('No Items specified');\r\n }\r\n\r\n // backreference for custom command type creation\r\n e.data.$trigger = $currentTrigger;\r\n\r\n op.create(e.data);\r\n }\r\n op.show.call($this, e.data, e.pageX, e.pageY);\r\n }\r\n },\r\n // contextMenu left-click trigger\r\n click: function (e) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n $(this).trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY}));\r\n },\r\n // contextMenu right-click trigger\r\n mousedown: function (e) {\r\n // register mouse down\r\n var $this = $(this);\r\n\r\n // hide any previous menus\r\n if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) {\r\n $currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide');\r\n }\r\n\r\n // activate on right click\r\n if (e.button === 2) {\r\n $currentTrigger = $this.data('contextMenuActive', true);\r\n }\r\n },\r\n // contextMenu right-click trigger\r\n mouseup: function (e) {\r\n // show menu\r\n var $this = $(this);\r\n if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n $currentTrigger = $this;\r\n $this.trigger($.Event('contextmenu', {data: e.data, pageX: e.pageX, pageY: e.pageY}));\r\n }\r\n\r\n $this.removeData('contextMenuActive');\r\n },\r\n // contextMenu hover trigger\r\n mouseenter: function (e) {\r\n var $this = $(this),\r\n $related = $(e.relatedTarget),\r\n $document = $(document);\r\n\r\n // abort if we're coming from a menu\r\n if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {\r\n return;\r\n }\r\n\r\n // abort if a menu is shown\r\n if ($currentTrigger && $currentTrigger.length) {\r\n return;\r\n }\r\n\r\n hoveract.pageX = e.pageX;\r\n hoveract.pageY = e.pageY;\r\n hoveract.data = e.data;\r\n $document.on('mousemove.contextMenuShow', handle.mousemove);\r\n hoveract.timer = setTimeout(function () {\r\n hoveract.timer = null;\r\n $document.off('mousemove.contextMenuShow');\r\n $currentTrigger = $this;\r\n $this.trigger($.Event('contextmenu', {\r\n data: hoveract.data,\r\n pageX: hoveract.pageX,\r\n pageY: hoveract.pageY\r\n }));\r\n }, e.data.delay);\r\n },\r\n // contextMenu hover trigger\r\n mousemove: function (e) {\r\n hoveract.pageX = e.pageX;\r\n hoveract.pageY = e.pageY;\r\n },\r\n // contextMenu hover trigger\r\n mouseleave: function (e) {\r\n // abort if we're leaving for a menu\r\n var $related = $(e.relatedTarget);\r\n if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {\r\n return;\r\n }\r\n\r\n try {\r\n clearTimeout(hoveract.timer);\r\n } catch (e) {\r\n }\r\n\r\n hoveract.timer = null;\r\n },\r\n // click on layer to hide contextMenu\r\n layerClick: function (e) {\r\n var $this = $(this),\r\n root = $this.data('contextMenuRoot'),\r\n button = e.button,\r\n x = e.pageX,\r\n y = e.pageY,\r\n fakeClick = x === undefined,\r\n target,\r\n offset;\r\n\r\n e.preventDefault();\r\n\r\n setTimeout(function () {\r\n // If the click is not real, things break: https://github.com/swisnl/jQuery-contextMenu/issues/132\r\n if(fakeClick){\r\n if (root !== null && typeof root !== 'undefined' && root.$menu !== null && typeof root.$menu !== 'undefined') {\r\n root.$menu.trigger('contextmenu:hide');\r\n }\r\n return;\r\n }\r\n\r\n var $window;\r\n var triggerAction = ((root.trigger === 'left' && button === 0) || (root.trigger === 'right' && button === 2));\r\n\r\n // find the element that would've been clicked, wasn't the layer in the way\r\n if (document.elementFromPoint && root.$layer) {\r\n root.$layer.hide();\r\n target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop());\r\n\r\n // also need to try and focus this element if we're in a contenteditable area,\r\n // as the layer will prevent the browser mouse action we want\r\n if (target.isContentEditable) {\r\n var range = document.createRange(),\r\n sel = window.getSelection();\r\n range.selectNode(target);\r\n range.collapse(true);\r\n sel.removeAllRanges();\r\n sel.addRange(range);\r\n }\r\n $(target).trigger(e);\r\n root.$layer.show();\r\n }\r\n\r\n if (root.hideOnSecondTrigger && triggerAction && root.$menu !== null && typeof root.$menu !== 'undefined') {\r\n root.$menu.trigger('contextmenu:hide');\r\n return;\r\n }\r\n\r\n if (root.reposition && triggerAction) {\r\n if (document.elementFromPoint) {\r\n if (root.$trigger.is(target)) {\r\n root.position.call(root.$trigger, root, x, y);\r\n return;\r\n }\r\n } else {\r\n offset = root.$trigger.offset();\r\n $window = $(window);\r\n // while this looks kinda awful, it's the best way to avoid\r\n // unnecessarily calculating any positions\r\n offset.top += $window.scrollTop();\r\n if (offset.top <= e.pageY) {\r\n offset.left += $window.scrollLeft();\r\n if (offset.left <= e.pageX) {\r\n offset.bottom = offset.top + root.$trigger.outerHeight();\r\n if (offset.bottom >= e.pageY) {\r\n offset.right = offset.left + root.$trigger.outerWidth();\r\n if (offset.right >= e.pageX) {\r\n // reposition\r\n root.position.call(root.$trigger, root, x, y);\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (target && triggerAction) {\r\n root.$trigger.one('contextmenu:hidden', function () {\r\n $(target).contextMenu({x: x, y: y, button: button});\r\n });\r\n }\r\n\r\n if (root !== null && typeof root !== 'undefined' && root.$menu !== null && typeof root.$menu !== 'undefined') {\r\n root.$menu.trigger('contextmenu:hide');\r\n }\r\n }, 50);\r\n },\r\n // key handled :hover\r\n keyStop: function (e, opt) {\r\n if (!opt.isInput) {\r\n e.preventDefault();\r\n }\r\n\r\n e.stopPropagation();\r\n },\r\n key: function (e) {\r\n\r\n var opt = {};\r\n\r\n // Only get the data from $currentTrigger if it exists\r\n if ($currentTrigger) {\r\n opt = $currentTrigger.data('contextMenu') || {};\r\n }\r\n // If the trigger happen on a element that are above the contextmenu do this\r\n if (typeof opt.zIndex === 'undefined') {\r\n opt.zIndex = 0;\r\n }\r\n var targetZIndex = 0;\r\n var getZIndexOfTriggerTarget = function (target) {\r\n if (target.style.zIndex !== '') {\r\n targetZIndex = target.style.zIndex;\r\n } else {\r\n if (target.offsetParent !== null && typeof target.offsetParent !== 'undefined') {\r\n getZIndexOfTriggerTarget(target.offsetParent);\r\n }\r\n else if (target.parentElement !== null && typeof target.parentElement !== 'undefined') {\r\n getZIndexOfTriggerTarget(target.parentElement);\r\n }\r\n }\r\n };\r\n getZIndexOfTriggerTarget(e.target);\r\n // If targetZIndex is heigher then opt.zIndex dont progress any futher.\r\n // This is used to make sure that if you are using a dialog with a input / textarea / contenteditable div\r\n // and its above the contextmenu it wont steal keys events\r\n if (opt.$menu && parseInt(targetZIndex,10) > parseInt(opt.$menu.css(\"zIndex\"),10)) {\r\n return;\r\n }\r\n switch (e.keyCode) {\r\n case 9:\r\n case 38: // up\r\n handle.keyStop(e, opt);\r\n // if keyCode is [38 (up)] or [9 (tab) with shift]\r\n if (opt.isInput) {\r\n if (e.keyCode === 9 && e.shiftKey) {\r\n e.preventDefault();\r\n if (opt.$selected) {\r\n opt.$selected.find('input, textarea, select').blur();\r\n }\r\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\r\n opt.$menu.trigger('prevcommand');\r\n }\r\n return;\r\n } else if (e.keyCode === 38 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') {\r\n // checkboxes don't capture this key\r\n e.preventDefault();\r\n return;\r\n }\r\n } else if (e.keyCode !== 9 || e.shiftKey) {\r\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\r\n opt.$menu.trigger('prevcommand');\r\n }\r\n return;\r\n }\r\n break;\r\n // omitting break;\r\n // case 9: // tab - reached through omitted break;\r\n case 40: // down\r\n handle.keyStop(e, opt);\r\n if (opt.isInput) {\r\n if (e.keyCode === 9) {\r\n e.preventDefault();\r\n if (opt.$selected) {\r\n opt.$selected.find('input, textarea, select').blur();\r\n }\r\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\r\n opt.$menu.trigger('nextcommand');\r\n }\r\n return;\r\n } else if (e.keyCode === 40 && opt.$selected.find('input, textarea, select').prop('type') === 'checkbox') {\r\n // checkboxes don't capture this key\r\n e.preventDefault();\r\n return;\r\n }\r\n } else {\r\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\r\n opt.$menu.trigger('nextcommand');\r\n }\r\n return;\r\n }\r\n break;\r\n\r\n case 37: // left\r\n handle.keyStop(e, opt);\r\n if (opt.isInput || !opt.$selected || !opt.$selected.length) {\r\n break;\r\n }\r\n\r\n if (!opt.$selected.parent().hasClass('context-menu-root')) {\r\n var $parent = opt.$selected.parent().parent();\r\n opt.$selected.trigger('contextmenu:blur');\r\n opt.$selected = $parent;\r\n return;\r\n }\r\n break;\r\n\r\n case 39: // right\r\n handle.keyStop(e, opt);\r\n if (opt.isInput || !opt.$selected || !opt.$selected.length) {\r\n break;\r\n }\r\n\r\n var itemdata = opt.$selected.data('contextMenu') || {};\r\n if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) {\r\n opt.$selected = null;\r\n itemdata.$selected = null;\r\n itemdata.$menu.trigger('nextcommand');\r\n return;\r\n }\r\n break;\r\n\r\n case 35: // end\r\n case 36: // home\r\n if (opt.$selected && opt.$selected.find('input, textarea, select').length) {\r\n return;\r\n } else {\r\n (opt.$selected && opt.$selected.parent() || opt.$menu)\r\n .children(':not(.' + opt.classNames.disabled + ', .' + opt.classNames.notSelectable + ')')[e.keyCode === 36 ? 'first' : 'last']()\r\n .trigger('contextmenu:focus');\r\n e.preventDefault();\r\n return;\r\n }\r\n break;\r\n\r\n case 13: // enter\r\n handle.keyStop(e, opt);\r\n if (opt.isInput) {\r\n if (opt.$selected && !opt.$selected.is('textarea, select')) {\r\n e.preventDefault();\r\n return;\r\n }\r\n break;\r\n }\r\n if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) {\r\n opt.$selected.trigger('mouseup');\r\n }\r\n return;\r\n\r\n case 32: // space\r\n case 33: // page up\r\n case 34: // page down\r\n // prevent browser from scrolling down while menu is visible\r\n handle.keyStop(e, opt);\r\n return;\r\n\r\n case 27: // esc\r\n handle.keyStop(e, opt);\r\n if (opt.$menu !== null && typeof opt.$menu !== 'undefined') {\r\n opt.$menu.trigger('contextmenu:hide');\r\n }\r\n return;\r\n\r\n default: // 0-9, a-z\r\n var k = (String.fromCharCode(e.keyCode)).toUpperCase();\r\n if (opt.accesskeys && opt.accesskeys[k]) {\r\n // according to the specs accesskeys must be invoked immediately\r\n opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu ? 'contextmenu:focus' : 'mouseup');\r\n return;\r\n }\r\n break;\r\n }\r\n // pass event to selected item,\r\n // stop propagation to avoid endless recursion\r\n e.stopPropagation();\r\n if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) {\r\n opt.$selected.trigger(e);\r\n }\r\n },\r\n // select previous possible command in menu\r\n prevItem: function (e) {\r\n e.stopPropagation();\r\n var opt = $(this).data('contextMenu') || {};\r\n var root = $(this).data('contextMenuRoot') || {};\r\n\r\n // obtain currently selected menu\r\n if (opt.$selected) {\r\n var $s = opt.$selected;\r\n opt = opt.$selected.parent().data('contextMenu') || {};\r\n opt.$selected = $s;\r\n }\r\n\r\n var $children = opt.$menu.children(),\r\n $prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(),\r\n $round = $prev;\r\n\r\n // skip disabled or hidden elements\r\n while ($prev.hasClass(root.classNames.disabled) || $prev.hasClass(root.classNames.notSelectable) || $prev.is(':hidden')) {\r\n if ($prev.prev().length) {\r\n $prev = $prev.prev();\r\n } else {\r\n $prev = $children.last();\r\n }\r\n if ($prev.is($round)) {\r\n // break endless loop\r\n return;\r\n }\r\n }\r\n\r\n // leave current\r\n if (opt.$selected) {\r\n handle.itemMouseleave.call(opt.$selected.get(0), e);\r\n }\r\n\r\n // activate next\r\n handle.itemMouseenter.call($prev.get(0), e);\r\n\r\n // focus input\r\n var $input = $prev.find('input, textarea, select');\r\n if ($input.length) {\r\n $input.focus();\r\n }\r\n },\r\n // select next possible command in menu\r\n nextItem: function (e) {\r\n e.stopPropagation();\r\n var opt = $(this).data('contextMenu') || {};\r\n var root = $(this).data('contextMenuRoot') || {};\r\n\r\n // obtain currently selected menu\r\n if (opt.$selected) {\r\n var $s = opt.$selected;\r\n opt = opt.$selected.parent().data('contextMenu') || {};\r\n opt.$selected = $s;\r\n }\r\n\r\n var $children = opt.$menu.children(),\r\n $next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(),\r\n $round = $next;\r\n\r\n // skip disabled\r\n while ($next.hasClass(root.classNames.disabled) || $next.hasClass(root.classNames.notSelectable) || $next.is(':hidden')) {\r\n if ($next.next().length) {\r\n $next = $next.next();\r\n } else {\r\n $next = $children.first();\r\n }\r\n if ($next.is($round)) {\r\n // break endless loop\r\n return;\r\n }\r\n }\r\n\r\n // leave current\r\n if (opt.$selected) {\r\n handle.itemMouseleave.call(opt.$selected.get(0), e);\r\n }\r\n\r\n // activate next\r\n handle.itemMouseenter.call($next.get(0), e);\r\n\r\n // focus input\r\n var $input = $next.find('input, textarea, select');\r\n if ($input.length) {\r\n $input.focus();\r\n }\r\n },\r\n // flag that we're inside an input so the key handler can act accordingly\r\n focusInput: function () {\r\n var $this = $(this).closest('.context-menu-item'),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot;\r\n\r\n root.$selected = opt.$selected = $this;\r\n root.isInput = opt.isInput = true;\r\n },\r\n // flag that we're inside an input so the key handler can act accordingly\r\n blurInput: function () {\r\n var $this = $(this).closest('.context-menu-item'),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot;\r\n\r\n root.isInput = opt.isInput = false;\r\n },\r\n // :hover on menu\r\n menuMouseenter: function () {\r\n var root = $(this).data().contextMenuRoot;\r\n root.hovering = true;\r\n },\r\n // :hover on menu\r\n menuMouseleave: function (e) {\r\n var root = $(this).data().contextMenuRoot;\r\n if (root.$layer && root.$layer.is(e.relatedTarget)) {\r\n root.hovering = false;\r\n }\r\n },\r\n // :hover done manually so key handling is possible\r\n itemMouseenter: function (e) {\r\n var $this = $(this),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot;\r\n\r\n root.hovering = true;\r\n\r\n // abort if we're re-entering\r\n if (e && root.$layer && root.$layer.is(e.relatedTarget)) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n }\r\n\r\n // make sure only one item is selected\r\n (opt.$menu ? opt : root).$menu\r\n .children('.' + root.classNames.hover).trigger('contextmenu:blur')\r\n .children('.hover').trigger('contextmenu:blur');\r\n\r\n if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {\r\n opt.$selected = null;\r\n return;\r\n }\r\n\r\n\r\n $this.trigger('contextmenu:focus');\r\n },\r\n // :hover done manually so key handling is possible\r\n itemMouseleave: function (e) {\r\n var $this = $(this),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot;\r\n\r\n if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) {\r\n if (typeof root.$selected !== 'undefined' && root.$selected !== null) {\r\n root.$selected.trigger('contextmenu:blur');\r\n }\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n root.$selected = opt.$selected = opt.$node;\r\n return;\r\n }\r\n\r\n if(opt && opt.$menu && opt.$menu.hasClass('context-menu-visible')){\r\n return;\r\n }\r\n\r\n $this.trigger('contextmenu:blur');\r\n },\r\n // contextMenu item click\r\n itemClick: function (e) {\r\n var $this = $(this),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot,\r\n key = data.contextMenuKey,\r\n callback;\r\n\r\n // abort if the key is unknown or disabled or is a menu\r\n if (!opt.items[key] || $this.is('.' + root.classNames.disabled + ', .context-menu-separator, .' + root.classNames.notSelectable) || ($this.is('.context-menu-submenu') && root.selectableSubMenu === false )) {\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n\r\n if ($.isFunction(opt.callbacks[key]) && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) {\r\n // item-specific callback\r\n callback = opt.callbacks[key];\r\n } else if ($.isFunction(root.callback)) {\r\n // default callback\r\n callback = root.callback;\r\n } else {\r\n // no callback, no action\r\n return;\r\n }\r\n\r\n // hide menu if callback doesn't stop that\r\n if (callback.call(root.$trigger, key, root, e) !== false) {\r\n root.$menu.trigger('contextmenu:hide');\r\n } else if (root.$menu.parent().length) {\r\n op.update.call(root.$trigger, root);\r\n }\r\n },\r\n // ignore click events on input elements\r\n inputClick: function (e) {\r\n e.stopImmediatePropagation();\r\n },\r\n // hide \r\n hideMenu: function (e, data) {\r\n var root = $(this).data('contextMenuRoot');\r\n op.hide.call(root.$trigger, root, data && data.force);\r\n },\r\n // focus \r\n focusItem: function (e) {\r\n e.stopPropagation();\r\n var $this = $(this),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot;\r\n\r\n if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {\r\n return;\r\n }\r\n\r\n $this\r\n .addClass([root.classNames.hover, root.classNames.visible].join(' '))\r\n // select other items and included items\r\n .parent().find('.context-menu-item').not($this)\r\n .removeClass(root.classNames.visible)\r\n .filter('.' + root.classNames.hover)\r\n .trigger('contextmenu:blur');\r\n\r\n // remember selected\r\n opt.$selected = root.$selected = $this;\r\n\r\n\r\n if(opt && opt.$node && opt.$node.hasClass('context-menu-submenu')){\r\n opt.$node.addClass(root.classNames.hover);\r\n }\r\n\r\n // position sub-menu - do after show so dumb $.ui.position can keep up\r\n if (opt.$node) {\r\n root.positionSubmenu.call(opt.$node, opt.$menu);\r\n }\r\n },\r\n // blur \r\n blurItem: function (e) {\r\n e.stopPropagation();\r\n var $this = $(this),\r\n data = $this.data(),\r\n opt = data.contextMenu,\r\n root = data.contextMenuRoot;\r\n\r\n if (opt.autoHide) { // for tablets and touch screens this needs to remain\r\n $this.removeClass(root.classNames.visible);\r\n }\r\n $this.removeClass(root.classNames.hover);\r\n opt.$selected = null;\r\n }\r\n },\r\n // operations\r\n op = {\r\n show: function (opt, x, y) {\r\n var $trigger = $(this),\r\n css = {};\r\n\r\n // hide any open menus\r\n $('#context-menu-layer').trigger('mousedown');\r\n\r\n // backreference for callbacks\r\n opt.$trigger = $trigger;\r\n\r\n // show event\r\n if (opt.events.show.call($trigger, opt) === false) {\r\n $currentTrigger = null;\r\n return;\r\n }\r\n\r\n // create or update context menu\r\n var hasVisibleItems = op.update.call($trigger, opt);\r\n if (hasVisibleItems === false) {\r\n $currentTrigger = null;\r\n return;\r\n }\r\n\r\n // position menu\r\n opt.position.call($trigger, opt, x, y);\r\n\r\n // make sure we're in front\r\n if (opt.zIndex) {\r\n var additionalZValue = opt.zIndex;\r\n // If opt.zIndex is a function, call the function to get the right zIndex.\r\n if (typeof opt.zIndex === 'function') {\r\n additionalZValue = opt.zIndex.call($trigger, opt);\r\n }\r\n css.zIndex = zindex($trigger) + additionalZValue;\r\n }\r\n\r\n // add layer\r\n op.layer.call(opt.$menu, opt, css.zIndex);\r\n\r\n // adjust sub-menu zIndexes\r\n opt.$menu.find('ul').css('zIndex', css.zIndex + 1);\r\n\r\n // position and show context menu\r\n opt.$menu.css(css)[opt.animation.show](opt.animation.duration, function () {\r\n $trigger.trigger('contextmenu:visible');\r\n\r\n op.activated(opt);\r\n opt.events.activated(opt);\r\n });\r\n // make options available and set state\r\n $trigger\r\n .data('contextMenu', opt)\r\n .addClass('context-menu-active');\r\n\r\n // register key handler\r\n $(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key);\r\n // register autoHide handler\r\n if (opt.autoHide) {\r\n // mouse position handler\r\n $(document).on('mousemove.contextMenuAutoHide', function (e) {\r\n // need to capture the offset on mousemove,\r\n // since the page might've been scrolled since activation\r\n var pos = $trigger.offset();\r\n pos.right = pos.left + $trigger.outerWidth();\r\n pos.bottom = pos.top + $trigger.outerHeight();\r\n\r\n if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) {\r\n /* Additional hover check after short time, you might just miss the edge of the menu */\r\n setTimeout(function () {\r\n if (!opt.hovering && opt.$menu !== null && typeof opt.$menu !== 'undefined') {\r\n opt.$menu.trigger('contextmenu:hide');\r\n }\r\n }, 50);\r\n }\r\n });\r\n }\r\n },\r\n hide: function (opt, force) {\r\n var $trigger = $(this);\r\n if (!opt) {\r\n opt = $trigger.data('contextMenu') || {};\r\n }\r\n\r\n // hide event\r\n if (!force && opt.events && opt.events.hide.call($trigger, opt) === false) {\r\n return;\r\n }\r\n\r\n // remove options and revert state\r\n $trigger\r\n .removeData('contextMenu')\r\n .removeClass('context-menu-active');\r\n\r\n if (opt.$layer) {\r\n // keep layer for a bit so the contextmenu event can be aborted properly by opera\r\n setTimeout((function ($layer) {\r\n return function () {\r\n $layer.remove();\r\n };\r\n })(opt.$layer), 10);\r\n\r\n try {\r\n delete opt.$layer;\r\n } catch (e) {\r\n opt.$layer = null;\r\n }\r\n }\r\n\r\n // remove handle\r\n $currentTrigger = null;\r\n // remove selected\r\n opt.$menu.find('.' + opt.classNames.hover).trigger('contextmenu:blur');\r\n opt.$selected = null;\r\n // collapse all submenus\r\n opt.$menu.find('.' + opt.classNames.visible).removeClass(opt.classNames.visible);\r\n // unregister key and mouse handlers\r\n // $(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705\r\n $(document).off('.contextMenuAutoHide').off('keydown.contextMenu');\r\n // hide menu\r\n if (opt.$menu) {\r\n opt.$menu[opt.animation.hide](opt.animation.duration, function () {\r\n // tear down dynamically built menu after animation is completed.\r\n if (opt.build) {\r\n opt.$menu.remove();\r\n $.each(opt, function (key) {\r\n switch (key) {\r\n case 'ns':\r\n case 'selector':\r\n case 'build':\r\n case 'trigger':\r\n return true;\r\n\r\n default:\r\n opt[key] = undefined;\r\n try {\r\n delete opt[key];\r\n } catch (e) {\r\n }\r\n return true;\r\n }\r\n });\r\n }\r\n\r\n setTimeout(function () {\r\n $trigger.trigger('contextmenu:hidden');\r\n }, 10);\r\n });\r\n }\r\n },\r\n create: function (opt, root) {\r\n if (typeof root === 'undefined') {\r\n root = opt;\r\n }\r\n\r\n // create contextMenu\r\n opt.$menu = $('
      ').addClass(opt.className || '').data({\r\n 'contextMenu': opt,\r\n 'contextMenuRoot': root\r\n });\r\n if(opt.dataAttr){\r\n $.each(opt.dataAttr, function (key, item) {\r\n opt.$menu.attr('data-' + opt.key, item);\r\n });\r\n }\r\n\r\n $.each(['callbacks', 'commands', 'inputs'], function (i, k) {\r\n opt[k] = {};\r\n if (!root[k]) {\r\n root[k] = {};\r\n }\r\n });\r\n\r\n if (!root.accesskeys) {\r\n root.accesskeys = {};\r\n }\r\n\r\n function createNameNode(item) {\r\n var $name = $('');\r\n if (item._accesskey) {\r\n if (item._beforeAccesskey) {\r\n $name.append(document.createTextNode(item._beforeAccesskey));\r\n }\r\n $('')\r\n .addClass('context-menu-accesskey')\r\n .text(item._accesskey)\r\n .appendTo($name);\r\n if (item._afterAccesskey) {\r\n $name.append(document.createTextNode(item._afterAccesskey));\r\n }\r\n } else {\r\n if (item.isHtmlName) {\r\n // restrict use with access keys\r\n if (typeof item.accesskey !== 'undefined') {\r\n throw new Error('accesskeys are not compatible with HTML names and cannot be used together in the same item');\r\n }\r\n $name.html(item.name);\r\n } else {\r\n $name.text(item.name);\r\n }\r\n }\r\n return $name;\r\n }\r\n\r\n // create contextMenu items\r\n $.each(opt.items, function (key, item) {\r\n var $t = $('
    • ').addClass(item.className || ''),\r\n $label = null,\r\n $input = null;\r\n\r\n // iOS needs to see a click-event bound to an element to actually\r\n // have the TouchEvents infrastructure trigger the click event\r\n $t.on('click', $.noop);\r\n\r\n // Make old school string seperator a real item so checks wont be\r\n // akward later.\r\n // And normalize 'cm_separator' into 'cm_seperator'.\r\n if (typeof item === 'string' || item.type === 'cm_separator') {\r\n item = {type: 'cm_seperator'};\r\n }\r\n\r\n item.$node = $t.data({\r\n 'contextMenu': opt,\r\n 'contextMenuRoot': root,\r\n 'contextMenuKey': key\r\n });\r\n\r\n // register accesskey\r\n // NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that\r\n if (typeof item.accesskey !== 'undefined') {\r\n var aks = splitAccesskey(item.accesskey);\r\n for (var i = 0, ak; ak = aks[i]; i++) {\r\n if (!root.accesskeys[ak]) {\r\n root.accesskeys[ak] = item;\r\n var matched = item.name.match(new RegExp('^(.*?)(' + ak + ')(.*)$', 'i'));\r\n if (matched) {\r\n item._beforeAccesskey = matched[1];\r\n item._accesskey = matched[2];\r\n item._afterAccesskey = matched[3];\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (item.type && types[item.type]) {\r\n // run custom type handler\r\n types[item.type].call($t, item, opt, root);\r\n // register commands\r\n $.each([opt, root], function (i, k) {\r\n k.commands[key] = item;\r\n // Overwrite only if undefined or the item is appended to the root. This so it\r\n // doesn't overwrite callbacks of root elements if the name is the same.\r\n if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {\r\n k.callbacks[key] = item.callback;\r\n }\r\n });\r\n } else {\r\n // add label for input\r\n if (item.type === 'cm_seperator') {\r\n $t.addClass('context-menu-separator ' + root.classNames.notSelectable);\r\n } else if (item.type === 'html') {\r\n $t.addClass('context-menu-html ' + root.classNames.notSelectable);\r\n } else if (item.type !== 'sub' && item.type) {\r\n $label = $('').appendTo($t);\r\n createNameNode(item).appendTo($label);\r\n\r\n $t.addClass('context-menu-input');\r\n opt.hasTypes = true;\r\n $.each([opt, root], function (i, k) {\r\n k.commands[key] = item;\r\n k.inputs[key] = item;\r\n });\r\n } else if (item.items) {\r\n item.type = 'sub';\r\n }\r\n\r\n switch (item.type) {\r\n case 'cm_seperator':\r\n break;\r\n\r\n case 'text':\r\n $input = $('')\r\n .attr('name', 'context-menu-input-' + key)\r\n .val(item.value || '')\r\n .appendTo($label);\r\n break;\r\n\r\n case 'textarea':\r\n $input = $('')\r\n .attr('name', 'context-menu-input-' + key)\r\n .val(item.value || '')\r\n .appendTo($label);\r\n\r\n if (item.height) {\r\n $input.height(item.height);\r\n }\r\n break;\r\n\r\n case 'checkbox':\r\n $input = $('')\r\n .attr('name', 'context-menu-input-' + key)\r\n .val(item.value || '')\r\n .prop('checked', !!item.selected)\r\n .prependTo($label);\r\n break;\r\n\r\n case 'radio':\r\n $input = $('')\r\n .attr('name', 'context-menu-input-' + item.radio)\r\n .val(item.value || '')\r\n .prop('checked', !!item.selected)\r\n .prependTo($label);\r\n break;\r\n\r\n case 'select':\r\n $input = $('')\r\n .attr('name', 'context-menu-input-' + key)\r\n .appendTo($label);\r\n if (item.options) {\r\n $.each(item.options, function (value, text) {\r\n $('').val(value).text(text).appendTo($input);\r\n });\r\n $input.val(item.selected);\r\n }\r\n break;\r\n\r\n case 'sub':\r\n createNameNode(item).appendTo($t);\r\n item.appendTo = item.$node;\r\n $t.data('contextMenu', item).addClass('context-menu-submenu');\r\n item.callback = null;\r\n\r\n // If item contains items, and this is a promise, we should create it later\r\n // check if subitems is of type promise. If it is a promise we need to create\r\n // it later, after promise has been resolved.\r\n if ('function' === typeof item.items.then) {\r\n // probably a promise, process it, when completed it will create the sub menu's.\r\n op.processPromises(item, root, item.items);\r\n } else {\r\n // normal submenu.\r\n op.create(item, root);\r\n }\r\n break;\r\n\r\n case 'html':\r\n $(item.html).appendTo($t);\r\n break;\r\n\r\n default:\r\n $.each([opt, root], function (i, k) {\r\n k.commands[key] = item;\r\n // Overwrite only if undefined or the item is appended to the root. This so it\r\n // doesn't overwrite callbacks of root elements if the name is the same.\r\n if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {\r\n k.callbacks[key] = item.callback;\r\n }\r\n });\r\n createNameNode(item).appendTo($t);\r\n break;\r\n }\r\n\r\n // disable key listener in \r\n if (item.type && item.type !== 'sub' && item.type !== 'html' && item.type !== 'cm_seperator') {\r\n $input\r\n .on('focus', handle.focusInput)\r\n .on('blur', handle.blurInput);\r\n\r\n if (item.events) {\r\n $input.on(item.events, opt);\r\n }\r\n }\r\n\r\n // add icons\r\n if (item.icon) {\r\n if ($.isFunction(item.icon)) {\r\n item._icon = item.icon.call(this, this, $t, key, item);\r\n } else {\r\n if (typeof(item.icon) === 'string' && (\r\n item.icon.substring(0, 4) === 'fab '\r\n || item.icon.substring(0, 4) === 'fas '\r\n || item.icon.substring(0, 4) === 'fad '\r\n || item.icon.substring(0, 4) === 'far '\r\n || item.icon.substring(0, 4) === 'fal ')\r\n ) {\r\n // to enable font awesome\r\n $t.addClass(root.classNames.icon + ' ' + root.classNames.icon + '--fa5');\r\n item._icon = $('');\r\n } else if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') {\r\n item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon;\r\n } else {\r\n item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;\r\n }\r\n }\r\n\r\n if(typeof(item._icon) === \"string\"){\r\n $t.addClass(item._icon);\r\n } else {\r\n $t.prepend(item._icon);\r\n }\r\n }\r\n }\r\n\r\n // cache contained elements\r\n item.$input = $input;\r\n item.$label = $label;\r\n\r\n // attach item to menu\r\n $t.appendTo(opt.$menu);\r\n\r\n // Disable text selection\r\n if (!opt.hasTypes && $.support.eventSelectstart) {\r\n // browsers support user-select: none,\r\n // IE has a special event for text-selection\r\n // browsers supporting neither will not be preventing text-selection\r\n $t.on('selectstart.disableTextSelect', handle.abortevent);\r\n }\r\n });\r\n // attach contextMenu to (to bypass any possible overflow:hidden issues on parents of the trigger element)\r\n if (!opt.$node) {\r\n opt.$menu.css('display', 'none').addClass('context-menu-root');\r\n }\r\n opt.$menu.appendTo(opt.appendTo || document.body);\r\n },\r\n resize: function ($menu, nested) {\r\n var domMenu;\r\n // determine widths of submenus, as CSS won't grow them automatically\r\n // position:absolute within position:absolute; min-width:100; max-width:200; results in width: 100;\r\n // kinda sucks hard...\r\n\r\n // determine width of absolutely positioned element\r\n $menu.css({position: 'absolute', display: 'block'});\r\n // don't apply yet, because that would break nested elements' widths\r\n $menu.data('width',\r\n (domMenu = $menu.get(0)).getBoundingClientRect ?\r\n Math.ceil(domMenu.getBoundingClientRect().width) :\r\n $menu.outerWidth() + 1); // outerWidth() returns rounded pixels\r\n // reset styles so they allow nested elements to grow/shrink naturally\r\n $menu.css({\r\n position: 'static',\r\n minWidth: '0px',\r\n maxWidth: '100000px'\r\n });\r\n // identify width of nested menus\r\n $menu.find('> li > ul').each(function () {\r\n op.resize($(this), true);\r\n });\r\n // reset and apply changes in the end because nested\r\n // elements' widths wouldn't be calculatable otherwise\r\n if (!nested) {\r\n $menu.find('ul').addBack().css({\r\n position: '',\r\n display: '',\r\n minWidth: '',\r\n maxWidth: ''\r\n }).outerWidth(function () {\r\n return $(this).data('width');\r\n });\r\n }\r\n },\r\n update: function (opt, root) {\r\n var $trigger = this;\r\n if (typeof root === 'undefined') {\r\n root = opt;\r\n op.resize(opt.$menu);\r\n }\r\n\r\n var hasVisibleItems = false;\r\n\r\n // re-check disabled for each item\r\n opt.$menu.children().each(function () {\r\n var $item = $(this),\r\n key = $item.data('contextMenuKey'),\r\n item = opt.items[key],\r\n disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true,\r\n visible;\r\n if ($.isFunction(item.visible)) {\r\n visible = item.visible.call($trigger, key, root);\r\n } else if (typeof item.visible !== 'undefined') {\r\n visible = item.visible === true;\r\n } else {\r\n visible = true;\r\n }\r\n\r\n if (visible) {\r\n hasVisibleItems = true;\r\n }\r\n\r\n $item[visible ? 'show' : 'hide']();\r\n\r\n // dis- / enable item\r\n $item[disabled ? 'addClass' : 'removeClass'](root.classNames.disabled);\r\n\r\n if ($.isFunction(item.icon)) {\r\n $item.removeClass(item._icon);\r\n var iconResult = item.icon.call(this, $trigger, $item, key, item);\r\n if(typeof(iconResult) === \"string\"){\r\n $item.addClass(iconResult);\r\n } else {\r\n $item.prepend(iconResult);\r\n }\r\n }\r\n\r\n if (item.type) {\r\n // dis- / enable input elements\r\n $item.find('input, select, textarea').prop('disabled', disabled);\r\n\r\n // update input states\r\n switch (item.type) {\r\n case 'text':\r\n case 'textarea':\r\n item.$input.val(item.value || '');\r\n break;\r\n\r\n case 'checkbox':\r\n case 'radio':\r\n item.$input.val(item.value || '').prop('checked', !!item.selected);\r\n break;\r\n\r\n case 'select':\r\n item.$input.val((item.selected === 0 ? \"0\" : item.selected) || '');\r\n break;\r\n }\r\n }\r\n\r\n if (item.$menu) {\r\n // update sub-menu\r\n var subMenuHasVisibleItems = op.update.call($trigger, item, root);\r\n if (subMenuHasVisibleItems) {\r\n hasVisibleItems = true;\r\n }\r\n }\r\n });\r\n return hasVisibleItems;\r\n },\r\n layer: function (opt, zIndex) {\r\n // add transparent layer for click area\r\n // filter and background for Internet Explorer, Issue #23\r\n var $layer = opt.$layer = $('
      ')\r\n .css({\r\n height: $win.height(),\r\n width: $win.width(),\r\n display: 'block',\r\n position: 'fixed',\r\n 'z-index': zIndex,\r\n top: 0,\r\n left: 0,\r\n opacity: 0,\r\n filter: 'alpha(opacity=0)',\r\n 'background-color': '#000'\r\n })\r\n .data('contextMenuRoot', opt)\r\n .insertBefore(this)\r\n .on('contextmenu', handle.abortevent)\r\n .on('mousedown', handle.layerClick);\r\n\r\n // IE6 doesn't know position:fixed;\r\n if (typeof document.body.style.maxWidth === 'undefined') { // IE6 doesn't support maxWidth\r\n $layer.css({\r\n 'position': 'absolute',\r\n 'height': $(document).height()\r\n });\r\n }\r\n\r\n return $layer;\r\n },\r\n processPromises: function (opt, root, promise) {\r\n // Start\r\n opt.$node.addClass(root.classNames.iconLoadingClass);\r\n\r\n function completedPromise(opt, root, items) {\r\n // Completed promise (dev called promise.resolve). We now have a list of items which can\r\n // be used to create the rest of the context menu.\r\n if (typeof items === 'undefined') {\r\n // Null result, dev should have checked\r\n errorPromise(undefined);//own error object\r\n }\r\n finishPromiseProcess(opt, root, items);\r\n }\r\n\r\n function errorPromise(opt, root, errorItem) {\r\n // User called promise.reject() with an error item, if not, provide own error item.\r\n if (typeof errorItem === 'undefined') {\r\n errorItem = {\r\n \"error\": {\r\n name: \"No items and no error item\",\r\n icon: \"context-menu-icon context-menu-icon-quit\"\r\n }\r\n };\r\n if (window.console) {\r\n (console.error || console.log).call(console, 'When you reject a promise, provide an \"items\" object, equal to normal sub-menu items');\r\n }\r\n } else if (typeof errorItem === 'string') {\r\n errorItem = {\"error\": {name: errorItem}};\r\n }\r\n finishPromiseProcess(opt, root, errorItem);\r\n }\r\n\r\n function finishPromiseProcess(opt, root, items) {\r\n if (typeof root.$menu === 'undefined' || !root.$menu.is(':visible')) {\r\n return;\r\n }\r\n opt.$node.removeClass(root.classNames.iconLoadingClass);\r\n opt.items = items;\r\n op.create(opt, root, true); // Create submenu\r\n op.update(opt, root); // Correctly update position if user is already hovered over menu item\r\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.\r\n }\r\n\r\n // Wait for promise completion. .then(success, error, notify) (we don't track notify). Bind the opt\r\n // and root to avoid scope problems\r\n promise.then(completedPromise.bind(this, opt, root), errorPromise.bind(this, opt, root));\r\n },\r\n // operation that will run after contextMenu showed on screen\r\n activated: function(opt){\r\n var $menu = opt.$menu;\r\n var $menuOffset = $menu.offset();\r\n var winHeight = $(window).height();\r\n var winScrollTop = $(window).scrollTop();\r\n var menuHeight = $menu.height();\r\n if(menuHeight > winHeight){\r\n $menu.css({\r\n 'height' : winHeight + 'px',\r\n 'overflow-x': 'hidden',\r\n 'overflow-y': 'auto',\r\n 'top': winScrollTop + 'px'\r\n });\r\n } else if(($menuOffset.top < winScrollTop) || ($menuOffset.top + menuHeight > winScrollTop + winHeight)){\r\n $menu.css({\r\n 'top': winScrollTop + 'px'\r\n });\r\n }\r\n }\r\n };\r\n\r\n // split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key\r\n function splitAccesskey(val) {\r\n var t = val.split(/\\s+/);\r\n var keys = [];\r\n\r\n for (var i = 0, k; k = t[i]; i++) {\r\n k = k.charAt(0).toUpperCase(); // first character only\r\n // theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it.\r\n // a map to look up already used access keys would be nice\r\n keys.push(k);\r\n }\r\n\r\n return keys;\r\n }\r\n\r\n// handle contextMenu triggers\r\n $.fn.contextMenu = function (operation) {\r\n var $t = this, $o = operation;\r\n if (this.length > 0) { // this is not a build on demand menu\r\n if (typeof operation === 'undefined') {\r\n this.first().trigger('contextmenu');\r\n } else if (typeof operation.x !== 'undefined' && typeof operation.y !== 'undefined') {\r\n this.first().trigger($.Event('contextmenu', {\r\n pageX: operation.x,\r\n pageY: operation.y,\r\n mouseButton: operation.button\r\n }));\r\n } else if (operation === 'hide') {\r\n var $menu = this.first().data('contextMenu') ? this.first().data('contextMenu').$menu : null;\r\n if ($menu) {\r\n $menu.trigger('contextmenu:hide');\r\n }\r\n } else if (operation === 'destroy') {\r\n $.contextMenu('destroy', {context: this});\r\n } else if ($.isPlainObject(operation)) {\r\n operation.context = this;\r\n $.contextMenu('create', operation);\r\n } else if (operation) {\r\n this.removeClass('context-menu-disabled');\r\n } else if (!operation) {\r\n this.addClass('context-menu-disabled');\r\n }\r\n } else {\r\n $.each(menus, function () {\r\n if (this.selector === $t.selector) {\r\n $o.data = this;\r\n\r\n $.extend($o.data, {trigger: 'demand'});\r\n }\r\n });\r\n\r\n handle.contextmenu.call($o.target, $o);\r\n }\r\n\r\n return this;\r\n };\r\n\r\n // manage contextMenu instances\r\n $.contextMenu = function (operation, options) {\r\n if (typeof operation !== 'string') {\r\n options = operation;\r\n operation = 'create';\r\n }\r\n\r\n if (typeof options === 'string') {\r\n options = {selector: options};\r\n } else if (typeof options === 'undefined') {\r\n options = {};\r\n }\r\n\r\n // merge with default options\r\n var o = $.extend(true, {}, defaults, options || {});\r\n var $document = $(document);\r\n var $context = $document;\r\n var _hasContext = false;\r\n\r\n if (!o.context || !o.context.length) {\r\n o.context = document;\r\n } else {\r\n // you never know what they throw at you...\r\n $context = $(o.context).first();\r\n o.context = $context.get(0);\r\n _hasContext = !$(o.context).is(document);\r\n }\r\n\r\n switch (operation) {\r\n\r\n case 'update':\r\n // Updates visibility and such\r\n if(_hasContext){\r\n op.update($context);\r\n } else {\r\n for(var menu in menus){\r\n if(menus.hasOwnProperty(menu)){\r\n op.update(menus[menu]);\r\n }\r\n }\r\n }\r\n break;\r\n\r\n case 'create':\r\n // no selector no joy\r\n if (!o.selector) {\r\n throw new Error('No selector specified');\r\n }\r\n // make sure internal classes are not bound to\r\n if (o.selector.match(/.context-menu-(list|item|input)($|\\s)/)) {\r\n throw new Error('Cannot bind to selector \"' + o.selector + '\" as it contains a reserved className');\r\n }\r\n if (!o.build && (!o.items || $.isEmptyObject(o.items))) {\r\n throw new Error('No Items specified');\r\n }\r\n counter++;\r\n o.ns = '.contextMenu' + counter;\r\n if (!_hasContext) {\r\n namespaces[o.selector] = o.ns;\r\n }\r\n menus[o.ns] = o;\r\n\r\n // default to right click\r\n if (!o.trigger) {\r\n o.trigger = 'right';\r\n }\r\n\r\n if (!initialized) {\r\n var itemClick = o.itemClickEvent === 'click' ? 'click.contextMenu' : 'mouseup.contextMenu';\r\n var contextMenuItemObj = {\r\n // 'mouseup.contextMenu': handle.itemClick,\r\n // 'click.contextMenu': handle.itemClick,\r\n 'contextmenu:focus.contextMenu': handle.focusItem,\r\n 'contextmenu:blur.contextMenu': handle.blurItem,\r\n 'contextmenu.contextMenu': handle.abortevent,\r\n 'mouseenter.contextMenu': handle.itemMouseenter,\r\n 'mouseleave.contextMenu': handle.itemMouseleave\r\n };\r\n contextMenuItemObj[itemClick] = handle.itemClick;\r\n // make sure item click is registered first\r\n $document\r\n .on({\r\n 'contextmenu:hide.contextMenu': handle.hideMenu,\r\n 'prevcommand.contextMenu': handle.prevItem,\r\n 'nextcommand.contextMenu': handle.nextItem,\r\n 'contextmenu.contextMenu': handle.abortevent,\r\n 'mouseenter.contextMenu': handle.menuMouseenter,\r\n 'mouseleave.contextMenu': handle.menuMouseleave\r\n }, '.context-menu-list')\r\n .on('mouseup.contextMenu', '.context-menu-input', handle.inputClick)\r\n .on(contextMenuItemObj, '.context-menu-item');\r\n\r\n initialized = true;\r\n }\r\n\r\n // engage native contextmenu event\r\n $context\r\n .on('contextmenu' + o.ns, o.selector, o, handle.contextmenu);\r\n\r\n if (_hasContext) {\r\n // add remove hook, just in case\r\n $context.on('remove' + o.ns, function () {\r\n $(this).contextMenu('destroy');\r\n });\r\n }\r\n\r\n switch (o.trigger) {\r\n case 'hover':\r\n $context\r\n .on('mouseenter' + o.ns, o.selector, o, handle.mouseenter)\r\n .on('mouseleave' + o.ns, o.selector, o, handle.mouseleave);\r\n break;\r\n\r\n case 'left':\r\n $context.on('click' + o.ns, o.selector, o, handle.click);\r\n break;\r\n\t\t\t\t case 'touchstart':\r\n $context.on('touchstart' + o.ns, o.selector, o, handle.click);\r\n break;\r\n /*\r\n default:\r\n // http://www.quirksmode.org/dom/events/contextmenu.html\r\n $document\r\n .on('mousedown' + o.ns, o.selector, o, handle.mousedown)\r\n .on('mouseup' + o.ns, o.selector, o, handle.mouseup);\r\n break;\r\n */\r\n }\r\n\r\n // create menu\r\n if (!o.build) {\r\n op.create(o);\r\n }\r\n break;\r\n\r\n case 'destroy':\r\n var $visibleMenu;\r\n if (_hasContext) {\r\n // get proper options\r\n var context = o.context;\r\n $.each(menus, function (ns, o) {\r\n\r\n if (!o) {\r\n return true;\r\n }\r\n\r\n // Is this menu equest to the context called from\r\n if (!$(context).is(o.selector)) {\r\n return true;\r\n }\r\n\r\n $visibleMenu = $('.context-menu-list').filter(':visible');\r\n if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is($(o.context).find(o.selector))) {\r\n $visibleMenu.trigger('contextmenu:hide', {force: true});\r\n }\r\n\r\n try {\r\n if (menus[o.ns].$menu) {\r\n menus[o.ns].$menu.remove();\r\n }\r\n\r\n delete menus[o.ns];\r\n } catch (e) {\r\n menus[o.ns] = null;\r\n }\r\n\r\n $(o.context).off(o.ns);\r\n\r\n return true;\r\n });\r\n } else if (!o.selector) {\r\n $document.off('.contextMenu .contextMenuAutoHide');\r\n $.each(menus, function (ns, o) {\r\n $(o.context).off(o.ns);\r\n });\r\n\r\n namespaces = {};\r\n menus = {};\r\n counter = 0;\r\n initialized = false;\r\n\r\n $('#context-menu-layer, .context-menu-list').remove();\r\n } else if (namespaces[o.selector]) {\r\n $visibleMenu = $('.context-menu-list').filter(':visible');\r\n if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) {\r\n $visibleMenu.trigger('contextmenu:hide', {force: true});\r\n }\r\n\r\n try {\r\n if (menus[namespaces[o.selector]].$menu) {\r\n menus[namespaces[o.selector]].$menu.remove();\r\n }\r\n\r\n delete menus[namespaces[o.selector]];\r\n } catch (e) {\r\n menus[namespaces[o.selector]] = null;\r\n }\r\n\r\n $document.off(namespaces[o.selector]);\r\n }\r\n break;\r\n\r\n case 'html5':\r\n // if and are not handled by the browser,\r\n // or options was a bool true,\r\n // initialize $.contextMenu for them\r\n if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options === 'boolean' && options)) {\r\n $('menu[type=\"context\"]').each(function () {\r\n if (this.id) {\r\n $.contextMenu({\r\n selector: '[contextmenu=' + this.id + ']',\r\n items: $.contextMenu.fromMenu(this)\r\n });\r\n }\r\n }).css('display', 'none');\r\n }\r\n break;\r\n\r\n default:\r\n throw new Error('Unknown operation \"' + operation + '\"');\r\n }\r\n\r\n return this;\r\n };\r\n\r\n// import values into commands\r\n $.contextMenu.setInputValues = function (opt, data) {\r\n if (typeof data === 'undefined') {\r\n data = {};\r\n }\r\n\r\n $.each(opt.inputs, function (key, item) {\r\n switch (item.type) {\r\n case 'text':\r\n case 'textarea':\r\n item.value = data[key] || '';\r\n break;\r\n\r\n case 'checkbox':\r\n item.selected = data[key] ? true : false;\r\n break;\r\n\r\n case 'radio':\r\n item.selected = (data[item.radio] || '') === item.value;\r\n break;\r\n\r\n case 'select':\r\n item.selected = data[key] || '';\r\n break;\r\n }\r\n });\r\n };\r\n\r\n// export values from commands\r\n $.contextMenu.getInputValues = function (opt, data) {\r\n if (typeof data === 'undefined') {\r\n data = {};\r\n }\r\n\r\n $.each(opt.inputs, function (key, item) {\r\n switch (item.type) {\r\n case 'text':\r\n case 'textarea':\r\n case 'select':\r\n data[key] = item.$input.val();\r\n break;\r\n\r\n case 'checkbox':\r\n data[key] = item.$input.prop('checked');\r\n break;\r\n\r\n case 'radio':\r\n if (item.$input.prop('checked')) {\r\n data[item.radio] = item.value;\r\n }\r\n break;\r\n }\r\n });\r\n\r\n return data;\r\n };\r\n\r\n// find