Permalink
Browse files

basic keyboard hooks for putting cwf in to auto mode

  • Loading branch information...
1 parent e021bff commit b7c8bbd7f155e245bf83adc77f95631ad6823165 @thisisaaronland thisisaaronland committed Jun 17, 2012
Showing with 38 additions and 7 deletions.
  1. +30 −0 www/javascript/cwf.js
  2. +8 −7 www/javascript/cwf.min.js
View
@@ -137,6 +137,21 @@ function cwf_init_layout(){
function cwf_init_shortcuts(){
+ var auto = false;
+ var auto_timeout = null;
+
+ var automatic = function(delay){
+
+ if (! delay){
+ delay = 20000;
+ }
+
+ auto_timeout = setTimeout(function(){
+ cwf_show_next_photo("overflow");
+ automatic();
+ }, delay);
+ };
+
var left = function(){
cwf_show_previous_photo("overflow");
};
@@ -172,6 +187,21 @@ function cwf_init_shortcuts(){
down();
}
+ /* to do: notifications */
+ /* to do: automode on shake */
+
+ else if (e.keyCode == 65){
+ auto = (auto) ? 0 : 1;
+
+ if (auto){
+ automatic(1000);
+ }
+
+ else {
+ clearTimeout(auto_timeout);
+ }
+ }
+
else if (e.keyCode == 80){
cwf_toggle_pixel_mode(e.shiftKey);
}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit b7c8bbd

Please sign in to comment.