fomantic-ui 2.9.0-beta.315 → 2.9.0-beta.316

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 (163) hide show
  1. package/dist/components/accordion.css +1 -1
  2. package/dist/components/accordion.js +1 -1
  3. package/dist/components/accordion.min.css +1 -1
  4. package/dist/components/accordion.min.js +1 -1
  5. package/dist/components/ad.css +1 -1
  6. package/dist/components/ad.min.css +1 -1
  7. package/dist/components/api.js +1 -1
  8. package/dist/components/api.min.js +1 -1
  9. package/dist/components/breadcrumb.css +1 -1
  10. package/dist/components/breadcrumb.min.css +1 -1
  11. package/dist/components/button.css +1 -1
  12. package/dist/components/button.min.css +1 -1
  13. package/dist/components/calendar.css +1 -1
  14. package/dist/components/calendar.js +1 -1
  15. package/dist/components/calendar.min.css +1 -1
  16. package/dist/components/calendar.min.js +1 -1
  17. package/dist/components/card.css +1 -1
  18. package/dist/components/card.min.css +1 -1
  19. package/dist/components/checkbox.css +1 -1
  20. package/dist/components/checkbox.js +1 -1
  21. package/dist/components/checkbox.min.css +1 -1
  22. package/dist/components/checkbox.min.js +1 -1
  23. package/dist/components/comment.css +1 -1
  24. package/dist/components/comment.min.css +1 -1
  25. package/dist/components/container.css +1 -1
  26. package/dist/components/container.min.css +1 -1
  27. package/dist/components/dimmer.css +1 -1
  28. package/dist/components/dimmer.js +1 -1
  29. package/dist/components/dimmer.min.css +1 -1
  30. package/dist/components/dimmer.min.js +1 -1
  31. package/dist/components/divider.css +1 -1
  32. package/dist/components/divider.min.css +1 -1
  33. package/dist/components/dropdown.css +1 -1
  34. package/dist/components/dropdown.js +1 -1
  35. package/dist/components/dropdown.min.css +1 -1
  36. package/dist/components/dropdown.min.js +1 -1
  37. package/dist/components/embed.css +1 -1
  38. package/dist/components/embed.js +1 -1
  39. package/dist/components/embed.min.css +1 -1
  40. package/dist/components/embed.min.js +1 -1
  41. package/dist/components/feed.css +1 -1
  42. package/dist/components/feed.min.css +1 -1
  43. package/dist/components/flag.css +1 -1
  44. package/dist/components/flag.min.css +1 -1
  45. package/dist/components/flyout.css +558 -0
  46. package/dist/components/flyout.js +1346 -0
  47. package/dist/components/flyout.min.css +9 -0
  48. package/dist/components/flyout.min.js +11 -0
  49. package/dist/components/form.css +1 -1
  50. package/dist/components/form.js +1 -1
  51. package/dist/components/form.min.css +1 -1
  52. package/dist/components/form.min.js +1 -1
  53. package/dist/components/grid.css +1 -1
  54. package/dist/components/grid.min.css +1 -1
  55. package/dist/components/header.css +1 -1
  56. package/dist/components/header.min.css +1 -1
  57. package/dist/components/icon.css +1 -1
  58. package/dist/components/icon.min.css +1 -1
  59. package/dist/components/image.css +1 -1
  60. package/dist/components/image.min.css +1 -1
  61. package/dist/components/input.css +1 -1
  62. package/dist/components/input.min.css +1 -1
  63. package/dist/components/item.css +1 -1
  64. package/dist/components/item.min.css +1 -1
  65. package/dist/components/label.css +1 -1
  66. package/dist/components/label.min.css +1 -1
  67. package/dist/components/list.css +1 -1
  68. package/dist/components/list.min.css +1 -1
  69. package/dist/components/loader.css +1 -1
  70. package/dist/components/loader.min.css +1 -1
  71. package/dist/components/message.css +1 -1
  72. package/dist/components/message.min.css +1 -1
  73. package/dist/components/modal.css +1 -1
  74. package/dist/components/modal.js +1 -1
  75. package/dist/components/modal.min.css +1 -1
  76. package/dist/components/modal.min.js +1 -1
  77. package/dist/components/nag.css +1 -1
  78. package/dist/components/nag.js +1 -1
  79. package/dist/components/nag.min.css +1 -1
  80. package/dist/components/nag.min.js +1 -1
  81. package/dist/components/placeholder.css +1 -1
  82. package/dist/components/placeholder.min.css +1 -1
  83. package/dist/components/popup.css +1 -1
  84. package/dist/components/popup.js +1 -1
  85. package/dist/components/popup.min.css +1 -1
  86. package/dist/components/popup.min.js +1 -1
  87. package/dist/components/progress.css +1 -1
  88. package/dist/components/progress.js +1 -1
  89. package/dist/components/progress.min.css +1 -1
  90. package/dist/components/progress.min.js +1 -1
  91. package/dist/components/rail.css +1 -1
  92. package/dist/components/rail.min.css +1 -1
  93. package/dist/components/rating.css +1 -1
  94. package/dist/components/rating.js +1 -1
  95. package/dist/components/rating.min.css +1 -1
  96. package/dist/components/rating.min.js +1 -1
  97. package/dist/components/reset.css +1 -1
  98. package/dist/components/reset.min.css +1 -1
  99. package/dist/components/reveal.css +1 -1
  100. package/dist/components/reveal.min.css +1 -1
  101. package/dist/components/search.css +1 -1
  102. package/dist/components/search.js +1 -1
  103. package/dist/components/search.min.css +1 -1
  104. package/dist/components/search.min.js +1 -1
  105. package/dist/components/segment.css +1 -1
  106. package/dist/components/segment.min.css +1 -1
  107. package/dist/components/shape.css +1 -1
  108. package/dist/components/shape.js +1 -1
  109. package/dist/components/shape.min.css +1 -1
  110. package/dist/components/shape.min.js +1 -1
  111. package/dist/components/sidebar.css +1 -1
  112. package/dist/components/sidebar.js +1 -1
  113. package/dist/components/sidebar.min.css +1 -1
  114. package/dist/components/sidebar.min.js +1 -1
  115. package/dist/components/site.css +1 -1
  116. package/dist/components/site.js +1 -1
  117. package/dist/components/site.min.css +1 -1
  118. package/dist/components/site.min.js +1 -1
  119. package/dist/components/slider.js +1 -1
  120. package/dist/components/slider.min.js +1 -1
  121. package/dist/components/state.js +1 -1
  122. package/dist/components/state.min.js +1 -1
  123. package/dist/components/statistic.css +1 -1
  124. package/dist/components/statistic.min.css +1 -1
  125. package/dist/components/step.css +1 -1
  126. package/dist/components/step.min.css +1 -1
  127. package/dist/components/sticky.css +1 -1
  128. package/dist/components/sticky.js +1 -1
  129. package/dist/components/sticky.min.css +1 -1
  130. package/dist/components/sticky.min.js +1 -1
  131. package/dist/components/tab.css +1 -1
  132. package/dist/components/tab.js +1 -1
  133. package/dist/components/tab.min.css +1 -1
  134. package/dist/components/tab.min.js +1 -1
  135. package/dist/components/table.css +1 -1
  136. package/dist/components/table.min.css +1 -1
  137. package/dist/components/text.css +1 -1
  138. package/dist/components/text.min.css +1 -1
  139. package/dist/components/toast.css +1 -1
  140. package/dist/components/toast.js +1 -1
  141. package/dist/components/toast.min.css +1 -1
  142. package/dist/components/toast.min.js +1 -1
  143. package/dist/components/transition.css +1 -1
  144. package/dist/components/transition.js +1 -1
  145. package/dist/components/transition.min.css +1 -1
  146. package/dist/components/transition.min.js +1 -1
  147. package/dist/components/visibility.js +1 -1
  148. package/dist/components/visibility.min.js +1 -1
  149. package/dist/semantic.css +657 -49
  150. package/dist/semantic.js +1372 -25
  151. package/dist/semantic.min.css +2 -2
  152. package/dist/semantic.min.js +2 -2
  153. package/package.json +1 -1
  154. package/src/definitions/modules/flyout.js +1346 -0
  155. package/src/definitions/modules/flyout.less +604 -0
  156. package/src/semantic.less +1 -0
  157. package/src/theme.config.example +1 -0
  158. package/src/themes/default/globals/variation.variables +10 -0
  159. package/src/themes/default/modules/flyout.overrides +3 -0
  160. package/src/themes/default/modules/flyout.variables +45 -0
  161. package/tasks/config/admin/release.js +1 -0
  162. package/tasks/config/defaults.js +1 -0
  163. package/tasks/config/project/install.js +1 -0
@@ -0,0 +1,1346 @@
1
+ /*!
2
+ * # Fomantic-UI - Flyout
3
+ * http://github.com/fomantic/Fomantic-UI/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ ;(function ($, window, document, undefined) {
12
+
13
+ 'use strict';
14
+
15
+ $.isFunction = $.isFunction || function(obj) {
16
+ return typeof obj === "function" && typeof obj.nodeType !== "number";
17
+ };
18
+
19
+ window = (typeof window != 'undefined' && window.Math == Math)
20
+ ? window
21
+ : (typeof self != 'undefined' && self.Math == Math)
22
+ ? self
23
+ : Function('return this')()
24
+ ;
25
+
26
+ $.fn.flyout = function(parameters) {
27
+ var
28
+ $allModules = $(this),
29
+ $window = $(window),
30
+ $document = $(document),
31
+ $html = $('html'),
32
+ $head = $('head'),
33
+ $body = $('body'),
34
+
35
+ moduleSelector = $allModules.selector || '',
36
+
37
+ time = new Date().getTime(),
38
+ performance = [],
39
+
40
+ query = arguments[0],
41
+ methodInvoked = (typeof query == 'string'),
42
+ queryArguments = [].slice.call(arguments, 1),
43
+
44
+ requestAnimationFrame = window.requestAnimationFrame
45
+ || window.mozRequestAnimationFrame
46
+ || window.webkitRequestAnimationFrame
47
+ || window.msRequestAnimationFrame
48
+ || function(callback) { setTimeout(callback, 0); },
49
+
50
+ returnedValue
51
+ ;
52
+
53
+ $allModules
54
+ .each(function() {
55
+ var
56
+ settings = ( $.isPlainObject(parameters) )
57
+ ? $.extend(true, {}, $.fn.flyout.settings, parameters)
58
+ : $.extend({}, $.fn.flyout.settings),
59
+
60
+ selector = settings.selector,
61
+ className = settings.className,
62
+ namespace = settings.namespace,
63
+ fields = settings.fields,
64
+ regExp = settings.regExp,
65
+ error = settings.error,
66
+
67
+ eventNamespace = '.' + namespace,
68
+ moduleNamespace = 'module-' + namespace,
69
+
70
+ $module = $(this),
71
+ $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $body,
72
+ $close = $module.find(selector.close),
73
+
74
+ $flyouts = $module.children(selector.flyout),
75
+ $pusher = $context.children(selector.pusher),
76
+ $style,
77
+
78
+ element = this,
79
+ instance = $module.hasClass(namespace) ? $module.data(moduleNamespace) : undefined,
80
+
81
+ ignoreRepeatedEvents = false,
82
+ isBody = $context[0] === $body[0],
83
+ initialBodyMargin = '',
84
+ tempBodyMargin = '',
85
+ hadScrollbar = false,
86
+
87
+ elementNamespace,
88
+ id,
89
+ currentScroll,
90
+ transitionEvent,
91
+
92
+ module
93
+ ;
94
+
95
+ module = {
96
+
97
+ initialize: function() {
98
+ module.debug('Initializing flyout', parameters);
99
+
100
+ if(!$module.hasClass(namespace)) {
101
+ module.create.flyout();
102
+ if(!$.isFunction(settings.onHidden)) {
103
+ settings.onHidden = function () {
104
+ module.destroy();
105
+ $module.remove();
106
+ };
107
+ }
108
+ }
109
+ $module.addClass(settings.class);
110
+ if (settings.title !== '') {
111
+ $module.find(selector.header).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
112
+ }
113
+ if (settings.content !== '') {
114
+ $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
115
+ }
116
+ if(module.has.configActions()){
117
+ var $actions = $module.find(selector.actions).addClass(settings.classActions);
118
+ if ($actions.length === 0) {
119
+ $actions = $('<div/>', {class: className.actions + ' ' + (settings.classActions || '')}).appendTo($module);
120
+ } else {
121
+ $actions.empty();
122
+ }
123
+ settings.actions.forEach(function (el) {
124
+ var
125
+ icon = el[fields.icon] ? '<i class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
126
+ text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
127
+ cls = module.helpers.deQuote(el[fields.class] || ''),
128
+ click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {}
129
+ ;
130
+ $actions.append($('<button/>', {
131
+ html: icon + text,
132
+ class: className.button + ' ' + cls,
133
+ click: function () {
134
+ if (click.call(element, $module) === false) {
135
+ return;
136
+ }
137
+ module.hide();
138
+ }
139
+ }));
140
+ });
141
+ }
142
+
143
+ module.create.id();
144
+
145
+ transitionEvent = module.get.transitionEvent();
146
+
147
+ // avoids locking rendering if initialized in onReady
148
+ if(settings.delaySetup) {
149
+ requestAnimationFrame(module.setup.layout);
150
+ }
151
+ else {
152
+ module.setup.layout();
153
+ }
154
+
155
+ requestAnimationFrame(function() {
156
+ module.setup.cache();
157
+ });
158
+
159
+ if (module.get.direction() == 'left' || module.get.direction() == 'right') {
160
+ module.setup.heights();
161
+ module.bind.resize();
162
+ }
163
+ module.instantiate();
164
+
165
+ if(settings.autoShow){
166
+ module.show();
167
+ }
168
+ },
169
+
170
+ instantiate: function() {
171
+ module.verbose('Storing instance of module', module);
172
+ instance = module;
173
+ $module
174
+ .data(moduleNamespace, instance)
175
+ ;
176
+ },
177
+
178
+ create: {
179
+ flyout: function() {
180
+ module.verbose('Programmaticaly create flyout', $context);
181
+ $module = $('<div/>', {class: className.flyout});
182
+ if (settings.closeIcon) {
183
+ $close = $('<i/>', {class: className.close})
184
+ $module.append($close);
185
+ }
186
+ if (settings.title !== '') {
187
+ $('<div/>', {class: className.header}).appendTo($module);
188
+ }
189
+ if (settings.content !== '') {
190
+ $('<div/>', {class: className.content}).appendTo($module);
191
+ }
192
+ if (module.has.configActions()) {
193
+ $('<div/>', {class: className.actions}).appendTo($module);
194
+ }
195
+ $context.append($module);
196
+ },
197
+ id: function() {
198
+ id = (Math.random().toString(16) + '000000000').substr(2,8);
199
+ elementNamespace = '.' + id;
200
+ module.verbose('Creating unique id for element', id);
201
+ }
202
+ },
203
+
204
+ destroy: function() {
205
+ module.verbose('Destroying previous module for', $module);
206
+ $module
207
+ .off(eventNamespace)
208
+ .removeData(moduleNamespace)
209
+ ;
210
+ if(module.is.ios()) {
211
+ module.remove.ios();
212
+ }
213
+ // bound by uuid
214
+ $context.off(elementNamespace);
215
+ $window.off(elementNamespace);
216
+ $document.off(elementNamespace);
217
+ },
218
+
219
+ event: {
220
+ resize: function() {
221
+ module.setup.heights();
222
+ },
223
+ clickaway: function(event) {
224
+ if(settings.closable){
225
+ var
226
+ clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
227
+ clickedContext = ($context.is(event.target))
228
+ ;
229
+ if(clickedInPusher) {
230
+ module.verbose('User clicked on dimmed page');
231
+ module.hide();
232
+ }
233
+ if(clickedContext) {
234
+ module.verbose('User clicked on dimmable context (scaled out page)');
235
+ module.hide();
236
+ }
237
+ }
238
+ },
239
+ close: function(event) {
240
+ module.hide();
241
+ },
242
+ approve: function(event) {
243
+ if (ignoreRepeatedEvents || settings.onApprove.call(module.element, $(this)) === false) {
244
+ module.verbose('Approve callback returned false cancelling close');
245
+ return;
246
+ }
247
+ ignoreRepeatedEvents = true;
248
+ module.hide(function() {
249
+ ignoreRepeatedEvents = false;
250
+ });
251
+ },
252
+ deny: function(event) {
253
+ if (ignoreRepeatedEvents || settings.onDeny.call(module.element, $(this)) === false) {
254
+ module.verbose('Deny callback returned false cancelling close');
255
+ return;
256
+ }
257
+ ignoreRepeatedEvents = true;
258
+ module.hide(function() {
259
+ ignoreRepeatedEvents = false;
260
+ });
261
+ },
262
+ touch: function(event) {
263
+ //event.stopPropagation();
264
+ },
265
+ containScroll: function(event) {
266
+ if(element.scrollTop <= 0) {
267
+ element.scrollTop = 1;
268
+ }
269
+ if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
270
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
271
+ }
272
+ },
273
+ scroll: function(event) {
274
+ if( $(event.target).closest(selector.flyout).length === 0 ) {
275
+ event.preventDefault();
276
+ }
277
+ }
278
+ },
279
+
280
+ bind: {
281
+ resize: function() {
282
+ module.verbose('Adding resize event to window', $window);
283
+ $window.on('resize' + elementNamespace, module.event.resize);
284
+ },
285
+ clickaway: function() {
286
+ module.verbose('Adding clickaway events to context', $context);
287
+ $context
288
+ .on('click' + elementNamespace, module.event.clickaway)
289
+ .on('touchend' + elementNamespace, module.event.clickaway)
290
+ ;
291
+
292
+ $module.on('click' + elementNamespace, settings.selector.close, module.event.close);
293
+ $module.on('click' + elementNamespace, settings.selector.approve, module.event.approve);
294
+ $module.on('click' + elementNamespace, settings.selector.deny, module.event.deny);
295
+ },
296
+ scrollLock: function() {
297
+ if(settings.scrollLock) {
298
+ module.debug('Disabling page scroll');
299
+ hadScrollbar = module.has.scrollbar();
300
+ if(hadScrollbar) {
301
+ module.save.bodyMargin();
302
+ module.set.bodyMargin();
303
+ }
304
+ $context.addClass(className.locked);
305
+ }
306
+ module.verbose('Adding events to contain flyout scroll');
307
+ $document
308
+ .on('touchmove' + elementNamespace, module.event.touch)
309
+ ;
310
+ $module
311
+ .on('scroll' + eventNamespace, module.event.containScroll)
312
+ ;
313
+ }
314
+ },
315
+ unbind: {
316
+ clickaway: function() {
317
+ module.verbose('Removing clickaway events from context', $context);
318
+ $context.off(elementNamespace);
319
+ },
320
+ scrollLock: function() {
321
+ module.verbose('Removing scroll lock from page');
322
+ if(hadScrollbar) {
323
+ module.restore.bodyMargin();
324
+ }
325
+ $context.removeClass(className.locked);
326
+ $document.off(elementNamespace);
327
+ $module.off('scroll' + eventNamespace);
328
+ }
329
+ },
330
+
331
+ add: {
332
+ inlineCSS: function() {
333
+ var
334
+ width = module.cache.width || $module.outerWidth(),
335
+ height = module.cache.height || $module.outerHeight(),
336
+ isRTL = module.is.rtl(),
337
+ direction = module.get.direction(),
338
+ distance = {
339
+ left : width,
340
+ right : -width,
341
+ top : height,
342
+ bottom : -height
343
+ },
344
+ style
345
+ ;
346
+
347
+ if(isRTL){
348
+ module.verbose('RTL detected, flipping widths');
349
+ distance.left = -width;
350
+ distance.right = width;
351
+ }
352
+
353
+ style = '<style>';
354
+
355
+ if(direction === 'left' || direction === 'right') {
356
+ module.debug('Adding CSS rules for animation distance', width);
357
+ style += ''
358
+ + ' .ui.visible.' + direction + '.flyout ~ .fixed,'
359
+ + ' .ui.visible.' + direction + '.flyout ~ .pusher {'
360
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
361
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
362
+ + ' }'
363
+ ;
364
+ }
365
+ else if(direction === 'top' || direction == 'bottom') {
366
+ style += ''
367
+ + ' .ui.visible.' + direction + '.flyout ~ .fixed,'
368
+ + ' .ui.visible.' + direction + '.flyout ~ .pusher {'
369
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
370
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
371
+ + ' }'
372
+ ;
373
+ }
374
+
375
+ /* IE is only browser not to create context with transforms */
376
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
377
+ if( module.is.ie() ) {
378
+ if(direction === 'left' || direction === 'right') {
379
+ module.debug('Adding CSS rules for animation distance', width);
380
+ style += ''
381
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher:after {'
382
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
383
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
384
+ + ' }'
385
+ ;
386
+ }
387
+ else if(direction === 'top' || direction == 'bottom') {
388
+ style += ''
389
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher:after {'
390
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
391
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
392
+ + ' }'
393
+ ;
394
+ }
395
+ /* opposite sides visible forces content overlay */
396
+ style += ''
397
+ + ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher:after,'
398
+ + ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher:after {'
399
+ + ' -webkit-transform: translate3d(0, 0, 0);'
400
+ + ' transform: translate3d(0, 0, 0);'
401
+ + ' }'
402
+ ;
403
+ }
404
+ style += '</style>';
405
+ $style = $(style)
406
+ .appendTo($head)
407
+ ;
408
+ module.debug('Adding sizing css to head', $style);
409
+ }
410
+ },
411
+
412
+ refresh: function() {
413
+ module.verbose('Refreshing selector cache');
414
+ $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
415
+ $flyouts = $context.children(selector.flyout);
416
+ $pusher = $context.children(selector.pusher);
417
+ module.clear.cache();
418
+ },
419
+
420
+ refreshFlyouts: function() {
421
+ module.verbose('Refreshing other flyouts');
422
+ $flyouts = $context.children(selector.flyout);
423
+ },
424
+
425
+ repaint: function() {
426
+ module.verbose('Forcing repaint event');
427
+ element.style.display = 'none';
428
+ element.scrollTop = element.scrollTop;
429
+ element.style.display = '';
430
+ },
431
+
432
+ setup: {
433
+ cache: function() {
434
+ module.cache = {
435
+ width : $module.outerWidth(),
436
+ height : $module.outerHeight()
437
+ };
438
+ },
439
+ layout: function() {
440
+ if( $context.children(selector.pusher).length === 0 ) {
441
+ module.debug('Adding wrapper element for flyout');
442
+ module.error(error.pusher);
443
+ $pusher = $('<div class="pusher" />');
444
+ $context
445
+ .children()
446
+ .not(selector.omitted)
447
+ .not($flyouts)
448
+ .wrapAll($pusher)
449
+ ;
450
+ module.refresh();
451
+ }
452
+ if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
453
+ module.debug('Moved flyout to correct parent element');
454
+ module.error(error.movedFlyout, element);
455
+ $module.detach().prependTo($context);
456
+ module.refresh();
457
+ }
458
+ if( module.is.mobile() ) {
459
+ $module.addClass(className.fullscreen);
460
+ }
461
+ module.clear.cache();
462
+ module.set.pushable();
463
+ module.set.direction();
464
+ },
465
+ heights: function() {
466
+ module.debug('Setting up heights', $module);
467
+ var
468
+ $header = $module.children(selector.header),
469
+ $content = $module.children(selector.content),
470
+ $actions = $module.children(selector.actions)
471
+ ;
472
+ $content.css('min-height', ($context.height() - $header.outerHeight() - $actions.outerHeight()) + 'px');
473
+ }
474
+ },
475
+
476
+ attachEvents: function(selector, event) {
477
+ var
478
+ $toggle = $(selector)
479
+ ;
480
+ event = $.isFunction(module[event])
481
+ ? module[event]
482
+ : module.toggle
483
+ ;
484
+ if($toggle.length > 0) {
485
+ module.debug('Attaching flyout events to element', selector, event);
486
+ $toggle
487
+ .on('click' + eventNamespace, event)
488
+ ;
489
+ }
490
+ else {
491
+ module.error(error.notFound, selector);
492
+ }
493
+ },
494
+
495
+ show: function(callback) {
496
+ callback = $.isFunction(callback)
497
+ ? callback
498
+ : function(){}
499
+ ;
500
+ if(module.is.hidden()) {
501
+ module.refreshFlyouts();
502
+ module.refresh();
503
+ if(module.othersActive()) {
504
+ module.debug('Other flyouts currently visible');
505
+ if(settings.exclusive) {
506
+ module.hideOthers();
507
+ } else {
508
+ ignoreRepeatedEvents = false;
509
+ }
510
+ }
511
+ module.pushPage(function() {
512
+ callback.call(element);
513
+ settings.onShow.call(element);
514
+ });
515
+ settings.onChange.call(element);
516
+ settings.onVisible.call(element);
517
+ }
518
+ else {
519
+ module.debug('Flyout is already visible');
520
+ }
521
+ },
522
+
523
+ hide: function(callback) {
524
+ callback = $.isFunction(callback)
525
+ ? callback
526
+ : function(){}
527
+ ;
528
+ if(settings.onHide.call(element, $(this)) === false) {
529
+ module.verbose('Hide callback returned false cancelling hide');
530
+ ignoreRepeatedEvents = false;
531
+ return false;
532
+ }
533
+ if(module.is.visible() || module.is.animating()) {
534
+ module.debug('Hiding flyout', callback);
535
+ module.refreshFlyouts();
536
+ module.pullPage(function() {
537
+ callback.call(element);
538
+ if($.isFunction(settings.onHidden)) {
539
+ settings.onHidden.call(element);
540
+ }
541
+ });
542
+ settings.onChange.call(element);
543
+ }
544
+ },
545
+
546
+ othersAnimating: function() {
547
+ return ($flyouts.not($module).filter('.' + className.animating).length > 0);
548
+ },
549
+ othersVisible: function() {
550
+ return ($flyouts.not($module).filter('.' + className.visible).length > 0);
551
+ },
552
+ othersActive: function() {
553
+ return(module.othersVisible() || module.othersAnimating());
554
+ },
555
+
556
+ hideOthers: function(callback) {
557
+ var
558
+ $otherFlyouts = $flyouts.not($module).filter('.' + className.visible),
559
+ flyoutCount = $otherFlyouts.length,
560
+ callbackCount = 0
561
+ ;
562
+ callback = callback || function(){};
563
+ $otherFlyouts
564
+ .flyout('hide', function() {
565
+ callbackCount++;
566
+ if(callbackCount == flyoutCount) {
567
+ callback();
568
+ }
569
+ })
570
+ ;
571
+ },
572
+
573
+ toggle: function() {
574
+ module.verbose('Determining toggled direction');
575
+ if(module.is.hidden()) {
576
+ module.show();
577
+ }
578
+ else {
579
+ module.hide();
580
+ }
581
+ },
582
+
583
+ pushPage: function(callback) {
584
+ var
585
+ animate,
586
+ dim,
587
+ transitionEnd
588
+ ;
589
+ callback = $.isFunction(callback)
590
+ ? callback
591
+ : function(){}
592
+ ;
593
+ module.set.overlay();
594
+ module.repaint();
595
+ if(settings.returnScroll) {
596
+ currentScroll = (isBody ? $window : $context).scrollTop();
597
+ }
598
+ module.bind.scrollLock();
599
+ animate = function() {
600
+ module.bind.clickaway();
601
+ module.add.inlineCSS();
602
+ module.set.animating();
603
+ module.set.visible();
604
+ };
605
+ dim = function() {
606
+ module.set.dimmed();
607
+ };
608
+ transitionEnd = function(event) {
609
+ if( event.target == $module[0] ) {
610
+ $module.off(transitionEvent + elementNamespace, transitionEnd);
611
+ module.remove.animating();
612
+ callback.call(element);
613
+ }
614
+ };
615
+ $module.off(transitionEvent + elementNamespace);
616
+ $module.on(transitionEvent + elementNamespace, transitionEnd);
617
+ requestAnimationFrame(animate);
618
+ if(settings.dimPage && !module.othersVisible()) {
619
+ requestAnimationFrame(dim);
620
+ }
621
+ },
622
+
623
+ pullPage: function(callback) {
624
+ var
625
+ animate,
626
+ transitionEnd
627
+ ;
628
+ callback = $.isFunction(callback)
629
+ ? callback
630
+ : function(){}
631
+ ;
632
+ module.verbose('Removing context push state', module.get.direction());
633
+
634
+ module.unbind.clickaway();
635
+ if(!module.othersActive()) {
636
+ module.unbind.scrollLock();
637
+ }
638
+
639
+ animate = function() {
640
+ module.set.overlay();
641
+ module.set.animating();
642
+ module.remove.visible();
643
+
644
+ };
645
+ transitionEnd = function(event) {
646
+ if( event.target == $module[0] ) {
647
+ $module.off(transitionEvent + elementNamespace, transitionEnd);
648
+ module.remove.animating();
649
+ module.remove.overlay();
650
+ module.remove.inlineCSS();
651
+ if(settings.returnScroll) {
652
+ module.scrollBack();
653
+ }
654
+ if (settings.dimPage && !module.othersVisible()) {
655
+ $pusher.removeClass(className.dimmed);
656
+ }
657
+ callback.call(element);
658
+ }
659
+ };
660
+ $module.off(transitionEvent + elementNamespace);
661
+ $module.on(transitionEvent + elementNamespace, transitionEnd);
662
+ requestAnimationFrame(animate);
663
+ },
664
+
665
+ scrollToTop: function() {
666
+ module.verbose('Scrolling to top of page to avoid animation issues');
667
+ $module.scrollTop(0);
668
+ (isBody ? $window : $context)[0].scrollTo(0, 0);
669
+ },
670
+
671
+ scrollBack: function() {
672
+ module.verbose('Scrolling back to original page position');
673
+ (isBody ? $window : $context)[0].scrollTo(0, currentScroll);
674
+ },
675
+
676
+ clear: {
677
+ cache: function() {
678
+ module.verbose('Clearing cached dimensions');
679
+ module.cache = {};
680
+ }
681
+ },
682
+
683
+ set: {
684
+ bodyMargin: function() {
685
+ var position = module.can.leftBodyScrollbar() ? 'left':'right';
686
+ $context.css((isBody ? 'margin-':'padding-')+position, tempBodyMargin + 'px');
687
+ $context.find(selector.bodyFixed.replace('right',position)).each(function(){
688
+ var el = $(this),
689
+ attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
690
+ ;
691
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
692
+ });
693
+ },
694
+
695
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
696
+ // (This is no longer necessary in latest iOS)
697
+ ios: function() {
698
+ $html.addClass(className.ios);
699
+ },
700
+
701
+ // container
702
+ pushed: function() {
703
+ $context.addClass(className.pushed);
704
+ },
705
+ pushable: function() {
706
+ $context.addClass(className.pushable);
707
+ },
708
+
709
+ // pusher
710
+ dimmed: function() {
711
+ $pusher.addClass(className.dimmed);
712
+ },
713
+
714
+ // flyout
715
+ active: function() {
716
+ $module.addClass(className.active);
717
+ },
718
+ animating: function() {
719
+ $module.addClass(className.animating);
720
+ },
721
+ direction: function(direction) {
722
+ direction = direction || module.get.direction();
723
+ $module.addClass(className[direction]);
724
+ },
725
+ visible: function() {
726
+ $module.addClass(className.visible);
727
+ },
728
+ overlay: function() {
729
+ $module.addClass(className.overlay);
730
+ }
731
+ },
732
+ remove: {
733
+
734
+ inlineCSS: function() {
735
+ module.debug('Removing inline css styles', $style);
736
+ if($style && $style.length > 0) {
737
+ $style.remove();
738
+ }
739
+ },
740
+
741
+ // ios scroll on html not document
742
+ ios: function() {
743
+ $html.removeClass(className.ios);
744
+ },
745
+
746
+ // context
747
+ pushed: function() {
748
+ $context.removeClass(className.pushed);
749
+ },
750
+ pushable: function() {
751
+ $context.removeClass(className.pushable);
752
+ },
753
+
754
+ // flyout
755
+ active: function() {
756
+ $module.removeClass(className.active);
757
+ },
758
+ animating: function() {
759
+ $module.removeClass(className.animating);
760
+ },
761
+ direction: function(direction) {
762
+ direction = direction || module.get.direction();
763
+ $module.removeClass(className[direction]);
764
+ },
765
+ visible: function() {
766
+ $module.removeClass(className.visible);
767
+ },
768
+ overlay: function() {
769
+ $module.removeClass(className.overlay);
770
+ }
771
+ },
772
+
773
+ get: {
774
+
775
+ direction: function() {
776
+ if($module.hasClass(className.top)) {
777
+ return className.top;
778
+ }
779
+ else if($module.hasClass(className.right)) {
780
+ return className.right;
781
+ }
782
+ else if($module.hasClass(className.bottom)) {
783
+ return className.bottom;
784
+ }
785
+ return className.left;
786
+ },
787
+ transitionEvent: function() {
788
+ var
789
+ element = document.createElement('element'),
790
+ transitions = {
791
+ 'transition' :'transitionend',
792
+ 'OTransition' :'oTransitionEnd',
793
+ 'MozTransition' :'transitionend',
794
+ 'WebkitTransition' :'webkitTransitionEnd'
795
+ },
796
+ transition
797
+ ;
798
+ for(transition in transitions){
799
+ if( element.style[transition] !== undefined ){
800
+ return transitions[transition];
801
+ }
802
+ }
803
+ },
804
+ settings: function() {
805
+ return settings;
806
+ }
807
+ },
808
+
809
+ can: {
810
+ leftBodyScrollbar: function () {
811
+ if (module.cache.leftBodyScrollbar === undefined) {
812
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
813
+ }
814
+ return module.cache.leftBodyScrollbar;
815
+ }
816
+ },
817
+
818
+ save: {
819
+ bodyMargin: function() {
820
+ initialBodyMargin = $context.css((isBody ? 'margin-':'padding-')+(module.can.leftBodyScrollbar() ? 'left':'right'));
821
+ var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
822
+ bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
823
+ tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
824
+ }
825
+ },
826
+
827
+ is: {
828
+ safari: function() {
829
+ if(module.cache.isSafari === undefined) {
830
+ module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
831
+ }
832
+ return module.cache.isSafari;
833
+ },
834
+ edge: function(){
835
+ if(module.cache.isEdge === undefined) {
836
+ module.cache.isEdge = !!window.setImmediate && !module.is.ie();
837
+ }
838
+ return module.cache.isEdge;
839
+ },
840
+ firefox: function(){
841
+ if(module.cache.isFirefox === undefined) {
842
+ module.cache.isFirefox = !!window.InstallTrigger;
843
+ }
844
+ return module.cache.isFirefox;
845
+ },
846
+ iframe: function() {
847
+ return !(self === top);
848
+ },
849
+ ie: function() {
850
+ if(module.cache.isIE === undefined) {
851
+ var
852
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
853
+ isIE = ('ActiveXObject' in window)
854
+ ;
855
+ module.cache.isIE = (isIE11 || isIE);
856
+ }
857
+ return module.cache.isIE;
858
+ },
859
+ ios: function() {
860
+ var
861
+ userAgent = navigator.userAgent,
862
+ isIOS = userAgent.match(regExp.ios),
863
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
864
+ ;
865
+ if(isIOS && !isMobileChrome) {
866
+ module.verbose('Browser was found to be iOS', userAgent);
867
+ return true;
868
+ }
869
+ else {
870
+ return false;
871
+ }
872
+ },
873
+ mobile: function() {
874
+ var
875
+ userAgent = navigator.userAgent,
876
+ isMobile = userAgent.match(regExp.mobile)
877
+ ;
878
+ if(isMobile) {
879
+ module.verbose('Browser was found to be mobile', userAgent);
880
+ return true;
881
+ }
882
+ else {
883
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
884
+ return false;
885
+ }
886
+ },
887
+ hidden: function() {
888
+ return !module.is.visible();
889
+ },
890
+ visible: function() {
891
+ return $module.hasClass(className.visible);
892
+ },
893
+ animating: function() {
894
+ return $context.hasClass(className.animating);
895
+ },
896
+ rtl: function () {
897
+ if(module.cache.isRTL === undefined) {
898
+ module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
899
+ }
900
+ return module.cache.isRTL;
901
+ }
902
+ },
903
+
904
+ has: {
905
+ configActions: function () {
906
+ return Array.isArray(settings.actions) && settings.actions.length > 0;
907
+ },
908
+ scrollbar: function() {
909
+ return isBody || $context.css('overflow-y') !== 'hidden';
910
+ }
911
+ },
912
+
913
+ restore: {
914
+ bodyMargin: function() {
915
+ var position = module.can.leftBodyScrollbar() ? 'left':'right';
916
+ $context.css((isBody ? 'margin-':'padding-')+position, initialBodyMargin);
917
+ $context.find(selector.bodyFixed.replace('right',position)).each(function(){
918
+ var el = $(this),
919
+ attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
920
+ ;
921
+ el.css(attribute, '');
922
+ });
923
+ }
924
+ },
925
+
926
+ helpers: {
927
+ deQuote: function(string) {
928
+ return String(string).replace(/"/g,"");
929
+ },
930
+ escape: function(string, preserveHTML) {
931
+ if (preserveHTML){
932
+ return string;
933
+ }
934
+ var
935
+ badChars = /[<>"'`]/g,
936
+ shouldEscape = /[&<>"'`]/,
937
+ escape = {
938
+ "<": "&lt;",
939
+ ">": "&gt;",
940
+ '"': "&quot;",
941
+ "'": "&#x27;",
942
+ "`": "&#x60;"
943
+ },
944
+ escapedChar = function(chr) {
945
+ return escape[chr];
946
+ }
947
+ ;
948
+ if(shouldEscape.test(string)) {
949
+ string = string.replace(/&(?![a-z0-9#]{1,6};)/, "&amp;");
950
+ return string.replace(badChars, escapedChar);
951
+ }
952
+ return string;
953
+ }
954
+ },
955
+
956
+ setting: function(name, value) {
957
+ module.debug('Changing setting', name, value);
958
+ if( $.isPlainObject(name) ) {
959
+ $.extend(true, settings, name);
960
+ }
961
+ else if(value !== undefined) {
962
+ if($.isPlainObject(settings[name])) {
963
+ $.extend(true, settings[name], value);
964
+ }
965
+ else {
966
+ settings[name] = value;
967
+ }
968
+ }
969
+ else {
970
+ return settings[name];
971
+ }
972
+ },
973
+ internal: function(name, value) {
974
+ if( $.isPlainObject(name) ) {
975
+ $.extend(true, module, name);
976
+ }
977
+ else if(value !== undefined) {
978
+ module[name] = value;
979
+ }
980
+ else {
981
+ return module[name];
982
+ }
983
+ },
984
+ debug: function() {
985
+ if(!settings.silent && settings.debug) {
986
+ if(settings.performance) {
987
+ module.performance.log(arguments);
988
+ }
989
+ else {
990
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
991
+ module.debug.apply(console, arguments);
992
+ }
993
+ }
994
+ },
995
+ verbose: function() {
996
+ if(!settings.silent && settings.verbose && settings.debug) {
997
+ if(settings.performance) {
998
+ module.performance.log(arguments);
999
+ }
1000
+ else {
1001
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1002
+ module.verbose.apply(console, arguments);
1003
+ }
1004
+ }
1005
+ },
1006
+ error: function() {
1007
+ if(!settings.silent) {
1008
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1009
+ module.error.apply(console, arguments);
1010
+ }
1011
+ },
1012
+ performance: {
1013
+ log: function(message) {
1014
+ var
1015
+ currentTime,
1016
+ executionTime,
1017
+ previousTime
1018
+ ;
1019
+ if(settings.performance) {
1020
+ currentTime = new Date().getTime();
1021
+ previousTime = time || currentTime;
1022
+ executionTime = currentTime - previousTime;
1023
+ time = currentTime;
1024
+ performance.push({
1025
+ 'Name' : message[0],
1026
+ 'Arguments' : [].slice.call(message, 1) || '',
1027
+ 'Element' : element,
1028
+ 'Execution Time' : executionTime
1029
+ });
1030
+ }
1031
+ clearTimeout(module.performance.timer);
1032
+ module.performance.timer = setTimeout(module.performance.display, 500);
1033
+ },
1034
+ display: function() {
1035
+ var
1036
+ title = settings.name + ':',
1037
+ totalTime = 0
1038
+ ;
1039
+ time = false;
1040
+ clearTimeout(module.performance.timer);
1041
+ $.each(performance, function(index, data) {
1042
+ totalTime += data['Execution Time'];
1043
+ });
1044
+ title += ' ' + totalTime + 'ms';
1045
+ if(moduleSelector) {
1046
+ title += ' \'' + moduleSelector + '\'';
1047
+ }
1048
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1049
+ console.groupCollapsed(title);
1050
+ if(console.table) {
1051
+ console.table(performance);
1052
+ }
1053
+ else {
1054
+ $.each(performance, function(index, data) {
1055
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
1056
+ });
1057
+ }
1058
+ console.groupEnd();
1059
+ }
1060
+ performance = [];
1061
+ }
1062
+ },
1063
+ invoke: function(query, passedArguments, context) {
1064
+ var
1065
+ object = instance,
1066
+ maxDepth,
1067
+ found,
1068
+ response
1069
+ ;
1070
+ passedArguments = passedArguments || queryArguments;
1071
+ context = element || context;
1072
+ if(typeof query == 'string' && object !== undefined) {
1073
+ query = query.split(/[\. ]/);
1074
+ maxDepth = query.length - 1;
1075
+ $.each(query, function(depth, value) {
1076
+ var camelCaseValue = (depth != maxDepth)
1077
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1078
+ : query
1079
+ ;
1080
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
1081
+ object = object[camelCaseValue];
1082
+ }
1083
+ else if( object[camelCaseValue] !== undefined ) {
1084
+ found = object[camelCaseValue];
1085
+ return false;
1086
+ }
1087
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
1088
+ object = object[value];
1089
+ }
1090
+ else if( object[value] !== undefined ) {
1091
+ found = object[value];
1092
+ return false;
1093
+ }
1094
+ else {
1095
+ module.error(error.method, query);
1096
+ return false;
1097
+ }
1098
+ });
1099
+ }
1100
+ if ( $.isFunction( found ) ) {
1101
+ response = found.apply(context, passedArguments);
1102
+ }
1103
+ else if(found !== undefined) {
1104
+ response = found;
1105
+ }
1106
+ if(Array.isArray(returnedValue)) {
1107
+ returnedValue.push(response);
1108
+ }
1109
+ else if(returnedValue !== undefined) {
1110
+ returnedValue = [returnedValue, response];
1111
+ }
1112
+ else if(response !== undefined) {
1113
+ returnedValue = response;
1114
+ }
1115
+ return found;
1116
+ }
1117
+ }
1118
+ ;
1119
+
1120
+ if(methodInvoked) {
1121
+ if(instance === undefined) {
1122
+ if ($.isFunction(settings.templates[query])) {
1123
+ settings.autoShow = true;
1124
+ settings.className.flyout = settings.className.template;
1125
+ settings = $.extend(true, {}, settings, settings.templates[query].apply(module ,queryArguments));
1126
+
1127
+ // reassign shortcuts
1128
+ className = settings.className;
1129
+ namespace = settings.namespace;
1130
+ fields = settings.fields;
1131
+ error = settings.error;
1132
+ }
1133
+ module.initialize();
1134
+ }
1135
+ if (!$.isFunction(settings.templates[query])) {
1136
+ module.invoke(query);
1137
+ }
1138
+ }
1139
+ else {
1140
+ if(instance !== undefined) {
1141
+ instance.invoke('destroy');
1142
+ }
1143
+ module.initialize();
1144
+ returnedValue = $module;
1145
+ }
1146
+ });
1147
+
1148
+ return (returnedValue !== undefined)
1149
+ ? returnedValue
1150
+ : this
1151
+ ;
1152
+ };
1153
+
1154
+ $.fn.flyout.settings = {
1155
+
1156
+ name : 'Flyout',
1157
+ namespace : 'flyout',
1158
+
1159
+ silent : false,
1160
+ debug : false,
1161
+ verbose : false,
1162
+ performance : true,
1163
+
1164
+ context : 'body',
1165
+ exclusive : false,
1166
+ closable : true,
1167
+ dimPage : true,
1168
+ scrollLock : false,
1169
+ returnScroll : false,
1170
+ delaySetup : false,
1171
+ autoShow : false,
1172
+
1173
+ //dynamic content
1174
+ title : '',
1175
+ content : '',
1176
+ class : '',
1177
+ classTitle : '',
1178
+ classContent : '',
1179
+ classActions : '',
1180
+ closeIcon : false,
1181
+ actions : false,
1182
+ preserveHTML : true,
1183
+
1184
+ fields : {
1185
+ class : 'class',
1186
+ text : 'text',
1187
+ icon : 'icon',
1188
+ click : 'click'
1189
+ },
1190
+
1191
+ onChange : function(){},
1192
+ onShow : function(){},
1193
+ onHide : function(){ return true; },
1194
+
1195
+ onHidden : false,
1196
+ onVisible : function(){},
1197
+
1198
+ onApprove : function(){},
1199
+ onDeny : function(){},
1200
+
1201
+ className : {
1202
+ flyout : 'ui flyout',
1203
+ close : 'close icon',
1204
+ header : 'ui header',
1205
+ content : 'content',
1206
+ actions : 'actions',
1207
+ active : 'active',
1208
+ animating : 'animating',
1209
+ dimmed : 'dimmed',
1210
+ ios : 'ios',
1211
+ locked : 'locked',
1212
+ pushable : 'pushable',
1213
+ pushed : 'pushed',
1214
+ right : 'right',
1215
+ top : 'top',
1216
+ left : 'left',
1217
+ bottom : 'bottom',
1218
+ visible : 'visible',
1219
+ overlay : 'overlay',
1220
+ fullscreen : 'fullscreen',
1221
+ template : 'ui flyout',
1222
+ button : 'ui button',
1223
+ ok : 'positive',
1224
+ cancel : 'negative',
1225
+ prompt : 'ui fluid input'
1226
+ },
1227
+
1228
+ selector: {
1229
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.right.flyout, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1230
+ fixed : '.fixed',
1231
+ omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1232
+ pusher : '.pusher',
1233
+ flyout : '.ui.flyout',
1234
+ header : '.ui.header',
1235
+ content : '.content',
1236
+ actions : '.actions',
1237
+ close : '.close',
1238
+ approve : '.actions .positive, .actions .approve, .actions .ok',
1239
+ deny : '.actions .negative, .actions .deny, .actions .cancel'
1240
+ },
1241
+
1242
+ regExp: {
1243
+ ios : /(iPad|iPhone|iPod)/g,
1244
+ mobileChrome : /(CriOS)/g,
1245
+ mobile : /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
1246
+ },
1247
+
1248
+ error : {
1249
+ method : 'The method you called is not defined.',
1250
+ pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1251
+ movedFlyout : 'Had to move flyout. For optimal performance make sure flyout and pusher are direct children of your body tag',
1252
+ notFound : 'There were no elements that matched the specified selector'
1253
+ },
1254
+
1255
+ text: {
1256
+ ok : 'Ok',
1257
+ cancel : 'Cancel'
1258
+ }
1259
+ };
1260
+
1261
+ $.fn.flyout.settings.templates = {
1262
+ getArguments: function(args) {
1263
+ var queryArguments = [].slice.call(args);
1264
+ if($.isPlainObject(queryArguments[0])){
1265
+ return $.extend({
1266
+ handler:function(){},
1267
+ content:'',
1268
+ title: ''
1269
+ }, queryArguments[0]);
1270
+ } else {
1271
+ if(!$.isFunction(queryArguments[queryArguments.length-1])) {
1272
+ queryArguments.push(function() {});
1273
+ }
1274
+ return {
1275
+ handler: queryArguments.pop(),
1276
+ content: queryArguments.pop() || '',
1277
+ title: queryArguments.pop() || ''
1278
+ };
1279
+ }
1280
+ },
1281
+ alert: function () {
1282
+ var
1283
+ settings = this.get.settings(),
1284
+ args = settings.templates.getArguments(arguments)
1285
+ ;
1286
+ return {
1287
+ title : args.title,
1288
+ content: args.content,
1289
+ actions: [{
1290
+ text : settings.text.ok,
1291
+ class: settings.className.ok,
1292
+ click: args.handler
1293
+ }]
1294
+ }
1295
+ },
1296
+ confirm: function () {
1297
+ var
1298
+ settings = this.get.settings(),
1299
+ args = settings.templates.getArguments(arguments)
1300
+ ;
1301
+ return {
1302
+ title : args.title,
1303
+ content: args.content,
1304
+ actions: [{
1305
+ text : settings.text.ok,
1306
+ class: settings.className.ok,
1307
+ click: function(){args.handler(true)}
1308
+ },{
1309
+ text: settings.text.cancel,
1310
+ class: settings.className.cancel,
1311
+ click: function(){args.handler(false)}
1312
+ }]
1313
+ }
1314
+ },
1315
+ prompt: function () {
1316
+ var
1317
+ $this = this,
1318
+ settings = this.get.settings(),
1319
+ args = settings.templates.getArguments(arguments),
1320
+ input = $($.parseHTML(args.content)).filter('.ui.input')
1321
+ ;
1322
+ if (input.length === 0) {
1323
+ args.content += '<p><div class="'+settings.className.prompt+'"><input placeholder="'+this.helpers.deQuote(args.placeholder || '')+'" type="text" value="'+this.helpers.deQuote(args.defaultValue || '')+'"></div></p>';
1324
+ }
1325
+ return {
1326
+ title : args.title,
1327
+ content: args.content,
1328
+ actions: [{
1329
+ text: settings.text.ok,
1330
+ class: settings.className.ok,
1331
+ click: function(){
1332
+ var settings = $this.get.settings(),
1333
+ inputField = $this.get.element().find(settings.selector.prompt)[0]
1334
+ ;
1335
+ args.handler($(inputField).val());
1336
+ }
1337
+ },{
1338
+ text: settings.text.cancel,
1339
+ class: settings.className.cancel,
1340
+ click: function(){args.handler(null)}
1341
+ }]
1342
+ }
1343
+ }
1344
+ };
1345
+
1346
+ })( jQuery, window, document );