Last active
November 17, 2023 22:27
-
-
Save GoodBoyNinja/26e35f0c246dd694662964d503be1583 to your computer and use it in GitHub Desktop.
A small group of functions to let you intuitively check one of ctrl, shift or alt is pressed. Example: alert(pressed.shift())
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pressed = new (function () { | |
this.shift = function () { | |
if (ScriptUI.environment.keyboardState.shiftKey) { | |
return true; | |
} | |
return false; | |
}; | |
this.alt = function () { | |
if (ScriptUI.environment.keyboardState.altKey) { | |
return true; | |
} | |
return false; | |
}; | |
this.ctrl = function () { | |
if (ScriptUI.environment.keyboardState.ctrlKey) { | |
return true; | |
} | |
return false; | |
}; | |
this.keyName = function (keyName) { | |
if (ScriptUI.environment.keyboardState.keyName(keyName)) { | |
return true; | |
} | |
return false; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment