Created
July 16, 2009 14:56
-
-
Save riffm/148453 to your computer and use it in GitHub Desktop.
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 Key = new Class({ | |
initialize:function(symbol, handler){ | |
this.symbol = symbol; | |
this.handler = handler; | |
}, | |
render:function(){ | |
return new Element('a',{ | |
'href':'#', | |
'text':this.symbol, | |
}); | |
} | |
}); | |
var KeyBoard = new Class({ | |
initialize:function(panelID){ | |
//this.panel = $(panelID); | |
this.chars = ['й','ц','у','к','е','н','г','ш','щ','з','х','ъ']; | |
this.body = new Element('div', { | |
'id':'keyboard', | |
'class':'keyboard', | |
'text':'' | |
}); | |
}, | |
initKeys:function(){ | |
this.chars.each(function(item, index){ | |
this.keys.push(new Key(item, this.typeHandler.bind(this))); | |
}); | |
}, | |
typeHandler:function(e){ | |
e.stop(); | |
console.log(e.target.symbol); | |
}, | |
render:function(){ | |
this.keys.each(function(item, index){ | |
item.render().inject(this.body); | |
}); | |
this.body.inject(document.body); | |
} | |
}); | |
window.addEvent('domready', function(){ | |
var keyBoard = new KeyBoard('panel'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment