boletia_ui 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +42 -0
  3. data/lib/boletia_ui/version.rb +3 -0
  4. data/lib/boletia_ui.rb +8 -0
  5. data/vendor/assets/boletia_ui/fonts/ss-standard.css +53 -0
  6. data/vendor/assets/boletia_ui/fonts/ss-standard.eot +0 -0
  7. data/vendor/assets/boletia_ui/fonts/ss-standard.js +84 -0
  8. data/vendor/assets/boletia_ui/fonts/ss-standard.svg +404 -0
  9. data/vendor/assets/boletia_ui/fonts/ss-standard.ttf +0 -0
  10. data/vendor/assets/boletia_ui/fonts/ss-standard.woff +0 -0
  11. data/vendor/assets/boletia_ui/images/cancel.png +0 -0
  12. data/vendor/assets/boletia_ui/images/check.png +0 -0
  13. data/vendor/assets/boletia_ui/images/default-search.png +0 -0
  14. data/vendor/assets/boletia_ui/images/download.png +0 -0
  15. data/vendor/assets/boletia_ui/images/edit.png +0 -0
  16. data/vendor/assets/boletia_ui/images/icon-logo140.png +0 -0
  17. data/vendor/assets/boletia_ui/images/logo/header-logo-black.png +0 -0
  18. data/vendor/assets/boletia_ui/images/logo/header-logo-white.png +0 -0
  19. data/vendor/assets/boletia_ui/images/logo/icon-logo140.png +0 -0
  20. data/vendor/assets/boletia_ui/images/resend.png +0 -0
  21. data/vendor/assets/boletia_ui/images/trash.png +0 -0
  22. data/vendor/assets/boletia_ui/images/trophy.png +0 -0
  23. data/vendor/assets/boletia_ui/images/white-resend.png +0 -0
  24. data/vendor/assets/boletia_ui/images/white-search.png +0 -0
  25. data/vendor/assets/boletia_ui/javascripts/boletia-ui/boletia-ui-components.js +117 -0
  26. data/vendor/assets/boletia_ui/javascripts/boletia-ui/classie.js +80 -0
  27. data/vendor/assets/boletia_ui/javascripts/boletia-ui/select_fx.js +335 -0
  28. data/vendor/assets/boletia_ui/javascripts/charts/Chart.Legend.js +56 -0
  29. data/vendor/assets/boletia_ui/javascripts/charts/chart.min.js +11 -0
  30. data/vendor/assets/boletia_ui/javascripts/charts/refundCharts.js +167 -0
  31. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Bar.js +302 -0
  32. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Core.js +2002 -0
  33. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Doughnut.js +184 -0
  34. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Line.js +374 -0
  35. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.PolarArea.js +250 -0
  36. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Radar.js +343 -0
  37. data/vendor/assets/boletia_ui/javascripts/counter/counter.js +12 -0
  38. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  39. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  40. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_55_ffffff_40x100.png +0 -0
  41. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  42. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  43. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  44. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  45. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  46. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_0073ea_256x240.png +0 -0
  47. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_454545_256x240.png +0 -0
  48. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_666666_256x240.png +0 -0
  49. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_ff0084_256x240.png +0 -0
  50. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  51. data/vendor/assets/boletia_ui/javascripts/jquery-ui/jquery-ui.min.js +8 -0
  52. data/vendor/assets/boletia_ui/javascripts/scrolling-header/scrolling-header.js +41 -0
  53. data/vendor/assets/boletia_ui/javascripts/styleguide/styleguide.js +87 -0
  54. data/vendor/assets/boletia_ui/javascripts/tooltips/jquery.tooltipster.min.js +1 -0
  55. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/core.js +966 -0
  56. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/fastclick.js +93 -0
  57. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/image.js +245 -0
  58. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/inline.js +66 -0
  59. data/vendor/assets/boletia_ui/stylesheets/boletia-admin.css.scss +41 -0
  60. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.css +53 -0
  61. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.eot +0 -0
  62. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.js +84 -0
  63. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.svg +404 -0
  64. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.ttf +0 -0
  65. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.woff +0 -0
  66. data/vendor/assets/boletia_ui/stylesheets/jquery-ui/jquery-ui.min.css +7 -0
  67. data/vendor/assets/boletia_ui/stylesheets/jquery-ui/jquery-ui.structure.min.css +5 -0
  68. data/vendor/assets/boletia_ui/stylesheets/jquery-ui/jquery-ui.theme.css +410 -0
  69. data/vendor/assets/boletia_ui/stylesheets/layouts/_event_details.scss +100 -0
  70. data/vendor/assets/boletia_ui/stylesheets/layouts/_refund-wizard.scss +290 -0
  71. data/vendor/assets/boletia_ui/stylesheets/layouts/_sales.scss +17 -0
  72. data/vendor/assets/boletia_ui/stylesheets/layouts/_style_guide.scss +216 -0
  73. data/vendor/assets/boletia_ui/stylesheets/menu/_footer.scss +117 -0
  74. data/vendor/assets/boletia_ui/stylesheets/menu/_header.scss +314 -0
  75. data/vendor/assets/boletia_ui/stylesheets/menu/_new_front_footer.scss +117 -0
  76. data/vendor/assets/boletia_ui/stylesheets/menu/_new_front_header.scss +314 -0
  77. data/vendor/assets/boletia_ui/stylesheets/partials/_alerts.scss +183 -0
  78. data/vendor/assets/boletia_ui/stylesheets/partials/_base.scss +376 -0
  79. data/vendor/assets/boletia_ui/stylesheets/partials/_boletia-cards.scss +401 -0
  80. data/vendor/assets/boletia_ui/stylesheets/partials/_buttons.scss +200 -0
  81. data/vendor/assets/boletia_ui/stylesheets/partials/_dashboard.scss +192 -0
  82. data/vendor/assets/boletia_ui/stylesheets/partials/_forms.scss +395 -0
  83. data/vendor/assets/boletia_ui/stylesheets/partials/_grid.scss +85 -0
  84. data/vendor/assets/boletia_ui/stylesheets/partials/_tables.scss +139 -0
  85. data/vendor/assets/boletia_ui/stylesheets/partials/_wizard.scss +125 -0
  86. data/vendor/assets/boletia_ui/stylesheets/vendor/_select.scss +109 -0
  87. data/vendor/assets/boletia_ui/stylesheets/vendor/magnific-popup/_magnific.scss +642 -0
  88. data/vendor/assets/boletia_ui/stylesheets/vendor/magnific-popup/_settings.scss +45 -0
  89. data/vendor/assets/boletia_ui/stylesheets/vendor/tooltipster.css +274 -0
  90. metadata +174 -0
@@ -0,0 +1,966 @@
1
+ /**
2
+ *
3
+ * Magnific Popup Core JS file
4
+ *
5
+ */
6
+
7
+
8
+ /**
9
+ * Private static constants
10
+ */
11
+ var CLOSE_EVENT = 'Close',
12
+ BEFORE_CLOSE_EVENT = 'BeforeClose',
13
+ AFTER_CLOSE_EVENT = 'AfterClose',
14
+ BEFORE_APPEND_EVENT = 'BeforeAppend',
15
+ MARKUP_PARSE_EVENT = 'MarkupParse',
16
+ OPEN_EVENT = 'Open',
17
+ CHANGE_EVENT = 'Change',
18
+ NS = 'mfp',
19
+ EVENT_NS = '.' + NS,
20
+ READY_CLASS = 'mfp-ready',
21
+ REMOVING_CLASS = 'mfp-removing',
22
+ PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
23
+
24
+
25
+ /**
26
+ * Private vars
27
+ */
28
+ /*jshint -W079 */
29
+ var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
30
+ MagnificPopup = function(){},
31
+ _isJQ = !!(window.jQuery),
32
+ _prevStatus,
33
+ _window = $(window),
34
+ _document,
35
+ _prevContentType,
36
+ _wrapClasses,
37
+ _currPopupType;
38
+
39
+
40
+ /**
41
+ * Private functions
42
+ */
43
+ var _mfpOn = function(name, f) {
44
+ mfp.ev.on(NS + name + EVENT_NS, f);
45
+ },
46
+ _getEl = function(className, appendTo, html, raw) {
47
+ var el = document.createElement('div');
48
+ el.className = 'mfp-'+className;
49
+ if(html) {
50
+ el.innerHTML = html;
51
+ }
52
+ if(!raw) {
53
+ el = $(el);
54
+ if(appendTo) {
55
+ el.appendTo(appendTo);
56
+ }
57
+ } else if(appendTo) {
58
+ appendTo.appendChild(el);
59
+ }
60
+ return el;
61
+ },
62
+ _mfpTrigger = function(e, data) {
63
+ mfp.ev.triggerHandler(NS + e, data);
64
+
65
+ if(mfp.st.callbacks) {
66
+ // converts "mfpEventName" to "eventName" callback and triggers it if it's present
67
+ e = e.charAt(0).toLowerCase() + e.slice(1);
68
+ if(mfp.st.callbacks[e]) {
69
+ mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
70
+ }
71
+ }
72
+ },
73
+ _getCloseBtn = function(type) {
74
+ if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
75
+ mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
76
+ _currPopupType = type;
77
+ }
78
+ return mfp.currTemplate.closeBtn;
79
+ },
80
+ // Initialize Magnific Popup only when called at least once
81
+ _checkInstance = function() {
82
+ if(!$.magnificPopup.instance) {
83
+ /*jshint -W020 */
84
+ mfp = new MagnificPopup();
85
+ mfp.init();
86
+ $.magnificPopup.instance = mfp;
87
+ }
88
+ },
89
+ // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
90
+ supportsTransitions = function() {
91
+ var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
92
+ v = ['ms','O','Moz','Webkit']; // 'v' for vendor
93
+
94
+ if( s['transition'] !== undefined ) {
95
+ return true;
96
+ }
97
+
98
+ while( v.length ) {
99
+ if( v.pop() + 'Transition' in s ) {
100
+ return true;
101
+ }
102
+ }
103
+
104
+ return false;
105
+ };
106
+
107
+
108
+
109
+ /**
110
+ * Public functions
111
+ */
112
+ MagnificPopup.prototype = {
113
+
114
+ constructor: MagnificPopup,
115
+
116
+ /**
117
+ * Initializes Magnific Popup plugin.
118
+ * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
119
+ */
120
+ init: function() {
121
+ var appVersion = navigator.appVersion;
122
+ mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1;
123
+ mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1;
124
+ mfp.isLowIE = mfp.isIE7 || mfp.isIE8;
125
+ mfp.isAndroid = (/android/gi).test(appVersion);
126
+ mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
127
+ mfp.supportsTransition = supportsTransitions();
128
+
129
+ // We disable fixed positioned lightbox on devices that don't handle it nicely.
130
+ // If you know a better way of detecting this - let me know.
131
+ mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
132
+ _document = $(document);
133
+
134
+ mfp.popupsCache = {};
135
+ },
136
+
137
+ /**
138
+ * Opens popup
139
+ * @param data [description]
140
+ */
141
+ open: function(data) {
142
+
143
+ var i;
144
+
145
+ if(data.isObj === false) {
146
+ // convert jQuery collection to array to avoid conflicts later
147
+ mfp.items = data.items.toArray();
148
+
149
+ mfp.index = 0;
150
+ var items = data.items,
151
+ item;
152
+ for(i = 0; i < items.length; i++) {
153
+ item = items[i];
154
+ if(item.parsed) {
155
+ item = item.el[0];
156
+ }
157
+ if(item === data.el[0]) {
158
+ mfp.index = i;
159
+ break;
160
+ }
161
+ }
162
+ } else {
163
+ mfp.items = $.isArray(data.items) ? data.items : [data.items];
164
+ mfp.index = data.index || 0;
165
+ }
166
+
167
+ // if popup is already opened - we just update the content
168
+ if(mfp.isOpen) {
169
+ mfp.updateItemHTML();
170
+ return;
171
+ }
172
+
173
+ mfp.types = [];
174
+ _wrapClasses = '';
175
+ if(data.mainEl && data.mainEl.length) {
176
+ mfp.ev = data.mainEl.eq(0);
177
+ } else {
178
+ mfp.ev = _document;
179
+ }
180
+
181
+ if(data.key) {
182
+ if(!mfp.popupsCache[data.key]) {
183
+ mfp.popupsCache[data.key] = {};
184
+ }
185
+ mfp.currTemplate = mfp.popupsCache[data.key];
186
+ } else {
187
+ mfp.currTemplate = {};
188
+ }
189
+
190
+
191
+
192
+ mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data );
193
+ mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
194
+
195
+ if(mfp.st.modal) {
196
+ mfp.st.closeOnContentClick = false;
197
+ mfp.st.closeOnBgClick = false;
198
+ mfp.st.showCloseBtn = false;
199
+ mfp.st.enableEscapeKey = false;
200
+ }
201
+
202
+
203
+ // Building markup
204
+ // main containers are created only once
205
+ if(!mfp.bgOverlay) {
206
+
207
+ // Dark overlay
208
+ mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
209
+ mfp.close();
210
+ });
211
+
212
+ mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
213
+ if(mfp._checkIfClose(e.target)) {
214
+ mfp.close();
215
+ }
216
+ });
217
+
218
+ mfp.container = _getEl('container', mfp.wrap);
219
+ }
220
+
221
+ mfp.contentContainer = _getEl('content');
222
+ if(mfp.st.preloader) {
223
+ mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
224
+ }
225
+
226
+
227
+ // Initializing modules
228
+ var modules = $.magnificPopup.modules;
229
+ for(i = 0; i < modules.length; i++) {
230
+ var n = modules[i];
231
+ n = n.charAt(0).toUpperCase() + n.slice(1);
232
+ mfp['init'+n].call(mfp);
233
+ }
234
+ _mfpTrigger('BeforeOpen');
235
+
236
+
237
+ if(mfp.st.showCloseBtn) {
238
+ // Close button
239
+ if(!mfp.st.closeBtnInside) {
240
+ mfp.wrap.append( _getCloseBtn() );
241
+ } else {
242
+ _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
243
+ values.close_replaceWith = _getCloseBtn(item.type);
244
+ });
245
+ _wrapClasses += ' mfp-close-btn-in';
246
+ }
247
+ }
248
+
249
+ if(mfp.st.alignTop) {
250
+ _wrapClasses += ' mfp-align-top';
251
+ }
252
+
253
+
254
+
255
+ if(mfp.fixedContentPos) {
256
+ mfp.wrap.css({
257
+ overflow: mfp.st.overflowY,
258
+ overflowX: 'hidden',
259
+ overflowY: mfp.st.overflowY
260
+ });
261
+ } else {
262
+ mfp.wrap.css({
263
+ top: _window.scrollTop(),
264
+ position: 'absolute'
265
+ });
266
+ }
267
+ if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
268
+ mfp.bgOverlay.css({
269
+ height: _document.height(),
270
+ position: 'absolute'
271
+ });
272
+ }
273
+
274
+
275
+
276
+ if(mfp.st.enableEscapeKey) {
277
+ // Close on ESC key
278
+ _document.on('keyup' + EVENT_NS, function(e) {
279
+ if(e.keyCode === 27) {
280
+ mfp.close();
281
+ }
282
+ });
283
+ }
284
+
285
+ _window.on('resize' + EVENT_NS, function() {
286
+ mfp.updateSize();
287
+ });
288
+
289
+
290
+ if(!mfp.st.closeOnContentClick) {
291
+ _wrapClasses += ' mfp-auto-cursor';
292
+ }
293
+
294
+ if(_wrapClasses)
295
+ mfp.wrap.addClass(_wrapClasses);
296
+
297
+
298
+ // this triggers recalculation of layout, so we get it once to not to trigger twice
299
+ var windowHeight = mfp.wH = _window.height();
300
+
301
+
302
+ var windowStyles = {};
303
+
304
+ if( mfp.fixedContentPos ) {
305
+ if(mfp._hasScrollBar(windowHeight)){
306
+ var s = mfp._getScrollbarSize();
307
+ if(s) {
308
+ windowStyles.marginRight = s;
309
+ }
310
+ }
311
+ }
312
+
313
+ if(mfp.fixedContentPos) {
314
+ if(!mfp.isIE7) {
315
+ windowStyles.overflow = 'hidden';
316
+ } else {
317
+ // ie7 double-scroll bug
318
+ $('body, html').css('overflow', 'hidden');
319
+ }
320
+ }
321
+
322
+
323
+
324
+ var classesToadd = mfp.st.mainClass;
325
+ if(mfp.isIE7) {
326
+ classesToadd += ' mfp-ie7';
327
+ }
328
+ if(classesToadd) {
329
+ mfp._addClassToMFP( classesToadd );
330
+ }
331
+
332
+ // add content
333
+ mfp.updateItemHTML();
334
+
335
+ _mfpTrigger('BuildControls');
336
+
337
+ // remove scrollbar, add margin e.t.c
338
+ $('html').css(windowStyles);
339
+
340
+ // add everything to DOM
341
+ mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) );
342
+
343
+ // Save last focused element
344
+ mfp._lastFocusedEl = document.activeElement;
345
+
346
+ // Wait for next cycle to allow CSS transition
347
+ setTimeout(function() {
348
+
349
+ if(mfp.content) {
350
+ mfp._addClassToMFP(READY_CLASS);
351
+ mfp._setFocus();
352
+ } else {
353
+ // if content is not defined (not loaded e.t.c) we add class only for BG
354
+ mfp.bgOverlay.addClass(READY_CLASS);
355
+ }
356
+
357
+ // Trap the focus in popup
358
+ _document.on('focusin' + EVENT_NS, mfp._onFocusIn);
359
+
360
+ }, 16);
361
+
362
+ mfp.isOpen = true;
363
+ mfp.updateSize(windowHeight);
364
+ _mfpTrigger(OPEN_EVENT);
365
+
366
+ return data;
367
+ },
368
+
369
+ /**
370
+ * Closes the popup
371
+ */
372
+ close: function() {
373
+ if(!mfp.isOpen) return;
374
+ _mfpTrigger(BEFORE_CLOSE_EVENT);
375
+
376
+ mfp.isOpen = false;
377
+ // for CSS3 animation
378
+ if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) {
379
+ mfp._addClassToMFP(REMOVING_CLASS);
380
+ setTimeout(function() {
381
+ mfp._close();
382
+ }, mfp.st.removalDelay);
383
+ } else {
384
+ mfp._close();
385
+ }
386
+ },
387
+
388
+ /**
389
+ * Helper for close() function
390
+ */
391
+ _close: function() {
392
+ _mfpTrigger(CLOSE_EVENT);
393
+
394
+ var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
395
+
396
+ mfp.bgOverlay.detach();
397
+ mfp.wrap.detach();
398
+ mfp.container.empty();
399
+
400
+ if(mfp.st.mainClass) {
401
+ classesToRemove += mfp.st.mainClass + ' ';
402
+ }
403
+
404
+ mfp._removeClassFromMFP(classesToRemove);
405
+
406
+ if(mfp.fixedContentPos) {
407
+ var windowStyles = {marginRight: ''};
408
+ if(mfp.isIE7) {
409
+ $('body, html').css('overflow', '');
410
+ } else {
411
+ windowStyles.overflow = '';
412
+ }
413
+ $('html').css(windowStyles);
414
+ }
415
+
416
+ _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
417
+ mfp.ev.off(EVENT_NS);
418
+
419
+ // clean up DOM elements that aren't removed
420
+ mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
421
+ mfp.bgOverlay.attr('class', 'mfp-bg');
422
+ mfp.container.attr('class', 'mfp-container');
423
+
424
+ // remove close button from target element
425
+ if(mfp.st.showCloseBtn &&
426
+ (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
427
+ if(mfp.currTemplate.closeBtn)
428
+ mfp.currTemplate.closeBtn.detach();
429
+ }
430
+
431
+
432
+ if(mfp._lastFocusedEl) {
433
+ $(mfp._lastFocusedEl).focus(); // put tab focus back
434
+ }
435
+ mfp.currItem = null;
436
+ mfp.content = null;
437
+ mfp.currTemplate = null;
438
+ mfp.prevHeight = 0;
439
+
440
+ _mfpTrigger(AFTER_CLOSE_EVENT);
441
+ },
442
+
443
+ updateSize: function(winHeight) {
444
+
445
+ if(mfp.isIOS) {
446
+ // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
447
+ var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
448
+ var height = window.innerHeight * zoomLevel;
449
+ mfp.wrap.css('height', height);
450
+ mfp.wH = height;
451
+ } else {
452
+ mfp.wH = winHeight || _window.height();
453
+ }
454
+ // Fixes #84: popup incorrectly positioned with position:relative on body
455
+ if(!mfp.fixedContentPos) {
456
+ mfp.wrap.css('height', mfp.wH);
457
+ }
458
+
459
+ _mfpTrigger('Resize');
460
+
461
+ },
462
+
463
+ /**
464
+ * Set content of popup based on current index
465
+ */
466
+ updateItemHTML: function() {
467
+ var item = mfp.items[mfp.index];
468
+
469
+ // Detach and perform modifications
470
+ mfp.contentContainer.detach();
471
+
472
+ if(mfp.content)
473
+ mfp.content.detach();
474
+
475
+ if(!item.parsed) {
476
+ item = mfp.parseEl( mfp.index );
477
+ }
478
+
479
+ var type = item.type;
480
+
481
+ _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
482
+ // BeforeChange event works like so:
483
+ // _mfpOn('BeforeChange', function(e, prevType, newType) { });
484
+
485
+ mfp.currItem = item;
486
+
487
+
488
+
489
+
490
+
491
+ if(!mfp.currTemplate[type]) {
492
+ var markup = mfp.st[type] ? mfp.st[type].markup : false;
493
+
494
+ // allows to modify markup
495
+ _mfpTrigger('FirstMarkupParse', markup);
496
+
497
+ if(markup) {
498
+ mfp.currTemplate[type] = $(markup);
499
+ } else {
500
+ // if there is no markup found we just define that template is parsed
501
+ mfp.currTemplate[type] = true;
502
+ }
503
+ }
504
+
505
+ if(_prevContentType && _prevContentType !== item.type) {
506
+ mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
507
+ }
508
+
509
+ var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
510
+ mfp.appendContent(newContent, type);
511
+
512
+ item.preloaded = true;
513
+
514
+ _mfpTrigger(CHANGE_EVENT, item);
515
+ _prevContentType = item.type;
516
+
517
+ // Append container back after its content changed
518
+ mfp.container.prepend(mfp.contentContainer);
519
+
520
+ _mfpTrigger('AfterChange');
521
+ },
522
+
523
+
524
+ /**
525
+ * Set HTML content of popup
526
+ */
527
+ appendContent: function(newContent, type) {
528
+ mfp.content = newContent;
529
+
530
+ if(newContent) {
531
+ if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
532
+ mfp.currTemplate[type] === true) {
533
+ // if there is no markup, we just append close button element inside
534
+ if(!mfp.content.find('.mfp-close').length) {
535
+ mfp.content.append(_getCloseBtn());
536
+ }
537
+ } else {
538
+ mfp.content = newContent;
539
+ }
540
+ } else {
541
+ mfp.content = '';
542
+ }
543
+
544
+ _mfpTrigger(BEFORE_APPEND_EVENT);
545
+ mfp.container.addClass('mfp-'+type+'-holder');
546
+
547
+ mfp.contentContainer.append(mfp.content);
548
+ },
549
+
550
+
551
+
552
+
553
+ /**
554
+ * Creates Magnific Popup data object based on given data
555
+ * @param {int} index Index of item to parse
556
+ */
557
+ parseEl: function(index) {
558
+ var item = mfp.items[index],
559
+ type;
560
+
561
+ if(item.tagName) {
562
+ item = { el: $(item) };
563
+ } else {
564
+ type = item.type;
565
+ item = { data: item, src: item.src };
566
+ }
567
+
568
+ if(item.el) {
569
+ var types = mfp.types;
570
+
571
+ // check for 'mfp-TYPE' class
572
+ for(var i = 0; i < types.length; i++) {
573
+ if( item.el.hasClass('mfp-'+types[i]) ) {
574
+ type = types[i];
575
+ break;
576
+ }
577
+ }
578
+
579
+ item.src = item.el.attr('data-mfp-src');
580
+ if(!item.src) {
581
+ item.src = item.el.attr('href');
582
+ }
583
+ }
584
+
585
+ item.type = type || mfp.st.type || 'inline';
586
+ item.index = index;
587
+ item.parsed = true;
588
+ mfp.items[index] = item;
589
+ _mfpTrigger('ElementParse', item);
590
+
591
+ return mfp.items[index];
592
+ },
593
+
594
+
595
+ /**
596
+ * Initializes single popup or a group of popups
597
+ */
598
+ addGroup: function(el, options) {
599
+ var eHandler = function(e) {
600
+ e.mfpEl = this;
601
+ mfp._openClick(e, el, options);
602
+ };
603
+
604
+ if(!options) {
605
+ options = {};
606
+ }
607
+
608
+ var eName = 'click.magnificPopup';
609
+ options.mainEl = el;
610
+
611
+ if(options.items) {
612
+ options.isObj = true;
613
+ el.off(eName).on(eName, eHandler);
614
+ } else {
615
+ options.isObj = false;
616
+ if(options.delegate) {
617
+ el.off(eName).on(eName, options.delegate , eHandler);
618
+ } else {
619
+ options.items = el;
620
+ el.off(eName).on(eName, eHandler);
621
+ }
622
+ }
623
+ },
624
+ _openClick: function(e, el, options) {
625
+ var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
626
+
627
+
628
+ if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) {
629
+ return;
630
+ }
631
+
632
+ var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
633
+
634
+ if(disableOn) {
635
+ if($.isFunction(disableOn)) {
636
+ if( !disableOn.call(mfp) ) {
637
+ return true;
638
+ }
639
+ } else { // else it's number
640
+ if( _window.width() < disableOn ) {
641
+ return true;
642
+ }
643
+ }
644
+ }
645
+
646
+ if(e.type) {
647
+ e.preventDefault();
648
+
649
+ // This will prevent popup from closing if element is inside and popup is already opened
650
+ if(mfp.isOpen) {
651
+ e.stopPropagation();
652
+ }
653
+ }
654
+
655
+
656
+ options.el = $(e.mfpEl);
657
+ if(options.delegate) {
658
+ options.items = el.find(options.delegate);
659
+ }
660
+ mfp.open(options);
661
+ },
662
+
663
+
664
+ /**
665
+ * Updates text on preloader
666
+ */
667
+ updateStatus: function(status, text) {
668
+
669
+ if(mfp.preloader) {
670
+ if(_prevStatus !== status) {
671
+ mfp.container.removeClass('mfp-s-'+_prevStatus);
672
+ }
673
+
674
+ if(!text && status === 'loading') {
675
+ text = mfp.st.tLoading;
676
+ }
677
+
678
+ var data = {
679
+ status: status,
680
+ text: text
681
+ };
682
+ // allows to modify status
683
+ _mfpTrigger('UpdateStatus', data);
684
+
685
+ status = data.status;
686
+ text = data.text;
687
+
688
+ mfp.preloader.html(text);
689
+
690
+ mfp.preloader.find('a').on('click', function(e) {
691
+ e.stopImmediatePropagation();
692
+ });
693
+
694
+ mfp.container.addClass('mfp-s-'+status);
695
+ _prevStatus = status;
696
+ }
697
+ },
698
+
699
+
700
+ /*
701
+ "Private" helpers that aren't private at all
702
+ */
703
+ // Check to close popup or not
704
+ // "target" is an element that was clicked
705
+ _checkIfClose: function(target) {
706
+
707
+ if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
708
+ return;
709
+ }
710
+
711
+ var closeOnContent = mfp.st.closeOnContentClick;
712
+ var closeOnBg = mfp.st.closeOnBgClick;
713
+
714
+ if(closeOnContent && closeOnBg) {
715
+ return true;
716
+ } else {
717
+
718
+ // We close the popup if click is on close button or on preloader. Or if there is no content.
719
+ if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
720
+ return true;
721
+ }
722
+
723
+ // if click is outside the content
724
+ if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
725
+ if(closeOnBg) {
726
+ // last check, if the clicked element is in DOM, (in case it's removed onclick)
727
+ if( $.contains(document, target) ) {
728
+ return true;
729
+ }
730
+ }
731
+ } else if(closeOnContent) {
732
+ return true;
733
+ }
734
+
735
+ }
736
+ return false;
737
+ },
738
+ _addClassToMFP: function(cName) {
739
+ mfp.bgOverlay.addClass(cName);
740
+ mfp.wrap.addClass(cName);
741
+ },
742
+ _removeClassFromMFP: function(cName) {
743
+ this.bgOverlay.removeClass(cName);
744
+ mfp.wrap.removeClass(cName);
745
+ },
746
+ _hasScrollBar: function(winHeight) {
747
+ return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
748
+ },
749
+ _setFocus: function() {
750
+ (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
751
+ },
752
+ _onFocusIn: function(e) {
753
+ if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
754
+ mfp._setFocus();
755
+ return false;
756
+ }
757
+ },
758
+ _parseMarkup: function(template, values, item) {
759
+ var arr;
760
+ if(item.data) {
761
+ values = $.extend(item.data, values);
762
+ }
763
+ _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
764
+
765
+ $.each(values, function(key, value) {
766
+ if(value === undefined || value === false) {
767
+ return true;
768
+ }
769
+ arr = key.split('_');
770
+ if(arr.length > 1) {
771
+ var el = template.find(EVENT_NS + '-'+arr[0]);
772
+
773
+ if(el.length > 0) {
774
+ var attr = arr[1];
775
+ if(attr === 'replaceWith') {
776
+ if(el[0] !== value[0]) {
777
+ el.replaceWith(value);
778
+ }
779
+ } else if(attr === 'img') {
780
+ if(el.is('img')) {
781
+ el.attr('src', value);
782
+ } else {
783
+ el.replaceWith( '<img src="'+value+'" class="' + el.attr('class') + '" />' );
784
+ }
785
+ } else {
786
+ el.attr(arr[1], value);
787
+ }
788
+ }
789
+
790
+ } else {
791
+ template.find(EVENT_NS + '-'+key).html(value);
792
+ }
793
+ });
794
+ },
795
+
796
+ _getScrollbarSize: function() {
797
+ // thx David
798
+ if(mfp.scrollbarSize === undefined) {
799
+ var scrollDiv = document.createElement("div");
800
+ scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
801
+ document.body.appendChild(scrollDiv);
802
+ mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
803
+ document.body.removeChild(scrollDiv);
804
+ }
805
+ return mfp.scrollbarSize;
806
+ }
807
+
808
+ }; /* MagnificPopup core prototype end */
809
+
810
+
811
+
812
+
813
+ /**
814
+ * Public static functions
815
+ */
816
+ $.magnificPopup = {
817
+ instance: null,
818
+ proto: MagnificPopup.prototype,
819
+ modules: [],
820
+
821
+ open: function(options, index) {
822
+ _checkInstance();
823
+
824
+ if(!options) {
825
+ options = {};
826
+ } else {
827
+ options = $.extend(true, {}, options);
828
+ }
829
+
830
+
831
+ options.isObj = true;
832
+ options.index = index || 0;
833
+ return this.instance.open(options);
834
+ },
835
+
836
+ close: function() {
837
+ return $.magnificPopup.instance && $.magnificPopup.instance.close();
838
+ },
839
+
840
+ registerModule: function(name, module) {
841
+ if(module.options) {
842
+ $.magnificPopup.defaults[name] = module.options;
843
+ }
844
+ $.extend(this.proto, module.proto);
845
+ this.modules.push(name);
846
+ },
847
+
848
+ defaults: {
849
+
850
+ // Info about options is in docs:
851
+ // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
852
+
853
+ disableOn: 0,
854
+
855
+ key: null,
856
+
857
+ midClick: false,
858
+
859
+ mainClass: '',
860
+
861
+ preloader: true,
862
+
863
+ focus: '', // CSS selector of input to focus after popup is opened
864
+
865
+ closeOnContentClick: false,
866
+
867
+ closeOnBgClick: true,
868
+
869
+ closeBtnInside: true,
870
+
871
+ showCloseBtn: true,
872
+
873
+ enableEscapeKey: true,
874
+
875
+ modal: false,
876
+
877
+ alignTop: false,
878
+
879
+ removalDelay: 0,
880
+
881
+ prependTo: null,
882
+
883
+ fixedContentPos: 'auto',
884
+
885
+ fixedBgPos: 'auto',
886
+
887
+ overflowY: 'auto',
888
+
889
+ closeMarkup: '<button title="%title%" type="button" class="mfp-close">&times;</button>',
890
+
891
+ tClose: 'Close (Esc)',
892
+
893
+ tLoading: 'Loading...'
894
+
895
+ }
896
+ };
897
+
898
+
899
+
900
+ $.fn.magnificPopup = function(options) {
901
+ _checkInstance();
902
+
903
+ var jqEl = $(this);
904
+
905
+ // We call some API method of first param is a string
906
+ if (typeof options === "string" ) {
907
+
908
+ if(options === 'open') {
909
+ var items,
910
+ itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
911
+ index = parseInt(arguments[1], 10) || 0;
912
+
913
+ if(itemOpts.items) {
914
+ items = itemOpts.items[index];
915
+ } else {
916
+ items = jqEl;
917
+ if(itemOpts.delegate) {
918
+ items = items.find(itemOpts.delegate);
919
+ }
920
+ items = items.eq( index );
921
+ }
922
+ mfp._openClick({mfpEl:items}, jqEl, itemOpts);
923
+ } else {
924
+ if(mfp.isOpen)
925
+ mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
926
+ }
927
+
928
+ } else {
929
+ // clone options obj
930
+ options = $.extend(true, {}, options);
931
+
932
+ /*
933
+ * As Zepto doesn't support .data() method for objects
934
+ * and it works only in normal browsers
935
+ * we assign "options" object directly to the DOM element. FTW!
936
+ */
937
+ if(_isJQ) {
938
+ jqEl.data('magnificPopup', options);
939
+ } else {
940
+ jqEl[0].magnificPopup = options;
941
+ }
942
+
943
+ mfp.addGroup(jqEl, options);
944
+
945
+ }
946
+ return jqEl;
947
+ };
948
+
949
+
950
+ //Quick benchmark
951
+ /*
952
+ var start = performance.now(),
953
+ i,
954
+ rounds = 1000;
955
+
956
+ for(i = 0; i < rounds; i++) {
957
+
958
+ }
959
+ console.log('Test #1:', performance.now() - start);
960
+
961
+ start = performance.now();
962
+ for(i = 0; i < rounds; i++) {
963
+
964
+ }
965
+ console.log('Test #2:', performance.now() - start);
966
+ */