less-rails-semantic_ui 2.1.8.2 → 2.2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +15 -0
- data/assets/fonts/semantic_ui/themes/default/assets/fonts/icons.eot +0 -0
- data/assets/fonts/semantic_ui/themes/default/assets/fonts/icons.svg +146 -26
- data/assets/fonts/semantic_ui/themes/default/assets/fonts/icons.ttf +0 -0
- data/assets/fonts/semantic_ui/themes/default/assets/fonts/icons.woff +0 -0
- data/assets/fonts/semantic_ui/themes/default/assets/fonts/icons.woff2 +0 -0
- data/assets/javascripts/semantic_ui/definitions/behaviors/api.js +41 -16
- data/assets/javascripts/semantic_ui/definitions/behaviors/colorize.js +233 -227
- data/assets/javascripts/semantic_ui/definitions/behaviors/form.js +58 -23
- data/assets/javascripts/semantic_ui/definitions/behaviors/state.js +20 -7
- data/assets/javascripts/semantic_ui/definitions/behaviors/visibility.js +89 -22
- data/assets/javascripts/semantic_ui/definitions/behaviors/visit.js +13 -5
- data/assets/javascripts/semantic_ui/definitions/globals/site.js +2 -2
- data/assets/javascripts/semantic_ui/definitions/modules/accordion.js +20 -6
- data/assets/javascripts/semantic_ui/definitions/modules/checkbox.js +31 -9
- data/assets/javascripts/semantic_ui/definitions/modules/dimmer.js +27 -9
- data/assets/javascripts/semantic_ui/definitions/modules/dropdown.js +482 -207
- data/assets/javascripts/semantic_ui/definitions/modules/embed.js +50 -13
- data/assets/javascripts/semantic_ui/definitions/modules/modal.js +28 -13
- data/assets/javascripts/semantic_ui/definitions/modules/nag.js +28 -7
- data/assets/javascripts/semantic_ui/definitions/modules/popup.js +136 -76
- data/assets/javascripts/semantic_ui/definitions/modules/progress.js +177 -62
- data/assets/javascripts/semantic_ui/definitions/modules/rating.js +41 -8
- data/assets/javascripts/semantic_ui/definitions/modules/search.js +109 -56
- data/assets/javascripts/semantic_ui/definitions/modules/shape.js +52 -19
- data/assets/javascripts/semantic_ui/definitions/modules/sidebar.js +21 -7
- data/assets/javascripts/semantic_ui/definitions/modules/sticky.js +48 -19
- data/assets/javascripts/semantic_ui/definitions/modules/tab.js +57 -27
- data/assets/javascripts/semantic_ui/definitions/modules/transition.js +24 -8
- data/assets/stylesheets/semantic_ui/definitions/collections/breadcrumb.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/collections/form.less +42 -36
- data/assets/stylesheets/semantic_ui/definitions/collections/grid.less +12 -5
- data/assets/stylesheets/semantic_ui/definitions/collections/menu.less +50 -6
- data/assets/stylesheets/semantic_ui/definitions/collections/message.less +20 -1
- data/assets/stylesheets/semantic_ui/definitions/collections/table.less +16 -3
- data/assets/stylesheets/semantic_ui/definitions/elements/button.less +184 -40
- data/assets/stylesheets/semantic_ui/definitions/elements/container.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/elements/divider.less +1 -3
- data/assets/stylesheets/semantic_ui/definitions/elements/flag.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/elements/header.less +2 -2
- data/assets/stylesheets/semantic_ui/definitions/elements/icon.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/elements/image.less +6 -1
- data/assets/stylesheets/semantic_ui/definitions/elements/input.less +14 -14
- data/assets/stylesheets/semantic_ui/definitions/elements/label.less +3 -3
- data/assets/stylesheets/semantic_ui/definitions/elements/list.less +29 -16
- data/assets/stylesheets/semantic_ui/definitions/elements/loader.less +72 -9
- data/assets/stylesheets/semantic_ui/definitions/elements/rail.less +21 -2
- data/assets/stylesheets/semantic_ui/definitions/elements/reveal.less +2 -3
- data/assets/stylesheets/semantic_ui/definitions/elements/segment.less +44 -3
- data/assets/stylesheets/semantic_ui/definitions/elements/step.less +28 -8
- data/assets/stylesheets/semantic_ui/definitions/globals/reset.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/globals/site.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/accordion.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/checkbox.less +9 -10
- data/assets/stylesheets/semantic_ui/definitions/modules/dimmer.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/dropdown.less +39 -21
- data/assets/stylesheets/semantic_ui/definitions/modules/embed.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/modal.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/nag.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/popup.less +344 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/progress.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/rating.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/search.less +1 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/shape.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/sidebar.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/sticky.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/tab.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/modules/transition.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/views/card.less +20 -2
- data/assets/stylesheets/semantic_ui/definitions/views/comment.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/views/feed.less +0 -1
- data/assets/stylesheets/semantic_ui/definitions/views/item.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/views/statistic.less +18 -19
- data/assets/stylesheets/semantic_ui/themes/basic/globals/reset.overrides +1 -1
- data/assets/stylesheets/semantic_ui/themes/default/collections/form.variables +4 -5
- data/assets/stylesheets/semantic_ui/themes/default/collections/menu.variables +13 -0
- data/assets/stylesheets/semantic_ui/themes/default/collections/message.variables +47 -1
- data/assets/stylesheets/semantic_ui/themes/default/collections/table.variables +7 -2
- data/assets/stylesheets/semantic_ui/themes/default/elements/button.variables +14 -0
- data/assets/stylesheets/semantic_ui/themes/default/elements/icon.overrides +263 -76
- data/assets/stylesheets/semantic_ui/themes/default/elements/icon.variables +3 -1
- data/assets/stylesheets/semantic_ui/themes/default/elements/input.variables +2 -4
- data/assets/stylesheets/semantic_ui/themes/default/elements/list.variables +2 -1
- data/assets/stylesheets/semantic_ui/themes/default/elements/loader.variables +17 -5
- data/assets/stylesheets/semantic_ui/themes/default/elements/rail.variables +2 -2
- data/assets/stylesheets/semantic_ui/themes/default/elements/step.variables +1 -1
- data/assets/stylesheets/semantic_ui/themes/default/globals/reset.overrides +1 -6
- data/assets/stylesheets/semantic_ui/themes/default/globals/site.variables +170 -46
- data/assets/stylesheets/semantic_ui/themes/default/modules/dropdown.variables +15 -12
- data/assets/stylesheets/semantic_ui/themes/default/modules/popup.variables +41 -3
- data/assets/stylesheets/semantic_ui/themes/default/modules/rating.overrides +2 -2
- data/assets/stylesheets/semantic_ui/themes/default/modules/sticky.variables +1 -1
- data/assets/stylesheets/semantic_ui/themes/default/views/card.variables +11 -0
- data/assets/stylesheets/semantic_ui/themes/material/collections/menu.variables +1 -1
- data/lib/less/rails/semantic_ui/version.rb +1 -1
- metadata +4 -3
@@ -1,9 +1,8 @@
|
|
1
1
|
/*!
|
2
|
-
* # Semantic UI -
|
2
|
+
* # Semantic UI - Embed
|
3
3
|
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright 2015 Contributors
|
7
6
|
* Released under the MIT license
|
8
7
|
* http://opensource.org/licenses/MIT
|
9
8
|
*
|
@@ -13,6 +12,13 @@
|
|
13
12
|
|
14
13
|
"use strict";
|
15
14
|
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
16
22
|
$.fn.embed = function(parameters) {
|
17
23
|
|
18
24
|
var
|
@@ -140,6 +146,12 @@ $.fn.embed = function(parameters) {
|
|
140
146
|
module.debug('Creating embed object', $embed);
|
141
147
|
},
|
142
148
|
|
149
|
+
changeEmbed: function(url) {
|
150
|
+
$embed
|
151
|
+
.html( module.generate.embed(url) )
|
152
|
+
;
|
153
|
+
},
|
154
|
+
|
143
155
|
createAndShow: function() {
|
144
156
|
module.createEmbed();
|
145
157
|
module.show();
|
@@ -151,9 +163,19 @@ $.fn.embed = function(parameters) {
|
|
151
163
|
$module
|
152
164
|
.data(metadata.source, source)
|
153
165
|
.data(metadata.id, id)
|
154
|
-
.data(metadata.url, url)
|
155
166
|
;
|
156
|
-
|
167
|
+
if(url) {
|
168
|
+
$module.data(metadata.url, url);
|
169
|
+
}
|
170
|
+
else {
|
171
|
+
$module.removeData(metadata.url);
|
172
|
+
}
|
173
|
+
if(module.has.embed()) {
|
174
|
+
module.changeEmbed();
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
module.create();
|
178
|
+
}
|
157
179
|
},
|
158
180
|
|
159
181
|
// clears embed
|
@@ -333,6 +355,9 @@ $.fn.embed = function(parameters) {
|
|
333
355
|
},
|
334
356
|
|
335
357
|
has: {
|
358
|
+
embed: function() {
|
359
|
+
return ($embed.length > 0);
|
360
|
+
},
|
336
361
|
placeholder: function() {
|
337
362
|
return settings.placeholder || $module.data(metadata.placeholder);
|
338
363
|
}
|
@@ -359,7 +384,12 @@ $.fn.embed = function(parameters) {
|
|
359
384
|
$.extend(true, settings, name);
|
360
385
|
}
|
361
386
|
else if(value !== undefined) {
|
362
|
-
settings[name]
|
387
|
+
if($.isPlainObject(settings[name])) {
|
388
|
+
$.extend(true, settings[name], value);
|
389
|
+
}
|
390
|
+
else {
|
391
|
+
settings[name] = value;
|
392
|
+
}
|
363
393
|
}
|
364
394
|
else {
|
365
395
|
return settings[name];
|
@@ -377,7 +407,7 @@ $.fn.embed = function(parameters) {
|
|
377
407
|
}
|
378
408
|
},
|
379
409
|
debug: function() {
|
380
|
-
if(settings.debug) {
|
410
|
+
if(!settings.silent && settings.debug) {
|
381
411
|
if(settings.performance) {
|
382
412
|
module.performance.log(arguments);
|
383
413
|
}
|
@@ -388,7 +418,7 @@ $.fn.embed = function(parameters) {
|
|
388
418
|
}
|
389
419
|
},
|
390
420
|
verbose: function() {
|
391
|
-
if(settings.verbose && settings.debug) {
|
421
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
392
422
|
if(settings.performance) {
|
393
423
|
module.performance.log(arguments);
|
394
424
|
}
|
@@ -399,8 +429,10 @@ $.fn.embed = function(parameters) {
|
|
399
429
|
}
|
400
430
|
},
|
401
431
|
error: function() {
|
402
|
-
|
403
|
-
|
432
|
+
if(!settings.silent) {
|
433
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
434
|
+
module.error.apply(console, arguments);
|
435
|
+
}
|
404
436
|
},
|
405
437
|
performance: {
|
406
438
|
log: function(message) {
|
@@ -537,6 +569,7 @@ $.fn.embed.settings = {
|
|
537
569
|
name : 'Embed',
|
538
570
|
namespace : 'embed',
|
539
571
|
|
572
|
+
silent : false,
|
540
573
|
debug : false,
|
541
574
|
verbose : false,
|
542
575
|
performance : true,
|
@@ -598,7 +631,7 @@ $.fn.embed.settings = {
|
|
598
631
|
return {
|
599
632
|
autohide : !settings.brandedUI,
|
600
633
|
autoplay : settings.autoplay,
|
601
|
-
color : settings.
|
634
|
+
color : settings.color || undefined,
|
602
635
|
hq : settings.hd,
|
603
636
|
jsapi : settings.api,
|
604
637
|
modestbranding : !settings.brandedUI
|
@@ -616,7 +649,7 @@ $.fn.embed.settings = {
|
|
616
649
|
api : settings.api,
|
617
650
|
autoplay : settings.autoplay,
|
618
651
|
byline : settings.brandedUI,
|
619
|
-
color : settings.
|
652
|
+
color : settings.color || undefined,
|
620
653
|
portrait : settings.brandedUI,
|
621
654
|
title : settings.brandedUI
|
622
655
|
};
|
@@ -626,8 +659,12 @@ $.fn.embed.settings = {
|
|
626
659
|
|
627
660
|
templates: {
|
628
661
|
iframe : function(url, parameters) {
|
662
|
+
var src = url;
|
663
|
+
if (parameters) {
|
664
|
+
src += '?' + parameters;
|
665
|
+
}
|
629
666
|
return ''
|
630
|
-
+ '<iframe src="' +
|
667
|
+
+ '<iframe src="' + src + '"'
|
631
668
|
+ ' width="100%" height="100%"'
|
632
669
|
+ ' frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
|
633
670
|
;
|
@@ -647,7 +684,7 @@ $.fn.embed.settings = {
|
|
647
684
|
},
|
648
685
|
|
649
686
|
// NOT YET IMPLEMENTED
|
650
|
-
api :
|
687
|
+
api : false,
|
651
688
|
onPause : function() {},
|
652
689
|
onPlay : function() {},
|
653
690
|
onStop : function() {}
|
@@ -3,16 +3,22 @@
|
|
3
3
|
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright 2015 Contributors
|
7
6
|
* Released under the MIT license
|
8
7
|
* http://opensource.org/licenses/MIT
|
9
8
|
*
|
10
9
|
*/
|
11
10
|
|
12
|
-
;(function (
|
11
|
+
;(function ($, window, document, undefined) {
|
13
12
|
|
14
13
|
"use strict";
|
15
14
|
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
16
22
|
$.fn.modal = function(parameters) {
|
17
23
|
var
|
18
24
|
$allModules = $(this),
|
@@ -66,7 +72,7 @@ $.fn.modal = function(parameters) {
|
|
66
72
|
element = this,
|
67
73
|
instance = $module.data(moduleNamespace),
|
68
74
|
|
69
|
-
|
75
|
+
elementEventNamespace,
|
70
76
|
id,
|
71
77
|
observer,
|
72
78
|
module
|
@@ -134,7 +140,7 @@ $.fn.modal = function(parameters) {
|
|
134
140
|
},
|
135
141
|
id: function() {
|
136
142
|
id = (Math.random().toString(16) + '000000000').substr(2,8);
|
137
|
-
|
143
|
+
elementEventNamespace = '.' + id;
|
138
144
|
module.verbose('Creating unique id for element', id);
|
139
145
|
}
|
140
146
|
},
|
@@ -145,7 +151,8 @@ $.fn.modal = function(parameters) {
|
|
145
151
|
.removeData(moduleNamespace)
|
146
152
|
.off(eventNamespace)
|
147
153
|
;
|
148
|
-
$window.off(
|
154
|
+
$window.off(elementEventNamespace);
|
155
|
+
$dimmer.off(elementEventNamespace);
|
149
156
|
$close.off(eventNamespace);
|
150
157
|
$context.dimmer('destroy');
|
151
158
|
},
|
@@ -206,7 +213,7 @@ $.fn.modal = function(parameters) {
|
|
206
213
|
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
207
214
|
;
|
208
215
|
$window
|
209
|
-
.on('resize' +
|
216
|
+
.on('resize' + elementEventNamespace, module.event.resize)
|
210
217
|
;
|
211
218
|
}
|
212
219
|
},
|
@@ -496,7 +503,7 @@ $.fn.modal = function(parameters) {
|
|
496
503
|
clickaway: function() {
|
497
504
|
if(settings.closable) {
|
498
505
|
$dimmer
|
499
|
-
.off('click' +
|
506
|
+
.off('click' + elementEventNamespace)
|
500
507
|
;
|
501
508
|
}
|
502
509
|
},
|
@@ -581,7 +588,7 @@ $.fn.modal = function(parameters) {
|
|
581
588
|
clickaway: function() {
|
582
589
|
if(settings.closable) {
|
583
590
|
$dimmer
|
584
|
-
.on('click' +
|
591
|
+
.on('click' + elementEventNamespace, module.event.click)
|
585
592
|
;
|
586
593
|
}
|
587
594
|
},
|
@@ -645,7 +652,12 @@ $.fn.modal = function(parameters) {
|
|
645
652
|
$.extend(true, settings, name);
|
646
653
|
}
|
647
654
|
else if(value !== undefined) {
|
648
|
-
settings[name]
|
655
|
+
if($.isPlainObject(settings[name])) {
|
656
|
+
$.extend(true, settings[name], value);
|
657
|
+
}
|
658
|
+
else {
|
659
|
+
settings[name] = value;
|
660
|
+
}
|
649
661
|
}
|
650
662
|
else {
|
651
663
|
return settings[name];
|
@@ -663,7 +675,7 @@ $.fn.modal = function(parameters) {
|
|
663
675
|
}
|
664
676
|
},
|
665
677
|
debug: function() {
|
666
|
-
if(settings.debug) {
|
678
|
+
if(!settings.silent && settings.debug) {
|
667
679
|
if(settings.performance) {
|
668
680
|
module.performance.log(arguments);
|
669
681
|
}
|
@@ -674,7 +686,7 @@ $.fn.modal = function(parameters) {
|
|
674
686
|
}
|
675
687
|
},
|
676
688
|
verbose: function() {
|
677
|
-
if(settings.verbose && settings.debug) {
|
689
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
678
690
|
if(settings.performance) {
|
679
691
|
module.performance.log(arguments);
|
680
692
|
}
|
@@ -685,8 +697,10 @@ $.fn.modal = function(parameters) {
|
|
685
697
|
}
|
686
698
|
},
|
687
699
|
error: function() {
|
688
|
-
|
689
|
-
|
700
|
+
if(!settings.silent) {
|
701
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
702
|
+
module.error.apply(console, arguments);
|
703
|
+
}
|
690
704
|
},
|
691
705
|
performance: {
|
692
706
|
log: function(message) {
|
@@ -820,6 +834,7 @@ $.fn.modal.settings = {
|
|
820
834
|
name : 'Modal',
|
821
835
|
namespace : 'modal',
|
822
836
|
|
837
|
+
silent : false,
|
823
838
|
debug : false,
|
824
839
|
verbose : false,
|
825
840
|
performance : true,
|
@@ -3,7 +3,6 @@
|
|
3
3
|
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright 2015 Contributors
|
7
6
|
* Released under the MIT license
|
8
7
|
* http://opensource.org/licenses/MIT
|
9
8
|
*
|
@@ -13,6 +12,13 @@
|
|
13
12
|
|
14
13
|
"use strict";
|
15
14
|
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
16
22
|
$.fn.nag = function(parameters) {
|
17
23
|
var
|
18
24
|
$allModules = $(this),
|
@@ -255,7 +261,12 @@ $.fn.nag = function(parameters) {
|
|
255
261
|
$.extend(true, settings, name);
|
256
262
|
}
|
257
263
|
else if(value !== undefined) {
|
258
|
-
settings[name]
|
264
|
+
if($.isPlainObject(settings[name])) {
|
265
|
+
$.extend(true, settings[name], value);
|
266
|
+
}
|
267
|
+
else {
|
268
|
+
settings[name] = value;
|
269
|
+
}
|
259
270
|
}
|
260
271
|
else {
|
261
272
|
return settings[name];
|
@@ -273,7 +284,7 @@ $.fn.nag = function(parameters) {
|
|
273
284
|
}
|
274
285
|
},
|
275
286
|
debug: function() {
|
276
|
-
if(settings.debug) {
|
287
|
+
if(!settings.silent && settings.debug) {
|
277
288
|
if(settings.performance) {
|
278
289
|
module.performance.log(arguments);
|
279
290
|
}
|
@@ -284,7 +295,7 @@ $.fn.nag = function(parameters) {
|
|
284
295
|
}
|
285
296
|
},
|
286
297
|
verbose: function() {
|
287
|
-
if(settings.verbose && settings.debug) {
|
298
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
288
299
|
if(settings.performance) {
|
289
300
|
module.performance.log(arguments);
|
290
301
|
}
|
@@ -295,8 +306,10 @@ $.fn.nag = function(parameters) {
|
|
295
306
|
}
|
296
307
|
},
|
297
308
|
error: function() {
|
298
|
-
|
299
|
-
|
309
|
+
if(!settings.silent) {
|
310
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
311
|
+
module.error.apply(console, arguments);
|
312
|
+
}
|
300
313
|
},
|
301
314
|
performance: {
|
302
315
|
log: function(message) {
|
@@ -430,13 +443,14 @@ $.fn.nag.settings = {
|
|
430
443
|
|
431
444
|
name : 'Nag',
|
432
445
|
|
446
|
+
silent : false,
|
433
447
|
debug : false,
|
434
448
|
verbose : false,
|
435
449
|
performance : true,
|
436
450
|
|
437
451
|
namespace : 'Nag',
|
438
452
|
|
439
|
-
// allows cookie to be
|
453
|
+
// allows cookie to be overridden
|
440
454
|
persist : false,
|
441
455
|
|
442
456
|
// set to zero to require manually dismissal, otherwise hides on its own
|
@@ -483,4 +497,11 @@ $.fn.nag.settings = {
|
|
483
497
|
|
484
498
|
};
|
485
499
|
|
500
|
+
// Adds easing
|
501
|
+
$.extend( $.easing, {
|
502
|
+
easeOutQuad: function (x, t, b, c, d) {
|
503
|
+
return -c *(t/=d)*(t-2) + b;
|
504
|
+
}
|
505
|
+
});
|
506
|
+
|
486
507
|
})( jQuery, window, document );
|
@@ -3,7 +3,6 @@
|
|
3
3
|
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright 2015 Contributors
|
7
6
|
* Released under the MIT license
|
8
7
|
* http://opensource.org/licenses/MIT
|
9
8
|
*
|
@@ -13,6 +12,13 @@
|
|
13
12
|
|
14
13
|
"use strict";
|
15
14
|
|
15
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
16
|
+
? window
|
17
|
+
: (typeof self != 'undefined' && self.Math == Math)
|
18
|
+
? self
|
19
|
+
: Function('return this')()
|
20
|
+
;
|
21
|
+
|
16
22
|
$.fn.popup = function(parameters) {
|
17
23
|
var
|
18
24
|
$allModules = $(this),
|
@@ -50,6 +56,8 @@ $.fn.popup = function(parameters) {
|
|
50
56
|
|
51
57
|
$module = $(this),
|
52
58
|
$context = $(settings.context),
|
59
|
+
$scrollContext = $(settings.scrollContext),
|
60
|
+
$boundary = $(settings.boundary),
|
53
61
|
$target = (settings.target)
|
54
62
|
? $(settings.target)
|
55
63
|
: $module,
|
@@ -64,6 +72,7 @@ $.fn.popup = function(parameters) {
|
|
64
72
|
element = this,
|
65
73
|
instance = $module.data(moduleNamespace),
|
66
74
|
|
75
|
+
documentObserver,
|
67
76
|
elementNamespace,
|
68
77
|
id,
|
69
78
|
module
|
@@ -76,9 +85,10 @@ $.fn.popup = function(parameters) {
|
|
76
85
|
module.debug('Initializing', $module);
|
77
86
|
module.createID();
|
78
87
|
module.bind.events();
|
79
|
-
if(
|
88
|
+
if(!module.exists() && settings.preserve) {
|
80
89
|
module.create();
|
81
90
|
}
|
91
|
+
module.observeChanges();
|
82
92
|
module.instantiate();
|
83
93
|
},
|
84
94
|
|
@@ -90,6 +100,17 @@ $.fn.popup = function(parameters) {
|
|
90
100
|
;
|
91
101
|
},
|
92
102
|
|
103
|
+
observeChanges: function() {
|
104
|
+
if('MutationObserver' in window) {
|
105
|
+
documentObserver = new MutationObserver(module.event.documentChanged);
|
106
|
+
documentObserver.observe(document, {
|
107
|
+
childList : true,
|
108
|
+
subtree : true
|
109
|
+
});
|
110
|
+
module.debug('Setting up mutation observer', documentObserver);
|
111
|
+
}
|
112
|
+
},
|
113
|
+
|
93
114
|
refresh: function() {
|
94
115
|
if(settings.popup) {
|
95
116
|
$popup = $(settings.popup).eq(0);
|
@@ -136,6 +157,9 @@ $.fn.popup = function(parameters) {
|
|
136
157
|
|
137
158
|
destroy: function() {
|
138
159
|
module.debug('Destroying previous module');
|
160
|
+
if(documentObserver) {
|
161
|
+
documentObserver.disconnect();
|
162
|
+
}
|
139
163
|
// remove element only if was created dynamically
|
140
164
|
if($popup && !settings.preserve) {
|
141
165
|
module.removePopup();
|
@@ -144,9 +168,9 @@ $.fn.popup = function(parameters) {
|
|
144
168
|
clearTimeout(module.hideTimer);
|
145
169
|
clearTimeout(module.showTimer);
|
146
170
|
// remove events
|
147
|
-
|
171
|
+
module.unbind.close();
|
172
|
+
module.unbind.events();
|
148
173
|
$module
|
149
|
-
.off(eventNamespace)
|
150
174
|
.removeData(moduleNamespace)
|
151
175
|
;
|
152
176
|
},
|
@@ -181,9 +205,26 @@ $.fn.popup = function(parameters) {
|
|
181
205
|
module.set.position();
|
182
206
|
}
|
183
207
|
},
|
208
|
+
documentChanged: function(mutations) {
|
209
|
+
[].forEach.call(mutations, function(mutation) {
|
210
|
+
if(mutation.removedNodes) {
|
211
|
+
[].forEach.call(mutation.removedNodes, function(node) {
|
212
|
+
if(node == element || $(node).find(element).length > 0) {
|
213
|
+
module.debug('Element removed from DOM, tearing down events');
|
214
|
+
module.destroy();
|
215
|
+
}
|
216
|
+
});
|
217
|
+
}
|
218
|
+
});
|
219
|
+
},
|
184
220
|
hideGracefully: function(event) {
|
221
|
+
var
|
222
|
+
$target = $(event.target),
|
223
|
+
isInDOM = $.contains(document.documentElement, event.target),
|
224
|
+
inPopup = ($target.closest(selector.popup).length > 0)
|
225
|
+
;
|
185
226
|
// don't close on clicks inside popup
|
186
|
-
if(event &&
|
227
|
+
if(event && !inPopup && isInDOM) {
|
187
228
|
module.debug('Click occurred outside popup hiding popup');
|
188
229
|
module.hide();
|
189
230
|
}
|
@@ -237,7 +278,7 @@ $.fn.popup = function(parameters) {
|
|
237
278
|
else if($target.next(selector.popup).length !== 0) {
|
238
279
|
module.verbose('Pre-existing popup found');
|
239
280
|
settings.inline = true;
|
240
|
-
settings.
|
281
|
+
settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
|
241
282
|
module.refresh();
|
242
283
|
if(settings.hoverable) {
|
243
284
|
module.bind.popup();
|
@@ -257,7 +298,7 @@ $.fn.popup = function(parameters) {
|
|
257
298
|
},
|
258
299
|
|
259
300
|
createID: function() {
|
260
|
-
id = (Math.random().toString(16) + '000000000').substr(2,8);
|
301
|
+
id = (Math.random().toString(16) + '000000000').substr(2, 8);
|
261
302
|
elementNamespace = '.' + id;
|
262
303
|
module.verbose('Creating unique id for element', id);
|
263
304
|
},
|
@@ -321,7 +362,7 @@ $.fn.popup = function(parameters) {
|
|
321
362
|
.each(function() {
|
322
363
|
$(this)
|
323
364
|
.data(metadata.activator)
|
324
|
-
|
365
|
+
.popup('hide')
|
325
366
|
;
|
326
367
|
})
|
327
368
|
;
|
@@ -370,6 +411,11 @@ $.fn.popup = function(parameters) {
|
|
370
411
|
return true;
|
371
412
|
}
|
372
413
|
},
|
414
|
+
supports: {
|
415
|
+
svg: function() {
|
416
|
+
return (typeof SVGGraphicsElement === undefined);
|
417
|
+
}
|
418
|
+
},
|
373
419
|
animate: {
|
374
420
|
show: function(callback) {
|
375
421
|
callback = $.isFunction(callback) ? callback : function(){};
|
@@ -454,11 +500,18 @@ $.fn.popup = function(parameters) {
|
|
454
500
|
},
|
455
501
|
calculations: function() {
|
456
502
|
var
|
457
|
-
targetElement
|
458
|
-
|
503
|
+
targetElement = $target[0],
|
504
|
+
isWindow = ($boundary[0] == window),
|
505
|
+
targetPosition = (settings.inline || (settings.popup && settings.movePopup))
|
459
506
|
? $target.position()
|
460
507
|
: $target.offset(),
|
461
|
-
|
508
|
+
screenPosition = (isWindow)
|
509
|
+
? { top: 0, left: 0 }
|
510
|
+
: $boundary.offset(),
|
511
|
+
calculations = {},
|
512
|
+
scroll = (isWindow)
|
513
|
+
? { top: $window.scrollTop(), left: $window.scrollLeft() }
|
514
|
+
: { top: 0, left: 0},
|
462
515
|
screen
|
463
516
|
;
|
464
517
|
calculations = {
|
@@ -483,12 +536,14 @@ $.fn.popup = function(parameters) {
|
|
483
536
|
},
|
484
537
|
// screen boundaries
|
485
538
|
screen : {
|
539
|
+
top : screenPosition.top,
|
540
|
+
left : screenPosition.left,
|
486
541
|
scroll: {
|
487
|
-
top :
|
488
|
-
left :
|
542
|
+
top : scroll.top,
|
543
|
+
left : scroll.left
|
489
544
|
},
|
490
|
-
width : $
|
491
|
-
height : $
|
545
|
+
width : $boundary.width(),
|
546
|
+
height : $boundary.height()
|
492
547
|
}
|
493
548
|
};
|
494
549
|
|
@@ -508,16 +563,16 @@ $.fn.popup = function(parameters) {
|
|
508
563
|
calculations.target.margin.left = (settings.inline)
|
509
564
|
? module.is.rtl()
|
510
565
|
? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-right'), 10)
|
511
|
-
: parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-left')
|
566
|
+
: parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10)
|
512
567
|
: 0
|
513
568
|
;
|
514
569
|
// calculate screen boundaries
|
515
570
|
screen = calculations.screen;
|
516
571
|
calculations.boundary = {
|
517
|
-
top : screen.scroll.top,
|
518
|
-
bottom : screen.scroll.top + screen.height,
|
519
|
-
left : screen.scroll.left,
|
520
|
-
right : screen.scroll.left + screen.width
|
572
|
+
top : screen.top + screen.scroll.top,
|
573
|
+
bottom : screen.top + screen.scroll.top + screen.height,
|
574
|
+
left : screen.left + screen.scroll.left,
|
575
|
+
right : screen.left + screen.scroll.left + screen.width
|
521
576
|
};
|
522
577
|
return calculations;
|
523
578
|
},
|
@@ -551,7 +606,6 @@ $.fn.popup = function(parameters) {
|
|
551
606
|
popup,
|
552
607
|
boundary
|
553
608
|
;
|
554
|
-
offset = offset || module.get.offset();
|
555
609
|
calculations = calculations || module.get.calculations();
|
556
610
|
|
557
611
|
// shorthand
|
@@ -697,7 +751,7 @@ $.fn.popup = function(parameters) {
|
|
697
751
|
popup = calculations.popup;
|
698
752
|
parent = calculations.parent;
|
699
753
|
|
700
|
-
if(target.width === 0 && target.height === 0 && !(target.element
|
754
|
+
if(target.width === 0 && target.height === 0 && !module.is.svg(target.element)) {
|
701
755
|
module.debug('Popup target is hidden, no action taken');
|
702
756
|
return false;
|
703
757
|
}
|
@@ -929,11 +983,8 @@ $.fn.popup = function(parameters) {
|
|
929
983
|
}
|
930
984
|
},
|
931
985
|
close: function() {
|
932
|
-
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click'))
|
933
|
-
$
|
934
|
-
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully)
|
935
|
-
;
|
936
|
-
$context
|
986
|
+
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) {
|
987
|
+
$scrollContext
|
937
988
|
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully)
|
938
989
|
;
|
939
990
|
}
|
@@ -959,28 +1010,22 @@ $.fn.popup = function(parameters) {
|
|
959
1010
|
},
|
960
1011
|
|
961
1012
|
unbind: {
|
1013
|
+
events: function() {
|
1014
|
+
$window
|
1015
|
+
.off(elementNamespace)
|
1016
|
+
;
|
1017
|
+
$module
|
1018
|
+
.off(eventNamespace)
|
1019
|
+
;
|
1020
|
+
},
|
962
1021
|
close: function() {
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
}
|
971
|
-
if(settings.on == 'hover' && openedWithTouch) {
|
972
|
-
$document
|
973
|
-
.off('touchstart' + elementNamespace)
|
974
|
-
;
|
975
|
-
openedWithTouch = false;
|
976
|
-
}
|
977
|
-
if(settings.on == 'click' && settings.closable) {
|
978
|
-
module.verbose('Removing close event from document');
|
979
|
-
$document
|
980
|
-
.off('click' + elementNamespace)
|
981
|
-
;
|
982
|
-
}
|
983
|
-
}
|
1022
|
+
$document
|
1023
|
+
.off(elementNamespace)
|
1024
|
+
;
|
1025
|
+
$scrollContext
|
1026
|
+
.off(elementNamespace)
|
1027
|
+
;
|
1028
|
+
},
|
984
1029
|
},
|
985
1030
|
|
986
1031
|
has: {
|
@@ -1008,6 +1053,9 @@ $.fn.popup = function(parameters) {
|
|
1008
1053
|
return false;
|
1009
1054
|
}
|
1010
1055
|
},
|
1056
|
+
svg: function(element) {
|
1057
|
+
return module.supports.svg() && (element instanceof SVGGraphicsElement);
|
1058
|
+
},
|
1011
1059
|
active: function() {
|
1012
1060
|
return $module.hasClass(className.active);
|
1013
1061
|
},
|
@@ -1068,7 +1116,7 @@ $.fn.popup = function(parameters) {
|
|
1068
1116
|
}
|
1069
1117
|
},
|
1070
1118
|
debug: function() {
|
1071
|
-
if(settings.debug) {
|
1119
|
+
if(!settings.silent && settings.debug) {
|
1072
1120
|
if(settings.performance) {
|
1073
1121
|
module.performance.log(arguments);
|
1074
1122
|
}
|
@@ -1079,7 +1127,7 @@ $.fn.popup = function(parameters) {
|
|
1079
1127
|
}
|
1080
1128
|
},
|
1081
1129
|
verbose: function() {
|
1082
|
-
if(settings.verbose && settings.debug) {
|
1130
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
1083
1131
|
if(settings.performance) {
|
1084
1132
|
module.performance.log(arguments);
|
1085
1133
|
}
|
@@ -1090,8 +1138,10 @@ $.fn.popup = function(parameters) {
|
|
1090
1138
|
}
|
1091
1139
|
},
|
1092
1140
|
error: function() {
|
1093
|
-
|
1094
|
-
|
1141
|
+
if(!settings.silent) {
|
1142
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
1143
|
+
module.error.apply(console, arguments);
|
1144
|
+
}
|
1095
1145
|
},
|
1096
1146
|
performance: {
|
1097
1147
|
log: function(message) {
|
@@ -1222,46 +1272,53 @@ $.fn.popup = function(parameters) {
|
|
1222
1272
|
|
1223
1273
|
$.fn.popup.settings = {
|
1224
1274
|
|
1225
|
-
name
|
1275
|
+
name : 'Popup',
|
1226
1276
|
|
1227
1277
|
// module settings
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1278
|
+
silent : false,
|
1279
|
+
debug : false,
|
1280
|
+
verbose : false,
|
1281
|
+
performance : true,
|
1282
|
+
namespace : 'popup',
|
1283
|
+
|
1284
|
+
// whether it should use dom mutation observers
|
1285
|
+
observeChanges : true,
|
1232
1286
|
|
1233
1287
|
// callback only when element added to dom
|
1234
|
-
onCreate
|
1288
|
+
onCreate : function(){},
|
1235
1289
|
|
1236
1290
|
// callback before element removed from dom
|
1237
|
-
onRemove
|
1291
|
+
onRemove : function(){},
|
1238
1292
|
|
1239
1293
|
// callback before show animation
|
1240
|
-
onShow
|
1294
|
+
onShow : function(){},
|
1241
1295
|
|
1242
1296
|
// callback after show animation
|
1243
|
-
onVisible
|
1297
|
+
onVisible : function(){},
|
1244
1298
|
|
1245
1299
|
// callback before hide animation
|
1246
|
-
onHide
|
1300
|
+
onHide : function(){},
|
1247
1301
|
|
1248
1302
|
// callback when popup cannot be positioned in visible screen
|
1249
|
-
onUnplaceable: function(){},
|
1303
|
+
onUnplaceable : function(){},
|
1250
1304
|
|
1251
1305
|
// callback after hide animation
|
1252
|
-
onHidden
|
1306
|
+
onHidden : function(){},
|
1253
1307
|
|
1254
1308
|
// when to show popup
|
1255
|
-
on
|
1309
|
+
on : 'hover',
|
1310
|
+
|
1311
|
+
// element to use to determine if popup is out of boundary
|
1312
|
+
boundary : window,
|
1256
1313
|
|
1257
1314
|
// whether to add touchstart events when using hover
|
1258
1315
|
addTouchEvents : true,
|
1259
1316
|
|
1260
1317
|
// default position relative to element
|
1261
|
-
position
|
1318
|
+
position : 'top left',
|
1262
1319
|
|
1263
1320
|
// name of variation to use
|
1264
|
-
variation
|
1321
|
+
variation : '',
|
1265
1322
|
|
1266
1323
|
// whether popup should be moved to context
|
1267
1324
|
movePopup : true,
|
@@ -1282,31 +1339,34 @@ $.fn.popup.settings = {
|
|
1282
1339
|
hoverable : false,
|
1283
1340
|
|
1284
1341
|
// explicitly set content
|
1285
|
-
content
|
1342
|
+
content : false,
|
1286
1343
|
|
1287
1344
|
// explicitly set html
|
1288
|
-
html
|
1345
|
+
html : false,
|
1289
1346
|
|
1290
1347
|
// explicitly set title
|
1291
|
-
title
|
1348
|
+
title : false,
|
1292
1349
|
|
1293
1350
|
// whether automatically close on clickaway when on click
|
1294
|
-
closable
|
1351
|
+
closable : true,
|
1295
1352
|
|
1296
1353
|
// automatically hide on scroll
|
1297
|
-
hideOnScroll
|
1354
|
+
hideOnScroll : 'auto',
|
1298
1355
|
|
1299
1356
|
// hide other popups on show
|
1300
|
-
exclusive
|
1357
|
+
exclusive : false,
|
1301
1358
|
|
1302
1359
|
// context to attach popups
|
1303
|
-
context
|
1360
|
+
context : 'body',
|
1361
|
+
|
1362
|
+
// context for binding scroll events
|
1363
|
+
scrollContext : window,
|
1304
1364
|
|
1305
1365
|
// position to prefer when calculating new position
|
1306
|
-
prefer
|
1366
|
+
prefer : 'opposite',
|
1307
1367
|
|
1308
1368
|
// specify position to appear even if it doesn't fit
|
1309
|
-
lastResort
|
1369
|
+
lastResort : false,
|
1310
1370
|
|
1311
1371
|
// delay used to prevent accidental refiring of animations due to user error
|
1312
1372
|
delay : {
|