annotate static/fancybox/jquery.fancybox-1.3.4.js @ 33:028cb06a24c9 tip

usunąłem thumbs.db
author Michał Rudowicz <michal.rudowicz@fl9.eu>
date Mon, 13 Jun 2011 09:55:17 +0200
parents 50708627f3c7
children
rev   line source
30
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1 /*
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
2 * FancyBox - jQuery Plugin
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
3 * Simple and fancy lightbox alternative
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
4 *
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
5 * Examples and documentation at: http://fancybox.net
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
6 *
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
7 * Copyright (c) 2008 - 2010 Janis Skarnelis
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
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.
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
9 *
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
10 * Version: 1.3.4 (11/11/2010)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
11 * Requires: jQuery v1.3+
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
12 *
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
13 * Dual licensed under the MIT and GPL licenses:
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
14 * http://www.opensource.org/licenses/mit-license.php
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
15 * http://www.gnu.org/licenses/gpl.html
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
16 */
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
17
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
18 ;(function($) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
19 var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
20
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
21 selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
22
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
23 ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
24
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
25 loadingTimer, loadingFrame = 1,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
26
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
27 titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
28
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
29 isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
30
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
31 /*
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
32 * Private methods
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
33 */
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
34
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
35 _abort = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
36 loading.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
37
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
38 imgPreloader.onerror = imgPreloader.onload = null;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
39
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
40 if (ajaxLoader) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
41 ajaxLoader.abort();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
42 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
43
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
44 tmp.empty();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
45 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
46
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
47 _error = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
48 if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
49 loading.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
50 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
51 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
52 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
53
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
54 selectedOpts.titleShow = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
55
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
56 selectedOpts.width = 'auto';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
57 selectedOpts.height = 'auto';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
58
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
59 tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
60
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
61 _process_inline();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
62 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
63
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
64 _start = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
65 var obj = selectedArray[ selectedIndex ],
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
66 href,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
67 type,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
68 title,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
69 str,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
70 emb,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
71 ret;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
72
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
73 _abort();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
74
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
75 selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
76
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
77 ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
78
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
79 if (ret === false) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
80 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
81 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
82 } else if (typeof ret == 'object') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
83 selectedOpts = $.extend(selectedOpts, ret);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
84 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
85
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
86 title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
87
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
88 if (obj.nodeName && !selectedOpts.orig) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
89 selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
90 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
91
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
92 if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
93 title = selectedOpts.orig.attr('alt');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
94 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
95
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
96 href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
97
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
98 if ((/^(?:javascript)/i).test(href) || href == '#') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
99 href = null;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
100 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
101
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
102 if (selectedOpts.type) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
103 type = selectedOpts.type;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
104
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
105 if (!href) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
106 href = selectedOpts.content;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
107 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
108
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
109 } else if (selectedOpts.content) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
110 type = 'html';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
111
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
112 } else if (href) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
113 if (href.match(imgRegExp)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
114 type = 'image';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
115
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
116 } else if (href.match(swfRegExp)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
117 type = 'swf';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
118
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
119 } else if ($(obj).hasClass("iframe")) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
120 type = 'iframe';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
121
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
122 } else if (href.indexOf("#") === 0) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
123 type = 'inline';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
124
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
125 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
126 type = 'ajax';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
127 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
128 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
129
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
130 if (!type) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
131 _error();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
132 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
133 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
134
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
135 if (type == 'inline') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
136 obj = href.substr(href.indexOf("#"));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
137 type = $(obj).length > 0 ? 'inline' : 'ajax';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
138 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
139
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
140 selectedOpts.type = type;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
141 selectedOpts.href = href;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
142 selectedOpts.title = title;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
143
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
144 if (selectedOpts.autoDimensions) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
145 if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
146 selectedOpts.width = 'auto';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
147 selectedOpts.height = 'auto';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
148 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
149 selectedOpts.autoDimensions = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
150 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
151 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
152
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
153 if (selectedOpts.modal) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
154 selectedOpts.overlayShow = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
155 selectedOpts.hideOnOverlayClick = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
156 selectedOpts.hideOnContentClick = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
157 selectedOpts.enableEscapeButton = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
158 selectedOpts.showCloseButton = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
159 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
160
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
161 selectedOpts.padding = parseInt(selectedOpts.padding, 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
162 selectedOpts.margin = parseInt(selectedOpts.margin, 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
163
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
164 tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
165
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
166 $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
167 $(this).replaceWith(content.children());
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
168 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
169
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
170 switch (type) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
171 case 'html' :
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
172 tmp.html( selectedOpts.content );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
173 _process_inline();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
174 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
175
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
176 case 'inline' :
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
177 if ( $(obj).parent().is('#fancybox-content') === true) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
178 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
179 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
180 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
181
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
182 $('<div class="fancybox-inline-tmp" />')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
183 .hide()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
184 .insertBefore( $(obj) )
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
185 .bind('fancybox-cleanup', function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
186 $(this).replaceWith(content.children());
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
187 }).bind('fancybox-cancel', function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
188 $(this).replaceWith(tmp.children());
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
189 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
190
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
191 $(obj).appendTo(tmp);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
192
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
193 _process_inline();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
194 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
195
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
196 case 'image':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
197 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
198
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
199 $.fancybox.showActivity();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
200
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
201 imgPreloader = new Image();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
202
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
203 imgPreloader.onerror = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
204 _error();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
205 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
206
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
207 imgPreloader.onload = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
208 busy = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
209
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
210 imgPreloader.onerror = imgPreloader.onload = null;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
211
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
212 _process_image();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
213 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
214
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
215 imgPreloader.src = href;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
216 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
217
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
218 case 'swf':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
219 selectedOpts.scrolling = 'no';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
220
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
221 str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
222 emb = '';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
223
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
224 $.each(selectedOpts.swf, function(name, val) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
225 str += '<param name="' + name + '" value="' + val + '"></param>';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
226 emb += ' ' + name + '="' + val + '"';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
227 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
228
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
229 str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
230
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
231 tmp.html(str);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
232
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
233 _process_inline();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
234 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
235
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
236 case 'ajax':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
237 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
238
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
239 $.fancybox.showActivity();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
240
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
241 selectedOpts.ajax.win = selectedOpts.ajax.success;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
242
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
243 ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
244 url : href,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
245 data : selectedOpts.ajax.data || {},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
246 error : function(XMLHttpRequest, textStatus, errorThrown) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
247 if ( XMLHttpRequest.status > 0 ) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
248 _error();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
249 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
250 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
251 success : function(data, textStatus, XMLHttpRequest) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
252 var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
253 if (o.status == 200) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
254 if ( typeof selectedOpts.ajax.win == 'function' ) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
255 ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
256
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
257 if (ret === false) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
258 loading.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
259 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
260 } else if (typeof ret == 'string' || typeof ret == 'object') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
261 data = ret;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
262 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
263 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
264
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
265 tmp.html( data );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
266 _process_inline();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
267 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
268 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
269 }));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
270
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
271 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
272
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
273 case 'iframe':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
274 _show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
275 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
276 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
277 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
278
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
279 _process_inline = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
280 var
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
281 w = selectedOpts.width,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
282 h = selectedOpts.height;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
283
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
284 if (w.toString().indexOf('%') > -1) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
285 w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
286
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
287 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
288 w = w == 'auto' ? 'auto' : w + 'px';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
289 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
290
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
291 if (h.toString().indexOf('%') > -1) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
292 h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
293
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
294 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
295 h = h == 'auto' ? 'auto' : h + 'px';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
296 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
297
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
298 tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
299
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
300 selectedOpts.width = tmp.width();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
301 selectedOpts.height = tmp.height();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
302
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
303 _show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
304 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
305
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
306 _process_image = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
307 selectedOpts.width = imgPreloader.width;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
308 selectedOpts.height = imgPreloader.height;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
309
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
310 $("<img />").attr({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
311 'id' : 'fancybox-img',
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
312 'src' : imgPreloader.src,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
313 'alt' : selectedOpts.title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
314 }).appendTo( tmp );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
315
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
316 _show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
317 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
318
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
319 _show = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
320 var pos, equal;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
321
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
322 loading.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
323
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
324 if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
325 $.event.trigger('fancybox-cancel');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
326
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
327 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
328 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
329 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
330
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
331 busy = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
332
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
333 $(content.add( overlay )).unbind();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
334
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
335 $(window).unbind("resize.fb scroll.fb");
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
336 $(document).unbind('keydown.fb');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
337
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
338 if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
339 wrap.css('height', wrap.height());
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
340 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
341
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
342 currentArray = selectedArray;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
343 currentIndex = selectedIndex;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
344 currentOpts = selectedOpts;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
345
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
346 if (currentOpts.overlayShow) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
347 overlay.css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
348 'background-color' : currentOpts.overlayColor,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
349 'opacity' : currentOpts.overlayOpacity,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
350 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
351 'height' : $(document).height()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
352 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
353
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
354 if (!overlay.is(':visible')) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
355 if (isIE6) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
356 $('select:not(#fancybox-tmp select)').filter(function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
357 return this.style.visibility !== 'hidden';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
358 }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
359 this.style.visibility = 'inherit';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
360 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
361 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
362
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
363 overlay.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
364 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
365 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
366 overlay.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
367 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
368
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
369 final_pos = _get_zoom_to();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
370
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
371 _process_title();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
372
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
373 if (wrap.is(":visible")) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
374 $( close.add( nav_left ).add( nav_right ) ).hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
375
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
376 pos = wrap.position(),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
377
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
378 start_pos = {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
379 top : pos.top,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
380 left : pos.left,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
381 width : wrap.width(),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
382 height : wrap.height()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
383 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
384
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
385 equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
386
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
387 content.fadeTo(currentOpts.changeFade, 0.3, function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
388 var finish_resizing = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
389 content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
390 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
391
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
392 $.event.trigger('fancybox-change');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
393
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
394 content
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
395 .empty()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
396 .removeAttr('filter')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
397 .css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
398 'border-width' : currentOpts.padding,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
399 'width' : final_pos.width - currentOpts.padding * 2,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
400 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
401 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
402
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
403 if (equal) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
404 finish_resizing();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
405
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
406 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
407 fx.prop = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
408
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
409 $(fx).animate({prop: 1}, {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
410 duration : currentOpts.changeSpeed,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
411 easing : currentOpts.easingChange,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
412 step : _draw,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
413 complete : finish_resizing
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
414 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
415 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
416 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
417
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
418 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
419 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
420
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
421 wrap.removeAttr("style");
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
422
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
423 content.css('border-width', currentOpts.padding);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
424
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
425 if (currentOpts.transitionIn == 'elastic') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
426 start_pos = _get_zoom_from();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
427
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
428 content.html( tmp.contents() );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
429
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
430 wrap.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
431
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
432 if (currentOpts.opacity) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
433 final_pos.opacity = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
434 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
435
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
436 fx.prop = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
437
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
438 $(fx).animate({prop: 1}, {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
439 duration : currentOpts.speedIn,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
440 easing : currentOpts.easingIn,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
441 step : _draw,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
442 complete : _finish
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
443 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
444
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
445 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
446 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
447
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
448 if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
449 title.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
450 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
451
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
452 content
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
453 .css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
454 'width' : final_pos.width - currentOpts.padding * 2,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
455 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
456 })
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
457 .html( tmp.contents() );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
458
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
459 wrap
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
460 .css(final_pos)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
461 .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
462 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
463
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
464 _format_title = function(title) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
465 if (title && title.length) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
466 if (currentOpts.titlePosition == 'float') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
467 return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
468 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
469
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
470 return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
471 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
472
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
473 return false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
474 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
475
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
476 _process_title = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
477 titleStr = currentOpts.title || '';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
478 titleHeight = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
479
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
480 title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
481 .empty()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
482 .removeAttr('style')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
483 .removeClass();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
484
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
485 if (currentOpts.titleShow === false) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
486 title.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
487 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
488 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
489
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
490 titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
491
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
492 if (!titleStr || titleStr === '') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
493 title.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
494 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
495 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
496
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
497 title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
498 .addClass('fancybox-title-' + currentOpts.titlePosition)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
499 .html( titleStr )
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
500 .appendTo( 'body' )
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
501 .show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
502
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
503 switch (currentOpts.titlePosition) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
504 case 'inside':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
505 title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
506 .css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
507 'width' : final_pos.width - (currentOpts.padding * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
508 'marginLeft' : currentOpts.padding,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
509 'marginRight' : currentOpts.padding
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
510 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
511
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
512 titleHeight = title.outerHeight(true);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
513
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
514 title.appendTo( outer );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
515
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
516 final_pos.height += titleHeight;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
517 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
518
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
519 case 'over':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
520 title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
521 .css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
522 'marginLeft' : currentOpts.padding,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
523 'width' : final_pos.width - (currentOpts.padding * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
524 'bottom' : currentOpts.padding
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
525 })
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
526 .appendTo( outer );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
527 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
528
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
529 case 'float':
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
530 title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
531 .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
532 .appendTo( wrap );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
533 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
534
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
535 default:
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
536 title
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
537 .css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
538 'width' : final_pos.width - (currentOpts.padding * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
539 'paddingLeft' : currentOpts.padding,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
540 'paddingRight' : currentOpts.padding
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
541 })
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
542 .appendTo( wrap );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
543 break;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
544 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
545
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
546 title.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
547 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
548
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
549 _set_navigation = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
550 if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
551 $(document).bind('keydown.fb', function(e) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
552 if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
553 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
554 $.fancybox.close();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
555
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
556 } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
557 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
558 $.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
559 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
560 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
561 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
562
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
563 if (!currentOpts.showNavArrows) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
564 nav_left.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
565 nav_right.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
566 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
567 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
568
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
569 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
570 nav_left.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
571 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
572
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
573 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
574 nav_right.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
575 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
576 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
577
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
578 _finish = function () {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
579 if (!$.support.opacity) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
580 content.get(0).style.removeAttribute('filter');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
581 wrap.get(0).style.removeAttribute('filter');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
582 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
583
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
584 if (selectedOpts.autoDimensions) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
585 content.css('height', 'auto');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
586 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
587
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
588 wrap.css('height', 'auto');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
589
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
590 if (titleStr && titleStr.length) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
591 title.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
592 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
593
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
594 if (currentOpts.showCloseButton) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
595 close.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
596 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
597
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
598 _set_navigation();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
599
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
600 if (currentOpts.hideOnContentClick) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
601 content.bind('click', $.fancybox.close);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
602 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
603
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
604 if (currentOpts.hideOnOverlayClick) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
605 overlay.bind('click', $.fancybox.close);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
606 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
607
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
608 $(window).bind("resize.fb", $.fancybox.resize);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
609
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
610 if (currentOpts.centerOnScroll) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
611 $(window).bind("scroll.fb", $.fancybox.center);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
612 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
613
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
614 if (currentOpts.type == 'iframe') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
615 $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
616 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
617
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
618 wrap.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
619
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
620 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
621
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
622 $.fancybox.center();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
623
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
624 currentOpts.onComplete(currentArray, currentIndex, currentOpts);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
625
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
626 _preload_images();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
627 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
628
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
629 _preload_images = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
630 var href,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
631 objNext;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
632
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
633 if ((currentArray.length -1) > currentIndex) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
634 href = currentArray[ currentIndex + 1 ].href;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
635
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
636 if (typeof href !== 'undefined' && href.match(imgRegExp)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
637 objNext = new Image();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
638 objNext.src = href;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
639 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
640 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
641
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
642 if (currentIndex > 0) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
643 href = currentArray[ currentIndex - 1 ].href;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
644
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
645 if (typeof href !== 'undefined' && href.match(imgRegExp)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
646 objNext = new Image();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
647 objNext.src = href;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
648 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
649 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
650 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
651
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
652 _draw = function(pos) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
653 var dim = {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
654 width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
655 height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
656
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
657 top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
658 left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
659 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
660
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
661 if (typeof final_pos.opacity !== 'undefined') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
662 dim.opacity = pos < 0.5 ? 0.5 : pos;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
663 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
664
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
665 wrap.css(dim);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
666
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
667 content.css({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
668 'width' : dim.width - currentOpts.padding * 2,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
669 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
670 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
671 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
672
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
673 _get_viewport = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
674 return [
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
675 $(window).width() - (currentOpts.margin * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
676 $(window).height() - (currentOpts.margin * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
677 $(document).scrollLeft() + currentOpts.margin,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
678 $(document).scrollTop() + currentOpts.margin
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
679 ];
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
680 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
681
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
682 _get_zoom_to = function () {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
683 var view = _get_viewport(),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
684 to = {},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
685 resize = currentOpts.autoScale,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
686 double_padding = currentOpts.padding * 2,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
687 ratio;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
688
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
689 if (currentOpts.width.toString().indexOf('%') > -1) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
690 to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
691 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
692 to.width = currentOpts.width + double_padding;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
693 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
694
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
695 if (currentOpts.height.toString().indexOf('%') > -1) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
696 to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
697 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
698 to.height = currentOpts.height + double_padding;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
699 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
700
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
701 if (resize && (to.width > view[0] || to.height > view[1])) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
702 if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
703 ratio = (currentOpts.width ) / (currentOpts.height );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
704
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
705 if ((to.width ) > view[0]) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
706 to.width = view[0];
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
707 to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
708 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
709
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
710 if ((to.height) > view[1]) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
711 to.height = view[1];
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
712 to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
713 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
714
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
715 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
716 to.width = Math.min(to.width, view[0]);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
717 to.height = Math.min(to.height, view[1]);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
718 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
719 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
720
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
721 to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
722 to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
723
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
724 return to;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
725 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
726
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
727 _get_obj_pos = function(obj) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
728 var pos = obj.offset();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
729
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
730 pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
731 pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
732
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
733 pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
734 pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
735
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
736 pos.width = obj.width();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
737 pos.height = obj.height();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
738
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
739 return pos;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
740 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
741
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
742 _get_zoom_from = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
743 var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
744 from = {},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
745 pos,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
746 view;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
747
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
748 if (orig && orig.length) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
749 pos = _get_obj_pos(orig);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
750
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
751 from = {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
752 width : pos.width + (currentOpts.padding * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
753 height : pos.height + (currentOpts.padding * 2),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
754 top : pos.top - currentOpts.padding - 20,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
755 left : pos.left - currentOpts.padding - 20
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
756 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
757
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
758 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
759 view = _get_viewport();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
760
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
761 from = {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
762 width : currentOpts.padding * 2,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
763 height : currentOpts.padding * 2,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
764 top : parseInt(view[3] + view[1] * 0.5, 10),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
765 left : parseInt(view[2] + view[0] * 0.5, 10)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
766 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
767 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
768
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
769 return from;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
770 },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
771
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
772 _animate_loading = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
773 if (!loading.is(':visible')){
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
774 clearInterval(loadingTimer);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
775 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
776 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
777
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
778 $('div', loading).css('top', (loadingFrame * -40) + 'px');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
779
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
780 loadingFrame = (loadingFrame + 1) % 12;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
781 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
782
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
783 /*
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
784 * Public methods
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
785 */
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
786
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
787 $.fn.fancybox = function(options) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
788 if (!$(this).length) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
789 return this;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
790 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
791
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
792 $(this)
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
793 .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
794 .unbind('click.fb')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
795 .bind('click.fb', function(e) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
796 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
797
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
798 if (busy) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
799 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
800 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
801
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
802 busy = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
803
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
804 $(this).blur();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
805
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
806 selectedArray = [];
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
807 selectedIndex = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
808
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
809 var rel = $(this).attr('rel') || '';
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
810
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
811 if (!rel || rel == '' || rel === 'nofollow') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
812 selectedArray.push(this);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
813
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
814 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
815 selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
816 selectedIndex = selectedArray.index( this );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
817 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
818
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
819 _start();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
820
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
821 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
822 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
823
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
824 return this;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
825 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
826
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
827 $.fancybox = function(obj) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
828 var opts;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
829
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
830 if (busy) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
831 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
832 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
833
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
834 busy = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
835 opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
836
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
837 selectedArray = [];
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
838 selectedIndex = parseInt(opts.index, 10) || 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
839
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
840 if ($.isArray(obj)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
841 for (var i = 0, j = obj.length; i < j; i++) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
842 if (typeof obj[i] == 'object') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
843 $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
844 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
845 obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
846 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
847 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
848
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
849 selectedArray = jQuery.merge(selectedArray, obj);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
850
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
851 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
852 if (typeof obj == 'object') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
853 $(obj).data('fancybox', $.extend({}, opts, obj));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
854 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
855 obj = $({}).data('fancybox', $.extend({content : obj}, opts));
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
856 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
857
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
858 selectedArray.push(obj);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
859 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
860
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
861 if (selectedIndex > selectedArray.length || selectedIndex < 0) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
862 selectedIndex = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
863 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
864
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
865 _start();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
866 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
867
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
868 $.fancybox.showActivity = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
869 clearInterval(loadingTimer);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
870
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
871 loading.show();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
872 loadingTimer = setInterval(_animate_loading, 66);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
873 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
874
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
875 $.fancybox.hideActivity = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
876 loading.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
877 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
878
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
879 $.fancybox.next = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
880 return $.fancybox.pos( currentIndex + 1);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
881 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
882
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
883 $.fancybox.prev = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
884 return $.fancybox.pos( currentIndex - 1);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
885 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
886
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
887 $.fancybox.pos = function(pos) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
888 if (busy) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
889 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
890 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
891
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
892 pos = parseInt(pos);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
893
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
894 selectedArray = currentArray;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
895
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
896 if (pos > -1 && pos < currentArray.length) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
897 selectedIndex = pos;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
898 _start();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
899
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
900 } else if (currentOpts.cyclic && currentArray.length > 1) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
901 selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
902 _start();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
903 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
904
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
905 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
906 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
907
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
908 $.fancybox.cancel = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
909 if (busy) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
910 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
911 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
912
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
913 busy = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
914
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
915 $.event.trigger('fancybox-cancel');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
916
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
917 _abort();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
918
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
919 selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
920
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
921 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
922 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
923
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
924 // Note: within an iframe use - parent.$.fancybox.close();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
925 $.fancybox.close = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
926 if (busy || wrap.is(':hidden')) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
927 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
928 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
929
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
930 busy = true;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
931
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
932 if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
933 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
934 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
935 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
936
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
937 _abort();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
938
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
939 $(close.add( nav_left ).add( nav_right )).hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
940
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
941 $(content.add( overlay )).unbind();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
942
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
943 $(window).unbind("resize.fb scroll.fb");
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
944 $(document).unbind('keydown.fb');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
945
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
946 content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
947
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
948 if (currentOpts.titlePosition !== 'inside') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
949 title.empty();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
950 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
951
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
952 wrap.stop();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
953
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
954 function _cleanup() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
955 overlay.fadeOut('fast');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
956
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
957 title.empty().hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
958 wrap.hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
959
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
960 $.event.trigger('fancybox-cleanup');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
961
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
962 content.empty();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
963
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
964 currentOpts.onClosed(currentArray, currentIndex, currentOpts);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
965
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
966 currentArray = selectedOpts = [];
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
967 currentIndex = selectedIndex = 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
968 currentOpts = selectedOpts = {};
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
969
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
970 busy = false;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
971 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
972
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
973 if (currentOpts.transitionOut == 'elastic') {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
974 start_pos = _get_zoom_from();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
975
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
976 var pos = wrap.position();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
977
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
978 final_pos = {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
979 top : pos.top ,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
980 left : pos.left,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
981 width : wrap.width(),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
982 height : wrap.height()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
983 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
984
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
985 if (currentOpts.opacity) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
986 final_pos.opacity = 1;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
987 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
988
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
989 title.empty().hide();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
990
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
991 fx.prop = 1;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
992
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
993 $(fx).animate({ prop: 0 }, {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
994 duration : currentOpts.speedOut,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
995 easing : currentOpts.easingOut,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
996 step : _draw,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
997 complete : _cleanup
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
998 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
999
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1000 } else {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1001 wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1002 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1003 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1004
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1005 $.fancybox.resize = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1006 if (overlay.is(':visible')) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1007 overlay.css('height', $(document).height());
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1008 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1009
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1010 $.fancybox.center(true);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1011 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1012
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1013 $.fancybox.center = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1014 var view, align;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1015
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1016 if (busy) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1017 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1018 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1019
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1020 align = arguments[0] === true ? 1 : 0;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1021 view = _get_viewport();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1022
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1023 if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1024 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1025 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1026
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1027 wrap
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1028 .stop()
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1029 .animate({
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1030 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1031 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1032 }, typeof arguments[0] == 'number' ? arguments[0] : 200);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1033 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1034
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1035 $.fancybox.init = function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1036 if ($("#fancybox-wrap").length) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1037 return;
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1038 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1039
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1040 $('body').append(
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1041 tmp = $('<div id="fancybox-tmp"></div>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1042 loading = $('<div id="fancybox-loading"><div></div></div>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1043 overlay = $('<div id="fancybox-overlay"></div>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1044 wrap = $('<div id="fancybox-wrap"></div>')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1045 );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1046
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1047 outer = $('<div id="fancybox-outer"></div>')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1048 .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>')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1049 .appendTo( wrap );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1050
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1051 outer.append(
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1052 content = $('<div id="fancybox-content"></div>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1053 close = $('<a id="fancybox-close"></a>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1054 title = $('<div id="fancybox-title"></div>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1055
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1056 nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1057 nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1058 );
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1059
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1060 close.click($.fancybox.close);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1061 loading.click($.fancybox.cancel);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1062
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1063 nav_left.click(function(e) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1064 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1065 $.fancybox.prev();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1066 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1067
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1068 nav_right.click(function(e) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1069 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1070 $.fancybox.next();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1071 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1072
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1073 if ($.fn.mousewheel) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1074 wrap.bind('mousewheel.fb', function(e, delta) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1075 if (busy) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1076 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1077
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1078 } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1079 e.preventDefault();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1080 $.fancybox[ delta > 0 ? 'prev' : 'next']();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1081 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1082 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1083 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1084
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1085 if (!$.support.opacity) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1086 wrap.addClass('fancybox-ie');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1087 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1088
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1089 if (isIE6) {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1090 loading.addClass('fancybox-ie6');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1091 wrap.addClass('fancybox-ie6');
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1092
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1093 $('<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(outer);
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1094 }
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1095 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1096
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1097 $.fn.fancybox.defaults = {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1098 padding : 10,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1099 margin : 40,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1100 opacity : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1101 modal : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1102 cyclic : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1103 scrolling : 'auto', // 'auto', 'yes' or 'no'
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1104
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1105 width : 560,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1106 height : 340,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1107
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1108 autoScale : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1109 autoDimensions : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1110 centerOnScroll : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1111
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1112 ajax : {},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1113 swf : { wmode: 'transparent' },
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1114
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1115 hideOnOverlayClick : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1116 hideOnContentClick : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1117
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1118 overlayShow : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1119 overlayOpacity : 0.7,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1120 overlayColor : '#777',
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1121
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1122 titleShow : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1123 titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1124 titleFormat : null,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1125 titleFromAlt : false,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1126
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1127 transitionIn : 'fade', // 'elastic', 'fade' or 'none'
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1128 transitionOut : 'fade', // 'elastic', 'fade' or 'none'
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1129
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1130 speedIn : 300,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1131 speedOut : 300,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1132
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1133 changeSpeed : 300,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1134 changeFade : 'fast',
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1135
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1136 easingIn : 'swing',
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1137 easingOut : 'swing',
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1138
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1139 showCloseButton : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1140 showNavArrows : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1141 enableEscapeButton : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1142 enableKeyboardNav : true,
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1143
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1144 onStart : function(){},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1145 onCancel : function(){},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1146 onComplete : function(){},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1147 onCleanup : function(){},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1148 onClosed : function(){},
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1149 onError : function(){}
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1150 };
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1151
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1152 $(document).ready(function() {
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1153 $.fancybox.init();
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1154 });
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1155
50708627f3c7 Ukończona strona klienta
mild@mild-laptop
parents:
diff changeset
1156 })(jQuery);