X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=4bd321f4ebc782037ec434fc2bf6e4ad1c662182;hp=b196a68f846dbe3222b3309ac46f4066735daedb;hb=d0ba69737f67bd7beb7f2050082b5e043375749c;hpb=5bc350814a9426a89e8ab06728badad9430d4015 diff --git a/phpfspot.js b/phpfspot.js index b196a68..4bd321f 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -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 = '';