issue59, fixed position of photo-index navigation after removing html tables
[phpfspot.git] / phpfspot.js
index b196a68f846dbe3222b3309ac46f4066735daedb..4bd321f4ebc782037ec434fc2bf6e4ad1c662182 100644 (file)
@@ -58,7 +58,7 @@ function showPhotoIndex(begin_with)
 // if photo index is currently shown, refresh it
 function refreshPhotoIndex()
 {
-   if(document.getElementById("matrix") != undefined || startup == 1) {
+   if(document.getElementById("index") != undefined || startup == 1) {
       showPhotoIndex();
       startup = 0;
    }
@@ -160,10 +160,12 @@ function AskServerWhatToDo()
    return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
 }
 
-function init_phpfspot()
+function init_phpfspot(mode)
 {
+   /* always load list of available tags */
    refreshAvailableTags();
 
+   /* ask the server what we are currently displaying */
    whattodo = AskServerWhatToDo();
 
    if(whattodo == 'showpi' || whattodo == 'showpi_date') {
@@ -179,7 +181,7 @@ function init_phpfspot()
          refreshSelectedTags();
       }
    }
-}
+} // init_phpfspot()
 
 function setBackGrdColor(item, color)
 {
@@ -416,6 +418,38 @@ function update_sort_order(obj)
 } // update_sort_order()
 
 
+function keyDown(e) {
+   var evt = (e) ? e:(window.event) ? window.event:null;
+
+   if(evt) {
+      var key = (evt.charCode) ? evt.charCode :
+         ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
+
+
+      if(key == 37) /* left curosr */ {
+         if(document.getElementById('prev_link')) {
+            var prev_link = document.getElementById('prev_link').href;
+            window.location.href = prev_link;
+         }
+         return;
+      }
+      if(key == 38) /* up cursor */ {
+      }
+      if(key == 39) /* right curosr */ {
+         if(document.getElementById('next_link')) {
+            var next_link = document.getElementById('next_link').href;
+            window.location.href = next_link;
+         }
+         return;
+      }
+   }
+}
+
+document.onkeydown=keyDown;
+if(document.layers) {
+   document.captureEvents(Event.KEYDOWN);
+}
+
 var startup = 1;
 var calendar_shown = 0;
 var calendar_mode = '';