jekyll-theme-so-simple 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/LICENSE +49 -49
  4. data/README.md +15 -2
  5. data/_data/authors.yml +16 -16
  6. data/_data/navigation.yml +16 -14
  7. data/_data/text.yml +36 -36
  8. data/_includes/disqus-comments.html +19 -19
  9. data/_includes/documents-collection.html +19 -19
  10. data/_includes/entry-date.html +6 -6
  11. data/_includes/entry.html +41 -39
  12. data/_includes/footer-custom.html +3 -3
  13. data/_includes/footer.html +24 -24
  14. data/_includes/google-analytics.html +9 -9
  15. data/_includes/head-custom.html +5 -5
  16. data/_includes/head-feed.html +1 -1
  17. data/_includes/head-seo.html +1 -1
  18. data/_includes/head.html +50 -50
  19. data/_includes/lunr-search-scripts.html +106 -106
  20. data/_includes/masthead.html +13 -13
  21. data/_includes/navigation.html +17 -17
  22. data/_includes/page-author.html +37 -37
  23. data/_includes/page-categories.html +14 -14
  24. data/_includes/page-date.html +4 -4
  25. data/_includes/page-image.html +14 -14
  26. data/_includes/page-pagination.html +19 -19
  27. data/_includes/page-tags.html +14 -14
  28. data/_includes/posts-all.html +3 -3
  29. data/_includes/posts-category.html +3 -3
  30. data/_includes/posts-paginated.html +74 -74
  31. data/_includes/posts-tag.html +3 -3
  32. data/_includes/read-time.html +16 -16
  33. data/_includes/responsive-embed +16 -16
  34. data/_includes/scripts.html +1 -3
  35. data/_includes/skip-links.html +8 -8
  36. data/_includes/social-share.html +6 -6
  37. data/_includes/toc +9 -9
  38. data/_layouts/categories.html +48 -48
  39. data/_layouts/category.html +9 -9
  40. data/_layouts/collection.html +9 -9
  41. data/_layouts/default.html +1 -1
  42. data/_layouts/home.html +17 -17
  43. data/_layouts/page.html +30 -30
  44. data/_layouts/post.html +41 -41
  45. data/_layouts/posts.html +29 -29
  46. data/_layouts/search.html +1 -1
  47. data/_layouts/tag.html +9 -9
  48. data/_layouts/tags.html +48 -48
  49. data/_sass/so-simple.scss +1 -1
  50. data/_sass/so-simple/_author.scss +45 -45
  51. data/_sass/so-simple/_base.scss +112 -112
  52. data/_sass/so-simple/_buttons.scss +92 -92
  53. data/_sass/so-simple/_entries.scss +182 -182
  54. data/_sass/so-simple/_functions.scss +4 -4
  55. data/_sass/so-simple/_global.scss +393 -393
  56. data/_sass/so-simple/_icons.scss +43 -43
  57. data/_sass/so-simple/_mixins.scss +5 -5
  58. data/_sass/so-simple/_notices.scss +93 -93
  59. data/_sass/so-simple/_page.scss +287 -282
  60. data/_sass/so-simple/_reset.scss +523 -523
  61. data/_sass/so-simple/_syntax-highlighting.scss +334 -334
  62. data/_sass/so-simple/_tables.scss +34 -34
  63. data/_sass/so-simple/_utilities.scss +7 -7
  64. data/_sass/so-simple/_variables.scss +132 -132
  65. data/_sass/so-simple/functions/_color.scss +21 -21
  66. data/_sass/so-simple/functions/_em.scss +7 -7
  67. data/_sass/so-simple/functions/_fluid-type.scss +33 -33
  68. data/_sass/so-simple/functions/_yiq.scss +38 -38
  69. data/_sass/so-simple/mixins/_clearfix.scss +32 -32
  70. data/_sass/so-simple/mixins/_float.scss +15 -15
  71. data/_sass/so-simple/mixins/_image.scss +38 -38
  72. data/_sass/so-simple/mixins/_lists.scss +9 -9
  73. data/_sass/so-simple/mixins/_text-truncate.scss +10 -10
  74. data/_sass/so-simple/utilities/_accessibility.scss +43 -43
  75. data/_sass/so-simple/utilities/_align.scss +60 -60
  76. data/_sass/so-simple/utilities/_animations.scss +99 -99
  77. data/_sass/so-simple/utilities/_clearfix.scss +7 -7
  78. data/_sass/so-simple/utilities/_float.scss +7 -7
  79. data/_sass/so-simple/utilities/_responsive-embed.scss +66 -66
  80. data/_sass/so-simple/utilities/_text.scss +48 -48
  81. data/_sass/so-simple/vendor/breakpoint/_breakpoint.scss +114 -114
  82. data/_sass/so-simple/vendor/breakpoint/_context.scss +94 -94
  83. data/_sass/so-simple/vendor/breakpoint/_helpers.scss +151 -151
  84. data/_sass/so-simple/vendor/breakpoint/_legacy-settings.scss +49 -49
  85. data/_sass/so-simple/vendor/breakpoint/_no-query.scss +15 -15
  86. data/_sass/so-simple/vendor/breakpoint/_parsers.scss +215 -215
  87. data/_sass/so-simple/vendor/breakpoint/_respond-to.scss +82 -82
  88. data/_sass/so-simple/vendor/breakpoint/_settings.scss +70 -70
  89. data/_sass/so-simple/vendor/breakpoint/parsers/_double.scss +33 -33
  90. data/_sass/so-simple/vendor/breakpoint/parsers/_query.scss +82 -82
  91. data/_sass/so-simple/vendor/breakpoint/parsers/_resolution.scss +31 -31
  92. data/_sass/so-simple/vendor/breakpoint/parsers/_single.scss +26 -26
  93. data/_sass/so-simple/vendor/breakpoint/parsers/_triple.scss +36 -36
  94. data/_sass/so-simple/vendor/breakpoint/parsers/double/_default-pair.scss +21 -21
  95. data/_sass/so-simple/vendor/breakpoint/parsers/double/_default.scss +22 -22
  96. data/_sass/so-simple/vendor/breakpoint/parsers/double/_double-string.scss +21 -21
  97. data/_sass/so-simple/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -60
  98. data/_sass/so-simple/vendor/breakpoint/parsers/single/_default.scss +13 -13
  99. data/_sass/so-simple/vendor/breakpoint/parsers/triple/_default.scss +18 -18
  100. data/_sass/so-simple/vendor/lity/_lity.scss +221 -221
  101. data/assets/css/main.scss +7 -7
  102. data/assets/js/lunr/lunr.da.min.js +17 -17
  103. data/assets/js/lunr/lunr.de.min.js +17 -17
  104. data/assets/js/lunr/lunr.du.min.js +17 -17
  105. data/assets/js/lunr/lunr.es.min.js +17 -17
  106. data/assets/js/lunr/lunr.fi.min.js +17 -17
  107. data/assets/js/lunr/lunr.fr.min.js +17 -17
  108. data/assets/js/lunr/lunr.hu.min.js +17 -17
  109. data/assets/js/lunr/lunr.it.min.js +17 -17
  110. data/assets/js/lunr/lunr.jp.min.js +1 -1
  111. data/assets/js/lunr/lunr.min.js +6 -6
  112. data/assets/js/lunr/lunr.no.min.js +17 -17
  113. data/assets/js/lunr/lunr.pt.min.js +17 -17
  114. data/assets/js/lunr/lunr.ro.min.js +17 -17
  115. data/assets/js/lunr/lunr.ru.min.js +17 -17
  116. data/assets/js/lunr/lunr.sv.min.js +17 -17
  117. data/assets/js/lunr/lunr.tr.min.js +17 -17
  118. data/assets/js/main.js +17 -15
  119. data/assets/js/main.min.js +2 -2
  120. data/assets/js/plugins/jquery.smooth-scroll.js +358 -358
  121. data/assets/js/plugins/jquery.smooth-scroll.min.js +8 -8
  122. data/assets/js/plugins/lity.js +655 -655
  123. data/assets/js/plugins/lity.min.js +4 -4
  124. data/assets/js/plugins/table-of-contents.js +59 -59
  125. data/assets/js/search-data.json +43 -27
  126. metadata +3 -3
@@ -1,9 +1,9 @@
1
- /*!
2
- * jQuery Smooth Scroll - v2.2.0 - 2017-05-05
3
- * https://github.com/kswedberg/jquery-smooth-scroll
4
- * Copyright (c) 2017 Karl Swedberg
5
- * Licensed MIT
6
- */
7
-
8
-
1
+ /*!
2
+ * jQuery Smooth Scroll - v2.2.0 - 2017-05-05
3
+ * https://github.com/kswedberg/jquery-smooth-scroll
4
+ * Copyright (c) 2017 Karl Swedberg
5
+ * Licensed MIT
6
+ */
7
+
8
+
9
9
  !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){var b={},c={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,autoFocus:!1,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},d=function(b){var c=[],d=!1,e=b.dir&&"left"===b.dir?"scrollLeft":"scrollTop";return this.each(function(){var b=a(this);if(this!==document&&this!==window)return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))):(c.push(document.scrollingElement),!1)}),c.length||this.each(function(){this===document.documentElement&&"smooth"===a(this).css("scrollBehavior")&&(c=[this]),c.length||"BODY"!==this.nodeName||(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c},e=/^([\-\+]=)(\d+)/;a.fn.extend({scrollable:function(a){var b=d.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=d.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(b,c){if("options"===(b=b||{}))return c?this.each(function(){var b=a(this),d=a.extend(b.data("ssOpts")||{},c);a(this).data("ssOpts",d)}):this.first().data("ssOpts");var d=a.extend({},a.fn.smoothScroll.defaults,b),e=function(b){var c=function(a){return a.replace(/(:|\.|\/)/g,"\\$1")},e=this,f=a(this),g=a.extend({},d,f.data("ssOpts")||{}),h=d.exclude,i=g.excludeWithin,j=0,k=0,l=!0,m={},n=a.smoothScroll.filterPath(location.pathname),o=a.smoothScroll.filterPath(e.pathname),p=location.hostname===e.hostname||!e.hostname,q=g.scrollTarget||o===n,r=c(e.hash);if(r&&!a(r).length&&(l=!1),g.scrollTarget||p&&q&&r){for(;l&&j<h.length;)f.is(c(h[j++]))&&(l=!1);for(;l&&k<i.length;)f.closest(i[k++]).length&&(l=!1)}else l=!1;l&&(g.preventDefault&&b.preventDefault(),a.extend(m,g,{scrollTarget:g.scrollTarget||r,link:e}),a.smoothScroll(m))};return null!==b.delegateSelector?this.off("click.smoothscroll",b.delegateSelector).on("click.smoothscroll",b.delegateSelector,e):this.off("click.smoothscroll").on("click.smoothscroll",e),this}});var f=function(a){var b={relative:""},c="string"==typeof a&&e.exec(a);return"number"==typeof a?b.px=a:c&&(b.relative=c[1],b.px=parseFloat(c[2])||0),b},g=function(b){var c=a(b.scrollTarget);b.autoFocus&&c.length&&(c[0].focus(),c.is(document.activeElement)||(c.prop({tabIndex:-1}),c[0].focus())),b.afterScroll.call(b.link,b)};a.smoothScroll=function(c,d){if("options"===c&&"object"==typeof d)return a.extend(b,d);var e,h,i,j,k=f(c),l={},m=0,n="offset",o="scrollTop",p={},q={};k.px?e=a.extend({link:null},a.fn.smoothScroll.defaults,b):(e=a.extend({link:null},a.fn.smoothScroll.defaults,c||{},b),e.scrollElement&&(n="position","static"===e.scrollElement.css("position")&&e.scrollElement.css("position","relative")),d&&(k=f(d))),o="left"===e.direction?"scrollLeft":o,e.scrollElement?(h=e.scrollElement,k.px||/^(?:HTML|BODY)$/.test(h[0].nodeName)||(m=h[o]())):h=a("html, body").firstScrollable(e.direction),e.beforeScroll.call(h,e),l=k.px?k:{relative:"",px:a(e.scrollTarget)[n]()&&a(e.scrollTarget)[n]()[e.direction]||0},p[o]=l.relative+(l.px+m+e.offset),i=e.speed,"auto"===i&&(j=Math.abs(p[o]-h[o]()),i=j/e.autoCoefficient),q={duration:i,easing:e.easing,complete:function(){g(e)}},e.step&&(q.step=e.step),h.length?h.stop().animate(p,q):g(e)},a.smoothScroll.version="2.2.0",a.smoothScroll.filterPath=function(a){return a=a||"",a.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},a.fn.smoothScroll.defaults=c});
@@ -1,655 +1,655 @@
1
- /*! Lity - v3.0.0-dev - 2017-07-17
2
- * http://sorgalla.com/lity/
3
- * Copyright (c) 2015-2017 Jan Sorgalla; Licensed MIT */
4
- (function(window, factory) {
5
- if (typeof define === 'function' && define.amd) {
6
- define(['jquery'], function($) {
7
- return factory(window, $);
8
- });
9
- } else if (typeof module === 'object' && typeof module.exports === 'object') {
10
- module.exports = factory(window, require('jquery'));
11
- } else {
12
- window.lity = factory(window, window.jQuery || window.Zepto);
13
- }
14
- }(typeof window !== "undefined" ? window : this, function(window, $) {
15
- 'use strict';
16
-
17
- var document = window.document;
18
-
19
- var _win = $(window);
20
- var _deferred = $.Deferred;
21
- var _html = $('html');
22
- var _instances = [];
23
-
24
- var _attrAriaHidden = 'aria-hidden';
25
- var _dataAriaHidden = 'lity-' + _attrAriaHidden;
26
-
27
- var _focusableElementsSelector = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])';
28
-
29
- var _defaultOptions = {
30
- esc: true,
31
- handler: null,
32
- handlers: {
33
- image: imageHandler,
34
- inline: inlineHandler,
35
- youtube: youtubeHandler,
36
- vimeo: vimeoHandler,
37
- googlemaps: googlemapsHandler,
38
- facebookvideo: facebookvideoHandler,
39
- iframe: iframeHandler
40
- },
41
- template: '<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'
42
- };
43
-
44
- var _imageRegexp = /(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i;
45
- var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i;
46
- var _vimeoRegex = /(vimeo(pro)?\.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/;
47
- var _googlemapsRegex = /((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i;
48
- var _facebookvideoRegex = /(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i;
49
-
50
- var _transitionEndEvent = (function() {
51
- var el = document.createElement('div');
52
-
53
- var transEndEventNames = {
54
- WebkitTransition: 'webkitTransitionEnd',
55
- MozTransition: 'transitionend',
56
- OTransition: 'oTransitionEnd otransitionend',
57
- transition: 'transitionend'
58
- };
59
-
60
- for (var name in transEndEventNames) {
61
- if (el.style[name] !== undefined) {
62
- return transEndEventNames[name];
63
- }
64
- }
65
-
66
- return false;
67
- })();
68
-
69
- function transitionEnd(element) {
70
- var deferred = _deferred();
71
-
72
- if (!_transitionEndEvent || !element.length) {
73
- deferred.resolve();
74
- } else {
75
- element.one(_transitionEndEvent, deferred.resolve);
76
- setTimeout(deferred.resolve, 500);
77
- }
78
-
79
- return deferred.promise();
80
- }
81
-
82
- function settings(currSettings, key, value) {
83
- if (arguments.length === 1) {
84
- return $.extend({}, currSettings);
85
- }
86
-
87
- if (typeof key === 'string') {
88
- if (typeof value === 'undefined') {
89
- return typeof currSettings[key] === 'undefined'
90
- ? null
91
- : currSettings[key];
92
- }
93
-
94
- currSettings[key] = value;
95
- } else {
96
- $.extend(currSettings, key);
97
- }
98
-
99
- return this;
100
- }
101
-
102
- function parseQueryParams(params) {
103
- var pos = params.indexOf('?');
104
-
105
- if (pos > -1) {
106
- params = params.substr(pos + 1);
107
- }
108
-
109
- var pairs = decodeURI(params.split('#')[0]).split('&');
110
- var obj = {}, p;
111
-
112
- for (var i = 0, n = pairs.length; i < n; i++) {
113
- if (!pairs[i]) {
114
- continue;
115
- }
116
-
117
- p = pairs[i].split('=');
118
- obj[p[0]] = p[1];
119
- }
120
-
121
- return obj;
122
- }
123
-
124
- function appendQueryParams(url, params) {
125
- if (!params) {
126
- return url;
127
- }
128
-
129
- if ('string' === $.type(params)) {
130
- params = parseQueryParams(params);
131
- }
132
-
133
- if (url.indexOf('?') > -1) {
134
- var split = url.split('?');
135
- url = split.shift();
136
-
137
- params = $.extend(
138
- {},
139
- parseQueryParams(split[0]),
140
- params
141
- )
142
- }
143
-
144
- return url + '?' + $.param(params);
145
- }
146
-
147
- function transferHash(originalUrl, newUrl) {
148
- var pos = originalUrl.indexOf('#');
149
-
150
- if (-1 === pos) {
151
- return newUrl;
152
- }
153
-
154
- if (pos > 0) {
155
- originalUrl = originalUrl.substr(pos);
156
- }
157
-
158
- return newUrl + originalUrl;
159
- }
160
-
161
- function iframe(iframeUrl, instance, queryParams, hashUrl) {
162
- instance && instance.element().addClass('lity-iframe');
163
-
164
- if (queryParams) {
165
- iframeUrl = appendQueryParams(iframeUrl, queryParams);
166
- }
167
-
168
- if (hashUrl) {
169
- iframeUrl = transferHash(hashUrl, iframeUrl);
170
- }
171
-
172
- return '<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="' + iframeUrl + '"/></div>';
173
- }
174
-
175
- function error(msg) {
176
- return $('<span class="lity-error"/>').append(msg);
177
- }
178
-
179
- function imageHandler(target, instance) {
180
- var desc = (instance.opener() && instance.opener().data('lity-desc')) || 'Image with no description';
181
- var img = $('<img src="' + target + '" alt="' + desc + '"/>');
182
- var deferred = _deferred();
183
- var failed = function() {
184
- deferred.reject(error('Failed loading image'));
185
- };
186
-
187
- img
188
- .on('load', function() {
189
- if (this.naturalWidth === 0) {
190
- return failed();
191
- }
192
-
193
- deferred.resolve(img);
194
- })
195
- .on('error', failed)
196
- ;
197
-
198
- return deferred.promise();
199
- }
200
-
201
- imageHandler.test = function(target) {
202
- return _imageRegexp.test(target);
203
- };
204
-
205
- function inlineHandler(target, instance) {
206
- var el, placeholder, hasHideClass;
207
-
208
- try {
209
- el = $(target);
210
- } catch (e) {
211
- return false;
212
- }
213
-
214
- if (!el.length) {
215
- return false;
216
- }
217
-
218
- placeholder = $('<i style="display:none !important"/>');
219
- hasHideClass = el.hasClass('lity-hide');
220
-
221
- instance
222
- .element()
223
- .one('lity:remove', function() {
224
- placeholder
225
- .before(el)
226
- .remove()
227
- ;
228
-
229
- if (hasHideClass && !el.closest('.lity-content').length) {
230
- el.addClass('lity-hide');
231
- }
232
- })
233
- ;
234
-
235
- return el
236
- .removeClass('lity-hide')
237
- .after(placeholder)
238
- ;
239
- }
240
-
241
- function youtubeHandler(target, instance) {
242
- var matches = _youtubeRegex.exec(target);
243
-
244
- if (!matches) {
245
- return false;
246
- }
247
-
248
- return iframe(
249
- 'https://www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4] + '?autoplay=1',
250
- instance,
251
- matches[5],
252
- target
253
- );
254
- }
255
-
256
- function vimeoHandler(target, instance) {
257
- var matches = _vimeoRegex.exec(target);
258
-
259
- if (!matches) {
260
- return false;
261
- }
262
-
263
- return iframe(
264
- 'https://player.vimeo.com/video/' + matches[3] + '?autoplay=1',
265
- instance,
266
- matches[4],
267
- target
268
- );
269
- }
270
-
271
- function facebookvideoHandler(target, instance) {
272
- var matches = _facebookvideoRegex.exec(target);
273
-
274
- if (!matches) {
275
- return false;
276
- }
277
-
278
- if (0 !== target.indexOf('http')) {
279
- target = 'https:' + target;
280
- }
281
-
282
- return iframe(
283
- 'https://www.facebook.com/plugins/video.php?href=' + target + '&autoplay=1',
284
- instance,
285
- matches[4],
286
- target
287
- );
288
- }
289
-
290
- function googlemapsHandler(target, instance) {
291
- var matches = _googlemapsRegex.exec(target);
292
-
293
- if (!matches) {
294
- return false;
295
- }
296
-
297
- return iframe(
298
- 'https://www.google.' + matches[3] + '/maps?' + matches[6],
299
- instance,
300
- {
301
- output: matches[6].indexOf('layer=c') > 0 ? 'svembed' : 'embed'
302
- },
303
- target
304
- );
305
- }
306
-
307
- function iframeHandler(target, instance) {
308
- return iframe(target, instance);
309
- }
310
-
311
- function winHeight() {
312
- return document.documentElement.clientHeight
313
- ? document.documentElement.clientHeight
314
- : Math.round(_win.height());
315
- }
316
-
317
- function keydown(e) {
318
- var current = currentInstance();
319
-
320
- if (!current) {
321
- return;
322
- }
323
-
324
- // ESC key
325
- if (e.keyCode === 27 && !!current.options('esc')) {
326
- current.close();
327
- }
328
-
329
- // TAB key
330
- if (e.keyCode === 9) {
331
- handleTabKey(e, current);
332
- }
333
- }
334
-
335
- function handleTabKey(e, instance) {
336
- var focusableElements = instance.element().find(_focusableElementsSelector);
337
- var focusedIndex = focusableElements.index(document.activeElement);
338
-
339
- if (e.shiftKey && focusedIndex <= 0) {
340
- focusableElements.get(focusableElements.length - 1).focus();
341
- e.preventDefault();
342
- } else if (!e.shiftKey && focusedIndex === focusableElements.length - 1) {
343
- focusableElements.get(0).focus();
344
- e.preventDefault();
345
- }
346
- }
347
-
348
- function resize() {
349
- $.each(_instances, function(i, instance) {
350
- instance.resize();
351
- });
352
- }
353
-
354
- function registerInstance(instanceToRegister) {
355
- if (1 === _instances.unshift(instanceToRegister)) {
356
- _html.addClass('lity-active');
357
-
358
- _win
359
- .on({
360
- resize: resize,
361
- keydown: keydown
362
- })
363
- ;
364
- }
365
-
366
- $('body > *').not(instanceToRegister.element())
367
- .addClass('lity-hidden')
368
- .each(function() {
369
- var el = $(this);
370
-
371
- if (undefined !== el.data(_dataAriaHidden)) {
372
- return;
373
- }
374
-
375
- el.data(_dataAriaHidden, el.attr(_attrAriaHidden) || null);
376
- })
377
- .attr(_attrAriaHidden, 'true')
378
- ;
379
- }
380
-
381
- function removeInstance(instanceToRemove) {
382
- var show;
383
-
384
- instanceToRemove
385
- .element()
386
- .attr(_attrAriaHidden, 'true')
387
- ;
388
-
389
- if (1 === _instances.length) {
390
- _html.removeClass('lity-active');
391
-
392
- _win
393
- .off({
394
- resize: resize,
395
- keydown: keydown
396
- })
397
- ;
398
- }
399
-
400
- _instances = $.grep(_instances, function(instance) {
401
- return instanceToRemove !== instance;
402
- });
403
-
404
- if (!!_instances.length) {
405
- show = _instances[0].element();
406
- } else {
407
- show = $('.lity-hidden');
408
- }
409
-
410
- show
411
- .removeClass('lity-hidden')
412
- .each(function() {
413
- var el = $(this), oldAttr = el.data(_dataAriaHidden);
414
-
415
- if (!oldAttr) {
416
- el.removeAttr(_attrAriaHidden);
417
- } else {
418
- el.attr(_attrAriaHidden, oldAttr);
419
- }
420
-
421
- el.removeData(_dataAriaHidden);
422
- })
423
- ;
424
- }
425
-
426
- function currentInstance() {
427
- if (0 === _instances.length) {
428
- return null;
429
- }
430
-
431
- return _instances[0];
432
- }
433
-
434
- function factory(target, instance, handlers, preferredHandler) {
435
- var handler = 'inline', content;
436
-
437
- var currentHandlers = $.extend({}, handlers);
438
-
439
- if (preferredHandler && currentHandlers[preferredHandler]) {
440
- content = currentHandlers[preferredHandler](target, instance);
441
- handler = preferredHandler;
442
- } else {
443
- // Run inline and iframe handlers after all other handlers
444
- $.each(['inline', 'iframe'], function(i, name) {
445
- delete currentHandlers[name];
446
-
447
- currentHandlers[name] = handlers[name];
448
- });
449
-
450
- $.each(currentHandlers, function(name, currentHandler) {
451
- // Handler might be "removed" by setting callback to null
452
- if (!currentHandler) {
453
- return true;
454
- }
455
-
456
- if (
457
- currentHandler.test &&
458
- !currentHandler.test(target, instance)
459
- ) {
460
- return true;
461
- }
462
-
463
- content = currentHandler(target, instance);
464
-
465
- if (false !== content) {
466
- handler = name;
467
- return false;
468
- }
469
- });
470
- }
471
-
472
- return {handler: handler, content: content || ''};
473
- }
474
-
475
- function Lity(target, options, opener, activeElement) {
476
- var self = this;
477
- var result;
478
- var isReady = false;
479
- var isClosed = false;
480
- var element;
481
- var content;
482
-
483
- options = $.extend(
484
- {},
485
- _defaultOptions,
486
- options
487
- );
488
-
489
- element = $(options.template);
490
-
491
- // -- API --
492
-
493
- self.element = function() {
494
- return element;
495
- };
496
-
497
- self.opener = function() {
498
- return opener;
499
- };
500
-
501
- self.content = function() {
502
- return content;
503
- };
504
-
505
- self.options = $.proxy(settings, self, options);
506
- self.handlers = $.proxy(settings, self, options.handlers);
507
-
508
- self.resize = function() {
509
- if (!isReady || isClosed) {
510
- return;
511
- }
512
-
513
- content
514
- .css('max-height', winHeight() + 'px')
515
- .trigger('lity:resize', [self])
516
- ;
517
- };
518
-
519
- self.close = function() {
520
- if (!isReady || isClosed) {
521
- return;
522
- }
523
-
524
- isClosed = true;
525
-
526
- removeInstance(self);
527
-
528
- var deferred = _deferred();
529
-
530
- // We return focus only if the current focus is inside this instance
531
- if (
532
- activeElement &&
533
- (
534
- document.activeElement === element[0] ||
535
- $.contains(element[0], document.activeElement)
536
- )
537
- ) {
538
- try {
539
- activeElement.focus();
540
- } catch (e) {
541
- // Ignore exceptions, eg. for SVG elements which can't be
542
- // focused in IE11
543
- }
544
- }
545
-
546
- content.trigger('lity:close', [self]);
547
-
548
- element
549
- .removeClass('lity-opened')
550
- .addClass('lity-closed')
551
- ;
552
-
553
- transitionEnd(content.add(element))
554
- .always(function() {
555
- content.trigger('lity:remove', [self]);
556
- element.remove();
557
- element = undefined;
558
- deferred.resolve();
559
- })
560
- ;
561
-
562
- return deferred.promise();
563
- };
564
-
565
- // -- Initialization --
566
-
567
- result = factory(target, self, options.handlers, options.handler);
568
-
569
- element
570
- .attr(_attrAriaHidden, 'false')
571
- .addClass('lity-loading lity-opened lity-' + result.handler)
572
- .appendTo('body')
573
- .focus()
574
- .on('click', '[data-lity-close]', function(e) {
575
- if ($(e.target).is('[data-lity-close]')) {
576
- self.close();
577
- }
578
- })
579
- .trigger('lity:open', [self])
580
- ;
581
-
582
- registerInstance(self);
583
-
584
- $.when(result.content)
585
- .always(ready)
586
- ;
587
-
588
- function ready(result) {
589
- content = $(result)
590
- .css('max-height', winHeight() + 'px')
591
- ;
592
-
593
- element
594
- .find('.lity-loader')
595
- .each(function() {
596
- var loader = $(this);
597
-
598
- transitionEnd(loader)
599
- .always(function() {
600
- loader.remove();
601
- })
602
- ;
603
- })
604
- ;
605
-
606
- element
607
- .removeClass('lity-loading')
608
- .find('.lity-content')
609
- .empty()
610
- .append(content)
611
- ;
612
-
613
- isReady = true;
614
-
615
- content
616
- .trigger('lity:ready', [self])
617
- ;
618
- }
619
- }
620
-
621
- function lity(target, options, opener) {
622
- if (!target.preventDefault) {
623
- opener = $(opener);
624
- } else {
625
- target.preventDefault();
626
- opener = $(this);
627
- target = opener.data('lity-target') || opener.attr('href') || opener.attr('src');
628
- }
629
-
630
- var instance = new Lity(
631
- target,
632
- $.extend(
633
- {},
634
- opener.data('lity-options') || opener.data('lity'),
635
- options
636
- ),
637
- opener,
638
- document.activeElement
639
- );
640
-
641
- if (!target.preventDefault) {
642
- return instance;
643
- }
644
- }
645
-
646
- lity.version = '3.0.0-dev';
647
- lity.options = $.proxy(settings, lity, _defaultOptions);
648
- lity.handlers = $.proxy(settings, lity, _defaultOptions.handlers);
649
- lity.current = currentInstance;
650
- lity.iframe = iframe;
651
-
652
- $(document).on('click.lity', '[data-lity]', lity);
653
-
654
- return lity;
655
- }));
1
+ /*! Lity - v3.0.0-dev - 2017-07-17
2
+ * http://sorgalla.com/lity/
3
+ * Copyright (c) 2015-2017 Jan Sorgalla; Licensed MIT */
4
+ (function(window, factory) {
5
+ if (typeof define === 'function' && define.amd) {
6
+ define(['jquery'], function($) {
7
+ return factory(window, $);
8
+ });
9
+ } else if (typeof module === 'object' && typeof module.exports === 'object') {
10
+ module.exports = factory(window, require('jquery'));
11
+ } else {
12
+ window.lity = factory(window, window.jQuery || window.Zepto);
13
+ }
14
+ }(typeof window !== "undefined" ? window : this, function(window, $) {
15
+ 'use strict';
16
+
17
+ var document = window.document;
18
+
19
+ var _win = $(window);
20
+ var _deferred = $.Deferred;
21
+ var _html = $('html');
22
+ var _instances = [];
23
+
24
+ var _attrAriaHidden = 'aria-hidden';
25
+ var _dataAriaHidden = 'lity-' + _attrAriaHidden;
26
+
27
+ var _focusableElementsSelector = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])';
28
+
29
+ var _defaultOptions = {
30
+ esc: true,
31
+ handler: null,
32
+ handlers: {
33
+ image: imageHandler,
34
+ inline: inlineHandler,
35
+ youtube: youtubeHandler,
36
+ vimeo: vimeoHandler,
37
+ googlemaps: googlemapsHandler,
38
+ facebookvideo: facebookvideoHandler,
39
+ iframe: iframeHandler
40
+ },
41
+ template: '<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'
42
+ };
43
+
44
+ var _imageRegexp = /(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i;
45
+ var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i;
46
+ var _vimeoRegex = /(vimeo(pro)?\.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/;
47
+ var _googlemapsRegex = /((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i;
48
+ var _facebookvideoRegex = /(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i;
49
+
50
+ var _transitionEndEvent = (function() {
51
+ var el = document.createElement('div');
52
+
53
+ var transEndEventNames = {
54
+ WebkitTransition: 'webkitTransitionEnd',
55
+ MozTransition: 'transitionend',
56
+ OTransition: 'oTransitionEnd otransitionend',
57
+ transition: 'transitionend'
58
+ };
59
+
60
+ for (var name in transEndEventNames) {
61
+ if (el.style[name] !== undefined) {
62
+ return transEndEventNames[name];
63
+ }
64
+ }
65
+
66
+ return false;
67
+ })();
68
+
69
+ function transitionEnd(element) {
70
+ var deferred = _deferred();
71
+
72
+ if (!_transitionEndEvent || !element.length) {
73
+ deferred.resolve();
74
+ } else {
75
+ element.one(_transitionEndEvent, deferred.resolve);
76
+ setTimeout(deferred.resolve, 500);
77
+ }
78
+
79
+ return deferred.promise();
80
+ }
81
+
82
+ function settings(currSettings, key, value) {
83
+ if (arguments.length === 1) {
84
+ return $.extend({}, currSettings);
85
+ }
86
+
87
+ if (typeof key === 'string') {
88
+ if (typeof value === 'undefined') {
89
+ return typeof currSettings[key] === 'undefined'
90
+ ? null
91
+ : currSettings[key];
92
+ }
93
+
94
+ currSettings[key] = value;
95
+ } else {
96
+ $.extend(currSettings, key);
97
+ }
98
+
99
+ return this;
100
+ }
101
+
102
+ function parseQueryParams(params) {
103
+ var pos = params.indexOf('?');
104
+
105
+ if (pos > -1) {
106
+ params = params.substr(pos + 1);
107
+ }
108
+
109
+ var pairs = decodeURI(params.split('#')[0]).split('&');
110
+ var obj = {}, p;
111
+
112
+ for (var i = 0, n = pairs.length; i < n; i++) {
113
+ if (!pairs[i]) {
114
+ continue;
115
+ }
116
+
117
+ p = pairs[i].split('=');
118
+ obj[p[0]] = p[1];
119
+ }
120
+
121
+ return obj;
122
+ }
123
+
124
+ function appendQueryParams(url, params) {
125
+ if (!params) {
126
+ return url;
127
+ }
128
+
129
+ if ('string' === $.type(params)) {
130
+ params = parseQueryParams(params);
131
+ }
132
+
133
+ if (url.indexOf('?') > -1) {
134
+ var split = url.split('?');
135
+ url = split.shift();
136
+
137
+ params = $.extend(
138
+ {},
139
+ parseQueryParams(split[0]),
140
+ params
141
+ )
142
+ }
143
+
144
+ return url + '?' + $.param(params);
145
+ }
146
+
147
+ function transferHash(originalUrl, newUrl) {
148
+ var pos = originalUrl.indexOf('#');
149
+
150
+ if (-1 === pos) {
151
+ return newUrl;
152
+ }
153
+
154
+ if (pos > 0) {
155
+ originalUrl = originalUrl.substr(pos);
156
+ }
157
+
158
+ return newUrl + originalUrl;
159
+ }
160
+
161
+ function iframe(iframeUrl, instance, queryParams, hashUrl) {
162
+ instance && instance.element().addClass('lity-iframe');
163
+
164
+ if (queryParams) {
165
+ iframeUrl = appendQueryParams(iframeUrl, queryParams);
166
+ }
167
+
168
+ if (hashUrl) {
169
+ iframeUrl = transferHash(hashUrl, iframeUrl);
170
+ }
171
+
172
+ return '<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="' + iframeUrl + '"/></div>';
173
+ }
174
+
175
+ function error(msg) {
176
+ return $('<span class="lity-error"/>').append(msg);
177
+ }
178
+
179
+ function imageHandler(target, instance) {
180
+ var desc = (instance.opener() && instance.opener().data('lity-desc')) || 'Image with no description';
181
+ var img = $('<img src="' + target + '" alt="' + desc + '"/>');
182
+ var deferred = _deferred();
183
+ var failed = function() {
184
+ deferred.reject(error('Failed loading image'));
185
+ };
186
+
187
+ img
188
+ .on('load', function() {
189
+ if (this.naturalWidth === 0) {
190
+ return failed();
191
+ }
192
+
193
+ deferred.resolve(img);
194
+ })
195
+ .on('error', failed)
196
+ ;
197
+
198
+ return deferred.promise();
199
+ }
200
+
201
+ imageHandler.test = function(target) {
202
+ return _imageRegexp.test(target);
203
+ };
204
+
205
+ function inlineHandler(target, instance) {
206
+ var el, placeholder, hasHideClass;
207
+
208
+ try {
209
+ el = $(target);
210
+ } catch (e) {
211
+ return false;
212
+ }
213
+
214
+ if (!el.length) {
215
+ return false;
216
+ }
217
+
218
+ placeholder = $('<i style="display:none !important"/>');
219
+ hasHideClass = el.hasClass('lity-hide');
220
+
221
+ instance
222
+ .element()
223
+ .one('lity:remove', function() {
224
+ placeholder
225
+ .before(el)
226
+ .remove()
227
+ ;
228
+
229
+ if (hasHideClass && !el.closest('.lity-content').length) {
230
+ el.addClass('lity-hide');
231
+ }
232
+ })
233
+ ;
234
+
235
+ return el
236
+ .removeClass('lity-hide')
237
+ .after(placeholder)
238
+ ;
239
+ }
240
+
241
+ function youtubeHandler(target, instance) {
242
+ var matches = _youtubeRegex.exec(target);
243
+
244
+ if (!matches) {
245
+ return false;
246
+ }
247
+
248
+ return iframe(
249
+ 'https://www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4] + '?autoplay=1',
250
+ instance,
251
+ matches[5],
252
+ target
253
+ );
254
+ }
255
+
256
+ function vimeoHandler(target, instance) {
257
+ var matches = _vimeoRegex.exec(target);
258
+
259
+ if (!matches) {
260
+ return false;
261
+ }
262
+
263
+ return iframe(
264
+ 'https://player.vimeo.com/video/' + matches[3] + '?autoplay=1',
265
+ instance,
266
+ matches[4],
267
+ target
268
+ );
269
+ }
270
+
271
+ function facebookvideoHandler(target, instance) {
272
+ var matches = _facebookvideoRegex.exec(target);
273
+
274
+ if (!matches) {
275
+ return false;
276
+ }
277
+
278
+ if (0 !== target.indexOf('http')) {
279
+ target = 'https:' + target;
280
+ }
281
+
282
+ return iframe(
283
+ 'https://www.facebook.com/plugins/video.php?href=' + target + '&autoplay=1',
284
+ instance,
285
+ matches[4],
286
+ target
287
+ );
288
+ }
289
+
290
+ function googlemapsHandler(target, instance) {
291
+ var matches = _googlemapsRegex.exec(target);
292
+
293
+ if (!matches) {
294
+ return false;
295
+ }
296
+
297
+ return iframe(
298
+ 'https://www.google.' + matches[3] + '/maps?' + matches[6],
299
+ instance,
300
+ {
301
+ output: matches[6].indexOf('layer=c') > 0 ? 'svembed' : 'embed'
302
+ },
303
+ target
304
+ );
305
+ }
306
+
307
+ function iframeHandler(target, instance) {
308
+ return iframe(target, instance);
309
+ }
310
+
311
+ function winHeight() {
312
+ return document.documentElement.clientHeight
313
+ ? document.documentElement.clientHeight
314
+ : Math.round(_win.height());
315
+ }
316
+
317
+ function keydown(e) {
318
+ var current = currentInstance();
319
+
320
+ if (!current) {
321
+ return;
322
+ }
323
+
324
+ // ESC key
325
+ if (e.keyCode === 27 && !!current.options('esc')) {
326
+ current.close();
327
+ }
328
+
329
+ // TAB key
330
+ if (e.keyCode === 9) {
331
+ handleTabKey(e, current);
332
+ }
333
+ }
334
+
335
+ function handleTabKey(e, instance) {
336
+ var focusableElements = instance.element().find(_focusableElementsSelector);
337
+ var focusedIndex = focusableElements.index(document.activeElement);
338
+
339
+ if (e.shiftKey && focusedIndex <= 0) {
340
+ focusableElements.get(focusableElements.length - 1).focus();
341
+ e.preventDefault();
342
+ } else if (!e.shiftKey && focusedIndex === focusableElements.length - 1) {
343
+ focusableElements.get(0).focus();
344
+ e.preventDefault();
345
+ }
346
+ }
347
+
348
+ function resize() {
349
+ $.each(_instances, function(i, instance) {
350
+ instance.resize();
351
+ });
352
+ }
353
+
354
+ function registerInstance(instanceToRegister) {
355
+ if (1 === _instances.unshift(instanceToRegister)) {
356
+ _html.addClass('lity-active');
357
+
358
+ _win
359
+ .on({
360
+ resize: resize,
361
+ keydown: keydown
362
+ })
363
+ ;
364
+ }
365
+
366
+ $('body > *').not(instanceToRegister.element())
367
+ .addClass('lity-hidden')
368
+ .each(function() {
369
+ var el = $(this);
370
+
371
+ if (undefined !== el.data(_dataAriaHidden)) {
372
+ return;
373
+ }
374
+
375
+ el.data(_dataAriaHidden, el.attr(_attrAriaHidden) || null);
376
+ })
377
+ .attr(_attrAriaHidden, 'true')
378
+ ;
379
+ }
380
+
381
+ function removeInstance(instanceToRemove) {
382
+ var show;
383
+
384
+ instanceToRemove
385
+ .element()
386
+ .attr(_attrAriaHidden, 'true')
387
+ ;
388
+
389
+ if (1 === _instances.length) {
390
+ _html.removeClass('lity-active');
391
+
392
+ _win
393
+ .off({
394
+ resize: resize,
395
+ keydown: keydown
396
+ })
397
+ ;
398
+ }
399
+
400
+ _instances = $.grep(_instances, function(instance) {
401
+ return instanceToRemove !== instance;
402
+ });
403
+
404
+ if (!!_instances.length) {
405
+ show = _instances[0].element();
406
+ } else {
407
+ show = $('.lity-hidden');
408
+ }
409
+
410
+ show
411
+ .removeClass('lity-hidden')
412
+ .each(function() {
413
+ var el = $(this), oldAttr = el.data(_dataAriaHidden);
414
+
415
+ if (!oldAttr) {
416
+ el.removeAttr(_attrAriaHidden);
417
+ } else {
418
+ el.attr(_attrAriaHidden, oldAttr);
419
+ }
420
+
421
+ el.removeData(_dataAriaHidden);
422
+ })
423
+ ;
424
+ }
425
+
426
+ function currentInstance() {
427
+ if (0 === _instances.length) {
428
+ return null;
429
+ }
430
+
431
+ return _instances[0];
432
+ }
433
+
434
+ function factory(target, instance, handlers, preferredHandler) {
435
+ var handler = 'inline', content;
436
+
437
+ var currentHandlers = $.extend({}, handlers);
438
+
439
+ if (preferredHandler && currentHandlers[preferredHandler]) {
440
+ content = currentHandlers[preferredHandler](target, instance);
441
+ handler = preferredHandler;
442
+ } else {
443
+ // Run inline and iframe handlers after all other handlers
444
+ $.each(['inline', 'iframe'], function(i, name) {
445
+ delete currentHandlers[name];
446
+
447
+ currentHandlers[name] = handlers[name];
448
+ });
449
+
450
+ $.each(currentHandlers, function(name, currentHandler) {
451
+ // Handler might be "removed" by setting callback to null
452
+ if (!currentHandler) {
453
+ return true;
454
+ }
455
+
456
+ if (
457
+ currentHandler.test &&
458
+ !currentHandler.test(target, instance)
459
+ ) {
460
+ return true;
461
+ }
462
+
463
+ content = currentHandler(target, instance);
464
+
465
+ if (false !== content) {
466
+ handler = name;
467
+ return false;
468
+ }
469
+ });
470
+ }
471
+
472
+ return {handler: handler, content: content || ''};
473
+ }
474
+
475
+ function Lity(target, options, opener, activeElement) {
476
+ var self = this;
477
+ var result;
478
+ var isReady = false;
479
+ var isClosed = false;
480
+ var element;
481
+ var content;
482
+
483
+ options = $.extend(
484
+ {},
485
+ _defaultOptions,
486
+ options
487
+ );
488
+
489
+ element = $(options.template);
490
+
491
+ // -- API --
492
+
493
+ self.element = function() {
494
+ return element;
495
+ };
496
+
497
+ self.opener = function() {
498
+ return opener;
499
+ };
500
+
501
+ self.content = function() {
502
+ return content;
503
+ };
504
+
505
+ self.options = $.proxy(settings, self, options);
506
+ self.handlers = $.proxy(settings, self, options.handlers);
507
+
508
+ self.resize = function() {
509
+ if (!isReady || isClosed) {
510
+ return;
511
+ }
512
+
513
+ content
514
+ .css('max-height', winHeight() + 'px')
515
+ .trigger('lity:resize', [self])
516
+ ;
517
+ };
518
+
519
+ self.close = function() {
520
+ if (!isReady || isClosed) {
521
+ return;
522
+ }
523
+
524
+ isClosed = true;
525
+
526
+ removeInstance(self);
527
+
528
+ var deferred = _deferred();
529
+
530
+ // We return focus only if the current focus is inside this instance
531
+ if (
532
+ activeElement &&
533
+ (
534
+ document.activeElement === element[0] ||
535
+ $.contains(element[0], document.activeElement)
536
+ )
537
+ ) {
538
+ try {
539
+ activeElement.focus();
540
+ } catch (e) {
541
+ // Ignore exceptions, eg. for SVG elements which can't be
542
+ // focused in IE11
543
+ }
544
+ }
545
+
546
+ content.trigger('lity:close', [self]);
547
+
548
+ element
549
+ .removeClass('lity-opened')
550
+ .addClass('lity-closed')
551
+ ;
552
+
553
+ transitionEnd(content.add(element))
554
+ .always(function() {
555
+ content.trigger('lity:remove', [self]);
556
+ element.remove();
557
+ element = undefined;
558
+ deferred.resolve();
559
+ })
560
+ ;
561
+
562
+ return deferred.promise();
563
+ };
564
+
565
+ // -- Initialization --
566
+
567
+ result = factory(target, self, options.handlers, options.handler);
568
+
569
+ element
570
+ .attr(_attrAriaHidden, 'false')
571
+ .addClass('lity-loading lity-opened lity-' + result.handler)
572
+ .appendTo('body')
573
+ .focus()
574
+ .on('click', '[data-lity-close]', function(e) {
575
+ if ($(e.target).is('[data-lity-close]')) {
576
+ self.close();
577
+ }
578
+ })
579
+ .trigger('lity:open', [self])
580
+ ;
581
+
582
+ registerInstance(self);
583
+
584
+ $.when(result.content)
585
+ .always(ready)
586
+ ;
587
+
588
+ function ready(result) {
589
+ content = $(result)
590
+ .css('max-height', winHeight() + 'px')
591
+ ;
592
+
593
+ element
594
+ .find('.lity-loader')
595
+ .each(function() {
596
+ var loader = $(this);
597
+
598
+ transitionEnd(loader)
599
+ .always(function() {
600
+ loader.remove();
601
+ })
602
+ ;
603
+ })
604
+ ;
605
+
606
+ element
607
+ .removeClass('lity-loading')
608
+ .find('.lity-content')
609
+ .empty()
610
+ .append(content)
611
+ ;
612
+
613
+ isReady = true;
614
+
615
+ content
616
+ .trigger('lity:ready', [self])
617
+ ;
618
+ }
619
+ }
620
+
621
+ function lity(target, options, opener) {
622
+ if (!target.preventDefault) {
623
+ opener = $(opener);
624
+ } else {
625
+ target.preventDefault();
626
+ opener = $(this);
627
+ target = opener.data('lity-target') || opener.attr('href') || opener.attr('src');
628
+ }
629
+
630
+ var instance = new Lity(
631
+ target,
632
+ $.extend(
633
+ {},
634
+ opener.data('lity-options') || opener.data('lity'),
635
+ options
636
+ ),
637
+ opener,
638
+ document.activeElement
639
+ );
640
+
641
+ if (!target.preventDefault) {
642
+ return instance;
643
+ }
644
+ }
645
+
646
+ lity.version = '3.0.0-dev';
647
+ lity.options = $.proxy(settings, lity, _defaultOptions);
648
+ lity.handlers = $.proxy(settings, lity, _defaultOptions.handlers);
649
+ lity.current = currentInstance;
650
+ lity.iframe = iframe;
651
+
652
+ $(document).on('click.lity', '[data-lity]', lity);
653
+
654
+ return lity;
655
+ }));