MCPcopy
hub / github.com/retspen/webvirtcloud / normalizeCommandKeys

Function normalizeCommandKeys

static/js/ace.js:1577–1646  ·  view source on GitHub ↗
(callback, e, keyCode)

Source from the content-addressed store, hash-verified

1575};
1576
1577function normalizeCommandKeys(callback, e, keyCode) {
1578 var hashId = getModifierHash(e);
1579
1580 if (!useragent.isMac && pressedKeys) {
1581 if (pressedKeys[91] || pressedKeys[92])
1582 hashId |= 8;
1583 if (pressedKeys.altGr) {
1584 if ((3 & hashId) != 3)
1585 pressedKeys.altGr = 0;
1586 else
1587 return;
1588 }
1589 if (keyCode === 18 || keyCode === 17) {
1590 var location = "location" in e ? e.location : e.keyLocation;
1591 if (keyCode === 17 && location === 1) {
1592 ts = e.timeStamp;
1593 } else if (keyCode === 18 && hashId === 3 && location === 2) {
1594 var dt = -ts;
1595 ts = e.timeStamp;
1596 dt += ts;
1597 if (dt < 3)
1598 pressedKeys.altGr = true;
1599 }
1600 }
1601 }
1602
1603 if (keyCode in keys.MODIFIER_KEYS) {
1604 switch (keys.MODIFIER_KEYS[keyCode]) {
1605 case "Alt":
1606 hashId = 2;
1607 break;
1608 case "Shift":
1609 hashId = 4;
1610 break;
1611 case "Ctrl":
1612 hashId = 1;
1613 break;
1614 default:
1615 hashId = 8;
1616 break;
1617 }
1618 keyCode = -1;
1619 }
1620
1621 if (hashId & 8 && (keyCode === 91 || keyCode === 93)) {
1622 keyCode = -1;
1623 }
1624
1625 if (!hashId && keyCode === 13) {
1626 var location = "location" in e ? e.location : e.keyLocation;
1627 if (location === 3) {
1628 callback(e, hashId, -keyCode);
1629 if (e.defaultPrevented)
1630 return;
1631 }
1632 }
1633
1634 if (useragent.isChromeOS && hashId & 8) {

Callers 1

ace.jsFile · 0.85

Calls 1

callbackFunction · 0.85

Tested by

no test coverage detected