orange-flickr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +27 -0
- data/Rakefile +46 -0
- data/lib/orange-flickr.rb +4 -0
- data/lib/orange-flickr/assets/js/yoxview/data/flickr.js +270 -0
- data/lib/orange-flickr/assets/js/yoxview/data/flickr.min.js +19 -0
- data/lib/orange-flickr/assets/js/yoxview/images/empty.gif +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/help_panel.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/left.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/left_eng.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/left_prev.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/popup_ajax_loader.gif +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/right.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/right_eng.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/sprites.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/install.htm +116 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.jsonp-1.0.4.min.js +12 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.timers-1.2.min.js +11 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxthumbs.js +207 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxthumbs.min.js +11 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxview-1.98.js +1673 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxview-1.98.min.js +38 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ar.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/bg.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ca.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/cs.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/de.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/en.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/es.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/fr.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/gr.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/he.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ie.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ir.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/it.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ja.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/mk.js +20 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/nl.js +3 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/pl.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/pt-br.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/pt.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ro.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ru.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/sk.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/sl.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/sv.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/tr.js +22 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ua.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/zh-cn.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/zh-tw.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/yox.js +179 -0
- data/lib/orange-flickr/assets/js/yoxview/yox.min.js +1 -0
- data/lib/orange-flickr/assets/js/yoxview/yoxview-init.js +47 -0
- data/lib/orange-flickr/assets/js/yoxview/yoxview-nojquery.js +5 -0
- data/lib/orange-flickr/assets/js/yoxview/yoxview.css +218 -0
- data/lib/orange-flickr/plugin.rb +14 -0
- data/lib/orange-flickr/resources/flickr_resource.rb +31 -0
- data/lib/orange-flickr/views/flickr/gallery.haml +4 -0
- data/lib/orange-flickr/views/flickr/photoset.haml +5 -0
- data/spec/orange-flickr_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +164 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
// jquery.jsonp 1.0.4 (c) 2009 Julian Aubourg | MIT License
|
2
|
+
// http://code.google.com/p/jquery-jsonp/
|
3
|
+
(function($){var x=function(o){return o!==undefined&&o!==null;},H=$("head"),Z={},K={callback:"C",url:location.href};$.jsonp=function(d){d=$.extend({},K,d);if(x(d.beforeSend)){var t=0;d.abort=function(){t=1;};if(d.beforeSend(d,d)===false||t)return d;}
|
4
|
+
var _="",y="success",n="error",u=x(d.url)?d.url:_,p=x(d.data)?d.data:_,s=(typeof p)=="string",k=function(f){setTimeout(f,1);},S,P,i,j,U;p=s?p:$.param(p);x(d.callbackParameter)&&(p+=(p==_?_:"&")+escape(d.callbackParameter)+"=?");!d.cache&&!d.pageCache&&(p+=[(p==_?_:"&"),"_xx",(new Date()).getTime(),"=",1].join(_));S=u.split("?");if(p!=_){P=p.split("?");j=S.length-1;j&&(S[j]+="&"+P.shift());S=S.concat(P);}
|
5
|
+
i=S.length-2;i&&(S[i]+=d.callback+S.pop());U=S.join("?");if(d.pageCache&&x(Z[U])){k(function(){if(x(Z[U].e)){x(d.error)&&d.error(d,n);x(d.complete)&&d.complete(d,n);}else{var v=Z[U].s;x(d.dataFilter)&&(v=d.dataFilter(v));x(d.success)&&d.success(v,y);x(d.complete)&&d.complete(d,y);}});return d;}
|
6
|
+
var f=$("<iframe />");H.append(f);var F=f[0],W=F.contentWindow||F.contentDocument,D=W.document;if(!x(D)){D=W;W=D.getParentNode();}
|
7
|
+
var w,e=function(_,m){d.pageCache&&!x(m)&&(Z[U]={e:1});w();m=x(m)?m:n;x(d.error)&&d.error(d,m);x(d.complete)&&d.complete(d,m);},t=0,C=d.callback,E=C=="E"?"X":"E";D.open();W[C]=function(v){t=1;d.pageCache&&(Z[U]={s:v});k(function(){w();x(d.dataFilter)&&(v=d.dataFilter(v));x(d.success)&&d.success(v,y);x(d.complete)&&d.complete(d,y);});};W[E]=function(s){(!s||s=="complete")&&!t++&&k(e);};w=function(){W[E]=undefined;W[C]=undefined;try{delete W[E];}catch(_){}
|
8
|
+
try{delete W[C];}catch(_){}
|
9
|
+
D.open()
|
10
|
+
D.write(_);D.close();f.remove();}
|
11
|
+
k(function(){D.write(['<html><head><script src="',U,'" onload="',E,'()" onreadystatechange="',E,'(this.readyState)"></script></head><body onload="',E,'()"></body></html>'].join(_));D.close();});d.timeout>0&&setTimeout(function(){!t&&e(_,"timeout");},d.timeout);d.abort=w;return d;}
|
12
|
+
$.jsonp.setup=function(o){$.extend(K,o);};})(jQuery);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery.timers - Timer abstractions for jQuery
|
3
|
+
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
|
4
|
+
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
|
5
|
+
* Date: 2009/10/16
|
6
|
+
*
|
7
|
+
* @author Blair Mitchelmore
|
8
|
+
* @version 1.2
|
9
|
+
*
|
10
|
+
**/
|
11
|
+
jQuery.fn.extend({everyTime:function(c,a,d,b){return this.each(function(){jQuery.timer.add(this,c,a,d,b)})},oneTime:function(c,a,d){return this.each(function(){jQuery.timer.add(this,c,a,d,1)})},stopTime:function(c,a){return this.each(function(){jQuery.timer.remove(this,c,a)})}}); jQuery.extend({timer:{global:[],guid:1,dataKey:"jQuery.timer",regex:/^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1E3,das:1E4,hs:1E5,ks:1E6},timeParse:function(c){if(c==undefined||c==null)return null;var a=this.regex.exec(jQuery.trim(c.toString()));return a[2]?parseFloat(a[1])*(this.powers[a[2]]||1):c},add:function(c,a,d,b,e){var g=0;if(jQuery.isFunction(d)){e||(e=b);b=d;d=a}a=jQuery.timer.timeParse(a);if(!(typeof a!="number"||isNaN(a)||a<0)){if(typeof e!="number"||isNaN(e)||e<0)e= 0;e=e||0;var f=jQuery.data(c,this.dataKey)||jQuery.data(c,this.dataKey,{});f[d]||(f[d]={});b.timerID=b.timerID||this.guid++;var h=function(){if(++g>e&&e!==0||b.call(c,g)===false)jQuery.timer.remove(c,d,b)};h.timerID=b.timerID;f[d][b.timerID]||(f[d][b.timerID]=window.setInterval(h,a));this.global.push(c)}},remove:function(c,a,d){var b=jQuery.data(c,this.dataKey),e;if(b){if(a){if(b[a]){if(d){if(d.timerID){window.clearInterval(b[a][d.timerID]);delete b[a][d.timerID]}}else for(d in b[a]){window.clearInterval(b[a][d]); delete b[a][d]}for(e in b[a])break;if(!e){e=null;delete b[a]}}}else for(a in b)this.remove(c,a,d);for(e in b)break;e||jQuery.removeData(c,this.dataKey)}}}});jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(c,a){jQuery.timer.remove(a)})});
|
@@ -0,0 +1,207 @@
|
|
1
|
+
/*!
|
2
|
+
* jquery.yoxthumbs v0.9
|
3
|
+
* jQuery thumbnails plugin
|
4
|
+
* http://yoxigen.com/
|
5
|
+
*
|
6
|
+
* Copyright (c) 2010 Yossi Kolesnicov
|
7
|
+
*
|
8
|
+
* Date: 13th July, 2010
|
9
|
+
* Version : 0.91
|
10
|
+
*/
|
11
|
+
(function($){
|
12
|
+
$.fn.yoxthumbs = function(opt) {
|
13
|
+
if (this.length == 0)
|
14
|
+
return this;
|
15
|
+
|
16
|
+
if (typeof(opt) != 'string')
|
17
|
+
{
|
18
|
+
var defaults = {
|
19
|
+
target: null, // an yoxview instance
|
20
|
+
selectedThumbnailClassName : "selected",
|
21
|
+
thumbsOpacityFadeTime: 300,
|
22
|
+
thumbsOpacity : undefined,
|
23
|
+
prevBtn: undefined,
|
24
|
+
nextBtn: undefined,
|
25
|
+
onClick: undefined,
|
26
|
+
images: undefined,
|
27
|
+
enableOnlyMedia: false // If set to true, YoxThumbs is enabled only for links whose HREF is to an image or other supported media.
|
28
|
+
};
|
29
|
+
|
30
|
+
var options = $.extend(defaults, opt);
|
31
|
+
var $this = $(this);
|
32
|
+
$this.data("yoxthumbs", new YoxThumbs($this, options));
|
33
|
+
return this;
|
34
|
+
}
|
35
|
+
else
|
36
|
+
{
|
37
|
+
var instance = $(this).data("yoxthumbs");
|
38
|
+
if (instance)
|
39
|
+
{
|
40
|
+
if ($.isFunction(instance[opt]))
|
41
|
+
instance[opt].apply(instance, Array.prototype.slice.call(arguments, 1));
|
42
|
+
else
|
43
|
+
return instance[opt];
|
44
|
+
}
|
45
|
+
return this;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
function YoxThumbs(container, options)
|
49
|
+
{
|
50
|
+
var self = this;
|
51
|
+
var prevBtn = options.prevBtn;
|
52
|
+
var nextBtn = options.nextBtn;
|
53
|
+
var viewIndex = container.data("yoxview") ? container.data("yoxview").viewIndex : undefined;
|
54
|
+
var $ = jQuery;
|
55
|
+
var containerIsAnchor = container[0].tagName == "A";
|
56
|
+
|
57
|
+
// If images data has been specified, create the thumbnails:
|
58
|
+
if (options.images)
|
59
|
+
{
|
60
|
+
jQuery.each(options.images, function(i, imageData){
|
61
|
+
container.append(createThumbnail(imageData));
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
this.thumbnails = [];
|
66
|
+
var foundThumbnails = containerIsAnchor ? container : container.find("a:has(img)");
|
67
|
+
var currentImageIndex = 0;
|
68
|
+
|
69
|
+
$.each(foundThumbnails, function(i, thumbnail)
|
70
|
+
{
|
71
|
+
var $thumbnail = $(thumbnail);
|
72
|
+
var addThumb = true;
|
73
|
+
if (options.enableOnlyMedia)
|
74
|
+
{
|
75
|
+
if (!thumbnail.href.match(Yox.imageRegex))
|
76
|
+
{
|
77
|
+
var isData = false;
|
78
|
+
for(dataProvider in Yox.dataRegex)
|
79
|
+
{
|
80
|
+
if (thumbnail.href.match(Yox.dataRegex[dataProvider]))
|
81
|
+
{
|
82
|
+
isData = true;
|
83
|
+
break;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
if (!isData)
|
87
|
+
{
|
88
|
+
var isVideo = false;
|
89
|
+
for(videoProvider in Yox.videoRegex)
|
90
|
+
{
|
91
|
+
if (thumbnail.href.match(Yox.videoRegex[videoProvider]))
|
92
|
+
{
|
93
|
+
isVideo = true;
|
94
|
+
break;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
if (!isVideo)
|
98
|
+
addThumb = false;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
if (addThumb)
|
104
|
+
{
|
105
|
+
$thumbnail.data("yoxthumbs", $.extend({imageIndex: currentImageIndex++}, $thumbnail.data("yoxthumbs")));
|
106
|
+
self.thumbnails.push($thumbnail);
|
107
|
+
}
|
108
|
+
});
|
109
|
+
|
110
|
+
if (options.thumbsOpacity)
|
111
|
+
{
|
112
|
+
this.thumbnails.css("opacity", options.thumbsOpacity);
|
113
|
+
container.delegate("a:has(img)", "mouseenter.yoxthumbs", function(e){
|
114
|
+
if (self.currentSelectedIndex === undefined ||
|
115
|
+
$(e.currentTarget).data("yoxthumbs").imageIndex != self.currentSelectedIndex){
|
116
|
+
$(e.currentTarget).stop().animate({opacity: 1}, options.thumbsOpacityFadeTime);
|
117
|
+
}
|
118
|
+
})
|
119
|
+
.delegate("a:has(img)", "mouseout.yoxthumbs", function(e){
|
120
|
+
if (self.currentSelectedIndex === undefined ||
|
121
|
+
$(e.currentTarget).data("yoxthumbs").imageIndex != self.currentSelectedIndex)
|
122
|
+
$(e.currentTarget).stop().animate({opacity: options.thumbsOpacity}, options.thumbsOpacityFadeTime);
|
123
|
+
});
|
124
|
+
}
|
125
|
+
if (options.onClick)
|
126
|
+
{
|
127
|
+
if (containerIsAnchor)
|
128
|
+
container.bind("click.yoxthumbs", function(e){
|
129
|
+
options.onClick(e);
|
130
|
+
return false;
|
131
|
+
});
|
132
|
+
else
|
133
|
+
container.delegate("a:has(img)", "click.yoxthumbs", function(e){
|
134
|
+
if (!$(e.currentTarget).data("yoxthumbs"))
|
135
|
+
return true;
|
136
|
+
|
137
|
+
options.onClick(e);
|
138
|
+
return false;
|
139
|
+
});
|
140
|
+
}
|
141
|
+
|
142
|
+
function createThumbnail(imageData, viewIndex)
|
143
|
+
{
|
144
|
+
var thumbnail = jQuery("<a>", {
|
145
|
+
href: imageData.link
|
146
|
+
});
|
147
|
+
|
148
|
+
var thumbImage = jQuery("<img>", {
|
149
|
+
src : imageData.thumbnailSrc,
|
150
|
+
alt : imageData.media.alt,
|
151
|
+
title : imageData.media.title
|
152
|
+
});
|
153
|
+
|
154
|
+
if (imageData.data)
|
155
|
+
thumbnail.data("yoxthumbs", imageData.data);
|
156
|
+
|
157
|
+
if (imageData.thumbnailDimensions)
|
158
|
+
thumbImage.css({
|
159
|
+
"width": imageData.thumbnailDimensions.width,
|
160
|
+
"height" : imageData.thumbnailDimensions.height
|
161
|
+
});
|
162
|
+
thumbImage.appendTo(thumbnail);
|
163
|
+
|
164
|
+
return thumbnail;
|
165
|
+
}
|
166
|
+
|
167
|
+
// Selects a thumbnail
|
168
|
+
this.select = function(thumbIndex)
|
169
|
+
{
|
170
|
+
if (this.currentSelectedIndex === undefined || this.currentSelectedIndex != thumbIndex)
|
171
|
+
{
|
172
|
+
var currentThumbnail = this.thumbnails.eq(thumbIndex);
|
173
|
+
var yoxslider = container.data("yoxslide");
|
174
|
+
if (yoxslider)
|
175
|
+
yoxslider.show(currentThumbnail);
|
176
|
+
|
177
|
+
// Remove selection from previous thumbnail:
|
178
|
+
if (this.currentSelectedIndex !== undefined)
|
179
|
+
{
|
180
|
+
var previousSelectedThumbnail = this.thumbnails.eq(this.currentSelectedIndex);
|
181
|
+
previousSelectedThumbnail.removeClass(options.selectedThumbnailClassName);
|
182
|
+
if (options.thumbsOpacity)
|
183
|
+
previousSelectedThumbnail.animate({opacity: options.thumbsOpacity}, options.thumbsOpacityFadeTime);
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
currentThumbnail.addClass(options.selectedThumbnailClassName);
|
188
|
+
if (options.thumbsOpacity)
|
189
|
+
currentThumbnail.animate({opacity: 1}, options.thumbsOpacityFadeTime);
|
190
|
+
|
191
|
+
this.currentSelectedIndex = thumbIndex;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
this.unload = function(dataKey)
|
195
|
+
{
|
196
|
+
$.each(this.thumbnails, function(i, thumbnail)
|
197
|
+
{
|
198
|
+
$(thumbnail).removeData("yoxthumbs");
|
199
|
+
if (dataKey)
|
200
|
+
$(thumbnail).removeData(dataKey);
|
201
|
+
});
|
202
|
+
container.undelegate("a:has(img)", "click.yoxthumbs");
|
203
|
+
if (containerIsAnchor)
|
204
|
+
container.unbind(".yoxthumbs");
|
205
|
+
}
|
206
|
+
}
|
207
|
+
})(jQuery);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*!
|
2
|
+
* jquery.yoxthumbs v0.9
|
3
|
+
* jQuery thumbnails plugin
|
4
|
+
* http://yoxigen.com/
|
5
|
+
*
|
6
|
+
* Copyright (c) 2010 Yossi Kolesnicov
|
7
|
+
*
|
8
|
+
* Date: 13th July, 2010
|
9
|
+
* Version : 0.91
|
10
|
+
*/
|
11
|
+
(function(g){function m(c,b){function j(a){var d=jQuery("<a>",{href:a.link}),e=jQuery("<img>",{src:a.thumbnailSrc,alt:a.media.alt,title:a.media.title});a.data&&d.data("yoxthumbs",a.data);a.thumbnailDimensions&&e.css({width:a.thumbnailDimensions.width,height:a.thumbnailDimensions.height});e.appendTo(d);return d}var h=this;c.data("yoxview")&&c.data("yoxview");var f=jQuery,k=c[0].tagName=="A";b.images&&jQuery.each(b.images,function(a,d){c.append(j(d))});this.thumbnails=[];var n=k?c:c.find("a:has(img)"), o=0;f.each(n,function(a,d){var e=f(d),l=true;if(b.enableOnlyMedia)if(!d.href.match(Yox.imageRegex)){var i=false;for(dataProvider in Yox.dataRegex)if(d.href.match(Yox.dataRegex[dataProvider])){i=true;break}if(!i){i=false;for(videoProvider in Yox.videoRegex)if(d.href.match(Yox.videoRegex[videoProvider])){i=true;break}i||(l=false)}}if(l){e.data("yoxthumbs",f.extend({imageIndex:o++},e.data("yoxthumbs")));h.thumbnails.push(e)}});if(b.thumbsOpacity){this.thumbnails.css("opacity",b.thumbsOpacity);c.delegate("a:has(img)", "mouseenter.yoxthumbs",function(a){if(h.currentSelectedIndex===undefined||f(a.currentTarget).data("yoxthumbs").imageIndex!=h.currentSelectedIndex)f(a.currentTarget).stop().animate({opacity:1},b.thumbsOpacityFadeTime)}).delegate("a:has(img)","mouseout.yoxthumbs",function(a){if(h.currentSelectedIndex===undefined||f(a.currentTarget).data("yoxthumbs").imageIndex!=h.currentSelectedIndex)f(a.currentTarget).stop().animate({opacity:b.thumbsOpacity},b.thumbsOpacityFadeTime)})}if(b.onClick)k?c.bind("click.yoxthumbs", function(a){b.onClick(a);return false}):c.delegate("a:has(img)","click.yoxthumbs",function(a){if(!f(a.currentTarget).data("yoxthumbs"))return true;b.onClick(a);return false});this.select=function(a){if(this.currentSelectedIndex===undefined||this.currentSelectedIndex!=a){var d=this.thumbnails.eq(a),e=c.data("yoxslide");e&&e.show(d);if(this.currentSelectedIndex!==undefined){e=this.thumbnails.eq(this.currentSelectedIndex);e.removeClass(b.selectedThumbnailClassName);b.thumbsOpacity&&e.animate({opacity:b.thumbsOpacity}, b.thumbsOpacityFadeTime)}d.addClass(b.selectedThumbnailClassName);b.thumbsOpacity&&d.animate({opacity:1},b.thumbsOpacityFadeTime);this.currentSelectedIndex=a}};this.unload=function(a){f.each(this.thumbnails,function(d,e){f(e).removeData("yoxthumbs");a&&f(e).removeData(a)});c.undelegate("a:has(img)","click.yoxthumbs");k&&c.unbind(".yoxthumbs")}}g.fn.yoxthumbs=function(c){if(this.length==0)return this;if(typeof c!="string"){var b=g.extend({target:null,selectedThumbnailClassName:"selected",thumbsOpacityFadeTime:300, thumbsOpacity:undefined,prevBtn:undefined,nextBtn:undefined,onClick:undefined,images:undefined,enableOnlyMedia:false},c),j=g(this);j.data("yoxthumbs",new m(j,b))}else if(b=g(this).data("yoxthumbs"))if(g.isFunction(b[c]))b[c].apply(b,Array.prototype.slice.call(arguments,1));else return b[c];return this}})(jQuery);
|
@@ -0,0 +1,1673 @@
|
|
1
|
+
/*!
|
2
|
+
* jquery.yoxview
|
3
|
+
* jQuery image gallery viewer
|
4
|
+
* http://yoxigen.com/yoxview
|
5
|
+
*
|
6
|
+
* Copyright (c) 2010 Yossi Kolesnicov
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license.
|
9
|
+
* http://www.opensource.org/licenses/mit-license.php
|
10
|
+
*
|
11
|
+
* Date: 28th July, 2010
|
12
|
+
* Version : 1.98
|
13
|
+
*/
|
14
|
+
|
15
|
+
var yoxviewApi;
|
16
|
+
|
17
|
+
(function($){
|
18
|
+
var yoxviewPath;
|
19
|
+
|
20
|
+
$.yoxviewUnload = function()
|
21
|
+
{
|
22
|
+
if (yoxviewApi)
|
23
|
+
{
|
24
|
+
yoxviewApi.unload();
|
25
|
+
yoxviewApi = null;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
$(window).unload(function(){
|
29
|
+
$.yoxviewUnload();
|
30
|
+
});
|
31
|
+
|
32
|
+
$.fn.extend({
|
33
|
+
yoxview: function(opt)
|
34
|
+
{
|
35
|
+
if (this.length == 0)
|
36
|
+
return this;
|
37
|
+
|
38
|
+
if (!yoxviewPath)
|
39
|
+
yoxviewPath = typeof(_yoxviewPath) != "undefined" ? _yoxviewPath : Yox.getPath(/(.*)jquery.yoxview.*/i);
|
40
|
+
|
41
|
+
// Load the language file if not already loaded:
|
42
|
+
this.loadLanguage = function(lang, callBack)
|
43
|
+
{
|
44
|
+
var self = this;
|
45
|
+
if (!yoxviewLanguages[lang])
|
46
|
+
{
|
47
|
+
yoxviewLanguages[lang] = {};
|
48
|
+
$.ajax({
|
49
|
+
url : yoxviewPath + "lang/" + lang + ".js",
|
50
|
+
async : false,
|
51
|
+
dataType : "json",
|
52
|
+
success: function(data){
|
53
|
+
yoxviewLanguages[lang] = data;
|
54
|
+
Yox.loadDataSource(options, callBack, self);
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
else
|
59
|
+
Yox.loadDataSource(options, callBack, self);
|
60
|
+
}
|
61
|
+
|
62
|
+
var defaults = {
|
63
|
+
autoHideInfo: true, // If false, the info bar (with image count and title) is always displayed.
|
64
|
+
autoPlay: false, // If true, slideshow mode starts when the popup opens
|
65
|
+
backgroundColor: "#000",
|
66
|
+
backgroundOpacity: 0.8,
|
67
|
+
buttonsFadeTime: 300, // The time, in milliseconds, it takes the buttons to fade in/out when hovered on. Set to 0 to force the Prev/Next buttons to remain visible.
|
68
|
+
cacheBuffer: 5, // The number of images to cache after the current image (directional, depends on the current viewing direction)
|
69
|
+
cacheImagesInBackground: true, // If true, full-size images are cached even while the gallery hasn't been opened yet.
|
70
|
+
controlsInitialFadeTime: 1500, // The time, in milliseconds, it takes the menu and prev/next buttons to fade in and out when the popup is opened.
|
71
|
+
controlsInitialDisplayTime: 1000, // The time, in milliseconds, to display the menu and prev/next buttons when the popup is opened. Set to 0 to not display them by default
|
72
|
+
dataFolder: yoxviewPath + "data/",
|
73
|
+
imagesFolder: yoxviewPath + "images/",
|
74
|
+
infoBackColor: "Black",
|
75
|
+
infoBackOpacity: 0.5,
|
76
|
+
isRTL : false, // Switch direction. For RTL languages such as Hebrew or Arabic, for example.
|
77
|
+
lang: "en", // The language for texts. The relevant language file should exist in the lang folder.
|
78
|
+
langFolder: yoxviewPath + "lang/",
|
79
|
+
loopPlay: true, // If true, slideshow play starts over after the last image
|
80
|
+
playDelay: 3000, // Time in milliseconds to display each image
|
81
|
+
popupMargin: 20, // the minimum margin between the popup and the window
|
82
|
+
popupResizeTime: 600, // The time in milliseconds it takes to make the resize transition from one image to the next.
|
83
|
+
renderButtons: true, // Set to false if you want to implement your own Next/Prev buttons, using the API.
|
84
|
+
renderMenu: true, // Set to false if you want to implement you own menu (Play/Help/Close).
|
85
|
+
showBarsOnOpen: true, // If true, displays the top (help) bar and bottom (info) bar momentarily when the popup opens.
|
86
|
+
showButtonsOnOpen: true, // If true, displays the Prev/Next buttons momentarily when the popup opens.
|
87
|
+
titleAttribute: "title",
|
88
|
+
titleDisplayDuration: 2000 // The time in ms to display the image's title, after which it fades out.
|
89
|
+
};
|
90
|
+
|
91
|
+
var options = $.extend(defaults, opt);
|
92
|
+
|
93
|
+
if (!yoxviewApi)
|
94
|
+
{
|
95
|
+
this.loadLanguage(options.lang, function(views){
|
96
|
+
yoxviewApi = new YoxView(views, options);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
else
|
100
|
+
{
|
101
|
+
this.loadLanguage(options.lang, function(views){
|
102
|
+
yoxviewApi.AddViews(views, options);
|
103
|
+
});
|
104
|
+
}
|
105
|
+
|
106
|
+
return this;
|
107
|
+
}
|
108
|
+
});
|
109
|
+
})(jQuery);
|
110
|
+
|
111
|
+
var yoxviewLanguages = new Array();
|
112
|
+
|
113
|
+
function YoxView(_views, _options)
|
114
|
+
{
|
115
|
+
var yoxviewApi = this;
|
116
|
+
var $ = jQuery; // Ensure the dollar sign stands for jQuery, in case other JS libraries are loaded, that use it.
|
117
|
+
|
118
|
+
var ajaxLoader;
|
119
|
+
var cacheBufferLastIndex;
|
120
|
+
var cacheComplete = false;
|
121
|
+
var cachedImagesCount = 0;
|
122
|
+
var cacheDirectionForward = true;
|
123
|
+
var cacheImg = new Image();
|
124
|
+
var countDisplay;
|
125
|
+
var ctlButtons; // next and prev buttons
|
126
|
+
var currentCacheImg = 0;
|
127
|
+
var currentItemIndex = 0;
|
128
|
+
var currentLanguage = {};
|
129
|
+
var currentViewIndex = 0;
|
130
|
+
var defaultOptions = _options;
|
131
|
+
var disableInfo = false;
|
132
|
+
var firstImage = true;
|
133
|
+
var helpPanel;
|
134
|
+
var hideInfoTimeout;
|
135
|
+
var hideMenuTimeout;
|
136
|
+
var image1;
|
137
|
+
var image2;
|
138
|
+
var images;
|
139
|
+
var imagesCount = 0;
|
140
|
+
var infoPanel;
|
141
|
+
var infoPanelContent;
|
142
|
+
var infoPanelLink;
|
143
|
+
var infoPanelMinHeight = 30;
|
144
|
+
var infoPanelWrap;
|
145
|
+
var infoPinLink;
|
146
|
+
var infoPinLinkImg;
|
147
|
+
var infoText;
|
148
|
+
this.isOpen = false;
|
149
|
+
var isPlaying = false;
|
150
|
+
var isResizing = false;
|
151
|
+
var itemVar;
|
152
|
+
var loading = false;
|
153
|
+
var mediaButtonsSize = {width: 100, height: 100};
|
154
|
+
var mediaLoader;
|
155
|
+
var mediaProviderUrls = {
|
156
|
+
vimeo: "http://vimeo.com/api/oembed.json",
|
157
|
+
myspace: "http://vids.myspace.com/index.cfm?fuseaction=oembed"
|
158
|
+
};
|
159
|
+
var menuHidePosition = -42;
|
160
|
+
var menuPanel;
|
161
|
+
var nextBtn;
|
162
|
+
var notifications = new Array();
|
163
|
+
var onOpenCallback;
|
164
|
+
var options = defaultOptions;
|
165
|
+
var panel1;
|
166
|
+
var panel2;
|
167
|
+
var playBtnText;
|
168
|
+
var popup;
|
169
|
+
var popupBackground;
|
170
|
+
var popupWrap;
|
171
|
+
var prevBtn;
|
172
|
+
var resumePlay = false;
|
173
|
+
var tempImg = new Image();
|
174
|
+
var thumbnail;
|
175
|
+
var thumbnailImg;
|
176
|
+
var thumbnailPos;
|
177
|
+
var thumbnailProperties;
|
178
|
+
var views = new Array();
|
179
|
+
var windowDimensions;
|
180
|
+
|
181
|
+
var keyCodes = {
|
182
|
+
40: 'DOWN',
|
183
|
+
35: 'END',
|
184
|
+
13: 'ENTER',
|
185
|
+
36: 'HOME',
|
186
|
+
37: 'LEFT',
|
187
|
+
39: 'RIGHT',
|
188
|
+
32: 'SPACE',
|
189
|
+
38: 'UP',
|
190
|
+
72: 'h',
|
191
|
+
27: 'ESCAPE'
|
192
|
+
};
|
193
|
+
var keyMappings = {
|
194
|
+
RIGHT: options.isRTL ? 'prev' : 'next',
|
195
|
+
DOWN: 'next',
|
196
|
+
UP: 'prev',
|
197
|
+
LEFT: options.isRTL ? 'next' : 'prev',
|
198
|
+
ENTER: 'play',
|
199
|
+
HOME: 'first',
|
200
|
+
END: 'last',
|
201
|
+
SPACE: 'next',
|
202
|
+
h: 'help',
|
203
|
+
ESCAPE: 'close'
|
204
|
+
};
|
205
|
+
var sprites = new Yox.Sprites({
|
206
|
+
notifications: {
|
207
|
+
width: 59,
|
208
|
+
height: 59,
|
209
|
+
sprites: [ 'empty', 'playRTL', 'play', 'pause', 'last', 'first' ]
|
210
|
+
},
|
211
|
+
icons: {
|
212
|
+
width: 18,
|
213
|
+
height: 18,
|
214
|
+
sprites: ['close', 'help', 'play', 'link', 'pin', 'unpin']
|
215
|
+
},
|
216
|
+
menu: {
|
217
|
+
height: 42,
|
218
|
+
sprites: ['back']
|
219
|
+
}
|
220
|
+
}, options.imagesFolder + "sprites.png", options.imagesFolder + "empty.gif");
|
221
|
+
|
222
|
+
this.AddViews = function(_views, options)
|
223
|
+
{
|
224
|
+
var popupIsCreated = this.firstViewWithImages != undefined;
|
225
|
+
jQuery.each(_views, function(){
|
226
|
+
setView(this, views.length, options);
|
227
|
+
views.push(this);
|
228
|
+
if (!yoxviewApi.firstViewWithImages)
|
229
|
+
{
|
230
|
+
var viewImages = $(this).data("yoxview").images;
|
231
|
+
if (viewImages && viewImages.length != 0)
|
232
|
+
yoxviewApi.firstViewWithImages = this;
|
233
|
+
}
|
234
|
+
});
|
235
|
+
|
236
|
+
if (!popupIsCreated && this.firstViewWithImages)
|
237
|
+
{
|
238
|
+
loadViewImages(this.firstViewWithImages);
|
239
|
+
createPopup();
|
240
|
+
|
241
|
+
if(options.cacheImagesInBackground && imagesCount != 0)
|
242
|
+
{
|
243
|
+
calculateCacheBuffer();
|
244
|
+
cacheImages(0);
|
245
|
+
}
|
246
|
+
popupIsCreated = true;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
this.SetImages = function(images)
|
250
|
+
{
|
251
|
+
imagesCount = images.length;
|
252
|
+
}
|
253
|
+
function resetPopup()
|
254
|
+
{
|
255
|
+
if (popup)
|
256
|
+
{
|
257
|
+
popupWrap.remove();
|
258
|
+
popup = undefined;
|
259
|
+
prevBtn = undefined;
|
260
|
+
nextBtn = undefined;
|
261
|
+
image1 = undefined;
|
262
|
+
image2 = undefined;
|
263
|
+
panel1 = undefined;
|
264
|
+
panel2 = undefined;
|
265
|
+
currentItemIndex = 0;
|
266
|
+
currentCacheImg = 0;
|
267
|
+
yoxviewApi.infoButtons = undefined;
|
268
|
+
}
|
269
|
+
createPopup();
|
270
|
+
}
|
271
|
+
function loadViewImages(_view)
|
272
|
+
{
|
273
|
+
var viewData = $(_view).data("yoxview");
|
274
|
+
if (!images || currentViewIndex != viewData.viewIndex)
|
275
|
+
{
|
276
|
+
images = viewData.images;
|
277
|
+
imagesCount = images.length;
|
278
|
+
currentViewIndex = viewData.viewIndex;
|
279
|
+
|
280
|
+
var isResetPopup = false;
|
281
|
+
|
282
|
+
if (viewData.options && !Yox.compare(options, viewData.options))
|
283
|
+
{
|
284
|
+
options = viewData.options;
|
285
|
+
isResetPopup = true;
|
286
|
+
}
|
287
|
+
else if (!viewData.options && !Yox.compare(options, defaultOptions))
|
288
|
+
{
|
289
|
+
options = defaultOptions;
|
290
|
+
isResetPopup = true;
|
291
|
+
}
|
292
|
+
else if ((prevBtn && imagesCount == 1) || (popup && !prevBtn && imagesCount > 0))
|
293
|
+
isResetPopup = true;
|
294
|
+
|
295
|
+
if (isResetPopup)
|
296
|
+
resetPopup();
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
function getImageDataFromThumbnail(thumbnail)
|
301
|
+
{
|
302
|
+
var isVideo = false;
|
303
|
+
var imageData = {};
|
304
|
+
var thumbnailHref = thumbnail.attr("href");
|
305
|
+
var thumbImg = thumbnail.children("img:first");
|
306
|
+
|
307
|
+
if (thumbnailHref.match(Yox.imageRegex))
|
308
|
+
{
|
309
|
+
$.extend(imageData, {
|
310
|
+
media: {
|
311
|
+
src : thumbnail.attr("href"),
|
312
|
+
title : thumbImg.attr(options.titleAttribute),
|
313
|
+
alt : thumbImg.attr("alt")
|
314
|
+
}
|
315
|
+
});
|
316
|
+
}
|
317
|
+
else
|
318
|
+
{
|
319
|
+
for(videoProvider in Yox.videoRegex)
|
320
|
+
{
|
321
|
+
if (thumbnailHref.match(Yox.videoRegex[videoProvider]))
|
322
|
+
{
|
323
|
+
$.extend(imageData, {
|
324
|
+
media: {
|
325
|
+
type: "video",
|
326
|
+
provider: videoProvider,
|
327
|
+
url: thumbnailHref
|
328
|
+
}
|
329
|
+
});
|
330
|
+
isVideo = true;
|
331
|
+
break;
|
332
|
+
}
|
333
|
+
}
|
334
|
+
if (!isVideo)
|
335
|
+
return null;
|
336
|
+
}
|
337
|
+
|
338
|
+
$.extend(imageData, {
|
339
|
+
thumbnailImg : thumbImg,
|
340
|
+
thumbnailSrc : thumbImg.attr("src")
|
341
|
+
});
|
342
|
+
return imageData;
|
343
|
+
}
|
344
|
+
|
345
|
+
function setView(view, viewIndex, _options)
|
346
|
+
{
|
347
|
+
var view = $(view);
|
348
|
+
view.data("yoxview", {viewIndex : viewIndex});
|
349
|
+
|
350
|
+
if (!Yox.compare(options, _options))
|
351
|
+
view.data("yoxview").options = _options;
|
352
|
+
|
353
|
+
// First, get image data from thumbnails:
|
354
|
+
_options.isSingleLink = view[0].tagName == "A";
|
355
|
+
var thumbnails = _options.isSingleLink ? view : view.find("a:has(img)");
|
356
|
+
var viewImages = new Array();
|
357
|
+
|
358
|
+
thumbnails.each(function(i, thumbnail){
|
359
|
+
var imageData = getImageDataFromThumbnail($(thumbnail));
|
360
|
+
if (imageData != null)
|
361
|
+
viewImages.push(imageData);
|
362
|
+
});
|
363
|
+
|
364
|
+
if (_options.images)
|
365
|
+
viewImages = viewImages.concat(_options.images);
|
366
|
+
|
367
|
+
if (_options.dataSource)
|
368
|
+
{
|
369
|
+
Yox.dataSources[_options.dataSource].getImagesData(_options, function(data){
|
370
|
+
viewImages = viewImages.concat(data.images);
|
371
|
+
view.data("yoxview").images = viewImages;
|
372
|
+
|
373
|
+
var thumbnailsData = data.isGroup
|
374
|
+
? [$.extend(data, {
|
375
|
+
media: {
|
376
|
+
title: data.title + " (" + data.images.length + " images)",
|
377
|
+
alt: data.title
|
378
|
+
}
|
379
|
+
})]
|
380
|
+
: data.images;
|
381
|
+
|
382
|
+
createThumbnails(view, _options.isSingleLink ? null : thumbnailsData, !data.createGroups ? null :
|
383
|
+
function(e){
|
384
|
+
var viewData = $(e.currentTarget).data("yoxview");
|
385
|
+
var thumbnail = $(e.currentTarget);
|
386
|
+
var thumbnailData = thumbnail.data("yoxthumbs");
|
387
|
+
if (!viewData.imagesAreSet)
|
388
|
+
{
|
389
|
+
thumbnail.css("cursor", "wait");
|
390
|
+
var newOptions = $.extend({}, options);
|
391
|
+
if (!newOptions.dataSourceOptions)
|
392
|
+
newOptions.dataSourceOptions = thumbnailData;
|
393
|
+
else
|
394
|
+
$.extend(newOptions.dataSourceOptions, thumbnailData);
|
395
|
+
|
396
|
+
Yox.dataSources[options.dataSource].getImagesData(newOptions, function(data){
|
397
|
+
viewData.images = data.images;
|
398
|
+
viewData.imagesAreSet = true;
|
399
|
+
thumbnail.css("cursor", "");
|
400
|
+
yoxviewApi.openGallery(viewData.viewIndex);
|
401
|
+
});
|
402
|
+
}
|
403
|
+
else
|
404
|
+
{
|
405
|
+
yoxviewApi.openGallery(viewData.viewIndex);
|
406
|
+
}
|
407
|
+
}
|
408
|
+
);
|
409
|
+
if (!_options.isSingleLink)
|
410
|
+
$.each(view.yoxthumbs("thumbnails"), function(i, thumbnail){
|
411
|
+
thumbnail.data("yoxview", {viewIndex: views.length});
|
412
|
+
views.push(thumbnail);
|
413
|
+
});
|
414
|
+
if (!yoxviewApi.firstViewWithImages && data.images.length > 0)
|
415
|
+
{
|
416
|
+
yoxviewApi.firstViewWithImages = view;
|
417
|
+
|
418
|
+
if (_options.cacheImagesInBackground)
|
419
|
+
yoxviewApi.startCache();
|
420
|
+
}
|
421
|
+
});
|
422
|
+
}
|
423
|
+
else
|
424
|
+
{
|
425
|
+
view.data("yoxview").images = viewImages;
|
426
|
+
createThumbnails(view);
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
430
|
+
function createThumbnails(view, additionalImages, onClick)
|
431
|
+
{
|
432
|
+
view.yoxthumbs({
|
433
|
+
images: additionalImages,
|
434
|
+
enableOnlyMedia: true,
|
435
|
+
onClick: onClick || function(e){
|
436
|
+
e.preventDefault();
|
437
|
+
if (options.thumbnailsOptions && options.thumbnailsOptions.onClick)
|
438
|
+
options.thumbnailsOptions.onClick(
|
439
|
+
$(e.currentTarget).data("yoxthumbs").imageIndex,
|
440
|
+
$(e.currentTarget),
|
441
|
+
$(e.liveFired).data("yoxview").viewIndex);
|
442
|
+
else
|
443
|
+
yoxviewApi.openGallery($(e.liveFired || e.currentTarget).data("yoxview").viewIndex,
|
444
|
+
$(e.currentTarget).data("yoxthumbs").imageIndex);
|
445
|
+
|
446
|
+
return false;
|
447
|
+
}
|
448
|
+
});
|
449
|
+
}
|
450
|
+
function setThumbnail(setToPopupImage)
|
451
|
+
{
|
452
|
+
var currentView = $(views[currentViewIndex]);
|
453
|
+
thumbnail = currentView[0].tagName == "A"
|
454
|
+
? currentView
|
455
|
+
: currentView.yoxthumbs('thumbnails')[currentItemIndex];
|
456
|
+
|
457
|
+
if (!thumbnail || thumbnail.length == 0)
|
458
|
+
thumbnail = currentView.yoxthumbs('thumbnails')[0];
|
459
|
+
|
460
|
+
var thumbnailImg = thumbnail.children("img:first");
|
461
|
+
if (thumbnailImg)
|
462
|
+
{
|
463
|
+
if (setToPopupImage && image1)
|
464
|
+
image1.attr("src", thumbnailImg.attr("src"));
|
465
|
+
|
466
|
+
thumbnailPos = thumbnailImg.offset();
|
467
|
+
thumbnailProperties = {
|
468
|
+
width: thumbnailImg.width(),
|
469
|
+
height: thumbnailImg.height(),
|
470
|
+
top: thumbnailPos.top - $(window).scrollTop(),
|
471
|
+
left: thumbnailPos.left
|
472
|
+
};
|
473
|
+
}
|
474
|
+
}
|
475
|
+
|
476
|
+
// Opens the viewer popup.
|
477
|
+
// Arguments:
|
478
|
+
// viewIndex: The 0-based index of the view to open, in case there are multiple instances of YoxView on the same page. Default is 0.
|
479
|
+
// imageIndex: The 0-based index of the image to open, in the specified view. Default is 0.
|
480
|
+
// callBack: A function to call after the gallery has opened.
|
481
|
+
this.openGallery = function(viewIndex, initialItemIndex, callBack)
|
482
|
+
{
|
483
|
+
if (typeof(viewIndex) == 'function')
|
484
|
+
{
|
485
|
+
callBack = viewIndex;
|
486
|
+
viewIndex = initialItemIndex = 0;
|
487
|
+
}
|
488
|
+
else if (typeof(initialItemIndex) == 'function')
|
489
|
+
{
|
490
|
+
callBack = initialItemIndex;
|
491
|
+
initialItemIndex = 0;
|
492
|
+
}
|
493
|
+
viewIndex = viewIndex || 0;
|
494
|
+
initialItemIndex = initialItemIndex || 0;
|
495
|
+
|
496
|
+
loadViewImages(views[viewIndex]);
|
497
|
+
|
498
|
+
if (!popup && imagesCount != 0)
|
499
|
+
createPopup();
|
500
|
+
|
501
|
+
this.selectImage(initialItemIndex);
|
502
|
+
popupWrap.stop().css({ opacity: 1 }).fadeIn("slow", function(){ popupWrap.css("opacity", "") });
|
503
|
+
|
504
|
+
if(options.cacheImagesInBackground)
|
505
|
+
cacheImages(initialItemIndex);
|
506
|
+
|
507
|
+
if (callBack)
|
508
|
+
onOpenCallback = callBack;
|
509
|
+
|
510
|
+
return false;
|
511
|
+
}
|
512
|
+
|
513
|
+
this.selectImage = function(itemIndex)
|
514
|
+
{
|
515
|
+
yoxviewApi.currentImage = images[itemIndex];
|
516
|
+
currentItemIndex = itemIndex;
|
517
|
+
|
518
|
+
setThumbnail(true);
|
519
|
+
thumbnail.blur();
|
520
|
+
|
521
|
+
panel1.css({
|
522
|
+
"z-index" : "1",
|
523
|
+
"width" : thumbnailProperties.width,
|
524
|
+
"height" : thumbnailProperties.height
|
525
|
+
});
|
526
|
+
panel2.css({
|
527
|
+
"display" : "none",
|
528
|
+
"z-index" : "2"
|
529
|
+
});
|
530
|
+
|
531
|
+
firstImage = true;
|
532
|
+
|
533
|
+
popup.css({
|
534
|
+
"width" : thumbnailProperties.width,
|
535
|
+
"height" : thumbnailProperties.height,
|
536
|
+
"top" : thumbnailProperties.top,
|
537
|
+
"left" : thumbnailProperties.left
|
538
|
+
});
|
539
|
+
this.select(itemIndex);
|
540
|
+
}
|
541
|
+
this.refresh = function()
|
542
|
+
{
|
543
|
+
resumePlay = isPlaying;
|
544
|
+
|
545
|
+
if (isPlaying)
|
546
|
+
stopPlay();
|
547
|
+
|
548
|
+
setImage(currentItemIndex);
|
549
|
+
|
550
|
+
if (resumePlay)
|
551
|
+
startPlay();
|
552
|
+
}
|
553
|
+
|
554
|
+
// Displays the specified image and shows the specified button, if specified. Use when the viewer is open.
|
555
|
+
// Arguments:
|
556
|
+
// imageIndex: The 0-based index of the image to display.
|
557
|
+
// pressedBtn: a jQuery element of a button to display momentarily in the viewer.
|
558
|
+
// For example, if the image has been selected by pressing the Next button
|
559
|
+
// on the keyboard, specify the Next button. If no button should be display, leave blank.
|
560
|
+
this.select = function(itemIndex, pressedBtn, viewIndex)
|
561
|
+
{
|
562
|
+
if (typeof pressedBtn === "number")
|
563
|
+
{
|
564
|
+
viewIndex = pressedBtn;
|
565
|
+
pressedBtn = undefined;
|
566
|
+
}
|
567
|
+
viewIndex = viewIndex || 0;
|
568
|
+
|
569
|
+
if (!isResizing)
|
570
|
+
{
|
571
|
+
if (itemIndex < 0)
|
572
|
+
itemIndex = imagesCount - 1;
|
573
|
+
else if (itemIndex == imagesCount)
|
574
|
+
itemIndex = 0;
|
575
|
+
|
576
|
+
if (!isPlaying && pressedBtn)
|
577
|
+
flicker(pressedBtn);
|
578
|
+
|
579
|
+
yoxviewApi.currentImage = images[itemIndex];
|
580
|
+
currentItemIndex = itemIndex;
|
581
|
+
setImage(currentItemIndex);
|
582
|
+
|
583
|
+
// Set the cache buffer, if required:
|
584
|
+
calculateCacheBuffer();
|
585
|
+
|
586
|
+
// Handle event onSelect:
|
587
|
+
if (options.onSelect)
|
588
|
+
options.onSelect(itemIndex, images[itemIndex]);
|
589
|
+
}
|
590
|
+
}
|
591
|
+
this.prev = function()
|
592
|
+
{
|
593
|
+
cacheDirectionForward = false;
|
594
|
+
this.select(currentItemIndex - 1, prevBtn);
|
595
|
+
return false;
|
596
|
+
}
|
597
|
+
this.next = function()
|
598
|
+
{
|
599
|
+
cacheDirectionForward = true;
|
600
|
+
this.select(currentItemIndex + 1, nextBtn);
|
601
|
+
return false;
|
602
|
+
}
|
603
|
+
this.first = function()
|
604
|
+
{
|
605
|
+
longFlicker(notifications["first"]);
|
606
|
+
this.select(0);
|
607
|
+
return false;
|
608
|
+
}
|
609
|
+
this.last = function()
|
610
|
+
{
|
611
|
+
longFlicker(notifications["last"]);
|
612
|
+
this.select(imagesCount - 1);
|
613
|
+
return false;
|
614
|
+
}
|
615
|
+
this.play = function()
|
616
|
+
{
|
617
|
+
if (imagesCount == 1)
|
618
|
+
return;
|
619
|
+
|
620
|
+
cacheDirectionForward = true;
|
621
|
+
|
622
|
+
if (!isPlaying)
|
623
|
+
{
|
624
|
+
longFlicker(notifications["play"]);
|
625
|
+
startPlay();
|
626
|
+
playBtnText.text(currentLanguage.Pause);
|
627
|
+
}
|
628
|
+
else
|
629
|
+
{
|
630
|
+
longFlicker(notifications["pause"]);
|
631
|
+
stopPlay();
|
632
|
+
playBtnText.text(currentLanguage.Play);
|
633
|
+
}
|
634
|
+
}
|
635
|
+
function flicker(button)
|
636
|
+
{
|
637
|
+
if (button.css("opacity") == 0)
|
638
|
+
button.stop().animate({ opacity : 0 }, options.buttonsFadeTime, fadeOut(button));
|
639
|
+
}
|
640
|
+
function longFlicker(button)
|
641
|
+
{
|
642
|
+
button.stop().fadeIn(options.buttonsFadeTime, function(){
|
643
|
+
$(this).delay(500)
|
644
|
+
.fadeOut(options.buttonsFadeTime);
|
645
|
+
});
|
646
|
+
}
|
647
|
+
function fadeIn(button)
|
648
|
+
{
|
649
|
+
$(button).stop().animate({ opacity : 0 }, options.buttonsFadeTime);
|
650
|
+
}
|
651
|
+
function fadeOut(button)
|
652
|
+
{
|
653
|
+
$(button).stop().animate({ opacity : 0.5 }, options.buttonsFadeTime);
|
654
|
+
}
|
655
|
+
|
656
|
+
this.close = function()
|
657
|
+
{
|
658
|
+
this.closeHelp();
|
659
|
+
setThumbnail(false);
|
660
|
+
resizePopup(thumbnailProperties.width, thumbnailProperties.height, thumbnailProperties.top, thumbnailProperties.left, function(){
|
661
|
+
yoxviewApi.isOpen = false;
|
662
|
+
});
|
663
|
+
hideMenuPanel();
|
664
|
+
|
665
|
+
if (infoPanel)
|
666
|
+
hideInfoPanel(function(){
|
667
|
+
infoText.html("");
|
668
|
+
});
|
669
|
+
|
670
|
+
newPanel.animate({
|
671
|
+
width: thumbnailProperties.width,
|
672
|
+
height: thumbnailProperties.height
|
673
|
+
}, options.popupResizeTime, function(){
|
674
|
+
newPanel.css("opacity", 1);
|
675
|
+
popupBackground.css("opacity", options.backgroundOpacity);
|
676
|
+
});
|
677
|
+
|
678
|
+
popupWrap.stop().fadeOut(1000);
|
679
|
+
|
680
|
+
if (isPlaying)
|
681
|
+
stopPlay();
|
682
|
+
|
683
|
+
if (options.onClose)
|
684
|
+
options.onClose();
|
685
|
+
|
686
|
+
isResizing = false;
|
687
|
+
}
|
688
|
+
this.help = function()
|
689
|
+
{
|
690
|
+
if (this.isOpen)
|
691
|
+
{
|
692
|
+
if (helpPanel.css("display") == "none")
|
693
|
+
helpPanel.css("display", "block").stop().animate({ opacity : 0.8 }, options.buttonsFadeTime);
|
694
|
+
else
|
695
|
+
this.closeHelp();
|
696
|
+
}
|
697
|
+
}
|
698
|
+
this.closeHelp = function()
|
699
|
+
{
|
700
|
+
if (helpPanel.css("display") != "none")
|
701
|
+
helpPanel.stop().animate({ opacity: 0 }, options.buttonsFadeTime, function(){
|
702
|
+
helpPanel.css("display", "none");
|
703
|
+
});
|
704
|
+
}
|
705
|
+
this.clickBtn = function(fn, stopPlaying)
|
706
|
+
{
|
707
|
+
if (stopPlaying && isPlaying)
|
708
|
+
stopPlay();
|
709
|
+
|
710
|
+
fn.call(this);
|
711
|
+
return false;
|
712
|
+
}
|
713
|
+
|
714
|
+
function catchPress(e)
|
715
|
+
{
|
716
|
+
if (yoxviewApi && yoxviewApi.isOpen)
|
717
|
+
{
|
718
|
+
var pK = keyCodes[e.keyCode];
|
719
|
+
var calledFunction = yoxviewApi[keyMappings[pK]];
|
720
|
+
if (calledFunction)
|
721
|
+
{
|
722
|
+
e.preventDefault();
|
723
|
+
calledFunction.apply(yoxviewApi);
|
724
|
+
return false;
|
725
|
+
}
|
726
|
+
return true;
|
727
|
+
}
|
728
|
+
return true;
|
729
|
+
}
|
730
|
+
|
731
|
+
function createMenuButton(_title, btnFunction, stopPlay)
|
732
|
+
{
|
733
|
+
var btn = $("<a>", {
|
734
|
+
href : "#",
|
735
|
+
click : function(){
|
736
|
+
return yoxviewApi.clickBtn(yoxviewApi[btnFunction], stopPlay);
|
737
|
+
}
|
738
|
+
});
|
739
|
+
var btnSpan = $("<span>" + _title + "</span>");
|
740
|
+
btnSpan.css("opacity", "0")
|
741
|
+
.appendTo(btn);
|
742
|
+
|
743
|
+
btn.append(sprites.getSprite("icons", btnFunction));
|
744
|
+
return btn;
|
745
|
+
}
|
746
|
+
|
747
|
+
// Prev and next buttons:
|
748
|
+
function createNavButton(_function, _side)
|
749
|
+
{
|
750
|
+
var navBtnImg = new Image();
|
751
|
+
navBtnImg.src = options.imagesFolder + _side + ".png";
|
752
|
+
var navBtn = $("<a>", {
|
753
|
+
css : {
|
754
|
+
"background" : "url(" + navBtnImg.src + ") no-repeat " + _side + " center",
|
755
|
+
"opacity" : "0",
|
756
|
+
"outline" : "0"
|
757
|
+
},
|
758
|
+
className : "yoxview_ctlBtn",
|
759
|
+
href : "#",
|
760
|
+
click : function(){
|
761
|
+
this.blur();
|
762
|
+
return yoxviewApi.clickBtn(_function, true);
|
763
|
+
}
|
764
|
+
});
|
765
|
+
navBtn.css(_side, "0");
|
766
|
+
return navBtn;
|
767
|
+
}
|
768
|
+
|
769
|
+
// INIT:
|
770
|
+
|
771
|
+
this.AddViews(_views, options);
|
772
|
+
|
773
|
+
$(document).delegate('*', 'keydown', function(data){
|
774
|
+
catchPress(data);
|
775
|
+
});
|
776
|
+
$(window).bind("resize.yoxview", function()
|
777
|
+
{
|
778
|
+
windowDimensions = getWindowDimensions();
|
779
|
+
if (yoxviewApi.isOpen)
|
780
|
+
yoxviewApi.resize();
|
781
|
+
});
|
782
|
+
|
783
|
+
function createPopup()
|
784
|
+
{
|
785
|
+
currentLanguage = yoxviewLanguages[options.lang];
|
786
|
+
|
787
|
+
popupWrap = $("<div>", {
|
788
|
+
id : "yoxview_popupWrap",
|
789
|
+
css : {
|
790
|
+
"position" : "fixed",
|
791
|
+
"top" : "0",
|
792
|
+
"left" : "0",
|
793
|
+
"width" : "100%",
|
794
|
+
"height" : "100%",
|
795
|
+
"display" : "none",
|
796
|
+
"z-index" : "100"
|
797
|
+
}
|
798
|
+
});
|
799
|
+
|
800
|
+
popup = $("<div>", {
|
801
|
+
id : 'yoxview'
|
802
|
+
});
|
803
|
+
popupWrap.appendTo($(parent.document.body)).append(popup);
|
804
|
+
|
805
|
+
panel1 = $("<div>", {
|
806
|
+
className: "yoxview_imgPanel",
|
807
|
+
css: {
|
808
|
+
"z-index": "2"
|
809
|
+
}
|
810
|
+
});
|
811
|
+
panel2 = $("<div>", {
|
812
|
+
className: "yoxview_imgPanel",
|
813
|
+
css: {
|
814
|
+
"z-index": "1",
|
815
|
+
"display": "none"
|
816
|
+
}
|
817
|
+
});
|
818
|
+
// the first image:
|
819
|
+
image1 = $("<img />", {
|
820
|
+
className : "yoxview_fadeImg",
|
821
|
+
css : {
|
822
|
+
"display" : "block",
|
823
|
+
"width" : "100%",
|
824
|
+
"height" : "100%"
|
825
|
+
}
|
826
|
+
});
|
827
|
+
|
828
|
+
// the second image:
|
829
|
+
image2 = $("<img />", {
|
830
|
+
className : "yoxview_fadeImg",
|
831
|
+
css : {
|
832
|
+
"display" : "block",
|
833
|
+
"width" : "100%",
|
834
|
+
"height" : "100%"
|
835
|
+
}
|
836
|
+
});
|
837
|
+
panel1.data("yoxviewPanel", {image: image1})
|
838
|
+
.append(image1).appendTo(popup);
|
839
|
+
panel2.data("yoxviewPanel", {image: image2})
|
840
|
+
panel2.append(image2).appendTo(popup);
|
841
|
+
var singleImage = imagesCount == 1;
|
842
|
+
if (singleImage && !images[0].media[options.titleAttribute])
|
843
|
+
options.renderInfo = false;
|
844
|
+
|
845
|
+
// the menu:
|
846
|
+
if (options.renderMenu !== false)
|
847
|
+
{
|
848
|
+
var menuPanelWrap = $("<div>", {
|
849
|
+
className : "yoxview_popupBarPanel yoxview_top"
|
850
|
+
});
|
851
|
+
|
852
|
+
if (options.autoHideMenu !== false)
|
853
|
+
{
|
854
|
+
menuPanelWrap.mouseenter(function(){
|
855
|
+
if (yoxviewApi.isOpen)
|
856
|
+
showMenuPanel();
|
857
|
+
})
|
858
|
+
.mouseleave(function(){
|
859
|
+
if (yoxviewApi.isOpen)
|
860
|
+
hideMenuPanel();
|
861
|
+
});
|
862
|
+
}
|
863
|
+
|
864
|
+
menuPanel = $("<div>", {
|
865
|
+
id : "yoxview_menuPanel",
|
866
|
+
css: {
|
867
|
+
"opacity": "0.8",
|
868
|
+
"background-position": sprites.getBackgroundPosition("menu", "back")
|
869
|
+
}
|
870
|
+
});
|
871
|
+
|
872
|
+
var helpBtn = createMenuButton(currentLanguage.Help, "help", false);
|
873
|
+
var playBtn = createMenuButton(currentLanguage.Slideshow, "play", false);
|
874
|
+
playBtnText = playBtn.children("span");
|
875
|
+
|
876
|
+
menuPanel.append(
|
877
|
+
createMenuButton(currentLanguage.Close, "close", true),
|
878
|
+
helpBtn,
|
879
|
+
playBtn
|
880
|
+
);
|
881
|
+
|
882
|
+
if (singleImage)
|
883
|
+
{
|
884
|
+
playBtn.css("display", "none");
|
885
|
+
helpBtn.css("display", "none");
|
886
|
+
menuPanel.css({
|
887
|
+
width: 58
|
888
|
+
});
|
889
|
+
}
|
890
|
+
|
891
|
+
menuPanel.find("a:last-child").attr("class", "last");
|
892
|
+
menuPanelWrap.append(menuPanel).appendTo(popup);
|
893
|
+
menuPanel.delegate("a", "mouseenter", function(){
|
894
|
+
$(this).stop().animate({ top : "8px" }, "fast").find("span").stop().animate({opacity:1}, "fast");
|
895
|
+
})
|
896
|
+
.delegate("a", "mouseleave", function(){
|
897
|
+
$(this).stop().animate({ top : "0" }, "fast").find("span").stop().animate({opacity:0}, "fast");
|
898
|
+
});
|
899
|
+
}
|
900
|
+
|
901
|
+
if (options.renderButtons !== false && !singleImage)
|
902
|
+
{
|
903
|
+
// prev and next buttons:
|
904
|
+
prevBtn = createNavButton(yoxviewApi.prev, options.isRTL ? "right" : "left");
|
905
|
+
prevBtn.appendTo(popup);
|
906
|
+
|
907
|
+
nextBtn = createNavButton(yoxviewApi.next, options.isRTL ? "left" : "right");
|
908
|
+
nextBtn.appendTo(popup);
|
909
|
+
}
|
910
|
+
|
911
|
+
ctlButtons = popup.find(".yoxview_ctlBtn");
|
912
|
+
|
913
|
+
// add the ajax loader:
|
914
|
+
ajaxLoader = $("<div>", {
|
915
|
+
id: "yoxview_ajaxLoader",
|
916
|
+
className: "yoxview_notification",
|
917
|
+
css: {
|
918
|
+
"display": "none"
|
919
|
+
}
|
920
|
+
});
|
921
|
+
ajaxLoader.append($("<img>", {
|
922
|
+
src: options.imagesFolder + "popup_ajax_loader.gif",
|
923
|
+
alt: currentLanguage.Loading,
|
924
|
+
css: {
|
925
|
+
width: 32,
|
926
|
+
height: 32,
|
927
|
+
"background-image": "url(" + options.imagesFolder + "sprites.png)",
|
928
|
+
"background-position": sprites.getBackgroundPosition("notifications", "empty")
|
929
|
+
}
|
930
|
+
}))
|
931
|
+
.appendTo(popup);
|
932
|
+
|
933
|
+
// notification images:
|
934
|
+
var notificationsNames = ["play", "pause", "first", "last"];
|
935
|
+
jQuery.each(notificationsNames, function(i, notificationName){
|
936
|
+
var notification = sprites.getSprite("notifications", notificationName);
|
937
|
+
|
938
|
+
notification.attr("className", "yoxview_notification")
|
939
|
+
.css("display", "none")
|
940
|
+
.appendTo(popup);
|
941
|
+
notifications[notificationName] = notification;
|
942
|
+
});
|
943
|
+
|
944
|
+
// help:
|
945
|
+
helpPanel = $("<div>", {
|
946
|
+
id : "yoxview_helpPanel",
|
947
|
+
href : "#",
|
948
|
+
title : currentLanguage.CloseHelp,
|
949
|
+
css : {
|
950
|
+
"background" : "url(" + options.imagesFolder + "help_panel.png) no-repeat center top",
|
951
|
+
"direction" : currentLanguage.Direction,
|
952
|
+
"opacity" : "0"
|
953
|
+
},
|
954
|
+
click : function(){
|
955
|
+
return yoxviewApi.clickBtn(yoxviewApi.help, false);
|
956
|
+
}
|
957
|
+
});
|
958
|
+
|
959
|
+
var helpTitle = document.createElement("h1");
|
960
|
+
helpTitle.innerHTML = currentLanguage.Help.toUpperCase();
|
961
|
+
|
962
|
+
var helpText = document.createElement("p");
|
963
|
+
helpText.innerHTML = currentLanguage.HelpText;
|
964
|
+
|
965
|
+
var closeHelp = document.createElement("span");
|
966
|
+
closeHelp.id = "yoxview_closeHelp";
|
967
|
+
closeHelp.innerHTML = currentLanguage.CloseHelp;
|
968
|
+
|
969
|
+
helpPanel.append(helpTitle).append(helpText).append(closeHelp).appendTo(popup);
|
970
|
+
|
971
|
+
// popup info:
|
972
|
+
if (options.renderInfo !== false)
|
973
|
+
{
|
974
|
+
infoPanelWrap = $("<div>", {
|
975
|
+
className : "yoxview_popupBarPanel yoxview_bottom"
|
976
|
+
});
|
977
|
+
|
978
|
+
infoPanelWrap.mouseenter(function(){
|
979
|
+
if (yoxviewApi.isOpen && !disableInfo && options.autoHideInfo !== false)
|
980
|
+
setInfoPanelHeight();
|
981
|
+
})
|
982
|
+
.mouseleave(function(){
|
983
|
+
if (yoxviewApi.isOpen && !disableInfo && options.autoHideInfo !== false)
|
984
|
+
hideInfoPanel();
|
985
|
+
});
|
986
|
+
|
987
|
+
infoPanel = $("<div>", {
|
988
|
+
id: "yoxview_infoPanel"
|
989
|
+
});
|
990
|
+
|
991
|
+
infoPanel.append(
|
992
|
+
$("<div>", {
|
993
|
+
id : "yoxview_infoPanelBack",
|
994
|
+
css : {
|
995
|
+
"background" : options.infoBackColor,
|
996
|
+
"opacity" : options.infoBackOpacity
|
997
|
+
}
|
998
|
+
})
|
999
|
+
);
|
1000
|
+
infoPanelContent = $("<div>", {
|
1001
|
+
id: "yoxview_infoPanelContent"
|
1002
|
+
});
|
1003
|
+
|
1004
|
+
countDisplay = $("<span>", {
|
1005
|
+
id: "yoxview_count"
|
1006
|
+
});
|
1007
|
+
|
1008
|
+
infoText = $("<div>", {
|
1009
|
+
id: "yoxview_infoText"
|
1010
|
+
});
|
1011
|
+
if (singleImage)
|
1012
|
+
{
|
1013
|
+
infoText.css("margin-left", "10px");
|
1014
|
+
countDisplay.css("display", "none");
|
1015
|
+
}
|
1016
|
+
infoPanelContent.append(countDisplay);
|
1017
|
+
|
1018
|
+
if (options.renderInfoPin !== false)
|
1019
|
+
{
|
1020
|
+
infoPinLinkImg = sprites.getSprite("icons", options.autoHideInfo ? "pin" : "unpin");
|
1021
|
+
infoPinLink = $("<a>", {
|
1022
|
+
className: "yoxviewInfoLink",
|
1023
|
+
href: "#",
|
1024
|
+
title: options.autoHideInfo ? currentLanguage.PinInfo : currentLanguage.UnpinInfo,
|
1025
|
+
css: { display: 'inline' },
|
1026
|
+
click: function(e){
|
1027
|
+
e.preventDefault();
|
1028
|
+
options.autoHideInfo = !options.autoHideInfo;
|
1029
|
+
infoPinLinkImg.css("background-position", sprites.getBackgroundPosition("icons", options.autoHideInfo ? "pin" : "unpin"));
|
1030
|
+
this.title = options.autoHideInfo ? currentLanguage.PinInfo : currentLanguage.UnpinInfo;
|
1031
|
+
}
|
1032
|
+
});
|
1033
|
+
infoPinLink.append(infoPinLinkImg).appendTo(infoPanelContent);
|
1034
|
+
|
1035
|
+
}
|
1036
|
+
if (options.linkToOriginalContext !== false)
|
1037
|
+
{
|
1038
|
+
infoPanelLink = $("<a>", {
|
1039
|
+
className: "yoxviewInfoLink",
|
1040
|
+
target: "_blank",
|
1041
|
+
title: currentLanguage.OriginalContext
|
1042
|
+
});
|
1043
|
+
infoPanelLink.append(sprites.getSprite("icons", "link")).appendTo(infoPanelContent);
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
if (options.infoButtons)
|
1047
|
+
{
|
1048
|
+
yoxviewApi.infoButtons = options.infoButtons;
|
1049
|
+
for (infoButton in options.infoButtons)
|
1050
|
+
{
|
1051
|
+
options.infoButtons[infoButton].attr("className", "yoxviewInfoLink").css("display", "inline").appendTo(infoPanelContent);
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
infoPanelContent.append(infoText);
|
1056
|
+
|
1057
|
+
infoPanel.append(infoPanelContent).appendTo(infoPanelWrap);
|
1058
|
+
popup.append(infoPanelWrap);
|
1059
|
+
}
|
1060
|
+
// set the background:
|
1061
|
+
popupBackground = $("<div>", {
|
1062
|
+
css : {
|
1063
|
+
"position" : "fixed",
|
1064
|
+
"height" : "100%",
|
1065
|
+
"width" : "100%",
|
1066
|
+
"top" : "0",
|
1067
|
+
"left" : "0",
|
1068
|
+
"background" : options.backgroundColor,
|
1069
|
+
"z-index" : "1",
|
1070
|
+
"opacity" : options.backgroundOpacity
|
1071
|
+
},
|
1072
|
+
click : function(){
|
1073
|
+
return yoxviewApi.clickBtn(yoxviewApi.close, true);
|
1074
|
+
}
|
1075
|
+
}).appendTo(popupWrap);
|
1076
|
+
|
1077
|
+
if (options.buttonsFadeTime != 0)
|
1078
|
+
{
|
1079
|
+
ctlButtons.hover(
|
1080
|
+
function(){
|
1081
|
+
if (yoxviewApi.isOpen)
|
1082
|
+
$(this).stop().animate({ opacity : 0.6 }, options.buttonsFadeTime);
|
1083
|
+
},
|
1084
|
+
function(){
|
1085
|
+
$(this).stop().animate({ opacity : 0 }, options.buttonsFadeTime);
|
1086
|
+
}
|
1087
|
+
);
|
1088
|
+
}
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
$(cacheImg).load(function()
|
1092
|
+
{
|
1093
|
+
$.extend(images[currentCacheImg].media, {
|
1094
|
+
width: this.width,
|
1095
|
+
height: this.height,
|
1096
|
+
loaded: true
|
1097
|
+
});
|
1098
|
+
advanceCache();
|
1099
|
+
})
|
1100
|
+
.error(function(){
|
1101
|
+
advanceCache();
|
1102
|
+
});
|
1103
|
+
|
1104
|
+
function advanceCache()
|
1105
|
+
{
|
1106
|
+
cachedImagesCount++;
|
1107
|
+
if (cachedImagesCount == imagesCount)
|
1108
|
+
cacheComplete = true;
|
1109
|
+
|
1110
|
+
if (!cacheComplete)
|
1111
|
+
getCacheBuffer();
|
1112
|
+
}
|
1113
|
+
this.startCache = function()
|
1114
|
+
{
|
1115
|
+
loadViewImages(this.firstViewWithImages);
|
1116
|
+
calculateCacheBuffer();
|
1117
|
+
cacheImages(0);
|
1118
|
+
}
|
1119
|
+
function getCacheBuffer()
|
1120
|
+
{
|
1121
|
+
if (!options.cacheBuffer || currentCacheImg != cacheBufferLastIndex)
|
1122
|
+
cacheImages(currentCacheImg + (cacheDirectionForward ? 1 : -1));
|
1123
|
+
}
|
1124
|
+
function calculateCacheBuffer()
|
1125
|
+
{
|
1126
|
+
if (options.cacheBuffer)
|
1127
|
+
{
|
1128
|
+
cacheBufferLastIndex = cacheDirectionForward ? currentItemIndex + options.cacheBuffer : currentItemIndex - options.cacheBuffer;
|
1129
|
+
if (cacheBufferLastIndex < 0)
|
1130
|
+
cacheBufferLastIndex += imagesCount;
|
1131
|
+
else if (cacheBufferLastIndex >= imagesCount)
|
1132
|
+
cacheBufferLastIndex -= imagesCount;
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
function cacheImages(imageIndexToCache)
|
1136
|
+
{
|
1137
|
+
if (cacheComplete)
|
1138
|
+
return;
|
1139
|
+
|
1140
|
+
if (imageIndexToCache == imagesCount)
|
1141
|
+
imageIndexToCache = 0;
|
1142
|
+
|
1143
|
+
else if (imageIndexToCache < 0)
|
1144
|
+
imageIndexToCache += imagesCount;
|
1145
|
+
|
1146
|
+
var image = images[imageIndexToCache].media;
|
1147
|
+
currentCacheImg = imageIndexToCache;
|
1148
|
+
if (image && !image.loaded)
|
1149
|
+
{
|
1150
|
+
if (!image.type || image.type === "image")
|
1151
|
+
cacheImg.src = image.src;
|
1152
|
+
else
|
1153
|
+
loadMedia(image, function(){
|
1154
|
+
advanceCache();
|
1155
|
+
});
|
1156
|
+
}
|
1157
|
+
else
|
1158
|
+
getCacheBuffer();
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
function showLoaderIcon()
|
1162
|
+
{
|
1163
|
+
loading = true;
|
1164
|
+
ajaxLoader.stop().stopTime()
|
1165
|
+
.oneTime(options.buttonsFadeTime, function()
|
1166
|
+
{
|
1167
|
+
$(this).stop().css("opacity", "0.6").fadeIn(options.buttonsFadeTime);
|
1168
|
+
});
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
function hideLoaderIcon()
|
1172
|
+
{
|
1173
|
+
loading = false;
|
1174
|
+
ajaxLoader.stop().stopTime().fadeOut(options.buttonsFadeTime);
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
function setImage(itemIndex)
|
1178
|
+
{
|
1179
|
+
if (!isPlaying)
|
1180
|
+
{
|
1181
|
+
showLoaderIcon();
|
1182
|
+
}
|
1183
|
+
loadAndDisplayMedia(yoxviewApi.currentImage.media);
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
function resizePopup(_width, _height, _top, _left, callBack)
|
1187
|
+
{
|
1188
|
+
popup.stop().animate({
|
1189
|
+
width: _width,
|
1190
|
+
height: _height,
|
1191
|
+
top: _top,
|
1192
|
+
left: _left
|
1193
|
+
}, options.popupResizeTime, callBack);
|
1194
|
+
}
|
1195
|
+
function startPlay()
|
1196
|
+
{
|
1197
|
+
if (imagesCount == 1)
|
1198
|
+
return;
|
1199
|
+
|
1200
|
+
isPlaying = true;
|
1201
|
+
if (currentItemIndex < imagesCount - 1)
|
1202
|
+
{
|
1203
|
+
popup.oneTime(options.playDelay, "play", function(){
|
1204
|
+
yoxviewApi.next();
|
1205
|
+
});
|
1206
|
+
}
|
1207
|
+
else
|
1208
|
+
{
|
1209
|
+
if (options.loopPlay)
|
1210
|
+
popup.oneTime(options.playDelay, "play", function(){
|
1211
|
+
yoxviewApi.select(0, null);
|
1212
|
+
});
|
1213
|
+
else
|
1214
|
+
stopPlay();
|
1215
|
+
}
|
1216
|
+
}
|
1217
|
+
function stopPlay()
|
1218
|
+
{
|
1219
|
+
popup.stopTime("play");
|
1220
|
+
isPlaying = false;
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
function blink(_element)
|
1224
|
+
{
|
1225
|
+
_element.animate({ opacity : 0.8 }, 1000, function()
|
1226
|
+
{
|
1227
|
+
$(this).animate({opacity: 0.2}, 1000, blink($(this)));
|
1228
|
+
});
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
var newPanel = panel1;
|
1232
|
+
var oldPanel = panel2;
|
1233
|
+
|
1234
|
+
function getWindowDimensions()
|
1235
|
+
{
|
1236
|
+
var widthVal = $(parent.window).width();
|
1237
|
+
var heightVal = $(parent.window).height();
|
1238
|
+
var returnValue = {
|
1239
|
+
height : heightVal,
|
1240
|
+
width : widthVal,
|
1241
|
+
usableHeight : heightVal - options.popupMargin * 2,
|
1242
|
+
usableWidth : widthVal - options.popupMargin * 2
|
1243
|
+
};
|
1244
|
+
return returnValue;
|
1245
|
+
}
|
1246
|
+
windowDimensions = getWindowDimensions();
|
1247
|
+
|
1248
|
+
this.resize = function()
|
1249
|
+
{
|
1250
|
+
if (isPlaying)
|
1251
|
+
{
|
1252
|
+
resumePlay = true;
|
1253
|
+
stopPlay();
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
var imageMaxSize = newPanel.data("maxSize");
|
1257
|
+
|
1258
|
+
if (!imageMaxSize || !imageMaxSize)
|
1259
|
+
return;
|
1260
|
+
|
1261
|
+
var newImageDimensions = Yox.fitImageSize(
|
1262
|
+
imageMaxSize,
|
1263
|
+
{ width: windowDimensions.usableWidth, height: windowDimensions.usableHeight});
|
1264
|
+
|
1265
|
+
newPanel.css({"width" : "100%", "height" : "100%"});
|
1266
|
+
|
1267
|
+
var marginTop = Math.round((windowDimensions.height - newImageDimensions.height) / 2);
|
1268
|
+
var marginLeft = Math.round((windowDimensions.width - newImageDimensions.width) / 2);
|
1269
|
+
|
1270
|
+
isResizing = true;
|
1271
|
+
if (newPanel.isMedia)
|
1272
|
+
ctlButtons.animate({top: newImageDimensions.height / 2 - mediaButtonsSize.height / 2}, options.popupResizeTime);
|
1273
|
+
|
1274
|
+
resizePopup(newImageDimensions.width,
|
1275
|
+
newImageDimensions.height,
|
1276
|
+
marginTop,
|
1277
|
+
marginLeft,
|
1278
|
+
function(){
|
1279
|
+
var newImageWidth = popup.width();
|
1280
|
+
var newImageHeight = popup.height();
|
1281
|
+
|
1282
|
+
newPanel.css({ "width" : newImageWidth + "px", "height" : newImageHeight + "px" });
|
1283
|
+
isResizing = false;
|
1284
|
+
|
1285
|
+
if (infoPanel)
|
1286
|
+
setInfoPanelHeight();
|
1287
|
+
|
1288
|
+
if (resumePlay)
|
1289
|
+
{
|
1290
|
+
startPlay();
|
1291
|
+
resumePlay = false;
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
);
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
function setInfoPanelHeight(callback)
|
1298
|
+
{
|
1299
|
+
clearTimeout(hideInfoTimeout);
|
1300
|
+
var titleHeight = infoText.outerHeight();
|
1301
|
+
|
1302
|
+
if (titleHeight < infoPanelMinHeight)
|
1303
|
+
titleHeight = infoPanelMinHeight;
|
1304
|
+
|
1305
|
+
infoPanel.stop().animate({height : titleHeight}, 500, function(){
|
1306
|
+
if (callback)
|
1307
|
+
callback();
|
1308
|
+
});
|
1309
|
+
}
|
1310
|
+
function hideInfoPanel(callback)
|
1311
|
+
{
|
1312
|
+
clearTimeout(hideInfoTimeout);
|
1313
|
+
infoPanel.stop().animate({ height: 0 }, 500, function(){
|
1314
|
+
if (callback)
|
1315
|
+
callback();
|
1316
|
+
});
|
1317
|
+
}
|
1318
|
+
function hideMenuPanel(callback)
|
1319
|
+
{
|
1320
|
+
clearTimeout(hideMenuTimeout);
|
1321
|
+
menuPanel.stop().animate({ top: menuHidePosition }, 500, function(){
|
1322
|
+
if (callback)
|
1323
|
+
callback();
|
1324
|
+
});
|
1325
|
+
}
|
1326
|
+
function showMenuPanel(callback)
|
1327
|
+
{
|
1328
|
+
clearTimeout(hideMenuTimeout);
|
1329
|
+
menuPanel.stop().animate({ top: 0 }, 500, function(){
|
1330
|
+
if (callback)
|
1331
|
+
callback();
|
1332
|
+
});
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
function changeMedia(media)
|
1336
|
+
{
|
1337
|
+
var currentImageElement;
|
1338
|
+
var mediaIsImage = !media.type || media.type === "image";
|
1339
|
+
|
1340
|
+
if (mediaIsImage && disableInfo && infoPanel)
|
1341
|
+
infoPanelWrap.css("display", "block");
|
1342
|
+
|
1343
|
+
clearTimeout(hideInfoTimeout);
|
1344
|
+
|
1345
|
+
if (panel1.css('z-index') == 1)
|
1346
|
+
{
|
1347
|
+
newPanel = panel1;
|
1348
|
+
currentImageElement = image1;
|
1349
|
+
oldPanel = panel2;
|
1350
|
+
}
|
1351
|
+
else
|
1352
|
+
{
|
1353
|
+
newPanel = panel2;
|
1354
|
+
currentImageElement = image2;
|
1355
|
+
oldPanel = panel1;
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
newPanel.data("maxSize", { width: media.width, height: media.height});
|
1359
|
+
|
1360
|
+
var newImageDimensions = Yox.fitImageSize(
|
1361
|
+
media,
|
1362
|
+
{ width: windowDimensions.usableWidth, height: windowDimensions.usableHeight });
|
1363
|
+
|
1364
|
+
if (infoPanel)
|
1365
|
+
{
|
1366
|
+
var infoTextValue = media.title || "";
|
1367
|
+
if (media.description)
|
1368
|
+
infoTextValue += infoTextValue != ""
|
1369
|
+
? "<div id='yoxview_infoTextDescription'>" + media.description + "</div>"
|
1370
|
+
: media.description;
|
1371
|
+
|
1372
|
+
infoText.html(infoTextValue);
|
1373
|
+
|
1374
|
+
if (imagesCount > 1)
|
1375
|
+
countDisplay.html(currentItemIndex + 1 + "/" + imagesCount);
|
1376
|
+
|
1377
|
+
if (infoPanelLink)
|
1378
|
+
{
|
1379
|
+
if (yoxviewApi.currentImage.link)
|
1380
|
+
infoPanelLink.attr("href", yoxviewApi.currentImage.link).css("display", "inline");
|
1381
|
+
else
|
1382
|
+
infoPanelLink.css("display", "none");
|
1383
|
+
}
|
1384
|
+
}
|
1385
|
+
var panelData = newPanel.data("yoxviewPanel");
|
1386
|
+
if (mediaIsImage)
|
1387
|
+
{
|
1388
|
+
currentImageElement.attr({
|
1389
|
+
src : media.src,
|
1390
|
+
title : media.title,
|
1391
|
+
alt: media.alt
|
1392
|
+
});
|
1393
|
+
|
1394
|
+
ctlButtons.css({"height": "100%", "width": "50%", "top": "0"});
|
1395
|
+
if(newPanel.isMedia)
|
1396
|
+
{
|
1397
|
+
panelData.media.remove();
|
1398
|
+
panelData.media = undefined;
|
1399
|
+
panelData.image.show();
|
1400
|
+
newPanel.isMedia = false;
|
1401
|
+
}
|
1402
|
+
disableInfo = false;
|
1403
|
+
}
|
1404
|
+
else
|
1405
|
+
{
|
1406
|
+
if (!panelData.media)
|
1407
|
+
{
|
1408
|
+
panelData.media = $("<div>", {
|
1409
|
+
className: "yoxview_mediaPanel"
|
1410
|
+
});
|
1411
|
+
panelData.image.hide();
|
1412
|
+
newPanel.append(panelData.media);
|
1413
|
+
}
|
1414
|
+
else
|
1415
|
+
panelData.media.show();
|
1416
|
+
|
1417
|
+
panelData.media.html(media.html);
|
1418
|
+
ctlButtons.css({
|
1419
|
+
"width": mediaButtonsSize.width,
|
1420
|
+
"height": mediaButtonsSize.height,
|
1421
|
+
"top": (newImageDimensions.height / 2) - (mediaButtonsSize.height / 2)
|
1422
|
+
});
|
1423
|
+
if (!newPanel.isMedia)
|
1424
|
+
{
|
1425
|
+
panelData.image.hide();
|
1426
|
+
newPanel.isMedia = true;
|
1427
|
+
}
|
1428
|
+
if (infoPanel)
|
1429
|
+
{
|
1430
|
+
if (options.autoHideInfo !== false)
|
1431
|
+
hideInfoPanel();
|
1432
|
+
|
1433
|
+
infoPanelWrap.css("display", "none");
|
1434
|
+
disableInfo = true;
|
1435
|
+
}
|
1436
|
+
}
|
1437
|
+
if (firstImage)
|
1438
|
+
newPanel.animate({
|
1439
|
+
width: newImageDimensions.width,
|
1440
|
+
height: newImageDimensions.height
|
1441
|
+
}, options.popupResizeTime);
|
1442
|
+
else
|
1443
|
+
newPanel.css({
|
1444
|
+
"width" : newImageDimensions.width + "px",
|
1445
|
+
"height" : newImageDimensions.height + "px"
|
1446
|
+
});
|
1447
|
+
|
1448
|
+
var marginTop = Math.round((windowDimensions.height - newImageDimensions.height) / 2);
|
1449
|
+
var marginLeft = Math.round((windowDimensions.width - newImageDimensions.width) / 2);
|
1450
|
+
|
1451
|
+
if (loading)
|
1452
|
+
hideLoaderIcon();
|
1453
|
+
|
1454
|
+
isResizing = true;
|
1455
|
+
resizePopup(newImageDimensions.width,
|
1456
|
+
newImageDimensions.height,
|
1457
|
+
marginTop,
|
1458
|
+
marginLeft,
|
1459
|
+
function()
|
1460
|
+
{
|
1461
|
+
if (firstImage)
|
1462
|
+
{
|
1463
|
+
yoxviewApi.isOpen = true;
|
1464
|
+
|
1465
|
+
if (options.controlsInitialDisplayTime > 0)
|
1466
|
+
{
|
1467
|
+
if (options.showButtonsOnOpen)
|
1468
|
+
ctlButtons.animate({opacity: 0.5}, options.controlsInitialFadeTime, function(){
|
1469
|
+
if(options.buttonsFadeTime != 0)
|
1470
|
+
$(this).delay(options.controlsInitialDisplayTime).animate({opacity : 0}, options.controlsInitialFadeTime);
|
1471
|
+
});
|
1472
|
+
|
1473
|
+
if (options.showBarsOnOpen)
|
1474
|
+
{
|
1475
|
+
showMenuPanel(function(){
|
1476
|
+
if (options.autoHideMenu !== false)
|
1477
|
+
hideMenuTimeout = setTimeout(function(){
|
1478
|
+
hideMenuPanel();
|
1479
|
+
},
|
1480
|
+
options.controlsInitialDisplayTime
|
1481
|
+
);
|
1482
|
+
});
|
1483
|
+
if (infoPanel)
|
1484
|
+
setInfoPanelHeight(function(){
|
1485
|
+
if (options.autoHideInfo !== false)
|
1486
|
+
hideInfoTimeout = setTimeout(function(){ hideInfoPanel(); }, options.controlsInitialDisplayTime);
|
1487
|
+
});
|
1488
|
+
}
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
if (options.autoPlay)
|
1492
|
+
yoxviewApi.play();
|
1493
|
+
|
1494
|
+
if (options.onOpen)
|
1495
|
+
options.onOpen();
|
1496
|
+
|
1497
|
+
if (onOpenCallback)
|
1498
|
+
{
|
1499
|
+
onOpenCallback();
|
1500
|
+
onOpenCallback = undefined;
|
1501
|
+
}
|
1502
|
+
|
1503
|
+
firstImage = false;
|
1504
|
+
}
|
1505
|
+
isResizing = false;
|
1506
|
+
}
|
1507
|
+
);
|
1508
|
+
|
1509
|
+
newPanel.css({'z-index': '2', opacity: 1});
|
1510
|
+
oldPanel.css('z-index', '1');
|
1511
|
+
|
1512
|
+
newPanel.fadeIn(options.popupResizeTime, function(){
|
1513
|
+
oldPanel.css('display', 'none');
|
1514
|
+
if (infoPanel)
|
1515
|
+
setInfoPanelHeight(function(){
|
1516
|
+
if (options.autoHideInfo !== false)
|
1517
|
+
hideInfoTimeout = setTimeout(function(){ hideInfoPanel(); }, options.titleDisplayDuration);
|
1518
|
+
});
|
1519
|
+
|
1520
|
+
if (imagesCount > 1)
|
1521
|
+
{
|
1522
|
+
if (currentItemIndex < imagesCount - 1 && options.cacheImagesInBackground)
|
1523
|
+
cacheImages(currentItemIndex + 1);
|
1524
|
+
|
1525
|
+
if (isPlaying)
|
1526
|
+
startPlay();
|
1527
|
+
}
|
1528
|
+
});
|
1529
|
+
}
|
1530
|
+
$(tempImg).load(function()
|
1531
|
+
{
|
1532
|
+
if (this.width == 0)
|
1533
|
+
{
|
1534
|
+
displayError("Image error");
|
1535
|
+
return;
|
1536
|
+
}
|
1537
|
+
changeMedia($.extend({}, yoxviewApi.currentImage.media, {
|
1538
|
+
width: this.width,
|
1539
|
+
height: this.height
|
1540
|
+
}));
|
1541
|
+
})
|
1542
|
+
.error(function(){
|
1543
|
+
displayError("Image not found:<br /><span class='errorUrl'>" + this.src + "</span>");
|
1544
|
+
});
|
1545
|
+
|
1546
|
+
function loadMediaFromProvider(provider, url, availableSize, onLoad, onError)
|
1547
|
+
{
|
1548
|
+
jQuery.jsonp({
|
1549
|
+
url: (mediaProviderUrls[provider] || "http://oohembed.com/oohembed/"),
|
1550
|
+
data: jQuery.extend({
|
1551
|
+
"url" : url,
|
1552
|
+
"format": "json"
|
1553
|
+
}, availableSize),
|
1554
|
+
dataType: 'jsonp',
|
1555
|
+
callbackParameter: "callback",
|
1556
|
+
success: function(data)
|
1557
|
+
{
|
1558
|
+
var media = {
|
1559
|
+
title: data.title,
|
1560
|
+
width: data.width,
|
1561
|
+
height: data.height,
|
1562
|
+
type: data.type
|
1563
|
+
};
|
1564
|
+
|
1565
|
+
if (data.type === "video")
|
1566
|
+
{
|
1567
|
+
media.html = data.html
|
1568
|
+
.replace(/<embed /, "<embed wmode=\"transparent\" ")
|
1569
|
+
.replace(/<param/, "<param name=\"wmode\" value=\"transparent\"><param")
|
1570
|
+
.replace(/width=\"[\d]+\"/ig, "width=\"100%\"")
|
1571
|
+
.replace(/height=\"[\d]+\"/ig, "height=\"100%\"");
|
1572
|
+
}
|
1573
|
+
else if (data.type === "photo")
|
1574
|
+
{
|
1575
|
+
jQuery.extend(media, {
|
1576
|
+
src: data.url,
|
1577
|
+
alt: data.title,
|
1578
|
+
type: "image"
|
1579
|
+
});
|
1580
|
+
}
|
1581
|
+
onLoad(media);
|
1582
|
+
},
|
1583
|
+
error: function(errorSender, errorMsg){
|
1584
|
+
if (onError)
|
1585
|
+
onError(errorSender, errorMsg);
|
1586
|
+
}
|
1587
|
+
});
|
1588
|
+
};
|
1589
|
+
|
1590
|
+
function loadAndDisplayMedia(media)
|
1591
|
+
{
|
1592
|
+
try
|
1593
|
+
{
|
1594
|
+
if (!media)
|
1595
|
+
throw("Error: Media is unavailable.");
|
1596
|
+
|
1597
|
+
if (!media.type || media.type === "image")
|
1598
|
+
{
|
1599
|
+
// Resets the src attribute for the image - avoids a rendering problem in Chrome.
|
1600
|
+
// $.opacity is tested so this isn't applied in IE (up to IE8),
|
1601
|
+
// since it creates a problem with the image's fading:
|
1602
|
+
if ($.support.opacity)
|
1603
|
+
tempImg.src = "";
|
1604
|
+
|
1605
|
+
tempImg.src = media.src;
|
1606
|
+
}
|
1607
|
+
else
|
1608
|
+
{
|
1609
|
+
if (!media.loaded)
|
1610
|
+
{
|
1611
|
+
loadMedia(
|
1612
|
+
media,
|
1613
|
+
function(loadedMedia){
|
1614
|
+
changeMedia(loadedMedia);
|
1615
|
+
},
|
1616
|
+
function(errorSender)
|
1617
|
+
{
|
1618
|
+
displayError("Error getting data from:<br /><span class='errorUrl'>" + errorSender.data.url + "</span>");
|
1619
|
+
}
|
1620
|
+
);
|
1621
|
+
}
|
1622
|
+
else
|
1623
|
+
changeMedia(yoxviewApi.currentImage.media);
|
1624
|
+
}
|
1625
|
+
}
|
1626
|
+
catch(error)
|
1627
|
+
{
|
1628
|
+
displayError(error);
|
1629
|
+
}
|
1630
|
+
}
|
1631
|
+
function loadMedia(media, onLoad, onError)
|
1632
|
+
{
|
1633
|
+
if (!media.type || media.type !== "image")
|
1634
|
+
{
|
1635
|
+
loadMediaFromProvider(
|
1636
|
+
media.provider,
|
1637
|
+
media.url,
|
1638
|
+
options.videoSize,
|
1639
|
+
function(mediaData){
|
1640
|
+
$.extend(media, mediaData, {loaded: true});
|
1641
|
+
if (onLoad)
|
1642
|
+
onLoad(media);
|
1643
|
+
},
|
1644
|
+
onError
|
1645
|
+
);
|
1646
|
+
}
|
1647
|
+
}
|
1648
|
+
function displayError(errorMsg)
|
1649
|
+
{
|
1650
|
+
changeMedia({
|
1651
|
+
html: "<span class='yoxview_error'>" + errorMsg + "</span>",
|
1652
|
+
width: 500,
|
1653
|
+
height: 300,
|
1654
|
+
type: "error",
|
1655
|
+
title: ""
|
1656
|
+
});
|
1657
|
+
}
|
1658
|
+
this.unload = function(){
|
1659
|
+
jQuery.each(views, function(i, view){
|
1660
|
+
var $view = $(view);
|
1661
|
+
$view.undelegate("a", "click.yoxview")
|
1662
|
+
.removeData("yoxview")
|
1663
|
+
.yoxthumbs("unload", "yoxview");
|
1664
|
+
});
|
1665
|
+
|
1666
|
+
$(window).unbind(".yoxview");
|
1667
|
+
|
1668
|
+
if (popup){
|
1669
|
+
popupWrap.remove();
|
1670
|
+
popup = undefined;
|
1671
|
+
}
|
1672
|
+
};
|
1673
|
+
}
|