Skip to content

dipcore/smart-tv-keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smartTvKeyboard

Virtual Keyboard for Smart TVs

About

See the project homepage.

Installation

Using Bower:

bower install smartTvKeyboard

Usage

Basic usage is as follows:

Include layout files and the library AFTER the Zepto/jQuery library

<script src="dist/layouts/en.js"></script>
<script src="dist/layouts/fr.js"></script>
<script src="dist/layouts/num.js"></script>
... put all layouts you want to use here
<script src="dist/smartTvKeyboard.min.js"></script>

Enable plugin

<input type="text" class="keyboard" placeholder="Enter your name">
...
<script type="text/javascript">
	$('document').ready(function(){
		$('.keyboard').smartTvKeyboard({
			layouts: smartTvKeyboardLayouts // Will enable all loaded layouts
		});
	});
</script>

Documentation

Configuration:

element.smartTvKeyboard({
	title: null, 			// Window title
	defLang: null, 			// Default language (layout key name)
	defMode: null, 			// Default mode (depends on layout, usually: 'shift', 'unshift' or 'symb')
	layouts: {}, 			// [REQUIRED] Layouts, ex. {en: en_layout_matrix, fr: fr_layout_matrix, etc}
	type: 'inline', 		// Keyboard type: 'inline' or 'modal'
	openOn: 'click focus', 	// Space-separated list of events to display the keyborad, defaults to 'click focus' 
	onEnter: null, 			// On enter callback, passes entered value as first param
	onCancel: null, 		// On cancel callback, passes entered value as first param
	useDirectEdit: true, 	// Allow direct input with physical keyboard
	useNavKeys: true, 		// Allow using nav keys (remote control) to select and enter values
	navKeys: { 				// List of custom key codes, requires if useNavKeys option enabled (usually it's remote control keycodes)
		LEFT: 37,
		UP: 38,
		RIGHT: 39,
		DOWN: 40,
		ENTER: 13, // Enter
		EXIT: 8 // ESC
	}
});
  • Only 'layouts' parameter is required.

Navigation keycodes example:

var KEY = new Common.API.TVKeyValue(); 	// Preset of keycodes generated by remote (Example for Samsung SmartTV)
										// http://www.samsungdforum.com/Guide/?FolderName=art00046&FileName=index.html

navKeys: {
    LEFT: KEY.KEY_LEFT, 
    UP: KEY.KEY_UP,
    RIGHT: KEY.KEY_RIGHT,
    DOWN: KEY.KEY_DOWN,
    ENTER: KEY.KEY_ENTER,
    EXIT: KEY.KEY_RETURN
}

See demo page for more examples

License

MIT. See LICENSE.txt in this directory.