X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.js;h=21a027af970748a4c54afdab1b561274b58d8e31;hp=c90d80e1365e337fb730ff4abed673d02d23c8c3;hb=1b98418fc7f31d2d10364a60bc798ee85ef7add1;hpb=f95833e6dec7e6ca04e96ec81527a90894904254;ds=inline diff --git a/phpfspot.js b/phpfspot.js index c90d80e..21a027a 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -1,7 +1,11 @@ -function showImage(id) +function showImage(id, scrollup) { - var image_div = document.getElementById("content"); - image_div.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=showphoto&id=' + id)); + HTML_AJAX.replace(document.getElementById("content"), encodeURI('rpc.php?action=showphoto&id=' + id)); + + /* scroll the window up to the top */ + if(scrollup != undefined) { + window.scrollTo(0,0); + } } function showCredits() @@ -12,24 +16,35 @@ function showCredits() function Tags(mode, id) { + var objTemp = new Object(); + if(mode == "add") { - // add the tag to users session - HTML_AJAX.grab(encodeURI('rpc.php?action=addtag&id=' + id)); + // add tag to users session + objTemp['action'] = 'addtag'; + objTemp['id'] = id; } else if(mode == "del") { - // del the tag from users session - HTML_AJAX.grab(encodeURI('rpc.php?action=deltag&id=' + id)); + // del tag from users session + objTemp['action'] = 'deltag'; + objTemp['id'] = id; } else if(mode == "condition") { setCheckedValue(id, id.value); - HTML_AJAX.grab(encodeURI('rpc.php?action=tagcondition&mode=' + id.value)); + objTemp['action'] = 'tagcondition'; + objTemp['mode'] = id.value; } - refreshAvailableTags(); - refreshSelectedTags(); - refreshPhotoIndex(); + var retr = HTML_AJAX.post('rpc.php', objTemp); + if(retr == "ok") { + refreshAvailableTags(); + refreshSelectedTags(); + refreshPhotoIndex(); + } + else { + window.alert(retr); + } -} +} // Tags() function refreshAvailableTags() { @@ -101,7 +116,6 @@ function startSearch() to_day = document.getElementById('today').value; to = to_year +"-"+ to_month +"-"+ to_day; - // Create object with values of the form var objTemp = new Object(); objTemp['action'] = 'search';