@pimaonline/pimaonline-themepack 2.1.5

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