You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ghost-keyboard

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghost-keyboard

Simulate any keyboard behaviour even not installed

1.0.6
latest
Source
npmnpm
Version published
Weekly downloads
5
25%
Maintainers
1
Weekly downloads
 
Created
Source

Ghost Keyboard

image image image

Simulate any keyboard behavior of any keyboard language. Using Ghost Keyboard you can:

  • Imitates an input typing and get the output value.
  • Convert the typing on a HTMLInputElement to another language even not installed on OS.

No dependency | Browser compatibility: IE10+, Chrome, Safari, Firefox

Check out the DEMO PAGE.

Languages

  • English (en) :us:
  • Korean (ko) :kr:

Options

  • lang Language abbreviation.
  • value (optional) Initial input value.
  • input(optional) HTMLInputElement that will connect with Ghost Keyboard.
  • pattern (optional) RegExp Allow only values that match the pattern.

Usage

$ npm install ghost-keyboard --save
import GhostKeyboard from 'ghost-keyboard';

GhostKeyboard({
    lang: 'en',
    value: '',
    input: document.getElementById('input_id'),
    pattern: /[a-zA-Z0-9.@]/g
});

Or manually download and link ghost-keyboard.min.js in your HTML, It can also be downloaded via UNPKG:

API

Ghost Keyboard also provide an API if you want to use without a real input.

let GhostKeyboard = require('ghost-require');

let EnglishKeyboard = GhostKeyboard({lang: 'en'});
keyboard.type('KeyI', {shiftKey: true}); // "I"
keyboard.type('Space'); // "I "
keyboard.type('KeyL'); // "I l"
keyboard.type('KeyU'); // "I lu"
keyboard.type('KeyV'); // "I luv"
keyboard.type('Space'); // "I luv "
keyboard.type('CapsLock'); // "I luv "
keyboard.type('KeyU'); // "I luv U"

let KoreanKeyboard = GhostKeyboard({lang: 'ko'});
KoreanKeyboard.type('KeyT'); //ㅅ
KoreanKeyboard.type('KeyK'); //사
KoreanKeyboard.type('KeyF'); //살
KoreanKeyboard.type('KeyK'); //사라
KoreanKeyboard.type('KeyD'); //사랑
console.log(KoreanKeyboard.value);

KoreanKeyboard.changeLang('en');
console.log('tkfkd');

Development

You will need Node.js installed on your system.

To develop, Install dependencies, Get the code:

$ git clone https://github.com/fill-lima/ghost-keyboard.git
$ cd ghost-keyboard # Into the directory
$ npm install       # Install dependencies

To develop, run the self-reloading:

$ npm start

To develop and check tests at same time.

$ npm run dev

To build, run:

$ npm run build

To contribute, please fork GhostKeyboard, add your patch and tests for it (in the test/ folder) and submit a pull request.

To do

  • Add compatibility to textarea input
  • Add option of keyboard layout
  • Other keyboard languages
  • Convert typed text in other keyboard layout

License

MIT © Felipe Lima

Keywords

keyboard

FAQs

Package last updated on 18 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.