From 17156df963385a2955314d6d34ad956c96220715 Mon Sep 17 00:00:00 2001 From: JoshPiper <32164094+JoshPiper@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:07:44 +0100 Subject: [PATCH 1/4] feat: Add additional CSS entries for keyboard inputs. --- assets/css/menu-photon.scss | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/assets/css/menu-photon.scss b/assets/css/menu-photon.scss index e1e9267..2e5b35b 100644 --- a/assets/css/menu-photon.scss +++ b/assets/css/menu-photon.scss @@ -185,3 +185,34 @@ h4 { code { color: #9ba9b9 } + +.long-press { + &::before { + font-family: "Font Awesome 5 Free"; + color: black; + font-weight: 900; + left: -2em; + position: absolute; + text-align: center; + width: 2em; + line-height: inherit; + content: "\f017"; + } +} + +kbd { + border: #404040 solid 1px; + border-top-color: darken(#404040, 10%); + font-family: monospace; + font-weight: bolder; + box-shadow: darken(#404040, 10%); + background-color: lighten(#404040, 65%); + border-radius: 4px; + color: black; + display: inline-block; + margin: 0 .1em; + overflow-wrap: break-word; + padding: .1em .6em; + text-shadow: #404040; +} + From e25f5d1ec580d10bd86a6a01355c22e54fa8ecb4 Mon Sep 17 00:00:00 2001 From: JoshPiper <32164094+JoshPiper@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:08:06 +0100 Subject: [PATCH 2/4] feat: Add the key map and key getters. --- assets/js/game.js | 188 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) diff --git a/assets/js/game.js b/assets/js/game.js index 0f0540f..a58377c 100644 --- a/assets/js/game.js +++ b/assets/js/game.js @@ -5,5 +5,193 @@ window.game = { close: function(){ game.lua('ClosePhotonMenu()') + }, + + key_map: { + 1: "0", + 2: "1", + 3: "2", + 4: "3", + 5: "4", + 6: "5", + 7: "6", + 8: "7", + 9: "8", + 10: "9", + 11: "A", + 12: "B", + 13: "C", + 14: "D", + 15: "E", + 16: "F", + 17: "G", + 18: "H", + 19: "I", + 20: "J", + 21: "K", + 22: "L", + 23: "M", + 24: "N", + 25: "O", + 26: "P", + 27: "Q", + 28: "R", + 29: "S", + 30: "T", + 31: "U", + 32: "V", + 33: "W", + 34: "X", + 35: "Y", + 36: "Z", + 37: "0", + 38: "1", + 39: "2", + 40: "3", + 41: "4", + 42: "5", + 43: "6", + 44: "7", + 45: "8", + 46: "9", + 47: "/", + 48: "*", + 49: "-", + 50: "+", + 51: "ENTER", + 52: ".", + 53: "[", + 54: "]", + 55: ";", + 56: "'", + 57: "`", + 58: ",", + 59: ".", + 60: "/", + 61: "\\", + 62: "-", + 63: "=", + 64: "ENTER", + 65: "SPACE", + 66: "⌫", + 67: "⭾", + 68: "CAPS", + 69: "NUMLOCK", + 70: "ESC", + 71: "SCRL_LOCK", + 72: "INS", + 73: "DEL", + 74: "HOME", + 75: "END", + 76: "PGUP", + 77: "PGDN", + 78: "PAUSE", + 79: "SHIFT", + 80: "RSHIFT", + 81: "ALT", + 82: "RALT", + 83: "CTRL", + 84: "RCTRL", + 85: "LWIN", + 86: "RWIN", + 87: "APP", + 88: "↑", + 89: "←", + 90: "↓", + 91: "→", + 92: "F1", + 93: "F2", + 94: "F3", + 95: "F4", + 96: "F5", + 97: "F6", + 98: "F7", + 99: "F8", + 100: "F9", + 101: "F10", + 102: "F11", + 103: "F12", + 104: "CAPS_TOGGLE", + 105: "NUM_LOCK_TOGGLE", + 106: "SCROLL_TOGGLE", + 107: "LMB", + 108: "RMB", + 109: "M3", + 110: "M4", + 111: "M5", + 112: "SCROLL_UP", + 113: "SCROLL_DOWN", + 114: "JOY1", + 115: "JOY2", + 116: "JOY3", + 117: "JOY4", + 118: "JOY5", + 119: "JOY6", + 120: "JOY7", + 121: "JOY8", + 122: "JOY9", + 123: "JOY10", + 124: "JOY11", + 125: "JOY12", + 126: "JOY13", + 127: "JOY14", + 128: "JOY15", + 129: "JOY16", + 130: "JOY17", + 131: "JOY18", + 132: "JOY19", + 133: "JOY20", + 134: "JOY21", + 135: "JOY22", + 136: "JOY23", + 137: "JOY24", + 138: "JOY25", + 139: "JOY26", + 140: "JOY27", + 141: "JOY28", + 142: "JOY29", + 143: "JOY30", + 144: "JOY31", + 145: "JOY32", + 146: "JOY1", + 147: "JOY2", + 148: "JOY3", + 149: "JOY4", + 150: "JOY5", + 151: "JOY6", + 152: "JOY7", + 153: "JOY8", + 154: "JOY9", + 155: "JOY10", + 156: "JOY11", + 157: "JOY12", + 158: "JOY13", + 159: "JOY14", + }, + + get_key: function(command){ + game.lua('PhotonWebPage:QueueJavascript([[game.get_key_callback("' + command + '", ]] .. GetConVar("' + command + '"):GetInt() .. [[)]])') + }, + + get_key_callback: function(command, code){ + console.log("callback") + console.log(command) + console.log(String(code)) + if (code === "nil"){ + return + } + + code = parseInt(code) + console.log(code) + $(`[data-bind="${command}"]`).each(function(_, element){ + element.innerText = game.key_map[code] + $(element).attr('data-code', code) + }) } } + +$(document).ready(function(){ + $("[data-bind]").each(function(_, element){ + game.get_key(element.attributes['data-bind'].value) + }) +}) From 90d58962af02dc4debaaadb639061f33b68b12fa Mon Sep 17 00:00:00 2001 From: JoshPiper <32164094+JoshPiper@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:08:24 +0100 Subject: [PATCH 3/4] style: remove debug. --- assets/js/game.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/assets/js/game.js b/assets/js/game.js index a58377c..7d38c21 100644 --- a/assets/js/game.js +++ b/assets/js/game.js @@ -174,15 +174,11 @@ window.game = { }, get_key_callback: function(command, code){ - console.log("callback") - console.log(command) - console.log(String(code)) if (code === "nil"){ return } code = parseInt(code) - console.log(code) $(`[data-bind="${command}"]`).each(function(_, element){ element.innerText = game.key_map[code] $(element).attr('data-code', code) From 8609551e2ee8f50d5863f1cc218abcf2c75d36a9 Mon Sep 17 00:00:00 2001 From: JoshPiper <32164094+JoshPiper@users.noreply.github.com> Date: Tue, 18 Apr 2023 00:08:42 +0100 Subject: [PATCH 4/4] feat: Replace the usage page keys. --- _includes/photon/usage.html | 65 +++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/_includes/photon/usage.html b/_includes/photon/usage.html index 75f9759..726330d 100644 --- a/_includes/photon/usage.html +++ b/_includes/photon/usage.html @@ -1,83 +1,76 @@