2011-07-14 13:10:52 +02:00
|
|
|
function initialize_a_star( dom_container, level_index ) {
|
2011-07-14 10:37:24 +02:00
|
|
|
// kinda enums
|
2011-07-15 12:28:25 +02:00
|
|
|
var cell = { WALL: '#', BALL: '@', CUBE: 'H', EMPTY: ' ', GIFT: 'x' };
|
2011-07-15 08:48:30 +02:00
|
|
|
var direction = { UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39 };
|
2011-07-14 10:37:24 +02:00
|
|
|
|
|
|
|
var assets = {
|
2011-07-14 10:41:10 +02:00
|
|
|
sprites: load_sprites( "HP48" ),
|
2011-07-14 10:37:24 +02:00
|
|
|
levels: [ "#################@## x#H## x #### ##x ## ## x #### x x x ## x x## x ## ##x x#################",
|
|
|
|
" # # # # # ### x @# #x #x x # # x x # # # x # # #H# x # # # # #xx## # # # # ",
|
|
|
|
"################# x#@## ## ##H## #x x ## x x## x## #x x x# x### ##x #x x x####x ##x #################",
|
|
|
|
"################# #H## # ###x#x x#x#x#x#x## # #x x# # # ####x#x#x x#x#x#x## # ## # #@ #################",
|
|
|
|
" ############## #@ # # # ## #x # x x # ### # # ##x #x# #### # x # ##x# # # # #H## # x# #x# ############## ",
|
|
|
|
" ############ # x #x x# # x # ## # x ##@ x ### x # ### x # ##H # x ##x #################",
|
|
|
|
"################# # ## ### #x ##x# #x #x # # # # # # ### ## ## # #x# #x# # ## @#x H #x#################",
|
|
|
|
"############### # x## ### #x ## x ## x## # #x ### ## #x# ### # x#x ##xHx# x #@# ### # ###############",
|
|
|
|
" # ########### #x#x # @##x x# x # # # x## x# ## #x #xHx x## x## # #x#x # # # ############ ",
|
|
|
|
" ########### #### x ## H ###x x# x## x #x #x # # # x # x##x#x # x# #@# #x ### ### # # # # ######### # #",
|
|
|
|
"################# # @## #xx xx #### x ## x##x #x#xx ##### ## ## ##x x# x H x###x### # ## ## ########### ",
|
|
|
|
"## ## #### #@#####x ### x### xx x ## ## ##x #x# ## # x ###x ## ## ## ## #H# ## x ## x #################",
|
|
|
|
" ############## # @# x ### # #x x## ## x # ## x #x## # x ### x x #x##H # x # # # ############## ",
|
|
|
|
"#################x#x x#x## x#@ ## ## H x ## x# ## x ## x# # ##x#x x#x#################",
|
|
|
|
" ###### ####### # x# x ## # x # # x ## @# #xx #x # # # # x H# ##x # #x # # x # #x x# ############## ",
|
|
|
|
"################## H#x x x##x @x#x #### ### x #### x#x# ##xx x#x ### x ####x ###x# # #################",
|
|
|
|
"################# x# #@ ## # x#xx#x # ## #x##x# x ## x# x# ## x#x x# ## # # ##x# # ## x #x H #################",
|
|
|
|
"################# x x H# ## #x#x #x ## #x# #x ## x # x#x ## #x# # x# ## x#x # x # ##x#@ # # #################",
|
|
|
|
"#################x ## ##x## # # #x ## x# x## x ## # #x ## # x# ## ## x# ##x #H## x# #x ##@#################",
|
|
|
|
"################# x#x ###x x# ##x ### # # x # # ## H # ## # @x## # # x # # ### x## #x x### x#x #################",
|
|
|
|
"################# ### x ### # # ### ##x x ## x x x ### # ###x ## x x @ H x xx################# ",
|
|
|
|
"#################x# #x# #x # ## # ##x # #x x ### #x x #### x # ###x ## #@#H x ################# ",
|
|
|
|
" ############## # # #x# #x # ## x # ### # x #x ## #x # xx x ###x # ## x ## #@#H x # ############## ",
|
|
|
|
"################# # ### ##x x ##x### #x x# #### xx x# ## ## #x x # ## ## ## @#H###xx################# ",
|
2011-07-14 10:41:10 +02:00
|
|
|
"################# # ## x ##x x ## #x x ## ## x ## #x ## #x x# x ## ##x #@ H ################# " ]
|
2011-07-14 10:37:24 +02:00
|
|
|
};
|
|
|
|
|
2011-07-14 10:28:36 +02:00
|
|
|
////// FUNCTIONS //////
|
2011-07-14 10:37:24 +02:00
|
|
|
function load_sprites( theme ) {
|
|
|
|
var sprites = { };
|
|
|
|
sprites.ball = new Image();
|
|
|
|
sprites.ball.src = "themes/" + theme + "/tex_ball.png";
|
|
|
|
sprites.ball_selected = new Image();
|
|
|
|
sprites.ball_selected.src = "themes/" + theme + "/tex_ball_selected.png";
|
|
|
|
sprites.cube = new Image();
|
|
|
|
sprites.cube.src = "themes/" + theme + "/tex_cube.png";
|
|
|
|
sprites.cube_selected = new Image();
|
|
|
|
sprites.cube_selected.src = "themes/" + theme + "/tex_cube_selected.png";
|
|
|
|
sprites.wall = new Image();
|
|
|
|
sprites.wall.src = "themes/" + theme + "/tex_wall.png";
|
2011-07-15 12:23:33 +02:00
|
|
|
sprites.empty = new Image();
|
|
|
|
sprites.empty.src = "themes/" + theme + "/tex_empty.png";
|
2011-07-14 10:37:24 +02:00
|
|
|
sprites.gift = new Image();
|
|
|
|
sprites.gift.src = "themes/" + theme + "/tex_gift.png";
|
|
|
|
|
|
|
|
return sprites;
|
|
|
|
}
|
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function count_gifts( ) {
|
2011-07-13 22:57:02 +02:00
|
|
|
var n = 0;
|
2011-07-14 10:24:58 +02:00
|
|
|
for ( var i = level_infos.height * level_infos.width ; i-- ; ) {
|
2011-07-13 22:57:02 +02:00
|
|
|
if ( state.board[ i ] == cell.GIFT ) {
|
|
|
|
n++;
|
|
|
|
}
|
2011-07-04 16:11:42 +02:00
|
|
|
}
|
2011-07-13 22:57:02 +02:00
|
|
|
return n;
|
2011-07-04 16:11:42 +02:00
|
|
|
}
|
2011-07-04 16:51:03 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function get_pos( actor ) {
|
2011-07-13 22:57:02 +02:00
|
|
|
var p = state.board.indexOf( actor, state.board );
|
|
|
|
var pos = { };
|
2011-07-14 10:24:58 +02:00
|
|
|
pos[ 1 ] = Math.floor( p / level_infos.width ); /* y */
|
|
|
|
pos[ 0 ] = p - ( pos[ 1 ] * level_infos.width ); /* x */
|
2011-07-04 16:11:42 +02:00
|
|
|
|
2011-07-13 22:57:02 +02:00
|
|
|
return pos;
|
|
|
|
}
|
2011-07-04 16:51:03 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function get_cell( x, y ) {
|
2011-07-14 10:24:58 +02:00
|
|
|
return state.board[ x + ( y * level_infos.width ) ];
|
2011-07-13 22:57:02 +02:00
|
|
|
}
|
2011-07-04 16:51:03 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function set_cell( x, y, value ) {
|
2011-07-14 10:24:58 +02:00
|
|
|
var p = x + ( y * level_infos.width );
|
2011-07-13 22:57:02 +02:00
|
|
|
state.board = [ state.board.substring( 0, p ), value, state.board.substring( p+1, state.board.length ) ].join( '' );
|
|
|
|
return state;
|
|
|
|
}
|
2011-07-04 16:51:03 +02:00
|
|
|
|
2011-07-14 10:47:17 +02:00
|
|
|
function draw_cell( sprite, x, y ) {
|
|
|
|
DOM_infos.canvas.context.drawImage( sprite,
|
|
|
|
x * level_infos.cell.width,
|
|
|
|
y * level_infos.cell.height,
|
|
|
|
level_infos.cell.width,
|
|
|
|
level_infos.cell.height );
|
|
|
|
}
|
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function switch_actor( ) {
|
2011-07-13 22:57:02 +02:00
|
|
|
state.moving = ( state.moving == cell.BALL ) ? cell.CUBE : cell.BALL;
|
2011-07-14 09:58:21 +02:00
|
|
|
var ball_pos = get_pos( cell.BALL );
|
|
|
|
var cube_pos = get_pos( cell.CUBE );
|
2011-07-13 22:17:50 +02:00
|
|
|
|
2011-07-13 22:57:02 +02:00
|
|
|
// redraw ball
|
2011-07-14 10:47:17 +02:00
|
|
|
draw_cell( ( state.moving == cell.BALL ) ? assets.sprites.ball_selected : assets.sprites.ball, ball_pos[ 0 ], ball_pos[ 1 ] );
|
2011-07-13 22:57:02 +02:00
|
|
|
// redraw cube
|
2011-07-14 10:47:17 +02:00
|
|
|
draw_cell( ( state.moving == cell.CUBE ) ? assets.sprites.cube_selected : assets.sprites.cube, cube_pos[ 0 ], cube_pos[ 1 ] );
|
2011-07-13 22:57:02 +02:00
|
|
|
return state;
|
|
|
|
}
|
2011-07-04 16:51:03 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function won_or_not( ) {
|
|
|
|
return count_gifts( ) === 0;
|
2011-07-13 22:57:02 +02:00
|
|
|
}
|
2011-07-04 16:11:42 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function full_display_on_canvas( ) {
|
2011-07-14 10:24:58 +02:00
|
|
|
for ( var i=0 ; i < level_infos.height ; i++ ) {
|
|
|
|
for ( var j=0 ; j < level_infos.width ; j++ ) {
|
2011-07-14 09:58:21 +02:00
|
|
|
var c = get_cell( j, i );
|
2011-07-13 22:57:02 +02:00
|
|
|
var sprite;
|
|
|
|
switch( c ) {
|
2011-07-14 10:37:24 +02:00
|
|
|
case "@": sprite = ( state.moving == cell.BALL ) ? assets.sprites.ball_selected : assets.sprites.ball; break;
|
|
|
|
case "H": sprite = ( state.moving == cell.CUBE ) ? assets.sprites.cube_selected : assets.sprites.cube; break;
|
|
|
|
case "#": sprite = assets.sprites.wall; break;
|
|
|
|
case "x": sprite = assets.sprites.gift; break;
|
2011-07-15 12:23:33 +02:00
|
|
|
case " ": sprite = assets.sprites.empty; break;
|
2011-07-15 11:51:09 +02:00
|
|
|
default: break;
|
2011-07-13 22:57:02 +02:00
|
|
|
}
|
2011-07-14 10:47:17 +02:00
|
|
|
draw_cell( sprite, j, i );
|
2011-07-13 18:34:03 +02:00
|
|
|
}
|
2011-07-13 18:17:38 +02:00
|
|
|
}
|
|
|
|
}
|
2011-07-13 20:48:37 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function update_infos( ) {
|
2011-07-13 22:57:02 +02:00
|
|
|
var infos = "<h1>Star5</h1><br />";
|
2011-07-14 10:37:24 +02:00
|
|
|
infos += "Level <em>" + (state.level+1) + "</em> of <em>" + assets.levels.length + "</em><br />";
|
2011-07-14 09:58:21 +02:00
|
|
|
infos += "<em>" + count_gifts( ) + "</em> gifts left<br />";
|
2011-07-13 22:57:02 +02:00
|
|
|
infos += "<em>" + state.distance_travelled + "</em> meters travelled";
|
2011-07-13 22:17:50 +02:00
|
|
|
|
2011-07-15 11:29:36 +02:00
|
|
|
jQuery( DOM_infos.container + " .gstar #infos" ).html( infos );
|
2011-07-13 22:57:02 +02:00
|
|
|
}
|
2011-07-13 22:17:50 +02:00
|
|
|
|
2011-07-13 22:57:02 +02:00
|
|
|
function format_help( ) {
|
|
|
|
var help = "<em>←↑→↓</em> to move around<br />";
|
|
|
|
help += "<em>Space</em> to switch actor<br />";
|
|
|
|
help += "<em>r</em> to reload<br />";
|
|
|
|
help += "<em>n</em> to pass to the next level<br />";
|
|
|
|
help += "<em>p</em> to go back to the previous level<br />";
|
|
|
|
return help;
|
|
|
|
}
|
2011-07-06 23:28:36 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function display_level( ) {
|
|
|
|
update_infos( );
|
2011-07-14 10:24:58 +02:00
|
|
|
full_display_on_canvas( DOM_infos.container + " #starboard" );
|
2011-07-13 22:57:02 +02:00
|
|
|
}
|
2011-07-07 09:09:07 +02:00
|
|
|
|
2011-07-14 10:29:20 +02:00
|
|
|
function load_level( index ) {
|
2011-07-15 21:26:08 +02:00
|
|
|
return( { moving: cell.BALL,
|
|
|
|
distance_travelled: 0,
|
|
|
|
level: index,
|
|
|
|
board: assets.levels[ index ],
|
|
|
|
it_s_over: false } );
|
2011-07-13 22:57:02 +02:00
|
|
|
}
|
2011-07-04 16:51:03 +02:00
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
function make_a_move( where ) {
|
2011-07-13 22:57:02 +02:00
|
|
|
var motion = [ 0, 0 ];
|
2011-07-14 09:58:21 +02:00
|
|
|
var item_coord = get_pos( state.moving );
|
2011-07-04 16:11:42 +02:00
|
|
|
|
2011-07-13 22:57:02 +02:00
|
|
|
/* Setup the motion vector according to direction.*/
|
|
|
|
switch( where ) {
|
|
|
|
case direction.UP:
|
|
|
|
motion[ 1 ]--;
|
|
|
|
break;
|
|
|
|
case direction.DOWN:
|
|
|
|
motion[ 1 ]++;
|
|
|
|
break;
|
|
|
|
case direction.LEFT:
|
|
|
|
motion[ 0 ]--;
|
|
|
|
break;
|
|
|
|
case direction.RIGHT:
|
|
|
|
motion[ 0 ]++;
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
2011-07-04 17:19:39 +02:00
|
|
|
|
2011-07-13 22:57:02 +02:00
|
|
|
/* Calculating arrival coordinates */
|
|
|
|
while ( /* Hairy conditions ahead */
|
|
|
|
/* target cell is within level's boundaries */
|
2011-07-14 10:24:58 +02:00
|
|
|
( ( item_coord[ 0 ] + motion[ 0 ] >= 0 ) && ( item_coord[ 0 ] + motion[ 0 ] < level_infos.width ) ) &&
|
|
|
|
( ( item_coord[ 1 ] + motion[ 1 ] >= 0 ) && ( item_coord[ 1 ] + motion[ 1 ] < level_infos.height ) ) &&
|
2011-07-13 22:57:02 +02:00
|
|
|
/* and target cell is empty */
|
2011-07-15 12:23:33 +02:00
|
|
|
( get_cell( item_coord[ 0 ] + motion[ 0 ], item_coord[ 1 ] + motion[ 1 ] ) == cell.EMPTY )
|
2011-07-13 22:57:02 +02:00
|
|
|
/* or, the ball will eat gifts so we can move it on one */
|
2011-07-14 09:58:21 +02:00
|
|
|
|| ( state.moving == cell.BALL && ( get_cell( item_coord[ 0 ] + motion[ 0 ], item_coord[ 1 ] + motion[ 1 ] ) == cell.GIFT ) )
|
2011-07-13 22:57:02 +02:00
|
|
|
)
|
|
|
|
{
|
2011-07-15 12:28:25 +02:00
|
|
|
state = set_cell( item_coord[ 0 ], item_coord[ 1 ], cell.EMPTY ); /* empty the origin cell */
|
2011-07-15 12:23:33 +02:00
|
|
|
draw_cell( assets.sprites.empty, item_coord[ 0 ], item_coord[ 1 ] );
|
2011-07-13 22:57:02 +02:00
|
|
|
|
|
|
|
item_coord[ 0 ] += motion[ 0 ]; /* move coordinate */
|
|
|
|
item_coord[ 1 ] += motion[ 1 ]; /* to those of target cells */
|
|
|
|
|
2011-07-14 09:58:21 +02:00
|
|
|
state = set_cell( item_coord[ 0 ], item_coord[ 1 ], state.moving ); /* move actor into target cell */
|
2011-07-14 10:47:17 +02:00
|
|
|
draw_cell( ( state.moving == cell.BALL ) ? assets.sprites.ball_selected : assets.sprites.cube_selected, item_coord[ 0 ], item_coord[ 1 ] );
|
2011-07-04 17:19:39 +02:00
|
|
|
|
2011-07-13 22:57:02 +02:00
|
|
|
state.distance_travelled++; /* increment distance_travelled */
|
|
|
|
}
|
2011-07-14 09:58:21 +02:00
|
|
|
update_infos( );
|
2011-07-13 22:57:02 +02:00
|
|
|
return state;
|
|
|
|
}
|
2011-07-04 16:40:15 +02:00
|
|
|
|
2011-07-14 12:47:10 +02:00
|
|
|
function event_handler( e ) {
|
2011-07-14 12:57:51 +02:00
|
|
|
if ( !state.it_s_over ) {
|
|
|
|
if ( e.type === "click" ) {
|
|
|
|
var movingpos = get_pos( state.moving );
|
|
|
|
var notmovingpos = get_pos( ( state.moving != cell.BALL ) ? cell.BALL : cell.CUBE );
|
|
|
|
var click = { };
|
|
|
|
click.x = e.pageX - DOM_infos.canvas.offset.left;
|
|
|
|
click.y = e.pageY - DOM_infos.canvas.offset.top;
|
|
|
|
|
|
|
|
if ( ( 0 <= click.x && click.x < DOM_infos.canvas.width )
|
|
|
|
&& ( 0 <= click.y && click.y < DOM_infos.canvas.height ) ) {
|
|
|
|
// coordinates in cell indexes
|
|
|
|
click.x = Math.floor( click.x / level_infos.cell.width );
|
|
|
|
click.y = Math.floor( click.y / level_infos.cell.height );
|
|
|
|
|
|
|
|
// We're inside the board
|
|
|
|
if ( click.x == notmovingpos[0] && click.y == notmovingpos[1] ) {
|
|
|
|
state.moving = ( state.moving != cell.BALL ) ? cell.BALL : cell.CUBE;
|
|
|
|
} else if ( click.x == movingpos[0] ) {
|
|
|
|
if ( click.y > movingpos[1] ) {
|
|
|
|
state = make_a_move( direction.DOWN );
|
|
|
|
} else if ( click.y < movingpos[1] ) {
|
|
|
|
state = make_a_move( direction.UP );
|
|
|
|
}
|
|
|
|
} else if ( click.y == movingpos[1] ) {
|
|
|
|
if ( click.x > movingpos[0] ) {
|
|
|
|
state = make_a_move( direction.RIGHT );
|
|
|
|
} else {
|
|
|
|
state = make_a_move( direction.LEFT );
|
|
|
|
}
|
2011-07-12 19:05:21 +02:00
|
|
|
}
|
|
|
|
}
|
2011-07-14 12:57:51 +02:00
|
|
|
} else if ( e.type === "keydown" ) {
|
|
|
|
switch( e.keyCode ) {
|
|
|
|
case 37: // LEFT
|
2011-07-15 08:50:11 +02:00
|
|
|
case 38: // UP
|
2011-07-14 12:57:51 +02:00
|
|
|
case 39: // RIGHT
|
2011-07-15 08:50:11 +02:00
|
|
|
case 40: // DOWN
|
2011-07-15 08:48:30 +02:00
|
|
|
state = make_a_move( e.keyCode );
|
2011-07-14 12:57:51 +02:00
|
|
|
break;
|
|
|
|
case 32: // SPACE
|
|
|
|
state = switch_actor( );
|
|
|
|
break;
|
|
|
|
case 78: // n
|
|
|
|
if ( state.level < assets.levels.length - 1 ) {
|
|
|
|
state = load_level( state.level + 1 );
|
|
|
|
display_level( );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 80: // p
|
|
|
|
if ( state.level > 0 ) {
|
|
|
|
state = load_level( state.level - 1 );
|
|
|
|
display_level( );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 82: // r
|
|
|
|
state = load_level( state.level );
|
|
|
|
display_level( );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2011-07-14 12:47:10 +02:00
|
|
|
}
|
2011-07-14 12:57:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( won_or_not( ) ) {
|
2011-07-14 12:47:10 +02:00
|
|
|
if ( state.level < assets.levels.length - 1 ) {
|
|
|
|
state = load_level( state.level + 1 );
|
2011-07-14 09:58:21 +02:00
|
|
|
display_level( );
|
2011-07-12 17:31:09 +02:00
|
|
|
}
|
2011-07-14 12:57:51 +02:00
|
|
|
else {
|
|
|
|
state.it_s_over = true;
|
|
|
|
alert( "You won!" );
|
2011-07-12 17:31:09 +02:00
|
|
|
}
|
2011-07-14 12:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 10:28:36 +02:00
|
|
|
////// MAIN (so to speak) //////
|
2011-07-15 20:57:55 +02:00
|
|
|
|
|
|
|
// First of all, setup our little DOM branch
|
|
|
|
var starhtml = '<div class="gstar">';
|
|
|
|
starhtml += '<aside id="help">' + format_help( ) + '</aside>';
|
|
|
|
starhtml += '<canvas id="starboard" width="320" height="180"></canvas>';
|
|
|
|
starhtml += '<aside id="infos"></aside>';
|
|
|
|
starhtml += '</div>';
|
|
|
|
jQuery( dom_container ).html( starhtml );
|
|
|
|
|
|
|
|
// Now we can collect some informations about this DOM branch we have
|
|
|
|
var DOM_infos = {
|
|
|
|
container: dom_container,
|
|
|
|
canvas: {
|
|
|
|
//jQuery() returns a jquery object, [0] to get the canvas itself
|
|
|
|
context: jQuery( dom_container + " #starboard" )[ 0 ].getContext( '2d' ),
|
|
|
|
offset: jQuery( dom_container + " #starboard" ).offset(),
|
|
|
|
width: jQuery( dom_container + " #starboard" ).width(),
|
|
|
|
height: jQuery( dom_container + " #starboard" ).height()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var level_infos = {
|
|
|
|
height: 9,
|
|
|
|
width: 16,
|
|
|
|
cell: {
|
|
|
|
width: DOM_infos.canvas.width / 16,
|
|
|
|
height: DOM_infos.canvas.height / 9
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-07-15 21:26:08 +02:00
|
|
|
var state = load_level( ( level_index === undefined ) ? 0 :
|
|
|
|
( level_index >= assets.levels.length ) ? assets.levels.length - 1 :
|
|
|
|
( level_index < 0 ) ? 0 : level_index );
|
2011-07-13 22:17:50 +02:00
|
|
|
|
2011-07-14 12:48:57 +02:00
|
|
|
// kinda ugly workaround around a mysterious bug causing the canvas
|
2011-07-13 22:17:50 +02:00
|
|
|
// not to refresh the first time (before any event)
|
2011-07-14 09:58:21 +02:00
|
|
|
setTimeout( function(){ display_level( ); }, 100 ); // 1/10 second
|
2011-07-15 21:26:08 +02:00
|
|
|
|
|
|
|
// Start main "loop"
|
|
|
|
jQuery(document).focus( );
|
|
|
|
jQuery(document).click( event_handler );
|
|
|
|
jQuery(document).keydown( event_handler );
|
2011-07-13 16:45:02 +02:00
|
|
|
}
|