spree_slider 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/Gemfile +13 -6
- data/Versionfile +1 -9
- data/app/models/spree/slide.rb +1 -1
- data/app/overrides/spree/admin/configurations/index/add_slides_to_admin_configurations_menu.html.erb.deface +5 -0
- data/app/overrides/spree/admin/shared/_configuration_menu/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface +2 -0
- data/app/overrides/spree/home/index/add_slider.html.erb.deface +4 -0
- data/app/overrides/spree/layouts/spree_application/add_slider.html.erb.deface +2 -0
- data/app/views/spree/admin/slides/_form.html.erb +4 -1
- data/app/views/spree/admin/slides/index.html.erb +2 -0
- data/app/views/spree/admin/slides/show.html.erb +6 -0
- data/config/locales/de.yml +3 -0
- data/config/locales/en.yml +2 -4
- data/config/locales/es.yml +3 -0
- data/config/locales/nl-NL.yml +3 -0
- data/config/locales/nl.yml +3 -0
- data/db/migrate/20120816192758_add_position_to_slides.rb +5 -0
- data/lib/generators/spree_slider/install_simple_carousel_generator.rb +30 -0
- data/lib/generators/spree_slider/templates/anything_slider.html.erb +1 -1
- data/lib/generators/spree_slider/templates/nivo_slider.html.erb +2 -2
- data/lib/generators/spree_slider/templates/simple_carousel_slider.html.erb +15 -0
- data/lib/spree_slider/engine.rb +2 -3
- data/spec/spec_helper.rb +12 -23
- data/spree_slider.gemspec +2 -8
- data/vendor/assets/simple-carousel/readme.txt +6 -0
- data/vendor/assets/simple-carousel/simple.carousel.js +144 -0
- data/vendor/assets/simple-carousel/simple.carousel.slider.js +14 -0
- metadata +18 -88
- data/Gemfile.lock +0 -175
- data/app/overrides/add_slider_to_layout.rb +0 -8
- data/app/overrides/add_slides_to_admin_configurations_menu.rb +0 -9
- data/app/overrides/add_slides_to_admin_configurations_sidebar_menu.rb +0 -7
- data/app/views/spree/home/index.html.erb +0 -14
- data/vendor/assets/anything-slider/demos.html +0 -740
- data/vendor/assets/anything-slider/demos/colorbox/border.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/colorbox.css +0 -62
- data/vendor/assets/anything-slider/demos/colorbox/controls.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomCenter.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopCenter.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox-min.js +0 -4
- data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox.js +0 -769
- data/vendor/assets/anything-slider/demos/colorbox/loading.gif +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/loading_background.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/overlay.png +0 -0
- data/vendor/assets/anything-slider/demos/css/page.css +0 -148
- data/vendor/assets/anything-slider/demos/images/251356.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/apple-touch-icon.png +0 -0
- data/vendor/assets/anything-slider/demos/images/favicon.ico +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-civil-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-civil-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-env-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-env-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-tele-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-tele-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-civil-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-civil-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-env-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-env-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/js/demo.js +0 -132
- data/vendor/assets/anything-slider/demos/video/movie.mp4 +0 -0
- data/vendor/assets/anything-slider/demos/video/movie.ogg +0 -0
- data/vendor/assets/anything-slider/demos/video/movie.webm +0 -0
- data/vendor/assets/anything-slider/expand.html +0 -97
- data/vendor/assets/anything-slider/index.html +0 -470
- data/vendor/assets/anything-slider/simple.html +0 -79
- data/vendor/assets/anything-slider/video.html +0 -341
- data/vendor/assets/nivo-slider/demo/demo.html +0 -39
- data/vendor/assets/nivo-slider/demo/images/dev7logo.png +0 -0
- data/vendor/assets/nivo-slider/demo/images/nemo.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/toystory.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/up.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/walle.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/scripts/jquery-1.6.1.min.js +0 -18
- data/vendor/assets/nivo-slider/demo/style.css +0 -100
Binary file
|
@@ -1,62 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
ColorBox Core Style
|
3
|
-
The following rules are the styles that are consistant between themes.
|
4
|
-
Avoid changing this area to maintain compatability with future versions of ColorBox.
|
5
|
-
*/
|
6
|
-
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
7
|
-
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
8
|
-
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
9
|
-
#cboxContent{position:relative; overflow:hidden;}
|
10
|
-
#cboxLoadedContent{overflow:auto;}
|
11
|
-
#cboxLoadedContent iframe{display:block; width:100%; height:100%; border:0;}
|
12
|
-
#cboxTitle{margin:0;}
|
13
|
-
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
|
14
|
-
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
15
|
-
|
16
|
-
/*
|
17
|
-
Example user style
|
18
|
-
The following rules are ordered and tabbed in a way that represents the
|
19
|
-
order/nesting of the generated HTML, so that the structure easier to understand.
|
20
|
-
*/
|
21
|
-
#cboxOverlay{background:url(overlay.png) 0 0 repeat;}
|
22
|
-
#colorbox{}
|
23
|
-
#cboxTopLeft{width:21px; height:21px; background:url(controls.png) -100px 0 no-repeat;}
|
24
|
-
#cboxTopRight{width:21px; height:21px; background:url(controls.png) -129px 0 no-repeat;}
|
25
|
-
#cboxBottomLeft{width:21px; height:21px; background:url(controls.png) -100px -29px no-repeat;}
|
26
|
-
#cboxBottomRight{width:21px; height:21px; background:url(controls.png) -129px -29px no-repeat;}
|
27
|
-
#cboxMiddleLeft{width:21px; background:url(controls.png) left top repeat-y;}
|
28
|
-
#cboxMiddleRight{width:21px; background:url(controls.png) right top repeat-y;}
|
29
|
-
#cboxTopCenter{height:21px; background:url(border.png) 0 0 repeat-x;}
|
30
|
-
#cboxBottomCenter{height:21px; background:url(border.png) 0 -29px repeat-x;}
|
31
|
-
#cboxContent{background:#fff;}
|
32
|
-
#cboxLoadedContent{margin-bottom:28px;}
|
33
|
-
#cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
|
34
|
-
#cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
|
35
|
-
#cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
|
36
|
-
#cboxPrevious{position:absolute; bottom:0; left:0px; background:url(controls.png) -75px 0px no-repeat; width:25px; height:25px; text-indent:-9999px;}
|
37
|
-
#cboxPrevious.hover{background-position:-75px -25px;}
|
38
|
-
#cboxNext{position:absolute; bottom:0; left:27px; background:url(controls.png) -50px 0px no-repeat; width:25px; height:25px; text-indent:-9999px;}
|
39
|
-
#cboxNext.hover{background-position:-50px -25px;}
|
40
|
-
#cboxLoadingOverlay{background:url(loading_background.png) center center no-repeat;}
|
41
|
-
#cboxLoadingGraphic{background:url(loading.gif) center center no-repeat;}
|
42
|
-
#cboxClose{position:absolute; bottom:0; right:0; background:url(controls.png) -25px 0px no-repeat; width:25px; height:25px; text-indent:-9999px;}
|
43
|
-
#cboxClose.hover{background-position:-25px -25px;}
|
44
|
-
|
45
|
-
/*
|
46
|
-
The following fixes png-transparency for IE6.
|
47
|
-
It is also necessary for png-transparency in IE7 & IE8 to avoid 'black halos' with the fade transition
|
48
|
-
|
49
|
-
Since this method does not support CSS background-positioning, it is incompatible with CSS sprites.
|
50
|
-
Colorbox preloads navigation hover classes to account for this.
|
51
|
-
|
52
|
-
!! Important Note: AlphaImageLoader src paths are relative to the HTML document,
|
53
|
-
while regular CSS background images are relative to the CSS document.
|
54
|
-
*/
|
55
|
-
.cboxIE #cboxTopLeft{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderTopLeft.png, sizingMethod='scale');}
|
56
|
-
.cboxIE #cboxTopCenter{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderTopCenter.png, sizingMethod='scale');}
|
57
|
-
.cboxIE #cboxTopRight{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderTopRight.png, sizingMethod='scale');}
|
58
|
-
.cboxIE #cboxBottomLeft{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderBottomLeft.png, sizingMethod='scale');}
|
59
|
-
.cboxIE #cboxBottomCenter{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderBottomCenter.png, sizingMethod='scale');}
|
60
|
-
.cboxIE #cboxBottomRight{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderBottomRight.png, sizingMethod='scale');}
|
61
|
-
.cboxIE #cboxMiddleLeft{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderMiddleLeft.png, sizingMethod='scale');}
|
62
|
-
.cboxIE #cboxMiddleRight{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=internet_explorer/borderMiddleRight.png, sizingMethod='scale');}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,4 +0,0 @@
|
|
1
|
-
// ColorBox v1.3.13 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
|
2
|
-
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
|
3
|
-
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
4
|
-
(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=E=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",A=b.browser.msie&&!b.support.opacity,X=A&&b.browser.version<7,P=i+"_IE6",x,j,B,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,C,D,y,z,l,g,a,u,E,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":A?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();B=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));B.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(B,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);C=bb.height()+S.height()+s.outerHeight(e)-s.height();D=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":C,"padding-right":D}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!E&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-C,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-D,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;B[0].style.width=B[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);E=c;B[0].style.width=a.w+z+D+"px";B[0].style.height=a.h+y+C+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-D;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-C;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(o){var e="hidden";function m(t){var q,f,o,e,m=h.length,s=a.loop;d.position(t,function(){if(u){A&&p&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(m>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,m)).show();I[s||g<m-1?"show":"hide"]().html(a.next);H[s||g?"show":"hide"]().html(a.previous);q=g?h[g-1]:h[m-1];o=g<m-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){e=b.data(o,r).href||o.href;f=b.data(q,r).href||q.href;e=b.isFunction(e)?e.call(o):e;f=b.isFunction(f)?f.call(q):f;if(U(e))b("<img/>")[0].src=e;if(U(f))b("<img/>")[0].src=f}}K.hide();if(a.transition==="fade")j.fadeTo(l,1,function(){if(A)j[0].style.filter=c});else if(A)j[0].style.filter=c;n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var p,l=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(o);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:e}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==e}).css({visibility:e}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(l,0,function(){m(0)}):m(l)}};d.load=function(u){var n,c,s,q=d.prep;E=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-C:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-D:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-D;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-C;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe name='"+(new Date).getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(A?" allowtransparency='true'":"")+" style='width:100%; height:100%; border:0; display:block;'/>");c[0].src=a.href;c.appendTo(k).one(Q,function(){c[0].src="about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(A)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!E){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!E){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this)
|
@@ -1,769 +0,0 @@
|
|
1
|
-
// ColorBox v1.3.13 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
|
2
|
-
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
|
3
|
-
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
4
|
-
(function ($, window) {
|
5
|
-
|
6
|
-
var
|
7
|
-
// ColorBox Default Settings.
|
8
|
-
// See http://colorpowered.com/colorbox for details.
|
9
|
-
defaults = {
|
10
|
-
transition: "elastic",
|
11
|
-
speed: 300,
|
12
|
-
width: false,
|
13
|
-
initialWidth: "600",
|
14
|
-
innerWidth: false,
|
15
|
-
maxWidth: false,
|
16
|
-
height: false,
|
17
|
-
initialHeight: "450",
|
18
|
-
innerHeight: false,
|
19
|
-
maxHeight: false,
|
20
|
-
scalePhotos: true,
|
21
|
-
scrolling: true,
|
22
|
-
inline: false,
|
23
|
-
html: false,
|
24
|
-
iframe: false,
|
25
|
-
photo: false,
|
26
|
-
href: false,
|
27
|
-
title: false,
|
28
|
-
rel: false,
|
29
|
-
opacity: 0.9,
|
30
|
-
preloading: true,
|
31
|
-
current: "image {current} of {total}",
|
32
|
-
previous: "previous",
|
33
|
-
next: "next",
|
34
|
-
close: "close",
|
35
|
-
open: false,
|
36
|
-
returnFocus: true,
|
37
|
-
loop: true,
|
38
|
-
slideshow: false,
|
39
|
-
slideshowAuto: true,
|
40
|
-
slideshowSpeed: 2500,
|
41
|
-
slideshowStart: "start slideshow",
|
42
|
-
slideshowStop: "stop slideshow",
|
43
|
-
onOpen: false,
|
44
|
-
onLoad: false,
|
45
|
-
onComplete: false,
|
46
|
-
onCleanup: false,
|
47
|
-
onClosed: false,
|
48
|
-
overlayClose: true,
|
49
|
-
escKey: true,
|
50
|
-
arrowKey: true
|
51
|
-
},
|
52
|
-
|
53
|
-
// Abstracting the HTML and event identifiers for easy rebranding
|
54
|
-
colorbox = 'colorbox',
|
55
|
-
prefix = 'cbox',
|
56
|
-
|
57
|
-
// Events
|
58
|
-
event_open = prefix + '_open',
|
59
|
-
event_load = prefix + '_load',
|
60
|
-
event_complete = prefix + '_complete',
|
61
|
-
event_cleanup = prefix + '_cleanup',
|
62
|
-
event_closed = prefix + '_closed',
|
63
|
-
event_purge = prefix + '_purge',
|
64
|
-
event_loaded = prefix + '_loaded',
|
65
|
-
|
66
|
-
// Special Handling for IE
|
67
|
-
isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
|
68
|
-
isIE6 = isIE && $.browser.version < 7,
|
69
|
-
event_ie6 = prefix + '_IE6',
|
70
|
-
|
71
|
-
// Cached jQuery Object Variables
|
72
|
-
$overlay,
|
73
|
-
$box,
|
74
|
-
$wrap,
|
75
|
-
$content,
|
76
|
-
$topBorder,
|
77
|
-
$leftBorder,
|
78
|
-
$rightBorder,
|
79
|
-
$bottomBorder,
|
80
|
-
$related,
|
81
|
-
$window,
|
82
|
-
$loaded,
|
83
|
-
$loadingBay,
|
84
|
-
$loadingOverlay,
|
85
|
-
$title,
|
86
|
-
$current,
|
87
|
-
$slideshow,
|
88
|
-
$next,
|
89
|
-
$prev,
|
90
|
-
$close,
|
91
|
-
|
92
|
-
// Variables for cached values or use across multiple functions
|
93
|
-
interfaceHeight,
|
94
|
-
interfaceWidth,
|
95
|
-
loadedHeight,
|
96
|
-
loadedWidth,
|
97
|
-
element,
|
98
|
-
index,
|
99
|
-
settings,
|
100
|
-
open,
|
101
|
-
active,
|
102
|
-
closing = false,
|
103
|
-
|
104
|
-
publicMethod,
|
105
|
-
boxElement = prefix + 'Element';
|
106
|
-
|
107
|
-
// ****************
|
108
|
-
// HELPER FUNCTIONS
|
109
|
-
// ****************
|
110
|
-
|
111
|
-
// jQuery object generator to reduce code size
|
112
|
-
function $div(id, css) {
|
113
|
-
id = id ? ' id="' + prefix + id + '"' : '';
|
114
|
-
css = css ? ' style="' + css + '"' : '';
|
115
|
-
return $('<div' + id + css + '/>');
|
116
|
-
}
|
117
|
-
|
118
|
-
// Convert % values to pixels
|
119
|
-
function setSize(size, dimension) {
|
120
|
-
dimension = dimension === 'x' ? $window.width() : $window.height();
|
121
|
-
return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
|
122
|
-
}
|
123
|
-
|
124
|
-
// Checks an href to see if it is a photo.
|
125
|
-
// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
|
126
|
-
function isImage(url) {
|
127
|
-
return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url);
|
128
|
-
}
|
129
|
-
|
130
|
-
// Assigns function results to their respective settings. This allows functions to be used as values.
|
131
|
-
function process(settings) {
|
132
|
-
for (var i in settings) {
|
133
|
-
if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
|
134
|
-
settings[i] = settings[i].call(element);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
settings.rel = settings.rel || element.rel || 'nofollow';
|
138
|
-
settings.href = settings.href || $(element).attr('href') || $(element).attr('src');
|
139
|
-
settings.title = settings.title || element.title;
|
140
|
-
return settings;
|
141
|
-
}
|
142
|
-
|
143
|
-
function trigger(event, callback) {
|
144
|
-
if (callback) {
|
145
|
-
callback.call(element);
|
146
|
-
}
|
147
|
-
$.event.trigger(event);
|
148
|
-
}
|
149
|
-
|
150
|
-
// Slideshow functionality
|
151
|
-
function slideshow() {
|
152
|
-
var
|
153
|
-
timeOut,
|
154
|
-
className = prefix + "Slideshow_",
|
155
|
-
click = "click." + prefix,
|
156
|
-
start,
|
157
|
-
stop,
|
158
|
-
clear;
|
159
|
-
|
160
|
-
if (settings.slideshow && $related[1]) {
|
161
|
-
start = function () {
|
162
|
-
$slideshow
|
163
|
-
.text(settings.slideshowStop)
|
164
|
-
.unbind(click)
|
165
|
-
.bind(event_complete, function () {
|
166
|
-
if (index < $related.length - 1 || settings.loop) {
|
167
|
-
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
168
|
-
}
|
169
|
-
})
|
170
|
-
.bind(event_load, function () {
|
171
|
-
clearTimeout(timeOut);
|
172
|
-
})
|
173
|
-
.one(click + ' ' + event_cleanup, stop);
|
174
|
-
$box.removeClass(className + "off").addClass(className + "on");
|
175
|
-
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
176
|
-
};
|
177
|
-
|
178
|
-
stop = function () {
|
179
|
-
clearTimeout(timeOut);
|
180
|
-
$slideshow
|
181
|
-
.text(settings.slideshowStart)
|
182
|
-
.unbind([event_complete, event_load, event_cleanup, click].join(' '))
|
183
|
-
.one(click, start);
|
184
|
-
$box.removeClass(className + "on").addClass(className + "off");
|
185
|
-
};
|
186
|
-
|
187
|
-
if (settings.slideshowAuto) {
|
188
|
-
start();
|
189
|
-
} else {
|
190
|
-
stop();
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
194
|
-
|
195
|
-
function launch(elem) {
|
196
|
-
if (!closing) {
|
197
|
-
|
198
|
-
element = elem;
|
199
|
-
|
200
|
-
settings = process($.extend({}, $.data(element, colorbox)));
|
201
|
-
|
202
|
-
$related = $(element);
|
203
|
-
|
204
|
-
index = 0;
|
205
|
-
|
206
|
-
if (settings.rel !== 'nofollow') {
|
207
|
-
$related = $('.' + boxElement).filter(function () {
|
208
|
-
var relRelated = $.data(this, colorbox).rel || this.rel;
|
209
|
-
return (relRelated === settings.rel);
|
210
|
-
});
|
211
|
-
index = $related.index(element);
|
212
|
-
|
213
|
-
// Check direct calls to ColorBox.
|
214
|
-
if (index === -1) {
|
215
|
-
$related = $related.add(element);
|
216
|
-
index = $related.length - 1;
|
217
|
-
}
|
218
|
-
}
|
219
|
-
|
220
|
-
if (!open) {
|
221
|
-
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
|
222
|
-
|
223
|
-
$box.show();
|
224
|
-
|
225
|
-
if (settings.returnFocus) {
|
226
|
-
try {
|
227
|
-
element.blur();
|
228
|
-
$(element).one(event_closed, function () {
|
229
|
-
try {
|
230
|
-
this.focus();
|
231
|
-
} catch (e) {
|
232
|
-
// do nothing
|
233
|
-
}
|
234
|
-
});
|
235
|
-
} catch (e) {
|
236
|
-
// do nothing
|
237
|
-
}
|
238
|
-
}
|
239
|
-
|
240
|
-
// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
|
241
|
-
$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
|
242
|
-
|
243
|
-
// Opens inital empty ColorBox prior to content being loaded.
|
244
|
-
settings.w = setSize(settings.initialWidth, 'x');
|
245
|
-
settings.h = setSize(settings.initialHeight, 'y');
|
246
|
-
publicMethod.position(0);
|
247
|
-
|
248
|
-
if (isIE6) {
|
249
|
-
$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
|
250
|
-
$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
|
251
|
-
}).trigger('scroll.' + event_ie6);
|
252
|
-
}
|
253
|
-
|
254
|
-
trigger(event_open, settings.onOpen);
|
255
|
-
|
256
|
-
$current.add($prev).add($next).add($slideshow).add($title).hide();
|
257
|
-
|
258
|
-
$close.html(settings.close).show();
|
259
|
-
}
|
260
|
-
|
261
|
-
publicMethod.load(true);
|
262
|
-
}
|
263
|
-
}
|
264
|
-
|
265
|
-
// ****************
|
266
|
-
// PUBLIC FUNCTIONS
|
267
|
-
// Usage format: $.fn.colorbox.close();
|
268
|
-
// Usage from within an iframe: parent.$.fn.colorbox.close();
|
269
|
-
// ****************
|
270
|
-
|
271
|
-
publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
|
272
|
-
var $this = this, autoOpen;
|
273
|
-
|
274
|
-
if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
|
275
|
-
return $this;
|
276
|
-
}
|
277
|
-
|
278
|
-
options = options || {};
|
279
|
-
|
280
|
-
if (callback) {
|
281
|
-
options.onComplete = callback;
|
282
|
-
}
|
283
|
-
|
284
|
-
if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
|
285
|
-
$this = $('<a/>');
|
286
|
-
options.open = true; // assume an immediate open
|
287
|
-
}
|
288
|
-
|
289
|
-
$this.each(function () {
|
290
|
-
$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
|
291
|
-
$(this).addClass(boxElement);
|
292
|
-
});
|
293
|
-
|
294
|
-
autoOpen = options.open;
|
295
|
-
|
296
|
-
if ($.isFunction(autoOpen)) {
|
297
|
-
autoOpen = autoOpen.call($this);
|
298
|
-
}
|
299
|
-
|
300
|
-
if (autoOpen) {
|
301
|
-
launch($this[0]);
|
302
|
-
}
|
303
|
-
|
304
|
-
return $this;
|
305
|
-
};
|
306
|
-
|
307
|
-
// Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
|
308
|
-
// This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
|
309
|
-
// having to run once, instead of each time colorbox is opened.
|
310
|
-
publicMethod.init = function () {
|
311
|
-
// Create & Append jQuery Objects
|
312
|
-
$window = $(window);
|
313
|
-
$box = $div().attr({id: colorbox, 'class': isIE ? prefix + 'IE' : ''});
|
314
|
-
$overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
|
315
|
-
|
316
|
-
$wrap = $div("Wrapper");
|
317
|
-
$content = $div("Content").append(
|
318
|
-
$loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
|
319
|
-
$loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
|
320
|
-
$title = $div("Title"),
|
321
|
-
$current = $div("Current"),
|
322
|
-
$next = $div("Next"),
|
323
|
-
$prev = $div("Previous"),
|
324
|
-
$slideshow = $div("Slideshow").bind(event_open, slideshow),
|
325
|
-
$close = $div("Close")
|
326
|
-
);
|
327
|
-
$wrap.append( // The 3x3 Grid that makes up ColorBox
|
328
|
-
$div().append(
|
329
|
-
$div("TopLeft"),
|
330
|
-
$topBorder = $div("TopCenter"),
|
331
|
-
$div("TopRight")
|
332
|
-
),
|
333
|
-
$div(false, 'clear:left').append(
|
334
|
-
$leftBorder = $div("MiddleLeft"),
|
335
|
-
$content,
|
336
|
-
$rightBorder = $div("MiddleRight")
|
337
|
-
),
|
338
|
-
$div(false, 'clear:left').append(
|
339
|
-
$div("BottomLeft"),
|
340
|
-
$bottomBorder = $div("BottomCenter"),
|
341
|
-
$div("BottomRight")
|
342
|
-
)
|
343
|
-
).children().children().css({'float': 'left'});
|
344
|
-
|
345
|
-
$loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
|
346
|
-
|
347
|
-
$('body').prepend($overlay, $box.append($wrap, $loadingBay));
|
348
|
-
|
349
|
-
$content.children()
|
350
|
-
.hover(function () {
|
351
|
-
$(this).addClass('hover');
|
352
|
-
}, function () {
|
353
|
-
$(this).removeClass('hover');
|
354
|
-
}).addClass('hover');
|
355
|
-
|
356
|
-
// Cache values needed for size calculations
|
357
|
-
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
|
358
|
-
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
|
359
|
-
loadedHeight = $loaded.outerHeight(true);
|
360
|
-
loadedWidth = $loaded.outerWidth(true);
|
361
|
-
|
362
|
-
// Setting padding to remove the need to do size conversions during the animation step.
|
363
|
-
$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
|
364
|
-
|
365
|
-
// Setup button events.
|
366
|
-
$next.click(publicMethod.next);
|
367
|
-
$prev.click(publicMethod.prev);
|
368
|
-
$close.click(publicMethod.close);
|
369
|
-
|
370
|
-
// Adding the 'hover' class allowed the browser to load the hover-state
|
371
|
-
// background graphics. The class can now can be removed.
|
372
|
-
$content.children().removeClass('hover');
|
373
|
-
|
374
|
-
$('.' + boxElement).live('click', function (e) {
|
375
|
-
// checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
|
376
|
-
if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
|
377
|
-
e.preventDefault();
|
378
|
-
launch(this);
|
379
|
-
}
|
380
|
-
});
|
381
|
-
|
382
|
-
$overlay.click(function () {
|
383
|
-
if (settings.overlayClose) {
|
384
|
-
publicMethod.close();
|
385
|
-
}
|
386
|
-
});
|
387
|
-
|
388
|
-
// Set Navigation Key Bindings
|
389
|
-
$(document).bind("keydown", function (e) {
|
390
|
-
if (open && settings.escKey && e.keyCode === 27) {
|
391
|
-
e.preventDefault();
|
392
|
-
publicMethod.close();
|
393
|
-
}
|
394
|
-
if (open && settings.arrowKey && !active && $related[1]) {
|
395
|
-
if (e.keyCode === 37 && (index || settings.loop)) {
|
396
|
-
e.preventDefault();
|
397
|
-
$prev.click();
|
398
|
-
} else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) {
|
399
|
-
e.preventDefault();
|
400
|
-
$next.click();
|
401
|
-
}
|
402
|
-
}
|
403
|
-
});
|
404
|
-
};
|
405
|
-
|
406
|
-
publicMethod.remove = function () {
|
407
|
-
$box.add($overlay).remove();
|
408
|
-
$('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
|
409
|
-
};
|
410
|
-
|
411
|
-
publicMethod.position = function (speed, loadedCallback) {
|
412
|
-
var
|
413
|
-
animate_speed,
|
414
|
-
// keeps the top and left positions within the browser's viewport.
|
415
|
-
posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
|
416
|
-
posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
|
417
|
-
|
418
|
-
// setting the speed to 0 to reduce the delay between same-sized content.
|
419
|
-
animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
|
420
|
-
|
421
|
-
// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
|
422
|
-
// but it has to be shrank down around the size of div#colorbox when it's done. If not,
|
423
|
-
// it can invoke an obscure IE bug when using iframes.
|
424
|
-
$wrap[0].style.width = $wrap[0].style.height = "9999px";
|
425
|
-
|
426
|
-
function modalDimensions(that) {
|
427
|
-
// loading overlay height has to be explicitly set for IE6.
|
428
|
-
$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
|
429
|
-
$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
|
430
|
-
}
|
431
|
-
|
432
|
-
$box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
|
433
|
-
duration: animate_speed,
|
434
|
-
complete: function () {
|
435
|
-
modalDimensions(this);
|
436
|
-
|
437
|
-
active = false;
|
438
|
-
|
439
|
-
// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
|
440
|
-
$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
|
441
|
-
$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
|
442
|
-
|
443
|
-
if (loadedCallback) {
|
444
|
-
loadedCallback();
|
445
|
-
}
|
446
|
-
},
|
447
|
-
step: function () {
|
448
|
-
modalDimensions(this);
|
449
|
-
}
|
450
|
-
});
|
451
|
-
};
|
452
|
-
|
453
|
-
publicMethod.resize = function (options) {
|
454
|
-
if (open) {
|
455
|
-
options = options || {};
|
456
|
-
|
457
|
-
if (options.width) {
|
458
|
-
settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
|
459
|
-
}
|
460
|
-
if (options.innerWidth) {
|
461
|
-
settings.w = setSize(options.innerWidth, 'x');
|
462
|
-
}
|
463
|
-
$loaded.css({width: settings.w});
|
464
|
-
|
465
|
-
if (options.height) {
|
466
|
-
settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
|
467
|
-
}
|
468
|
-
if (options.innerHeight) {
|
469
|
-
settings.h = setSize(options.innerHeight, 'y');
|
470
|
-
}
|
471
|
-
if (!options.innerHeight && !options.height) {
|
472
|
-
var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
|
473
|
-
settings.h = $child.height();
|
474
|
-
$child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
|
475
|
-
}
|
476
|
-
$loaded.css({height: settings.h});
|
477
|
-
|
478
|
-
publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
|
479
|
-
}
|
480
|
-
};
|
481
|
-
|
482
|
-
publicMethod.prep = function (object) {
|
483
|
-
if (!open) {
|
484
|
-
return;
|
485
|
-
}
|
486
|
-
|
487
|
-
var photo,
|
488
|
-
speed = settings.transition === "none" ? 0 : settings.speed;
|
489
|
-
|
490
|
-
$window.unbind('resize.' + prefix);
|
491
|
-
$loaded.remove();
|
492
|
-
$loaded = $div('LoadedContent').html(object);
|
493
|
-
|
494
|
-
function getWidth() {
|
495
|
-
settings.w = settings.w || $loaded.width();
|
496
|
-
settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
|
497
|
-
return settings.w;
|
498
|
-
}
|
499
|
-
function getHeight() {
|
500
|
-
settings.h = settings.h || $loaded.height();
|
501
|
-
settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
|
502
|
-
return settings.h;
|
503
|
-
}
|
504
|
-
|
505
|
-
$loaded.hide()
|
506
|
-
.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
|
507
|
-
.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
|
508
|
-
.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
|
509
|
-
.prependTo($content);
|
510
|
-
|
511
|
-
$loadingBay.hide();
|
512
|
-
|
513
|
-
// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
|
514
|
-
$('#' + prefix + 'Photo').css({cssFloat: 'none', marginLeft: 'auto', marginRight: 'auto'});
|
515
|
-
|
516
|
-
// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
|
517
|
-
if (isIE6) {
|
518
|
-
$('select').not($box.find('select')).filter(function () {
|
519
|
-
return this.style.visibility !== 'hidden';
|
520
|
-
}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
|
521
|
-
this.style.visibility = 'inherit';
|
522
|
-
});
|
523
|
-
}
|
524
|
-
|
525
|
-
function setPosition(s) {
|
526
|
-
var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;
|
527
|
-
publicMethod.position(s, function () {
|
528
|
-
function defilter() {
|
529
|
-
if (isIE) {
|
530
|
-
//IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
|
531
|
-
$box[0].style.filter = false;
|
532
|
-
}
|
533
|
-
}
|
534
|
-
|
535
|
-
if (!open) {
|
536
|
-
return;
|
537
|
-
}
|
538
|
-
|
539
|
-
if (isIE) {
|
540
|
-
//This fadeIn helps the bicubic resampling to kick-in.
|
541
|
-
if (photo) {
|
542
|
-
$loaded.fadeIn(100);
|
543
|
-
}
|
544
|
-
}
|
545
|
-
|
546
|
-
$loaded.show();
|
547
|
-
|
548
|
-
trigger(event_loaded);
|
549
|
-
|
550
|
-
$title.show().html(settings.title);
|
551
|
-
|
552
|
-
if (total > 1) { // handle grouping
|
553
|
-
if (typeof settings.current === "string") {
|
554
|
-
$current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
|
555
|
-
}
|
556
|
-
|
557
|
-
$next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
|
558
|
-
$prev[(loop || index) ? "show" : "hide"]().html(settings.previous);
|
559
|
-
|
560
|
-
prev = index ? $related[index - 1] : $related[total - 1];
|
561
|
-
next = index < total - 1 ? $related[index + 1] : $related[0];
|
562
|
-
|
563
|
-
if (settings.slideshow) {
|
564
|
-
$slideshow.show();
|
565
|
-
}
|
566
|
-
|
567
|
-
// Preloads images within a rel group
|
568
|
-
if (settings.preloading) {
|
569
|
-
nextSrc = $.data(next, colorbox).href || next.href;
|
570
|
-
prevSrc = $.data(prev, colorbox).href || prev.href;
|
571
|
-
|
572
|
-
nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
|
573
|
-
prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
|
574
|
-
|
575
|
-
if (isImage(nextSrc)) {
|
576
|
-
$('<img/>')[0].src = nextSrc;
|
577
|
-
}
|
578
|
-
|
579
|
-
if (isImage(prevSrc)) {
|
580
|
-
$('<img/>')[0].src = prevSrc;
|
581
|
-
}
|
582
|
-
}
|
583
|
-
}
|
584
|
-
|
585
|
-
$loadingOverlay.hide();
|
586
|
-
|
587
|
-
if (settings.transition === 'fade') {
|
588
|
-
$box.fadeTo(speed, 1, function () {
|
589
|
-
defilter();
|
590
|
-
});
|
591
|
-
} else {
|
592
|
-
defilter();
|
593
|
-
}
|
594
|
-
|
595
|
-
$window.bind('resize.' + prefix, function () {
|
596
|
-
publicMethod.position(0);
|
597
|
-
});
|
598
|
-
|
599
|
-
trigger(event_complete, settings.onComplete);
|
600
|
-
});
|
601
|
-
}
|
602
|
-
|
603
|
-
if (settings.transition === 'fade') {
|
604
|
-
$box.fadeTo(speed, 0, function () {
|
605
|
-
setPosition(0);
|
606
|
-
});
|
607
|
-
} else {
|
608
|
-
setPosition(speed);
|
609
|
-
}
|
610
|
-
};
|
611
|
-
|
612
|
-
publicMethod.load = function (launched) {
|
613
|
-
var href, img, setResize, prep = publicMethod.prep;
|
614
|
-
|
615
|
-
active = true;
|
616
|
-
element = $related[index];
|
617
|
-
|
618
|
-
if (!launched) {
|
619
|
-
settings = process($.extend({}, $.data(element, colorbox)));
|
620
|
-
}
|
621
|
-
|
622
|
-
trigger(event_purge);
|
623
|
-
|
624
|
-
trigger(event_load, settings.onLoad);
|
625
|
-
|
626
|
-
settings.h = settings.height ?
|
627
|
-
setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
|
628
|
-
settings.innerHeight && setSize(settings.innerHeight, 'y');
|
629
|
-
|
630
|
-
settings.w = settings.width ?
|
631
|
-
setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
|
632
|
-
settings.innerWidth && setSize(settings.innerWidth, 'x');
|
633
|
-
|
634
|
-
// Sets the minimum dimensions for use in image scaling
|
635
|
-
settings.mw = settings.w;
|
636
|
-
settings.mh = settings.h;
|
637
|
-
|
638
|
-
// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
|
639
|
-
// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
|
640
|
-
if (settings.maxWidth) {
|
641
|
-
settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
|
642
|
-
settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
|
643
|
-
}
|
644
|
-
if (settings.maxHeight) {
|
645
|
-
settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
|
646
|
-
settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
|
647
|
-
}
|
648
|
-
|
649
|
-
href = settings.href;
|
650
|
-
|
651
|
-
$loadingOverlay.show();
|
652
|
-
|
653
|
-
if (settings.inline) {
|
654
|
-
// Inserts an empty placeholder where inline content is being pulled from.
|
655
|
-
// An event is bound to put inline content back when ColorBox closes or loads new content.
|
656
|
-
$div().hide().insertBefore($(href)[0]).one(event_purge, function () {
|
657
|
-
$(this).replaceWith($loaded.children());
|
658
|
-
});
|
659
|
-
prep($(href));
|
660
|
-
} else if (settings.iframe) {
|
661
|
-
// IFrame element won't be added to the DOM until it is ready to be displayed,
|
662
|
-
// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
|
663
|
-
$box.one(event_loaded, function () {
|
664
|
-
var $iframe = $("<iframe name='" + new Date().getTime() + "' frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + " style='width:100%; height:100%; border:0; display:block;'/>");
|
665
|
-
$iframe[0].src = settings.href;
|
666
|
-
$iframe.appendTo($loaded).one(event_purge, function () {
|
667
|
-
$iframe[0].src = 'about:blank';
|
668
|
-
});
|
669
|
-
});
|
670
|
-
|
671
|
-
prep(" ");
|
672
|
-
} else if (settings.html) {
|
673
|
-
prep(settings.html);
|
674
|
-
} else if (isImage(href)) {
|
675
|
-
img = new Image();
|
676
|
-
img.onload = function () {
|
677
|
-
var percent;
|
678
|
-
img.onload = null;
|
679
|
-
img.id = prefix + 'Photo';
|
680
|
-
$(img).css({border: 'none', display: 'block', cssFloat: 'left'});
|
681
|
-
if (settings.scalePhotos) {
|
682
|
-
$(img).css({ width: '100%', height: '100%' });
|
683
|
-
|
684
|
-
}
|
685
|
-
|
686
|
-
|
687
|
-
if (settings.h && !settings.scalePhotos) {
|
688
|
-
img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px';
|
689
|
-
}
|
690
|
-
|
691
|
-
if ($related[1] && (index < $related.length - 1 || settings.loop)) {
|
692
|
-
$(img).css({cursor: 'pointer'}).click(publicMethod.next);
|
693
|
-
}
|
694
|
-
|
695
|
-
if (isIE) {
|
696
|
-
img.style.msInterpolationMode = 'bicubic';
|
697
|
-
}
|
698
|
-
|
699
|
-
setTimeout(function () { // Chrome will sometimes report a 0 by 0 size if there isn't pause in execution
|
700
|
-
prep(img);
|
701
|
-
}, 1);
|
702
|
-
};
|
703
|
-
|
704
|
-
setTimeout(function () { // Opera 10.6+ will sometimes load the src before the onload function is set
|
705
|
-
img.src = href;
|
706
|
-
}, 1);
|
707
|
-
} else if (href) {
|
708
|
-
$loadingBay.load(href, function (data, status, xhr) {
|
709
|
-
prep(status === 'error' ? 'Request unsuccessful: ' + xhr.statusText : $(this).children());
|
710
|
-
});
|
711
|
-
}
|
712
|
-
};
|
713
|
-
|
714
|
-
// Navigates to the next page/image in a set.
|
715
|
-
publicMethod.next = function () {
|
716
|
-
if (!active) {
|
717
|
-
index = index < $related.length - 1 ? index + 1 : 0;
|
718
|
-
publicMethod.load();
|
719
|
-
}
|
720
|
-
};
|
721
|
-
|
722
|
-
publicMethod.prev = function () {
|
723
|
-
if (!active) {
|
724
|
-
index = index ? index - 1 : $related.length - 1;
|
725
|
-
publicMethod.load();
|
726
|
-
}
|
727
|
-
};
|
728
|
-
|
729
|
-
// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
|
730
|
-
publicMethod.close = function () {
|
731
|
-
if (open && !closing) {
|
732
|
-
closing = true;
|
733
|
-
|
734
|
-
open = false;
|
735
|
-
|
736
|
-
trigger(event_cleanup, settings.onCleanup);
|
737
|
-
|
738
|
-
$window.unbind('.' + prefix + ' .' + event_ie6);
|
739
|
-
|
740
|
-
$overlay.fadeTo('fast', 0);
|
741
|
-
|
742
|
-
$box.stop().fadeTo('fast', 0, function () {
|
743
|
-
|
744
|
-
trigger(event_purge);
|
745
|
-
|
746
|
-
$loaded.remove();
|
747
|
-
|
748
|
-
$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
|
749
|
-
|
750
|
-
setTimeout(function () {
|
751
|
-
closing = false;
|
752
|
-
trigger(event_closed, settings.onClosed);
|
753
|
-
}, 1);
|
754
|
-
});
|
755
|
-
}
|
756
|
-
};
|
757
|
-
|
758
|
-
// A method for fetching the current element ColorBox is referencing.
|
759
|
-
// returns a jQuery object.
|
760
|
-
publicMethod.element = function () {
|
761
|
-
return $(element);
|
762
|
-
};
|
763
|
-
|
764
|
-
publicMethod.settings = defaults;
|
765
|
-
|
766
|
-
// Initializes ColorBox when the DOM has loaded
|
767
|
-
$(publicMethod.init);
|
768
|
-
|
769
|
-
}(jQuery, this));
|