mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
1 line
7.3 KiB
JavaScript
1 line
7.3 KiB
JavaScript
!function(){var e,t,o,i,s,n,r,a,l={},c=this&&this.__classPrivateFieldSet||function(e,t,o,i,s){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?s.call(e,o):s?s.value=o:t.set(e,o),o},h=this&&this.__classPrivateFieldGet||function(e,t,o,i){if("a"===o&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?i:"a"===o?i.call(e):i?i.value:t.get(e)};Object.defineProperty(l,"__esModule",{value:!0}),l.ControlTipsPlugin=void 0,l.ControlTipsPlugin=class{constructor(){e.add(this),t.set(this,void 0),o.set(this,void 0),i.set(this,void 0),s.set(this,!1),n.set(this,!1),r.set(this,void 0),c(this,t,document.createElement("div"),"f"),h(this,t,"f").id="control-tips-panel",document.body.appendChild(h(this,t,"f"))}getName(){return"Control Tips Plugin"}initialize(t){return c(this,o,t,"f"),c(this,i,h(this,o,"f").getShortcutManager(),"f"),h(this,i,"f").onKeyDown(()=>{h(this,e,"m",a).call(this)}),h(this,i,"f").onKeyUp(()=>{h(this,e,"m",a).call(this)}),document.addEventListener("airbaseMouseover",t=>{c(this,n,!0,"f"),h(this,e,"m",a).call(this)}),document.addEventListener("airbaseMouseout",t=>{c(this,n,!1,"f"),h(this,e,"m",a).call(this)}),document.addEventListener("unitDeselection",t=>{h(this,e,"m",a).call(this)}),document.addEventListener("unitMouseover",t=>{c(this,s,!0,"f"),h(this,e,"m",a).call(this)}),document.addEventListener("unitMouseout",t=>{c(this,s,!1,"f"),h(this,e,"m",a).call(this)}),document.addEventListener("unitsSelection",t=>{h(this,e,"m",a).call(this)}),document.addEventListener("mapVisibilityOptionsChanged",()=>{this.toggle(!h(this,o,"f").getMap().getVisibilityOptions()["Show control tips"])}),document.addEventListener("mouseover",t=>{t.target instanceof HTMLElement&&c(this,r,t.target,"f"),h(this,e,"m",a).call(this)}),document.addEventListener("mouseup",t=>{h(this,e,"m",a).call(this)}),h(this,e,"m",a).call(this),h(this,o,"f").getMap().addVisibilityOption("Show control tips",!0),!0}getElement(){return h(this,t,"f")}toggle(e){this.getElement().classList.toggle("hide",e)}},t=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,n=new WeakMap,r=new WeakMap,e=new WeakSet,a=function(){const e=[{keys:[],tips:[{key:"SHIFT",action:"Box select",showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1,showIfUnitSelected:!1},{key:"Mouse1",action:"Deselect",showIfUnitSelected:!0},{key:"Mouse1+drag",action:"Move map",showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1,showIfUnitSelected:!1},{key:"Mouse2",action:"Spawn menu",showIfUnitSelected:!1,showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1},{key:"Mouse2",action:"Quick options",showIfUnitSelected:!1,showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!0},{key:"Mouse2",action:"Airbase menu",showIfUnitSelected:!1,showIfHoveringOverAirbase:!0,showIfHoveringOverUnit:!1},{key:"Mouse2",action:"Set first waypoint",showIfHoveringOverAirbase:!1,showIfUnitSelected:!0,unitsMustBeControlled:!0},{key:"Mouse2 (hold)",action:"Interact (ground)",showIfUnitSelected:!0,showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1,unitsMustBeControlled:!0},{key:"Shift",action:"<em> in formation...</em>",showIfUnitSelected:!0,minSelectedUnits:2},{key:"CTRL",action:"<em> ... more</em>",showIfUnitSelected:!0,showIfHoveringOverAirbase:!1,unitsMustBeControlled:!0},{key:"CTRL",action:" Pin tool",showIfUnitSelected:!1,showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1,unitsMustBeControlled:!0},{key:"CTRL+Mouse2",action:" Airbase menu",showIfUnitSelected:!0,showIfHoveringOverAirbase:!0,unitsMustBeControlled:!0},{key:"Mouse1",action:"Toggle Blue/Red",mouseoverSelector:"#coalition-switch .ol-switch-fill"},{key:"Mouse2",action:"Set Neutral",mouseoverSelector:"#coalition-switch .ol-switch-fill"},{key:"Mouse1",action:"Toggle time display",mouseoverSelector:"#connection-status-panel[data-is-connected] #connection-status-message abbr"},{key:"Mouse1 or Z",action:"Change location system",mouseoverSelector:"#coordinates-tool, #coordinates-tool *"},{key:"Comma",action:"Decrease precision",mouseoverSelector:'#coordinates-tool[data-location-system="MGRS"], #coordinates-tool[data-location-system="MGRS"] *'},{key:"Period",action:"Increase precision",mouseoverSelector:'#coordinates-tool[data-location-system="MGRS"], #coordinates-tool[data-location-system="MGRS"] *'}]},{keys:["ControlLeft"],tips:[{key:"Mouse1",action:"Toggle pin",showIfUnitSelected:!1,showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1},{key:"Mouse1",action:"Toggle selection",showIfUnitSelected:!0,showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!0},{key:"Mouse2",action:"Add waypoint",showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!1,showIfUnitSelected:!0,unitsMustBeControlled:!0},{key:"Mouse2",action:"Interact (airbase)",showIfHoveringOverAirbase:!0,showIfUnitSelected:!0,unitsMustBeControlled:!0},{key:"Mouse2",action:"Interact (unit)",showIfHoveringOverAirbase:!1,showIfHoveringOverUnit:!0,showIfUnitSelected:!0,unitsMustBeControlled:!0},{key:"Shift",action:"<em> in formation...</em>",showIfUnitSelected:!0,minSelectedUnits:2},{key:"[Num 1-9]",action:"Set hotgroup",showIfUnitSelected:!0}]},{keys:["ShiftLeft"],tips:[{key:"Mouse1+drag",action:"Box select",showIfUnitSelected:!1},{key:"Mouse2",action:"Set first formation waypoint",showIfUnitSelected:!0,minSelectedUnits:2},{key:"[Num 1-9]",action:"Add to hotgroup",showIfUnitSelected:!0},{key:"CTRL",action:"<em> ... more</em>",minSelectedUnits:2,showIfUnitSelected:!0,showIfHoveringOverAirbase:!1,unitsMustBeControlled:!0}]},{keys:["ControlLeft","ShiftLeft"],tips:[{key:"Mouse2",action:"Add formation waypoint",showIfUnitSelected:!0,minSelectedUnits:2,unitsMustBeControlled:!0},{key:"[Num 1-9]",action:"Add hotgroup to selection",callback:e=>Object.values(h(this,o,"f").getUnitsManager().getUnits()).some(e=>e.getAlive()&&e.getControlled()&&e.getHotgroup()),showIfUnitSelected:!0,minSelectedUnits:1}]}],t=e.find(e=>h(this,i,"f").keyComboMatches(e.keys))||e[0],a=this.getElement();a.innerHTML="";let l=0,c=0,d=!1;if(h(this,o,"f").getUnitsManager()){let e=Object.values(h(this,o,"f").getUnitsManager().getSelectedUnits());l=e.length,c=e.filter(e=>e.getControlled()).length,d=c>0}const f=t.tips.some(e=>!!e.mouseoverSelector&&h(this,r,"f")instanceof HTMLElement!=0&&!!h(this,r,"f").matches(e.mouseoverSelector));t.tips.filter(e=>{if(l>0){if(!1===e.showIfUnitSelected)return!1;if(!0===e.unitsMustBeControlled&&!1===d)return!1;if("number"==typeof e.minSelectedUnits&&c<e.minSelectedUnits)return!1}return(0!==l||!0!==e.showIfUnitSelected)&&("boolean"!=typeof e.showIfHoveringOverAirbase||e.showIfHoveringOverAirbase===h(this,n,"f"))&&("boolean"!=typeof e.showIfHoveringOverUnit||e.showIfHoveringOverUnit===h(this,s,"f"))&&!(f&&("string"!=typeof e.mouseoverSelector||!h(this,r,"f").matches(e.mouseoverSelector)))&&!(!f&&"string"==typeof e.mouseoverSelector)&&!("function"==typeof e.callback&&!e.callback(e))&&void(a.innerHTML+=`<div><span class="key">${e.key}</span><span class="action">${e.action}</span></div>`)})};Object.defineProperty({},"__esModule",{value:!0}),globalThis.getOlympusPlugin=()=>new l.ControlTipsPlugin}(); |