promethee 1.7.12 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/promethee/rails/version.rb +1 -1
  3. data/node_modules/@fancyapps/fancybox/README.md +1 -1
  4. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.css +162 -161
  5. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.js +1281 -790
  6. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.min.css +1 -1
  7. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.min.js +4 -3
  8. data/node_modules/@fancyapps/fancybox/docs/index.html +1398 -1321
  9. data/node_modules/@fancyapps/fancybox/package.json +52 -43
  10. data/node_modules/@fancyapps/fancybox/src/css/core.css +144 -142
  11. data/node_modules/@fancyapps/fancybox/src/css/thumbs.css +20 -23
  12. data/node_modules/@fancyapps/fancybox/src/js/core.js +883 -536
  13. data/node_modules/@fancyapps/fancybox/src/js/fullscreen.js +67 -64
  14. data/node_modules/@fancyapps/fancybox/src/js/guestures.js +114 -78
  15. data/node_modules/@fancyapps/fancybox/src/js/hash.js +13 -18
  16. data/node_modules/@fancyapps/fancybox/src/js/media.js +118 -29
  17. data/node_modules/@fancyapps/fancybox/src/js/share.js +8 -6
  18. data/node_modules/@fancyapps/fancybox/src/js/slideshow.js +55 -32
  19. data/node_modules/@fancyapps/fancybox/src/js/thumbs.js +22 -26
  20. data/node_modules/@fancyapps/fancybox/src/js/wheel.js +1 -1
  21. metadata +2 -46
  22. data/node_modules/fancybox/CHANGELOG.md +0 -125
  23. data/node_modules/fancybox/README.md +0 -249
  24. data/node_modules/fancybox/bower.json +0 -24
  25. data/node_modules/fancybox/demo/1_b.jpg +0 -0
  26. data/node_modules/fancybox/demo/1_s.jpg +0 -0
  27. data/node_modules/fancybox/demo/2_b.jpg +0 -0
  28. data/node_modules/fancybox/demo/2_s.jpg +0 -0
  29. data/node_modules/fancybox/demo/3_b.jpg +0 -0
  30. data/node_modules/fancybox/demo/3_s.jpg +0 -0
  31. data/node_modules/fancybox/demo/4_b.jpg +0 -0
  32. data/node_modules/fancybox/demo/4_s.jpg +0 -0
  33. data/node_modules/fancybox/demo/5_b.jpg +0 -0
  34. data/node_modules/fancybox/demo/5_s.jpg +0 -0
  35. data/node_modules/fancybox/demo/ajax.txt +0 -15
  36. data/node_modules/fancybox/demo/iframe.html +0 -26
  37. data/node_modules/fancybox/demo/index.html +0 -312
  38. data/node_modules/fancybox/dist/css/jquery.fancybox.css +0 -222
  39. data/node_modules/fancybox/dist/helpers/css/jquery.fancybox-buttons.css +0 -82
  40. data/node_modules/fancybox/dist/helpers/css/jquery.fancybox-thumbs.css +0 -46
  41. data/node_modules/fancybox/dist/helpers/img/fancybox_buttons.png +0 -0
  42. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-buttons.cjs.js +0 -121
  43. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-buttons.js +0 -122
  44. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-media.cjs.js +0 -199
  45. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-media.js +0 -199
  46. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-thumbs.cjs.js +0 -164
  47. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-thumbs.js +0 -165
  48. data/node_modules/fancybox/dist/helpers/scss/jquery.fancybox-buttons.scss +0 -100
  49. data/node_modules/fancybox/dist/helpers/scss/jquery.fancybox-thumbs.scss +0 -55
  50. data/node_modules/fancybox/dist/img/blank.gif +0 -0
  51. data/node_modules/fancybox/dist/img/fancybox_loading.gif +0 -0
  52. data/node_modules/fancybox/dist/img/fancybox_loading@2x.gif +0 -0
  53. data/node_modules/fancybox/dist/img/fancybox_overlay.png +0 -0
  54. data/node_modules/fancybox/dist/img/fancybox_sprite.png +0 -0
  55. data/node_modules/fancybox/dist/img/fancybox_sprite@2x.png +0 -0
  56. data/node_modules/fancybox/dist/js/jquery.fancybox.cjs.js +0 -2027
  57. data/node_modules/fancybox/dist/js/jquery.fancybox.js +0 -2018
  58. data/node_modules/fancybox/dist/js/jquery.fancybox.pack.js +0 -46
  59. data/node_modules/fancybox/dist/scss/jquery.fancybox.scss +0 -276
  60. data/node_modules/fancybox/fancybox.jquery.json +0 -31
  61. data/node_modules/fancybox/lib/jquery-1.10.2.min.js +0 -6
  62. data/node_modules/fancybox/lib/jquery.mousewheel.pack.js +0 -14
  63. data/node_modules/fancybox/package.json +0 -32
  64. data/node_modules/fancybox/sprite.psd +0 -0
  65. data/node_modules/fancybox/test.js +0 -10
@@ -1,100 +0,0 @@
1
- // no longer use image-url since that is not a part of the sass spec. Instead assign your path to this variable
2
- $fancybox-image-url: '../img' !default;
3
-
4
- #fancybox-buttons {
5
- position: fixed;
6
- left: 0;
7
- width: 100%;
8
- z-index: 8050;
9
- }
10
-
11
- #fancybox-buttons.top {
12
- top: 10px;
13
- }
14
-
15
- #fancybox-buttons.bottom {
16
- bottom: 10px;
17
- }
18
-
19
- #fancybox-buttons ul {
20
- display: block;
21
- width: 166px;
22
- height: 30px;
23
- margin: 0 auto;
24
- padding: 0;
25
- list-style: none;
26
- border: 1px solid #111;
27
- border-radius: 3px;
28
- -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
29
- -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
30
- box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
31
- background: rgb(50,50,50);
32
- background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%);
33
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51)));
34
- background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
35
- background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
36
- background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
37
- background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
38
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 );
39
- }
40
-
41
- #fancybox-buttons ul li {
42
- float: left;
43
- margin: 0;
44
- padding: 0;
45
- }
46
-
47
- #fancybox-buttons a {
48
- display: block;
49
- width: 30px;
50
- height: 30px;
51
- text-indent: -9999px;
52
- background-color: transparent;
53
- background-image: url('#{$fancybox-image-url}/fancybox_buttons.png');
54
- background-repeat: no-repeat;
55
- outline: none;
56
- opacity: 0.8;
57
- }
58
-
59
- #fancybox-buttons a:hover {
60
- opacity: 1;
61
- }
62
-
63
- #fancybox-buttons a.btnPrev {
64
- background-position: 5px 0;
65
- }
66
-
67
- #fancybox-buttons a.btnNext {
68
- background-position: -33px 0;
69
- border-right: 1px solid #3e3e3e;
70
- }
71
-
72
- #fancybox-buttons a.btnPlay {
73
- background-position: 0 -30px;
74
- }
75
-
76
- #fancybox-buttons a.btnPlayOn {
77
- background-position: -30px -30px;
78
- }
79
-
80
- #fancybox-buttons a.btnToggle {
81
- background-position: 3px -60px;
82
- border-left: 1px solid #111;
83
- border-right: 1px solid #3e3e3e;
84
- width: 35px
85
- }
86
-
87
- #fancybox-buttons a.btnToggleOn {
88
- background-position: -27px -60px;
89
- }
90
-
91
- #fancybox-buttons a.btnClose {
92
- border-left: 1px solid #111;
93
- width: 35px;
94
- background-position: -56px 0px;
95
- }
96
-
97
- #fancybox-buttons a.btnDisabled {
98
- opacity : 0.4;
99
- cursor: default;
100
- }
@@ -1,55 +0,0 @@
1
- #fancybox-thumbs {
2
- position: fixed;
3
- left: 0;
4
- width: 100%;
5
- overflow: hidden;
6
- z-index: 8050;
7
- }
8
-
9
- #fancybox-thumbs.bottom {
10
- bottom: 2px;
11
- }
12
-
13
- #fancybox-thumbs.top {
14
- top: 2px;
15
- }
16
-
17
- #fancybox-thumbs ul {
18
- position: relative;
19
- list-style: none;
20
- margin: 0;
21
- padding: 0;
22
- }
23
-
24
- #fancybox-thumbs ul li {
25
- float: left;
26
- padding: 1px;
27
- opacity: 0.5;
28
- }
29
-
30
- #fancybox-thumbs ul li.active {
31
- opacity: 0.75;
32
- padding: 0;
33
- border: 1px solid #fff;
34
- }
35
-
36
- #fancybox-thumbs ul li:hover {
37
- opacity: 1;
38
- }
39
-
40
- #fancybox-thumbs ul li a {
41
- display: block;
42
- position: relative;
43
- overflow: hidden;
44
- border: 1px solid #222;
45
- background: #111;
46
- outline: none;
47
- }
48
-
49
- #fancybox-thumbs ul li img {
50
- display: block;
51
- position: relative;
52
- border: 0;
53
- padding: 0;
54
- max-width: none;
55
- }
@@ -1,2027 +0,0 @@
1
- /*!
2
- * fancyBox - jQuery Plugin
3
- * version: 2.1.5 (Fri, 14 Jun 2013)
4
- * requires jQuery v1.6 or later
5
- *
6
- * Examples at http://fancyapps.com/fancybox/
7
- * License: www.fancyapps.com/fancybox/#license
8
- *
9
- * Copyright 2012 Janis Skarnelis - janis@fancyapps.com
10
- *
11
- */
12
-
13
- module.exports = function(jQuery) {
14
- "use strict";
15
-
16
- var H = jQuery("html"),
17
- W = jQuery(window),
18
- D = jQuery(document),
19
- F = jQuery.fancybox = function() {
20
- F.open.apply(this, arguments);
21
- },
22
- IE = navigator.userAgent.match(/msie/i),
23
- didUpdate = null,
24
- isTouch = document.createTouch !== undefined,
25
-
26
- isQuery = function(obj) {
27
- return obj && obj.hasOwnProperty && obj instanceof jQuery;
28
- },
29
- isString = function(str) {
30
- return str && jQuery.type(str) === "string";
31
- },
32
- isPercentage = function(str) {
33
- return isString(str) && str.indexOf('%') > 0;
34
- },
35
- isScrollable = function(el) {
36
- return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
37
- },
38
- getScalar = function(orig, dim) {
39
- var value = parseInt(orig, 10) || 0;
40
-
41
- if (dim && isPercentage(orig)) {
42
- value = F.getViewport()[dim] / 100 * value;
43
- }
44
-
45
- return Math.ceil(value);
46
- },
47
- getValue = function(value, dim) {
48
- return getScalar(value, dim) + 'px';
49
- };
50
-
51
- jQuery.extend(F, {
52
- // The current version of fancyBox
53
- version: '2.1.5',
54
-
55
- defaults: {
56
- padding: 15,
57
- margin: 20,
58
-
59
- width: 800,
60
- height: 600,
61
- minWidth: 100,
62
- minHeight: 100,
63
- maxWidth: 9999,
64
- maxHeight: 9999,
65
- pixelRatio: 1, // Set to 2 for retina display support
66
-
67
- autoSize: true,
68
- autoHeight: false,
69
- autoWidth: false,
70
-
71
- autoResize: true,
72
- autoCenter: !isTouch,
73
- fitToView: true,
74
- aspectRatio: false,
75
- topRatio: 0.5,
76
- leftRatio: 0.5,
77
-
78
- scrolling: 'auto', // 'auto', 'yes' or 'no'
79
- wrapCSS: '',
80
-
81
- arrows: true,
82
- closeBtn: true,
83
- closeClick: false,
84
- nextClick: false,
85
- mouseWheel: true,
86
- autoPlay: false,
87
- playSpeed: 3000,
88
- preload: 3,
89
- modal: false,
90
- loop: true,
91
-
92
- ajax: {
93
- dataType: 'html',
94
- headers: {
95
- 'X-fancyBox': true
96
- }
97
- },
98
- iframe: {
99
- scrolling: 'auto',
100
- preload: true
101
- },
102
- swf: {
103
- wmode: 'transparent',
104
- allowfullscreen: 'true',
105
- allowscriptaccess: 'always'
106
- },
107
-
108
- keys: {
109
- next: {
110
- 13: 'left', // enter
111
- 34: 'up', // page down
112
- 39: 'left', // right arrow
113
- 40: 'up' // down arrow
114
- },
115
- prev: {
116
- 8: 'right', // backspace
117
- 33: 'down', // page up
118
- 37: 'right', // left arrow
119
- 38: 'down' // up arrow
120
- },
121
- close: [27], // escape key
122
- play: [32], // space - start/stop slideshow
123
- toggle: [70] // letter "f" - toggle fullscreen
124
- },
125
-
126
- direction: {
127
- next: 'left',
128
- prev: 'right'
129
- },
130
-
131
- scrollOutside: true,
132
-
133
- // Override some properties
134
- index: 0,
135
- type: null,
136
- href: null,
137
- content: null,
138
- title: null,
139
-
140
- // HTML templates
141
- tpl: {
142
- wrap: '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
143
- image: '<img class="fancybox-image" src="{href}" alt="" />',
144
- iframe: '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
145
- error: '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
146
- closeBtn: '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
147
- next: '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
148
- prev: '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
149
- loading: '<div id="fancybox-loading"><div></div></div>'
150
- },
151
-
152
- // Properties for each animation type
153
- // Opening fancyBox
154
- openEffect: 'fade', // 'elastic', 'fade' or 'none'
155
- openSpeed: 250,
156
- openEasing: 'swing',
157
- openOpacity: true,
158
- openMethod: 'zoomIn',
159
-
160
- // Closing fancyBox
161
- closeEffect: 'fade', // 'elastic', 'fade' or 'none'
162
- closeSpeed: 250,
163
- closeEasing: 'swing',
164
- closeOpacity: true,
165
- closeMethod: 'zoomOut',
166
-
167
- // Changing next gallery item
168
- nextEffect: 'elastic', // 'elastic', 'fade' or 'none'
169
- nextSpeed: 250,
170
- nextEasing: 'swing',
171
- nextMethod: 'changeIn',
172
-
173
- // Changing previous gallery item
174
- prevEffect: 'elastic', // 'elastic', 'fade' or 'none'
175
- prevSpeed: 250,
176
- prevEasing: 'swing',
177
- prevMethod: 'changeOut',
178
-
179
- // Enable default helpers
180
- helpers: {
181
- overlay: true,
182
- title: true
183
- },
184
-
185
- // Callbacks
186
- onCancel: jQuery.noop, // If canceling
187
- beforeLoad: jQuery.noop, // Before loading
188
- afterLoad: jQuery.noop, // After loading
189
- beforeShow: jQuery.noop, // Before changing in current item
190
- afterShow: jQuery.noop, // After opening
191
- beforeChange: jQuery.noop, // Before changing gallery item
192
- beforeClose: jQuery.noop, // Before closing
193
- afterClose: jQuery.noop // After closing
194
- },
195
-
196
- //Current state
197
- group: {}, // Selected group
198
- opts: {}, // Group options
199
- previous: null, // Previous element
200
- coming: null, // Element being loaded
201
- current: null, // Currently loaded element
202
- isActive: false, // Is activated
203
- isOpen: false, // Is currently open
204
- isOpened: false, // Have been fully opened at least once
205
-
206
- wrap: null,
207
- skin: null,
208
- outer: null,
209
- inner: null,
210
-
211
- player: {
212
- timer: null,
213
- isActive: false
214
- },
215
-
216
- // Loaders
217
- ajaxLoad: null,
218
- imgPreload: null,
219
-
220
- // Some collections
221
- transitions: {},
222
- helpers: {},
223
-
224
- /*
225
- * Static methods
226
- */
227
-
228
- open: function(group, opts) {
229
- if (!group) {
230
- return;
231
- }
232
-
233
- if (!jQuery.isPlainObject(opts)) {
234
- opts = {};
235
- }
236
-
237
- // Close if already active
238
- if (false === F.close(true)) {
239
- return;
240
- }
241
-
242
- // Normalize group
243
- if (!jQuery.isArray(group)) {
244
- group = isQuery(group) ? jQuery(group).get() : [group];
245
- }
246
-
247
- // Recheck if the type of each element is `object` and set content type (image, ajax, etc)
248
- jQuery.each(group, function(i, element) {
249
- var obj = {},
250
- href,
251
- title,
252
- content,
253
- type,
254
- rez,
255
- hrefParts,
256
- selector;
257
-
258
- if (jQuery.type(element) === "object") {
259
- // Check if is DOM element
260
- if (element.nodeType) {
261
- element = jQuery(element);
262
- }
263
-
264
- if (isQuery(element)) {
265
- obj = {
266
- href: element.data('fancybox-href') || element.attr('href'),
267
- title: jQuery('<div/>').text(element.data('fancybox-title') || element.attr('title') || '').html(),
268
- isDom: true,
269
- element: element
270
- };
271
-
272
- if (jQuery.metadata) {
273
- jQuery.extend(true, obj, element.metadata());
274
- }
275
-
276
- } else {
277
- obj = element;
278
- }
279
- }
280
-
281
- href = opts.href || obj.href || (isString(element) ? element : null);
282
- title = opts.title !== undefined ? opts.title : obj.title || '';
283
-
284
- content = opts.content || obj.content;
285
- type = content ? 'html' : (opts.type || obj.type);
286
-
287
- if (!type && obj.isDom) {
288
- type = element.data('fancybox-type');
289
-
290
- if (!type) {
291
- rez = element.prop('class').match(/fancybox\.(\w+)/);
292
- type = rez ? rez[1] : null;
293
- }
294
- }
295
-
296
- if (isString(href)) {
297
- // Try to guess the content type
298
- if (!type) {
299
- if (F.isImage(href)) {
300
- type = 'image';
301
-
302
- } else if (F.isSWF(href)) {
303
- type = 'swf';
304
-
305
- } else if (href.charAt(0) === '#') {
306
- type = 'inline';
307
-
308
- } else if (isString(element)) {
309
- type = 'html';
310
- content = element;
311
- }
312
- }
313
-
314
- // Split url into two pieces with source url and content selector, e.g,
315
- // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
316
- if (type === 'ajax') {
317
- hrefParts = href.split(/\s+/, 2);
318
- href = hrefParts.shift();
319
- selector = hrefParts.shift();
320
- }
321
- }
322
-
323
- if (!content) {
324
- if (type === 'inline') {
325
- if (href) {
326
- content = jQuery(isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href); //strip for ie7
327
-
328
- } else if (obj.isDom) {
329
- content = element;
330
- }
331
-
332
- } else if (type === 'html') {
333
- content = href;
334
-
335
- } else if (!type && !href && obj.isDom) {
336
- type = 'inline';
337
- content = element;
338
- }
339
- }
340
-
341
- jQuery.extend(obj, {
342
- href: href,
343
- type: type,
344
- content: content,
345
- title: title,
346
- selector: selector
347
- });
348
-
349
- group[i] = obj;
350
- });
351
-
352
- // Extend the defaults
353
- F.opts = jQuery.extend(true, {}, F.defaults, opts);
354
-
355
- // All options are merged recursive except keys
356
- if (opts.keys !== undefined) {
357
- F.opts.keys = opts.keys ? jQuery.extend({}, F.defaults.keys, opts.keys) : false;
358
- }
359
-
360
- F.group = group;
361
-
362
- return F._start(F.opts.index);
363
- },
364
-
365
- // Cancel image loading or abort ajax request
366
- cancel: function() {
367
- var coming = F.coming;
368
-
369
- if (coming && false === F.trigger('onCancel')) {
370
- return;
371
- }
372
-
373
- F.hideLoading();
374
-
375
- if (!coming) {
376
- return;
377
- }
378
-
379
- if (F.ajaxLoad) {
380
- F.ajaxLoad.abort();
381
- }
382
-
383
- F.ajaxLoad = null;
384
-
385
- if (F.imgPreload) {
386
- F.imgPreload.onload = F.imgPreload.onerror = null;
387
- }
388
-
389
- if (coming.wrap) {
390
- coming.wrap.stop(true, true).trigger('onReset').remove();
391
- }
392
-
393
- F.coming = null;
394
-
395
- // If the first item has been canceled, then clear everything
396
- if (!F.current) {
397
- F._afterZoomOut(coming);
398
- }
399
- },
400
-
401
- // Start closing animation if is open; remove immediately if opening/closing
402
- close: function(event) {
403
- F.cancel();
404
-
405
- if (false === F.trigger('beforeClose')) {
406
- return;
407
- }
408
-
409
- F.unbindEvents();
410
-
411
- if (!F.isActive) {
412
- return;
413
- }
414
-
415
- if (!F.isOpen || event === true) {
416
- jQuery('.fancybox-wrap').stop(true).trigger('onReset').remove();
417
-
418
- F._afterZoomOut();
419
-
420
- } else {
421
- F.isOpen = F.isOpened = false;
422
- F.isClosing = true;
423
-
424
- jQuery('.fancybox-item, .fancybox-nav').remove();
425
-
426
- F.wrap.stop(true, true).removeClass('fancybox-opened');
427
-
428
- F.transitions[F.current.closeMethod]();
429
- }
430
- },
431
-
432
- // Manage slideshow:
433
- // jQuery.fancybox.play(); - toggle slideshow
434
- // jQuery.fancybox.play( true ); - start
435
- // jQuery.fancybox.play( false ); - stop
436
- play: function(action) {
437
- var clear = function() {
438
- clearTimeout(F.player.timer);
439
- },
440
- set = function() {
441
- clear();
442
-
443
- if (F.current && F.player.isActive) {
444
- F.player.timer = setTimeout(F.next, F.current.playSpeed);
445
- }
446
- },
447
- stop = function() {
448
- clear();
449
-
450
- D.unbind('.player');
451
-
452
- F.player.isActive = false;
453
-
454
- F.trigger('onPlayEnd');
455
- },
456
- start = function() {
457
- if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
458
- F.player.isActive = true;
459
-
460
- D.bind({
461
- 'onCancel.player beforeClose.player': stop,
462
- 'onUpdate.player': set,
463
- 'beforeLoad.player': clear
464
- });
465
-
466
- set();
467
-
468
- F.trigger('onPlayStart');
469
- }
470
- };
471
-
472
- if (action === true || (!F.player.isActive && action !== false)) {
473
- start();
474
- } else {
475
- stop();
476
- }
477
- },
478
-
479
- // Navigate to next gallery item
480
- next: function(direction) {
481
- var current = F.current;
482
-
483
- if (current) {
484
- if (!isString(direction)) {
485
- direction = current.direction.next;
486
- }
487
-
488
- F.jumpto(current.index + 1, direction, 'next');
489
- }
490
- },
491
-
492
- // Navigate to previous gallery item
493
- prev: function(direction) {
494
- var current = F.current;
495
-
496
- if (current) {
497
- if (!isString(direction)) {
498
- direction = current.direction.prev;
499
- }
500
-
501
- F.jumpto(current.index - 1, direction, 'prev');
502
- }
503
- },
504
-
505
- // Navigate to gallery item by index
506
- jumpto: function(index, direction, router) {
507
- var current = F.current;
508
-
509
- if (!current) {
510
- return;
511
- }
512
-
513
- index = getScalar(index);
514
-
515
- F.direction = direction || current.direction[(index >= current.index ? 'next' : 'prev')];
516
- F.router = router || 'jumpto';
517
-
518
- if (current.loop) {
519
- if (index < 0) {
520
- index = current.group.length + (index % current.group.length);
521
- }
522
-
523
- index = index % current.group.length;
524
- }
525
-
526
- if (current.group[index] !== undefined) {
527
- F.cancel();
528
-
529
- F._start(index);
530
- }
531
- },
532
-
533
- // Center inside viewport and toggle position type to fixed or absolute if needed
534
- reposition: function(e, onlyAbsolute) {
535
- var current = F.current,
536
- wrap = current ? current.wrap : null,
537
- pos;
538
-
539
- if (wrap) {
540
- pos = F._getPosition(onlyAbsolute);
541
-
542
- if (e && e.type === 'scroll') {
543
- delete pos.position;
544
-
545
- wrap.stop(true, true).animate(pos, 200);
546
-
547
- } else {
548
- wrap.css(pos);
549
-
550
- current.pos = jQuery.extend({}, current.dim, pos);
551
- }
552
- }
553
- },
554
-
555
- update: function(e) {
556
- var type = (e && e.originalEvent && e.originalEvent.type),
557
- anyway = !type || type === 'orientationchange';
558
-
559
- if (anyway) {
560
- clearTimeout(didUpdate);
561
-
562
- didUpdate = null;
563
- }
564
-
565
- if (!F.isOpen || didUpdate) {
566
- return;
567
- }
568
-
569
- didUpdate = setTimeout(function() {
570
- var current = F.current;
571
-
572
- if (!current || F.isClosing) {
573
- return;
574
- }
575
-
576
- F.wrap.removeClass('fancybox-tmp');
577
-
578
- if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
579
- F._setDimension();
580
- }
581
-
582
- if (!(type === 'scroll' && current.canShrink)) {
583
- F.reposition(e);
584
- }
585
-
586
- F.trigger('onUpdate');
587
-
588
- didUpdate = null;
589
-
590
- }, (anyway && !isTouch ? 0 : 300));
591
- },
592
-
593
- // Shrink content to fit inside viewport or restore if resized
594
- toggle: function(action) {
595
- if (F.isOpen) {
596
- F.current.fitToView = jQuery.type(action) === "boolean" ? action : !F.current.fitToView;
597
-
598
- // Help browser to restore document dimensions
599
- if (isTouch) {
600
- F.wrap.removeAttr('style').addClass('fancybox-tmp');
601
-
602
- F.trigger('onUpdate');
603
- }
604
-
605
- F.update();
606
- }
607
- },
608
-
609
- hideLoading: function() {
610
- D.unbind('.loading');
611
-
612
- jQuery('#fancybox-loading').remove();
613
- },
614
-
615
- showLoading: function() {
616
- var el, viewport;
617
-
618
- F.hideLoading();
619
-
620
- el = jQuery(F.opts.tpl.loading).click(F.cancel).appendTo('body');
621
-
622
- // If user will press the escape-button, the request will be canceled
623
- D.bind('keydown.loading', function(e) {
624
- if ((e.which || e.keyCode) === 27) {
625
- e.preventDefault();
626
-
627
- F.cancel();
628
- }
629
- });
630
-
631
- if (!F.defaults.fixed) {
632
- viewport = F.getViewport();
633
-
634
- el.css({
635
- position: 'absolute',
636
- top: (viewport.h * 0.5) + viewport.y,
637
- left: (viewport.w * 0.5) + viewport.x
638
- });
639
- }
640
-
641
- F.trigger('onLoading');
642
- },
643
-
644
- getViewport: function() {
645
- var locked = (F.current && F.current.locked) || false,
646
- rez = {
647
- x: W.scrollLeft(),
648
- y: W.scrollTop()
649
- };
650
-
651
- if (locked && locked.length) {
652
- rez.w = locked[0].clientWidth;
653
- rez.h = locked[0].clientHeight;
654
-
655
- } else {
656
- // See http://bugs.jquery.com/ticket/6724
657
- rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
658
- rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
659
- }
660
-
661
- return rez;
662
- },
663
-
664
- // Unbind the keyboard / clicking actions
665
- unbindEvents: function() {
666
- if (F.wrap && isQuery(F.wrap)) {
667
- F.wrap.unbind('.fb');
668
- }
669
-
670
- D.unbind('.fb');
671
- W.unbind('.fb');
672
- },
673
-
674
- bindEvents: function() {
675
- var current = F.current,
676
- keys;
677
-
678
- if (!current) {
679
- return;
680
- }
681
-
682
- // Changing document height on iOS devices triggers a 'resize' event,
683
- // that can change document height... repeating infinitely
684
- W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
685
-
686
- keys = current.keys;
687
-
688
- if (keys) {
689
- D.bind('keydown.fb', function(e) {
690
- var code = e.which || e.keyCode,
691
- target = e.target || e.srcElement;
692
-
693
- // Skip esc key if loading, because showLoading will cancel preloading
694
- if (code === 27 && F.coming) {
695
- return false;
696
- }
697
-
698
- // Ignore key combinations and key events within form elements
699
- if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || jQuery(target).is('[contenteditable]')))) {
700
- jQuery.each(keys, function(i, val) {
701
- if (current.group.length > 1 && val[code] !== undefined) {
702
- F[i](val[code]);
703
-
704
- e.preventDefault();
705
- return false;
706
- }
707
-
708
- if (jQuery.inArray(code, val) > -1) {
709
- F[i]();
710
-
711
- e.preventDefault();
712
- return false;
713
- }
714
- });
715
- }
716
- });
717
- }
718
-
719
- if (jQuery.fn.mousewheel && current.mouseWheel) {
720
- F.wrap.bind('mousewheel.fb', function(e, delta, deltaX, deltaY) {
721
- var target = e.target || null,
722
- parent = jQuery(target),
723
- canScroll = false;
724
-
725
- while (parent.length) {
726
- if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
727
- break;
728
- }
729
-
730
- canScroll = isScrollable(parent[0]);
731
- parent = jQuery(parent).parent();
732
- }
733
-
734
- if (delta !== 0 && !canScroll) {
735
- if (F.group.length > 1 && !current.canShrink) {
736
- if (deltaY > 0 || deltaX > 0) {
737
- F.prev(deltaY > 0 ? 'down' : 'left');
738
-
739
- } else if (deltaY < 0 || deltaX < 0) {
740
- F.next(deltaY < 0 ? 'up' : 'right');
741
- }
742
-
743
- e.preventDefault();
744
- }
745
- }
746
- });
747
- }
748
- },
749
-
750
- trigger: function(event, o) {
751
- var ret, obj = o || F.coming || F.current;
752
-
753
- if (obj) {
754
- if (jQuery.isFunction(obj[event])) {
755
- ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
756
- }
757
-
758
- if (ret === false) {
759
- return false;
760
- }
761
-
762
- if (obj.helpers) {
763
- jQuery.each(obj.helpers, function(helper, opts) {
764
- if (opts && F.helpers[helper] && jQuery.isFunction(F.helpers[helper][event])) {
765
- F.helpers[helper][event](jQuery.extend(true, {}, F.helpers[helper].defaults, opts), obj);
766
- }
767
- });
768
- }
769
- }
770
-
771
- D.trigger(event);
772
- },
773
-
774
- isImage: function(str) {
775
- return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
776
- },
777
-
778
- isSWF: function(str) {
779
- return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
780
- },
781
-
782
- _start: function(index) {
783
- var coming = {},
784
- obj,
785
- href,
786
- type,
787
- margin,
788
- padding;
789
-
790
- index = getScalar(index);
791
- obj = F.group[index] || null;
792
-
793
- if (!obj) {
794
- return false;
795
- }
796
-
797
- coming = jQuery.extend(true, {}, F.opts, obj);
798
-
799
- // Convert margin and padding properties to array - top, right, bottom, left
800
- margin = coming.margin;
801
- padding = coming.padding;
802
-
803
- if (jQuery.type(margin) === 'number') {
804
- coming.margin = [margin, margin, margin, margin];
805
- }
806
-
807
- if (jQuery.type(padding) === 'number') {
808
- coming.padding = [padding, padding, padding, padding];
809
- }
810
-
811
- // 'modal' propery is just a shortcut
812
- if (coming.modal) {
813
- jQuery.extend(true, coming, {
814
- closeBtn: false,
815
- closeClick: false,
816
- nextClick: false,
817
- arrows: false,
818
- mouseWheel: false,
819
- keys: null,
820
- helpers: {
821
- overlay: {
822
- closeClick: false
823
- }
824
- }
825
- });
826
- }
827
-
828
- // 'autoSize' property is a shortcut, too
829
- if (coming.autoSize) {
830
- coming.autoWidth = coming.autoHeight = true;
831
- }
832
-
833
- if (coming.width === 'auto') {
834
- coming.autoWidth = true;
835
- }
836
-
837
- if (coming.height === 'auto') {
838
- coming.autoHeight = true;
839
- }
840
-
841
- /*
842
- * Add reference to the group, so it`s possible to access from callbacks, example:
843
- * afterLoad : function() {
844
- * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
845
- * }
846
- */
847
-
848
- coming.group = F.group;
849
- coming.index = index;
850
-
851
- // Give a chance for callback or helpers to update coming item (type, title, etc)
852
- F.coming = coming;
853
-
854
- if (false === F.trigger('beforeLoad')) {
855
- F.coming = null;
856
-
857
- return;
858
- }
859
-
860
- type = coming.type;
861
- href = coming.href;
862
-
863
- if (!type) {
864
- F.coming = null;
865
-
866
- //If we can not determine content type then drop silently or display next/prev item if looping through gallery
867
- if (F.current && F.router && F.router !== 'jumpto') {
868
- F.current.index = index;
869
-
870
- return F[F.router](F.direction);
871
- }
872
-
873
- return false;
874
- }
875
-
876
- F.isActive = true;
877
-
878
- if (type === 'image' || type === 'swf') {
879
- coming.autoHeight = coming.autoWidth = false;
880
- coming.scrolling = 'visible';
881
- }
882
-
883
- if (type === 'image') {
884
- coming.aspectRatio = true;
885
- }
886
-
887
- if (type === 'iframe' && isTouch) {
888
- coming.scrolling = 'scroll';
889
- }
890
-
891
- // Build the neccessary markup
892
- coming.wrap = jQuery(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo(coming.parent || 'body');
893
-
894
- jQuery.extend(coming, {
895
- skin: jQuery('.fancybox-skin', coming.wrap),
896
- outer: jQuery('.fancybox-outer', coming.wrap),
897
- inner: jQuery('.fancybox-inner', coming.wrap)
898
- });
899
-
900
- jQuery.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
901
- coming.skin.css('padding' + v, getValue(coming.padding[i]));
902
- });
903
-
904
- F.trigger('onReady');
905
-
906
- // Check before try to load; 'inline' and 'html' types need content, others - href
907
- if (type === 'inline' || type === 'html') {
908
- if (!coming.content || !coming.content.length) {
909
- return F._error('content');
910
- }
911
-
912
- } else if (!href) {
913
- return F._error('href');
914
- }
915
-
916
- if (type === 'image') {
917
- F._loadImage();
918
-
919
- } else if (type === 'ajax') {
920
- F._loadAjax();
921
-
922
- } else if (type === 'iframe') {
923
- F._loadIframe();
924
-
925
- } else {
926
- F._afterLoad();
927
- }
928
- },
929
-
930
- _error: function(type) {
931
- jQuery.extend(F.coming, {
932
- type: 'html',
933
- autoWidth: true,
934
- autoHeight: true,
935
- minWidth: 0,
936
- minHeight: 0,
937
- scrolling: 'no',
938
- hasError: type,
939
- content: F.coming.tpl.error
940
- });
941
-
942
- F._afterLoad();
943
- },
944
-
945
- _loadImage: function() {
946
- // Reset preload image so it is later possible to check "complete" property
947
- var img = F.imgPreload = new Image();
948
-
949
- img.onload = function() {
950
- this.onload = this.onerror = null;
951
-
952
- F.coming.width = this.width / F.opts.pixelRatio;
953
- F.coming.height = this.height / F.opts.pixelRatio;
954
-
955
- F._afterLoad();
956
- };
957
-
958
- img.onerror = function() {
959
- this.onload = this.onerror = null;
960
-
961
- F._error('image');
962
- };
963
-
964
- img.src = F.coming.href;
965
-
966
- if (img.complete !== true) {
967
- F.showLoading();
968
- }
969
- },
970
-
971
- _loadAjax: function() {
972
- var coming = F.coming;
973
-
974
- F.showLoading();
975
-
976
- F.ajaxLoad = jQuery.ajax(jQuery.extend({}, coming.ajax, {
977
- url: coming.href,
978
- error: function(jqXHR, textStatus) {
979
- if (F.coming && textStatus !== 'abort') {
980
- F._error('ajax', jqXHR);
981
-
982
- } else {
983
- F.hideLoading();
984
- }
985
- },
986
- success: function(data, textStatus) {
987
- if (textStatus === 'success') {
988
- coming.content = data;
989
-
990
- F._afterLoad();
991
- }
992
- }
993
- }));
994
- },
995
-
996
- _loadIframe: function() {
997
- var coming = F.coming,
998
- iframe = jQuery(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
999
- .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
1000
- .attr('src', coming.href);
1001
-
1002
- // This helps IE
1003
- jQuery(coming.wrap).bind('onReset', function() {
1004
- try {
1005
- jQuery(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
1006
- } catch (e) {}
1007
- });
1008
-
1009
- if (coming.iframe.preload) {
1010
- F.showLoading();
1011
-
1012
- iframe.one('load', function() {
1013
- jQuery(this).data('ready', 1);
1014
-
1015
- // iOS will lose scrolling if we resize
1016
- if (!isTouch) {
1017
- jQuery(this).bind('load.fb', F.update);
1018
- }
1019
-
1020
- // Without this trick:
1021
- // - iframe won't scroll on iOS devices
1022
- // - IE7 sometimes displays empty iframe
1023
- jQuery(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
1024
-
1025
- F._afterLoad();
1026
- });
1027
- }
1028
-
1029
- coming.content = iframe.appendTo(coming.inner);
1030
-
1031
- if (!coming.iframe.preload) {
1032
- F._afterLoad();
1033
- }
1034
- },
1035
-
1036
- _preloadImages: function() {
1037
- var group = F.group,
1038
- current = F.current,
1039
- len = group.length,
1040
- cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
1041
- item,
1042
- i;
1043
-
1044
- for (i = 1; i <= cnt; i += 1) {
1045
- item = group[(current.index + i) % len];
1046
-
1047
- if (item.type === 'image' && item.href) {
1048
- new Image().src = item.href;
1049
- }
1050
- }
1051
- },
1052
-
1053
- _afterLoad: function() {
1054
- var coming = F.coming,
1055
- previous = F.current,
1056
- placeholder = 'fancybox-placeholder',
1057
- current,
1058
- content,
1059
- type,
1060
- scrolling,
1061
- href,
1062
- embed;
1063
-
1064
- F.hideLoading();
1065
-
1066
- if (!coming || F.isActive === false) {
1067
- return;
1068
- }
1069
-
1070
- if (false === F.trigger('afterLoad', coming, previous)) {
1071
- coming.wrap.stop(true).trigger('onReset').remove();
1072
-
1073
- F.coming = null;
1074
-
1075
- return;
1076
- }
1077
-
1078
- if (previous) {
1079
- F.trigger('beforeChange', previous);
1080
-
1081
- previous.wrap.stop(true).removeClass('fancybox-opened')
1082
- .find('.fancybox-item, .fancybox-nav')
1083
- .remove();
1084
- }
1085
-
1086
- F.unbindEvents();
1087
-
1088
- current = coming;
1089
- content = coming.content;
1090
- type = coming.type;
1091
- scrolling = coming.scrolling;
1092
-
1093
- jQuery.extend(F, {
1094
- wrap: current.wrap,
1095
- skin: current.skin,
1096
- outer: current.outer,
1097
- inner: current.inner,
1098
- current: current,
1099
- previous: previous
1100
- });
1101
-
1102
- href = current.href;
1103
-
1104
- switch (type) {
1105
- case 'inline':
1106
- case 'ajax':
1107
- case 'html':
1108
- if (current.selector) {
1109
- content = jQuery('<div>').html(content).find(current.selector);
1110
-
1111
- } else if (isQuery(content)) {
1112
- if (!content.data(placeholder)) {
1113
- content.data(placeholder, jQuery('<div class="' + placeholder + '"></div>').insertAfter(content).hide());
1114
- }
1115
-
1116
- content = content.show().detach();
1117
-
1118
- current.wrap.bind('onReset', function() {
1119
- if (jQuery(this).find(content).length) {
1120
- content.hide().replaceAll(content.data(placeholder)).data(placeholder, false);
1121
- }
1122
- });
1123
- }
1124
- break;
1125
-
1126
- case 'image':
1127
- content = current.tpl.image.replace(/\{href\}/g, href);
1128
- break;
1129
-
1130
- case 'swf':
1131
- content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
1132
- embed = '';
1133
-
1134
- jQuery.each(current.swf, function(name, val) {
1135
- content += '<param name="' + name + '" value="' + val + '"></param>';
1136
- embed += ' ' + name + '="' + val + '"';
1137
- });
1138
-
1139
- content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
1140
- break;
1141
- }
1142
-
1143
- if (!(isQuery(content) && content.parent().is(current.inner))) {
1144
- current.inner.append(content);
1145
- }
1146
-
1147
- // Give a chance for helpers or callbacks to update elements
1148
- F.trigger('beforeShow');
1149
-
1150
- // Set scrolling before calculating dimensions
1151
- current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
1152
-
1153
- // Set initial dimensions and start position
1154
- F._setDimension();
1155
-
1156
- F.reposition();
1157
-
1158
- F.isOpen = false;
1159
- F.coming = null;
1160
-
1161
- F.bindEvents();
1162
-
1163
- if (!F.isOpened) {
1164
- jQuery('.fancybox-wrap').not(current.wrap).stop(true).trigger('onReset').remove();
1165
-
1166
- } else if (previous.prevMethod) {
1167
- F.transitions[previous.prevMethod]();
1168
- }
1169
-
1170
- F.transitions[F.isOpened ? current.nextMethod : current.openMethod]();
1171
-
1172
- F._preloadImages();
1173
- },
1174
-
1175
- _setDimension: function() {
1176
- var viewport = F.getViewport(),
1177
- steps = 0,
1178
- canShrink = false,
1179
- canExpand = false,
1180
- wrap = F.wrap,
1181
- skin = F.skin,
1182
- inner = F.inner,
1183
- current = F.current,
1184
- width = current.width,
1185
- height = current.height,
1186
- minWidth = current.minWidth,
1187
- minHeight = current.minHeight,
1188
- maxWidth = current.maxWidth,
1189
- maxHeight = current.maxHeight,
1190
- scrolling = current.scrolling,
1191
- scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
1192
- margin = current.margin,
1193
- wMargin = getScalar(margin[1] + margin[3]),
1194
- hMargin = getScalar(margin[0] + margin[2]),
1195
- wPadding,
1196
- hPadding,
1197
- wSpace,
1198
- hSpace,
1199
- origWidth,
1200
- origHeight,
1201
- origMaxWidth,
1202
- origMaxHeight,
1203
- ratio,
1204
- width_,
1205
- height_,
1206
- maxWidth_,
1207
- maxHeight_,
1208
- iframe,
1209
- body;
1210
-
1211
- // Reset dimensions so we could re-check actual size
1212
- wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
1213
-
1214
- wPadding = getScalar(skin.outerWidth(true) - skin.width());
1215
- hPadding = getScalar(skin.outerHeight(true) - skin.height());
1216
-
1217
- // Any space between content and viewport (margin, padding, border, title)
1218
- wSpace = wMargin + wPadding;
1219
- hSpace = hMargin + hPadding;
1220
-
1221
- origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
1222
- origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
1223
-
1224
- if (current.type === 'iframe') {
1225
- iframe = current.content;
1226
-
1227
- if (current.autoHeight && iframe.data('ready') === 1) {
1228
- try {
1229
- if (iframe[0].contentWindow.document.location) {
1230
- inner.width(origWidth).height(9999);
1231
-
1232
- body = iframe.contents().find('body');
1233
-
1234
- if (scrollOut) {
1235
- body.css('overflow-x', 'hidden');
1236
- }
1237
-
1238
- origHeight = body.outerHeight(true);
1239
- }
1240
-
1241
- } catch (e) {}
1242
- }
1243
-
1244
- } else if (current.autoWidth || current.autoHeight) {
1245
- inner.addClass('fancybox-tmp');
1246
-
1247
- // Set width or height in case we need to calculate only one dimension
1248
- if (!current.autoWidth) {
1249
- inner.width(origWidth);
1250
- }
1251
-
1252
- if (!current.autoHeight) {
1253
- inner.height(origHeight);
1254
- }
1255
-
1256
- if (current.autoWidth) {
1257
- origWidth = inner.width();
1258
- }
1259
-
1260
- if (current.autoHeight) {
1261
- origHeight = inner.height();
1262
- }
1263
-
1264
- inner.removeClass('fancybox-tmp');
1265
- }
1266
-
1267
- width = getScalar(origWidth);
1268
- height = getScalar(origHeight);
1269
-
1270
- ratio = origWidth / origHeight;
1271
-
1272
- // Calculations for the content
1273
- minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
1274
- maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
1275
-
1276
- minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
1277
- maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
1278
-
1279
- // These will be used to determine if wrap can fit in the viewport
1280
- origMaxWidth = maxWidth;
1281
- origMaxHeight = maxHeight;
1282
-
1283
- if (current.fitToView) {
1284
- maxWidth = Math.min(viewport.w - wSpace, maxWidth);
1285
- maxHeight = Math.min(viewport.h - hSpace, maxHeight);
1286
- }
1287
-
1288
- maxWidth_ = viewport.w - wMargin;
1289
- maxHeight_ = viewport.h - hMargin;
1290
-
1291
- if (current.aspectRatio) {
1292
- if (width > maxWidth) {
1293
- width = maxWidth;
1294
- height = getScalar(width / ratio);
1295
- }
1296
-
1297
- if (height > maxHeight) {
1298
- height = maxHeight;
1299
- width = getScalar(height * ratio);
1300
- }
1301
-
1302
- if (width < minWidth) {
1303
- width = minWidth;
1304
- height = getScalar(width / ratio);
1305
- }
1306
-
1307
- if (height < minHeight) {
1308
- height = minHeight;
1309
- width = getScalar(height * ratio);
1310
- }
1311
-
1312
- } else {
1313
- width = Math.max(minWidth, Math.min(width, maxWidth));
1314
-
1315
- if (current.autoHeight && current.type !== 'iframe') {
1316
- inner.width(width);
1317
-
1318
- height = inner.height();
1319
- }
1320
-
1321
- height = Math.max(minHeight, Math.min(height, maxHeight));
1322
- }
1323
-
1324
- // Try to fit inside viewport (including the title)
1325
- if (current.fitToView) {
1326
- inner.width(width).height(height);
1327
-
1328
- wrap.width(width + wPadding);
1329
-
1330
- // Real wrap dimensions
1331
- width_ = wrap.width();
1332
- height_ = wrap.height();
1333
-
1334
- if (current.aspectRatio) {
1335
- while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
1336
- if (steps++ > 19) {
1337
- break;
1338
- }
1339
-
1340
- height = Math.max(minHeight, Math.min(maxHeight, height - 10));
1341
- width = getScalar(height * ratio);
1342
-
1343
- if (width < minWidth) {
1344
- width = minWidth;
1345
- height = getScalar(width / ratio);
1346
- }
1347
-
1348
- if (width > maxWidth) {
1349
- width = maxWidth;
1350
- height = getScalar(width / ratio);
1351
- }
1352
-
1353
- inner.width(width).height(height);
1354
-
1355
- wrap.width(width + wPadding);
1356
-
1357
- width_ = wrap.width();
1358
- height_ = wrap.height();
1359
- }
1360
-
1361
- } else {
1362
- width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_)));
1363
- height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
1364
- }
1365
- }
1366
-
1367
- if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
1368
- width += scrollOut;
1369
- }
1370
-
1371
- inner.width(width).height(height);
1372
-
1373
- wrap.width(width + wPadding);
1374
-
1375
- width_ = wrap.width();
1376
- height_ = wrap.height();
1377
-
1378
- canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
1379
- canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
1380
-
1381
- jQuery.extend(current, {
1382
- dim: {
1383
- width: getValue(width_),
1384
- height: getValue(height_)
1385
- },
1386
- origWidth: origWidth,
1387
- origHeight: origHeight,
1388
- canShrink: canShrink,
1389
- canExpand: canExpand,
1390
- wPadding: wPadding,
1391
- hPadding: hPadding,
1392
- wrapSpace: height_ - skin.outerHeight(true),
1393
- skinSpace: skin.height() - height
1394
- });
1395
-
1396
- if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
1397
- inner.height('auto');
1398
- }
1399
- },
1400
-
1401
- _getPosition: function(onlyAbsolute) {
1402
- var current = F.current,
1403
- viewport = F.getViewport(),
1404
- margin = current.margin,
1405
- width = F.wrap.width() + margin[1] + margin[3],
1406
- height = F.wrap.height() + margin[0] + margin[2],
1407
- rez = {
1408
- position: 'absolute',
1409
- top: margin[0],
1410
- left: margin[3]
1411
- };
1412
-
1413
- if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
1414
- rez.position = 'fixed';
1415
-
1416
- } else if (!current.locked) {
1417
- rez.top += viewport.y;
1418
- rez.left += viewport.x;
1419
- }
1420
-
1421
- rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
1422
- rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
1423
-
1424
- return rez;
1425
- },
1426
-
1427
- _afterZoomIn: function() {
1428
- var current = F.current;
1429
-
1430
- if (!current) {
1431
- return;
1432
- }
1433
-
1434
- F.isOpen = F.isOpened = true;
1435
-
1436
- F.wrap.css('overflow', 'visible').addClass('fancybox-opened').hide().show(0);
1437
-
1438
- F.update();
1439
-
1440
- // Assign a click event
1441
- if (current.closeClick || (current.nextClick && F.group.length > 1)) {
1442
- F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
1443
- if (!jQuery(e.target).is('a') && !jQuery(e.target).parent().is('a')) {
1444
- e.preventDefault();
1445
-
1446
- F[current.closeClick ? 'close' : 'next']();
1447
- }
1448
- });
1449
- }
1450
-
1451
- // Create a close button
1452
- if (current.closeBtn) {
1453
- jQuery(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
1454
- e.preventDefault();
1455
-
1456
- F.close();
1457
- });
1458
- }
1459
-
1460
- // Create navigation arrows
1461
- if (current.arrows && F.group.length > 1) {
1462
- if (current.loop || current.index > 0) {
1463
- jQuery(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
1464
- }
1465
-
1466
- if (current.loop || current.index < F.group.length - 1) {
1467
- jQuery(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
1468
- }
1469
- }
1470
-
1471
- F.trigger('afterShow');
1472
-
1473
- // Stop the slideshow if this is the last item
1474
- if (!current.loop && current.index === current.group.length - 1) {
1475
-
1476
- F.play(false);
1477
-
1478
- } else if (F.opts.autoPlay && !F.player.isActive) {
1479
- F.opts.autoPlay = false;
1480
-
1481
- F.play(true);
1482
- }
1483
- },
1484
-
1485
- _afterZoomOut: function(obj) {
1486
- obj = obj || F.current;
1487
-
1488
- jQuery('.fancybox-wrap').trigger('onReset').remove();
1489
-
1490
- jQuery.extend(F, {
1491
- group: {},
1492
- opts: {},
1493
- router: false,
1494
- current: null,
1495
- isActive: false,
1496
- isOpened: false,
1497
- isOpen: false,
1498
- isClosing: false,
1499
- wrap: null,
1500
- skin: null,
1501
- outer: null,
1502
- inner: null
1503
- });
1504
-
1505
- F.trigger('afterClose', obj);
1506
- }
1507
- });
1508
-
1509
- /*
1510
- * Default transitions
1511
- */
1512
-
1513
- F.transitions = {
1514
- getOrigPosition: function() {
1515
- var current = F.current,
1516
- element = current.element,
1517
- orig = current.orig,
1518
- pos = {},
1519
- width = 50,
1520
- height = 50,
1521
- hPadding = current.hPadding,
1522
- wPadding = current.wPadding,
1523
- viewport = F.getViewport();
1524
-
1525
- if (!orig && current.isDom && element.is(':visible')) {
1526
- orig = element.find('img:first');
1527
-
1528
- if (!orig.length) {
1529
- orig = element;
1530
- }
1531
- }
1532
-
1533
- if (isQuery(orig)) {
1534
- pos = orig.offset();
1535
-
1536
- if (orig.is('img')) {
1537
- width = orig.outerWidth();
1538
- height = orig.outerHeight();
1539
- }
1540
-
1541
- } else {
1542
- pos.top = viewport.y + (viewport.h - height) * current.topRatio;
1543
- pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
1544
- }
1545
-
1546
- if (F.wrap.css('position') === 'fixed' || current.locked) {
1547
- pos.top -= viewport.y;
1548
- pos.left -= viewport.x;
1549
- }
1550
-
1551
- pos = {
1552
- top: getValue(pos.top - hPadding * current.topRatio),
1553
- left: getValue(pos.left - wPadding * current.leftRatio),
1554
- width: getValue(width + wPadding),
1555
- height: getValue(height + hPadding)
1556
- };
1557
-
1558
- return pos;
1559
- },
1560
-
1561
- step: function(now, fx) {
1562
- var ratio,
1563
- padding,
1564
- value,
1565
- prop = fx.prop,
1566
- current = F.current,
1567
- wrapSpace = current.wrapSpace,
1568
- skinSpace = current.skinSpace;
1569
-
1570
- if (prop === 'width' || prop === 'height') {
1571
- ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
1572
-
1573
- if (F.isClosing) {
1574
- ratio = 1 - ratio;
1575
- }
1576
-
1577
- padding = prop === 'width' ? current.wPadding : current.hPadding;
1578
- value = now - padding;
1579
-
1580
- F.skin[prop](getScalar(prop === 'width' ? value : value - (wrapSpace * ratio)));
1581
- F.inner[prop](getScalar(prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio)));
1582
- }
1583
- },
1584
-
1585
- zoomIn: function() {
1586
- var current = F.current,
1587
- startPos = current.pos,
1588
- effect = current.openEffect,
1589
- elastic = effect === 'elastic',
1590
- endPos = jQuery.extend({
1591
- opacity: 1
1592
- }, startPos);
1593
-
1594
- // Remove "position" property that breaks older IE
1595
- delete endPos.position;
1596
-
1597
- if (elastic) {
1598
- startPos = this.getOrigPosition();
1599
-
1600
- if (current.openOpacity) {
1601
- startPos.opacity = 0.1;
1602
- }
1603
-
1604
- } else if (effect === 'fade') {
1605
- startPos.opacity = 0.1;
1606
- }
1607
-
1608
- F.wrap.css(startPos).animate(endPos, {
1609
- duration: effect === 'none' ? 0 : current.openSpeed,
1610
- easing: current.openEasing,
1611
- step: elastic ? this.step : null,
1612
- complete: F._afterZoomIn
1613
- });
1614
- },
1615
-
1616
- zoomOut: function() {
1617
- var current = F.current,
1618
- effect = current.closeEffect,
1619
- elastic = effect === 'elastic',
1620
- endPos = {
1621
- opacity: 0.1
1622
- };
1623
-
1624
- if (elastic) {
1625
- endPos = this.getOrigPosition();
1626
-
1627
- if (current.closeOpacity) {
1628
- endPos.opacity = 0.1;
1629
- }
1630
- }
1631
-
1632
- F.wrap.animate(endPos, {
1633
- duration: effect === 'none' ? 0 : current.closeSpeed,
1634
- easing: current.closeEasing,
1635
- step: elastic ? this.step : null,
1636
- complete: F._afterZoomOut
1637
- });
1638
- },
1639
-
1640
- changeIn: function() {
1641
- var current = F.current,
1642
- effect = current.nextEffect,
1643
- startPos = current.pos,
1644
- endPos = {
1645
- opacity: 1
1646
- },
1647
- direction = F.direction,
1648
- distance = 200,
1649
- field;
1650
-
1651
- startPos.opacity = 0.1;
1652
-
1653
- if (effect === 'elastic') {
1654
- field = direction === 'down' || direction === 'up' ? 'top' : 'left';
1655
-
1656
- if (direction === 'down' || direction === 'right') {
1657
- startPos[field] = getValue(getScalar(startPos[field]) - distance);
1658
- endPos[field] = '+=' + distance + 'px';
1659
-
1660
- } else {
1661
- startPos[field] = getValue(getScalar(startPos[field]) + distance);
1662
- endPos[field] = '-=' + distance + 'px';
1663
- }
1664
- }
1665
-
1666
- // Workaround for http://bugs.jquery.com/ticket/12273
1667
- if (effect === 'none') {
1668
- F._afterZoomIn();
1669
-
1670
- } else {
1671
- F.wrap.css(startPos).animate(endPos, {
1672
- duration: current.nextSpeed,
1673
- easing: current.nextEasing,
1674
- complete: F._afterZoomIn
1675
- });
1676
- }
1677
- },
1678
-
1679
- changeOut: function() {
1680
- var previous = F.previous,
1681
- effect = previous.prevEffect,
1682
- endPos = {
1683
- opacity: 0.1
1684
- },
1685
- direction = F.direction,
1686
- distance = 200;
1687
-
1688
- if (effect === 'elastic') {
1689
- endPos[direction === 'down' || direction === 'up' ? 'top' : 'left'] = (direction === 'up' || direction === 'left' ? '-' : '+') + '=' + distance + 'px';
1690
- }
1691
-
1692
- previous.wrap.animate(endPos, {
1693
- duration: effect === 'none' ? 0 : previous.prevSpeed,
1694
- easing: previous.prevEasing,
1695
- complete: function() {
1696
- jQuery(this).trigger('onReset').remove();
1697
- }
1698
- });
1699
- }
1700
- };
1701
-
1702
- /*
1703
- * Overlay helper
1704
- */
1705
-
1706
- F.helpers.overlay = {
1707
- defaults: {
1708
- closeClick: true, // if true, fancyBox will be closed when user clicks on the overlay
1709
- speedOut: 200, // duration of fadeOut animation
1710
- showEarly: true, // indicates if should be opened immediately or wait until the content is ready
1711
- css: {}, // custom CSS properties
1712
- locked: !isTouch, // if true, the content will be locked into overlay
1713
- fixed: true // if false, the overlay CSS position property will not be set to "fixed"
1714
- },
1715
-
1716
- overlay: null, // current handle
1717
- fixed: false, // indicates if the overlay has position "fixed"
1718
- el: jQuery('html'), // element that contains "the lock"
1719
-
1720
- // Public methods
1721
- create: function(opts) {
1722
- var parent;
1723
-
1724
- opts = jQuery.extend({}, this.defaults, opts);
1725
-
1726
- if (this.overlay) {
1727
- this.close();
1728
- }
1729
-
1730
- parent = F.coming ? F.coming.parent : opts.parent;
1731
-
1732
- this.overlay = jQuery('<div class="fancybox-overlay"></div>').appendTo(parent && parent.length ? parent : 'body');
1733
- this.fixed = false;
1734
-
1735
- if (opts.fixed && F.defaults.fixed) {
1736
- this.overlay.addClass('fancybox-overlay-fixed');
1737
-
1738
- this.fixed = true;
1739
- }
1740
- },
1741
-
1742
- open: function(opts) {
1743
- var that = this;
1744
-
1745
- opts = jQuery.extend({}, this.defaults, opts);
1746
-
1747
- if (this.overlay) {
1748
- this.overlay.unbind('.overlay').width('auto').height('auto');
1749
-
1750
- } else {
1751
- this.create(opts);
1752
- }
1753
-
1754
- if (!this.fixed) {
1755
- W.bind('resize.overlay', jQuery.proxy(this.update, this));
1756
-
1757
- this.update();
1758
- }
1759
-
1760
- if (opts.closeClick) {
1761
- this.overlay.bind('click.overlay', function(e) {
1762
- if (jQuery(e.target).hasClass('fancybox-overlay')) {
1763
- if (F.isActive) {
1764
- F.close();
1765
- } else {
1766
- that.close();
1767
- }
1768
-
1769
- return false;
1770
- }
1771
- });
1772
- }
1773
-
1774
- this.overlay.css(opts.css).show();
1775
- },
1776
-
1777
- close: function() {
1778
- W.unbind('resize.overlay');
1779
-
1780
- if (this.el.hasClass('fancybox-lock')) {
1781
- jQuery('.fancybox-margin').removeClass('fancybox-margin');
1782
-
1783
- this.el.removeClass('fancybox-lock');
1784
-
1785
- W.scrollTop(this.scrollV).scrollLeft(this.scrollH);
1786
- }
1787
-
1788
- jQuery('.fancybox-overlay').remove().hide();
1789
-
1790
- jQuery.extend(this, {
1791
- overlay: null,
1792
- fixed: false
1793
- });
1794
- },
1795
-
1796
- // Private, callbacks
1797
-
1798
- update: function() {
1799
- var width = '100%', offsetWidth;
1800
-
1801
- // Reset width/height so it will not mess
1802
- this.overlay.width(width).height('100%');
1803
-
1804
- // jQuery does not return reliable result for IE
1805
- if (IE) {
1806
- offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
1807
-
1808
- if (D.width() > offsetWidth) {
1809
- width = D.width();
1810
- }
1811
-
1812
- } else if (D.width() > W.width()) {
1813
- width = D.width();
1814
- }
1815
-
1816
- this.overlay.width(width).height(D.height());
1817
- },
1818
-
1819
- // This is where we can manipulate DOM, because later it would cause iframes to reload
1820
- onReady: function(opts, obj) {
1821
- var overlay = this.overlay;
1822
-
1823
- jQuery('.fancybox-overlay').stop(true, true);
1824
-
1825
- if (!overlay) {
1826
- this.create(opts);
1827
- }
1828
-
1829
- if (opts.locked && this.fixed && obj.fixed) {
1830
- obj.locked = this.overlay.append(obj.wrap);
1831
- obj.fixed = false;
1832
- }
1833
-
1834
- if (opts.showEarly === true) {
1835
- this.beforeShow.apply(this, arguments);
1836
- }
1837
- },
1838
-
1839
- beforeShow: function(opts, obj) {
1840
- if (obj.locked && !this.el.hasClass('fancybox-lock')) {
1841
- if (this.fixPosition !== false) {
1842
- jQuery('*').filter(function() {
1843
- return (jQuery(this).css('position') === 'fixed' && !jQuery(this).hasClass("fancybox-overlay") && !jQuery(this).hasClass("fancybox-wrap"));
1844
- }).addClass('fancybox-margin');
1845
- }
1846
-
1847
- this.el.addClass('fancybox-margin');
1848
-
1849
- this.scrollV = W.scrollTop();
1850
- this.scrollH = W.scrollLeft();
1851
-
1852
- this.el.addClass('fancybox-lock');
1853
-
1854
- W.scrollTop(this.scrollV).scrollLeft(this.scrollH);
1855
- }
1856
-
1857
- this.open(opts);
1858
- },
1859
-
1860
- onUpdate: function() {
1861
- if (!this.fixed) {
1862
- this.update();
1863
- }
1864
- },
1865
-
1866
- afterClose: function(opts) {
1867
- // Remove overlay if exists and fancyBox is not opening
1868
- // (e.g., it is not being open using afterClose callback)
1869
- if (this.overlay && !F.coming) {
1870
- this.overlay.fadeOut(opts.speedOut, jQuery.proxy(this.close, this));
1871
- }
1872
- }
1873
- };
1874
-
1875
- /*
1876
- * Title helper
1877
- */
1878
-
1879
- F.helpers.title = {
1880
- defaults: {
1881
- type: 'float', // 'float', 'inside', 'outside' or 'over',
1882
- position: 'bottom' // 'top' or 'bottom'
1883
- },
1884
-
1885
- beforeShow: function(opts) {
1886
- var current = F.current,
1887
- text = current.title,
1888
- type = opts.type,
1889
- title,
1890
- target;
1891
-
1892
- if (jQuery.isFunction(text)) {
1893
- text = text.call(current.element, current);
1894
- }
1895
-
1896
- if (!isString(text) || jQuery.trim(text) === '') {
1897
- return;
1898
- }
1899
-
1900
- title = jQuery('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
1901
-
1902
- switch (type) {
1903
- case 'inside':
1904
- target = F.skin;
1905
- break;
1906
-
1907
- case 'outside':
1908
- target = F.wrap;
1909
- break;
1910
-
1911
- case 'over':
1912
- target = F.inner;
1913
- break;
1914
-
1915
- default: // 'float'
1916
- target = F.skin;
1917
-
1918
- title.appendTo('body');
1919
-
1920
- if (IE) {
1921
- title.width(title.width());
1922
- }
1923
-
1924
- title.wrapInner('<span class="child"></span>');
1925
-
1926
- //Increase bottom margin so this title will also fit into viewport
1927
- F.current.margin[2] += Math.abs(getScalar(title.css('margin-bottom')));
1928
- break;
1929
- }
1930
-
1931
- title[(opts.position === 'top' ? 'prependTo' : 'appendTo')](target);
1932
- }
1933
- };
1934
-
1935
- // jQuery plugin initialization
1936
- jQuery.fn.fancybox = function(options) {
1937
- var index,
1938
- that = jQuery(this),
1939
- selector = this.selector || '',
1940
- run = function(e) {
1941
- var what = jQuery(this).blur(), idx = index, relType, relVal;
1942
-
1943
- if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
1944
- relType = options.groupAttr || 'data-fancybox-group';
1945
- relVal = what.attr(relType);
1946
-
1947
- if (!relVal) {
1948
- relType = 'rel';
1949
- relVal = what.get(0)[relType];
1950
- }
1951
-
1952
- if (relVal && relVal !== '' && relVal !== 'nofollow') {
1953
- what = selector.length ? jQuery(selector) : that;
1954
- what = what.filter('[' + relType + '="' + relVal + '"]');
1955
- idx = what.index(this);
1956
- }
1957
-
1958
- options.index = idx;
1959
-
1960
- // Stop an event from bubbling if everything is fine
1961
- if (F.open(what, options) !== false) {
1962
- e.preventDefault();
1963
- }
1964
- }
1965
- };
1966
-
1967
- options = options || {};
1968
- index = options.index || 0;
1969
-
1970
- if (!selector || options.live === false) {
1971
- that.unbind('click.fb-start').bind('click.fb-start', run);
1972
-
1973
- } else {
1974
- D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
1975
- }
1976
-
1977
- this.filter('[data-fancybox-start=1]').trigger('click');
1978
-
1979
- return this;
1980
- };
1981
-
1982
- // Tests that need a body at doc ready
1983
- D.ready(function() {
1984
- var w1, w2;
1985
-
1986
- if (jQuery.scrollbarWidth === undefined) {
1987
- // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
1988
- jQuery.scrollbarWidth = function() {
1989
- var parent = jQuery('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
1990
- child = parent.children(),
1991
- width = child.innerWidth() - child.height(99).innerWidth();
1992
-
1993
- parent.remove();
1994
-
1995
- return width;
1996
- };
1997
- }
1998
-
1999
- if (jQuery.support.fixedPosition === undefined) {
2000
- jQuery.support.fixedPosition = (function() {
2001
- var elem = jQuery('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
2002
- fixed = (elem[0].offsetTop === 20 || elem[0].offsetTop === 15);
2003
-
2004
- elem.remove();
2005
-
2006
- return fixed;
2007
- }());
2008
- }
2009
-
2010
- jQuery.extend(F.defaults, {
2011
- scrollbarWidth: jQuery.scrollbarWidth(),
2012
- fixed: jQuery.support.fixedPosition,
2013
- parent: jQuery('body')
2014
- });
2015
-
2016
- //Get real width of page scroll-bar
2017
- w1 = jQuery(window).width();
2018
-
2019
- H.addClass('fancybox-lock-test');
2020
-
2021
- w2 = jQuery(window).width();
2022
-
2023
- H.removeClass('fancybox-lock-test');
2024
-
2025
- jQuery("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
2026
- });
2027
- }