1
0
Fork 0
forked from 0x2620/oxjs

more docs

This commit is contained in:
j 2011-05-16 12:49:48 +02:00
commit cc75e25415
42 changed files with 664 additions and 93 deletions

View file

@ -1,13 +1,9 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.Focus <o> Basic focus handler
@*/
Ox.Focus = function() {
/***
Ox.Focus
Basic focus handler
Methods
blur(id) blur element
focus(id) focus element
focused() return id of focused element, or null
***/
var stack = [];
return {
_print: function() {
@ -17,6 +13,10 @@ Ox.Focus = function() {
$('.OxFocus').removeClass('OxFocus');
stack = [];
},
/*@
blur <f> blur element
(id) -> <u> blur element by id
@*/
blur: function(id) {
var index = stack.indexOf(id);
if (index > -1 && index == stack.length - 1) {
@ -28,6 +28,10 @@ Ox.Focus = function() {
Ox.print('blur', id, stack);
}
},
/*@
focus <f> focus element
(id) -> <u> focus element by id
@*/
focus: function(id) {
var index = stack.indexOf(id);
if (index == -1 || index < stack.length - 1) {
@ -38,6 +42,10 @@ Ox.Focus = function() {
Ox.print('focus', id, stack);
}
},
/*@
focused <f> return id of focused element, or null
() -> <s> get id of currently focused element
@*/
focused: function() {
return stack.length ? stack[stack.length - 1] : null;
}