summaryrefslogtreecommitdiffstats
path: root/phpfspot.js
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-05-04 11:04:20 +0200
committerAndreas Unterkircher <unki@netshadow.at>2008-05-04 21:52:40 +0200
commit8a050d435329e91cf33fc12f56c82b7a4b479d0a (patch)
tree9facae1cddfcd9395759ed2cbd1d49fb95411013 /phpfspot.js
parent867cf65e5ec98f5be8529a584329385814543e4d (diff)
set everywhere the correct path to scripts, stylesheets, images, ...
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
Diffstat (limited to 'phpfspot.js')
-rw-r--r--phpfspot.js70
1 files changed, 43 insertions, 27 deletions
diff --git a/phpfspot.js b/phpfspot.js
index 47ebe32..7dfdcc8 100644
--- a/phpfspot.js
+++ b/phpfspot.js
@@ -42,7 +42,7 @@ function showImage(id, scrollup)
}
/* fetch single-photo view from server */
- HTML_AJAX.replace(content, encodeURI('rpc.php?action=showphoto&id=' + id));
+ HTML_AJAX.replace(content, encodeURI(web_path + '/rpc.php?action=showphoto&id=' + id));
/* scroll the window up to the top */
if(scrollup != undefined) {
@@ -101,7 +101,7 @@ function findPos(obj, direction) {
function showCredits()
{
var credits = document.getElementById("content");
- credits.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=showcredits'));
+ credits.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=showcredits'));
} // showCredits()
@@ -136,7 +136,7 @@ function Tags(mode, id)
objTemp['mode'] = id.value;
}
- var retr = HTML_AJAX.post('rpc.php', objTemp);
+ var retr = HTML_AJAX.post(web_path + '/rpc.php', objTemp);
if(retr == "ok") {
refreshAvailableTags();
refreshSelectedTags();
@@ -159,8 +159,10 @@ function refreshAvailableTags()
{
// update available tags
var avail_tags = document.getElementById('available_tags');
- avail_tags.innerHTML = "Loading...";
- avail_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_available_tags'));
+ if(avail_tags != undefined) {
+ avail_tags.innerHTML = "Loading...";
+ avail_tags.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=show_available_tags'));
+ }
} // refreshAvailableTags()
@@ -174,8 +176,10 @@ function refreshSelectedTags()
{
// update selected tags
var selected_tags = document.getElementById("selected_tags");
- selected_tags.innerHTML = "Loading...";
- selected_tags.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=show_selected_tags'));
+ if(selected_tags != undefined) {
+ selected_tags.innerHTML = "Loading...";
+ selected_tags.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=show_selected_tags'));
+ }
} // refreshSelectedTags()
@@ -188,7 +192,7 @@ function refreshSelectedTags()
*/
function showPhotoIndex(begin_with, last_photo)
{
- var url = "rpc.php?action=show_photo_index";
+ var url = web_path + "/rpc.php?action=show_photo_index";
if(begin_with != undefined)
url = url + '&begin_with=' + begin_with;
if(last_photo != undefined)
@@ -284,7 +288,7 @@ function startSearch()
objTemp['to'] = to;
}
- var retr = HTML_AJAX.post('rpc.php', objTemp);
+ var retr = HTML_AJAX.post(web_path + '/rpc.php', objTemp);
if(retr == "ok") {
refreshAvailableTags();
refreshSelectedTags();
@@ -329,7 +333,7 @@ function setViewMode(mode)
{
var exprt = document.getElementById('output');
exprt.innerHTML = "Loading...";
- exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode));
+ exprt.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_export&mode=' + mode));
} // setViewMode()
@@ -354,7 +358,8 @@ function clearSearch()
*/
function AskServerWhatToDo()
{
- return HTML_AJAX.grab(encodeURI('rpc.php?action=what_to_do'));
+ return HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=what_to_do'));
+
} // AskServerWhatToDo()
/**
@@ -364,9 +369,19 @@ function AskServerWhatToDo()
* the first time. It will fetch the tag-lists and will then
* switch to the right view, which the browser got told from
* the server (maybe someone hit the refresh button...).
+ *
+ * as parameter the server can set the correct webpath.
+ * espacialley when using user-friendly url's, the browser
+ * does not know the correct URLs to address images, stylesheets,
+ * ... then.
*/
-function init_phpfspot(mode)
+function init_phpfspot(srv_webpath)
{
+ if(srv_webpath != undefined)
+ web_path = srv_webpath;
+ else
+ web_path = '';
+
/* always load list of available tags */
refreshAvailableTags();
@@ -415,7 +430,7 @@ function setBackGrdColor(item, color)
*/
function getPhotoToShow()
{
- var photo_to_show = HTML_AJAX.grab(encodeURI('rpc.php?action=get_photo_to_show'));
+ var photo_to_show = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_photo_to_show'));
// if no image needs to be shown, return false from here
if(photo_to_show == "")
@@ -525,7 +540,7 @@ function showCalendar(date_box, click_obj)
if(calendar.style.visibility == "" || calendar.style.visibility == 'hidden') {
calendar.style.visibility = 'visible';
calendar.innerHTML = "Loading...";
- calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year=' + year + '&month=' + month));
+ calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path +'/rpc.php?action=get_calendar_matrix&year=' + year + '&month=' + month));
calendar_shown = 1;
}
else {
@@ -553,7 +568,7 @@ function setMonth(year, month, day)
{
var calendar = document.getElementById('calendar');
calendar.innerHTML = "Loading...";
- calendar.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));
+ calendar.innerHTML = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_calendar_matrix&year='+ year +'&month='+ month +'&day='+ day));
}
/**
@@ -574,7 +589,7 @@ function setCalendarDate(year, month, day)
*/
function resetAll()
{
- HTML_AJAX.grab(encodeURI('rpc.php?action=reset'));
+ HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=reset'));
clearSearch();
refreshAvailableTags();
refreshSelectedTags();
@@ -652,15 +667,15 @@ function noop() {}
function startSlideShow()
{
if(!sliding) {
- HTML_AJAX.grab(encodeURI('rpc.php?action=reset_slideshow'));
+ HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=reset_slideshow'));
nextSlide();
sliding = setInterval("nextSlide()", sliding_time*1000);
- document.getElementById('stop_ico').src = "resources/32_stop.png";
+ document.getElementById('stop_ico').src = web_path + "/resources/32_stop.png";
}
else {
clearInterval(sliding);
sliding = 0;
- document.getElementById('stop_ico').src = "resources/32_play.png";
+ document.getElementById('stop_ico').src = web_path + "/resources/32_play.png";
}
} // startSlideShow()
@@ -670,7 +685,7 @@ function startSlideShow()
*/
function nextSlide()
{
- var next_img = HTML_AJAX.grab(encodeURI('rpc.php?action=get_next_slideshow_img'));
+ var next_img = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_next_slideshow_img'));
document.getElementById('slide_img').src = next_img;
} // nextSlide()
@@ -680,7 +695,7 @@ function nextSlide()
*/
function prevSlide()
{
- var prev_img = HTML_AJAX.grab(encodeURI('rpc.php?action=get_prev_slideshow_img'));
+ var prev_img = HTML_AJAX.grab(encodeURI(web_path + '/rpc.php?action=get_prev_slideshow_img'));
document.getElementById('slide_img').src = prev_img;
} // prevSlide()
@@ -693,12 +708,12 @@ function pauseSlideShow()
if(!sliding_paused) {
sliding_paused = 1;
clearInterval(sliding);
- document.getElementById('pause_ico').src = "resources/32_play.png";
+ document.getElementById('pause_ico').src = web_path + "/resources/32_play.png";
}
else {
sliding_paused = 0;
sliding = setInterval("nextSlide()", sliding_time*1000);
- document.getElementById('pause_ico').src = "resources/32_pause.png";
+ document.getElementById('pause_ico').src = web_path + "/resources/32_pause.png";
}
} // pauseSlideShow()
@@ -715,7 +730,7 @@ function startAutoBrowse()
else {
clearInterval(autobrowse);
autobrowse = 0;
- document.getElementById('autobrowse_ico').src = "resources/32_play.png";
+ document.getElementById('autobrowse_ico').src = web_path + "/resources/32_play.png";
}
} // startAutoBrowser()
@@ -728,12 +743,12 @@ function autoBrowse()
if(document.getElementById('next_link')) {
var next_link = document.getElementById('next_link').href;
window.location.href = next_link;
- document.getElementById('autobrowse_ico').src = "resources/32_pause.png";
+ document.getElementById('autobrowse_ico').src = web_path + "/resources/32_pause.png";
}
/* we have reached the last photo */
else {
if(ab_ico = document.getElementById('autobrowse_ico'))
- ab_ico.src = "resources/32_play.png";
+ ab_ico.src = web_path + "/resources/32_play.png";
clearInterval(autobrowse);
}
@@ -774,7 +789,7 @@ function update_sort_order(obj)
var objTemp = new Object();
objTemp['value'] = obj.options[obj.selectedIndex].value;
- var retr = HTML_AJAX.post('rpc.php?action=update_sort_order', objTemp);
+ var retr = HTML_AJAX.post(web_path + '/rpc.php?action=update_sort_order', objTemp);
if(retr == "ok") {
showPhotoIndex();
@@ -843,3 +858,4 @@ var origHeight;
var origWidth;
// position of the last shown photo in photo-index
var photo_details_pos;
+var web_path;