Changeset 2360349
- Timestamp:
- 08/13/2020 04:45:11 PM (5 years ago)
- Location:
- jarvis/trunk
- Files:
-
- 15 edited
-
README.md (modified) (1 diff)
-
dist/jarvis-user-profile.js.map (modified) (1 diff)
-
dist/jarvis.css (modified) (4 diffs)
-
dist/jarvis.css.map (modified) (1 diff)
-
dist/jarvis.js (modified) (1 diff)
-
dist/jarvis.js.map (modified) (1 diff)
-
jarvis.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
src/js/jarvis.js (modified) (1 diff)
-
src/php/plugin.php (modified) (3 diffs)
-
src/php/suggestions/action.php (modified) (2 diffs)
-
src/php/suggestions/flush-rewrite-rules.php (modified) (1 diff)
-
src/php/suggestions/logout.php (modified) (1 diff)
-
src/php/suggestions/menus.php (modified) (2 diffs)
-
src/php/suggestions/recent.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jarvis/trunk/README.md
r2072561 r2360349 82 82 * fix the autoloader to support web roots with underscore characters 83 83 * update npm packages and add core-js as a dev dependency 84 13. 1.0.5 85 * Update build dependencies 86 * Add permission_callback on rest api routes for 5.5 update 87 * Add capability checks to instant actions 88 84 89 85 90 ## Develop -
jarvis/trunk/dist/jarvis-user-profile.js.map
r1966854 r2360349 1 {"version":3,"sources":["jarvis-user-profile.js"],"names":["Jarvis","UserProfile","$","_class","options","_this","this","opt","_classCallCheck","version","jarvisUri","hasOwnProperty"," hotKey","document","getElementById","e","key","match","preventDefault","hotKeySelect","select","addEventListener","jarvisThemeCss","setAttribute","href","jarvisThemeSelect","querySelector","scheme","matchColorScheme","value","changeScheme","currentTarget","_createClass","themeOption","concat","getAttribute","indexOf","jQuery"],"mappings":";;;;;;;mZAAAA,OAAOC,YAAgB,SAAUC,GAEhC,OAAA,WACC,SAAAC,EAAaC,GAAU,IAAAC,EAAAC,KADxB,IAAA,IAAAC,KACwBC,gBAAAF,KAAAH,GAEtBG,KAAKF,QAAU,CACdK,QAAS,GACTC,UAAW,6BALdN,EAAAA,EAAA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tversion: '',\n\t\t\t\tjarvisUri: '/wp-content/themes/jarvis',\n\t\t\t};\n\n\t\t\tfor( let opt in options ) {\n\t\t\t\tif ( options.hasOwnProperty( opt ) ) {\n\t\t\t\t\tthis.options[ opt ] = options[ opt ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.hotKey = document.getElementById('jarvis_hotkey');\n\n\t\t\tif ( this.hotKey ) {\n\t\t\t\tthis.hotKey.addEventListener( 'keydown', (e) => {\n\t\t\t\t\tif ( ! e.key.match(/^[a-z0-9\\;\\\\\\|\\=\\,\\-\\.\\/\\`\\[\\]]$/) ) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tconst hotKeySelect = () => {\n\t\t\t\t\tthis.hotKey.select();\n\t\t\t\t}\n\n\t\t\t\tthis.hotKey.addEventListener('focus', hotKeySelect);\n\t\t\t\tthis.hotKey.addEventListener('keyup', hotKeySelect);\n\t\t\t}\n\n\t\t\tthis.jarvisThemeCss = document.getElementById('wp-jarvis-theme-css');\n\t\t\tif ( this.jarvisThemeCss ) {\n\t\t\t\tthis.jarvisThemeCss.setAttribute('data-href', this.jarvisThemeCss.href);\n\t\t\t}\n\n\t\t\tthis.jarvisThemeSelect = document.querySelector('select[name=\"jarvis_theme\"]');\n\n\t\t\tif ( this.jarvisThemeSelect ) {\n\t\t\t\tthis.jarvisThemeSelect.addEventListener( 'change', () => {\n\t\t\t\t\tlet scheme;\n\t\t\t\t\tif ( this.matchColorScheme() ) {\n\t\t\t\t\t\tscheme = document.querySelector('#color-picker input[type=\"radio\"]:checked').value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tscheme = this.jarvisThemeSelect.value\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changeScheme( scheme );\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t$('#color-picker').on( 'click.colorpicker', '.color-option', (e) => {\n\t\t\t\tif ( this.matchColorScheme() ) {\n\t\t\t\t\tthis.changeScheme( e.currentTarget.querySelector( 'input[type=\"radio\"]' ).value );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tchangeScheme( scheme ) {\n\t\t\tif ( this.jarvisThemeCss ) {\n\t\t\t\tlet themeOption = this.jarvisThemeSelect.querySelector( `option[value=\"${scheme}\"]` );\n\t\t\t\tif ( themeOption ) {\n\t\t\t\t\tthis.jarvisThemeCss.href = themeOption.getAttribute('data-uri');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmatchColorScheme() {\n\t\t\treturn [ '', 'wp' ].indexOf( this.jarvisThemeSelect.value ) > -1;\n\t\t}\n\t}\n\n})( jQuery );\n"]}1 {"version":3,"sources":["jarvis-user-profile.js"],"names":["Jarvis","UserProfile","$","_class","options","_this","this","opt","_classCallCheck","version","jarvisUri","hasOwnProperty","document","getElementById","hotKey","addEventListener","e","key","match","preventDefault","hotKeySelect","select","jarvisThemeCss","setAttribute","href","jarvisThemeSelect","querySelector","scheme","value","changeScheme","on","matchColorScheme","_createClass","themeOption","concat","getAttribute","indexOf","jQuery"],"mappings":";;;;;;;mZAAAA,OAAOC,YAAgB,SAAUC,GAEhC,OAAA,WACC,SAAAC,EAAaC,GAAU,IAAAC,EAAAC,KAAvB,IAAA,IAAAC,KAAuBC,gBAAAF,KAAAH,GAEtBG,KAAKF,QAAU,CACdK,QAAS,GACTC,UAAW,6BAJbN,EAAuBA,EAAAO,eAAAJ,KASpBD,KAAKF,QAASG,GAAQH,EAASG,IAPlB,GACdE,KAAAA,OAASG,SADKC,eAAA,iBAAfP,KAAAQ,OAAA,CAcCR,KAAKQ,OAAOC,iBAAkB,UAAW,SAACC,GATtCA,EAAAC,IAALC,MAAgBd,qCACfY,EAAAG,mBAKD,IAAAC,EAAeR,WAWbP,EAAKS,OAAOO,UAPZf,KAAAQ,OAAQC,iBAAW,QAAAK,GAClBJ,KAAAA,OAAEG,iBAAF,QAAAC,GAGDd,KAAAgB,eALDV,SAAAC,eAAA,uBAgBIP,KAAKgB,gBATThB,KAAAgB,eAAkBC,aAAZH,YAAed,KAAMgB,eAAAE,MAa5BlB,KAAKmB,kBAAoBb,SAASc,cAAc,+BAR/CpB,KAAKQ,mBACLR,KAAAmB,kBAAAV,iBAAA,SAAA,WAWC,IAAIY,EAEHA,EAXHtB,EAAKiB,mBAWOV,SAASc,cAAc,6CAA6CE,MAT1EN,EAAAA,kBAAeC,MAGrBlB,EAAAwB,aAAKJ,KAIHvB,EAAA,iBAAA4B,GAAA,oBAAA,gBAAA,SAAAd,GAYIX,EAAK0B,oBAXT1B,EAAAwB,aAAUE,EAAAA,cAAqBL,cAAA,uBAAAE,SA1CnC,OAAAI,aAAA7B,EAAA,CAAA,CAAAc,IAAA,eAAAW,MAAA,SA2DeD,GAXX,GAAArB,KAAAgB,eAAmBK,CACnB,IAAAM,EATD3B,KAAAmB,kBAAAC,cAAA,iBAAAQ,OAAAP,EAAA,OAUAM,IAaC3B,KAAKgB,eAAeE,KAAOS,EAAYE,aAAa,gBA/DxD,CAAAlB,IAAA,mBAAAW,MAAA,WAyDE,OAAA,EAAA,CAAA,GAAA,MAAAQ,QAAA9B,KAAAmB,kBAAAG,WAzDFzB,EAAA,GAFsB,CAEtBkC","file":"jarvis-user-profile.js","sourcesContent":["Jarvis.UserProfile = ( function( $ ) {\n\n\treturn class {\n\t\tconstructor( options ) {\n\n\t\t\tthis.options = {\n\t\t\t\tversion: '',\n\t\t\t\tjarvisUri: '/wp-content/themes/jarvis',\n\t\t\t};\n\n\t\t\tfor( let opt in options ) {\n\t\t\t\tif ( options.hasOwnProperty( opt ) ) {\n\t\t\t\t\tthis.options[ opt ] = options[ opt ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.hotKey = document.getElementById('jarvis_hotkey');\n\n\t\t\tif ( this.hotKey ) {\n\t\t\t\tthis.hotKey.addEventListener( 'keydown', (e) => {\n\t\t\t\t\tif ( ! e.key.match(/^[a-z0-9\\;\\\\\\|\\=\\,\\-\\.\\/\\`\\[\\]]$/) ) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tconst hotKeySelect = () => {\n\t\t\t\t\tthis.hotKey.select();\n\t\t\t\t}\n\n\t\t\t\tthis.hotKey.addEventListener('focus', hotKeySelect);\n\t\t\t\tthis.hotKey.addEventListener('keyup', hotKeySelect);\n\t\t\t}\n\n\t\t\tthis.jarvisThemeCss = document.getElementById('wp-jarvis-theme-css');\n\t\t\tif ( this.jarvisThemeCss ) {\n\t\t\t\tthis.jarvisThemeCss.setAttribute('data-href', this.jarvisThemeCss.href);\n\t\t\t}\n\n\t\t\tthis.jarvisThemeSelect = document.querySelector('select[name=\"jarvis_theme\"]');\n\n\t\t\tif ( this.jarvisThemeSelect ) {\n\t\t\t\tthis.jarvisThemeSelect.addEventListener( 'change', () => {\n\t\t\t\t\tlet scheme;\n\t\t\t\t\tif ( this.matchColorScheme() ) {\n\t\t\t\t\t\tscheme = document.querySelector('#color-picker input[type=\"radio\"]:checked').value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tscheme = this.jarvisThemeSelect.value\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changeScheme( scheme );\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t$('#color-picker').on( 'click.colorpicker', '.color-option', (e) => {\n\t\t\t\tif ( this.matchColorScheme() ) {\n\t\t\t\t\tthis.changeScheme( e.currentTarget.querySelector( 'input[type=\"radio\"]' ).value );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tchangeScheme( scheme ) {\n\t\t\tif ( this.jarvisThemeCss ) {\n\t\t\t\tlet themeOption = this.jarvisThemeSelect.querySelector( `option[value=\"${scheme}\"]` );\n\t\t\t\tif ( themeOption ) {\n\t\t\t\t\tthis.jarvisThemeCss.href = themeOption.getAttribute('data-uri');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmatchColorScheme() {\n\t\t\treturn [ '', 'wp' ].indexOf( this.jarvisThemeSelect.value ) > -1;\n\t\t}\n\t}\n\n})( jQuery );\n"]} -
jarvis/trunk/dist/jarvis.css
r2072561 r2360349 8 8 @-webkit-keyframes jarvis-loading-spin { 9 9 0% { 10 -webkit-transform: rotate(0deg); 11 transform: rotate(0deg); 10 transform: rotate(0deg); 12 11 } 13 12 100% { 14 -webkit-transform: rotate(360deg); 15 transform: rotate(360deg); 13 transform: rotate(360deg); 16 14 } 17 15 } … … 19 17 @keyframes jarvis-loading-spin { 20 18 0% { 21 -webkit-transform: rotate(0deg); 22 transform: rotate(0deg); 19 transform: rotate(0deg); 23 20 } 24 21 100% { 25 -webkit-transform: rotate(360deg); 26 transform: rotate(360deg); 22 transform: rotate(360deg); 27 23 } 28 24 } … … 45 41 position: fixed; 46 42 top: 32px; 47 -webkit-transform: translateX(-50%); 48 transform: translateX(-50%); 43 transform: translateX(-50%); 49 44 width: 96%; 50 45 z-index: 100001; … … 87 82 top: 2px; 88 83 left: 50%; 89 -webkit-transform: translateX(-50%); 90 transform: translateX(-50%); 84 transform: translateX(-50%); 91 85 border-radius: 50%; 92 86 } -
jarvis/trunk/dist/jarvis.css.map
r2072561 r2360349 1 {"version":3,"sources":["jarvis.scss","jarvis.css"],"names":[],"mappings":";;;;;;;AAAA;EACC;IACC, +BAAuB;YAAvB,uBAAuB;ECCvB;EDCD;IACC,iCAAyB;YAAzB,yBAAyB;ECCzB;AACF;;ADPA;EACC;IACC,+BAAuB;YAAvB,uBAAuB;ECCvB;EDCD;IACC,iCAAyB;YAAzB,yBAAyB;ECCzB;AACF;;ADGC;EACC,SAAQ;EACR,OAAM;EACN,eAAc;EACd,QAAO;EACP,MAAK;EACL,eAAc;ACAhB;;ADGC;EACC,mBAAmB;EACnB,sBAAsB;EACtB,SAAS;EACT,gBAAgB;EAChB,YAAY;EACZ,eAAe;EACf,SAAS;EACT,mCAA2B;UAA3B,2BAA2B;EAC3B,UAAU;EACV,eAAe;ACAjB;;ADGC;E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AAiB;EACjB,kBAAkB;ACTpB;;ADaA;EACC,kBAAkB;EAClB,eAAe;ACVhB;;ADQA;EAKE,sBAAsB;EACtB,YAAY;ACTd;;ADGA;EAUE,6BAA6B;ACT/B;;ADDA;EAUE,6BAA6B;ACT/B;;ADYC;EAbD;IAcE,WAAW;ECRX;AACF;;ADWA;EAEE,cAAc;ACThB;;ADOA;EAKG,kBAAkB;ACRrB;;ADGA;EAQI,kBAAiB;EACjB,SAAQ;EACR,mBAAkB;ACPtB;;ADHA;EAcI,kCAAkC;EAClC,gBAAgB;EAChB,qBAAqB;EACrB,WAAW;EACX,sBAAsB;EACtB,eAAe;EACf,kBAAkB;EAClB,gBAAgB;EAChB,YAAY;EACZ,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB,wBAAwB;EACxB,oBAAoB;EACpB,WAAW;ACPf;;ADWE;EAhCF;IAkCI,WAAW;ECRb;ED1BF;IAqCK,eAAe;IACf,YAAY;IACZ,qBAAqB;IACrB,WAAW;ECRd;AACF","file":"jarvis.css","sourcesContent":["@keyframes jarvis-loading-spin {\n\t0% {\n\t\ttransform: rotate(0deg);\n\t}\n\t100% {\n\t\ttransform: rotate(360deg);\n\t}\n}\n\n.jarvis {\n\t&__overlay {\n\t\tbottom:0;\n\t\tleft:0;\n\t\tposition:fixed;\n\t\tright:0;\n\t\ttop:0;\n\t\tz-index:100000;\n\t}\n\n\t&__modal {\n\t\tborder-radius: .5em;\n\t\tbox-sizing: border-box;\n\t\tleft: 50%;\n\t\tmax-width: 750px;\n\t\tpadding: 1em;\n\t\tposition: fixed;\n\t\ttop: 32px;\n\t\ttransform: translateX(-50%);\n\t\twidth: 96%;\n\t\tz-index: 100001;\n\t}\n\n\t&__wrap {\n\t\twidth: 100%;\n\t}\n\n\t&__search {\n\t\twidth: 100%;\n\t}\n\n\t&__hint,\n\t&__input {\n\t\tborder:none;\n\t\tfont-size:2em;\n\t\tpadding:.5em;\n\t\twidth:100%;\n\t}\n\n\t&__loading {\n\t\tanimation: jarvis-loading-spin 1000ms linear infinite;\n\t\t// background: #808080;\n\t\tborder-radius: 50%;\n\t\theight: 20px;\n\t\tmargin-top:-8px;\n\t\topacity: .7;\n\t\tposition:absolute;\n\t\tright:20px;\n\t\ttop:50%;\n\t\twidth: 20px;\n\n\t\t&::after {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\theight: 4px;\n\t\t\twidth: 4px;\n\t\t\t// background: #ffffff;\n\t\t\tposition: absolute;\n\t\t\ttop: 2px;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t\tborder-radius: 50%;\n\t\t}\n\t}\n\n\t&__menu {\n\t\tborder-radius: .5em;\n\t\tpadding: 1em;\n\t\tmargin: 0 -1em 0 -1em;\n\t\twidth: 100%;\n\n\t\ta {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\ttext-decoration: none;\n\t\t\tpadding:.5em;\n\t\t\tborder: 1px solid transparent;\n\t\t\tposition: relative;\n\t\t}\n\t}\n\n\t&__suggestion {\n\t\toverflow:hidden;\n\n\t\ta {\n\t\t\tborder-radius:.5em;\n\t\t}\n\t}\n\n\t&__cursor {\n\t\ta {\n\t\t\t&:hover {\n\t\t\t\tborder-color:rgb(209,218,225);\n\t\t\t}\n\t\t}\n\t}\n\n\t&__icon {\n\t\tbackground-size: 28px 28px;\n\t\tbox-sizing: border-box;\n\t\tflex: none;\n\t\theight: 28px;\n\t\tline-height: 28px;\n\t\tmargin-right: 8px;\n\t\ttext-align: left;\n\t\twidth: 28px;\n\n\t\tsvg,\n\t\timg {\n\t\t\theight: 24px;\n\t\t\twidth: 24px;\n\t\t\tmargin: 2px;\n\t\t}\n\n\t\tsvg {\n\t\t\tpath {\n\t\t\t\tfill: currentColor;\n\t\t\t}\n\t\t}\n\n\t\t&.dashicons-before {\n\t\t\tbackground: none;\n\t\t\tpadding-top: 2px;\n\t\t\tpadding-bottom: 2px;\n\n\t\t\t&:before {\n\t\t\t\theight: 24px;\n\t\t\t\twidth: 24px;\n\t\t\t\tfont-size: 24px;\n\t\t\t\tline-height: 24px;\n\t\t\t}\n\t\t}\n\t}\n\n\t&__title {\n\t\tdisplay: block;\n\t\tline-height: 28px;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t\tflex: 1;\n\t}\n\n\t&__pills {\n\t\tdisplay: block;\n\t\tflex: none;\n\t\tfont-size: .8em;\n\t\topacity: .75;\n\t\tpointer-events: none;\n\t\ttext-transform: uppercase;\n\t\tuser-select: none;\n\t\twhite-space: nowrap;\n\t}\n\n\t&__pill {\n\t\tpadding: 1px 3px;\n\t\tborder: 1px solid;\n\t\tborder-radius: 2px;\n\t}\n}\n\ninput[name=\"jarvis_hotkey\"] {\n\ttext-align: center;\n\tmax-width: 30px;\n\n\t&:focus {\n\t\tbackground-color: gray;\n\t\tcolor: white;\n\t}\n\n\t&::selection {\n\t\tbackground-color: transparent;\n\t}\n\n\t@media screen and ( max-width: 782px ) {\n\t\twidth: auto;\n\t}\n}\n\n#wpadminbar {\n\t#wp-admin-bar-jarvis_menubar_icon {\n\t\tdisplay: block;\n\n\t\t.ab-item {\n\t\t\ttext-align: center;\n\n\t\t\tspan {\n\t\t\t\tposition:absolute;\n\t\t\t\ttop:-4em;\n\t\t\t\twhite-space:nowrap;\n\t\t\t}\n\n\t\t\t&::before {\n\t\t\t\t-moz-osx-font-smoothing: grayscale;\n\t\t\t\tcontent: \"\\f179\";\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tfloat: none;\n\t\t\t\tfont-family: dashicons;\n\t\t\t\tfont-size: 20px;\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight: 400;\n\t\t\t\theight: 20px;\n\t\t\t\tline-height: 1;\n\t\t\t\tmargin-right: 0;\n\t\t\t\ttext-align: center;\n\t\t\t\ttext-decoration: inherit;\n\t\t\t\tvertical-align: -5px;\n\t\t\t\twidth: 20px;\n\t\t\t}\n\t\t}\n\n\t\t@media screen and ( max-width: 782px ) {\n\t\t\t.ab-item {\n\t\t\t\twidth: 46px;\n\n\t\t\t\t&::before {\n\t\t\t\t\tfont-size: 32px;\n\t\t\t\t\theight: 20px;\n\t\t\t\t\tvertical-align: -10px;\n\t\t\t\t\twidth: 28px;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","@keyframes jarvis-loading-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.jarvis__overlay {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n z-index: 100000;\n}\n\n.jarvis__modal {\n border-radius: .5em;\n box-sizing: border-box;\n left: 50%;\n max-width: 750px;\n padding: 1em;\n position: fixed;\n top: 32px;\n transform: translateX(-50%);\n width: 96%;\n z-index: 100001;\n}\n\n.jarvis__wrap {\n width: 100%;\n}\n\n.jarvis__search {\n width: 100%;\n}\n\n.jarvis__hint, .jarvis__input {\n border: none;\n font-size: 2em;\n padding: .5em;\n width: 100%;\n}\n\n.jarvis__loading {\n animation: jarvis-loading-spin 1000ms linear infinite;\n border-radius: 50%;\n height: 20px;\n margin-top: -8px;\n opacity: .7;\n position: absolute;\n right: 20px;\n top: 50%;\n width: 20px;\n}\n\n.jarvis__loading::after {\n content: '';\n display: block;\n height: 4px;\n width: 4px;\n position: absolute;\n top: 2px;\n left: 50%;\n transform: translateX(-50%);\n border-radius: 50%;\n}\n\n.jarvis__menu {\n border-radius: .5em;\n padding: 1em;\n margin: 0 -1em 0 -1em;\n width: 100%;\n}\n\n.jarvis__menu a {\n display: flex;\n align-items: center;\n text-decoration: none;\n padding: .5em;\n border: 1px solid transparent;\n position: relative;\n}\n\n.jarvis__suggestion {\n overflow: hidden;\n}\n\n.jarvis__suggestion a {\n border-radius: .5em;\n}\n\n.jarvis__cursor a:hover {\n border-color: #d1dae1;\n}\n\n.jarvis__icon {\n background-size: 28px 28px;\n box-sizing: border-box;\n flex: none;\n height: 28px;\n line-height: 28px;\n margin-right: 8px;\n text-align: left;\n width: 28px;\n}\n\n.jarvis__icon svg,\n.jarvis__icon img {\n height: 24px;\n width: 24px;\n margin: 2px;\n}\n\n.jarvis__icon svg path {\n fill: currentColor;\n}\n\n.jarvis__icon.dashicons-before {\n background: none;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n\n.jarvis__icon.dashicons-before:before {\n height: 24px;\n width: 24px;\n font-size: 24px;\n line-height: 24px;\n}\n\n.jarvis__title {\n display: block;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n}\n\n.jarvis__pills {\n display: block;\n flex: none;\n font-size: .8em;\n opacity: .75;\n pointer-events: none;\n text-transform: uppercase;\n user-select: none;\n white-space: nowrap;\n}\n\n.jarvis__pill {\n padding: 1px 3px;\n border: 1px solid;\n border-radius: 2px;\n}\n\ninput[name=\"jarvis_hotkey\"] {\n text-align: center;\n max-width: 30px;\n}\n\ninput[name=\"jarvis_hotkey\"]:focus {\n background-color: gray;\n color: white;\n}\n\ninput[name=\"jarvis_hotkey\"]::selection {\n background-color: transparent;\n}\n\n@media screen and (max-width: 782px) {\n input[name=\"jarvis_hotkey\"] {\n width: auto;\n }\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon {\n display: block;\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item {\n text-align: center;\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item span {\n position: absolute;\n top: -4em;\n white-space: nowrap;\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item::before {\n -moz-osx-font-smoothing: grayscale;\n content: \"\\f179\";\n display: inline-block;\n float: none;\n font-family: dashicons;\n font-size: 20px;\n font-style: normal;\n font-weight: 400;\n height: 20px;\n line-height: 1;\n margin-right: 0;\n text-align: center;\n text-decoration: inherit;\n vertical-align: -5px;\n width: 20px;\n}\n\n@media screen and (max-width: 782px) {\n #wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item {\n width: 46px;\n }\n #wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item::before {\n font-size: 32px;\n height: 20px;\n vertical-align: -10px;\n width: 28px;\n }\n}\n"]}1 {"version":3,"sources":["jarvis.scss","jarvis.css"],"names":[],"mappings":";;;;;;;AAAA;EACC;IACC,uBAAuB;ECCvB;EDCD;IACC,yBAAyB;ECCzB;AACF;;ADPA;EACC;IACC,uBAAuB;ECCvB;EDCD;IACC,yBAAyB;ECCzB;AACF;;ADGC;EACC,SAAQ;EACR,OAAM;EACN,eAAc;EACd,QAAO;EACP,MAAK;EACL,eAAc;ACAhB;;ADGC;EACC,mBAAmB;EACnB,sBAAsB;EACtB,SAAS;EACT,gBAAgB;EAChB,YAAY;EACZ,eAAe;EACf,SAAS;EACT,2BAA2B;EAC3B,UAAU;EACV,eAAe;ACAjB;;ADGC;EACC,WAAW;ACAb;;ADGC;EACC,WAAW;ACAb;;ADGC;EAEC,YAAW;EACX,cAAa;EACb,aAAY;EACZ,WAAU;ACDZ;;ADIC;EACC,6DAAqD;UAArD,qDAAqD;EAErD,kBAAkB;EAClB,YAAY;EACZ,gBAAe;EACf,WAAW;EACX,kBAAiB;EACjB,WAAU;EACV,QAAO;EACP,WAAW;ACFb;;ADRE;EAaC,WAAW;EACX,cAAc;EACd,WAAW;EACX,UAAU;EAEV,kBAAkB;EAClB,QAAQ;EACR,SAAS;EACT,2BAA2B;EAC3B,kBAAkB;ACFrB;;ADMC;EACC,mBAAmB;EACnB,YAAY;EACZ,qBAAqB;EACrB,WAAW;ACHb;;ADDE;EAOC,aAAa;EACb,mBAAmB;EACnB,qBAAqB;EACrB,aAAY;EACZ,6BAA6B;EAC7B,kBAAkB;ACFrB;;ADMC;EACC,gBAAe;ACHjB;;ADEE;EAIC,mBAAkB;ACFrB;;ADME;EAGE,qBAA6B;ACLjC;;ADUC;EACC,0BAA0B;EAC1B,sBAAsB;EACtB,UAAU;EACV,YAAY;EACZ,iBAAiB;EACjB,iBAAiB;EAC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ttransform: rotate(360deg);\n\t}\n}\n\n.jarvis {\n\t&__overlay {\n\t\tbottom:0;\n\t\tleft:0;\n\t\tposition:fixed;\n\t\tright:0;\n\t\ttop:0;\n\t\tz-index:100000;\n\t}\n\n\t&__modal {\n\t\tborder-radius: .5em;\n\t\tbox-sizing: border-box;\n\t\tleft: 50%;\n\t\tmax-width: 750px;\n\t\tpadding: 1em;\n\t\tposition: fixed;\n\t\ttop: 32px;\n\t\ttransform: translateX(-50%);\n\t\twidth: 96%;\n\t\tz-index: 100001;\n\t}\n\n\t&__wrap {\n\t\twidth: 100%;\n\t}\n\n\t&__search {\n\t\twidth: 100%;\n\t}\n\n\t&__hint,\n\t&__input {\n\t\tborder:none;\n\t\tfont-size:2em;\n\t\tpadding:.5em;\n\t\twidth:100%;\n\t}\n\n\t&__loading {\n\t\tanimation: jarvis-loading-spin 1000ms linear infinite;\n\t\t// background: #808080;\n\t\tborder-radius: 50%;\n\t\theight: 20px;\n\t\tmargin-top:-8px;\n\t\topacity: .7;\n\t\tposition:absolute;\n\t\tright:20px;\n\t\ttop:50%;\n\t\twidth: 20px;\n\n\t\t&::after {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\theight: 4px;\n\t\t\twidth: 4px;\n\t\t\t// background: #ffffff;\n\t\t\tposition: absolute;\n\t\t\ttop: 2px;\n\t\t\tleft: 50%;\n\t\t\ttransform: translateX(-50%);\n\t\t\tborder-radius: 50%;\n\t\t}\n\t}\n\n\t&__menu {\n\t\tborder-radius: .5em;\n\t\tpadding: 1em;\n\t\tmargin: 0 -1em 0 -1em;\n\t\twidth: 100%;\n\n\t\ta {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\ttext-decoration: none;\n\t\t\tpadding:.5em;\n\t\t\tborder: 1px solid transparent;\n\t\t\tposition: relative;\n\t\t}\n\t}\n\n\t&__suggestion {\n\t\toverflow:hidden;\n\n\t\ta {\n\t\t\tborder-radius:.5em;\n\t\t}\n\t}\n\n\t&__cursor {\n\t\ta {\n\t\t\t&:hover {\n\t\t\t\tborder-color:rgb(209,218,225);\n\t\t\t}\n\t\t}\n\t}\n\n\t&__icon {\n\t\tbackground-size: 28px 28px;\n\t\tbox-sizing: border-box;\n\t\tflex: none;\n\t\theight: 28px;\n\t\tline-height: 28px;\n\t\tmargin-right: 8px;\n\t\ttext-align: left;\n\t\twidth: 28px;\n\n\t\tsvg,\n\t\timg {\n\t\t\theight: 24px;\n\t\t\twidth: 24px;\n\t\t\tmargin: 2px;\n\t\t}\n\n\t\tsvg {\n\t\t\tpath {\n\t\t\t\tfill: currentColor;\n\t\t\t}\n\t\t}\n\n\t\t&.dashicons-before {\n\t\t\tbackground: none;\n\t\t\tpadding-top: 2px;\n\t\t\tpadding-bottom: 2px;\n\n\t\t\t&:before {\n\t\t\t\theight: 24px;\n\t\t\t\twidth: 24px;\n\t\t\t\tfont-size: 24px;\n\t\t\t\tline-height: 24px;\n\t\t\t}\n\t\t}\n\t}\n\n\t&__title {\n\t\tdisplay: block;\n\t\tline-height: 28px;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t\tflex: 1;\n\t}\n\n\t&__pills {\n\t\tdisplay: block;\n\t\tflex: none;\n\t\tfont-size: .8em;\n\t\topacity: .75;\n\t\tpointer-events: none;\n\t\ttext-transform: uppercase;\n\t\tuser-select: none;\n\t\twhite-space: nowrap;\n\t}\n\n\t&__pill {\n\t\tpadding: 1px 3px;\n\t\tborder: 1px solid;\n\t\tborder-radius: 2px;\n\t}\n}\n\ninput[name=\"jarvis_hotkey\"] {\n\ttext-align: center;\n\tmax-width: 30px;\n\n\t&:focus {\n\t\tbackground-color: gray;\n\t\tcolor: white;\n\t}\n\n\t&::selection {\n\t\tbackground-color: transparent;\n\t}\n\n\t@media screen and ( max-width: 782px ) {\n\t\twidth: auto;\n\t}\n}\n\n#wpadminbar {\n\t#wp-admin-bar-jarvis_menubar_icon {\n\t\tdisplay: block;\n\n\t\t.ab-item {\n\t\t\ttext-align: center;\n\n\t\t\tspan {\n\t\t\t\tposition:absolute;\n\t\t\t\ttop:-4em;\n\t\t\t\twhite-space:nowrap;\n\t\t\t}\n\n\t\t\t&::before {\n\t\t\t\t-moz-osx-font-smoothing: grayscale;\n\t\t\t\tcontent: \"\\f179\";\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tfloat: none;\n\t\t\t\tfont-family: dashicons;\n\t\t\t\tfont-size: 20px;\n\t\t\t\tfont-style: normal;\n\t\t\t\tfont-weight: 400;\n\t\t\t\theight: 20px;\n\t\t\t\tline-height: 1;\n\t\t\t\tmargin-right: 0;\n\t\t\t\ttext-align: center;\n\t\t\t\ttext-decoration: inherit;\n\t\t\t\tvertical-align: -5px;\n\t\t\t\twidth: 20px;\n\t\t\t}\n\t\t}\n\n\t\t@media screen and ( max-width: 782px ) {\n\t\t\t.ab-item {\n\t\t\t\twidth: 46px;\n\n\t\t\t\t&::before {\n\t\t\t\t\tfont-size: 32px;\n\t\t\t\t\theight: 20px;\n\t\t\t\t\tvertical-align: -10px;\n\t\t\t\t\twidth: 28px;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","@keyframes jarvis-loading-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.jarvis__overlay {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n z-index: 100000;\n}\n\n.jarvis__modal {\n border-radius: .5em;\n box-sizing: border-box;\n left: 50%;\n max-width: 750px;\n padding: 1em;\n position: fixed;\n top: 32px;\n transform: translateX(-50%);\n width: 96%;\n z-index: 100001;\n}\n\n.jarvis__wrap {\n width: 100%;\n}\n\n.jarvis__search {\n width: 100%;\n}\n\n.jarvis__hint, .jarvis__input {\n border: none;\n font-size: 2em;\n padding: .5em;\n width: 100%;\n}\n\n.jarvis__loading {\n animation: jarvis-loading-spin 1000ms linear infinite;\n border-radius: 50%;\n height: 20px;\n margin-top: -8px;\n opacity: .7;\n position: absolute;\n right: 20px;\n top: 50%;\n width: 20px;\n}\n\n.jarvis__loading::after {\n content: '';\n display: block;\n height: 4px;\n width: 4px;\n position: absolute;\n top: 2px;\n left: 50%;\n transform: translateX(-50%);\n border-radius: 50%;\n}\n\n.jarvis__menu {\n border-radius: .5em;\n padding: 1em;\n margin: 0 -1em 0 -1em;\n width: 100%;\n}\n\n.jarvis__menu a {\n display: flex;\n align-items: center;\n text-decoration: none;\n padding: .5em;\n border: 1px solid transparent;\n position: relative;\n}\n\n.jarvis__suggestion {\n overflow: hidden;\n}\n\n.jarvis__suggestion a {\n border-radius: .5em;\n}\n\n.jarvis__cursor a:hover {\n border-color: #d1dae1;\n}\n\n.jarvis__icon {\n background-size: 28px 28px;\n box-sizing: border-box;\n flex: none;\n height: 28px;\n line-height: 28px;\n margin-right: 8px;\n text-align: left;\n width: 28px;\n}\n\n.jarvis__icon svg,\n.jarvis__icon img {\n height: 24px;\n width: 24px;\n margin: 2px;\n}\n\n.jarvis__icon svg path {\n fill: currentColor;\n}\n\n.jarvis__icon.dashicons-before {\n background: none;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n\n.jarvis__icon.dashicons-before:before {\n height: 24px;\n width: 24px;\n font-size: 24px;\n line-height: 24px;\n}\n\n.jarvis__title {\n display: block;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n}\n\n.jarvis__pills {\n display: block;\n flex: none;\n font-size: .8em;\n opacity: .75;\n pointer-events: none;\n text-transform: uppercase;\n user-select: none;\n white-space: nowrap;\n}\n\n.jarvis__pill {\n padding: 1px 3px;\n border: 1px solid;\n border-radius: 2px;\n}\n\ninput[name=\"jarvis_hotkey\"] {\n text-align: center;\n max-width: 30px;\n}\n\ninput[name=\"jarvis_hotkey\"]:focus {\n background-color: gray;\n color: white;\n}\n\ninput[name=\"jarvis_hotkey\"]::selection {\n background-color: transparent;\n}\n\n@media screen and (max-width: 782px) {\n input[name=\"jarvis_hotkey\"] {\n width: auto;\n }\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon {\n display: block;\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item {\n text-align: center;\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item span {\n position: absolute;\n top: -4em;\n white-space: nowrap;\n}\n\n#wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item::before {\n -moz-osx-font-smoothing: grayscale;\n content: \"\\f179\";\n display: inline-block;\n float: none;\n font-family: dashicons;\n font-size: 20px;\n font-style: normal;\n font-weight: 400;\n height: 20px;\n line-height: 1;\n margin-right: 0;\n text-align: center;\n text-decoration: inherit;\n vertical-align: -5px;\n width: 20px;\n}\n\n@media screen and (max-width: 782px) {\n #wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item {\n width: 46px;\n }\n #wpadminbar #wp-admin-bar-jarvis_menubar_icon .ab-item::before {\n font-size: 32px;\n height: 20px;\n vertical-align: -10px;\n width: 28px;\n }\n}\n"]} -
jarvis/trunk/dist/jarvis.js
r2072561 r2360349 6 6 */ 7 7 8 "use strict";function _ possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Jarvis=function(o,t,e){for(var n=0;n<arguments.length;n++)if(!/function|object/.test(_typeof(arguments[n])))return"object"===("undefined"==typeof console?"undefined":_typeof(console))&&"function"==typeof console.error&&console.error("Jarvis dependency is missing: ".concat(arguments[n])),function(){};function a(){return/INPUT|SELECT|TEXTAREA/.test(document.activeElement.tagName)||"true"===document.activeElement.contentEditable}var d={store:{attachment:{type:"dashicon",icon:"dashicons-admin-media"},category:{type:"dashicon",icon:"dashicons-category"},nav_menu:{type:"dashicon",icon:"dashicons-menu"},nav_menu_item:{type:"dashicon",icon:"dashicons-admin-appearance"},page:{type:"dashicon",icon:"dashicons-admin-page"},post:{type:"dashicon",icon:"dashicons-admin-post"},post_tag:{type:"dashicon",icon:"dashicons-tag"},post_format:{type:"dashicon",icon:"dashicons-format-standard"},term:{type:"dashicon",icon:"dashicons-category"},user:{type:"dashicon",icon:"dashicons-admin-users"}},add:function(t,e,n){return this.store[t]||(this.store[t]={type:e,icon:n}),this.store[t]},remove:function(t){this.store[t]&&delete this.store[t]},get:function(t){return"object"===_typeof(this.store[t])&&this.store[t]}},r=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};1<arguments.length&&void 0!==arguments[1]&&arguments[1];for(var e in _classCallCheck(this,n),this.attributes=[],this.classes=[],this.href="",this.icon=null,this.iconClasses=["jarvis__icon"],this.iconKey="",this.iconStyle="",this.iconType="dashicon",this.kind="",this.prefix="",this.section="",this.title="",this.type="",t)t.hasOwnProperty(e)&&(this[e]=t[e]);"string"==typeof this.type&&0<this.type.length&&-1===this.attributes.indexOf(this.type)&&this.attributes.push(this.type),this.iconKey&&this.iconType&&this.icon&&!d.get(this.iconKey)&&d.add(this.iconKey,this.iconType,this.icon),this.setIcon(this.iconKey)}return _createClass(n,[{key:"setIcon",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";if("image"!==this.iconType||!this.icon){if(!d.get(t)&&this.kind)switch(this.kind){case"term":t="post_tag";break;case"post":t="post";break;case"user":t="user"}var e=d.get(t);return!!e&&(this.iconKey=t,this.iconType=e.type,this.icon=e.icon,"dashicon"===this.iconType&&(this.iconClasses.push("dashicons-before"),-1===this.iconClasses.indexOf(this.icon)&&this.iconClasses.push(this.icon)),this.icon)}}}]),n}(),c=function(t){function u(t){var e;_classCallCheck(this,u),(e=_possibleConstructorReturn(this,_getPrototypeOf(u).call(this))).link=t,e.section=jQuery(e.link).closest("li.menu-top").first(),e.prefix=e.section.find(".wp-menu-name").clone().children().remove().end().text(),e.kind="menu",e.type=e.kind,e.href=t.href,e.attributes.push(e.type),e.classes.push("jarvis__suggestion--".concat(e.kind)),jQuery(e.link).is(".wp-submenu a")?e.title="".concat(e.prefix," » ").concat(jQuery(e.link).clone().children().remove().end().text()):e.title=e.prefix;var n=e.section.find(".wp-menu-image").first(),i=e.section.find("> a").first();if(0<i.length){var s=i.attr("href");if(-1<s.indexOf("?"))for(var o=s.substr(s.indexOf("?")+1).split("&"),a=0;a<o.length;a++){var r=o[a].split("=");if(2===r.length&&"post_type"===r[0]&&0<r[1].length){e.iconKey=r[1];break}}}if(e.iconKey||(e.iconKey=e.section.attr("id")),e.classes.push("jarvis__suggestion--".concat(e.iconKey)),0<n.length){if(!d.get(e.iconKey)){var c;switch(!0){case 0<e.section.find(".wp-menu-image img").length:e.iconType="image",e.icon=e.section.find(".wp-menu-image img").first().attr("src");break;case n.hasClass("svg"):c=window.getComputedStyle(n.get(0)),/^url\("data:image\/svg\+xml\;base64,/.test(c.backgroundImage)&&(e.iconType="svg",e.icon=atob(c.backgroundImage.replace(/^url\("data:image\/svg\+xml\;base64,/,"").replace(/\"\)$/,"")),e.icon=e.icon.replace(/<\?xml [^>]+\?>/g,"").replace(/\sid="[^\"]+"/g,"").replace(/<!--[\s\S]*?-->/g,"").replace(/<(title|desc|defs)>[^<]+?<\/(title|desc|defs)>/g,""));break;case n.hasClass("dashicons-before"):if("dashicons"===(c=window.getComputedStyle(n.get(0),":before")).fontFamily)e.iconType="dashicon",e.icon=n.attr("class").trim().split(" ").filter(function(t){return-1===["dashicons-before","wp-menu-image"].indexOf(t)}).shift(),e.iconClasses.push(e.icon),e.iconClasses.push("dashicons-before");else{var h=document.getElementById("jarvis_style");h||((h=document.createElement("style")).type="text/css",h.id="jarvis_style",document.head.appendChild(h));var l=".jarvis__suggestion--".concat(e.iconKey," .jarvis__icon::before { font-family: ").concat(c.fontFamily,"; content: ").concat(c.content,"; }")+"\n";h.appendChild(document.createTextNode(l))}}d.add(e.iconKey,e.iconType,e.icon)}e.setIcon(e.iconKey)}return e}return _inherits(u,r),u}(),i={suggestion:t.template('\n\t\t\t<span class="<% print( classes.join( \' \' ) ) %>">\n\t\t\t\t<a href="<%= href %>" data-type="<%= type %>">\n\t\t\t\t\t<span class="<% print( iconClasses.join( \' \' ) ) %>" style=\'<%= iconStyle %>\' title="<%= prefix %>">\n\t\t\t\t\t<% if ( iconType === \'image\' ) { %>\n\t\t\t\t\t\t<img src="<%= icon %>" alt="<%= title %>">\n\t\t\t\t\t<% } else if ( iconType === \'svg\' ) { %>\n\t\t\t\t\t\t<%= icon %>\n\t\t\t\t\t<% } %>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class="jarvis__title" title="<%- title %>"><%- title %></span>\n\t\t\t\t\t<% if ( attributes ) { %>\n\t\t\t\t\t\t<span class="jarvis__pills">\n\t\t\t\t\t\t\t<% _.each( attributes, function(attr) { %>\n\t\t\t\t\t\t\t\t<span class="jarvis__pill"><%= attr %></span>\n\t\t\t\t\t\t\t<% } ); %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t<% } %>\n\t\t\t\t</a>\n\t\t\t</span>\n\t\t')};return function(){function s(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];for(var i in _classCallCheck(this,s),this.iconStore=d,this.settings={hotkey:"/",searchurl:"/wp-json/jarvis/v1/search"},e)e.hasOwnProperty(i)&&(this.settings[i]=e[i]);this.opened=!1,this.suggestions=[],this.instants=n,this.term="",this.ctrlKey=!1,this.node=document.createElement("div"),this.node.className="jarvis jarvis--".concat(this.settings.theme),this.node.id="jarvis",this.modal=document.createElement("div"),this.modal.className="jarvis__modal",this.overlay=document.createElement("div"),this.overlay.className="jarvis__overlay",this.overlay.addEventListener("click",function(){return t.close()}),this.search=document.createElement("input"),this.search.type="text",this.$search=o(this.search),this.node.appendChild(this.overlay),this.node.appendChild(this.modal),this.modal.appendChild(this.search),this.loading=document.createElement("i"),this.loading.className="jarvis__loading",this.isJarvisUrl=function(t){return-1<t.indexOf(this.settings.searchurl)},/complete|loaded/.test(document.readyState)?this.init():document.addEventListener("DOMContentLoaded",this.init.bind(this))}return _createClass(s,[{key:"init",value:function(){var i=this;o("#adminmenu a").each(function(t,e){i.suggestions.push(new c(e))}),Array.isArray(this.instants)&&(this.suggestions=this.suggestions.concat(this.instants.map(function(t){return new r(t)}))),document.addEventListener("keydown",function(t){t.key!==i.settings.hotkey||a()||(t.preventDefault(),t.stopPropagation())},!0),o(document).on("click","#wp-admin-bar-jarvis_menubar_icon a",function(t){t.preventDefault(),i.open()}),o(document).on("click",".jarvis__suggestion a",function(t){!0!==t.ctrlKey&&"ajax"!==t.currentTarget.getAttribute("data-type")||t.preventDefault()}),o(document).on("keydown keyup","#jarvis-search",function(t){i.ctrlKey=t.ctrlKey}),o(document).on("keyup",function(t){return i.opened&&"Escape"===t.key?(t.preventDefault(),t.stopPropagation(),void i.close()):a()?void 0:i.opened||t.key!==i.settings.hotkey?void 0:(t.preventDefault(),t.stopPropagation(),i.open())}),o(document).ajaxSend(function(t,e,n){i.opened&&i.isJarvisUrl(n.url)&&(i.modal.appendChild(i.loading),e.setRequestHeader("X-WP-Nonce",i.settings.nonce))}),o(document).ajaxComplete(function(t,e,n){i.opened&&i.isJarvisUrl(n.url)&&i.loading.parentNode&&i.loading.parentNode.removeChild(i.loading)})}},{key:"open",value:function(){var n=this;return this.opened=!0,document.body.appendChild(this.node),this.$search.typeahead({hint:!0,highlight:!0,minLength:1,classNames:{cursor:"jarvis__cursor",dataset:"jarvis__dataset",empty:"jarvis__empty",highlight:"jarvis__highlight",hint:"jarvis__hint",input:"jarvis__input",menu:"jarvis__menu",open:"jarvis__open",selectable:"jarvis__selectable",suggestion:"jarvis__suggestion",wrapper:"jarvis__wrap"}},{name:"results",limit:10,display:"title",source:new e({local:this.suggestions,datumTokenizer:e.tokenizers.obj.whitespace("title"),queryTokenizer:e.tokenizers.whitespace,remote:{url:"".concat(this.settings.searchurl,"?q=%s"),wildcard:"%s",transform:function(t){return Array.isArray(t)?t.map(function(t){return new r(t,"remote")}):t}}}),templates:{suggestion:function(t){return i.suggestion(t)}}}),this.$search.on("typeahead:select",function(t,e){if("ajax"===e.type)return n.ajax(e);n.ctrlKey?window.open(e.href,"_blank"):location.href=e.href}),this.$search.on("keyup",function(){n.term=n.search.value}),this.$search.typeahead("val",this.term),this.$search.focus().select(),this}},{key:"close",value:function(){return this.opened=!1,this.node.parentNode.removeChild(this.node),this.$search.typeahead("destroy"),this}},{key:"toggle",value:function(){return this.opened?this.close():this.open()}},{key:"ajax",value:function(t){var i=this;this.modal.appendChild(this.loading),o.ajax({url:t.href,success:function(t,e,n){i.term="",i.loading.parentNode&&i.modal.removeChild(i.loading),i.close()},error:function(t,e,n){i.loading.parentNode&&i.modal.removeChild(i.loading)}})}}]),s}()}(jQuery,_,Bloodhound);8 "use strict";function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _createSuper(i){var s=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(i);if(s){var n=_getPrototypeOf(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return _possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Jarvis=function(o,t,e){for(var n=0;n<arguments.length;n++)if(!/function|object/.test(_typeof(arguments[n])))return"object"===("undefined"==typeof console?"undefined":_typeof(console))&&"function"==typeof console.error&&console.error("Jarvis dependency is missing: ".concat(arguments[n])),function(){};function a(){return/INPUT|SELECT|TEXTAREA/.test(document.activeElement.tagName)||"true"===document.activeElement.contentEditable}var d={store:{attachment:{type:"dashicon",icon:"dashicons-admin-media"},category:{type:"dashicon",icon:"dashicons-category"},nav_menu:{type:"dashicon",icon:"dashicons-menu"},nav_menu_item:{type:"dashicon",icon:"dashicons-admin-appearance"},page:{type:"dashicon",icon:"dashicons-admin-page"},post:{type:"dashicon",icon:"dashicons-admin-post"},post_tag:{type:"dashicon",icon:"dashicons-tag"},post_format:{type:"dashicon",icon:"dashicons-format-standard"},term:{type:"dashicon",icon:"dashicons-category"},user:{type:"dashicon",icon:"dashicons-admin-users"}},add:function(t,e,n){return this.store[t]||(this.store[t]={type:e,icon:n}),this.store[t]},remove:function(t){this.store[t]&&delete this.store[t]},get:function(t){return"object"===_typeof(this.store[t])&&this.store[t]}},r=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};1<arguments.length&&void 0!==arguments[1]&&arguments[1];for(var e in _classCallCheck(this,n),this.attributes=[],this.classes=[],this.href="",this.icon=null,this.iconClasses=["jarvis__icon"],this.iconKey="",this.iconStyle="",this.iconType="dashicon",this.kind="",this.prefix="",this.section="",this.title="",this.type="",t)t.hasOwnProperty(e)&&(this[e]=t[e]);"string"==typeof this.type&&0<this.type.length&&-1===this.attributes.indexOf(this.type)&&this.attributes.push(this.type),this.iconKey&&this.iconType&&this.icon&&!d.get(this.iconKey)&&d.add(this.iconKey,this.iconType,this.icon),this.setIcon(this.iconKey)}return _createClass(n,[{key:"setIcon",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";if("image"!==this.iconType||!this.icon){if(!d.get(t)&&this.kind)switch(this.kind){case"term":t="post_tag";break;case"post":t="post";break;case"user":t="user"}var e=d.get(t);return!!e&&(this.iconKey=t,this.iconType=e.type,this.icon=e.icon,"dashicon"===this.iconType&&(this.iconClasses.push("dashicons-before"),-1===this.iconClasses.indexOf(this.icon)&&this.iconClasses.push(this.icon)),this.icon)}}}]),n}(),c=function(t){_inherits(p,r);var u=_createSuper(p);function p(t){var e;_classCallCheck(this,p),(e=u.call(this)).link=t,e.section=jQuery(e.link).closest("li.menu-top").first(),e.prefix=e.section.find(".wp-menu-name").clone().children().remove().end().text(),e.kind="menu",e.type=e.kind,e.href=t.href,e.attributes.push(e.type),e.classes.push("jarvis__suggestion--".concat(e.kind)),jQuery(e.link).is(".wp-submenu a")?e.title="".concat(e.prefix," » ").concat(jQuery(e.link).clone().children().remove().end().text()):e.title=e.prefix;var n=e.section.find(".wp-menu-image").first(),i=e.section.find("> a").first();if(0<i.length){var s=i.attr("href");if(-1<s.indexOf("?"))for(var o=s.substr(s.indexOf("?")+1).split("&"),a=0;a<o.length;a++){var r=o[a].split("=");if(2===r.length&&"post_type"===r[0]&&0<r[1].length){e.iconKey=r[1];break}}}if(e.iconKey||(e.iconKey=e.section.attr("id")),e.classes.push("jarvis__suggestion--".concat(e.iconKey)),0<n.length){if(!d.get(e.iconKey)){var c;switch(!0){case 0<e.section.find(".wp-menu-image img").length:e.iconType="image",e.icon=e.section.find(".wp-menu-image img").first().attr("src");break;case n.hasClass("svg"):c=window.getComputedStyle(n.get(0)),/^url\("data:image\/svg\+xml\;base64,/.test(c.backgroundImage)&&(e.iconType="svg",e.icon=atob(c.backgroundImage.replace(/^url\("data:image\/svg\+xml\;base64,/,"").replace(/\"\)$/,"")),e.icon=e.icon.replace(/<\?xml [^>]+\?>/g,"").replace(/\sid="[^\"]+"/g,"").replace(/<!--[\s\S]*?-->/g,"").replace(/<(title|desc|defs)>[^<]+?<\/(title|desc|defs)>/g,""));break;case n.hasClass("dashicons-before"):if("dashicons"===(c=window.getComputedStyle(n.get(0),":before")).fontFamily)e.iconType="dashicon",e.icon=n.attr("class").trim().split(" ").filter(function(t){return-1===["dashicons-before","wp-menu-image"].indexOf(t)}).shift(),e.iconClasses.push(e.icon),e.iconClasses.push("dashicons-before");else{var l=document.getElementById("jarvis_style");l||((l=document.createElement("style")).type="text/css",l.id="jarvis_style",document.head.appendChild(l));var h=".jarvis__suggestion--".concat(e.iconKey," .jarvis__icon::before { font-family: ").concat(c.fontFamily,"; content: ").concat(c.content,"; }")+"\n";l.appendChild(document.createTextNode(h))}}d.add(e.iconKey,e.iconType,e.icon)}e.setIcon(e.iconKey)}return e}return p}(),i={suggestion:t.template('\n\t\t\t<span class="<% print( classes.join( \' \' ) ) %>">\n\t\t\t\t<a href="<%= href %>" data-type="<%= type %>">\n\t\t\t\t\t<span class="<% print( iconClasses.join( \' \' ) ) %>" style=\'<%= iconStyle %>\' title="<%= prefix %>">\n\t\t\t\t\t<% if ( iconType === \'image\' ) { %>\n\t\t\t\t\t\t<img src="<%= icon %>" alt="<%= title %>">\n\t\t\t\t\t<% } else if ( iconType === \'svg\' ) { %>\n\t\t\t\t\t\t<%= icon %>\n\t\t\t\t\t<% } %>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class="jarvis__title" title="<%- title %>"><%- title %></span>\n\t\t\t\t\t<% if ( attributes ) { %>\n\t\t\t\t\t\t<span class="jarvis__pills">\n\t\t\t\t\t\t\t<% _.each( attributes, function(attr) { %>\n\t\t\t\t\t\t\t\t<span class="jarvis__pill"><%= attr %></span>\n\t\t\t\t\t\t\t<% } ); %>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t<% } %>\n\t\t\t\t</a>\n\t\t\t</span>\n\t\t')};return function(){function s(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];for(var i in _classCallCheck(this,s),this.iconStore=d,this.settings={hotkey:"/",searchurl:"/wp-json/jarvis/v1/search"},e)e.hasOwnProperty(i)&&(this.settings[i]=e[i]);this.opened=!1,this.suggestions=[],this.instants=n,this.term="",this.ctrlKey=!1,this.node=document.createElement("div"),this.node.className="jarvis jarvis--".concat(this.settings.theme),this.node.id="jarvis",this.modal=document.createElement("div"),this.modal.className="jarvis__modal",this.overlay=document.createElement("div"),this.overlay.className="jarvis__overlay",this.overlay.addEventListener("click",function(){return t.close()}),this.search=document.createElement("input"),this.search.type="text",this.$search=o(this.search),this.node.appendChild(this.overlay),this.node.appendChild(this.modal),this.modal.appendChild(this.search),this.loading=document.createElement("i"),this.loading.className="jarvis__loading",this.isJarvisUrl=function(t){var e=new URL(t,location.origin).pathname.match(/^\/wp-json\/jarvis\//);return e&&0<e.length},/complete|loaded/.test(document.readyState)?this.init():document.addEventListener("DOMContentLoaded",this.init.bind(this))}return _createClass(s,[{key:"init",value:function(){var i=this;o("#adminmenu a").each(function(t,e){i.suggestions.push(new c(e))}),Array.isArray(this.instants)&&(this.suggestions=this.suggestions.concat(this.instants.map(function(t){return new r(t)}))),document.addEventListener("keydown",function(t){t.key!==i.settings.hotkey||a()||(t.preventDefault(),t.stopPropagation())},!0),o(document).on("click","#wp-admin-bar-jarvis_menubar_icon a",function(t){t.preventDefault(),i.open()}),o(document).on("click",".jarvis__suggestion a",function(t){!0!==t.ctrlKey&&"ajax"!==t.currentTarget.getAttribute("data-type")||t.preventDefault()}),o(document).on("keydown keyup","#jarvis-search",function(t){i.ctrlKey=t.ctrlKey}),o(document).on("keyup",function(t){return i.opened&&"Escape"===t.key?(t.preventDefault(),t.stopPropagation(),void i.close()):a()?void 0:i.opened||t.key!==i.settings.hotkey?void 0:(t.preventDefault(),t.stopPropagation(),i.open())}),o(document).ajaxSend(function(t,e,n){i.opened&&i.isJarvisUrl(n.url)&&(i.modal.appendChild(i.loading),e.setRequestHeader("X-WP-Nonce",i.settings.nonce))}),o(document).ajaxComplete(function(t,e,n){i.opened&&i.isJarvisUrl(n.url)&&i.loading.parentNode&&i.loading.parentNode.removeChild(i.loading)})}},{key:"open",value:function(){var n=this;return this.opened=!0,document.body.appendChild(this.node),this.$search.typeahead({hint:!0,highlight:!0,minLength:1,classNames:{cursor:"jarvis__cursor",dataset:"jarvis__dataset",empty:"jarvis__empty",highlight:"jarvis__highlight",hint:"jarvis__hint",input:"jarvis__input",menu:"jarvis__menu",open:"jarvis__open",selectable:"jarvis__selectable",suggestion:"jarvis__suggestion",wrapper:"jarvis__wrap"}},{name:"results",limit:10,display:"title",source:new e({local:this.suggestions,datumTokenizer:e.tokenizers.obj.whitespace("title"),queryTokenizer:e.tokenizers.whitespace,remote:{url:"".concat(this.settings.searchurl,"?q=%s"),wildcard:"%s",transform:function(t){return Array.isArray(t)?t.map(function(t){return new r(t,"remote")}):t}}}),templates:{suggestion:function(t){return i.suggestion(t)}}}),this.$search.on("typeahead:select",function(t,e){if("ajax"===e.type)return n.ajax(e);n.ctrlKey?window.open(e.href,"_blank"):location.href=e.href}),this.$search.on("keyup",function(){n.term=n.search.value}),this.$search.typeahead("val",this.term),this.$search.focus().select(),this}},{key:"close",value:function(){return this.opened=!1,this.node.parentNode.removeChild(this.node),this.$search.typeahead("destroy"),this}},{key:"toggle",value:function(){return this.opened?this.close():this.open()}},{key:"ajax",value:function(t){var i=this;this.modal.appendChild(this.loading),o.ajax({url:t.href,success:function(t,e,n){i.term="",i.loading.parentNode&&i.modal.removeChild(i.loading),i.close()},error:function(t,e,n){i.loading.parentNode&&i.modal.removeChild(i.loading)}})}}]),s}()}(jQuery,_,Bloodhound); 9 9 //# sourceMappingURL=jarvis.js.map -
jarvis/trunk/dist/jarvis.js.map
r2072561 r2360349 1 {"version":3,"sources":["jarvis.js"],"names":["Jarvis","$","_","Bloodhound","i","arguments","length","test","_typeof","console","error","concat","inputFocused","document","activeElement","tagName","contentEditable","iconStore","store","attachment"," icon","category","type","nav_menu","nav_menu_item","page","post","key","post_format","post_tag","remove","term","this","Suggestion","data","undefined","prop","_classCallCheck","classes","href","iconClasses","get","iconKey","iconStyle","iconType","kind","prefix","title","hasOwnProperty","attributes","indexOf","push","setIcon","_createClass","value","storedIcon","MenuSuggestion","_Suggestion","link","_this","section","jQuery","closest","first","find","clone","children","end","text","is","$wpMenuIcon","$wpMenuLink","linkHref","attr","params","substr","split","pairs","computedStyle","hasClass","window","getComputedStyle","backgroundImage","atob","replace","trim","filter","c","shift","style","getElementById","createElement","id","head","appendChild","css","fontFamily","content","createTextNode","add","_inherits","templates","suggestion","template","_this2","settings","instants","s","hotkey","searchurl","opened","suggestions","ctrlKey","node","className","theme","modal","overlay","addEventListener","close","search","loading","isJarvisUrl","url","readyState","init","bind","_this3","elem","Array","isArray","map","inst","e","preventDefault","stopPropagation","on","open","currentTarget","getAttribute","event","jqXHR","setRequestHeader","ajaxComplete","parentNode","removeChild","display","body","$search","typeahead","hint","highlight","minLength","classNames","cursor","dataset","empty","input","selectable","wrapper","name","limit","source","local","obj","whitespace","queryTokenizer","tokenizers","remote","transform","response","item","focus","select","_this5","ajax","status"],"mappings":";;;;;;;85CAAA,IAAMA,OAAW,SAAUC,EAAGC,EAAGC,GAGhC,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IACrC,IAAO,kBAAkBG,KAAlBC,QAA+BH,UAAUD,KAI/C,MAHwB,YAAnB,oBAAOK,QAAP,YAAAD,QAAOC,WAAiD,mBAAlBA,QAAQC,OAClDD,QAAQC,MAAR,iCAAAC,OAAgDN,UAAUD,KAEpD,aAOY,SAAfQ,IACL,MAAO,wBAAwBL,KAAMM,SAASC,cAAcC,UAAwD,SAA3CF,SAASC,cAAcE,gBADjG,IAZAC,EAAA,CACCC,MAAO,CACNC,WAAK,CACJV,KAAAA,WACAW,KAAA,yBACDC,SAAO,CACPC,KAAA,WACDF,KAAA,sBAsBCG,SAAU,CACTD,KAAM,WACNF,KAAM,kBAnBTI,cAAkB,CACjBF,KAAA,WADDF,KAAA,8BAyBEK,KAAM,CACLH,KAAM,WACNF,KAAM,wBApBTM,KAAIT,CACHC,KAAK,WACJC,KAAAA,wBAECC,SAAI,CAFOE,KADN,WAKND,KAAAA,iBAECD,YAAM,CAFGE,KALJ,WASNC,KAAAA,6BAECH,KAAAA,CAFSE,KATJ,WAaNE,KAAAA,sBAECJ,KAAAA,CAFcE,KAbT,WAiBNG,KAAI,0BAIJC,IAAAA,SAAMC,EAAAL,EAAAF,GAQNQ,OAPCN,KAAMJ,MAAAS,KACNP,KAAAA,MAAMO,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vfwC,CAAA9I,IAAA,SAAA2B,MAAA,WAyfjB,OAAAtB,KAAA8E,OAArB9E,KAAAuF,QAAAvF,KAAAyG,SAzfsC,CAAA9G,IAAA,OAAA2B,MAAA,SA4fvCqH,GAAA,IAAAG,EAAA9I,KACAA,KAAAoF,MAAAtB,YAAA9D,KAAAyF,SAbqBxH,EAAA8K,KAAhB,CAiBR1E,IAAAA,EAAAA,KACCC,QAAAA,SAAAA,EAAAA,EAAYuC,GAAAiC,EAAA/I,KAAA,GAAA+I,EAAArD,QAAAuB,YADF8B,EAAA1D,MAAA6B,YAAA6B,EAAArD,SAMXqD,EAAAvD,SAEC7G,MAAA,SAAAmI,EAAAmC,EAAAtK,GA6CKoK,EAAKrD,QAAQuB,YA3CnB8B,EAAA1D,MAAK6B,YAAe6B,EAAArD,gBA3gBsBzH,EAAA,GAA7B,CAshBd6D,OAAA3D,EAAKkJ","file":"jarvis.js","sourcesContent":["const Jarvis = ( function( $, _, Bloodhound ) {\r\n\r\n\t// cut the mustard - bail if any of our dependencies are missing\r\n\tfor( let i = 0; i < arguments.length; i++ ) {\r\n\t\tif ( ! /function|object/.test( typeof arguments[i] ) ) {\r\n\t\t\tif ( typeof console === 'object' && typeof console.error === 'function' ) {\r\n\t\t\t\tconsole.error( `Jarvis dependency is missing: ${arguments[i]}` );\r\n\t\t\t}\r\n\t\t\treturn function() {};\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * function for determining if the quick key should fire\r\n\t */\r\n\tconst inputFocused = function() {\r\n\t\treturn /INPUT|SELECT|TEXTAREA/.test( document.activeElement.tagName ) || document.activeElement.contentEditable === 'true';\r\n\t}\r\n\r\n\t/**\r\n\t * Object to store icons data by key\r\n\t */\r\n\tlet iconStore = {\r\n\t\tstore: {\r\n\t\t\tattachment: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-media',\r\n\t\t\t},\r\n\t\t\tcategory: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-category',\r\n\t\t\t},\r\n\t\t\tnav_menu: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-menu',\r\n\t\t\t},\r\n\t\t\tnav_menu_item: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-appearance',\r\n\t\t\t},\r\n\t\t\tpage: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-page',\r\n\t\t\t},\r\n\t\t\tpost: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-post',\r\n\t\t\t},\r\n\t\t\tpost_tag: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-tag',\r\n\t\t\t},\r\n\t\t\tpost_format: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-format-standard',\r\n\t\t\t},\r\n\t\t\tterm: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-category',\r\n\t\t\t},\r\n\t\t\tuser: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-users',\r\n\t\t\t},\r\n\t\t},\r\n\r\n\t\tadd: function( key, type, icon ) {\r\n\t\t\tif ( ! this.store[ key ] ) {\r\n\t\t\t\tthis.store[ key ] = {\r\n\t\t\t\t\ttype: type,\r\n\t\t\t\t\ticon: icon,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\treturn this.store[ key ];\r\n\t\t},\r\n\r\n\t\tremove: function( key ) {\r\n\t\t\tif ( this.store[ key ] ) {\r\n\t\t\t\tdelete this.store[ key ];\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tget: function( key ) {\r\n\t\t\treturn ( typeof this.store[key] === 'object' ) ? this.store[key] : false;\r\n\t\t},\r\n\t};\r\n\r\n\tclass Suggestion {\r\n\r\n\t\t/**\r\n\t\t * Base Suggestion class constrcutor that contains the suggestion model\r\n\t\t *\r\n\t\t * @param object data\r\n\t\t * @param string type\r\n\t\t */\r\n\t\tconstructor( data = {}, type = '' ) {\r\n\t\t\tthis.attributes = [];\r\n\t\t\tthis.classes = [];\r\n\t\t\tthis.href = '';\r\n\t\t\tthis.icon = null;\r\n\t\t\tthis.iconClasses = [ 'jarvis__icon' ];\r\n\t\t\tthis.iconKey = '';\r\n\t\t\tthis.iconStyle = '';\r\n\t\t\tthis.iconType = 'dashicon';\r\n\t\t\tthis.kind = '';\r\n\t\t\tthis.prefix = '';\r\n\t\t\tthis.section = '';\r\n\t\t\tthis.title = '';\r\n\t\t\tthis.type = '';\r\n\r\n\t\t\tfor ( let prop in data ) {\r\n\t\t\t\tif ( data.hasOwnProperty( prop ) ) {\r\n\t\t\t\t\tthis[prop] = data[prop];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( typeof this.type === 'string' && this.type.length > 0 && this.attributes.indexOf( this.type ) === -1 ) {\r\n\t\t\t\tthis.attributes.push( this.type );\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.iconKey && this.iconType && this.icon && ! iconStore.get( this.iconKey ) ) {\r\n\t\t\t\ticonStore.add( this.iconKey, this.iconType, this.icon );\r\n\t\t\t}\r\n\r\n\t\t\tthis.setIcon( this.iconKey );\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Set the icon of this suggestion to the icon key in the icon store\r\n\t\t *\r\n\t\t * @param string iconKey\r\n\t\t */\r\n\t\tsetIcon( iconKey = '' ) {\r\n\t\t\t// image icon - usually unique per suggestion - no reason to cache it\r\n\t\t\tif ( this.iconType === 'image' && this.icon ) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! iconStore.get( iconKey ) && this.kind ) {\r\n\t\t\t\tswitch( this.kind ) {\r\n\t\t\t\t\tcase 'term':\r\n\t\t\t\t\t\ticonKey = 'post_tag';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'post':\r\n\t\t\t\t\t\ticonKey = 'post';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'user':\r\n\t\t\t\t\t\ticonKey = 'user';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet storedIcon = iconStore.get( iconKey );\r\n\r\n\t\t\tif ( storedIcon ) {\r\n\t\t\t\tthis.iconKey = iconKey;\r\n\t\t\t\tthis.iconType = storedIcon.type;\r\n\t\t\t\tthis.icon = storedIcon.icon;\r\n\r\n\t\t\t\tif ( this.iconType === 'dashicon' ) {\r\n\t\t\t\t\tthis.iconClasses.push( 'dashicons-before' );\r\n\r\n\t\t\t\t\tif ( this.iconClasses.indexOf( this.icon ) === -1 ) {\r\n\t\t\t\t\t\tthis.iconClasses.push( this.icon );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn this.icon;\r\n\t\t\t}\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tclass MenuSuggestion extends Suggestion {\r\n\t\t/**\r\n\t\t * Heavily modify the base suggestion model for menu items\r\n\t\t */\r\n\t\tconstructor( link ) {\r\n\t\t\tsuper();\r\n\r\n\t\t\tthis.link = link;\r\n\t\t\tthis.section = jQuery( this.link ).closest( 'li.menu-top' ).first();\r\n\t\t\tthis.prefix = this.section.find( '.wp-menu-name' ).clone().children().remove().end().text();\r\n\t\t\tthis.kind = 'menu';\r\n\t\t\tthis.type = this.kind;\r\n\t\t\tthis.href = link.href;\r\n\r\n\t\t\tthis.attributes.push( this.type );\r\n\t\t\tthis.classes.push( `jarvis__suggestion--${this.kind}`);\r\n\r\n\t\t\tif ( jQuery( this.link ).is( '.wp-submenu a' ) ) {\r\n\t\t\t\tthis.title = `${this.prefix} » ${jQuery( this.link ).clone().children().remove().end().text()}`;\r\n\t\t\t} else {\r\n\t\t\t\tthis.title = this.prefix;\r\n\t\t\t}\r\n\r\n\t\t\tlet $wpMenuIcon = this.section.find( '.wp-menu-image' ).first();\r\n\r\n\t\t\t// try and get the icon key from the top level link post_type= param of the link href so it matches up to remote data\r\n\t\t\tlet $wpMenuLink = this.section.find('> a').first();\r\n\t\t\tif ( $wpMenuLink.length > 0 ) {\r\n\t\t\t\tlet linkHref = $wpMenuLink.attr('href');\r\n\t\t\t\tlet qsIndex = linkHref.indexOf('?');\r\n\r\n\t\t\t\tif ( qsIndex > -1 ) {\r\n\t\t\t\t\tlet qs = linkHref.substr( linkHref.indexOf('?') + 1 );\r\n\t\t\t\t\tlet params = qs.split(\"&\");\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < params.length; i++ ) {\r\n\t\t\t\t\t\tlet pairs = params[i].split('=');\r\n\t\t\t\t\t\tif ( pairs.length === 2 && pairs[0] === 'post_type' && pairs[1].length > 0 ) {\r\n\t\t\t\t\t\t\tthis.iconKey = pairs[1];\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! this.iconKey ) {\r\n\t\t\t\tthis.iconKey = this.section.attr('id');\r\n\t\t\t}\r\n\r\n\t\t\tthis.classes.push( `jarvis__suggestion--${this.iconKey}`);\r\n\r\n\t\t\tif ( $wpMenuIcon.length > 0 ) {\r\n\t\t\t\tif ( ! iconStore.get( this.iconKey ) ) {\r\n\t\t\t\t\tlet computedStyle;\r\n\r\n\t\t\t\t\tswitch( true ) {\r\n\t\t\t\t\t\tcase this.section.find('.wp-menu-image img').length > 0:\r\n\t\t\t\t\t\t\t// img tag inside icon - old school\r\n\t\t\t\t\t\t\tthis.iconType = 'image';\r\n\t\t\t\t\t\t\tthis.icon = this.section.find('.wp-menu-image img').first().attr('src');\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase $wpMenuIcon.hasClass( 'svg' ):\r\n\t\t\t\t\t\t\t// base64 encoded svg\r\n\t\t\t\t\t\t\tcomputedStyle = window.getComputedStyle( $wpMenuIcon.get( 0 ) );\r\n\t\t\t\t\t\t\tif ( /^url\\(\"data:image\\/svg\\+xml\\;base64,/.test( computedStyle.backgroundImage ) ) {\r\n\t\t\t\t\t\t\t\tthis.iconType = 'svg';\r\n\t\t\t\t\t\t\t\tthis.icon = atob( computedStyle.backgroundImage.replace( /^url\\(\"data:image\\/svg\\+xml\\;base64,/, '' ).replace( /\\\"\\)$/, '' ) );\r\n\t\t\t\t\t\t\t\tthis.icon = this.icon.replace( /<\\?xml [^>]+\\?>/g, '' ).replace( /\\sid=\"[^\\\"]+\"/g, '' ).replace( /<!--[\\s\\S]*?-->/g, '' ).replace( /<(title|desc|defs)>[^<]+?<\\/(title|desc|defs)>/g, '' );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase $wpMenuIcon.hasClass( 'dashicons-before' ):\r\n\r\n\t\t\t\t\t\t\tcomputedStyle = window.getComputedStyle( $wpMenuIcon.get( 0 ), ':before' );\r\n\r\n\t\t\t\t\t\t\tif ( computedStyle.fontFamily === 'dashicons' ) {\r\n\t\t\t\t\t\t\t\t// proper dashicon\r\n\t\t\t\t\t\t\t\tthis.iconType = 'dashicon';\r\n\t\t\t\t\t\t\t\tthis.icon = $wpMenuIcon.attr('class').trim().split(' ').filter( c => [ 'dashicons-before', 'wp-menu-image' ].indexOf(c) === -1 ).shift();\r\n\t\t\t\t\t\t\t\tthis.iconClasses.push( this.icon );\r\n\t\t\t\t\t\t\t\tthis.iconClasses.push( 'dashicons-before' );\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// custom icons on top of a dashicon using css (woocommerce does this)\r\n\t\t\t\t\t\t\t\tlet style = document.getElementById( 'jarvis_style' );\r\n\t\t\t\t\t\t\t\tif ( ! style ) {\r\n\t\t\t\t\t\t\t\t\tstyle = document.createElement('style');\r\n\t\t\t\t\t\t\t\t\tstyle.type = 'text/css';\r\n\t\t\t\t\t\t\t\t\tstyle.id = 'jarvis_style';\r\n\t\t\t\t\t\t\t\t\tdocument.head.appendChild(style);\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tlet css = `.jarvis__suggestion--${this.iconKey} .jarvis__icon::before { font-family: ${computedStyle.fontFamily}; content: ${computedStyle.content}; }` + \"\\n\";\r\n\r\n\t\t\t\t\t\t\t\tstyle.appendChild( document.createTextNode(css) );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ticonStore.add( this.iconKey, this.iconType, this.icon );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.setIcon( this.iconKey );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * underscore template for typeahead suggestion\r\n\t */\r\n\tconst templates = {\r\n\t\tsuggestion: _.template( `\r\n\t\t\t<span class=\"<% print( classes.join( ' ' ) ) %>\">\r\n\t\t\t\t<a href=\"<%= href %>\" data-type=\"<%= type %>\">\r\n\t\t\t\t\t<span class=\"<% print( iconClasses.join( ' ' ) ) %>\" style='<%= iconStyle %>' title=\"<%= prefix %>\">\r\n\t\t\t\t\t<% if ( iconType === 'image' ) { %>\r\n\t\t\t\t\t\t<img src=\"<%= icon %>\" alt=\"<%= title %>\">\r\n\t\t\t\t\t<% } else if ( iconType === 'svg' ) { %>\r\n\t\t\t\t\t\t<%= icon %>\r\n\t\t\t\t\t<% } %>\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<span class=\"jarvis__title\" title=\"<%- title %>\"><%- title %></span>\r\n\t\t\t\t\t<% if ( attributes ) { %>\r\n\t\t\t\t\t\t<span class=\"jarvis__pills\">\r\n\t\t\t\t\t\t\t<% _.each( attributes, function(attr) { %>\r\n\t\t\t\t\t\t\t\t<span class=\"jarvis__pill\"><%= attr %></span>\r\n\t\t\t\t\t\t\t<% } ); %>\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t<% } %>\r\n\t\t\t\t</a>\r\n\t\t\t</span>\r\n\t\t`)\r\n\t};\r\n\r\n\tclass Jarvis {\r\n\t\t/**\r\n\t\t * The main interface to Jarvis\r\n\t\t *\r\n\t\t * @param object settings\r\n\t\t * @param array instants\r\n\t\t */\r\n\t\tconstructor( settings = {}, instants = [] ) {\r\n\r\n\t\t\tthis.iconStore = iconStore;\r\n\r\n\t\t\t// default settings\r\n\t\t\tthis.settings = {\r\n\t\t\t\thotkey: '/',\r\n\t\t\t\tsearchurl: '/wp-json/jarvis/v1/search',\r\n\t\t\t};\r\n\r\n\t\t\t// merge constructor settings with defaults\r\n\t\t\tfor( const s in settings ) {\r\n\t\t\t\tif ( settings.hasOwnProperty( s ) ) {\r\n\t\t\t\t\tthis.settings[ s ] = settings[ s ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// internal flag for modal open/close\r\n\t\t\tthis.opened = false;\r\n\r\n\t\t\t// array for storing wordpress links as datums for autocomplete\r\n\t\t\tthis.suggestions = [];\r\n\r\n\t\t\t// hold the instant suggestions to get processed after the menu links\r\n\t\t\tthis.instants = instants;\r\n\r\n\t\t\t// the current search term to re-open the modal with the same term\r\n\t\t\tthis.term = '';\r\n\r\n\t\t\t// flag for whether the ctrlKey is currently pressed\r\n\t\t\tthis.ctrlKey = false;\r\n\r\n\t\t\t// outer jarvis node\r\n\t\t\tthis.node = document.createElement( 'div' );\r\n\t\t\tthis.node.className = `jarvis jarvis--${this.settings.theme}`;\r\n\t\t\tthis.node.id = 'jarvis';\r\n\r\n\t\t\t// modal node\r\n\t\t\tthis.modal = document.createElement( 'div' );\r\n\t\t\tthis.modal.className = 'jarvis__modal';\r\n\r\n\t\t\t// modal overlay node\r\n\t\t\tthis.overlay = document.createElement( 'div' );\r\n\t\t\tthis.overlay.className = 'jarvis__overlay';\r\n\t\t\tthis.overlay.addEventListener( 'click', () => this.close() );\r\n\r\n\t\t\t// search input node\r\n\t\t\tthis.search = document.createElement( 'input' );\r\n\t\t\tthis.search.type = 'text';\r\n\t\t\tthis.$search = $( this.search ); // jquery version for typeahead\r\n\r\n\t\t\t// add our internal nodes to the outer node\r\n\t\t\tthis.node.appendChild( this.overlay );\r\n\t\t\tthis.node.appendChild( this.modal );\r\n\t\t\tthis.modal.appendChild( this.search );\r\n\r\n\t\t\t// loading icon node\r\n\t\t\tthis.loading = document.createElement( 'i' );\r\n\t\t\tthis.loading.className = 'jarvis__loading';\r\n\r\n\t\t\t// does the url argument match the searchurl\r\n\t\t\tthis.isJarvisUrl = function( url ) {\r\n\t\t\t\treturn url.indexOf( this.settings.searchurl ) > -1;\r\n\t\t\t}\r\n\r\n\t\t\t// test if constructor was called after the page is loaded, or on DOMContentLoaded\r\n\t\t\tif ( /complete|loaded/.test( document.readyState ) ) {\r\n\t\t\t\tthis.init();\r\n\t\t\t} else {\r\n\t\t\t\tdocument.addEventListener( 'DOMContentLoaded', this.init.bind( this ) );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tinit() {\r\n\t\t\t// scrape wordpress menu for sidebar links\r\n\t\t\t$( '#adminmenu a' ).each( ( i, elem ) => {\r\n\t\t\t\tthis.suggestions.push( new MenuSuggestion( elem ) );\r\n\t\t\t\treturn;\r\n\t\t\t} );\r\n\r\n\t\t\t// process the instant suggestions after the icons have been scraped\r\n\t\t\tif ( Array.isArray( this.instants ) ) {\r\n\t\t\t\tthis.suggestions = this.suggestions.concat( this.instants.map( inst => new Suggestion(inst) ) );\r\n\t\t\t}\r\n\r\n\t\t\t// Prevent Firefox from using quick search with the hotkey\r\n\t\t\tdocument.addEventListener( 'keydown', ( e ) => {\r\n\t\t\t\tif ( e.key === this.settings.hotkey && ! inputFocused() ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t}\r\n\t\t\t}, true ); // use true for event capture\r\n\r\n\t\t\t// menu bar icon click\r\n\t\t\t$( document ).on( 'click', '#wp-admin-bar-jarvis_menubar_icon a', ( e ) => {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\tthis.open();\r\n\t\t\t} );\r\n\r\n\t\t\t// let the typeahead:selected event handle ctrl+click so it's consistent with keyboard ctrl+enter\r\n\t\t\t// prevent default for ajax actions\r\n\t\t\t$( document ).on( 'click', '.jarvis__suggestion a', ( e ) => {\r\n\t\t\t\tif ( e.ctrlKey === true || e.currentTarget.getAttribute('data-type') === 'ajax' ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\t// record the ctrlKey status so we can use it in typeaheads custom triggered events\r\n\t\t\t$( document ).on( 'keydown keyup', '#jarvis-search', ( e ) => {\r\n\t\t\t\tthis.ctrlKey = e.ctrlKey;\r\n\t\t\t} );\r\n\r\n\t\t\t// listen for hotkey\r\n\t\t\t$( document ).on( 'keyup', ( e ) => {\r\n\t\t\t\t// handle esc key - must go before inputFocused check so we can close when jarvis search is focused\r\n\t\t\t\tif ( this.opened && e.key === 'Escape' ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\tthis.close();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// return if editable field is focused\r\n\t\t\t\tif ( inputFocused() ) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// open jarvis\r\n\t\t\t\tif ( ! this.opened && e.key === this.settings.hotkey ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn this.open();\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\t// showing spinners & adding nonce headers\r\n\t\t\t$( document ).ajaxSend( ( event, jqXHR, settings ) => {\r\n\t\t\t\tif ( this.opened && this.isJarvisUrl( settings.url ) ) {\r\n\t\t\t\t\t// add our loading icon to the UI\r\n\t\t\t\t\tthis.modal.appendChild( this.loading );\r\n\t\t\t\t\t// add our nonce to the header so the rest api considers it a logged in request\r\n\t\t\t\t\tjqXHR.setRequestHeader( 'X-WP-Nonce', this.settings.nonce );\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\t// hiding spinners\r\n\t\t\t$( document ).ajaxComplete( ( event, jqXHR, settings ) => {\r\n\t\t\t\tif ( this.opened && this.isJarvisUrl( settings.url ) && this.loading.parentNode ) {\r\n\t\t\t\t\t// hide our loading icon on ajaxComplete\r\n\t\t\t\t\tthis.loading.parentNode.removeChild( this.loading );\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\t\t}\r\n\r\n\t\topen() {\r\n\t\t\tthis.opened = true;\r\n\t\t\tdocument.body.appendChild( this.node ); // append our primary node to the body\r\n\r\n\t\t\tthis.$search.typeahead( {\r\n\t\t\t\thint : true,\r\n\t\t\t\thighlight : true,\r\n\t\t\t\tminLength : 1,\r\n\t\t\t\tclassNames: {\r\n\t\t\t\t\tcursor : 'jarvis__cursor',\r\n\t\t\t\t\tdataset : 'jarvis__dataset',\r\n\t\t\t\t\tempty : 'jarvis__empty',\r\n\t\t\t\t\thighlight : 'jarvis__highlight',\r\n\t\t\t\t\thint : 'jarvis__hint',\r\n\t\t\t\t\tinput : 'jarvis__input',\r\n\t\t\t\t\tmenu : 'jarvis__menu',\r\n\t\t\t\t\topen : 'jarvis__open',\r\n\t\t\t\t\tselectable: 'jarvis__selectable',\r\n\t\t\t\t\tsuggestion: 'jarvis__suggestion',\r\n\t\t\t\t\twrapper : 'jarvis__wrap',\r\n\t\t\t\t}\r\n\t\t\t}, {\r\n\t\t\t\tname: 'results',\r\n\t\t\t\tlimit: 10,\r\n\t\t\t\tdisplay: 'title',\r\n\t\t\t\tsource: new Bloodhound( {\r\n\t\t\t\t\tlocal: this.suggestions,\r\n\t\t\t\t\tdatumTokenizer: Bloodhound.tokenizers.obj.whitespace( 'title' ),\r\n\t\t\t\t\tqueryTokenizer: Bloodhound.tokenizers.whitespace,\r\n\t\t\t\t\tremote: {\r\n\t\t\t\t\t\turl: `${this.settings.searchurl}?q=%s`,\r\n\t\t\t\t\t\twildcard: '%s',\r\n\t\t\t\t\t\ttransform: ( response ) => {\r\n\t\t\t\t\t\t\tif ( Array.isArray( response ) ) {\r\n\t\t\t\t\t\t\t\treturn response.map( (data) => new Suggestion( data, 'remote' ) );\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\treturn response;\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t}\r\n\t\t\t\t} ),\r\n\r\n\t\t\t\ttemplates: {\r\n\t\t\t\t\tsuggestion: ( data ) => templates.suggestion( data ),\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\tthis.$search.on( 'typeahead:select', ( e, item ) => {\r\n\t\t\t\tif ( item.type === 'ajax' ) {\r\n\t\t\t\t\treturn this.ajax( item );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( this.ctrlKey ) {\r\n\t\t\t\t\twindow.open( item.href, '_blank' );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlocation.href = item.href;\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\tthis.$search.on( 'keyup', () => {\r\n\t\t\t\tthis.term = this.search.value;\r\n\t\t\t} );\r\n\r\n\t\t\tthis.$search.typeahead( 'val', this.term );\r\n\t\t\tthis.$search.focus().select();\r\n\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tclose() {\r\n\t\t\tthis.opened = false;\r\n\t\t\tthis.node.parentNode.removeChild( this.node );\r\n\t\t\tthis.$search.typeahead( 'destroy' );\r\n\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\ttoggle() {\r\n\t\t\treturn ( this.opened ) ? this.close() : this.open();\r\n\t\t}\r\n\r\n\t\tajax( item ) {\r\n\t\t\tthis.modal.appendChild( this.loading );\r\n\r\n\t\t\t$.ajax( {\r\n\t\t\t\turl: item.href,\r\n\t\t\t\tsuccess: ( data, status, jqXHR ) => {\r\n\t\t\t\t\tthis.term = '';\r\n\t\t\t\t\tif ( this.loading.parentNode ) {\r\n\t\t\t\t\t\tthis.modal.removeChild( this.loading );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.close();\r\n\t\t\t\t},\r\n\t\t\t\terror: ( jqXHR, status, error ) => {\r\n\t\t\t\t\tif ( this.loading.parentNode ) {\r\n\t\t\t\t\t\tthis.modal.removeChild( this.loading );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\t\t}\r\n\t}\r\n\r\n\treturn Jarvis;\r\n\r\n})( jQuery, _, Bloodhound );\r\n"]}1 {"version":3,"sources":["jarvis.js"],"names":["Jarvis","$","_","Bloodhound","i","arguments","length","test","_typeof","console","error","concat","inputFocused","document","activeElement","tagName","contentEditable","iconStore","store","attachment","type","icon","category","nav_menu","nav_menu_item","page","post","post_tag","key","remove","post_format","this","Suggestion","data","undefined","_classCallCheck","attributes","classes","href","iconKey","iconStyle","iconType","kind","get","prefix","section","title","hasOwnProperty","prop","indexOf","push","add","setIcon","_createClass","value","storedIcon","iconClasses","MenuSuggestion","_Suggestion","_inherits","_super","_createSuper","link","_this","call","jQuery","closest","first","find","clone","children","end","text","$wpMenuIcon","$wpMenuLink","linkHref","attr","params","substr","split","pairs","computedStyle","window","getComputedStyle","backgroundImage","atob","replace","hasClass","fontFamily","trim","filter","c","shift","style","getElementById","createElement","id","head","appendChild","css","content","createTextNode","templates","_this2","instants","hotkey","searchurl","settings","s","opened","ctrlKey","node","className","theme","modal","overlay","addEventListener","close","search","loading","isJarvisUrl","url","matches","URL","location","origin","pathname","match","readyState","init","bind","_this3","each","elem","suggestions","Array","isArray","map","inst","e","preventDefault","stopPropagation","open","on","currentTarget","getAttribute","event","jqXHR","setRequestHeader","ajaxComplete","parentNode","removeChild","display","body","$search","typeahead","hint","highlight","minLength","classNames","cursor","dataset","empty","input","selectable","suggestion","wrapper","name","limit","source","local","obj","whitespace","queryTokenizer","tokenizers","remote","transform","response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,EAAAsL,KAAhB,CAiBRjF,IAAAA,EAAAA,KACC+D,QAAAA,SAAAA,EAAAA,EAAYlB,GAAAmC,EAAAH,KAAA,GAAAG,EAAA/D,QAAA+B,YADFgC,EAAApE,MAAAqC,YAAA+B,EAAA/D,SAMX+D,EAAAjE,SAEC3G,MAAA,SAAAyI,EAAAqC,EAAA9K,GA6CK4K,EAAK/D,QAAQ+B,YA3CnBgC,EAAApE,MAAKqC,YAAe+B,EAAA/D,gBA5gBsBvH,EAAA,GAA7B,CAuhBdiE,OAAA/D,EAAKwJ","file":"jarvis.js","sourcesContent":["const Jarvis = ( function( $, _, Bloodhound ) {\r\n\r\n\t// cut the mustard - bail if any of our dependencies are missing\r\n\tfor( let i = 0; i < arguments.length; i++ ) {\r\n\t\tif ( ! /function|object/.test( typeof arguments[i] ) ) {\r\n\t\t\tif ( typeof console === 'object' && typeof console.error === 'function' ) {\r\n\t\t\t\tconsole.error( `Jarvis dependency is missing: ${arguments[i]}` );\r\n\t\t\t}\r\n\t\t\treturn function() {};\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * function for determining if the quick key should fire\r\n\t */\r\n\tconst inputFocused = function() {\r\n\t\treturn /INPUT|SELECT|TEXTAREA/.test( document.activeElement.tagName ) || document.activeElement.contentEditable === 'true';\r\n\t}\r\n\r\n\t/**\r\n\t * Object to store icons data by key\r\n\t */\r\n\tlet iconStore = {\r\n\t\tstore: {\r\n\t\t\tattachment: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-media',\r\n\t\t\t},\r\n\t\t\tcategory: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-category',\r\n\t\t\t},\r\n\t\t\tnav_menu: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-menu',\r\n\t\t\t},\r\n\t\t\tnav_menu_item: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-appearance',\r\n\t\t\t},\r\n\t\t\tpage: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-page',\r\n\t\t\t},\r\n\t\t\tpost: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-post',\r\n\t\t\t},\r\n\t\t\tpost_tag: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-tag',\r\n\t\t\t},\r\n\t\t\tpost_format: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-format-standard',\r\n\t\t\t},\r\n\t\t\tterm: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-category',\r\n\t\t\t},\r\n\t\t\tuser: {\r\n\t\t\t\ttype: 'dashicon',\r\n\t\t\t\ticon: 'dashicons-admin-users',\r\n\t\t\t},\r\n\t\t},\r\n\r\n\t\tadd: function( key, type, icon ) {\r\n\t\t\tif ( ! this.store[ key ] ) {\r\n\t\t\t\tthis.store[ key ] = {\r\n\t\t\t\t\ttype: type,\r\n\t\t\t\t\ticon: icon,\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\treturn this.store[ key ];\r\n\t\t},\r\n\r\n\t\tremove: function( key ) {\r\n\t\t\tif ( this.store[ key ] ) {\r\n\t\t\t\tdelete this.store[ key ];\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tget: function( key ) {\r\n\t\t\treturn ( typeof this.store[key] === 'object' ) ? this.store[key] : false;\r\n\t\t},\r\n\t};\r\n\r\n\tclass Suggestion {\r\n\r\n\t\t/**\r\n\t\t * Base Suggestion class constrcutor that contains the suggestion model\r\n\t\t *\r\n\t\t * @param object data\r\n\t\t * @param string type\r\n\t\t */\r\n\t\tconstructor( data = {}, type = '' ) {\r\n\t\t\tthis.attributes = [];\r\n\t\t\tthis.classes = [];\r\n\t\t\tthis.href = '';\r\n\t\t\tthis.icon = null;\r\n\t\t\tthis.iconClasses = [ 'jarvis__icon' ];\r\n\t\t\tthis.iconKey = '';\r\n\t\t\tthis.iconStyle = '';\r\n\t\t\tthis.iconType = 'dashicon';\r\n\t\t\tthis.kind = '';\r\n\t\t\tthis.prefix = '';\r\n\t\t\tthis.section = '';\r\n\t\t\tthis.title = '';\r\n\t\t\tthis.type = '';\r\n\r\n\t\t\tfor ( let prop in data ) {\r\n\t\t\t\tif ( data.hasOwnProperty( prop ) ) {\r\n\t\t\t\t\tthis[prop] = data[prop];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( typeof this.type === 'string' && this.type.length > 0 && this.attributes.indexOf( this.type ) === -1 ) {\r\n\t\t\t\tthis.attributes.push( this.type );\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.iconKey && this.iconType && this.icon && ! iconStore.get( this.iconKey ) ) {\r\n\t\t\t\ticonStore.add( this.iconKey, this.iconType, this.icon );\r\n\t\t\t}\r\n\r\n\t\t\tthis.setIcon( this.iconKey );\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Set the icon of this suggestion to the icon key in the icon store\r\n\t\t *\r\n\t\t * @param string iconKey\r\n\t\t */\r\n\t\tsetIcon( iconKey = '' ) {\r\n\t\t\t// image icon - usually unique per suggestion - no reason to cache it\r\n\t\t\tif ( this.iconType === 'image' && this.icon ) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! iconStore.get( iconKey ) && this.kind ) {\r\n\t\t\t\tswitch( this.kind ) {\r\n\t\t\t\t\tcase 'term':\r\n\t\t\t\t\t\ticonKey = 'post_tag';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'post':\r\n\t\t\t\t\t\ticonKey = 'post';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'user':\r\n\t\t\t\t\t\ticonKey = 'user';\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tlet storedIcon = iconStore.get( iconKey );\r\n\r\n\t\t\tif ( storedIcon ) {\r\n\t\t\t\tthis.iconKey = iconKey;\r\n\t\t\t\tthis.iconType = storedIcon.type;\r\n\t\t\t\tthis.icon = storedIcon.icon;\r\n\r\n\t\t\t\tif ( this.iconType === 'dashicon' ) {\r\n\t\t\t\t\tthis.iconClasses.push( 'dashicons-before' );\r\n\r\n\t\t\t\t\tif ( this.iconClasses.indexOf( this.icon ) === -1 ) {\r\n\t\t\t\t\t\tthis.iconClasses.push( this.icon );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn this.icon;\r\n\t\t\t}\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tclass MenuSuggestion extends Suggestion {\r\n\t\t/**\r\n\t\t * Heavily modify the base suggestion model for menu items\r\n\t\t */\r\n\t\tconstructor( link ) {\r\n\t\t\tsuper();\r\n\r\n\t\t\tthis.link = link;\r\n\t\t\tthis.section = jQuery( this.link ).closest( 'li.menu-top' ).first();\r\n\t\t\tthis.prefix = this.section.find( '.wp-menu-name' ).clone().children().remove().end().text();\r\n\t\t\tthis.kind = 'menu';\r\n\t\t\tthis.type = this.kind;\r\n\t\t\tthis.href = link.href;\r\n\r\n\t\t\tthis.attributes.push( this.type );\r\n\t\t\tthis.classes.push( `jarvis__suggestion--${this.kind}`);\r\n\r\n\t\t\tif ( jQuery( this.link ).is( '.wp-submenu a' ) ) {\r\n\t\t\t\tthis.title = `${this.prefix} » ${jQuery( this.link ).clone().children().remove().end().text()}`;\r\n\t\t\t} else {\r\n\t\t\t\tthis.title = this.prefix;\r\n\t\t\t}\r\n\r\n\t\t\tlet $wpMenuIcon = this.section.find( '.wp-menu-image' ).first();\r\n\r\n\t\t\t// try and get the icon key from the top level link post_type= param of the link href so it matches up to remote data\r\n\t\t\tlet $wpMenuLink = this.section.find('> a').first();\r\n\t\t\tif ( $wpMenuLink.length > 0 ) {\r\n\t\t\t\tlet linkHref = $wpMenuLink.attr('href');\r\n\t\t\t\tlet qsIndex = linkHref.indexOf('?');\r\n\r\n\t\t\t\tif ( qsIndex > -1 ) {\r\n\t\t\t\t\tlet qs = linkHref.substr( linkHref.indexOf('?') + 1 );\r\n\t\t\t\t\tlet params = qs.split(\"&\");\r\n\r\n\t\t\t\t\tfor ( let i = 0; i < params.length; i++ ) {\r\n\t\t\t\t\t\tlet pairs = params[i].split('=');\r\n\t\t\t\t\t\tif ( pairs.length === 2 && pairs[0] === 'post_type' && pairs[1].length > 0 ) {\r\n\t\t\t\t\t\t\tthis.iconKey = pairs[1];\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! this.iconKey ) {\r\n\t\t\t\tthis.iconKey = this.section.attr('id');\r\n\t\t\t}\r\n\r\n\t\t\tthis.classes.push( `jarvis__suggestion--${this.iconKey}`);\r\n\r\n\t\t\tif ( $wpMenuIcon.length > 0 ) {\r\n\t\t\t\tif ( ! iconStore.get( this.iconKey ) ) {\r\n\t\t\t\t\tlet computedStyle;\r\n\r\n\t\t\t\t\tswitch( true ) {\r\n\t\t\t\t\t\tcase this.section.find('.wp-menu-image img').length > 0:\r\n\t\t\t\t\t\t\t// img tag inside icon - old school\r\n\t\t\t\t\t\t\tthis.iconType = 'image';\r\n\t\t\t\t\t\t\tthis.icon = this.section.find('.wp-menu-image img').first().attr('src');\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase $wpMenuIcon.hasClass( 'svg' ):\r\n\t\t\t\t\t\t\t// base64 encoded svg\r\n\t\t\t\t\t\t\tcomputedStyle = window.getComputedStyle( $wpMenuIcon.get( 0 ) );\r\n\t\t\t\t\t\t\tif ( /^url\\(\"data:image\\/svg\\+xml\\;base64,/.test( computedStyle.backgroundImage ) ) {\r\n\t\t\t\t\t\t\t\tthis.iconType = 'svg';\r\n\t\t\t\t\t\t\t\tthis.icon = atob( computedStyle.backgroundImage.replace( /^url\\(\"data:image\\/svg\\+xml\\;base64,/, '' ).replace( /\\\"\\)$/, '' ) );\r\n\t\t\t\t\t\t\t\tthis.icon = this.icon.replace( /<\\?xml [^>]+\\?>/g, '' ).replace( /\\sid=\"[^\\\"]+\"/g, '' ).replace( /<!--[\\s\\S]*?-->/g, '' ).replace( /<(title|desc|defs)>[^<]+?<\\/(title|desc|defs)>/g, '' );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase $wpMenuIcon.hasClass( 'dashicons-before' ):\r\n\r\n\t\t\t\t\t\t\tcomputedStyle = window.getComputedStyle( $wpMenuIcon.get( 0 ), ':before' );\r\n\r\n\t\t\t\t\t\t\tif ( computedStyle.fontFamily === 'dashicons' ) {\r\n\t\t\t\t\t\t\t\t// proper dashicon\r\n\t\t\t\t\t\t\t\tthis.iconType = 'dashicon';\r\n\t\t\t\t\t\t\t\tthis.icon = $wpMenuIcon.attr('class').trim().split(' ').filter( c => [ 'dashicons-before', 'wp-menu-image' ].indexOf(c) === -1 ).shift();\r\n\t\t\t\t\t\t\t\tthis.iconClasses.push( this.icon );\r\n\t\t\t\t\t\t\t\tthis.iconClasses.push( 'dashicons-before' );\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// custom icons on top of a dashicon using css (woocommerce does this)\r\n\t\t\t\t\t\t\t\tlet style = document.getElementById( 'jarvis_style' );\r\n\t\t\t\t\t\t\t\tif ( ! style ) {\r\n\t\t\t\t\t\t\t\t\tstyle = document.createElement('style');\r\n\t\t\t\t\t\t\t\t\tstyle.type = 'text/css';\r\n\t\t\t\t\t\t\t\t\tstyle.id = 'jarvis_style';\r\n\t\t\t\t\t\t\t\t\tdocument.head.appendChild(style);\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tlet css = `.jarvis__suggestion--${this.iconKey} .jarvis__icon::before { font-family: ${computedStyle.fontFamily}; content: ${computedStyle.content}; }` + \"\\n\";\r\n\r\n\t\t\t\t\t\t\t\tstyle.appendChild( document.createTextNode(css) );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ticonStore.add( this.iconKey, this.iconType, this.icon );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.setIcon( this.iconKey );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * underscore template for typeahead suggestion\r\n\t */\r\n\tconst templates = {\r\n\t\tsuggestion: _.template( `\r\n\t\t\t<span class=\"<% print( classes.join( ' ' ) ) %>\">\r\n\t\t\t\t<a href=\"<%= href %>\" data-type=\"<%= type %>\">\r\n\t\t\t\t\t<span class=\"<% print( iconClasses.join( ' ' ) ) %>\" style='<%= iconStyle %>' title=\"<%= prefix %>\">\r\n\t\t\t\t\t<% if ( iconType === 'image' ) { %>\r\n\t\t\t\t\t\t<img src=\"<%= icon %>\" alt=\"<%= title %>\">\r\n\t\t\t\t\t<% } else if ( iconType === 'svg' ) { %>\r\n\t\t\t\t\t\t<%= icon %>\r\n\t\t\t\t\t<% } %>\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<span class=\"jarvis__title\" title=\"<%- title %>\"><%- title %></span>\r\n\t\t\t\t\t<% if ( attributes ) { %>\r\n\t\t\t\t\t\t<span class=\"jarvis__pills\">\r\n\t\t\t\t\t\t\t<% _.each( attributes, function(attr) { %>\r\n\t\t\t\t\t\t\t\t<span class=\"jarvis__pill\"><%= attr %></span>\r\n\t\t\t\t\t\t\t<% } ); %>\r\n\t\t\t\t\t\t</span>\r\n\t\t\t\t\t<% } %>\r\n\t\t\t\t</a>\r\n\t\t\t</span>\r\n\t\t`)\r\n\t};\r\n\r\n\tclass Jarvis {\r\n\t\t/**\r\n\t\t * The main interface to Jarvis\r\n\t\t *\r\n\t\t * @param object settings\r\n\t\t * @param array instants\r\n\t\t */\r\n\t\tconstructor( settings = {}, instants = [] ) {\r\n\r\n\t\t\tthis.iconStore = iconStore;\r\n\r\n\t\t\t// default settings\r\n\t\t\tthis.settings = {\r\n\t\t\t\thotkey: '/',\r\n\t\t\t\tsearchurl: '/wp-json/jarvis/v1/search',\r\n\t\t\t};\r\n\r\n\t\t\t// merge constructor settings with defaults\r\n\t\t\tfor( const s in settings ) {\r\n\t\t\t\tif ( settings.hasOwnProperty( s ) ) {\r\n\t\t\t\t\tthis.settings[ s ] = settings[ s ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// internal flag for modal open/close\r\n\t\t\tthis.opened = false;\r\n\r\n\t\t\t// array for storing wordpress links as datums for autocomplete\r\n\t\t\tthis.suggestions = [];\r\n\r\n\t\t\t// hold the instant suggestions to get processed after the menu links\r\n\t\t\tthis.instants = instants;\r\n\r\n\t\t\t// the current search term to re-open the modal with the same term\r\n\t\t\tthis.term = '';\r\n\r\n\t\t\t// flag for whether the ctrlKey is currently pressed\r\n\t\t\tthis.ctrlKey = false;\r\n\r\n\t\t\t// outer jarvis node\r\n\t\t\tthis.node = document.createElement( 'div' );\r\n\t\t\tthis.node.className = `jarvis jarvis--${this.settings.theme}`;\r\n\t\t\tthis.node.id = 'jarvis';\r\n\r\n\t\t\t// modal node\r\n\t\t\tthis.modal = document.createElement( 'div' );\r\n\t\t\tthis.modal.className = 'jarvis__modal';\r\n\r\n\t\t\t// modal overlay node\r\n\t\t\tthis.overlay = document.createElement( 'div' );\r\n\t\t\tthis.overlay.className = 'jarvis__overlay';\r\n\t\t\tthis.overlay.addEventListener( 'click', () => this.close() );\r\n\r\n\t\t\t// search input node\r\n\t\t\tthis.search = document.createElement( 'input' );\r\n\t\t\tthis.search.type = 'text';\r\n\t\t\tthis.$search = $( this.search ); // jquery version for typeahead\r\n\r\n\t\t\t// add our internal nodes to the outer node\r\n\t\t\tthis.node.appendChild( this.overlay );\r\n\t\t\tthis.node.appendChild( this.modal );\r\n\t\t\tthis.modal.appendChild( this.search );\r\n\r\n\t\t\t// loading icon node\r\n\t\t\tthis.loading = document.createElement( 'i' );\r\n\t\t\tthis.loading.className = 'jarvis__loading';\r\n\r\n\t\t\t// does the url argument match the searchurl\r\n\t\t\tthis.isJarvisUrl = function( url ) {\r\n\t\t\t\tconst matches = ( new URL( url, location.origin ) ).pathname.match( /^\\/wp-json\\/jarvis\\// );\r\n\t\t\t\treturn matches && matches.length > 0;\r\n\t\t\t}\r\n\r\n\t\t\t// test if constructor was called after the page is loaded, or on DOMContentLoaded\r\n\t\t\tif ( /complete|loaded/.test( document.readyState ) ) {\r\n\t\t\t\tthis.init();\r\n\t\t\t} else {\r\n\t\t\t\tdocument.addEventListener( 'DOMContentLoaded', this.init.bind( this ) );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tinit() {\r\n\t\t\t// scrape wordpress menu for sidebar links\r\n\t\t\t$( '#adminmenu a' ).each( ( i, elem ) => {\r\n\t\t\t\tthis.suggestions.push( new MenuSuggestion( elem ) );\r\n\t\t\t\treturn;\r\n\t\t\t} );\r\n\r\n\t\t\t// process the instant suggestions after the icons have been scraped\r\n\t\t\tif ( Array.isArray( this.instants ) ) {\r\n\t\t\t\tthis.suggestions = this.suggestions.concat( this.instants.map( inst => new Suggestion(inst) ) );\r\n\t\t\t}\r\n\r\n\t\t\t// Prevent Firefox from using quick search with the hotkey\r\n\t\t\tdocument.addEventListener( 'keydown', ( e ) => {\r\n\t\t\t\tif ( e.key === this.settings.hotkey && ! inputFocused() ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t}\r\n\t\t\t}, true ); // use true for event capture\r\n\r\n\t\t\t// menu bar icon click\r\n\t\t\t$( document ).on( 'click', '#wp-admin-bar-jarvis_menubar_icon a', ( e ) => {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\tthis.open();\r\n\t\t\t} );\r\n\r\n\t\t\t// let the typeahead:selected event handle ctrl+click so it's consistent with keyboard ctrl+enter\r\n\t\t\t// prevent default for ajax actions\r\n\t\t\t$( document ).on( 'click', '.jarvis__suggestion a', ( e ) => {\r\n\t\t\t\tif ( e.ctrlKey === true || e.currentTarget.getAttribute('data-type') === 'ajax' ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\t// record the ctrlKey status so we can use it in typeaheads custom triggered events\r\n\t\t\t$( document ).on( 'keydown keyup', '#jarvis-search', ( e ) => {\r\n\t\t\t\tthis.ctrlKey = e.ctrlKey;\r\n\t\t\t} );\r\n\r\n\t\t\t// listen for hotkey\r\n\t\t\t$( document ).on( 'keyup', ( e ) => {\r\n\t\t\t\t// handle esc key - must go before inputFocused check so we can close when jarvis search is focused\r\n\t\t\t\tif ( this.opened && e.key === 'Escape' ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\tthis.close();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// return if editable field is focused\r\n\t\t\t\tif ( inputFocused() ) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// open jarvis\r\n\t\t\t\tif ( ! this.opened && e.key === this.settings.hotkey ) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn this.open();\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\t// showing spinners & adding nonce headers\r\n\t\t\t$( document ).ajaxSend( ( event, jqXHR, settings ) => {\r\n\t\t\t\tif ( this.opened && this.isJarvisUrl( settings.url ) ) {\r\n\t\t\t\t\t// add our loading icon to the UI\r\n\t\t\t\t\tthis.modal.appendChild( this.loading );\r\n\t\t\t\t\t// add our nonce to the header so the rest api considers it a logged in request\r\n\t\t\t\t\tjqXHR.setRequestHeader( 'X-WP-Nonce', this.settings.nonce );\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\t// hiding spinners\r\n\t\t\t$( document ).ajaxComplete( ( event, jqXHR, settings ) => {\r\n\t\t\t\tif ( this.opened && this.isJarvisUrl( settings.url ) && this.loading.parentNode ) {\r\n\t\t\t\t\t// hide our loading icon on ajaxComplete\r\n\t\t\t\t\tthis.loading.parentNode.removeChild( this.loading );\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\t\t}\r\n\r\n\t\topen() {\r\n\t\t\tthis.opened = true;\r\n\t\t\tdocument.body.appendChild( this.node ); // append our primary node to the body\r\n\r\n\t\t\tthis.$search.typeahead( {\r\n\t\t\t\thint : true,\r\n\t\t\t\thighlight : true,\r\n\t\t\t\tminLength : 1,\r\n\t\t\t\tclassNames: {\r\n\t\t\t\t\tcursor : 'jarvis__cursor',\r\n\t\t\t\t\tdataset : 'jarvis__dataset',\r\n\t\t\t\t\tempty : 'jarvis__empty',\r\n\t\t\t\t\thighlight : 'jarvis__highlight',\r\n\t\t\t\t\thint : 'jarvis__hint',\r\n\t\t\t\t\tinput : 'jarvis__input',\r\n\t\t\t\t\tmenu : 'jarvis__menu',\r\n\t\t\t\t\topen : 'jarvis__open',\r\n\t\t\t\t\tselectable: 'jarvis__selectable',\r\n\t\t\t\t\tsuggestion: 'jarvis__suggestion',\r\n\t\t\t\t\twrapper : 'jarvis__wrap',\r\n\t\t\t\t}\r\n\t\t\t}, {\r\n\t\t\t\tname: 'results',\r\n\t\t\t\tlimit: 10,\r\n\t\t\t\tdisplay: 'title',\r\n\t\t\t\tsource: new Bloodhound( {\r\n\t\t\t\t\tlocal: this.suggestions,\r\n\t\t\t\t\tdatumTokenizer: Bloodhound.tokenizers.obj.whitespace( 'title' ),\r\n\t\t\t\t\tqueryTokenizer: Bloodhound.tokenizers.whitespace,\r\n\t\t\t\t\tremote: {\r\n\t\t\t\t\t\turl: `${this.settings.searchurl}?q=%s`,\r\n\t\t\t\t\t\twildcard: '%s',\r\n\t\t\t\t\t\ttransform: ( response ) => {\r\n\t\t\t\t\t\t\tif ( Array.isArray( response ) ) {\r\n\t\t\t\t\t\t\t\treturn response.map( (data) => new Suggestion( data, 'remote' ) );\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\treturn response;\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t}\r\n\t\t\t\t} ),\r\n\r\n\t\t\t\ttemplates: {\r\n\t\t\t\t\tsuggestion: ( data ) => templates.suggestion( data ),\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\tthis.$search.on( 'typeahead:select', ( e, item ) => {\r\n\t\t\t\tif ( item.type === 'ajax' ) {\r\n\t\t\t\t\treturn this.ajax( item );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( this.ctrlKey ) {\r\n\t\t\t\t\twindow.open( item.href, '_blank' );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlocation.href = item.href;\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\r\n\t\t\tthis.$search.on( 'keyup', () => {\r\n\t\t\t\tthis.term = this.search.value;\r\n\t\t\t} );\r\n\r\n\t\t\tthis.$search.typeahead( 'val', this.term );\r\n\t\t\tthis.$search.focus().select();\r\n\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tclose() {\r\n\t\t\tthis.opened = false;\r\n\t\t\tthis.node.parentNode.removeChild( this.node );\r\n\t\t\tthis.$search.typeahead( 'destroy' );\r\n\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\ttoggle() {\r\n\t\t\treturn ( this.opened ) ? this.close() : this.open();\r\n\t\t}\r\n\r\n\t\tajax( item ) {\r\n\t\t\tthis.modal.appendChild( this.loading );\r\n\r\n\t\t\t$.ajax( {\r\n\t\t\t\turl: item.href,\r\n\t\t\t\tsuccess: ( data, status, jqXHR ) => {\r\n\t\t\t\t\tthis.term = '';\r\n\t\t\t\t\tif ( this.loading.parentNode ) {\r\n\t\t\t\t\t\tthis.modal.removeChild( this.loading );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.close();\r\n\t\t\t\t},\r\n\t\t\t\terror: ( jqXHR, status, error ) => {\r\n\t\t\t\t\tif ( this.loading.parentNode ) {\r\n\t\t\t\t\t\tthis.modal.removeChild( this.loading );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} );\r\n\t\t}\r\n\t}\r\n\r\n\treturn Jarvis;\r\n\r\n})( jQuery, _, Bloodhound );\r\n"]} -
jarvis/trunk/jarvis.php
r2072561 r2360349 4 4 Plugin URI: http://www.wpjarvis.com 5 5 Description: Jarvis is your administration assistant, putting WordPress at your fingertips. 6 Version: 1.0. 46 Version: 1.0.5 7 7 Author: The Web Development Group, David Everett, Joan Piedra, Kurtis Shaner, Doug Axelrod 8 8 Author URI: http://www.wdg.co -
jarvis/trunk/readme.txt
r2072561 r2360349 7 7 Author: wdgdc 8 8 Requires at least: 4.8 9 Tested up to: 5. 1.110 Stable tag: 1.0. 411 Version: 1.0. 49 Tested up to: 5.5.0 10 Stable tag: 1.0.5 11 Version: 1.0.5 12 12 License: GPLv2 or later 13 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 66 66 == Changelog == 67 67 68 = 1.0.5 = 69 * Update build dependencies 70 * Add permission_callback on rest api routes for 5.5 update 71 * Add capability checks to instant actions 72 68 73 = 1.0.4 = 69 74 * fix the autoloader to support web roots with underscore characters -
jarvis/trunk/src/js/jarvis.js
r2072561 r2360349 377 377 // does the url argument match the searchurl 378 378 this.isJarvisUrl = function( url ) { 379 return url.indexOf( this.settings.searchurl ) > -1; 379 const matches = ( new URL( url, location.origin ) ).pathname.match( /^\/wp-json\/jarvis\// ); 380 return matches && matches.length > 0; 380 381 } 381 382 -
jarvis/trunk/src/php/plugin.php
r2072561 r2360349 8 8 * Le version of le plugin 9 9 */ 10 const VERSION = '1.0. 4';10 const VERSION = '1.0.5'; 11 11 12 12 /** … … 171 171 $this->get_instants(); 172 172 173 register_rest_route( Suggestions\Action::REST_PREFIX, '/search/', [ 174 'methods' => 'GET', 175 'callback' => function( $request ) { 176 return ( new Suggestions\Search() )->get( $request->get_param( 'q' ) ); 177 } 178 ] ); 173 register_rest_route( 174 Suggestions\Action::REST_PREFIX, '/search/', [ 175 'methods' => 'GET', 176 'callback' => function( $request ) { 177 return ( new Suggestions\Search() )->get( $request->get_param( 'q' ) ); 178 }, 179 'permission_callback' => 'is_user_logged_in', 180 ] 181 ); 179 182 180 183 if ( ! empty( $this->instants ) ) { … … 207 210 $this->_instants = apply_filters( 'jarvis/instants', $this->_instants ); 208 211 209 foreach( $this->_instants as $instant ) { 210 $this->instants[ $instant ] = new $instant; 212 foreach( $this->_instants as $instant_class ) { 213 $instant = new $instant_class(); 214 215 if ( current_user_can( $instant->capability() ) ) { 216 $this->instants[ $instant_class ] = $instant; 217 } 211 218 } 212 219 } -
jarvis/trunk/src/php/suggestions/action.php
r1966854 r2360349 3 3 namespace Jarvis\Suggestions; 4 4 5 class Action {5 abstract class Action { 6 6 7 7 const REST_PREFIX = 'jarvis/v1'; … … 10 10 protected $rest_methods = []; 11 11 protected $rest_args = []; 12 protected $rest_permission_callback = 'is_user_logged_in'; 13 14 public function current_user_can() { 15 return current_user_can( 'read' ); 16 } 12 17 13 18 public function register_rest_route() { 14 19 if ( ! empty( $this->rest_route ) ) { 15 register_rest_route( self::REST_PREFIX, '/' . $this->rest_route . '/', [ 16 'args' => $this->rest_args, 17 'callback' => [ $this, 'rest_route' ], 18 'methods' => $this->rest_methods, 19 ] ); 20 register_rest_route( 21 self::REST_PREFIX, 22 '/' . $this->rest_route . '/', 23 [ 24 'args' => $this->rest_args, 25 'callback' => [ $this, 'rest_route' ], 26 'methods' => $this->rest_methods, 27 'permission_callback' => [ $this, 'current_user_can' ], 28 ] 29 ); 20 30 } 21 31 } -
jarvis/trunk/src/php/suggestions/flush-rewrite-rules.php
r1966854 r2360349 8 8 protected $rest_args = []; 9 9 protected $rest_methods = [ 'GET' ]; 10 11 public function current_user_can() { 12 return current_user_can( 'manage_options' ); 13 } 10 14 11 15 public function get() { -
jarvis/trunk/src/php/suggestions/logout.php
r1966854 r2360349 5 5 class Logout { 6 6 7 public function current_user_can() { 8 return is_user_logged_in(); 9 } 10 7 11 public function get() { 8 $action = new \Jarvis\Models\Action();9 $action->id = 'logout';10 $action->slug = 'logout';11 $action->title = 'Logout';12 $action->iconKey = 'logout';12 $action = new \Jarvis\Models\Action(); 13 $action->id = 'logout'; 14 $action->slug = 'logout'; 15 $action->title = 'Logout'; 16 $action->iconKey = 'logout'; 13 17 $action->iconType = 'dashicon'; 14 $action->icon = 'dashicons-migrate';18 $action->icon = 'dashicons-migrate'; 15 19 16 $action->href = add_query_arg( [ 17 'action' => 'logout', 18 '_wpnonce' => wp_create_nonce( 'log-out' ) 19 ], home_url( 'wp-login.php' ) ); 20 $action->href = add_query_arg( 21 [ 22 'action' => 'logout', 23 '_wpnonce' => wp_create_nonce( 'log-out' ) 24 ], 25 home_url( 'wp-login.php' ) 26 ); 20 27 21 28 return $action; -
jarvis/trunk/src/php/suggestions/menus.php
r1966854 r2360349 4 4 5 5 class Menus { 6 7 public function current_user_can() { 8 return current_user_can( 'manage_options' ); 9 } 6 10 7 11 public function get() { … … 12 16 } 13 17 14 return array_map( function( $menu ) { 15 return new \Jarvis\Models\Menu( $menu->term_id ); 16 }, $menus ); 18 return array_map( 19 function( $menu ) { 20 return new \Jarvis\Models\Menu( $menu->term_id ); 21 }, 22 $menus 23 ); 17 24 } 18 25 -
jarvis/trunk/src/php/suggestions/recent.php
r1966854 r2360349 9 9 */ 10 10 class Recent { 11 12 public function current_user_can() { 13 return current_user_can( 'edit_posts' ); 14 } 11 15 12 16 public function get() { … … 22 26 * @since 1.0.0 23 27 */ 24 $query_args = apply_filters( 'jarvis/suggestions/recent/query', [ 25 'post_type' => get_post_types( ['show_ui' => true ], 'names' ), 26 'posts_per_page' => 10, 27 'author' => get_current_user_id(), 28 'orderby' => 'modified', 29 'order' => 'DESC', 30 'fields' => 'ids', 31 ] ); 28 $query_args = apply_filters( 29 'jarvis/suggestions/recent/query', 30 [ 31 'post_type' => get_post_types( ['show_ui' => true ], 'names' ), 32 'posts_per_page' => 10, 33 'author' => get_current_user_id(), 34 'orderby' => 'modified', 35 'order' => 'DESC', 36 'fields' => 'ids', 37 ] 38 ); 32 39 33 40 $query = new \WP_Query( $query_args );
Note: See TracChangeset
for help on using the changeset viewer.