]>
git.defcon.no Git - plsgen/blob - nav.js
7 function key_handler ( e
)
9 var key
= (window
.event
) ? event
.keyCode
: e
.keyCode
;
10 if ( (key
== 37) && (prev
!= null) )
12 window
.location
= prev
+ '.html';
14 if ( (key
== 39) && (next
!= null) )
16 window
.location
= next
+ '.html';
18 if (key
== 27) window
.location
= "index.html";
19 if ( (key
== 38) && (index
!= null) ) window
.location
= index
;
22 function img_preload ( image
)
24 var image_thumb
= new Image();
25 image_thumb
.src
= 'thumb/' + image
;
26 preloaded
.push(image_thumb
);
28 var image_view
= new Image();
29 image_view
.src
= 'view/' + image
;
30 preloaded
.push(image_view
);
33 function nav_set_target ( target
, direction
)
37 if ( direction
== 0 ) prev
= target
;
38 if ( direction
== 1 ) next
= target
;
39 var img_regx
= /.*\.(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF)$/;
40 if ( target
.match( img_regx
) )
41 img_preload( target
);
45 function nav_reg_prev ( target
)
46 { nav_set_target(target
, 0); }
48 function nav_reg_next ( target
)
49 { nav_set_target(target
, 1); }
51 function nav_reg_index( target
)
54 function nav_reg_onkeypress()
55 { document
.onkeyup
= key_handler
; }