freeberry 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,98 @@
1
+ /*
2
+ Queue Plug-in
3
+
4
+ Features:
5
+ *Adds a cancelQueue() method for cancelling the entire queue.
6
+ *All queued files are uploaded when startUpload() is called.
7
+ *If false is returned from uploadComplete then the queue upload is stopped.
8
+ If false is not returned (strict comparison) then the queue upload is continued.
9
+ *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
10
+ Set the event handler with the queue_complete_handler setting.
11
+
12
+ */
13
+
14
+ var SWFUpload;
15
+ if (typeof(SWFUpload) === "function") {
16
+ SWFUpload.queue = {};
17
+
18
+ SWFUpload.prototype.initSettings = (function (oldInitSettings) {
19
+ return function (userSettings) {
20
+ if (typeof(oldInitSettings) === "function") {
21
+ oldInitSettings.call(this, userSettings);
22
+ }
23
+
24
+ this.queueSettings = {};
25
+
26
+ this.queueSettings.queue_cancelled_flag = false;
27
+ this.queueSettings.queue_upload_count = 0;
28
+
29
+ this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
30
+ this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
31
+ this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
32
+ this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
33
+
34
+ this.settings.queue_complete_handler = userSettings.queue_complete_handler || null;
35
+ };
36
+ })(SWFUpload.prototype.initSettings);
37
+
38
+ SWFUpload.prototype.startUpload = function (fileID) {
39
+ this.queueSettings.queue_cancelled_flag = false;
40
+ this.callFlash("StartUpload", [fileID]);
41
+ };
42
+
43
+ SWFUpload.prototype.cancelQueue = function () {
44
+ this.queueSettings.queue_cancelled_flag = true;
45
+ this.stopUpload();
46
+
47
+ var stats = this.getStats();
48
+ while (stats.files_queued > 0) {
49
+ this.cancelUpload();
50
+ stats = this.getStats();
51
+ }
52
+ };
53
+
54
+ SWFUpload.queue.uploadStartHandler = function (file) {
55
+ var returnValue;
56
+ if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
57
+ returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
58
+ }
59
+
60
+ // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
61
+ returnValue = (returnValue === false) ? false : true;
62
+
63
+ this.queueSettings.queue_cancelled_flag = !returnValue;
64
+
65
+ return returnValue;
66
+ };
67
+
68
+ SWFUpload.queue.uploadCompleteHandler = function (file) {
69
+ var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
70
+ var continueUpload;
71
+
72
+ if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
73
+ this.queueSettings.queue_upload_count++;
74
+ }
75
+
76
+ if (typeof(user_upload_complete_handler) === "function") {
77
+ continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
78
+ } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
79
+ // If the file was stopped and re-queued don't restart the upload
80
+ continueUpload = false;
81
+ } else {
82
+ continueUpload = true;
83
+ }
84
+
85
+ if (continueUpload) {
86
+ var stats = this.getStats();
87
+ if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
88
+ this.startUpload();
89
+ } else if (this.queueSettings.queue_cancelled_flag === false) {
90
+ this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
91
+ this.queueSettings.queue_upload_count = 0;
92
+ } else {
93
+ this.queueSettings.queue_cancelled_flag = false;
94
+ this.queueSettings.queue_upload_count = 0;
95
+ }
96
+ }
97
+ };
98
+ }
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) 2008 - 2010 Janis Skarnelis
8
8
  * 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.
9
9
  *
10
- * Version: 1.3.2 (20/10/2010)
10
+ * Version: 1.3.4 (11/11/2010)
11
11
  * Requires: jQuery v1.3+
12
12
  *
13
13
  * Dual licensed under the MIT and GPL licenses:
@@ -43,7 +43,6 @@
43
43
  top: 0;
44
44
  left: 0;
45
45
  width: 100%;
46
- height: 100%;
47
46
  z-index: 1100;
48
47
  display: none;
49
48
  }
@@ -174,7 +173,7 @@
174
173
  }
175
174
 
176
175
  #fancybox-left:hover, #fancybox-right:hover {
177
- visibility: visible; /* IE6 */
176
+ visibility: visible; /* IE6 */
178
177
  }
179
178
 
180
179
  #fancybox-left:hover span {
@@ -301,11 +300,12 @@
301
300
  }
302
301
 
303
302
  #fancybox-title-float-wrap td {
303
+ border: none;
304
304
  white-space: nowrap;
305
305
  }
306
306
 
307
307
  #fancybox-title-float-left {
308
- padding-left: 15px;
308
+ padding: 0 0 0 15px;
309
309
  background: url('/stylesheets/fancybox/images/fancybox.png') -40px -90px no-repeat;
310
310
  }
311
311
 
@@ -313,12 +313,12 @@
313
313
  color: #FFF;
314
314
  line-height: 29px;
315
315
  font-weight: bold;
316
- padding-bottom: 3px;
316
+ padding: 0 0 3px 0;
317
317
  background: url('/stylesheets/fancybox/images/fancybox-x.png') 0px -40px;
318
318
  }
319
319
 
320
320
  #fancybox-title-float-right {
321
- padding-left: 15px;
321
+ padding: 0 0 0 15px;
322
322
  background: url('/stylesheets/fancybox/images/fancybox.png') -55px -90px no-repeat;
323
323
  }
324
324
 
@@ -4,19 +4,20 @@
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
5
  <%= csrf_meta_tag %>
6
6
  <title><%= t('manage.page_title') %></title>
7
- <%= stylesheet_link_tag "manage/main" %>
7
+ <%= stylesheet_link_tag "manage/main", "fancybox/jquery.fancybox-1.3.4" %>
8
8
  <%= stylesheet_link_tag "smoothness/jquery-ui-1.8.6.custom" %>
9
9
  <!--[if lt IE 7]><%= stylesheet_link_tag "manage/ie" %><![endif]-->
10
10
 
11
11
  <script src="https://www.google.com/jsapi?key=" type="text/javascript"></script>
12
12
  <script language="Javascript" type="text/javascript">
13
13
  //<![CDATA[
14
- google.load("jquery", "1.4.4");
14
+ google.load("jquery", "1.5.1");
15
15
  google.load("jqueryui", "1.8.6");
16
16
  google.load("swfobject", "2.2");
17
17
  //]]>
18
18
  </script>
19
19
 
20
+ <%= javascript_include_tag "jquery.tmpl.min", "jquery.fancybox-1.3.4.pack" %>
20
21
  <%= javascript_include_tag :ckeditor, "preloader", "rails", "wp_cookie", "manage" %>
21
22
  <%= yield(:head)%>
22
23
  </head>
@@ -1,7 +1,4 @@
1
1
  <% unless model.new_record? %>
2
- <% javascript "jquery.fancybox-1.3.2.pack.js" %>
3
- <% stylesheet "fancybox/jquery.fancybox-1.3.2.css" %>
4
-
5
2
  <div class="gray-blocks">
6
3
  <div style="padding: 20px;" class="bg-bl">
7
4
  <div style="padding: 0px 0px 15px;" class="gr-title"><%= t('manage.pictures') %></div>
@@ -21,29 +18,15 @@
21
18
 
22
19
  <script type='text/javascript'>
23
20
  $(document).ready(function(){
24
- /*$("div.galery a.fancybox").fancybox({
25
- 'titleShow' : true,
26
- 'transitionIn' : 'none',
27
- 'transitionOut' : 'none'
28
- });*/
29
-
30
- $('div.galery a.del').bind("ajax:complete", function(){
31
- var pid = $(this).attr('href').replace('/manage/assets/', '');
32
- $('#picture_' + pid).fadeOut(1);
33
- });
34
-
35
- $("div.galery").sortable({
36
- revert: true,
37
- update: function(event, ui){
38
- var data = $('div.galery').sortable('serialize');
39
- $.ajax({
40
- url: "<%= sort_manage_assets_path(:klass => model.pictures.name) %>",
41
- data: data,
42
- dataType: 'script',
43
- type: 'POST'
44
- });
45
- }
46
- });
21
+ Manage.init_assets('div.galery', '<%= sort_manage_assets_path(:klass => model.pictures.name) %>');
47
22
  });
48
23
  </script>
24
+ <script id="asset_tmpl" type="text/x-jquery-tmpl">
25
+ <div id="<%= dom_class(model.class.reflections[:pictures].klass) %>_${id}" class="asset ill">
26
+ <%= link_to image_tag("manage/empty.gif", :alt=>t('manage.delete'), :title=>t('manage.delete')),
27
+ "/manage/assets/${id}", :remote => true, :method => :delete, :confirm => t('manage.confirm_delete'), :class => "del" %>
28
+
29
+ <a class="fancybox" href="${link_path}"><img title="${image_title}" src="${image_path}"></a>
30
+ </div>
31
+ </script>
49
32
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= content_tag(:div, :class=>"ill", :id => dom_id(picture)) do %>
1
+ <%= content_tag(:div, :class=>"asset ill", :id => dom_id(picture)) do %>
2
2
  <%= link_to image_tag("manage/empty.gif", :alt=>t('manage.delete'), :title=>t('manage.delete')),
3
3
  manage_asset_path(picture),
4
4
  :remote => true,
@@ -1,16 +1,11 @@
1
- <% javascript "swfupload/swfupload.js", "swfupload/swfupload.queue.js", "swfupload/fileprogress.js", "swfupload/handlers.js" %>
1
+ <% javascript "swfupload/swfupload", "swfupload/swfupload.queue", "swfupload/fileprogress", "swfupload/handlers" %>
2
2
 
3
3
  <script type="text/javascript">
4
- var swfu;
5
- var assetable_type = "<%= model.class.to_s %>";
6
- var assetable_id = "<%= model.id %>";
7
- var upload_path = "<%= manage_assets_path_with_session_information(klass, {:collection=>1}) %>";
8
-
9
- function init_swfupload() {
10
- swfu = new SWFUpload({
4
+ $(document).ready(function(){
5
+ new SWFUpload({
11
6
  // Backend settings
12
- upload_url: upload_path,
13
- post_params: {"assetable_type" : assetable_type, "assetable_id" : assetable_id},
7
+ upload_url: "<%= control_assets_path_with_session_information(klass, {:collection=>1}) %>",
8
+ post_params: {"assetable_type" : "<%= model.class.to_s %>", "assetable_id" : "<%= model.id %>"},
14
9
  file_post_name: "data_file",
15
10
 
16
11
  // Flash file settings
@@ -41,7 +36,7 @@
41
36
  button_cursor: SWFUpload.CURSOR.HAND,
42
37
 
43
38
  // Flash Settings
44
- flash_url : "/swf/swfupload.swf",
39
+ flash_url : "/javascripts/swfupload/swfupload.swf",
45
40
 
46
41
  custom_settings : {
47
42
  progressTarget : <%=raw "swf_container_#{model.id}".inspect %>,
@@ -52,8 +47,5 @@
52
47
  // Debug settings
53
48
  debug: <%= Rails.env.development? ? 'true' : 'false' %>
54
49
  });
55
-
56
- };
57
-
58
- $(document).ready(init_swfupload);
50
+ });
59
51
  </script>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freeberry
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 9
10
- version: 0.2.9
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-18 00:00:00 +02:00
19
+ date: 2011-04-08 00:00:00 +03:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -195,10 +195,16 @@ files:
195
195
  - lib/generators/freeberry/base/templates/javascripts/datepicker/jquery-ui-i18n.js
196
196
  - lib/generators/freeberry/base/templates/javascripts/datepicker/jquery.ui.datepicker-ru.js
197
197
  - lib/generators/freeberry/base/templates/javascripts/datepicker/jquery.ui.datepicker-uk.js
198
- - lib/generators/freeberry/base/templates/javascripts/jquery.fancybox-1.3.2.pack.js
198
+ - lib/generators/freeberry/base/templates/javascripts/jquery.fancybox-1.3.4.pack.js
199
+ - lib/generators/freeberry/base/templates/javascripts/jquery.tmpl.min.js
199
200
  - lib/generators/freeberry/base/templates/javascripts/manage.js
200
201
  - lib/generators/freeberry/base/templates/javascripts/preloader.js
201
202
  - lib/generators/freeberry/base/templates/javascripts/rails.js
203
+ - lib/generators/freeberry/base/templates/javascripts/swfupload/fileprogress.js
204
+ - lib/generators/freeberry/base/templates/javascripts/swfupload/handlers.js
205
+ - lib/generators/freeberry/base/templates/javascripts/swfupload/swfupload.js
206
+ - lib/generators/freeberry/base/templates/javascripts/swfupload/swfupload.queue.js
207
+ - lib/generators/freeberry/base/templates/javascripts/swfupload/swfupload.swf
202
208
  - lib/generators/freeberry/base/templates/javascripts/wp_cookie.js
203
209
  - lib/generators/freeberry/base/templates/stylesheets/fancybox/images/blank.gif
204
210
  - lib/generators/freeberry/base/templates/stylesheets/fancybox/images/fancy_close.png
@@ -220,7 +226,7 @@ files:
220
226
  - lib/generators/freeberry/base/templates/stylesheets/fancybox/images/fancybox-x.png
221
227
  - lib/generators/freeberry/base/templates/stylesheets/fancybox/images/fancybox-y.png
222
228
  - lib/generators/freeberry/base/templates/stylesheets/fancybox/images/fancybox.png
223
- - lib/generators/freeberry/base/templates/stylesheets/fancybox/jquery.fancybox-1.3.2.css
229
+ - lib/generators/freeberry/base/templates/stylesheets/fancybox/jquery.fancybox-1.3.4.css
224
230
  - lib/generators/freeberry/base/templates/stylesheets/manage/ie.css
225
231
  - lib/generators/freeberry/base/templates/stylesheets/manage/main.css
226
232
  - lib/generators/freeberry/base/templates/stylesheets/manage/panel.css
@@ -1,46 +0,0 @@
1
- /*
2
- * FancyBox - jQuery Plugin
3
- * Simple and fancy lightbox alternative
4
- *
5
- * Examples and documentation at: http://fancybox.net
6
- *
7
- * Copyright (c) 2008 - 2010 Janis Skarnelis
8
- * 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.
9
- *
10
- * Version: 1.3.2 (20/10/2010)
11
- * Requires: jQuery v1.3+
12
- *
13
- * Dual licensed under the MIT and GPL licenses:
14
- * http://www.opensource.org/licenses/mit-license.php
15
- * http://www.gnu.org/licenses/gpl.html
16
- */
17
-
18
- ;(function(a){var m,t,u,f,D,h,E,n,z,A,q=0,e={},o=[],p=0,c={},l=[],I=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,j,i=false,B=a.extend(a("<div/>")[0],{prop:0}),M=a.browser.msie&&a.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;I&&I.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();i=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
19
- F()}},H=function(){var b=o[q],d,g,k,C,P,w;N();e=a.extend({},a.fn.fancybox.defaults,typeof a(b).data("fancybox")=="undefined"?e:a(b).data("fancybox"));w=e.onStart(o,q,e);if(w===false)i=false;else{if(typeof w=="object")e=a.extend(e,w);k=e.title||(b.nodeName?a(b).attr("title"):b.title)||"";if(b.nodeName&&!e.orig)e.orig=a(b).children("img:first").length?a(b).children("img:first"):a(b);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");d=e.href||(b.nodeName?a(b).attr("href"):b.href)||null;if(/^(?:javascript)/i.test(d)||
20
- d=="#")d=null;if(e.type){g=e.type;if(!d)d=e.content}else if(e.content)g="html";else if(d)g=d.match(J)?"image":d.match(W)?"swf":a(b).hasClass("iframe")?"iframe":d.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){b=d.substr(d.indexOf("#"));g=a(b).length>0?"inline":"ajax"}e.type=g;e.href=d;e.title=k;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;
21
- e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);a(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){a(this).replaceWith(h.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(a(b).parent().is("#fancybox-content")===true){i=false;break}a('<div class="fancybox-inline-tmp" />').hide().insertBefore(a(b)).bind("fancybox-cleanup",function(){a(this).replaceWith(h.children())}).bind("fancybox-cancel",
22
- function(){a(this).replaceWith(m.children())});a(b).appendTo(m);F();break;case "image":i=false;a.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){i=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;a("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=d;break;case "swf":C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+d+'"></param>';P="";
23
- a.each(e.swf,function(x,G){C+='<param name="'+x+'" value="'+G+'"></param>';P+=" "+x+'="'+G+'"'});C+='<embed src="'+d+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":i=false;a.fancybox.showActivity();e.ajax.win=e.ajax.success;I=a.ajax(a.extend({},e.ajax,{url:d,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,G,U){if(U.status==200){if(typeof e.ajax.win=="function"){w=e.ajax.win(d,x,G,
24
- U);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(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();Q()},Q=function(){var b,d;t.hide();if(f.is(":visible")&&false===c.onCleanup(l,p,c)){a.event.trigger("fancybox-cancel");i=false}else{i=true;a(h.add(u)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");f.is(":visible")&&
25
- c.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;c=e;if(c.overlayShow){u.css({"background-color":c.overlayColor,opacity:c.overlayOpacity,cursor:c.hideOnOverlayClick?"pointer":"auto",height:a(document).height()});if(!u.is(":visible")){M&&a("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();h.get(0).scrollTop=0;h.get(0).scrollLeft=
26
- 0;j=X();s=c.title||"";y=0;n.empty().removeAttr("style").removeClass();if(c.titleShow!==false){if(a.isFunction(c.titleFormat))b=c.titleFormat(s,l,p,c);else b=s&&s.length?c.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+c.titlePosition+'">'+s+"</div>":false;s=b;if(!(!s||s==="")){n.addClass("fancybox-title-"+
27
- c.titlePosition).html(s).appendTo("body").show();switch(c.titlePosition){case "inside":n.css({width:j.width-c.padding*2,marginLeft:c.padding,marginRight:c.padding});y=n.outerHeight(true);n.appendTo(D);j.height+=y;break;case "over":n.css({marginLeft:c.padding,width:j.width-c.padding*2,bottom:c.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-j.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:j.width-c.padding*2,paddingLeft:c.padding,paddingRight:c.padding}).appendTo(f)}}}n.hide();
28
- if(f.is(":visible")){a(E.add(z).add(A)).hide();b=f.position();r={top:b.top,left:b.left,width:f.width(),height:f.height()};d=r.width==j.width&&r.height==j.height;h.fadeTo(c.changeFade,0.3,function(){var g=function(){h.html(m.contents()).fadeTo(c.changeFade,1,R)};a.event.trigger("fancybox-change");h.empty().removeAttr("filter").css({"border-width":c.padding,width:j.width-c.padding*2,height:c.type=="image"||c.type=="swf"||c.type=="iframe"?j.height-y-c.padding*2:"auto"});if(d)g();else{B.prop=0;a(B).animate({prop:1},
29
- {duration:c.changeSpeed,easing:c.easingChange,step:S,complete:g})}})}else{f.removeAttr("style");h.css("border-width",c.padding);if(c.transitionIn=="elastic"){r=V();h.html(m.contents());f.show();if(c.opacity)j.opacity=0;B.prop=0;a(B).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:S,complete:R})}else{c.titlePosition=="inside"&&y>0&&n.show();h.css({width:j.width-c.padding*2,height:c.type=="image"||c.type=="swf"||c.type=="iframe"?j.height-y-c.padding*2:"auto"}).html(m.contents());f.css(j).fadeIn(c.transitionIn==
30
- "none"?0:c.fadeIn,R)}}}},Y=function(){if(c.enableEscapeButton||c.enableKeyboardNav)a(document).bind("keydown.fb",function(b){if(b.keyCode==27&&c.enableEscapeButton){b.preventDefault();a.fancybox.close()}else if((b.keyCode==37||b.keyCode==39)&&c.enableKeyboardNav&&b.target.tagName!=="INPUT"&&b.target.tagName!=="TEXTAREA"&&b.target.tagName!=="SELECT"){b.preventDefault();a.fancybox[b.keyCode==37?"prev":"next"]()}});if(c.showNavArrows){if(c.cyclic&&l.length>1||p!==0)z.show();if(c.cyclic&&l.length>1||
31
- p!=l.length-1)A.show()}else{z.hide();A.hide()}},R=function(){if(!a.support.opacity){h.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}f.css("height","auto");c.type!=="image"&&c.type!=="swf"&&c.type!=="iframe"&&h.css("height","auto");s&&s.length&&n.show();c.showCloseButton&&E.show();Y();c.hideOnContentClick&&h.bind("click",a.fancybox.close);c.hideOnOverlayClick&&u.bind("click",a.fancybox.close);a(window).bind("resize.fb",a.fancybox.resize);c.centerOnScroll&&a(window).bind("scroll.fb",
32
- a.fancybox.center);if(c.type=="iframe")a('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(a.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+c.href+'"></iframe>').appendTo(h);f.show();i=false;a.fancybox.center();c.onComplete(l,p,c);var b,d;if(l.length-1>p){b=l[p+1].href;if(typeof b!=="undefined"&&b.match(J)){d=new Image;d.src=b}}if(p>0){b=l[p-1].href;if(typeof b!=="undefined"&&b.match(J)){d=new Image;d.src=b}}},
33
- S=function(b){var d={width:parseInt(r.width+(j.width-r.width)*b,10),height:parseInt(r.height+(j.height-r.height)*b,10),top:parseInt(r.top+(j.top-r.top)*b,10),left:parseInt(r.left+(j.left-r.left)*b,10)};if(typeof j.opacity!=="undefined")d.opacity=b<0.5?0.5:b;f.css(d);h.css({width:d.width-c.padding*2,height:d.height-y*b-c.padding*2})},T=function(){return[a(window).width()-c.margin*2,a(window).height()-c.margin*2,a(document).scrollLeft()+c.margin,a(document).scrollTop()+c.margin]},X=function(){var b=
34
- T(),d={},g=c.autoScale,k=c.padding*2;d.width=c.width.toString().indexOf("%")>-1?parseInt(b[0]*parseFloat(c.width)/100,10):c.width+k;d.height=c.height.toString().indexOf("%")>-1?parseInt(b[1]*parseFloat(c.height)/100,10):c.height+k;if(g&&(d.width>b[0]||d.height>b[1]))if(e.type=="image"||e.type=="swf"){g=c.width/c.height;if(d.width>b[0]){d.width=b[0];d.height=parseInt((d.width-k)/g+k,10)}if(d.height>b[1]){d.height=b[1];d.width=parseInt((d.height-k)*g+k,10)}}else{d.width=Math.min(d.width,b[0]);d.height=
35
- Math.min(d.height,b[1])}d.top=parseInt(Math.max(b[3]-20,b[3]+(b[1]-d.height-40)*0.5),10);d.left=parseInt(Math.max(b[2]-20,b[2]+(b[0]-d.width-40)*0.5),10);return d},V=function(){var b=e.orig?a(e.orig):false,d={};if(b&&b.length){d=b.offset();d.top+=parseInt(b.css("paddingTop"),10)||0;d.left+=parseInt(b.css("paddingLeft"),10)||0;d.top+=parseInt(b.css("border-top-width"),10)||0;d.left+=parseInt(b.css("border-left-width"),10)||0;d.width=b.width();d.height=b.height();d={width:d.width+c.padding*2,height:d.height+
36
- c.padding*2,top:d.top-c.padding-20,left:d.left-c.padding-20}}else{b=T();d={width:c.padding*2,height:c.padding*2,top:parseInt(b[3]+b[1]*0.5,10),left:parseInt(b[2]+b[0]*0.5,10)}}return d},Z=function(){if(t.is(":visible")){a("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};a.fn.fancybox=function(b){if(!a(this).length)return this;a(this).data("fancybox",a.extend({},b,a.metadata?a(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!i){i=true;a(this).blur();
37
- o=[];q=0;d=a(this).attr("rel")||"";if(!d||d==""||d==="nofollow")o.push(this);else{o=a("a[rel="+d+"], area[rel="+d+"]");q=o.index(this)}H()}});return this};a.fancybox=function(b,d){var g;if(!i){i=true;g=typeof d!=="undefined"?d:{};o=[];q=parseInt(g.index,10)||0;if(a.isArray(b)){for(var k=0,C=b.length;k<C;k++)if(typeof b[k]=="object")a(b[k]).data("fancybox",a.extend({},g,b[k]));else b[k]=a({}).data("fancybox",a.extend({content:b[k]},g));o=jQuery.merge(o,b)}else{if(typeof b=="object")a(b).data("fancybox",
38
- a.extend({},g,b));else b=a({}).data("fancybox",a.extend({content:b},g));o.push(b)}if(q>o.length||q<0)q=0;H()}};a.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};a.fancybox.hideActivity=function(){t.hide()};a.fancybox.next=function(){return a.fancybox.pos(p+1)};a.fancybox.prev=function(){return a.fancybox.pos(p-1)};a.fancybox.pos=function(b){if(!i){b=parseInt(b);o=l;if(b>-1&&b<l.length){q=b;H()}else if(c.cyclic&&l.length>1){q=b>=l.length?0:l.length-1;H()}}};a.fancybox.cancel=
39
- function(){if(!i){i=true;a.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);i=false}};a.fancybox.close=function(){function b(){u.fadeOut("fast");n.empty().hide();f.hide();a.event.trigger("fancybox-cleanup");h.empty();c.onClosed(l,p,c);l=e=[];p=q=0;c=e={};i=false}if(!(i||f.is(":hidden"))){i=true;if(c&&false===c.onCleanup(l,p,c))i=false;else{N();a(E.add(z).add(A)).hide();a(h.add(u)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");h.find("iframe").attr("src",M&&
40
- /^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");c.titlePosition!=="inside"&&n.empty();f.stop();if(c.transitionOut=="elastic"){r=V();var d=f.position();j={top:d.top,left:d.left,width:f.width(),height:f.height()};if(c.opacity)j.opacity=1;n.empty().hide();B.prop=1;a(B).animate({prop:0},{duration:c.speedOut,easing:c.easingOut,step:S,complete:b})}else f.fadeOut(c.transitionOut=="none"?0:c.speedOut,b)}}};a.fancybox.resize=function(){u.is(":visible")&&u.css("height",a(document).height());
41
- a.fancybox.center(true)};a.fancybox.center=function(b){var d,g;if(!i){g=b===true?1:0;d=T();!g&&(f.width()>d[0]||f.height()>d[1])||f.stop().animate({top:parseInt(Math.max(d[3]-20,d[3]+(d[1]-h.height()-40)*0.5-c.padding)),left:parseInt(Math.max(d[2]-20,d[2]+(d[0]-h.width()-40)*0.5-c.padding))},typeof b=="number"?b:200)}};a.fancybox.init=function(){if(!a("#fancybox-wrap").length){a("body").append(m=a('<div id="fancybox-tmp"></div>'),t=a('<div id="fancybox-loading"><div></div></div>'),u=a('<div id="fancybox-overlay"></div>'),
42
- f=a('<div id="fancybox-wrap"></div>'));D=a('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
43
- D.append(h=a('<div id="fancybox-content"></div>'),E=a('<a id="fancybox-close"></a>'),n=a('<div id="fancybox-title"></div>'),z=a('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=a('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(a.fancybox.close);t.click(a.fancybox.cancel);z.click(function(b){b.preventDefault();a.fancybox.prev()});A.click(function(b){b.preventDefault();a.fancybox.next()});
44
- a.fn.mousewheel&&f.bind("mousewheel.fb",function(b,d){b.preventDefault();a.fancybox[d>0?"prev":"next"]()});a.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");a('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};a.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,
45
- 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,
46
- enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};a(document).ready(function(){a.fancybox.init()})})(jQuery);