fomantic-ui-sass 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +569 -596
- data/app/assets/javascripts/semantic-ui/api.js +1158 -1180
- data/app/assets/javascripts/semantic-ui/calendar.js +1935 -1810
- data/app/assets/javascripts/semantic-ui/checkbox.js +843 -842
- data/app/assets/javascripts/semantic-ui/dimmer.js +707 -738
- data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4237
- data/app/assets/javascripts/semantic-ui/embed.js +646 -676
- data/app/assets/javascripts/semantic-ui/flyout.js +1515 -1466
- data/app/assets/javascripts/semantic-ui/form.js +2023 -2005
- data/app/assets/javascripts/semantic-ui/modal.js +1545 -1487
- data/app/assets/javascripts/semantic-ui/nag.js +521 -527
- data/app/assets/javascripts/semantic-ui/popup.js +1457 -1457
- data/app/assets/javascripts/semantic-ui/progress.js +970 -998
- data/app/assets/javascripts/semantic-ui/rating.js +508 -524
- data/app/assets/javascripts/semantic-ui/search.js +1521 -1535
- data/app/assets/javascripts/semantic-ui/shape.js +784 -811
- data/app/assets/javascripts/semantic-ui/sidebar.js +1062 -1100
- data/app/assets/javascripts/semantic-ui/site.js +437 -477
- data/app/assets/javascripts/semantic-ui/slider.js +1311 -1312
- data/app/assets/javascripts/semantic-ui/state.js +639 -658
- data/app/assets/javascripts/semantic-ui/sticky.js +848 -902
- data/app/assets/javascripts/semantic-ui/tab.js +903 -967
- data/app/assets/javascripts/semantic-ui/toast.js +911 -885
- data/app/assets/javascripts/semantic-ui/transition.js +1049 -1078
- data/app/assets/javascripts/semantic-ui/visibility.js +1214 -1246
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +246 -341
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +185 -331
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +272 -433
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +127 -199
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +549 -776
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +711 -1123
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +9 -8
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +45 -63
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +3556 -3556
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +272 -270
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +120 -144
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +667 -747
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +358 -276
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +361 -412
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +51 -72
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +69 -157
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +24 -44
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +17 -22
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +46 -85
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +150 -226
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +79 -152
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +10 -15
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +30 -43
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +37 -55
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +26 -29
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +122 -193
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +55 -174
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +254 -388
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +20 -31
- data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +97 -143
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +122 -156
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +426 -204
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +83 -124
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +71 -100
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +105 -208
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +93 -121
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +12 -16
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +71 -149
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +36 -47
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +221 -367
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +43 -61
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +37 -59
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +86 -133
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +77 -118
- data/lib/fomantic/ui/sass/version.rb +2 -2
- data/tasks/converter.rb +1 -1
- metadata +17 -1
@@ -1,765 +1,734 @@
|
|
1
1
|
/*!
|
2
2
|
* # Fomantic-UI - Dimmer
|
3
|
-
*
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
6
6
|
* Released under the MIT license
|
7
|
-
*
|
7
|
+
* https://opensource.org/licenses/MIT
|
8
8
|
*
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
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.dimmer = function(parameters) {
|
27
|
-
var
|
28
|
-
$allModules = $(this),
|
29
|
-
|
30
|
-
time = new Date().getTime(),
|
31
|
-
performance = [],
|
32
|
-
|
33
|
-
query = arguments[0],
|
34
|
-
methodInvoked = (typeof query == 'string'),
|
35
|
-
queryArguments = [].slice.call(arguments, 1),
|
36
|
-
|
37
|
-
returnedValue
|
38
|
-
;
|
39
|
-
|
40
|
-
$allModules
|
41
|
-
.each(function() {
|
42
|
-
var
|
43
|
-
settings = ( $.isPlainObject(parameters) )
|
44
|
-
? $.extend(true, {}, $.fn.dimmer.settings, parameters)
|
45
|
-
: $.extend({}, $.fn.dimmer.settings),
|
46
|
-
|
47
|
-
selector = settings.selector,
|
48
|
-
namespace = settings.namespace,
|
49
|
-
className = settings.className,
|
50
|
-
error = settings.error,
|
51
|
-
|
52
|
-
eventNamespace = '.' + namespace,
|
53
|
-
moduleNamespace = 'module-' + namespace,
|
54
|
-
moduleSelector = $allModules.selector || '',
|
55
|
-
|
56
|
-
clickEvent = ('ontouchstart' in document.documentElement)
|
57
|
-
? 'touchstart'
|
58
|
-
: 'click',
|
59
|
-
|
60
|
-
$module = $(this),
|
61
|
-
$dimmer,
|
62
|
-
$dimmable,
|
63
|
-
|
64
|
-
element = this,
|
65
|
-
instance = $module.data(moduleNamespace),
|
66
|
-
module
|
67
|
-
;
|
68
|
-
|
69
|
-
module = {
|
70
|
-
|
71
|
-
preinitialize: function() {
|
72
|
-
if( module.is.dimmer() ) {
|
73
|
-
|
74
|
-
$dimmable = $module.parent();
|
75
|
-
$dimmer = $module;
|
76
|
-
}
|
77
|
-
else {
|
78
|
-
$dimmable = $module;
|
79
|
-
if( module.has.dimmer() ) {
|
80
|
-
if(settings.dimmerName) {
|
81
|
-
$dimmer = $dimmable.find(selector.dimmer).filter('.' + settings.dimmerName);
|
82
|
-
}
|
83
|
-
else {
|
84
|
-
$dimmer = $dimmable.find(selector.dimmer);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
else {
|
88
|
-
$dimmer = module.create();
|
89
|
-
}
|
90
|
-
}
|
91
|
-
},
|
11
|
+
(function ($, window, document) {
|
12
|
+
'use strict';
|
92
13
|
|
93
|
-
|
94
|
-
|
14
|
+
function isFunction(obj) {
|
15
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
|
+
}
|
95
17
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
},
|
18
|
+
window = window !== undefined && window.Math === Math
|
19
|
+
? window
|
20
|
+
: globalThis;
|
100
21
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
$module
|
105
|
-
.data(moduleNamespace, instance)
|
106
|
-
;
|
107
|
-
},
|
22
|
+
$.fn.dimmer = function (parameters) {
|
23
|
+
var
|
24
|
+
$allModules = $(this),
|
108
25
|
|
109
|
-
|
110
|
-
|
111
|
-
module.unbind.events();
|
112
|
-
module.remove.variation();
|
113
|
-
$dimmable
|
114
|
-
.off(eventNamespace)
|
115
|
-
;
|
116
|
-
},
|
26
|
+
time = Date.now(),
|
27
|
+
performance = [],
|
117
28
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
$dimmable
|
122
|
-
.on('mouseenter' + eventNamespace, module.show)
|
123
|
-
.on('mouseleave' + eventNamespace, module.hide)
|
124
|
-
;
|
125
|
-
}
|
126
|
-
else if(settings.on == 'click') {
|
127
|
-
$dimmable
|
128
|
-
.on(clickEvent + eventNamespace, module.toggle)
|
129
|
-
;
|
130
|
-
}
|
131
|
-
if( module.is.page() ) {
|
132
|
-
module.debug('Setting as a page dimmer', $dimmable);
|
133
|
-
module.set.pageDimmer();
|
134
|
-
}
|
29
|
+
query = arguments[0],
|
30
|
+
methodInvoked = typeof query === 'string',
|
31
|
+
queryArguments = [].slice.call(arguments, 1),
|
135
32
|
|
136
|
-
|
137
|
-
|
138
|
-
$dimmable
|
139
|
-
.on(clickEvent + eventNamespace, selector.dimmer, module.event.click)
|
140
|
-
;
|
141
|
-
}
|
142
|
-
}
|
143
|
-
},
|
33
|
+
returnedValue
|
34
|
+
;
|
144
35
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
36
|
+
$allModules.each(function () {
|
37
|
+
var
|
38
|
+
settings = $.isPlainObject(parameters)
|
39
|
+
? $.extend(true, {}, $.fn.dimmer.settings, parameters)
|
40
|
+
: $.extend({}, $.fn.dimmer.settings),
|
41
|
+
|
42
|
+
selector = settings.selector,
|
43
|
+
namespace = settings.namespace,
|
44
|
+
className = settings.className,
|
45
|
+
error = settings.error,
|
46
|
+
|
47
|
+
eventNamespace = '.' + namespace,
|
48
|
+
moduleNamespace = 'module-' + namespace,
|
49
|
+
moduleSelector = $allModules.selector || '',
|
50
|
+
|
51
|
+
clickEvent = 'ontouchstart' in document.documentElement
|
52
|
+
? 'touchstart'
|
53
|
+
: 'click',
|
54
|
+
|
55
|
+
$module = $(this),
|
56
|
+
$dimmer,
|
57
|
+
$dimmable,
|
58
|
+
|
59
|
+
element = this,
|
60
|
+
instance = $module.data(moduleNamespace),
|
61
|
+
module
|
152
62
|
;
|
153
|
-
}
|
154
|
-
},
|
155
|
-
|
156
|
-
event: {
|
157
|
-
click: function(event) {
|
158
|
-
module.verbose('Determining if event occurred on dimmer', event);
|
159
|
-
if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) {
|
160
|
-
module.hide();
|
161
|
-
event.stopImmediatePropagation();
|
162
|
-
}
|
163
|
-
}
|
164
|
-
},
|
165
|
-
|
166
|
-
addContent: function(element) {
|
167
|
-
var
|
168
|
-
$content = $(element)
|
169
|
-
;
|
170
|
-
module.debug('Add content to dimmer', $content);
|
171
|
-
if($content.parent()[0] !== $dimmer[0]) {
|
172
|
-
$content.detach().appendTo($dimmer);
|
173
|
-
}
|
174
|
-
},
|
175
63
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
: function(){}
|
214
|
-
;
|
215
|
-
if( module.is.dimmed() || module.is.animating() ) {
|
216
|
-
if(settings.onHide.call(element) === false) {
|
217
|
-
module.verbose('Hide callback returned false cancelling dimmer hide');
|
218
|
-
return;
|
219
|
-
}
|
220
|
-
module.debug('Hiding dimmer', $dimmer);
|
221
|
-
module.animate.hide(callback);
|
222
|
-
settings.onChange.call(element);
|
223
|
-
}
|
224
|
-
else {
|
225
|
-
module.debug('Dimmer is not visible');
|
226
|
-
}
|
227
|
-
},
|
228
|
-
|
229
|
-
toggle: function() {
|
230
|
-
module.verbose('Toggling dimmer visibility', $dimmer);
|
231
|
-
if( !module.is.dimmed() ) {
|
232
|
-
module.show();
|
233
|
-
}
|
234
|
-
else {
|
235
|
-
if ( module.is.closable() ) {
|
236
|
-
module.hide();
|
237
|
-
}
|
238
|
-
}
|
239
|
-
},
|
240
|
-
|
241
|
-
animate: {
|
242
|
-
show: function(callback) {
|
243
|
-
callback = $.isFunction(callback)
|
244
|
-
? callback
|
245
|
-
: function(){}
|
246
|
-
;
|
247
|
-
if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
|
248
|
-
if(settings.useFlex) {
|
249
|
-
module.debug('Using flex dimmer');
|
250
|
-
module.remove.legacy();
|
251
|
-
}
|
252
|
-
else {
|
253
|
-
module.debug('Using legacy non-flex dimmer');
|
254
|
-
module.set.legacy();
|
255
|
-
}
|
256
|
-
if(settings.opacity !== 'auto') {
|
257
|
-
module.set.opacity();
|
258
|
-
}
|
259
|
-
$dimmer
|
260
|
-
.transition({
|
261
|
-
debug : settings.debug,
|
262
|
-
verbose : settings.verbose,
|
263
|
-
silent : settings.silent,
|
264
|
-
displayType : settings.useFlex
|
265
|
-
? 'flex'
|
266
|
-
: 'block',
|
267
|
-
animation : (settings.transition.showMethod || settings.transition) + ' in',
|
268
|
-
queue : false,
|
269
|
-
duration : module.get.duration(),
|
270
|
-
useFailSafe : true,
|
271
|
-
onStart : function() {
|
272
|
-
module.set.dimmed();
|
273
|
-
},
|
274
|
-
onComplete : function() {
|
275
|
-
module.set.active();
|
276
|
-
settings.onVisible.call($dimmer);
|
277
|
-
callback();
|
278
|
-
}
|
279
|
-
})
|
280
|
-
;
|
281
|
-
}
|
282
|
-
else {
|
283
|
-
module.verbose('Showing dimmer animation with javascript');
|
284
|
-
module.set.dimmed();
|
285
|
-
if(settings.opacity == 'auto') {
|
286
|
-
settings.opacity = 0.8;
|
287
|
-
}
|
288
|
-
$dimmer
|
289
|
-
.stop()
|
290
|
-
.css({
|
291
|
-
opacity : 0,
|
292
|
-
width : '100%',
|
293
|
-
height : '100%'
|
294
|
-
})
|
295
|
-
.fadeTo(module.get.duration(), settings.opacity, function() {
|
296
|
-
$dimmer.removeAttr('style');
|
297
|
-
module.set.active();
|
298
|
-
settings.onVisible.call($dimmer);
|
299
|
-
callback();
|
300
|
-
})
|
301
|
-
;
|
302
|
-
}
|
303
|
-
},
|
304
|
-
hide: function(callback) {
|
305
|
-
callback = $.isFunction(callback)
|
306
|
-
? callback
|
307
|
-
: function(){}
|
308
|
-
;
|
309
|
-
if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
|
310
|
-
module.verbose('Hiding dimmer with css');
|
311
|
-
$dimmer
|
312
|
-
.transition({
|
313
|
-
debug : settings.debug,
|
314
|
-
verbose : settings.verbose,
|
315
|
-
silent : settings.silent,
|
316
|
-
displayType : settings.useFlex
|
317
|
-
? 'flex'
|
318
|
-
: 'block',
|
319
|
-
animation : (settings.transition.hideMethod || settings.transition) + ' out',
|
320
|
-
queue : false,
|
321
|
-
duration : module.get.duration(),
|
322
|
-
useFailSafe : true,
|
323
|
-
onComplete : function() {
|
324
|
-
module.remove.dimmed();
|
64
|
+
module = {
|
65
|
+
|
66
|
+
preinitialize: function () {
|
67
|
+
if (module.is.dimmer()) {
|
68
|
+
$dimmable = $module.parent();
|
69
|
+
$dimmer = $module;
|
70
|
+
} else {
|
71
|
+
$dimmable = $module;
|
72
|
+
if (module.has.dimmer()) {
|
73
|
+
$dimmer = settings.dimmerName
|
74
|
+
? $dimmable.find(selector.dimmer).filter('.' + settings.dimmerName)
|
75
|
+
: $dimmable.find(selector.dimmer);
|
76
|
+
} else {
|
77
|
+
$dimmer = module.create();
|
78
|
+
}
|
79
|
+
}
|
80
|
+
},
|
81
|
+
|
82
|
+
initialize: function () {
|
83
|
+
module.debug('Initializing dimmer', settings);
|
84
|
+
|
85
|
+
module.bind.events();
|
86
|
+
module.set.dimmable();
|
87
|
+
module.instantiate();
|
88
|
+
},
|
89
|
+
|
90
|
+
instantiate: function () {
|
91
|
+
module.verbose('Storing instance of module', module);
|
92
|
+
instance = module;
|
93
|
+
$module
|
94
|
+
.data(moduleNamespace, instance)
|
95
|
+
;
|
96
|
+
},
|
97
|
+
|
98
|
+
destroy: function () {
|
99
|
+
module.verbose('Destroying previous module', $dimmer);
|
100
|
+
module.unbind.events();
|
325
101
|
module.remove.variation();
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
102
|
+
$dimmable
|
103
|
+
.off(eventNamespace)
|
104
|
+
;
|
105
|
+
},
|
106
|
+
|
107
|
+
bind: {
|
108
|
+
events: function () {
|
109
|
+
if (settings.on === 'hover') {
|
110
|
+
$dimmable
|
111
|
+
.on('mouseenter' + eventNamespace, module.show)
|
112
|
+
.on('mouseleave' + eventNamespace, module.hide)
|
113
|
+
;
|
114
|
+
} else if (settings.on === 'click') {
|
115
|
+
$dimmable
|
116
|
+
.on(clickEvent + eventNamespace, module.toggle)
|
117
|
+
;
|
118
|
+
}
|
119
|
+
if (module.is.page()) {
|
120
|
+
module.debug('Setting as a page dimmer', $dimmable);
|
121
|
+
module.set.pageDimmer();
|
122
|
+
}
|
123
|
+
|
124
|
+
if (module.is.closable()) {
|
125
|
+
module.verbose('Adding dimmer close event', $dimmer);
|
126
|
+
$dimmable
|
127
|
+
.on(clickEvent + eventNamespace, selector.dimmer, module.event.click)
|
128
|
+
;
|
129
|
+
}
|
130
|
+
},
|
131
|
+
},
|
132
|
+
|
133
|
+
unbind: {
|
134
|
+
events: function () {
|
135
|
+
$module
|
136
|
+
.removeData(moduleNamespace)
|
137
|
+
;
|
138
|
+
$dimmable
|
139
|
+
.off(eventNamespace)
|
140
|
+
;
|
141
|
+
},
|
142
|
+
},
|
143
|
+
|
144
|
+
event: {
|
145
|
+
click: function (event) {
|
146
|
+
module.verbose('Determining if event occurred on dimmer', event);
|
147
|
+
if ($dimmer.find(event.target).length === 0 || $(event.target).is(selector.content)) {
|
148
|
+
module.hide();
|
149
|
+
event.stopImmediatePropagation();
|
150
|
+
}
|
151
|
+
},
|
152
|
+
},
|
153
|
+
|
154
|
+
addContent: function (element) {
|
155
|
+
var
|
156
|
+
$content = $(element)
|
157
|
+
;
|
158
|
+
module.debug('Add content to dimmer', $content);
|
159
|
+
if ($content.parent()[0] !== $dimmer[0]) {
|
160
|
+
$content.detach().appendTo($dimmer);
|
161
|
+
}
|
162
|
+
},
|
163
|
+
|
164
|
+
create: function () {
|
165
|
+
var
|
166
|
+
$element = $(settings.template.dimmer(settings))
|
167
|
+
;
|
168
|
+
if (settings.dimmerName) {
|
169
|
+
module.debug('Creating named dimmer', settings.dimmerName);
|
170
|
+
$element.addClass(settings.dimmerName);
|
171
|
+
}
|
172
|
+
$element
|
173
|
+
.appendTo($dimmable)
|
174
|
+
;
|
175
|
+
|
176
|
+
return $element;
|
177
|
+
},
|
178
|
+
|
179
|
+
show: function (callback) {
|
180
|
+
callback = isFunction(callback)
|
181
|
+
? callback
|
182
|
+
: function () {};
|
183
|
+
if ((!module.is.dimmed() || module.is.animating()) && module.is.enabled()) {
|
184
|
+
if (settings.onShow.call(element) === false) {
|
185
|
+
module.verbose('Show callback returned false cancelling dimmer show');
|
186
|
+
|
187
|
+
return;
|
188
|
+
}
|
189
|
+
module.debug('Showing dimmer', $dimmer, settings);
|
190
|
+
module.set.variation();
|
191
|
+
module.animate.show(callback);
|
192
|
+
settings.onChange.call(element);
|
193
|
+
} else {
|
194
|
+
module.debug('Dimmer is already shown or disabled');
|
195
|
+
}
|
196
|
+
},
|
197
|
+
|
198
|
+
hide: function (callback) {
|
199
|
+
callback = isFunction(callback)
|
200
|
+
? callback
|
201
|
+
: function () {};
|
202
|
+
if (module.is.dimmed() || module.is.animating()) {
|
203
|
+
if (settings.onHide.call(element) === false) {
|
204
|
+
module.verbose('Hide callback returned false cancelling dimmer hide');
|
205
|
+
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
module.debug('Hiding dimmer', $dimmer);
|
209
|
+
module.animate.hide(callback);
|
210
|
+
settings.onChange.call(element);
|
211
|
+
} else {
|
212
|
+
module.debug('Dimmer is not visible');
|
213
|
+
}
|
214
|
+
},
|
215
|
+
|
216
|
+
toggle: function () {
|
217
|
+
module.verbose('Toggling dimmer visibility', $dimmer);
|
218
|
+
if (!module.is.dimmed()) {
|
219
|
+
module.show();
|
220
|
+
} else {
|
221
|
+
if (module.is.closable()) {
|
222
|
+
module.hide();
|
223
|
+
}
|
224
|
+
}
|
225
|
+
},
|
226
|
+
|
227
|
+
animate: {
|
228
|
+
show: function (callback) {
|
229
|
+
callback = isFunction(callback)
|
230
|
+
? callback
|
231
|
+
: function () {};
|
232
|
+
if (settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
|
233
|
+
if (settings.useFlex) {
|
234
|
+
module.debug('Using flex dimmer');
|
235
|
+
module.remove.legacy();
|
236
|
+
} else {
|
237
|
+
module.debug('Using legacy non-flex dimmer');
|
238
|
+
module.set.legacy();
|
239
|
+
}
|
240
|
+
if (settings.opacity !== 'auto') {
|
241
|
+
module.set.opacity();
|
242
|
+
}
|
243
|
+
$dimmer
|
244
|
+
.transition({
|
245
|
+
debug: settings.debug,
|
246
|
+
verbose: settings.verbose,
|
247
|
+
silent: settings.silent,
|
248
|
+
displayType: settings.useFlex
|
249
|
+
? 'flex'
|
250
|
+
: 'block',
|
251
|
+
animation: (settings.transition.showMethod || settings.transition) + ' in',
|
252
|
+
queue: false,
|
253
|
+
duration: module.get.duration(),
|
254
|
+
useFailSafe: true,
|
255
|
+
onStart: function () {
|
256
|
+
module.set.dimmed();
|
257
|
+
},
|
258
|
+
onComplete: function () {
|
259
|
+
module.set.active();
|
260
|
+
settings.onVisible.call($dimmer);
|
261
|
+
callback();
|
262
|
+
},
|
263
|
+
})
|
264
|
+
;
|
265
|
+
} else {
|
266
|
+
module.verbose('Showing dimmer animation with javascript');
|
267
|
+
module.set.dimmed();
|
268
|
+
if (settings.opacity === 'auto') {
|
269
|
+
settings.opacity = 0.8;
|
270
|
+
}
|
271
|
+
$dimmer
|
272
|
+
.stop()
|
273
|
+
.css({
|
274
|
+
opacity: 0,
|
275
|
+
width: '100%',
|
276
|
+
height: '100%',
|
277
|
+
})
|
278
|
+
.fadeTo(module.get.duration(), settings.opacity, function () {
|
279
|
+
$dimmer.removeAttr('style');
|
280
|
+
module.set.active();
|
281
|
+
settings.onVisible.call($dimmer);
|
282
|
+
callback();
|
283
|
+
})
|
284
|
+
;
|
285
|
+
}
|
286
|
+
},
|
287
|
+
hide: function (callback) {
|
288
|
+
callback = isFunction(callback)
|
289
|
+
? callback
|
290
|
+
: function () {};
|
291
|
+
if (settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
|
292
|
+
module.verbose('Hiding dimmer with css');
|
293
|
+
$dimmer
|
294
|
+
.transition({
|
295
|
+
debug: settings.debug,
|
296
|
+
verbose: settings.verbose,
|
297
|
+
silent: settings.silent,
|
298
|
+
displayType: settings.useFlex
|
299
|
+
? 'flex'
|
300
|
+
: 'block',
|
301
|
+
animation: (settings.transition.hideMethod || settings.transition) + ' out',
|
302
|
+
queue: false,
|
303
|
+
duration: module.get.duration(),
|
304
|
+
useFailSafe: true,
|
305
|
+
onComplete: function () {
|
306
|
+
module.remove.dimmed();
|
307
|
+
module.remove.variation();
|
308
|
+
module.remove.active();
|
309
|
+
settings.onHidden.call($dimmer);
|
310
|
+
callback();
|
311
|
+
},
|
312
|
+
})
|
313
|
+
;
|
314
|
+
} else {
|
315
|
+
module.verbose('Hiding dimmer with javascript');
|
316
|
+
$dimmer
|
317
|
+
.stop()
|
318
|
+
.fadeOut(module.get.duration(), function () {
|
319
|
+
module.remove.dimmed();
|
320
|
+
module.remove.active();
|
321
|
+
$dimmer.removeAttr('style');
|
322
|
+
settings.onHidden.call($dimmer);
|
323
|
+
callback();
|
324
|
+
})
|
325
|
+
;
|
326
|
+
}
|
327
|
+
},
|
328
|
+
},
|
329
|
+
|
330
|
+
get: {
|
331
|
+
dimmer: function () {
|
332
|
+
return $dimmer;
|
333
|
+
},
|
334
|
+
duration: function () {
|
335
|
+
if (module.is.active()) {
|
336
|
+
return settings.transition.hideDuration || settings.duration.hide || settings.duration;
|
337
|
+
}
|
338
|
+
|
339
|
+
return settings.transition.showDuration || settings.duration.show || settings.duration;
|
340
|
+
},
|
341
|
+
},
|
342
|
+
|
343
|
+
has: {
|
344
|
+
dimmer: function () {
|
345
|
+
if (settings.dimmerName) {
|
346
|
+
return $module.find(selector.dimmer).filter('.' + settings.dimmerName).length > 0;
|
347
|
+
}
|
348
|
+
|
349
|
+
return $module.find(selector.dimmer).length > 0;
|
350
|
+
},
|
351
|
+
},
|
352
|
+
|
353
|
+
is: {
|
354
|
+
active: function () {
|
355
|
+
return $dimmer.hasClass(className.active);
|
356
|
+
},
|
357
|
+
animating: function () {
|
358
|
+
return $dimmer.is(':animated') || $dimmer.hasClass(className.animating);
|
359
|
+
},
|
360
|
+
closable: function () {
|
361
|
+
if (settings.closable === 'auto') {
|
362
|
+
return settings.on !== 'hover';
|
363
|
+
}
|
364
|
+
|
365
|
+
return settings.closable;
|
366
|
+
},
|
367
|
+
dimmer: function () {
|
368
|
+
return $module.hasClass(className.dimmer);
|
369
|
+
},
|
370
|
+
dimmable: function () {
|
371
|
+
return $module.hasClass(className.dimmable);
|
372
|
+
},
|
373
|
+
dimmed: function () {
|
374
|
+
return $dimmable.hasClass(className.dimmed);
|
375
|
+
},
|
376
|
+
disabled: function () {
|
377
|
+
return $dimmable.hasClass(className.disabled);
|
378
|
+
},
|
379
|
+
enabled: function () {
|
380
|
+
return !module.is.disabled();
|
381
|
+
},
|
382
|
+
page: function () {
|
383
|
+
return $dimmable.is('body');
|
384
|
+
},
|
385
|
+
pageDimmer: function () {
|
386
|
+
return $dimmer.hasClass(className.pageDimmer);
|
387
|
+
},
|
388
|
+
},
|
389
|
+
|
390
|
+
can: {
|
391
|
+
show: function () {
|
392
|
+
return !$dimmer.hasClass(className.disabled);
|
393
|
+
},
|
394
|
+
},
|
395
|
+
|
396
|
+
set: {
|
397
|
+
opacity: function (opacity) {
|
398
|
+
var
|
399
|
+
color = $dimmer.css('background-color'),
|
400
|
+
colorArray = color.split(','),
|
401
|
+
isRGB = colorArray && colorArray.length >= 3
|
402
|
+
;
|
403
|
+
opacity = settings.opacity === 0 ? 0 : settings.opacity || opacity;
|
404
|
+
if (isRGB) {
|
405
|
+
colorArray[2] = colorArray[2].replace(')', '');
|
406
|
+
colorArray[3] = opacity + ')';
|
407
|
+
color = colorArray.join(',');
|
408
|
+
} else {
|
409
|
+
color = 'rgba(0, 0, 0, ' + opacity + ')';
|
410
|
+
}
|
411
|
+
module.debug('Setting opacity to', opacity);
|
412
|
+
$dimmer.css('background-color', color);
|
413
|
+
},
|
414
|
+
legacy: function () {
|
415
|
+
$dimmer.addClass(className.legacy);
|
416
|
+
},
|
417
|
+
active: function () {
|
418
|
+
$dimmer.addClass(className.active);
|
419
|
+
},
|
420
|
+
dimmable: function () {
|
421
|
+
$dimmable.addClass(className.dimmable);
|
422
|
+
},
|
423
|
+
dimmed: function () {
|
424
|
+
$dimmable.addClass(className.dimmed);
|
425
|
+
},
|
426
|
+
pageDimmer: function () {
|
427
|
+
$dimmer.addClass(className.pageDimmer);
|
428
|
+
},
|
429
|
+
disabled: function () {
|
430
|
+
$dimmer.addClass(className.disabled);
|
431
|
+
},
|
432
|
+
variation: function (variation) {
|
433
|
+
variation = variation || settings.variation;
|
434
|
+
if (variation) {
|
435
|
+
$dimmer.addClass(variation);
|
436
|
+
}
|
437
|
+
},
|
438
|
+
},
|
439
|
+
|
440
|
+
remove: {
|
441
|
+
active: function () {
|
442
|
+
$dimmer
|
443
|
+
.removeClass(className.active)
|
444
|
+
;
|
445
|
+
},
|
446
|
+
legacy: function () {
|
447
|
+
$dimmer.removeClass(className.legacy);
|
448
|
+
},
|
449
|
+
dimmed: function () {
|
450
|
+
$dimmable.removeClass(className.dimmed);
|
451
|
+
},
|
452
|
+
disabled: function () {
|
453
|
+
$dimmer.removeClass(className.disabled);
|
454
|
+
},
|
455
|
+
variation: function (variation) {
|
456
|
+
variation = variation || settings.variation;
|
457
|
+
if (variation) {
|
458
|
+
$dimmer.removeClass(variation);
|
459
|
+
}
|
460
|
+
},
|
461
|
+
},
|
462
|
+
|
463
|
+
setting: function (name, value) {
|
464
|
+
module.debug('Changing setting', name, value);
|
465
|
+
if ($.isPlainObject(name)) {
|
466
|
+
$.extend(true, settings, name);
|
467
|
+
} else if (value !== undefined) {
|
468
|
+
if ($.isPlainObject(settings[name])) {
|
469
|
+
$.extend(true, settings[name], value);
|
470
|
+
} else {
|
471
|
+
settings[name] = value;
|
472
|
+
}
|
473
|
+
} else {
|
474
|
+
return settings[name];
|
475
|
+
}
|
476
|
+
},
|
477
|
+
internal: function (name, value) {
|
478
|
+
if ($.isPlainObject(name)) {
|
479
|
+
$.extend(true, module, name);
|
480
|
+
} else if (value !== undefined) {
|
481
|
+
module[name] = value;
|
482
|
+
} else {
|
483
|
+
return module[name];
|
484
|
+
}
|
485
|
+
},
|
486
|
+
debug: function () {
|
487
|
+
if (!settings.silent && settings.debug) {
|
488
|
+
if (settings.performance) {
|
489
|
+
module.performance.log(arguments);
|
490
|
+
} else {
|
491
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
492
|
+
module.debug.apply(console, arguments);
|
493
|
+
}
|
494
|
+
}
|
495
|
+
},
|
496
|
+
verbose: function () {
|
497
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
498
|
+
if (settings.performance) {
|
499
|
+
module.performance.log(arguments);
|
500
|
+
} else {
|
501
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
502
|
+
module.verbose.apply(console, arguments);
|
503
|
+
}
|
504
|
+
}
|
505
|
+
},
|
506
|
+
error: function () {
|
507
|
+
if (!settings.silent) {
|
508
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
509
|
+
module.error.apply(console, arguments);
|
510
|
+
}
|
511
|
+
},
|
512
|
+
performance: {
|
513
|
+
log: function (message) {
|
514
|
+
var
|
515
|
+
currentTime,
|
516
|
+
executionTime,
|
517
|
+
previousTime
|
518
|
+
;
|
519
|
+
if (settings.performance) {
|
520
|
+
currentTime = Date.now();
|
521
|
+
previousTime = time || currentTime;
|
522
|
+
executionTime = currentTime - previousTime;
|
523
|
+
time = currentTime;
|
524
|
+
performance.push({
|
525
|
+
Name: message[0],
|
526
|
+
Arguments: [].slice.call(message, 1) || '',
|
527
|
+
Element: element,
|
528
|
+
'Execution Time': executionTime,
|
529
|
+
});
|
530
|
+
}
|
531
|
+
clearTimeout(module.performance.timer);
|
532
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
533
|
+
},
|
534
|
+
display: function () {
|
535
|
+
var
|
536
|
+
title = settings.name + ':',
|
537
|
+
totalTime = 0
|
538
|
+
;
|
539
|
+
time = false;
|
540
|
+
clearTimeout(module.performance.timer);
|
541
|
+
$.each(performance, function (index, data) {
|
542
|
+
totalTime += data['Execution Time'];
|
543
|
+
});
|
544
|
+
title += ' ' + totalTime + 'ms';
|
545
|
+
if (moduleSelector) {
|
546
|
+
title += ' \'' + moduleSelector + '\'';
|
547
|
+
}
|
548
|
+
if ($allModules.length > 1) {
|
549
|
+
title += ' (' + $allModules.length + ')';
|
550
|
+
}
|
551
|
+
if (performance.length > 0) {
|
552
|
+
console.groupCollapsed(title);
|
553
|
+
if (console.table) {
|
554
|
+
console.table(performance);
|
555
|
+
} else {
|
556
|
+
$.each(performance, function (index, data) {
|
557
|
+
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
558
|
+
});
|
559
|
+
}
|
560
|
+
console.groupEnd();
|
561
|
+
}
|
562
|
+
performance = [];
|
563
|
+
},
|
564
|
+
},
|
565
|
+
invoke: function (query, passedArguments, context) {
|
566
|
+
var
|
567
|
+
object = instance,
|
568
|
+
maxDepth,
|
569
|
+
found,
|
570
|
+
response
|
571
|
+
;
|
572
|
+
passedArguments = passedArguments || queryArguments;
|
573
|
+
context = context || element;
|
574
|
+
if (typeof query === 'string' && object !== undefined) {
|
575
|
+
query = query.split(/[ .]/);
|
576
|
+
maxDepth = query.length - 1;
|
577
|
+
$.each(query, function (depth, value) {
|
578
|
+
var camelCaseValue = depth !== maxDepth
|
579
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
580
|
+
: query
|
581
|
+
;
|
582
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
583
|
+
object = object[camelCaseValue];
|
584
|
+
} else if (object[camelCaseValue] !== undefined) {
|
585
|
+
found = object[camelCaseValue];
|
586
|
+
|
587
|
+
return false;
|
588
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
589
|
+
object = object[value];
|
590
|
+
} else if (object[value] !== undefined) {
|
591
|
+
found = object[value];
|
592
|
+
|
593
|
+
return false;
|
594
|
+
} else {
|
595
|
+
module.error(error.method, query);
|
596
|
+
|
597
|
+
return false;
|
598
|
+
}
|
599
|
+
});
|
600
|
+
}
|
601
|
+
if (isFunction(found)) {
|
602
|
+
response = found.apply(context, passedArguments);
|
603
|
+
} else if (found !== undefined) {
|
604
|
+
response = found;
|
605
|
+
}
|
606
|
+
if (Array.isArray(returnedValue)) {
|
607
|
+
returnedValue.push(response);
|
608
|
+
} else if (returnedValue !== undefined) {
|
609
|
+
returnedValue = [returnedValue, response];
|
610
|
+
} else if (response !== undefined) {
|
611
|
+
returnedValue = response;
|
612
|
+
}
|
613
|
+
|
614
|
+
return found;
|
615
|
+
},
|
616
|
+
};
|
617
|
+
|
618
|
+
module.preinitialize();
|
619
|
+
|
620
|
+
if (methodInvoked) {
|
621
|
+
if (instance === undefined) {
|
622
|
+
module.initialize();
|
623
|
+
}
|
624
|
+
module.invoke(query);
|
625
|
+
} else {
|
626
|
+
if (instance !== undefined) {
|
627
|
+
instance.invoke('destroy');
|
628
|
+
}
|
629
|
+
module.initialize();
|
630
|
+
}
|
631
|
+
});
|
632
|
+
|
633
|
+
return returnedValue !== undefined
|
634
|
+
? returnedValue
|
635
|
+
: this;
|
636
|
+
};
|
637
|
+
|
638
|
+
$.fn.dimmer.settings = {
|
639
|
+
|
640
|
+
name: 'Dimmer',
|
641
|
+
namespace: 'dimmer',
|
642
|
+
|
643
|
+
silent: false,
|
644
|
+
debug: false,
|
645
|
+
verbose: false,
|
646
|
+
performance: true,
|
647
|
+
|
648
|
+
// whether should use flex layout
|
649
|
+
useFlex: true,
|
650
|
+
|
651
|
+
// name to distinguish between multiple dimmers in context
|
652
|
+
dimmerName: false,
|
653
|
+
|
654
|
+
// whether to add a variation type
|
655
|
+
variation: false,
|
656
|
+
|
657
|
+
// whether to bind close events
|
658
|
+
closable: 'auto',
|
659
|
+
|
660
|
+
// whether to use css animations
|
661
|
+
useCSS: true,
|
662
|
+
|
663
|
+
// css animation to use
|
664
|
+
transition: 'fade',
|
665
|
+
|
666
|
+
// event to bind to
|
667
|
+
on: false,
|
668
|
+
|
669
|
+
// overriding opacity value
|
670
|
+
opacity: 'auto',
|
671
|
+
|
672
|
+
// transition durations
|
673
|
+
duration: {
|
674
|
+
show: 500,
|
675
|
+
hide: 500,
|
347
676
|
},
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
},
|
362
|
-
|
363
|
-
has: {
|
364
|
-
dimmer: function() {
|
365
|
-
if(settings.dimmerName) {
|
366
|
-
return ($module.find(selector.dimmer).filter('.' + settings.dimmerName).length > 0);
|
367
|
-
}
|
368
|
-
else {
|
369
|
-
return ( $module.find(selector.dimmer).length > 0 );
|
370
|
-
}
|
371
|
-
}
|
677
|
+
// whether the dynamically created dimmer should have a loader
|
678
|
+
displayLoader: false,
|
679
|
+
loaderText: false,
|
680
|
+
loaderVariation: '',
|
681
|
+
|
682
|
+
onChange: function () {},
|
683
|
+
onShow: function () {},
|
684
|
+
onHide: function () {},
|
685
|
+
onVisible: function () {},
|
686
|
+
onHidden: function () {},
|
687
|
+
|
688
|
+
error: {
|
689
|
+
method: 'The method you called is not defined.',
|
372
690
|
},
|
373
691
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
},
|
387
|
-
dimmer: function() {
|
388
|
-
return $module.hasClass(className.dimmer);
|
389
|
-
},
|
390
|
-
dimmable: function() {
|
391
|
-
return $module.hasClass(className.dimmable);
|
392
|
-
},
|
393
|
-
dimmed: function() {
|
394
|
-
return $dimmable.hasClass(className.dimmed);
|
395
|
-
},
|
396
|
-
disabled: function() {
|
397
|
-
return $dimmable.hasClass(className.disabled);
|
398
|
-
},
|
399
|
-
enabled: function() {
|
400
|
-
return !module.is.disabled();
|
401
|
-
},
|
402
|
-
page: function () {
|
403
|
-
return $dimmable.is('body');
|
404
|
-
},
|
405
|
-
pageDimmer: function() {
|
406
|
-
return $dimmer.hasClass(className.pageDimmer);
|
407
|
-
}
|
692
|
+
className: {
|
693
|
+
active: 'active',
|
694
|
+
animating: 'animating',
|
695
|
+
dimmable: 'dimmable',
|
696
|
+
dimmed: 'dimmed',
|
697
|
+
dimmer: 'dimmer',
|
698
|
+
disabled: 'disabled',
|
699
|
+
hide: 'hide',
|
700
|
+
legacy: 'legacy',
|
701
|
+
pageDimmer: 'page',
|
702
|
+
show: 'show',
|
703
|
+
loader: 'ui loader',
|
408
704
|
},
|
409
705
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
}
|
706
|
+
selector: {
|
707
|
+
dimmer: '> .ui.dimmer',
|
708
|
+
content: '.ui.dimmer > .content, .ui.dimmer > .content > .center',
|
414
709
|
},
|
415
710
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
$dimmer.addClass(className.legacy);
|
437
|
-
},
|
438
|
-
active: function() {
|
439
|
-
$dimmer.addClass(className.active);
|
440
|
-
},
|
441
|
-
dimmable: function() {
|
442
|
-
$dimmable.addClass(className.dimmable);
|
443
|
-
},
|
444
|
-
dimmed: function() {
|
445
|
-
$dimmable.addClass(className.dimmed);
|
446
|
-
},
|
447
|
-
pageDimmer: function() {
|
448
|
-
$dimmer.addClass(className.pageDimmer);
|
449
|
-
},
|
450
|
-
disabled: function() {
|
451
|
-
$dimmer.addClass(className.disabled);
|
452
|
-
},
|
453
|
-
variation: function(variation) {
|
454
|
-
variation = variation || settings.variation;
|
455
|
-
if(variation) {
|
456
|
-
$dimmer.addClass(variation);
|
457
|
-
}
|
458
|
-
}
|
459
|
-
},
|
460
|
-
|
461
|
-
remove: {
|
462
|
-
active: function() {
|
463
|
-
$dimmer
|
464
|
-
.removeClass(className.active)
|
465
|
-
;
|
466
|
-
},
|
467
|
-
legacy: function() {
|
468
|
-
$dimmer.removeClass(className.legacy);
|
469
|
-
},
|
470
|
-
dimmed: function() {
|
471
|
-
$dimmable.removeClass(className.dimmed);
|
472
|
-
},
|
473
|
-
disabled: function() {
|
474
|
-
$dimmer.removeClass(className.disabled);
|
475
|
-
},
|
476
|
-
variation: function(variation) {
|
477
|
-
variation = variation || settings.variation;
|
478
|
-
if(variation) {
|
479
|
-
$dimmer.removeClass(variation);
|
480
|
-
}
|
481
|
-
}
|
482
|
-
},
|
483
|
-
|
484
|
-
setting: function(name, value) {
|
485
|
-
module.debug('Changing setting', name, value);
|
486
|
-
if( $.isPlainObject(name) ) {
|
487
|
-
$.extend(true, settings, name);
|
488
|
-
}
|
489
|
-
else if(value !== undefined) {
|
490
|
-
if($.isPlainObject(settings[name])) {
|
491
|
-
$.extend(true, settings[name], value);
|
492
|
-
}
|
493
|
-
else {
|
494
|
-
settings[name] = value;
|
495
|
-
}
|
496
|
-
}
|
497
|
-
else {
|
498
|
-
return settings[name];
|
499
|
-
}
|
711
|
+
template: {
|
712
|
+
dimmer: function (settings) {
|
713
|
+
var
|
714
|
+
d = $('<div/>').addClass('ui dimmer'),
|
715
|
+
l
|
716
|
+
;
|
717
|
+
if (settings.displayLoader) {
|
718
|
+
l = $('<div/>')
|
719
|
+
.addClass(settings.className.loader)
|
720
|
+
.addClass(settings.loaderVariation)
|
721
|
+
;
|
722
|
+
if (settings.loaderText) {
|
723
|
+
l.text(settings.loaderText);
|
724
|
+
l.addClass('text');
|
725
|
+
}
|
726
|
+
d.append(l);
|
727
|
+
}
|
728
|
+
|
729
|
+
return d;
|
730
|
+
},
|
500
731
|
},
|
501
|
-
internal: function(name, value) {
|
502
|
-
if( $.isPlainObject(name) ) {
|
503
|
-
$.extend(true, module, name);
|
504
|
-
}
|
505
|
-
else if(value !== undefined) {
|
506
|
-
module[name] = value;
|
507
|
-
}
|
508
|
-
else {
|
509
|
-
return module[name];
|
510
|
-
}
|
511
|
-
},
|
512
|
-
debug: function() {
|
513
|
-
if(!settings.silent && settings.debug) {
|
514
|
-
if(settings.performance) {
|
515
|
-
module.performance.log(arguments);
|
516
|
-
}
|
517
|
-
else {
|
518
|
-
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
519
|
-
module.debug.apply(console, arguments);
|
520
|
-
}
|
521
|
-
}
|
522
|
-
},
|
523
|
-
verbose: function() {
|
524
|
-
if(!settings.silent && settings.verbose && settings.debug) {
|
525
|
-
if(settings.performance) {
|
526
|
-
module.performance.log(arguments);
|
527
|
-
}
|
528
|
-
else {
|
529
|
-
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
530
|
-
module.verbose.apply(console, arguments);
|
531
|
-
}
|
532
|
-
}
|
533
|
-
},
|
534
|
-
error: function() {
|
535
|
-
if(!settings.silent) {
|
536
|
-
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
537
|
-
module.error.apply(console, arguments);
|
538
|
-
}
|
539
|
-
},
|
540
|
-
performance: {
|
541
|
-
log: function(message) {
|
542
|
-
var
|
543
|
-
currentTime,
|
544
|
-
executionTime,
|
545
|
-
previousTime
|
546
|
-
;
|
547
|
-
if(settings.performance) {
|
548
|
-
currentTime = new Date().getTime();
|
549
|
-
previousTime = time || currentTime;
|
550
|
-
executionTime = currentTime - previousTime;
|
551
|
-
time = currentTime;
|
552
|
-
performance.push({
|
553
|
-
'Name' : message[0],
|
554
|
-
'Arguments' : [].slice.call(message, 1) || '',
|
555
|
-
'Element' : element,
|
556
|
-
'Execution Time' : executionTime
|
557
|
-
});
|
558
|
-
}
|
559
|
-
clearTimeout(module.performance.timer);
|
560
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
561
|
-
},
|
562
|
-
display: function() {
|
563
|
-
var
|
564
|
-
title = settings.name + ':',
|
565
|
-
totalTime = 0
|
566
|
-
;
|
567
|
-
time = false;
|
568
|
-
clearTimeout(module.performance.timer);
|
569
|
-
$.each(performance, function(index, data) {
|
570
|
-
totalTime += data['Execution Time'];
|
571
|
-
});
|
572
|
-
title += ' ' + totalTime + 'ms';
|
573
|
-
if(moduleSelector) {
|
574
|
-
title += ' \'' + moduleSelector + '\'';
|
575
|
-
}
|
576
|
-
if($allModules.length > 1) {
|
577
|
-
title += ' ' + '(' + $allModules.length + ')';
|
578
|
-
}
|
579
|
-
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
580
|
-
console.groupCollapsed(title);
|
581
|
-
if(console.table) {
|
582
|
-
console.table(performance);
|
583
|
-
}
|
584
|
-
else {
|
585
|
-
$.each(performance, function(index, data) {
|
586
|
-
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
587
|
-
});
|
588
|
-
}
|
589
|
-
console.groupEnd();
|
590
|
-
}
|
591
|
-
performance = [];
|
592
|
-
}
|
593
|
-
},
|
594
|
-
invoke: function(query, passedArguments, context) {
|
595
|
-
var
|
596
|
-
object = instance,
|
597
|
-
maxDepth,
|
598
|
-
found,
|
599
|
-
response
|
600
|
-
;
|
601
|
-
passedArguments = passedArguments || queryArguments;
|
602
|
-
context = context || element;
|
603
|
-
if(typeof query == 'string' && object !== undefined) {
|
604
|
-
query = query.split(/[\. ]/);
|
605
|
-
maxDepth = query.length - 1;
|
606
|
-
$.each(query, function(depth, value) {
|
607
|
-
var camelCaseValue = (depth != maxDepth)
|
608
|
-
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
609
|
-
: query
|
610
|
-
;
|
611
|
-
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
612
|
-
object = object[camelCaseValue];
|
613
|
-
}
|
614
|
-
else if( object[camelCaseValue] !== undefined ) {
|
615
|
-
found = object[camelCaseValue];
|
616
|
-
return false;
|
617
|
-
}
|
618
|
-
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
619
|
-
object = object[value];
|
620
|
-
}
|
621
|
-
else if( object[value] !== undefined ) {
|
622
|
-
found = object[value];
|
623
|
-
return false;
|
624
|
-
}
|
625
|
-
else {
|
626
|
-
module.error(error.method, query);
|
627
|
-
return false;
|
628
|
-
}
|
629
|
-
});
|
630
|
-
}
|
631
|
-
if ( $.isFunction( found ) ) {
|
632
|
-
response = found.apply(context, passedArguments);
|
633
|
-
}
|
634
|
-
else if(found !== undefined) {
|
635
|
-
response = found;
|
636
|
-
}
|
637
|
-
if(Array.isArray(returnedValue)) {
|
638
|
-
returnedValue.push(response);
|
639
|
-
}
|
640
|
-
else if(returnedValue !== undefined) {
|
641
|
-
returnedValue = [returnedValue, response];
|
642
|
-
}
|
643
|
-
else if(response !== undefined) {
|
644
|
-
returnedValue = response;
|
645
|
-
}
|
646
|
-
return found;
|
647
|
-
}
|
648
|
-
};
|
649
|
-
|
650
|
-
module.preinitialize();
|
651
|
-
|
652
|
-
if(methodInvoked) {
|
653
|
-
if(instance === undefined) {
|
654
|
-
module.initialize();
|
655
|
-
}
|
656
|
-
module.invoke(query);
|
657
|
-
}
|
658
|
-
else {
|
659
|
-
if(instance !== undefined) {
|
660
|
-
instance.invoke('destroy');
|
661
|
-
}
|
662
|
-
module.initialize();
|
663
|
-
}
|
664
|
-
})
|
665
|
-
;
|
666
|
-
|
667
|
-
return (returnedValue !== undefined)
|
668
|
-
? returnedValue
|
669
|
-
: this
|
670
|
-
;
|
671
|
-
};
|
672
|
-
|
673
|
-
$.fn.dimmer.settings = {
|
674
|
-
|
675
|
-
name : 'Dimmer',
|
676
|
-
namespace : 'dimmer',
|
677
|
-
|
678
|
-
silent : false,
|
679
|
-
debug : false,
|
680
|
-
verbose : false,
|
681
|
-
performance : true,
|
682
|
-
|
683
|
-
// whether should use flex layout
|
684
|
-
useFlex : true,
|
685
|
-
|
686
|
-
// name to distinguish between multiple dimmers in context
|
687
|
-
dimmerName : false,
|
688
|
-
|
689
|
-
// whether to add a variation type
|
690
|
-
variation : false,
|
691
|
-
|
692
|
-
// whether to bind close events
|
693
|
-
closable : 'auto',
|
694
|
-
|
695
|
-
// whether to use css animations
|
696
|
-
useCSS : true,
|
697
|
-
|
698
|
-
// css animation to use
|
699
|
-
transition : 'fade',
|
700
|
-
|
701
|
-
// event to bind to
|
702
|
-
on : false,
|
703
|
-
|
704
|
-
// overriding opacity value
|
705
|
-
opacity : 'auto',
|
706
|
-
|
707
|
-
// transition durations
|
708
|
-
duration : {
|
709
|
-
show : 500,
|
710
|
-
hide : 500
|
711
|
-
},
|
712
|
-
// whether the dynamically created dimmer should have a loader
|
713
|
-
displayLoader: false,
|
714
|
-
loaderText : false,
|
715
|
-
loaderVariation : '',
|
716
|
-
|
717
|
-
onChange : function(){},
|
718
|
-
onShow : function(){},
|
719
|
-
onHide : function(){},
|
720
|
-
onVisible : function(){},
|
721
|
-
onHidden : function(){},
|
722
|
-
|
723
|
-
error : {
|
724
|
-
method : 'The method you called is not defined.'
|
725
|
-
},
|
726
|
-
|
727
|
-
className : {
|
728
|
-
active : 'active',
|
729
|
-
animating : 'animating',
|
730
|
-
dimmable : 'dimmable',
|
731
|
-
dimmed : 'dimmed',
|
732
|
-
dimmer : 'dimmer',
|
733
|
-
disabled : 'disabled',
|
734
|
-
hide : 'hide',
|
735
|
-
legacy : 'legacy',
|
736
|
-
pageDimmer : 'page',
|
737
|
-
show : 'show',
|
738
|
-
loader : 'ui loader'
|
739
|
-
},
|
740
|
-
|
741
|
-
selector: {
|
742
|
-
dimmer : '> .ui.dimmer',
|
743
|
-
content : '.ui.dimmer > .content, .ui.dimmer > .content > .center'
|
744
|
-
},
|
745
|
-
|
746
|
-
template: {
|
747
|
-
dimmer: function(settings) {
|
748
|
-
var d = $('<div/>').addClass('ui dimmer'),l;
|
749
|
-
if(settings.displayLoader) {
|
750
|
-
l = $('<div/>')
|
751
|
-
.addClass(settings.className.loader)
|
752
|
-
.addClass(settings.loaderVariation);
|
753
|
-
if(!!settings.loaderText){
|
754
|
-
l.text(settings.loaderText);
|
755
|
-
l.addClass('text');
|
756
|
-
}
|
757
|
-
d.append(l);
|
758
|
-
}
|
759
|
-
return d;
|
760
|
-
}
|
761
|
-
}
|
762
|
-
|
763
|
-
};
|
764
732
|
|
765
|
-
}
|
733
|
+
};
|
734
|
+
})(jQuery, window, document);
|