galleryThumbs.js
3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Daten zu einem einzelnen Teaser
function c_GalleryThumb (thu, cat, tit, tex, u)
{
var thumb = thu;
var cat = cat;
var title = tit;
var text = tex;
var url = u;
this.getThumb = function () { return thumb; }
this.getCat = function () { return cat; }
this.getTitle = function () { return title; }
this.getText = function () { return text; }
this.getUrl = function () { return url; }
}
// Container fuer alle Teaser wird via ajax ueber den picToolService
// gefuellt.
function c_GalleryThumbs (_id, pos, _count)
{
var thumbs = new Array ();
var startIdx = pos;
var id = _id;
var count = _count;
// Dies kann warscheinlich auch raus aus c_GalleryThumbs
this.popup = function (i)
{
url = document.getElementById (id+'_BG_URL1_'+i).href;
if (url.match (/javascript:ftvlaunch\(/))
{
expr = /\(([0-9]+),\s*([0-9]+),\s*'(.+)'\)/;
expr.exec (url);
ftvlaunch (RegExp.$1, RegExp.$2, RegExp.$3);
return false;
}
return popup (document.getElementById (id+'_BG_URL1_'+i).href);
}
// -----
function changeDisplay (client)
{
for (i = 0; i < count; i++)
{
idx = i + startIdx;
if (idx > (thumbs.length - 1))
idx -= thumbs.length;
thumb = thumbs[idx].getThumb ();
cat = thumbs[idx].getCat ();
title = thumbs[idx].getTitle ();
text = thumbs[idx].getText ();
url = thumbs[idx].getUrl ();
document.getElementById (id+'_BG_THUMB'+i).src = thumb;
node = document.getElementById (id+'_BG_CAT'+i);
node.firstChild.data = cat;
node = document.getElementById (id+'_BG_TITLE'+i);
node.firstChild.data = title;
node = document.getElementById (id+'_BG_TEXT'+i);
node.firstChild.data = text;
document.getElementById (id+'_BG_URL1_'+i).href =
url + '?em_client=' + client;
document.getElementById (id+'_BG_URL2_'+i).href =
url + '?em_client=' + client;
}
}
this.incGallery = function (client)
{
startIdx = (startIdx == (thumbs.length - count)) ?
thumbs.length - count : startIdx + 1;
changeDisplay (client);
if (thumbs.length - (startIdx + count) === 4)
{
nBildertool.callback = this.callback;
var url = 'http://georgs_test/_module/bildertool/' +
'fakeFotoService.php?' +
'action=latest&cnt=3&limit=10&lfrom=' + thumbs.length +
'&omit=3,7';
nBildertool.service (url);
}
return false;
}
this.decGallery = function (client)
{
startIdx = (startIdx == 0) ? 0 : startIdx - 1;
changeDisplay (client);
return false;
}
this.callback = function ()
{
switch (nBildertool.req.readyState)
{
case 4:
if (nBildertool.req.status != 200)
alert ("Fehler:" + nBildertool.req.status);
else
{
var data = nBildertool.deXmlify (nBildertool.req.responseXML);
for (d in data['data'])
{
var expr = /(.*) [^ ]*$/;
thumbs.push (
new c_GalleryThumb (
data['data'][d].getThumbUrl (),
data['data'][d].getOrdnerName (0).toUpperCase (),
data['data'][d].titel,
data['data'][d].ffBildzeile+
' '.substr (0, 100).replace (expr, '$1...'),
data['data'][d].getShowUrl ()));
}
}
return true;
default:
return false;
}
}
nBildertool.callback = this.callback;
var url = 'http://georgs_test/_module/bildertool/fakeFotoService.php?' +
'action=latest&cnt=3&limit=' + (startIdx+count+5) + '&lfrom=0' +
'&omit=3,7';
nBildertool.service (url);
}