fomantic-ui-sass 2.9.1 → 2.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +4 -8
- data/app/assets/javascripts/semantic-ui/api.js +22 -15
- data/app/assets/javascripts/semantic-ui/calendar.js +1 -6
- data/app/assets/javascripts/semantic-ui/checkbox.js +4 -6
- data/app/assets/javascripts/semantic-ui/dimmer.js +3 -7
- data/app/assets/javascripts/semantic-ui/dropdown.js +58 -35
- data/app/assets/javascripts/semantic-ui/embed.js +2 -7
- data/app/assets/javascripts/semantic-ui/flyout.js +56 -86
- data/app/assets/javascripts/semantic-ui/form.js +216 -157
- data/app/assets/javascripts/semantic-ui/modal.js +58 -39
- data/app/assets/javascripts/semantic-ui/nag.js +17 -9
- data/app/assets/javascripts/semantic-ui/popup.js +46 -26
- data/app/assets/javascripts/semantic-ui/progress.js +3 -34
- data/app/assets/javascripts/semantic-ui/rating.js +1 -5
- data/app/assets/javascripts/semantic-ui/search.js +5 -8
- data/app/assets/javascripts/semantic-ui/shape.js +15 -41
- data/app/assets/javascripts/semantic-ui/sidebar.js +21 -64
- data/app/assets/javascripts/semantic-ui/site.js +1 -1
- data/app/assets/javascripts/semantic-ui/slider.js +130 -34
- data/app/assets/javascripts/semantic-ui/state.js +23 -20
- data/app/assets/javascripts/semantic-ui/sticky.js +17 -16
- data/app/assets/javascripts/semantic-ui/tab.js +18 -8
- data/app/assets/javascripts/semantic-ui/toast.js +19 -11
- data/app/assets/javascripts/semantic-ui/transition.js +11 -66
- data/app/assets/javascripts/semantic-ui/visibility.js +15 -6
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +118 -56
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +113 -107
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +39 -9
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +66 -2
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +62 -1
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +698 -250
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +3 -2
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +62 -62
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +61 -51
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +21 -2
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +13 -13
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +282 -282
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +186 -37
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +4 -4
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -10
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +145 -8
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +89 -45
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +126 -31
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +10 -3
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +188 -42
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +26 -1
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +9 -6
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +6 -1
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +6 -1
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +486 -5
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +7 -2
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
- data/lib/fomantic/ui/sass/version.rb +2 -2
- metadata +1 -1
@@ -26,15 +26,25 @@
|
|
26
26
|
$document = $(document),
|
27
27
|
$body = $('body'),
|
28
28
|
|
29
|
-
moduleSelector = $allModules.selector || '',
|
30
|
-
|
31
29
|
time = Date.now(),
|
32
30
|
performance = [],
|
33
31
|
|
34
32
|
query = arguments[0],
|
35
33
|
methodInvoked = typeof query === 'string',
|
36
34
|
queryArguments = [].slice.call(arguments, 1),
|
35
|
+
contextCheck = function (context, win) {
|
36
|
+
var $context;
|
37
|
+
if ([window, document].indexOf(context) >= 0) {
|
38
|
+
$context = $body;
|
39
|
+
} else {
|
40
|
+
$context = $(win.document).find(context);
|
41
|
+
if ($context.length === 0) {
|
42
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
43
|
+
}
|
44
|
+
}
|
37
45
|
|
46
|
+
return $context;
|
47
|
+
},
|
38
48
|
returnedValue
|
39
49
|
;
|
40
50
|
|
@@ -54,7 +64,7 @@
|
|
54
64
|
moduleNamespace = 'module-' + namespace,
|
55
65
|
|
56
66
|
$module = $(this),
|
57
|
-
$context =
|
67
|
+
$context = contextCheck(settings.context, window),
|
58
68
|
isBody = $context[0] === $body[0],
|
59
69
|
$closeIcon = $module.find(selector.closeIcon),
|
60
70
|
$inputs,
|
@@ -78,10 +88,12 @@
|
|
78
88
|
tempBodyMargin = '',
|
79
89
|
keepScrollingClass = false,
|
80
90
|
hadScrollbar = false,
|
91
|
+
windowRefocused = false,
|
81
92
|
|
82
93
|
elementEventNamespace,
|
83
94
|
id,
|
84
95
|
observer,
|
96
|
+
observeAttributes = false,
|
85
97
|
module
|
86
98
|
;
|
87
99
|
module = {
|
@@ -240,6 +252,7 @@
|
|
240
252
|
.off(eventNamespace)
|
241
253
|
;
|
242
254
|
$window.off(elementEventNamespace);
|
255
|
+
$context.off(elementEventNamespace);
|
243
256
|
$dimmer.off(elementEventNamespace);
|
244
257
|
$closeIcon.off(elementEventNamespace);
|
245
258
|
if ($inputs) {
|
@@ -261,11 +274,12 @@
|
|
261
274
|
return nodes;
|
262
275
|
},
|
263
276
|
shouldRefresh = false,
|
264
|
-
shouldRefreshInputs = false
|
277
|
+
shouldRefreshInputs = false,
|
278
|
+
ignoreAutofocus = true
|
265
279
|
;
|
266
280
|
mutations.every(function (mutation) {
|
267
281
|
if (mutation.type === 'attributes') {
|
268
|
-
if (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input')) {
|
282
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
269
283
|
shouldRefreshInputs = true;
|
270
284
|
}
|
271
285
|
} else {
|
@@ -276,6 +290,9 @@
|
|
276
290
|
$removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
277
291
|
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
278
292
|
shouldRefreshInputs = true;
|
293
|
+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
294
|
+
ignoreAutofocus = false;
|
295
|
+
}
|
279
296
|
}
|
280
297
|
}
|
281
298
|
|
@@ -287,7 +304,7 @@
|
|
287
304
|
module.refresh();
|
288
305
|
}
|
289
306
|
if (shouldRefreshInputs) {
|
290
|
-
module.refreshInputs();
|
307
|
+
module.refreshInputs(ignoreAutofocus);
|
291
308
|
}
|
292
309
|
});
|
293
310
|
observer.observe(element, {
|
@@ -315,7 +332,7 @@
|
|
315
332
|
$allModals = $otherModals.add($module);
|
316
333
|
},
|
317
334
|
|
318
|
-
refreshInputs: function () {
|
335
|
+
refreshInputs: function (ignoreAutofocus) {
|
319
336
|
if ($inputs) {
|
320
337
|
$inputs
|
321
338
|
.off('keydown' + elementEventNamespace)
|
@@ -324,10 +341,11 @@
|
|
324
341
|
$inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
|
325
342
|
return $(this).closest('.disabled').length === 0;
|
326
343
|
});
|
327
|
-
$
|
328
|
-
|
329
|
-
$inputs = $module;
|
344
|
+
if ($inputs.filter(':input').length === 0) {
|
345
|
+
$inputs = $module.add($inputs);
|
330
346
|
$module.attr('tabindex', -1);
|
347
|
+
} else {
|
348
|
+
$module.removeAttr('tabindex');
|
331
349
|
}
|
332
350
|
$inputs.first()
|
333
351
|
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
|
@@ -335,7 +353,7 @@
|
|
335
353
|
$inputs.last()
|
336
354
|
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
|
337
355
|
;
|
338
|
-
if (settings.autofocus && $inputs.filter(':focus').length === 0) {
|
356
|
+
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
339
357
|
module.set.autofocus();
|
340
358
|
}
|
341
359
|
},
|
@@ -373,6 +391,9 @@
|
|
373
391
|
.on('resize' + elementEventNamespace, module.event.resize)
|
374
392
|
.on('focus' + elementEventNamespace, module.event.focus)
|
375
393
|
;
|
394
|
+
$context
|
395
|
+
.on('click' + elementEventNamespace, module.event.click)
|
396
|
+
;
|
376
397
|
},
|
377
398
|
scrollLock: function () {
|
378
399
|
// touch events default to passive, due to changes in chrome to optimize mobile perf
|
@@ -506,7 +527,7 @@
|
|
506
527
|
},
|
507
528
|
debounce: function (method, delay) {
|
508
529
|
clearTimeout(module.timer);
|
509
|
-
module.timer = setTimeout(method, delay);
|
530
|
+
module.timer = setTimeout(function () { method(); }, delay);
|
510
531
|
},
|
511
532
|
keyboard: function (event) {
|
512
533
|
var
|
@@ -530,9 +551,13 @@
|
|
530
551
|
}
|
531
552
|
},
|
532
553
|
focus: function () {
|
533
|
-
|
554
|
+
windowRefocused = true;
|
555
|
+
},
|
556
|
+
click: function (event) {
|
557
|
+
if (windowRefocused && document.activeElement !== event.target && $dimmable.dimmer('is active') && module.is.active() && settings.autofocus && $(document.activeElement).closest(selector.modal).length === 0) {
|
534
558
|
requestAnimationFrame(module.set.autofocus);
|
535
559
|
}
|
560
|
+
windowRefocused = false;
|
536
561
|
},
|
537
562
|
},
|
538
563
|
|
@@ -597,15 +622,16 @@
|
|
597
622
|
ignoreRepeatedEvents = false;
|
598
623
|
if (settings.allowMultiple) {
|
599
624
|
if (module.others.active()) {
|
600
|
-
$otherModals.filter('.' + className.active).find(selector.dimmer).addClass('active');
|
625
|
+
$otherModals.filter('.' + className.active).find(selector.dimmer).removeClass('out').addClass('transition fade in active');
|
601
626
|
}
|
602
627
|
|
603
628
|
if (settings.detachable) {
|
604
629
|
$module.detach().appendTo($dimmer);
|
605
630
|
}
|
606
631
|
}
|
607
|
-
if (settings.transition && $.fn.transition !== undefined
|
632
|
+
if (settings.transition && $.fn.transition !== undefined) {
|
608
633
|
module.debug('Showing modal with css animations');
|
634
|
+
module.set.observeAttributes(false);
|
609
635
|
$module
|
610
636
|
.transition({
|
611
637
|
debug: settings.debug,
|
@@ -623,6 +649,7 @@
|
|
623
649
|
module.save.focus();
|
624
650
|
module.set.active();
|
625
651
|
module.refreshInputs();
|
652
|
+
requestAnimationFrame(module.set.observeAttributes);
|
626
653
|
callback();
|
627
654
|
},
|
628
655
|
})
|
@@ -652,8 +679,9 @@
|
|
652
679
|
|
653
680
|
if (module.is.animating() || module.is.active()) {
|
654
681
|
module.debug('Hiding modal');
|
655
|
-
if (settings.transition && $.fn.transition !== undefined
|
682
|
+
if (settings.transition && $.fn.transition !== undefined) {
|
656
683
|
module.remove.active();
|
684
|
+
module.set.observeAttributes(false);
|
657
685
|
$module
|
658
686
|
.transition({
|
659
687
|
debug: settings.debug,
|
@@ -666,6 +694,8 @@
|
|
666
694
|
onStart: function () {
|
667
695
|
if (!module.others.active() && !module.others.animating() && !keepDimmed) {
|
668
696
|
module.hideDimmer();
|
697
|
+
} else if (settings.allowMultiple) {
|
698
|
+
(hideOthersToo ? $allModals : $previousModal).find(selector.dimmer).removeClass('in').addClass('out');
|
669
699
|
}
|
670
700
|
if (settings.keyboardShortcuts && !module.others.active()) {
|
671
701
|
module.remove.keyboardShortcuts();
|
@@ -673,15 +703,12 @@
|
|
673
703
|
},
|
674
704
|
onComplete: function () {
|
675
705
|
module.unbind.scrollLock();
|
706
|
+
module.remove.active();
|
676
707
|
if (settings.allowMultiple) {
|
677
708
|
$previousModal.addClass(className.front);
|
678
709
|
$module.removeClass(className.front);
|
679
710
|
|
680
|
-
|
681
|
-
$allModals.find(selector.dimmer).removeClass('active');
|
682
|
-
} else {
|
683
|
-
$previousModal.find(selector.dimmer).removeClass('active');
|
684
|
-
}
|
711
|
+
(hideOthersToo ? $allModals : $previousModal).find(selector.dimmer).removeClass('active');
|
685
712
|
}
|
686
713
|
if (isFunction(settings.onHidden)) {
|
687
714
|
settings.onHidden.call(element);
|
@@ -988,9 +1015,7 @@
|
|
988
1015
|
return module.cache.isIE;
|
989
1016
|
},
|
990
1017
|
animating: function () {
|
991
|
-
return $module.transition('is
|
992
|
-
? $module.transition('is animating')
|
993
|
-
: $module.is(':visible');
|
1018
|
+
return $module.transition('is animating');
|
994
1019
|
},
|
995
1020
|
scrolling: function () {
|
996
1021
|
return $dimmable.hasClass(className.scrolling);
|
@@ -1033,24 +1058,21 @@
|
|
1033
1058
|
},
|
1034
1059
|
|
1035
1060
|
set: {
|
1061
|
+
observeAttributes: function (state) {
|
1062
|
+
observeAttributes = state !== false;
|
1063
|
+
},
|
1036
1064
|
autofocus: function () {
|
1037
1065
|
var
|
1038
1066
|
$autofocus = $inputs.filter('[autofocus]'),
|
1039
1067
|
$rawInputs = $inputs.filter(':input'),
|
1040
|
-
$input = $autofocus.length > 0
|
1041
|
-
? $autofocus
|
1068
|
+
$input = ($autofocus.length > 0
|
1069
|
+
? $autofocus
|
1042
1070
|
: ($rawInputs.length > 0
|
1043
1071
|
? $rawInputs
|
1044
|
-
: $
|
1045
|
-
|
1072
|
+
: $module)
|
1073
|
+
).first()
|
1046
1074
|
;
|
1047
|
-
|
1048
|
-
if ($input.length === 0 && $inputs.length > 0) {
|
1049
|
-
$input = $inputs.first();
|
1050
|
-
}
|
1051
|
-
if ($input.length > 0) {
|
1052
|
-
$input.trigger('focus');
|
1053
|
-
}
|
1075
|
+
$input.trigger('focus');
|
1054
1076
|
},
|
1055
1077
|
bodyMargin: function () {
|
1056
1078
|
var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
@@ -1251,7 +1273,7 @@
|
|
1251
1273
|
});
|
1252
1274
|
}
|
1253
1275
|
clearTimeout(module.performance.timer);
|
1254
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
1276
|
+
module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
|
1255
1277
|
},
|
1256
1278
|
display: function () {
|
1257
1279
|
var
|
@@ -1264,9 +1286,6 @@
|
|
1264
1286
|
totalTime += data['Execution Time'];
|
1265
1287
|
});
|
1266
1288
|
title += ' ' + totalTime + 'ms';
|
1267
|
-
if (moduleSelector) {
|
1268
|
-
title += ' \'' + moduleSelector + '\'';
|
1269
|
-
}
|
1270
1289
|
if (performance.length > 0) {
|
1271
1290
|
console.groupCollapsed(title);
|
1272
1291
|
if (console.table) {
|
@@ -22,7 +22,7 @@
|
|
22
22
|
$.fn.nag = function (parameters) {
|
23
23
|
var
|
24
24
|
$allModules = $(this),
|
25
|
-
|
25
|
+
$body = $('body'),
|
26
26
|
|
27
27
|
time = Date.now(),
|
28
28
|
performance = [],
|
@@ -30,6 +30,19 @@
|
|
30
30
|
query = arguments[0],
|
31
31
|
methodInvoked = typeof query === 'string',
|
32
32
|
queryArguments = [].slice.call(arguments, 1),
|
33
|
+
contextCheck = function (context, win) {
|
34
|
+
var $context;
|
35
|
+
if ([window, document].indexOf(context) >= 0) {
|
36
|
+
$context = $(context);
|
37
|
+
} else {
|
38
|
+
$context = $(win.document).find(context);
|
39
|
+
if ($context.length === 0) {
|
40
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
return $context;
|
45
|
+
},
|
33
46
|
returnedValue
|
34
47
|
;
|
35
48
|
$allModules.each(function () {
|
@@ -47,9 +60,7 @@
|
|
47
60
|
|
48
61
|
$module = $(this),
|
49
62
|
|
50
|
-
$context = settings.context
|
51
|
-
? ([window, document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
|
52
|
-
: $('body'),
|
63
|
+
$context = settings.context ? contextCheck(settings.context, window) : $body,
|
53
64
|
|
54
65
|
element = this,
|
55
66
|
instance = $module.data(moduleNamespace),
|
@@ -77,7 +88,7 @@
|
|
77
88
|
}
|
78
89
|
|
79
90
|
if (settings.displayTime > 0) {
|
80
|
-
setTimeout(module.hide, settings.displayTime);
|
91
|
+
setTimeout(function () { module.hide(); }, settings.displayTime);
|
81
92
|
}
|
82
93
|
module.show();
|
83
94
|
},
|
@@ -366,7 +377,7 @@
|
|
366
377
|
});
|
367
378
|
}
|
368
379
|
clearTimeout(module.performance.timer);
|
369
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
380
|
+
module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
|
370
381
|
},
|
371
382
|
display: function () {
|
372
383
|
var
|
@@ -379,9 +390,6 @@
|
|
379
390
|
totalTime += data['Execution Time'];
|
380
391
|
});
|
381
392
|
title += ' ' + totalTime + 'ms';
|
382
|
-
if (moduleSelector) {
|
383
|
-
title += ' \'' + moduleSelector + '\'';
|
384
|
-
}
|
385
393
|
if (performance.length > 0) {
|
386
394
|
console.groupCollapsed(title);
|
387
395
|
if (console.table) {
|
@@ -26,8 +26,6 @@
|
|
26
26
|
$window = $(window),
|
27
27
|
$body = $('body'),
|
28
28
|
|
29
|
-
moduleSelector = $allModules.selector || '',
|
30
|
-
|
31
29
|
clickEvent = 'ontouchstart' in document.documentElement
|
32
30
|
? 'touchstart'
|
33
31
|
: 'click',
|
@@ -38,6 +36,19 @@
|
|
38
36
|
query = arguments[0],
|
39
37
|
methodInvoked = typeof query === 'string',
|
40
38
|
queryArguments = [].slice.call(arguments, 1),
|
39
|
+
contextCheck = function (context, win) {
|
40
|
+
var $context;
|
41
|
+
if ([window, document].indexOf(context) >= 0) {
|
42
|
+
$context = $(context);
|
43
|
+
} else {
|
44
|
+
$context = $(win.document).find(context);
|
45
|
+
if ($context.length === 0) {
|
46
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
return $context;
|
51
|
+
},
|
41
52
|
|
42
53
|
returnedValue
|
43
54
|
;
|
@@ -57,12 +68,10 @@
|
|
57
68
|
moduleNamespace = 'module-' + namespace,
|
58
69
|
|
59
70
|
$module = $(this),
|
60
|
-
$context =
|
61
|
-
$scrollContext =
|
62
|
-
$boundary =
|
63
|
-
$target = settings.target
|
64
|
-
? ([window, document].indexOf(settings.target) < 0 ? $document.find(settings.target) : $(settings.target))
|
65
|
-
: $module,
|
71
|
+
$context = contextCheck(settings.context, window),
|
72
|
+
$scrollContext = contextCheck(settings.scrollContext, window),
|
73
|
+
$boundary = contextCheck(settings.boundary, window),
|
74
|
+
$target = settings.target ? contextCheck(settings.target, window) : $module,
|
66
75
|
|
67
76
|
$popup,
|
68
77
|
$offsetParent,
|
@@ -125,9 +134,9 @@
|
|
125
134
|
}
|
126
135
|
}
|
127
136
|
if (settings.popup) {
|
128
|
-
|
137
|
+
module.set.invisible();
|
129
138
|
$offsetParent = module.get.offsetParent();
|
130
|
-
|
139
|
+
module.remove.invisible();
|
131
140
|
if (settings.movePopup && module.has.popup() && module.get.offsetParent($popup)[0] !== $offsetParent[0]) {
|
132
141
|
module.debug('Moving popup to the same offset parent as target');
|
133
142
|
$popup
|
@@ -185,7 +194,7 @@
|
|
185
194
|
;
|
186
195
|
clearTimeout(module.hideTimer);
|
187
196
|
if (!openedWithTouch || (openedWithTouch && settings.addTouchEvents)) {
|
188
|
-
module.showTimer = setTimeout(module.show, delay);
|
197
|
+
module.showTimer = setTimeout(function () { module.show(); }, delay);
|
189
198
|
}
|
190
199
|
},
|
191
200
|
end: function () {
|
@@ -195,7 +204,7 @@
|
|
195
204
|
: settings.delay
|
196
205
|
;
|
197
206
|
clearTimeout(module.showTimer);
|
198
|
-
module.hideTimer = setTimeout(module.hide, delay);
|
207
|
+
module.hideTimer = setTimeout(function () { module.hide(); }, delay);
|
199
208
|
},
|
200
209
|
touchstart: function (event) {
|
201
210
|
openedWithTouch = true;
|
@@ -239,9 +248,11 @@
|
|
239
248
|
// generates popup html from metadata
|
240
249
|
create: function () {
|
241
250
|
var
|
251
|
+
targetSibling = $target.next(selector.popup),
|
252
|
+
contentFallback = !settings.popup && targetSibling.length === 0 ? $module.attr('title') : false,
|
242
253
|
html = module.get.html(),
|
243
254
|
title = module.get.title(),
|
244
|
-
content = module.get.content()
|
255
|
+
content = module.get.content(contentFallback)
|
245
256
|
;
|
246
257
|
|
247
258
|
if (html || content || title) {
|
@@ -282,10 +293,10 @@
|
|
282
293
|
if (settings.hoverable) {
|
283
294
|
module.bind.popup();
|
284
295
|
}
|
285
|
-
} else if (
|
296
|
+
} else if (targetSibling.length > 0) {
|
286
297
|
module.verbose('Pre-existing popup found');
|
287
298
|
settings.inline = true;
|
288
|
-
settings.popup =
|
299
|
+
settings.popup = targetSibling.data(metadata.activator, $module);
|
289
300
|
module.refresh();
|
290
301
|
if (settings.hoverable) {
|
291
302
|
module.bind.popup();
|
@@ -414,7 +425,7 @@
|
|
414
425
|
animate: {
|
415
426
|
show: function (callback) {
|
416
427
|
callback = isFunction(callback) ? callback : function () {};
|
417
|
-
if (settings.transition && module.can.useElement('transition')
|
428
|
+
if (settings.transition && module.can.useElement('transition')) {
|
418
429
|
module.set.visible();
|
419
430
|
$popup
|
420
431
|
.transition({
|
@@ -436,7 +447,7 @@
|
|
436
447
|
hide: function (callback) {
|
437
448
|
callback = isFunction(callback) ? callback : function () {};
|
438
449
|
module.debug('Hiding pop-up');
|
439
|
-
if (settings.transition && $.fn.transition !== undefined
|
450
|
+
if (settings.transition && $.fn.transition !== undefined) {
|
440
451
|
$popup
|
441
452
|
.transition({
|
442
453
|
animation: (settings.transition.hideMethod || settings.transition) + ' out',
|
@@ -475,10 +486,10 @@
|
|
475
486
|
|
476
487
|
return $module.data(metadata.title) || settings.title;
|
477
488
|
},
|
478
|
-
content: function () {
|
489
|
+
content: function (fallback) {
|
479
490
|
$module.removeData(metadata.content);
|
480
491
|
|
481
|
-
return $module.data(metadata.content) || settings.content ||
|
492
|
+
return $module.data(metadata.content) || settings.content || fallback;
|
482
493
|
},
|
483
494
|
variation: function () {
|
484
495
|
$module.removeData(metadata.variation);
|
@@ -901,8 +912,8 @@
|
|
901
912
|
.css(positioning)
|
902
913
|
.removeClass(className.position)
|
903
914
|
.addClass(position)
|
904
|
-
.addClass(className.loading)
|
905
915
|
;
|
916
|
+
module.set.invisible();
|
906
917
|
|
907
918
|
popupOffset = module.get.popupOffset();
|
908
919
|
|
@@ -926,7 +937,7 @@
|
|
926
937
|
module.debug('Popup could not find a position to display', $popup);
|
927
938
|
module.error(error.cannotPlace, element);
|
928
939
|
module.remove.attempts();
|
929
|
-
module.remove.
|
940
|
+
module.remove.invisible();
|
930
941
|
module.reset();
|
931
942
|
settings.onUnplaceable.call($popup, element);
|
932
943
|
|
@@ -935,7 +946,7 @@
|
|
935
946
|
}
|
936
947
|
module.debug('Position is on stage', position);
|
937
948
|
module.remove.attempts();
|
938
|
-
module.remove.
|
949
|
+
module.remove.invisible();
|
939
950
|
if (settings.setFluidWidth && module.is.fluid()) {
|
940
951
|
module.set.fluidWidth(calculations);
|
941
952
|
}
|
@@ -949,6 +960,14 @@
|
|
949
960
|
$popup.css('width', calculations.container.width);
|
950
961
|
},
|
951
962
|
|
963
|
+
loading: function () {
|
964
|
+
$popup.addClass(className.loading);
|
965
|
+
},
|
966
|
+
|
967
|
+
invisible: function () {
|
968
|
+
$popup.addClass(className.invisible);
|
969
|
+
},
|
970
|
+
|
952
971
|
variation: function (variation) {
|
953
972
|
variation = variation || module.get.variation();
|
954
973
|
if (variation && module.has.popup()) {
|
@@ -966,6 +985,9 @@
|
|
966
985
|
loading: function () {
|
967
986
|
$popup.removeClass(className.loading);
|
968
987
|
},
|
988
|
+
invisible: function () {
|
989
|
+
$popup.removeClass(className.invisible);
|
990
|
+
},
|
969
991
|
variation: function (variation) {
|
970
992
|
variation = variation || module.get.variation();
|
971
993
|
if (variation) {
|
@@ -1222,7 +1244,7 @@
|
|
1222
1244
|
});
|
1223
1245
|
}
|
1224
1246
|
clearTimeout(module.performance.timer);
|
1225
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
1247
|
+
module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
|
1226
1248
|
},
|
1227
1249
|
display: function () {
|
1228
1250
|
var
|
@@ -1235,9 +1257,6 @@
|
|
1235
1257
|
totalTime += data['Execution Time'];
|
1236
1258
|
});
|
1237
1259
|
title += ' ' + totalTime + 'ms';
|
1238
|
-
if (moduleSelector) {
|
1239
|
-
title += ' \'' + moduleSelector + '\'';
|
1240
|
-
}
|
1241
1260
|
if (performance.length > 0) {
|
1242
1261
|
console.groupCollapsed(title);
|
1243
1262
|
if (console.table) {
|
@@ -1475,6 +1494,7 @@
|
|
1475
1494
|
basic: 'basic',
|
1476
1495
|
animating: 'animating',
|
1477
1496
|
dropdown: 'dropdown',
|
1497
|
+
invisible: 'invisible',
|
1478
1498
|
fluid: 'fluid',
|
1479
1499
|
loading: 'loading',
|
1480
1500
|
popup: 'ui popup',
|
@@ -23,8 +23,6 @@
|
|
23
23
|
var
|
24
24
|
$allModules = $(this),
|
25
25
|
|
26
|
-
moduleSelector = $allModules.selector || '',
|
27
|
-
|
28
26
|
time = Date.now(),
|
29
27
|
performance = [],
|
30
28
|
|
@@ -59,7 +57,6 @@
|
|
59
57
|
instance = $module.data(moduleNamespace),
|
60
58
|
|
61
59
|
animating = false,
|
62
|
-
transitionEnd,
|
63
60
|
module
|
64
61
|
;
|
65
62
|
module = {
|
@@ -115,7 +112,6 @@
|
|
115
112
|
|
116
113
|
initialize: function () {
|
117
114
|
module.set.duration();
|
118
|
-
module.set.transitionEvent();
|
119
115
|
module.debug(element);
|
120
116
|
|
121
117
|
module.read.metadata();
|
@@ -195,17 +191,14 @@
|
|
195
191
|
|
196
192
|
bind: {
|
197
193
|
transitionEnd: function (callback) {
|
198
|
-
var
|
199
|
-
transitionEnd = module.get.transitionEnd()
|
200
|
-
;
|
201
194
|
$bars
|
202
|
-
.one(
|
195
|
+
.one('transitionend' + eventNamespace, function (event) {
|
203
196
|
clearTimeout(module.failSafeTimer);
|
204
197
|
callback.call(this, event);
|
205
198
|
})
|
206
199
|
;
|
207
200
|
module.failSafeTimer = setTimeout(function () {
|
208
|
-
$bars.triggerHandler(
|
201
|
+
$bars.triggerHandler('transitionend');
|
209
202
|
}, settings.duration + settings.failSafeDelay);
|
210
203
|
module.verbose('Adding fail safe timer', module.timer);
|
211
204
|
},
|
@@ -330,24 +323,6 @@
|
|
330
323
|
: value;
|
331
324
|
},
|
332
325
|
|
333
|
-
transitionEnd: function () {
|
334
|
-
var
|
335
|
-
element = document.createElement('element'),
|
336
|
-
transitions = {
|
337
|
-
transition: 'transitionend',
|
338
|
-
OTransition: 'oTransitionEnd',
|
339
|
-
MozTransition: 'transitionend',
|
340
|
-
WebkitTransition: 'webkitTransitionEnd',
|
341
|
-
},
|
342
|
-
transition
|
343
|
-
;
|
344
|
-
for (transition in transitions) {
|
345
|
-
if (element.style[transition] !== undefined) {
|
346
|
-
return transitions[transition];
|
347
|
-
}
|
348
|
-
}
|
349
|
-
},
|
350
|
-
|
351
326
|
// gets current displayed percentage (if animating values this is the intermediary value)
|
352
327
|
displayPercent: function (index) {
|
353
328
|
var
|
@@ -687,9 +662,6 @@
|
|
687
662
|
settings.onError.call(element, module.value, module.total);
|
688
663
|
});
|
689
664
|
},
|
690
|
-
transitionEvent: function () {
|
691
|
-
transitionEnd = module.get.transitionEnd();
|
692
|
-
},
|
693
665
|
total: function (totalValue) {
|
694
666
|
module.total = totalValue;
|
695
667
|
},
|
@@ -819,7 +791,7 @@
|
|
819
791
|
});
|
820
792
|
}
|
821
793
|
clearTimeout(module.performance.timer);
|
822
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
794
|
+
module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
|
823
795
|
},
|
824
796
|
display: function () {
|
825
797
|
var
|
@@ -832,9 +804,6 @@
|
|
832
804
|
totalTime += data['Execution Time'];
|
833
805
|
});
|
834
806
|
title += ' ' + totalTime + 'ms';
|
835
|
-
if (moduleSelector) {
|
836
|
-
title += ' \'' + moduleSelector + '\'';
|
837
|
-
}
|
838
807
|
if (performance.length > 0) {
|
839
808
|
console.groupCollapsed(title);
|
840
809
|
if (console.table) {
|