From e543ec6eb6351171322630a19b6974c47729bc35 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 13 Jun 2012 22:06:22 +0200 Subject: [PATCH 1/8] show username of the body who shares in the summary --- apps/calendar/ajax/events.php | 1 - apps/calendar/lib/app.php | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index 56fa51aaff..b0c5587633 100644 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -27,7 +27,6 @@ else { $start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']); $end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']); $events = OC_Calendar_App::getrequestedEvents($calendar_id, $start, $end); - $output = array(); foreach($events as $event){ $output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end)); diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index 2cd28c0f78..e0035c4df8 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -331,26 +331,29 @@ class OC_Calendar_App{ */ public static function getrequestedEvents($calendarid, $start, $end){ $events = array(); - if($calendarid == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){ + if($calendarid == 'shared_rw' || $calendarid == 'shared_r'){ $calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); foreach($calendars as $calendar){ $calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end); + foreach($calendarevents as $event){ + $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')'; + } $events = array_merge($events, $calendarevents); } $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); foreach($singleevents as $singleevent){ $event = OC_Calendar_Object::find($singleevent['eventid']); + $event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')'; $events[] = $event; } }else{ - $calendar_id = $_GET['calendar_id']; - if (is_numeric($calendar_id)) { - $calendar = self::getCalendar($calendar_id); + if (is_numeric($calendarid)) { + $calendar = self::getCalendar($calendarid); OCP\Response::enableCaching(0); OCP\Response::setETagHeader($calendar['ctag']); - $events = OC_Calendar_Object::allInPeriod($calendar_id, $start, $end); + $events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end); } else { - OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendar_id, 'events' => &$events)); + OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events)); } } return $events; From 4ff11308a33289e334caf9e95ef152fe0693b69a Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 13 Jun 2012 22:12:54 +0200 Subject: [PATCH 2/8] fix a ui bug for calendar sharing --- apps/calendar/templates/part.showevent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/templates/part.showevent.php b/apps/calendar/templates/part.showevent.php index 3646baf5bb..8d33d6b890 100644 --- a/apps/calendar/templates/part.showevent.php +++ b/apps/calendar/templates/part.showevent.php @@ -33,7 +33,7 @@ - - - + t('of') . ' ' . $calendar['userid']; + ?>   From f9af0ef7034c0e781a2ad17f17383ac7359a9c3c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 13 Jun 2012 22:20:43 +0200 Subject: [PATCH 4/8] fix another ui bug of calendar --- apps/calendar/templates/part.showevent.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/calendar/templates/part.showevent.php b/apps/calendar/templates/part.showevent.php index 416b00f9a3..a4c862ad41 100644 --- a/apps/calendar/templates/part.showevent.php +++ b/apps/calendar/templates/part.showevent.php @@ -19,12 +19,14 @@ t("Category");?>: t('No categories selected'); }else{ - echo ''; + echo '
    '; + foreach($_['categories'] as $categorie){ + echo '
  • ' . $categorie . '
  • '; + } + echo '
'; } ?> From b0420ee8bec3146273e633b179f7e10423849434 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 14 Jun 2012 12:01:16 +0200 Subject: [PATCH 5/8] suppress warning if /dev/urandom is not readable (bug #997) --- 3rdparty/phpass/PasswordHash.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/phpass/PasswordHash.php b/3rdparty/phpass/PasswordHash.php index 12958c7f19..84447b277d 100644 --- a/3rdparty/phpass/PasswordHash.php +++ b/3rdparty/phpass/PasswordHash.php @@ -48,7 +48,7 @@ class PasswordHash { function get_random_bytes($count) { $output = ''; - if (is_readable('/dev/urandom') && + if (@is_readable('/dev/urandom') && ($fh = @fopen('/dev/urandom', 'rb'))) { $output = fread($fh, $count); fclose($fh); From 4a47fa255d12fc4cfcd3b675d4664398e0a72730 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 14 Jun 2012 13:13:17 +0200 Subject: [PATCH 6/8] xss vulnerability fixed for fancybox image viewer --- .../js/jquery.fancybox-1.3.4.pack.js | 805 +++++++++++++++++- apps/files_imageviewer/js/lightbox.js | 1 + 2 files changed, 777 insertions(+), 29 deletions(-) diff --git a/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js b/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js index 1373ed0838..d5b72d8640 100644 --- a/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js +++ b/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js @@ -15,32 +15,779 @@ * http://www.gnu.org/licenses/gpl.html */ -;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("
")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('

The requested content cannot be loaded.
Please try again later.

'); -F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)|| -c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick= -false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('
').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel", -function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='';P="";b.each(e.swf,function(x,H){C+='';P+=" "+x+'="'+H+'"'});C+='";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win== -"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('
');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor, -opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length? -d.titlePosition=="float"?'
'+s+'
':'
'+s+"
":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding}); -y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height== -i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents()); -f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode== -37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto"); -s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('').appendTo(j); -f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c); -j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type== -"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"), -10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)}; -b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k= -0,C=a.length;ko.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+ -1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h= -true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1; -b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5- -d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
'),t=b('
'),u=b('
'),f=b('
'));D=b('
').append('
').appendTo(f); -D.append(j=b('
'),E=b(''),n=b('
'),z=b(''),A=b(''));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()}); -b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('').prependTo(D)}}}; -b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing", -easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery); \ No newline at end of file +; +(function(b) { + var m, t, u, f, D, j, E, n, z, A, q = 0, e = {}, o = [], p = 0, d = {}, l = [], G = null, v = new Image, J = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, W = /[^\.]\.(swf)\s*$/i, K, L = 1, y = 0, s = "", r, i, h = false, B = b + .extend(b("
")[0], { + prop : 0 + }), M = b.browser.msie && b.browser.version < 7 + && !window.XMLHttpRequest, N = function() { + t.hide(); + v.onerror = v.onload = null; + G && G.abort(); + m.empty() + }, O = function() { + if (false === e.onError(o, q, e)) { + t.hide(); + h = false + } else { + e.titleShow = false; + e.width = "auto"; + e.height = "auto"; + m + .html('

The requested content cannot be loaded.
Please try again later.

'); + F() + } + }, I = function() { + var a = o[q], c, g, k, C, P, w; + N(); + e = b.extend({}, b.fn.fancybox.defaults, + typeof b(a).data("fancybox") == "undefined" ? e : b(a).data( + "fancybox")); + w = e.onStart(o, q, e); + if (w === false) + h = false; + else { + if (typeof w == "object") + e = b.extend(e, w); + k = e.title || (a.nodeName ? b(a).attr("title") : a.title) || ""; + k = k.replace(//, ">"); + if (a.nodeName && !e.orig) + e.orig = b(a).children("img:first").length ? b(a).children( + "img:first") : b(a); + if (k === "" && e.orig && e.titleFromAlt) + k = e.orig.attr("alt"); + c = e.href || (a.nodeName ? b(a).attr("href") : a.href) || null; + if (/^(?:javascript)/i.test(c) || c == "#") + c = null; + if (e.type) { + g = e.type; + if (!c) + c = e.content + } else if (e.content) + g = "html"; + else if (c) + g = c.match(J) ? "image" : c.match(W) ? "swf" : b(a).hasClass( + "iframe") ? "iframe" : c.indexOf("#") === 0 ? "inline" + : "ajax"; + if (g) { + if (g == "inline") { + a = c.substr(c.indexOf("#")); + g = b(a).length > 0 ? "inline" : "ajax" + } + e.type = g; + e.href = c; + e.title = k; + if (e.autoDimensions) + if (e.type == "html" || e.type == "inline" + || e.type == "ajax") { + e.width = "auto"; + e.height = "auto" + } else + e.autoDimensions = false; + if (e.modal) { + e.overlayShow = true; + e.hideOnOverlayClick = false; + e.hideOnContentClick = false; + e.enableEscapeButton = false; + e.showCloseButton = false + } + e.padding = parseInt(e.padding, 10); + e.margin = parseInt(e.margin, 10); + m.css("padding", e.padding + e.margin); + b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind( + "fancybox-change", function() { + b(this).replaceWith(j.children()) + }); + switch (g) { + case "html": + m.html(e.content); + F(); + break; + case "inline": + if (b(a).parent().is("#fancybox-content") === true) { + h = false; + break + } + b('
').hide() + .insertBefore(b(a)).bind("fancybox-cleanup", + function() { + b(this).replaceWith(j.children()) + }).bind("fancybox-cancel", function() { + b(this).replaceWith(m.children()) + }); + b(a).appendTo(m); + F(); + break; + case "image": + h = false; + b.fancybox.showActivity(); + v = new Image; + v.onerror = function() { + O() + }; + v.onload = function() { + h = true; + v.onerror = v.onload = null; + e.width = v.width; + e.height = v.height; + b("").attr({ + id : "fancybox-img", + src : v.src, + alt : e.title + }).appendTo(m); + Q() + }; + v.src = c; + break; + case "swf": + e.scrolling = "no"; + C = ''; + P = ""; + b.each(e.swf, function(x, H) { + C += ''; + P += " " + x + '="' + H + '"' + }); + C += '"; + m.html(C); + F(); + break; + case "ajax": + h = false; + b.fancybox.showActivity(); + e.ajax.win = e.ajax.success; + G = b.ajax(b.extend({}, e.ajax, { + url : c, + data : e.ajax.data || {}, + error : function(x) { + x.status > 0 && O() + }, + success : function(x, H, R) { + if ((typeof R == "object" ? R : G).status == 200) { + if (typeof e.ajax.win == "function") { + w = e.ajax.win(c, x, H, R); + if (w === false) { + t.hide(); + return + } else if (typeof w == "string" + || typeof w == "object") + x = w + } + m.html(x); + F() + } + } + })); + break; + case "iframe": + Q() + } + } else + O() + } + }, F = function() { + var a = e.width, c = e.height; + a = a.toString().indexOf("%") > -1 ? parseInt( + (b(window).width() - e.margin * 2) * parseFloat(a) / 100, 10) + + "px" : a == "auto" ? "auto" : a + "px"; + c = c.toString().indexOf("%") > -1 ? parseInt( + (b(window).height() - e.margin * 2) * parseFloat(c) / 100, 10) + + "px" : c == "auto" ? "auto" : c + "px"; + m.wrapInner('
'); + e.width = m.width(); + e.height = m.height(); + Q() + }, Q = function() { + var a, c; + t.hide(); + if (f.is(":visible") && false === d.onCleanup(l, p, d)) { + b.event.trigger("fancybox-cancel"); + h = false + } else { + h = true; + b(j.add(u)).unbind(); + b(window).unbind("resize.fb scroll.fb"); + b(document).unbind("keydown.fb"); + f.is(":visible") && d.titlePosition !== "outside" + && f.css("height", f.height()); + l = o; + p = q; + d = e; + if (d.overlayShow) { + u.css({ + "background-color" : d.overlayColor, + opacity : d.overlayOpacity, + cursor : d.hideOnOverlayClick ? "pointer" : "auto", + height : b(document).height() + }); + if (!u.is(":visible")) { + M + && b("select:not(#fancybox-tmp select)") + .filter( + function() { + return this.style.visibility !== "hidden" + }).css({ + visibility : "hidden" + }).one("fancybox-cleanup", function() { + this.style.visibility = "inherit" + }); + u.show() + } + } else + u.hide(); + i = X(); + s = d.title || ""; + y = 0; + n.empty().removeAttr("style").removeClass(); + if (d.titleShow !== false) { + if (b.isFunction(d.titleFormat)) + a = d.titleFormat(s, l, p, d); + else + a = s && s.length ? d.titlePosition == "float" ? '
' + + s + + '
' + : '
' + s + "
" + : false; + s = a; + if (!(!s || s === "")) { + n.addClass("fancybox-title-" + d.titlePosition).html(s) + .appendTo("body").show(); + switch (d.titlePosition) { + case "inside": + n.css({ + width : i.width - d.padding * 2, + marginLeft : d.padding, + marginRight : d.padding + }); + y = n.outerHeight(true); + n.appendTo(D); + i.height += y; + break; + case "over": + n.css({ + marginLeft : d.padding, + width : i.width - d.padding * 2, + bottom : d.padding + }).appendTo(D); + break; + case "float": + n.css( + "left", + parseInt((n.width() - i.width - 40) / 2, 10) + * -1).appendTo(f); + break; + default: + n.css({ + width : i.width - d.padding * 2, + paddingLeft : d.padding, + paddingRight : d.padding + }).appendTo(f) + } + } + } + n.hide(); + if (f.is(":visible")) { + b(E.add(z).add(A)).hide(); + a = f.position(); + r = { + top : a.top, + left : a.left, + width : f.width(), + height : f.height() + }; + c = r.width == i.width && r.height == i.height; + j.fadeTo(d.changeFade, 0.3, function() { + var g = function() { + j.html(m.contents()).fadeTo(d.changeFade, 1, S) + }; + b.event.trigger("fancybox-change"); + j.empty().removeAttr("filter").css( + { + "border-width" : d.padding, + width : i.width - d.padding * 2, + height : e.autoDimensions ? "auto" : i.height + - y - d.padding * 2 + }); + if (c) + g(); + else { + B.prop = 0; + b(B).animate({ + prop : 1 + }, { + duration : d.changeSpeed, + easing : d.easingChange, + step : T, + complete : g + }) + } + }) + } else { + f.removeAttr("style"); + j.css("border-width", d.padding); + if (d.transitionIn == "elastic") { + r = V(); + j.html(m.contents()); + f.show(); + if (d.opacity) + i.opacity = 0; + B.prop = 0; + b(B).animate({ + prop : 1 + }, { + duration : d.speedIn, + easing : d.easingIn, + step : T, + complete : S + }) + } else { + d.titlePosition == "inside" && y > 0 && n.show(); + j.css( + { + width : i.width - d.padding * 2, + height : e.autoDimensions ? "auto" : i.height + - y - d.padding * 2 + }).html(m.contents()); + f + .css(i) + .fadeIn(d.transitionIn == "none" ? 0 : d.speedIn, S) + } + } + } + }, Y = function() { + if (d.enableEscapeButton || d.enableKeyboardNav) + b(document).bind( + "keydown.fb", + function(a) { + if (a.keyCode == 27 && d.enableEscapeButton) { + a.preventDefault(); + b.fancybox.close() + } else if ((a.keyCode == 37 || a.keyCode == 39) + && d.enableKeyboardNav + && a.target.tagName !== "INPUT" + && a.target.tagName !== "TEXTAREA" + && a.target.tagName !== "SELECT") { + a.preventDefault(); + b.fancybox[a.keyCode == 37 ? "prev" : "next"]() + } + }); + if (d.showNavArrows) { + if (d.cyclic && l.length > 1 || p !== 0) + z.show(); + if (d.cyclic && l.length > 1 || p != l.length - 1) + A.show() + } else { + z.hide(); + A.hide() + } + }, S = function() { + if (!b.support.opacity) { + j.get(0).style.removeAttribute("filter"); + f.get(0).style.removeAttribute("filter") + } + e.autoDimensions && j.css("height", "auto"); + f.css("height", "auto"); + s && s.length && n.show(); + d.showCloseButton && E.show(); + Y(); + d.hideOnContentClick && j.bind("click", b.fancybox.close); + d.hideOnOverlayClick && u.bind("click", b.fancybox.close); + b(window).bind("resize.fb", b.fancybox.resize); + d.centerOnScroll && b(window).bind("scroll.fb", b.fancybox.center); + if (d.type == "iframe") + b( + '').appendTo(j); + f.show(); + h = false; + b.fancybox.center(); + d.onComplete(l, p, d); + var a, c; + if (l.length - 1 > p) { + a = l[p + 1].href; + if (typeof a !== "undefined" && a.match(J)) { + c = new Image; + c.src = a + } + } + if (p > 0) { + a = l[p - 1].href; + if (typeof a !== "undefined" && a.match(J)) { + c = new Image; + c.src = a + } + } + }, T = function(a) { + var c = { + width : parseInt(r.width + (i.width - r.width) * a, 10), + height : parseInt(r.height + (i.height - r.height) * a, 10), + top : parseInt(r.top + (i.top - r.top) * a, 10), + left : parseInt(r.left + (i.left - r.left) * a, 10) + }; + if (typeof i.opacity !== "undefined") + c.opacity = a < 0.5 ? 0.5 : a; + f.css(c); + j.css({ + width : c.width - d.padding * 2, + height : c.height - y * a - d.padding * 2 + }) + }, U = function() { + return [ b(window).width() - d.margin * 2, + b(window).height() - d.margin * 2, + b(document).scrollLeft() + d.margin, + b(document).scrollTop() + d.margin ] + }, X = function() { + var a = U(), c = {}, g = d.autoScale, k = d.padding * 2; + c.width = d.width.toString().indexOf("%") > -1 ? parseInt(a[0] + * parseFloat(d.width) / 100, 10) : d.width + k; + c.height = d.height.toString().indexOf("%") > -1 ? parseInt(a[1] + * parseFloat(d.height) / 100, 10) : d.height + k; + if (g && (c.width > a[0] || c.height > a[1])) + if (e.type == "image" || e.type == "swf") { + g = d.width / d.height; + if (c.width > a[0]) { + c.width = a[0]; + c.height = parseInt((c.width - k) / g + k, 10) + } + if (c.height > a[1]) { + c.height = a[1]; + c.width = parseInt((c.height - k) * g + k, 10) + } + } else { + c.width = Math.min(c.width, a[0]); + c.height = Math.min(c.height, a[1]) + } + c.top = parseInt(Math.max(a[3] - 20, a[3] + (a[1] - c.height - 40) + * 0.5), 10); + c.left = parseInt(Math.max(a[2] - 20, a[2] + (a[0] - c.width - 40) + * 0.5), 10); + return c + }, V = function() { + var a = e.orig ? b(e.orig) : false, c = {}; + if (a && a.length) { + c = a.offset(); + c.top += parseInt(a.css("paddingTop"), 10) || 0; + c.left += parseInt(a.css("paddingLeft"), 10) || 0; + c.top += parseInt(a.css("border-top-width"), 10) || 0; + c.left += parseInt(a.css("border-left-width"), 10) || 0; + c.width = a.width(); + c.height = a.height(); + c = { + width : c.width + d.padding * 2, + height : c.height + d.padding * 2, + top : c.top - d.padding - 20, + left : c.left - d.padding - 20 + } + } else { + a = U(); + c = { + width : d.padding * 2, + height : d.padding * 2, + top : parseInt(a[3] + a[1] * 0.5, 10), + left : parseInt(a[2] + a[0] * 0.5, 10) + } + } + return c + }, Z = function() { + if (t.is(":visible")) { + b("div", t).css("top", L * -40 + "px"); + L = (L + 1) % 12 + } else + clearInterval(K) + }; + b.fn.fancybox = function(a) { + if (!b(this).length) + return this; + b(this).data("fancybox", + b.extend({}, a, b.metadata ? b(this).metadata() : {})).unbind( + "click.fb").bind("click.fb", function(c) { + c.preventDefault(); + if (!h) { + h = true; + b(this).blur(); + o = []; + q = 0; + c = b(this).attr("rel") || ""; + if (!c || c == "" || c === "nofollow") + o.push(this); + else { + o = b("a[rel=" + c + "], area[rel=" + c + "]"); + q = o.index(this) + } + I() + } + }); + return this + }; + b.fancybox = function(a, c) { + var g; + if (!h) { + h = true; + g = typeof c !== "undefined" ? c : {}; + o = []; + q = parseInt(g.index, 10) || 0; + if (b.isArray(a)) { + for ( var k = 0, C = a.length; k < C; k++) + if (typeof a[k] == "object") + b(a[k]).data("fancybox", b.extend({}, g, a[k])); + else + a[k] = b({}).data("fancybox", b.extend({ + content : a[k] + }, g)); + o = jQuery.merge(o, a) + } else { + if (typeof a == "object") + b(a).data("fancybox", b.extend({}, g, a)); + else + a = b({}).data("fancybox", b.extend({ + content : a + }, g)); + o.push(a) + } + if (q > o.length || q < 0) + q = 0; + I() + } + }; + b.fancybox.showActivity = function() { + clearInterval(K); + t.show(); + K = setInterval(Z, 66) + }; + b.fancybox.hideActivity = function() { + t.hide() + }; + b.fancybox.next = function() { + return b.fancybox.pos(p + 1) + }; + b.fancybox.prev = function() { + return b.fancybox.pos(p - 1) + }; + b.fancybox.pos = function(a) { + if (!h) { + a = parseInt(a); + o = l; + if (a > -1 && a < l.length) { + q = a; + I() + } else if (d.cyclic && l.length > 1) { + q = a >= l.length ? 0 : l.length - 1; + I() + } + } + }; + b.fancybox.cancel = function() { + if (!h) { + h = true; + b.event.trigger("fancybox-cancel"); + N(); + e.onCancel(o, q, e); + h = false + } + }; + b.fancybox.close = function() { + function a() { + u.fadeOut("fast"); + n.empty().hide(); + f.hide(); + b.event.trigger("fancybox-cleanup"); + j.empty(); + d.onClosed(l, p, d); + l = e = []; + p = q = 0; + d = e = {}; + h = false + } + if (!(h || f.is(":hidden"))) { + h = true; + if (d && false === d.onCleanup(l, p, d)) + h = false; + else { + N(); + b(E.add(z).add(A)).hide(); + b(j.add(u)).unbind(); + b(window).unbind("resize.fb scroll.fb"); + b(document).unbind("keydown.fb"); + j + .find("iframe") + .attr( + "src", + M && /^https/i.test(window.location.href || "") ? "javascript:void(false)" + : "about:blank"); + d.titlePosition !== "inside" && n.empty(); + f.stop(); + if (d.transitionOut == "elastic") { + r = V(); + var c = f.position(); + i = { + top : c.top, + left : c.left, + width : f.width(), + height : f.height() + }; + if (d.opacity) + i.opacity = 1; + n.empty().hide(); + B.prop = 1; + b(B).animate({ + prop : 0 + }, { + duration : d.speedOut, + easing : d.easingOut, + step : T, + complete : a + }) + } else + f.fadeOut(d.transitionOut == "none" ? 0 : d.speedOut, a) + } + } + }; + b.fancybox.resize = function() { + u.is(":visible") && u.css("height", b(document).height()); + b.fancybox.center(true) + }; + b.fancybox.center = function(a) { + var c, g; + if (!h) { + g = a === true ? 1 : 0; + c = U(); + !g + && (f.width() > c[0] || f.height() > c[1]) + || f.stop().animate( + { + top : parseInt(Math.max(c[3] - 20, c[3] + + (c[1] - j.height() - 40) * 0.5 + - d.padding)), + left : parseInt(Math.max(c[2] - 20, c[2] + + (c[0] - j.width() - 40) * 0.5 + - d.padding)) + }, typeof a == "number" ? a : 200) + } + }; + b.fancybox.init = function() { + if (!b("#fancybox-wrap").length) { + b("body").append(m = b('
'), + t = b('
'), + u = b('
'), + f = b('
')); + D = b('
') + .append( + '
') + .appendTo(f); + D + .append( + j = b('
'), + E = b(''), + n = b('
'), + z = b(''), + A = b('')); + E.click(b.fancybox.close); + t.click(b.fancybox.cancel); + z.click(function(a) { + a.preventDefault(); + b.fancybox.prev() + }); + A.click(function(a) { + a.preventDefault(); + b.fancybox.next() + }); + b.fn.mousewheel + && f.bind("mousewheel.fb", function(a, c) { + if (h) + a.preventDefault(); + else if (b(a.target).get(0).clientHeight == 0 + || b(a.target).get(0).scrollHeight === b( + a.target).get(0).clientHeight) { + a.preventDefault(); + b.fancybox[c > 0 ? "prev" : "next"]() + } + }); + b.support.opacity || f.addClass("fancybox-ie"); + if (M) { + t.addClass("fancybox-ie6"); + f.addClass("fancybox-ie6"); + b( + '') + .prependTo(D) + } + } + }; + b.fn.fancybox.defaults = { + padding : 10, + margin : 40, + opacity : false, + modal : false, + cyclic : false, + scrolling : "auto", + width : 560, + height : 340, + autoScale : true, + autoDimensions : true, + centerOnScroll : false, + ajax : {}, + swf : { + wmode : "transparent" + }, + hideOnOverlayClick : true, + hideOnContentClick : false, + overlayShow : true, + overlayOpacity : 0.7, + overlayColor : "#777", + titleShow : true, + titlePosition : "float", + titleFormat : null, + titleFromAlt : false, + transitionIn : "fade", + transitionOut : "fade", + speedIn : 300, + speedOut : 300, + changeSpeed : 300, + changeFade : "fast", + easingIn : "swing", + easingOut : "swing", + showCloseButton : true, + showNavArrows : true, + enableEscapeButton : true, + enableKeyboardNav : true, + onStart : function() { + }, + onCancel : function() { + }, + onComplete : function() { + }, + onCleanup : function() { + }, + onClosed : function() { + }, + onError : function() { + } + }; + b(document).ready(function() { + b.fancybox.init() + }) +})(jQuery); \ No newline at end of file diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js index 69cda7a0ec..32147782fe 100644 --- a/apps/files_imageviewer/js/lightbox.js +++ b/apps/files_imageviewer/js/lightbox.js @@ -22,6 +22,7 @@ function viewImage(dir, file) { if(file.indexOf('.psd')>0){//can't view those return; } + console.log("!!!!!!!!! lightbox"); var location=OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir); $.fancybox({ "href": location, From 544f97f03423aaee44e57af8bdd39950337e8493 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 14 Jun 2012 13:17:06 +0200 Subject: [PATCH 7/8] debugging output removed --- apps/files_imageviewer/js/lightbox.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js index 32147782fe..69cda7a0ec 100644 --- a/apps/files_imageviewer/js/lightbox.js +++ b/apps/files_imageviewer/js/lightbox.js @@ -22,7 +22,6 @@ function viewImage(dir, file) { if(file.indexOf('.psd')>0){//can't view those return; } - console.log("!!!!!!!!! lightbox"); var location=OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir); $.fancybox({ "href": location, From cd759aee001e112bc4e31813d5aee72822f206de Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 14 Jun 2012 13:41:39 +0200 Subject: [PATCH 8/8] fixed xss vulnerability in un-packed version of jquery.fancybox and repack it --- .../js/jquery.fancybox-1.3.4.js | 3 +- .../js/jquery.fancybox-1.3.4.pack.js | 794 +----------------- 2 files changed, 3 insertions(+), 794 deletions(-) diff --git a/apps/files_imageviewer/js/jquery.fancybox-1.3.4.js b/apps/files_imageviewer/js/jquery.fancybox-1.3.4.js index be77275376..21b202b9e3 100644 --- a/apps/files_imageviewer/js/jquery.fancybox-1.3.4.js +++ b/apps/files_imageviewer/js/jquery.fancybox-1.3.4.js @@ -84,7 +84,8 @@ } title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || ''; - + title = title.replace(//, ">"); + if (obj.nodeName && !selectedOpts.orig) { selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj); } diff --git a/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js b/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js index d5b72d8640..ff9a90f09d 100644 --- a/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js +++ b/apps/files_imageviewer/js/jquery.fancybox-1.3.4.pack.js @@ -1,793 +1 @@ -/* - * FancyBox - jQuery Plugin - * Simple and fancy lightbox alternative - * - * Examples and documentation at: http://fancybox.net - * - * Copyright (c) 2008 - 2010 Janis Skarnelis - * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. - * - * Version: 1.3.4 (11/11/2010) - * Requires: jQuery v1.3+ - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ - -; -(function(b) { - var m, t, u, f, D, j, E, n, z, A, q = 0, e = {}, o = [], p = 0, d = {}, l = [], G = null, v = new Image, J = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, W = /[^\.]\.(swf)\s*$/i, K, L = 1, y = 0, s = "", r, i, h = false, B = b - .extend(b("
")[0], { - prop : 0 - }), M = b.browser.msie && b.browser.version < 7 - && !window.XMLHttpRequest, N = function() { - t.hide(); - v.onerror = v.onload = null; - G && G.abort(); - m.empty() - }, O = function() { - if (false === e.onError(o, q, e)) { - t.hide(); - h = false - } else { - e.titleShow = false; - e.width = "auto"; - e.height = "auto"; - m - .html('

The requested content cannot be loaded.
Please try again later.

'); - F() - } - }, I = function() { - var a = o[q], c, g, k, C, P, w; - N(); - e = b.extend({}, b.fn.fancybox.defaults, - typeof b(a).data("fancybox") == "undefined" ? e : b(a).data( - "fancybox")); - w = e.onStart(o, q, e); - if (w === false) - h = false; - else { - if (typeof w == "object") - e = b.extend(e, w); - k = e.title || (a.nodeName ? b(a).attr("title") : a.title) || ""; - k = k.replace(//, ">"); - if (a.nodeName && !e.orig) - e.orig = b(a).children("img:first").length ? b(a).children( - "img:first") : b(a); - if (k === "" && e.orig && e.titleFromAlt) - k = e.orig.attr("alt"); - c = e.href || (a.nodeName ? b(a).attr("href") : a.href) || null; - if (/^(?:javascript)/i.test(c) || c == "#") - c = null; - if (e.type) { - g = e.type; - if (!c) - c = e.content - } else if (e.content) - g = "html"; - else if (c) - g = c.match(J) ? "image" : c.match(W) ? "swf" : b(a).hasClass( - "iframe") ? "iframe" : c.indexOf("#") === 0 ? "inline" - : "ajax"; - if (g) { - if (g == "inline") { - a = c.substr(c.indexOf("#")); - g = b(a).length > 0 ? "inline" : "ajax" - } - e.type = g; - e.href = c; - e.title = k; - if (e.autoDimensions) - if (e.type == "html" || e.type == "inline" - || e.type == "ajax") { - e.width = "auto"; - e.height = "auto" - } else - e.autoDimensions = false; - if (e.modal) { - e.overlayShow = true; - e.hideOnOverlayClick = false; - e.hideOnContentClick = false; - e.enableEscapeButton = false; - e.showCloseButton = false - } - e.padding = parseInt(e.padding, 10); - e.margin = parseInt(e.margin, 10); - m.css("padding", e.padding + e.margin); - b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind( - "fancybox-change", function() { - b(this).replaceWith(j.children()) - }); - switch (g) { - case "html": - m.html(e.content); - F(); - break; - case "inline": - if (b(a).parent().is("#fancybox-content") === true) { - h = false; - break - } - b('
').hide() - .insertBefore(b(a)).bind("fancybox-cleanup", - function() { - b(this).replaceWith(j.children()) - }).bind("fancybox-cancel", function() { - b(this).replaceWith(m.children()) - }); - b(a).appendTo(m); - F(); - break; - case "image": - h = false; - b.fancybox.showActivity(); - v = new Image; - v.onerror = function() { - O() - }; - v.onload = function() { - h = true; - v.onerror = v.onload = null; - e.width = v.width; - e.height = v.height; - b("").attr({ - id : "fancybox-img", - src : v.src, - alt : e.title - }).appendTo(m); - Q() - }; - v.src = c; - break; - case "swf": - e.scrolling = "no"; - C = ''; - P = ""; - b.each(e.swf, function(x, H) { - C += ''; - P += " " + x + '="' + H + '"' - }); - C += '"; - m.html(C); - F(); - break; - case "ajax": - h = false; - b.fancybox.showActivity(); - e.ajax.win = e.ajax.success; - G = b.ajax(b.extend({}, e.ajax, { - url : c, - data : e.ajax.data || {}, - error : function(x) { - x.status > 0 && O() - }, - success : function(x, H, R) { - if ((typeof R == "object" ? R : G).status == 200) { - if (typeof e.ajax.win == "function") { - w = e.ajax.win(c, x, H, R); - if (w === false) { - t.hide(); - return - } else if (typeof w == "string" - || typeof w == "object") - x = w - } - m.html(x); - F() - } - } - })); - break; - case "iframe": - Q() - } - } else - O() - } - }, F = function() { - var a = e.width, c = e.height; - a = a.toString().indexOf("%") > -1 ? parseInt( - (b(window).width() - e.margin * 2) * parseFloat(a) / 100, 10) - + "px" : a == "auto" ? "auto" : a + "px"; - c = c.toString().indexOf("%") > -1 ? parseInt( - (b(window).height() - e.margin * 2) * parseFloat(c) / 100, 10) - + "px" : c == "auto" ? "auto" : c + "px"; - m.wrapInner('
'); - e.width = m.width(); - e.height = m.height(); - Q() - }, Q = function() { - var a, c; - t.hide(); - if (f.is(":visible") && false === d.onCleanup(l, p, d)) { - b.event.trigger("fancybox-cancel"); - h = false - } else { - h = true; - b(j.add(u)).unbind(); - b(window).unbind("resize.fb scroll.fb"); - b(document).unbind("keydown.fb"); - f.is(":visible") && d.titlePosition !== "outside" - && f.css("height", f.height()); - l = o; - p = q; - d = e; - if (d.overlayShow) { - u.css({ - "background-color" : d.overlayColor, - opacity : d.overlayOpacity, - cursor : d.hideOnOverlayClick ? "pointer" : "auto", - height : b(document).height() - }); - if (!u.is(":visible")) { - M - && b("select:not(#fancybox-tmp select)") - .filter( - function() { - return this.style.visibility !== "hidden" - }).css({ - visibility : "hidden" - }).one("fancybox-cleanup", function() { - this.style.visibility = "inherit" - }); - u.show() - } - } else - u.hide(); - i = X(); - s = d.title || ""; - y = 0; - n.empty().removeAttr("style").removeClass(); - if (d.titleShow !== false) { - if (b.isFunction(d.titleFormat)) - a = d.titleFormat(s, l, p, d); - else - a = s && s.length ? d.titlePosition == "float" ? '
' - + s - + '
' - : '
' + s + "
" - : false; - s = a; - if (!(!s || s === "")) { - n.addClass("fancybox-title-" + d.titlePosition).html(s) - .appendTo("body").show(); - switch (d.titlePosition) { - case "inside": - n.css({ - width : i.width - d.padding * 2, - marginLeft : d.padding, - marginRight : d.padding - }); - y = n.outerHeight(true); - n.appendTo(D); - i.height += y; - break; - case "over": - n.css({ - marginLeft : d.padding, - width : i.width - d.padding * 2, - bottom : d.padding - }).appendTo(D); - break; - case "float": - n.css( - "left", - parseInt((n.width() - i.width - 40) / 2, 10) - * -1).appendTo(f); - break; - default: - n.css({ - width : i.width - d.padding * 2, - paddingLeft : d.padding, - paddingRight : d.padding - }).appendTo(f) - } - } - } - n.hide(); - if (f.is(":visible")) { - b(E.add(z).add(A)).hide(); - a = f.position(); - r = { - top : a.top, - left : a.left, - width : f.width(), - height : f.height() - }; - c = r.width == i.width && r.height == i.height; - j.fadeTo(d.changeFade, 0.3, function() { - var g = function() { - j.html(m.contents()).fadeTo(d.changeFade, 1, S) - }; - b.event.trigger("fancybox-change"); - j.empty().removeAttr("filter").css( - { - "border-width" : d.padding, - width : i.width - d.padding * 2, - height : e.autoDimensions ? "auto" : i.height - - y - d.padding * 2 - }); - if (c) - g(); - else { - B.prop = 0; - b(B).animate({ - prop : 1 - }, { - duration : d.changeSpeed, - easing : d.easingChange, - step : T, - complete : g - }) - } - }) - } else { - f.removeAttr("style"); - j.css("border-width", d.padding); - if (d.transitionIn == "elastic") { - r = V(); - j.html(m.contents()); - f.show(); - if (d.opacity) - i.opacity = 0; - B.prop = 0; - b(B).animate({ - prop : 1 - }, { - duration : d.speedIn, - easing : d.easingIn, - step : T, - complete : S - }) - } else { - d.titlePosition == "inside" && y > 0 && n.show(); - j.css( - { - width : i.width - d.padding * 2, - height : e.autoDimensions ? "auto" : i.height - - y - d.padding * 2 - }).html(m.contents()); - f - .css(i) - .fadeIn(d.transitionIn == "none" ? 0 : d.speedIn, S) - } - } - } - }, Y = function() { - if (d.enableEscapeButton || d.enableKeyboardNav) - b(document).bind( - "keydown.fb", - function(a) { - if (a.keyCode == 27 && d.enableEscapeButton) { - a.preventDefault(); - b.fancybox.close() - } else if ((a.keyCode == 37 || a.keyCode == 39) - && d.enableKeyboardNav - && a.target.tagName !== "INPUT" - && a.target.tagName !== "TEXTAREA" - && a.target.tagName !== "SELECT") { - a.preventDefault(); - b.fancybox[a.keyCode == 37 ? "prev" : "next"]() - } - }); - if (d.showNavArrows) { - if (d.cyclic && l.length > 1 || p !== 0) - z.show(); - if (d.cyclic && l.length > 1 || p != l.length - 1) - A.show() - } else { - z.hide(); - A.hide() - } - }, S = function() { - if (!b.support.opacity) { - j.get(0).style.removeAttribute("filter"); - f.get(0).style.removeAttribute("filter") - } - e.autoDimensions && j.css("height", "auto"); - f.css("height", "auto"); - s && s.length && n.show(); - d.showCloseButton && E.show(); - Y(); - d.hideOnContentClick && j.bind("click", b.fancybox.close); - d.hideOnOverlayClick && u.bind("click", b.fancybox.close); - b(window).bind("resize.fb", b.fancybox.resize); - d.centerOnScroll && b(window).bind("scroll.fb", b.fancybox.center); - if (d.type == "iframe") - b( - '').appendTo(j); - f.show(); - h = false; - b.fancybox.center(); - d.onComplete(l, p, d); - var a, c; - if (l.length - 1 > p) { - a = l[p + 1].href; - if (typeof a !== "undefined" && a.match(J)) { - c = new Image; - c.src = a - } - } - if (p > 0) { - a = l[p - 1].href; - if (typeof a !== "undefined" && a.match(J)) { - c = new Image; - c.src = a - } - } - }, T = function(a) { - var c = { - width : parseInt(r.width + (i.width - r.width) * a, 10), - height : parseInt(r.height + (i.height - r.height) * a, 10), - top : parseInt(r.top + (i.top - r.top) * a, 10), - left : parseInt(r.left + (i.left - r.left) * a, 10) - }; - if (typeof i.opacity !== "undefined") - c.opacity = a < 0.5 ? 0.5 : a; - f.css(c); - j.css({ - width : c.width - d.padding * 2, - height : c.height - y * a - d.padding * 2 - }) - }, U = function() { - return [ b(window).width() - d.margin * 2, - b(window).height() - d.margin * 2, - b(document).scrollLeft() + d.margin, - b(document).scrollTop() + d.margin ] - }, X = function() { - var a = U(), c = {}, g = d.autoScale, k = d.padding * 2; - c.width = d.width.toString().indexOf("%") > -1 ? parseInt(a[0] - * parseFloat(d.width) / 100, 10) : d.width + k; - c.height = d.height.toString().indexOf("%") > -1 ? parseInt(a[1] - * parseFloat(d.height) / 100, 10) : d.height + k; - if (g && (c.width > a[0] || c.height > a[1])) - if (e.type == "image" || e.type == "swf") { - g = d.width / d.height; - if (c.width > a[0]) { - c.width = a[0]; - c.height = parseInt((c.width - k) / g + k, 10) - } - if (c.height > a[1]) { - c.height = a[1]; - c.width = parseInt((c.height - k) * g + k, 10) - } - } else { - c.width = Math.min(c.width, a[0]); - c.height = Math.min(c.height, a[1]) - } - c.top = parseInt(Math.max(a[3] - 20, a[3] + (a[1] - c.height - 40) - * 0.5), 10); - c.left = parseInt(Math.max(a[2] - 20, a[2] + (a[0] - c.width - 40) - * 0.5), 10); - return c - }, V = function() { - var a = e.orig ? b(e.orig) : false, c = {}; - if (a && a.length) { - c = a.offset(); - c.top += parseInt(a.css("paddingTop"), 10) || 0; - c.left += parseInt(a.css("paddingLeft"), 10) || 0; - c.top += parseInt(a.css("border-top-width"), 10) || 0; - c.left += parseInt(a.css("border-left-width"), 10) || 0; - c.width = a.width(); - c.height = a.height(); - c = { - width : c.width + d.padding * 2, - height : c.height + d.padding * 2, - top : c.top - d.padding - 20, - left : c.left - d.padding - 20 - } - } else { - a = U(); - c = { - width : d.padding * 2, - height : d.padding * 2, - top : parseInt(a[3] + a[1] * 0.5, 10), - left : parseInt(a[2] + a[0] * 0.5, 10) - } - } - return c - }, Z = function() { - if (t.is(":visible")) { - b("div", t).css("top", L * -40 + "px"); - L = (L + 1) % 12 - } else - clearInterval(K) - }; - b.fn.fancybox = function(a) { - if (!b(this).length) - return this; - b(this).data("fancybox", - b.extend({}, a, b.metadata ? b(this).metadata() : {})).unbind( - "click.fb").bind("click.fb", function(c) { - c.preventDefault(); - if (!h) { - h = true; - b(this).blur(); - o = []; - q = 0; - c = b(this).attr("rel") || ""; - if (!c || c == "" || c === "nofollow") - o.push(this); - else { - o = b("a[rel=" + c + "], area[rel=" + c + "]"); - q = o.index(this) - } - I() - } - }); - return this - }; - b.fancybox = function(a, c) { - var g; - if (!h) { - h = true; - g = typeof c !== "undefined" ? c : {}; - o = []; - q = parseInt(g.index, 10) || 0; - if (b.isArray(a)) { - for ( var k = 0, C = a.length; k < C; k++) - if (typeof a[k] == "object") - b(a[k]).data("fancybox", b.extend({}, g, a[k])); - else - a[k] = b({}).data("fancybox", b.extend({ - content : a[k] - }, g)); - o = jQuery.merge(o, a) - } else { - if (typeof a == "object") - b(a).data("fancybox", b.extend({}, g, a)); - else - a = b({}).data("fancybox", b.extend({ - content : a - }, g)); - o.push(a) - } - if (q > o.length || q < 0) - q = 0; - I() - } - }; - b.fancybox.showActivity = function() { - clearInterval(K); - t.show(); - K = setInterval(Z, 66) - }; - b.fancybox.hideActivity = function() { - t.hide() - }; - b.fancybox.next = function() { - return b.fancybox.pos(p + 1) - }; - b.fancybox.prev = function() { - return b.fancybox.pos(p - 1) - }; - b.fancybox.pos = function(a) { - if (!h) { - a = parseInt(a); - o = l; - if (a > -1 && a < l.length) { - q = a; - I() - } else if (d.cyclic && l.length > 1) { - q = a >= l.length ? 0 : l.length - 1; - I() - } - } - }; - b.fancybox.cancel = function() { - if (!h) { - h = true; - b.event.trigger("fancybox-cancel"); - N(); - e.onCancel(o, q, e); - h = false - } - }; - b.fancybox.close = function() { - function a() { - u.fadeOut("fast"); - n.empty().hide(); - f.hide(); - b.event.trigger("fancybox-cleanup"); - j.empty(); - d.onClosed(l, p, d); - l = e = []; - p = q = 0; - d = e = {}; - h = false - } - if (!(h || f.is(":hidden"))) { - h = true; - if (d && false === d.onCleanup(l, p, d)) - h = false; - else { - N(); - b(E.add(z).add(A)).hide(); - b(j.add(u)).unbind(); - b(window).unbind("resize.fb scroll.fb"); - b(document).unbind("keydown.fb"); - j - .find("iframe") - .attr( - "src", - M && /^https/i.test(window.location.href || "") ? "javascript:void(false)" - : "about:blank"); - d.titlePosition !== "inside" && n.empty(); - f.stop(); - if (d.transitionOut == "elastic") { - r = V(); - var c = f.position(); - i = { - top : c.top, - left : c.left, - width : f.width(), - height : f.height() - }; - if (d.opacity) - i.opacity = 1; - n.empty().hide(); - B.prop = 1; - b(B).animate({ - prop : 0 - }, { - duration : d.speedOut, - easing : d.easingOut, - step : T, - complete : a - }) - } else - f.fadeOut(d.transitionOut == "none" ? 0 : d.speedOut, a) - } - } - }; - b.fancybox.resize = function() { - u.is(":visible") && u.css("height", b(document).height()); - b.fancybox.center(true) - }; - b.fancybox.center = function(a) { - var c, g; - if (!h) { - g = a === true ? 1 : 0; - c = U(); - !g - && (f.width() > c[0] || f.height() > c[1]) - || f.stop().animate( - { - top : parseInt(Math.max(c[3] - 20, c[3] - + (c[1] - j.height() - 40) * 0.5 - - d.padding)), - left : parseInt(Math.max(c[2] - 20, c[2] - + (c[0] - j.width() - 40) * 0.5 - - d.padding)) - }, typeof a == "number" ? a : 200) - } - }; - b.fancybox.init = function() { - if (!b("#fancybox-wrap").length) { - b("body").append(m = b('
'), - t = b('
'), - u = b('
'), - f = b('
')); - D = b('
') - .append( - '
') - .appendTo(f); - D - .append( - j = b('
'), - E = b(''), - n = b('
'), - z = b(''), - A = b('')); - E.click(b.fancybox.close); - t.click(b.fancybox.cancel); - z.click(function(a) { - a.preventDefault(); - b.fancybox.prev() - }); - A.click(function(a) { - a.preventDefault(); - b.fancybox.next() - }); - b.fn.mousewheel - && f.bind("mousewheel.fb", function(a, c) { - if (h) - a.preventDefault(); - else if (b(a.target).get(0).clientHeight == 0 - || b(a.target).get(0).scrollHeight === b( - a.target).get(0).clientHeight) { - a.preventDefault(); - b.fancybox[c > 0 ? "prev" : "next"]() - } - }); - b.support.opacity || f.addClass("fancybox-ie"); - if (M) { - t.addClass("fancybox-ie6"); - f.addClass("fancybox-ie6"); - b( - '') - .prependTo(D) - } - } - }; - b.fn.fancybox.defaults = { - padding : 10, - margin : 40, - opacity : false, - modal : false, - cyclic : false, - scrolling : "auto", - width : 560, - height : 340, - autoScale : true, - autoDimensions : true, - centerOnScroll : false, - ajax : {}, - swf : { - wmode : "transparent" - }, - hideOnOverlayClick : true, - hideOnContentClick : false, - overlayShow : true, - overlayOpacity : 0.7, - overlayColor : "#777", - titleShow : true, - titlePosition : "float", - titleFormat : null, - titleFromAlt : false, - transitionIn : "fade", - transitionOut : "fade", - speedIn : 300, - speedOut : 300, - changeSpeed : 300, - changeFade : "fast", - easingIn : "swing", - easingOut : "swing", - showCloseButton : true, - showNavArrows : true, - enableEscapeButton : true, - enableKeyboardNav : true, - onStart : function() { - }, - onCancel : function() { - }, - onComplete : function() { - }, - onCleanup : function() { - }, - onClosed : function() { - }, - onError : function() { - } - }; - b(document).ready(function() { - b.fancybox.init() - }) -})(jQuery); \ No newline at end of file +(function(B){var L,T,Q,M,d,m,J,A,O,z,C=0,H={},j=[],e=0,G={},y=[],f=null,o=new Image(),i=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,k=/[^\.]\.(swf)\s*$/i,p,N=1,h=0,t="",b,c,P=false,s=B.extend(B("
")[0],{prop:0}),S=B.browser.msie&&B.browser.version<7&&!window.XMLHttpRequest,r=function(){T.hide();o.onerror=o.onload=null;if(f){f.abort()}L.empty()},x=function(){if(false===H.onError(j,C,H)){T.hide();P=false;return}H.titleShow=false;H.width="auto";H.height="auto";L.html('

The requested content cannot be loaded.
Please try again later.

');n()},w=function(){var Z=j[C],W,Y,ab,aa,V,X;r();H=B.extend({},B.fn.fancybox.defaults,(typeof B(Z).data("fancybox")=="undefined"?H:B(Z).data("fancybox")));X=H.onStart(j,C,H);if(X===false){P=false;return}else{if(typeof X=="object"){H=B.extend(H,X)}}ab=H.title||(Z.nodeName?B(Z).attr("title"):Z.title)||"";ab=ab.replace(//,">");if(Z.nodeName&&!H.orig){H.orig=B(Z).children("img:first").length?B(Z).children("img:first"):B(Z)}if(ab===""&&H.orig&&H.titleFromAlt){ab=H.orig.attr("alt")}W=H.href||(Z.nodeName?B(Z).attr("href"):Z.href)||null;if((/^(?:javascript)/i).test(W)||W=="#"){W=null}if(H.type){Y=H.type;if(!W){W=H.content}}else{if(H.content){Y="html"}else{if(W){if(W.match(i)){Y="image"}else{if(W.match(k)){Y="swf"}else{if(B(Z).hasClass("iframe")){Y="iframe"}else{if(W.indexOf("#")===0){Y="inline"}else{Y="ajax"}}}}}}}if(!Y){x();return}if(Y=="inline"){Z=W.substr(W.indexOf("#"));Y=B(Z).length>0?"inline":"ajax"}H.type=Y;H.href=W;H.title=ab;if(H.autoDimensions){if(H.type=="html"||H.type=="inline"||H.type=="ajax"){H.width="auto";H.height="auto"}else{H.autoDimensions=false}}if(H.modal){H.overlayShow=true;H.hideOnOverlayClick=false;H.hideOnContentClick=false;H.enableEscapeButton=false;H.showCloseButton=false}H.padding=parseInt(H.padding,10);H.margin=parseInt(H.margin,10);L.css("padding",(H.padding+H.margin));B(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){B(this).replaceWith(m.children())});switch(Y){case"html":L.html(H.content);n();break;case"inline":if(B(Z).parent().is("#fancybox-content")===true){P=false;return}B('
').hide().insertBefore(B(Z)).bind("fancybox-cleanup",function(){B(this).replaceWith(m.children())}).bind("fancybox-cancel",function(){B(this).replaceWith(L.children())});B(Z).appendTo(L);n();break;case"image":P=false;B.fancybox.showActivity();o=new Image();o.onerror=function(){x()};o.onload=function(){P=true;o.onerror=o.onload=null;F()};o.src=W;break;case"swf":H.scrolling="no";aa='';V="";B.each(H.swf,function(ac,ad){aa+='';V+=" "+ac+'="'+ad+'"'});aa+='";L.html(aa);n();break;case"ajax":P=false;B.fancybox.showActivity();H.ajax.win=H.ajax.success;f=B.ajax(B.extend({},H.ajax,{url:W,data:H.ajax.data||{},error:function(ac,ae,ad){if(ac.status>0){x()}},success:function(ad,af,ac){var ae=typeof ac=="object"?ac:f;if(ae.status==200){if(typeof H.ajax.win=="function"){X=H.ajax.win(W,ad,af,ac);if(X===false){T.hide();return}else{if(typeof X=="string"||typeof X=="object"){ad=X}}}L.html(ad);n()}}}));break;case"iframe":E();break}},n=function(){var V=H.width,W=H.height;if(V.toString().indexOf("%")>-1){V=parseInt((B(window).width()-(H.margin*2))*parseFloat(V)/100,10)+"px"}else{V=V=="auto"?"auto":V+"px"}if(W.toString().indexOf("%")>-1){W=parseInt((B(window).height()-(H.margin*2))*parseFloat(W)/100,10)+"px"}else{W=W=="auto"?"auto":W+"px"}L.wrapInner('
');H.width=L.width();H.height=L.height();E()},F=function(){H.width=o.width;H.height=o.height;B("").attr({id:"fancybox-img",src:o.src,alt:H.title}).appendTo(L);E()},E=function(){var W,V;T.hide();if(M.is(":visible")&&false===G.onCleanup(y,e,G)){B.event.trigger("fancybox-cancel");P=false;return}P=true;B(m.add(Q)).unbind();B(window).unbind("resize.fb scroll.fb");B(document).unbind("keydown.fb");if(M.is(":visible")&&G.titlePosition!=="outside"){M.css("height",M.height())}y=j;e=C;G=H;if(G.overlayShow){Q.css({"background-color":G.overlayColor,opacity:G.overlayOpacity,cursor:G.hideOnOverlayClick?"pointer":"auto",height:B(document).height()});if(!Q.is(":visible")){if(S){B("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"})}Q.show()}}else{Q.hide()}c=R();l();if(M.is(":visible")){B(J.add(O).add(z)).hide();W=M.position(),b={top:W.top,left:W.left,width:M.width(),height:M.height()};V=(b.width==c.width&&b.height==c.height);m.fadeTo(G.changeFade,0.3,function(){var X=function(){m.html(L.contents()).fadeTo(G.changeFade,1,v)};B.event.trigger("fancybox-change");m.empty().removeAttr("filter").css({"border-width":G.padding,width:c.width-G.padding*2,height:H.autoDimensions?"auto":c.height-h-G.padding*2});if(V){X()}else{s.prop=0;B(s).animate({prop:1},{duration:G.changeSpeed,easing:G.easingChange,step:U,complete:X})}});return}M.removeAttr("style");m.css("border-width",G.padding);if(G.transitionIn=="elastic"){b=I();m.html(L.contents());M.show();if(G.opacity){c.opacity=0}s.prop=0;B(s).animate({prop:1},{duration:G.speedIn,easing:G.easingIn,step:U,complete:v});return}if(G.titlePosition=="inside"&&h>0){A.show()}m.css({width:c.width-G.padding*2,height:H.autoDimensions?"auto":c.height-h-G.padding*2}).html(L.contents());M.css(c).fadeIn(G.transitionIn=="none"?0:G.speedIn,v)},D=function(V){if(V&&V.length){if(G.titlePosition=="float"){return'
'+V+'
'}return'
'+V+"
"}return false},l=function(){t=G.title||"";h=0;A.empty().removeAttr("style").removeClass();if(G.titleShow===false){A.hide();return}t=B.isFunction(G.titleFormat)?G.titleFormat(t,y,e,G):D(t);if(!t||t===""){A.hide();return}A.addClass("fancybox-title-"+G.titlePosition).html(t).appendTo("body").show();switch(G.titlePosition){case"inside":A.css({width:c.width-(G.padding*2),marginLeft:G.padding,marginRight:G.padding});h=A.outerHeight(true);A.appendTo(d);c.height+=h;break;case"over":A.css({marginLeft:G.padding,width:c.width-(G.padding*2),bottom:G.padding}).appendTo(d);break;case"float":A.css("left",parseInt((A.width()-c.width-40)/2,10)*-1).appendTo(M);break;default:A.css({width:c.width-(G.padding*2),paddingLeft:G.padding,paddingRight:G.padding}).appendTo(M);break}A.hide()},g=function(){if(G.enableEscapeButton||G.enableKeyboardNav){B(document).bind("keydown.fb",function(V){if(V.keyCode==27&&G.enableEscapeButton){V.preventDefault();B.fancybox.close()}else{if((V.keyCode==37||V.keyCode==39)&&G.enableKeyboardNav&&V.target.tagName!=="INPUT"&&V.target.tagName!=="TEXTAREA"&&V.target.tagName!=="SELECT"){V.preventDefault();B.fancybox[V.keyCode==37?"prev":"next"]()}}})}if(!G.showNavArrows){O.hide();z.hide();return}if((G.cyclic&&y.length>1)||e!==0){O.show()}if((G.cyclic&&y.length>1)||e!=(y.length-1)){z.show()}},v=function(){if(!B.support.opacity){m.get(0).style.removeAttribute("filter");M.get(0).style.removeAttribute("filter")}if(H.autoDimensions){m.css("height","auto")}M.css("height","auto");if(t&&t.length){A.show()}if(G.showCloseButton){J.show()}g();if(G.hideOnContentClick){m.bind("click",B.fancybox.close)}if(G.hideOnOverlayClick){Q.bind("click",B.fancybox.close)}B(window).bind("resize.fb",B.fancybox.resize);if(G.centerOnScroll){B(window).bind("scroll.fb",B.fancybox.center)}if(G.type=="iframe"){B('').appendTo(m)}M.show();P=false;B.fancybox.center();G.onComplete(y,e,G);K()},K=function(){var V,W;if((y.length-1)>e){V=y[e+1].href;if(typeof V!=="undefined"&&V.match(i)){W=new Image();W.src=V}}if(e>0){V=y[e-1].href;if(typeof V!=="undefined"&&V.match(i)){W=new Image();W.src=V}}},U=function(W){var V={width:parseInt(b.width+(c.width-b.width)*W,10),height:parseInt(b.height+(c.height-b.height)*W,10),top:parseInt(b.top+(c.top-b.top)*W,10),left:parseInt(b.left+(c.left-b.left)*W,10)};if(typeof c.opacity!=="undefined"){V.opacity=W<0.5?0.5:W}M.css(V);m.css({width:V.width-G.padding*2,height:V.height-(h*W)-G.padding*2})},u=function(){return[B(window).width()-(G.margin*2),B(window).height()-(G.margin*2),B(document).scrollLeft()+G.margin,B(document).scrollTop()+G.margin]},R=function(){var V=u(),Z={},W=G.autoScale,X=G.padding*2,Y;if(G.width.toString().indexOf("%")>-1){Z.width=parseInt((V[0]*parseFloat(G.width))/100,10)}else{Z.width=G.width+X}if(G.height.toString().indexOf("%")>-1){Z.height=parseInt((V[1]*parseFloat(G.height))/100,10)}else{Z.height=G.height+X}if(W&&(Z.width>V[0]||Z.height>V[1])){if(H.type=="image"||H.type=="swf"){Y=(G.width)/(G.height);if((Z.width)>V[0]){Z.width=V[0];Z.height=parseInt(((Z.width-X)/Y)+X,10)}if((Z.height)>V[1]){Z.height=V[1];Z.width=parseInt(((Z.height-X)*Y)+X,10)}}else{Z.width=Math.min(Z.width,V[0]);Z.height=Math.min(Z.height,V[1])}}Z.top=parseInt(Math.max(V[3]-20,V[3]+((V[1]-Z.height-40)*0.5)),10);Z.left=parseInt(Math.max(V[2]-20,V[2]+((V[0]-Z.width-40)*0.5)),10);return Z},q=function(V){var W=V.offset();W.top+=parseInt(V.css("paddingTop"),10)||0;W.left+=parseInt(V.css("paddingLeft"),10)||0;W.top+=parseInt(V.css("border-top-width"),10)||0;W.left+=parseInt(V.css("border-left-width"),10)||0;W.width=V.width();W.height=V.height();return W},I=function(){var Y=H.orig?B(H.orig):false,X={},W,V;if(Y&&Y.length){W=q(Y);X={width:W.width+(G.padding*2),height:W.height+(G.padding*2),top:W.top-G.padding-20,left:W.left-G.padding-20}}else{V=u();X={width:G.padding*2,height:G.padding*2,top:parseInt(V[3]+V[1]*0.5,10),left:parseInt(V[2]+V[0]*0.5,10)}}return X},a=function(){if(!T.is(":visible")){clearInterval(p);return}B("div",T).css("top",(N*-40)+"px");N=(N+1)%12};B.fn.fancybox=function(V){if(!B(this).length){return this}B(this).data("fancybox",B.extend({},V,(B.metadata?B(this).metadata():{}))).unbind("click.fb").bind("click.fb",function(X){X.preventDefault();if(P){return}P=true;B(this).blur();j=[];C=0;var W=B(this).attr("rel")||"";if(!W||W==""||W==="nofollow"){j.push(this)}else{j=B("a[rel="+W+"], area[rel="+W+"]");C=j.index(this)}w();return});return this};B.fancybox=function(Y){var X;if(P){return}P=true;X=typeof arguments[1]!=="undefined"?arguments[1]:{};j=[];C=parseInt(X.index,10)||0;if(B.isArray(Y)){for(var W=0,V=Y.length;Wj.length||C<0){C=0}w()};B.fancybox.showActivity=function(){clearInterval(p);T.show();p=setInterval(a,66)};B.fancybox.hideActivity=function(){T.hide()};B.fancybox.next=function(){return B.fancybox.pos(e+1)};B.fancybox.prev=function(){return B.fancybox.pos(e-1)};B.fancybox.pos=function(V){if(P){return}V=parseInt(V);j=y;if(V>-1&&V1){C=V>=y.length?0:y.length-1;w()}}return};B.fancybox.cancel=function(){if(P){return}P=true;B.event.trigger("fancybox-cancel");r();H.onCancel(j,C,H);P=false};B.fancybox.close=function(){if(P||M.is(":hidden")){return}P=true;if(G&&false===G.onCleanup(y,e,G)){P=false;return}r();B(J.add(O).add(z)).hide();B(m.add(Q)).unbind();B(window).unbind("resize.fb scroll.fb");B(document).unbind("keydown.fb");m.find("iframe").attr("src",S&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");if(G.titlePosition!=="inside"){A.empty()}M.stop();function V(){Q.fadeOut("fast");A.empty().hide();M.hide();B.event.trigger("fancybox-cleanup");m.empty();G.onClosed(y,e,G);y=H=[];e=C=0;G=H={};P=false}if(G.transitionOut=="elastic"){b=I();var W=M.position();c={top:W.top,left:W.left,width:M.width(),height:M.height()};if(G.opacity){c.opacity=1}A.empty().hide();s.prop=1;B(s).animate({prop:0},{duration:G.speedOut,easing:G.easingOut,step:U,complete:V})}else{M.fadeOut(G.transitionOut=="none"?0:G.speedOut,V)}};B.fancybox.resize=function(){if(Q.is(":visible")){Q.css("height",B(document).height())}B.fancybox.center(true)};B.fancybox.center=function(){var V,W;if(P){return}W=arguments[0]===true?1:0;V=u();if(!W&&(M.width()>V[0]||M.height()>V[1])){return}M.stop().animate({top:parseInt(Math.max(V[3]-20,V[3]+((V[1]-m.height()-40)*0.5)-G.padding)),left:parseInt(Math.max(V[2]-20,V[2]+((V[0]-m.width()-40)*0.5)-G.padding))},typeof arguments[0]=="number"?arguments[0]:200)};B.fancybox.init=function(){if(B("#fancybox-wrap").length){return}B("body").append(L=B('
'),T=B('
'),Q=B('
'),M=B('
'));d=B('
').append('
').appendTo(M);d.append(m=B('
'),J=B(''),A=B('
'),O=B(''),z=B(''));J.click(B.fancybox.close);T.click(B.fancybox.cancel);O.click(function(V){V.preventDefault();B.fancybox.prev()});z.click(function(V){V.preventDefault();B.fancybox.next()});if(B.fn.mousewheel){M.bind("mousewheel.fb",function(V,W){if(P){V.preventDefault()}else{if(B(V.target).get(0).clientHeight==0||B(V.target).get(0).scrollHeight===B(V.target).get(0).clientHeight){V.preventDefault();B.fancybox[W>0?"prev":"next"]()}}})}if(!B.support.opacity){M.addClass("fancybox-ie")}if(S){T.addClass("fancybox-ie6");M.addClass("fancybox-ie6");B('').prependTo(d)}};B.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};B(document).ready(function(){B.fancybox.init()})})(jQuery); \ No newline at end of file