keyboard.html revision 4679bde12548e75a51abcb9c51cde874e70427a8
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin <!-- reset the default browser styles -->
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin font-size:6em;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin border:dotted;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin font-family: Terminal, monospace;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin text-align:center;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin display:inline-block;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin background-color: #444444;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin background-image: -webkit-linear-gradient(top, #ccc, #999);
b00c1cf9d61ccd9b0f7bc131f01d80bb5736af0dZbigniew Jędrzejewski-Szmek background-image: -moz-linear-gradient(top, #ccc, #999);
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin position: absolute;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin body .yui3-button-selected {
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin background-color:#666;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin body .yui3-button{
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin font-size:2em;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin margin:3px 6px 3px 6px;
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin <script src='/build/yui/yui-min.js'></script>
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin /*globals YUI */
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin }).use('button', 'cssreset', 'cssfonts', function(Y){
e4f246b1b512c68260581c4976d2eb01cf7febdcEvgeny Vereshchagin var caps, alt, i, textarea, keys, altKeys;
textarea = Y.one("#output");
Y.Array.each(keys, function(key){
var button = new Y.Button({
var node = button.getNode();
node.set('name', key);
if (key[0] === "[" && key.length > 1) {
node.addClass('wide');
node.addClass('space');
Y.one("#keyboard").append(node);
button.set('type', 'toggle');
nodeList = Y.all('#keyboard .yui3-button');
Y.Array.each(altKeys, function(pair){
nodeList.each(function(node){
if (node.getContent() === pair[x]) {
node.setContent(pair[y]);
var nodeList = Y.all('#keyboard .yui3-button');
nodeList.each(function(node){
var key = node.getContent();
if (key.length === 1) { // Only need to worry about the 1-character 'input' buttons
key = key.toUpperCase();
key = key.toLowerCase();
node.setContent(key);
Y.one("#keyboard").delegate("click", function(e){
key = e.target.getContent();
content = Y.one("#output").get("value");
newContent = Y.Lang.trimRight(newContent);
textarea.set('value', newContent);
textarea.set('value', content + '\t');
textarea.set('value', content + ' ');
textarea.set('value', content + '\n');
key = key.toUpperCase();
textarea.set('value', content + key);
Y.one("#output").on(["keydown", "keyup"], function(e){
Y.Object.some(codes, function(val, key){
if (e.button === val) {
node = Y.one('#keyboard .yui3-button[name='+ pressed +']');
node.toggleClass('yui3-button-selected');