-
Notifications
You must be signed in to change notification settings - Fork 157
/
thumb.html
93 lines (78 loc) · 2.88 KB
/
thumb.html
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
<!--#
@version 0.1 (auto-set)
#-->
[#if SRC!=""#]
[#if ENLARGE!="1"#]
<img src="<#ROOTHTML#>modules/thumb/thumb.php?img=[#SRC#]&w=[#WIDTH#]&h=[#HEIGHT#]&url=[#URL#]&live=[#LIVE#]&username=[#USERNAME#]&password=[#PASSWORD#]&transport=[#TRANSPORT#]" id="imgelem[#UNIQ#]">
[#else#]
<script type="text/javascript">
function enlarge[#UNIQ#]() {
[#if REAL_WIDTH!="" && REAL_HEIGHT!=""#]
wdth=[#REAL_WIDTH#];
hgth=[#REAL_HEIGHT#];
[#else#]
wdth=400;
hgth=400;
[#endif#]
[#if CLOSE!=""#]hgth+=20;[#endif#]
LeftPosition=(screen.width)?(screen.width-wdth)/2:100;
TopPosition=(screen.height)?(screen.height-hgth)/2:100;
settings='width='+ wdth + ',height='+ hgth + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes,dependent=no';
wnd=window.open("<#ROOTHTML#>modules/thumb/enlarge.php?img=[#SRC_REAL#]&color=[#COLOR#]&close=[#CLOSE#]&bgcolor=[#BGCOLOR#]", "img[#UNIQ#]", settings);
}
</script>
<a href="#" onClick="enlarge[#UNIQ#]();return false;"><img src="<#ROOTHTML#>modules/thumb/thumb.php?img=[#SRC#]&w=[#WIDTH#]&h=[#HEIGHT#]&url=[#URL#]&username=[#USERNAME#]&password=[#PASSWORD#]&live=[#LIVE#]&transport=[#TRANSPORT#]" id="imgelem[#UNIQ#]" border=0></a>
[#endif#]
[#if SLIDESHOW="1"#]
<script type="text/javascript">
var imageOrig[#UNIQ#] = document.getElementById("imgelem[#UNIQ#]");
var imageOrig[#UNIQ#]URL = imageOrig[#UNIQ#].src;
var imgNew[#UNIQ#] = new Image();
function checkImageOnScreen[#UNIQ#]() {
var elem=$('#imgelem[#UNIQ#]');
var height = elem.outerHeight();
var width = elem.outerWidth();
if(!width || !height){
return false;
}
var win = $(window);
var viewport = {
top : win.scrollTop(),
left : win.scrollLeft()
};
viewport.right = viewport.left + win.width();
viewport.bottom = viewport.top + win.height();
var bounds = elem.offset();
bounds.right = bounds.left + width;
bounds.bottom = bounds.top + height;
var showing = {
top : viewport.bottom - bounds.top,
left: viewport.right - bounds.left,
bottom: bounds.bottom - viewport.top,
right: bounds.right - viewport.left
};
return showing.top > 0
&& showing.left > 0
&& showing.right > 0
&& showing.bottom > 0;
}
function reloadSlideShowImage[#UNIQ#]() {
if (checkImageOnScreen[#UNIQ#]()) {
//console.log('loading image');
imageOrig[#UNIQ#].src=imgNew[#UNIQ#].src;
var srcURL=imageOrig[#UNIQ#]URL+ "&" + new Date().getTime();
imgNew[#UNIQ#].src = srcURL;
} else {
//console.log('skipping load');
setTimeout('reloadSlideShowImage[#UNIQ#]();',1000);
}
}
imgNew[#UNIQ#].onload = function () {
reloadSlideShowImage[#UNIQ#]();
}
imgNew[#UNIQ#].src = imageOrig[#UNIQ#]URL;
</script>
[#endif#]
[#else SRC#]
image not found ([#REQUESTED#])
[#endif SRC#]