Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 XThreads Attachments Gallery with Javascript
Jumper Offline
Member
***
Posts: 75
Joined: Aug 2010
Post: #1
XThreads Attachments Gallery with Javascript
Hi,

with this modification you can embed a picture gallery incl. javascript looks like a slider-effect. so you can display as many pictures as you want in only one line Smile

example from a testboard: http://oxygen-vlight.com/intelligen/index.php

this mod is for all users which are using leefish´s XThreads Attachments Gallery

1. download gallery plugin from leefish´s homepage: http://www.leefish.nl/mybb/thread-1294.html
2. install and open the template (global templates) "fishhatt_gallery"
3. replace the original template with this template:

Code:
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<style type="text/css">

<!--
/* Gallery Styles */

#motioncontainer {

/*margin:0 auto;  Uncomment this line if you wish to center the gallery on page */

height: 170px; /* Set to gallery height */

}

#motioncontainer a img {

border: 3px solid #cccccc; /* Set image border color */

}

#motioncontainer a:hover img {

border: 3px solid navy; /* Set image border hover color */

}

#statusdiv {

background-color: lightgreen;

border: 1px solid gray;

padding: 2px;

position: absolute; /* Stop Editing Gallery Styles */

left: -300px;

visibility: hidden;

}

#motioncontainer a:hover {

color: red; /* Dummy definition to overcome IE bug */

}

/* End Gallery Styles */

-->

</style>

<!-- Do not edit IE conditional style below -->

<!--[if gte IE 5.5]>

<style type="text/css">

#motioncontainer {

width:expression(Math.min(this.offsetWidth, maxwidth)+'px');

}

</style>

<![endif]-->

<!-- End Conditional Style -->

<script type="text/javascript">

 //1) Set width of the "neutral" area in the center of the gallery.

var restarea=10;

 //2) Set top scroll speed in pixels. Script auto creates a range from 0 to top speed.

var maxspeed=15;

 //3) Set to maximum width for gallery - must be less than the actual length of the image train.

var maxwidth=10000

 //4) Set to 1 for left start, 0 for right, 2 for center.

var startpos=0;

 //5) Set message to show at end of gallery. Enter "" to disable message.

var endofgallerymsg='<<< new entries - move mouse - old entries >>>';



function enlargeimage(path, optWidth, optHeight){ //function to enlarge image. Change as desired.

var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width

var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height

var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"

window.open(path,"", winattributes)

}

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom=document.all||document.getElementById, scrollspeed=0, movestate='', actualwidth='', cross_scroll, ns_scroll, statusdiv, loadedyes=0, lefttime, righttime;

function ietruebody(){

return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;

}

function creatediv(){

statusdiv=document.createElement("div")

statusdiv.setAttribute("id","statusdiv")

document.body.appendChild(statusdiv)

statusdiv=document.getElementById("statusdiv")

statusdiv.innerHTML=endofgallerymsg

}

function positiondiv(){

var mainobjoffset=getposOffset(crossmain, "left"),

menuheight=parseInt(crossmain.offsetHeight),

mainobjoffsetH=getposOffset(crossmain, "top");

statusdiv.style.left=mainobjoffset+(menuwidth/2)-(statusdiv.offsetWidth/2)+"px";

statusdiv.style.top=menuheight+mainobjoffsetH+"px";

}

function showhidediv(what){

if (endofgallerymsg!="") {

positiondiv();

statusdiv.style.visibility=what;

}

}

function getposOffset(what, offsettype){

var totaloffset=(offsettype=="left")? what.offsetLeft: what.offsetTop;

var parentEl=what.offsetParent;

while (parentEl!=null){

totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;

parentEl=parentEl.offsetParent;

}

return totaloffset;

}

function moveleft(){

if (loadedyes){

movestate="left";

if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){

cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px";

showhidediv("hidden");

}

else

showhidediv("visible");

}

lefttime=setTimeout("moveleft()",10);

}

function moveright(){

if (loadedyes){

movestate="right";

if (iedom&&parseInt(cross_scroll.style.left)<0){

cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px";

showhidediv("hidden");

}

else

showhidediv("visible");

}

righttime=setTimeout("moveright()",10);

}

function motionengine(e){

var mainobjoffset=getposOffset(crossmain, "left"),

dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft,

dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop,

curposy=window.event? event.clientX : e.clientX? e.clientX: "";

curposy-=mainobjoffset-dsocx;

var leftbound=(menuwidth-restarea)/2;

var rightbound=(menuwidth+restarea)/2;

if (curposy>rightbound){

scrollspeed=(curposy-rightbound)/((menuwidth-restarea)/2) * maxspeed;

clearTimeout(righttime);

if (movestate!="left") moveleft();

}

else if (curposy<leftbound){

scrollspeed=(leftbound-curposy)/((menuwidth-restarea)/2) * maxspeed;

clearTimeout(lefttime);

if (movestate!="right") moveright();

}

else

scrollspeed=0;

}

function contains_ns6(a, b) {

if (b!==null)

while (b.parentNode)

if ((b = b.parentNode) == a)

return true;

return false;

}

function stopmotion(e){

if (!window.opera||(window.opera&&e.relatedTarget!==null))

if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){

clearTimeout(lefttime);

clearTimeout(righttime);

movestate="";

}

}

function fillup(){

if (iedom){

crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer;

if(typeof crossmain.style.maxWidth!=='undefined')

crossmain.style.maxWidth=maxwidth+'px';

menuwidth=crossmain.offsetWidth;

cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery;

actualwidth=document.getElementById? document.getElementById("trueContainer").offsetWidth : document.all['trueContainer'].offsetWidth;

if (startpos)

cross_scroll.style.left=(menuwidth-actualwidth)/startpos+'px';

crossmain.onmousemove=function(e){

motionengine(e);

}

crossmain.onmouseout=function(e){

stopmotion(e);

showhidediv("hidden");

}

}

loadedyes=1

if (endofgallerymsg!=""){

creatediv();

positiondiv();

}

if (document.body.filters)

onresize()

}

window.onload=fillup;

onresize=function(){

if (typeof motioncontainer!=='undefined'&&motioncontainer.filters){

motioncontainer.style.width="0";

motioncontainer.style.width="";

motioncontainer.style.width=Math.min(motioncontainer.offsetWidth, maxwidth)+'px';

}

menuwidth=crossmain.offsetWidth;

cross_scroll.style.left=startpos? (menuwidth-actualwidth)/startpos+'px' : 0;

}

</script>

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
	<tbody>
		<tr>
			<td class="thead">
				<div class="expcolimage">
					<img src="{$theme['imgdir']}/collapse{$collapsedimg['fishhattatgal']}.gif" id="fishhattatgal_img" class="expander" alt="[-]" title="" />
				</div>
				<div><strong>Kleine Auswahl der neuesten Einträge</strong></div>
			</td>
		</tr>
	</tbody>
	<tbody style="{$collapsed['fishhattatgal_e']}" id="fishhattatgal_e">
		<tr>
			<td class="trow1" align="">
<div id="motioncontainer" style="position:relative;overflow:hidden;">

<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">
		<nobr id="trueContainer">		{$fishhatt_gallery_gallery}</div></div>
			</td>
		</tr>
	</tbody>
</table>
<br />


you can customize many settings in this code. each point is explained in code.

and how many pictures you want to display can you change in the plugin settings (Number Of Attachments Thumbnails). so you can display 10 or 50 or 100 pictures or whatever you want in only one line. i hope this mod is useful for some user. Wink

and big thx to leefish for his very good plugin Yes

(This post was last modified: 03-02-2012 01:29 AM by Jumper.)
03-02-2012 01:26 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
XThreads Attachments Gallery with Javascript - Jumper - 03-02-2012 01:26 AM

 Standard Tools
Forum Jump: