fomantic-ui 2.10.0-beta.6 → 2.10.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -10
- package/README.md +4 -5
- package/changelog-setup.js +64 -70
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +94 -131
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +152 -205
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +305 -341
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +76 -116
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +58 -91
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +674 -977
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +80 -127
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +192 -274
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +325 -429
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +221 -313
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +67 -97
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +185 -254
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +103 -138
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +89 -139
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +253 -352
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +157 -223
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +122 -163
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +242 -325
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +68 -98
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +116 -159
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +168 -233
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +99 -132
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +86 -141
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +134 -210
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +4100 -5721
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/gulpfile.js +5 -7
- package/package.json +1 -1
- package/scripts/nightly-version.js +7 -10
- package/src/definitions/behaviors/api.js +151 -204
- package/src/definitions/behaviors/form.js +324 -428
- package/src/definitions/behaviors/state.js +67 -97
- package/src/definitions/behaviors/visibility.js +133 -209
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +93 -130
- package/src/definitions/modules/calendar.js +304 -340
- package/src/definitions/modules/checkbox.js +75 -115
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +673 -976
- package/src/definitions/modules/embed.js +79 -126
- package/src/definitions/modules/flyout.js +191 -273
- package/src/definitions/modules/modal.js +220 -312
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +184 -253
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +88 -138
- package/src/definitions/modules/search.js +252 -351
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +121 -162
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +115 -158
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +98 -131
- package/src/definitions/modules/transition.js +85 -140
- package/tasks/admin/components/create.js +88 -108
- package/tasks/admin/components/init.js +26 -32
- package/tasks/admin/components/update.js +46 -53
- package/tasks/admin/distributions/create.js +71 -101
- package/tasks/admin/distributions/init.js +27 -33
- package/tasks/admin/distributions/update.js +45 -52
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +54 -63
- package/tasks/build/javascript.js +45 -53
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -7
- package/tasks/clean.js +2 -4
- package/tasks/collections/admin.js +13 -15
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +2 -4
- package/tasks/collections/install.js +2 -4
- package/tasks/collections/rtl.js +2 -4
- package/tasks/collections/various.js +2 -4
- package/tasks/config/admin/github.js +7 -9
- package/tasks/config/admin/templates/css-package.js +1 -3
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +22 -30
- package/tasks/config/project/install.js +56 -70
- package/tasks/config/project/release.js +6 -8
- package/tasks/config/tasks.js +8 -12
- package/tasks/config/user.js +13 -17
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +24 -30
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +71 -98
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
package/dist/components/popup.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.8+62e258f - Popup
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,74 +20,70 @@
|
|
20
20
|
: globalThis;
|
21
21
|
|
22
22
|
$.fn.popup = function (parameters) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
47
|
-
}
|
23
|
+
let $allModules = $(this);
|
24
|
+
let $document = $(document);
|
25
|
+
let $window = $(window);
|
26
|
+
let $body = $('body');
|
27
|
+
|
28
|
+
let clickEvent = 'ontouchstart' in document.documentElement
|
29
|
+
? 'touchstart'
|
30
|
+
: 'click';
|
31
|
+
|
32
|
+
let time = Date.now();
|
33
|
+
let performance = [];
|
34
|
+
|
35
|
+
let query = arguments[0];
|
36
|
+
let methodInvoked = typeof query === 'string';
|
37
|
+
let queryArguments = [].slice.call(arguments, 1);
|
38
|
+
let contextCheck = function (context, win) {
|
39
|
+
let $context;
|
40
|
+
if ([window, document].indexOf(context) >= 0) {
|
41
|
+
$context = $(context);
|
42
|
+
} else {
|
43
|
+
$context = $(win.document).find(context);
|
44
|
+
if ($context.length === 0) {
|
45
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
48
46
|
}
|
47
|
+
}
|
49
48
|
|
50
|
-
|
51
|
-
|
49
|
+
return $context;
|
50
|
+
};
|
52
51
|
|
53
|
-
|
54
|
-
;
|
52
|
+
let returnedValue;
|
55
53
|
$allModules.each(function () {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
module
|
90
|
-
;
|
54
|
+
let settings = $.isPlainObject(parameters)
|
55
|
+
? $.extend(true, {}, $.fn.popup.settings, parameters)
|
56
|
+
: $.extend({}, $.fn.popup.settings);
|
57
|
+
|
58
|
+
let selector = settings.selector;
|
59
|
+
let className = settings.className;
|
60
|
+
let error = settings.error;
|
61
|
+
let metadata = settings.metadata;
|
62
|
+
let namespace = settings.namespace;
|
63
|
+
|
64
|
+
let eventNamespace = '.' + settings.namespace;
|
65
|
+
let moduleNamespace = 'module-' + namespace;
|
66
|
+
|
67
|
+
let $module = $(this);
|
68
|
+
let $context = contextCheck(settings.context, window);
|
69
|
+
let $scrollContext = contextCheck(settings.scrollContext, window);
|
70
|
+
let $boundary = contextCheck(settings.boundary, window);
|
71
|
+
let $target = settings.target ? contextCheck(settings.target, window) : $module;
|
72
|
+
|
73
|
+
let $popup;
|
74
|
+
let $offsetParent;
|
75
|
+
|
76
|
+
let searchDepth = 0;
|
77
|
+
let triedPositions = false;
|
78
|
+
let openedWithTouch = false;
|
79
|
+
|
80
|
+
let element = this;
|
81
|
+
let instance = $module.data(moduleNamespace);
|
82
|
+
|
83
|
+
let documentObserver;
|
84
|
+
let elementNamespace;
|
85
|
+
let id;
|
86
|
+
let module;
|
91
87
|
|
92
88
|
module = {
|
93
89
|
|
@@ -109,8 +105,7 @@
|
|
109
105
|
module.verbose('Storing instance', module);
|
110
106
|
instance = module;
|
111
107
|
$module
|
112
|
-
.data(moduleNamespace, instance)
|
113
|
-
;
|
108
|
+
.data(moduleNamespace, instance);
|
114
109
|
},
|
115
110
|
|
116
111
|
observeChanges: function () {
|
@@ -141,8 +136,7 @@
|
|
141
136
|
module.debug('Moving popup to the same offset parent as target');
|
142
137
|
$popup
|
143
138
|
.detach()
|
144
|
-
.appendTo($offsetParent)
|
145
|
-
;
|
139
|
+
.appendTo($offsetParent);
|
146
140
|
}
|
147
141
|
} else {
|
148
142
|
$offsetParent = settings.inline
|
@@ -181,17 +175,14 @@
|
|
181
175
|
module.unbind.close();
|
182
176
|
module.unbind.events();
|
183
177
|
$module
|
184
|
-
.removeData(moduleNamespace)
|
185
|
-
;
|
178
|
+
.removeData(moduleNamespace);
|
186
179
|
},
|
187
180
|
|
188
181
|
event: {
|
189
182
|
start: function (event) {
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
: settings.delay
|
194
|
-
;
|
183
|
+
let delay = $.isPlainObject(settings.delay)
|
184
|
+
? settings.delay.show
|
185
|
+
: settings.delay;
|
195
186
|
clearTimeout(module.hideTimer);
|
196
187
|
if (!openedWithTouch || (openedWithTouch && settings.addTouchEvents)) {
|
197
188
|
module.showTimer = setTimeout(function () {
|
@@ -200,11 +191,9 @@
|
|
200
191
|
}
|
201
192
|
},
|
202
193
|
end: function () {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
: settings.delay
|
207
|
-
;
|
194
|
+
let delay = $.isPlainObject(settings.delay)
|
195
|
+
? settings.delay.hide
|
196
|
+
: settings.delay;
|
208
197
|
clearTimeout(module.showTimer);
|
209
198
|
module.hideTimer = setTimeout(function () {
|
210
199
|
module.hide();
|
@@ -234,11 +223,9 @@
|
|
234
223
|
});
|
235
224
|
},
|
236
225
|
hideGracefully: function (event) {
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
inPopup = $target.closest(selector.popup).length > 0
|
241
|
-
;
|
226
|
+
let $target = $(event.target);
|
227
|
+
let isInDOM = $.contains(document.documentElement, event.target);
|
228
|
+
let inPopup = $target.closest(selector.popup).length > 0;
|
242
229
|
// don't close on clicks inside popup
|
243
230
|
if (event && !inPopup && isInDOM) {
|
244
231
|
module.debug('Click occurred outside popup hiding popup');
|
@@ -251,13 +238,11 @@
|
|
251
238
|
|
252
239
|
// generates popup html from metadata
|
253
240
|
create: function () {
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
content = module.get.content(contentFallback)
|
260
|
-
;
|
241
|
+
let targetSibling = $target.next(selector.popup);
|
242
|
+
let contentFallback = !settings.popup && targetSibling.length === 0 ? $module.attr('title') : false;
|
243
|
+
let html = module.get.html();
|
244
|
+
let title = module.get.title();
|
245
|
+
let content = module.get.content(contentFallback);
|
261
246
|
|
262
247
|
if (html || content || title) {
|
263
248
|
module.debug('Creating pop-up html');
|
@@ -270,18 +255,15 @@
|
|
270
255
|
$popup = $('<div/>')
|
271
256
|
.addClass(className.popup)
|
272
257
|
.data(metadata.activator, $module)
|
273
|
-
.html(html)
|
274
|
-
;
|
258
|
+
.html(html);
|
275
259
|
if (settings.inline) {
|
276
260
|
module.verbose('Inserting popup element inline', $popup);
|
277
261
|
$popup
|
278
|
-
.insertAfter($module)
|
279
|
-
;
|
262
|
+
.insertAfter($module);
|
280
263
|
} else {
|
281
264
|
module.verbose('Appending popup element to body', $popup);
|
282
265
|
$popup
|
283
|
-
.appendTo($context)
|
284
|
-
;
|
266
|
+
.appendTo($context);
|
285
267
|
}
|
286
268
|
module.refresh();
|
287
269
|
module.set.variation();
|
@@ -375,10 +357,8 @@
|
|
375
357
|
.each(function () {
|
376
358
|
$(this)
|
377
359
|
.data(metadata.activator)
|
378
|
-
.popup('hide')
|
379
|
-
|
380
|
-
})
|
381
|
-
;
|
360
|
+
.popup('hide');
|
361
|
+
});
|
382
362
|
},
|
383
363
|
exists: function () {
|
384
364
|
if (!$popup) {
|
@@ -444,8 +424,7 @@
|
|
444
424
|
callback.call($popup, element);
|
445
425
|
settings.onVisible.call($popup, element);
|
446
426
|
},
|
447
|
-
})
|
448
|
-
;
|
427
|
+
});
|
449
428
|
}
|
450
429
|
},
|
451
430
|
hide: function (callback) {
|
@@ -465,8 +444,7 @@
|
|
465
444
|
callback.call($popup, element);
|
466
445
|
settings.onHidden.call($popup, element);
|
467
446
|
},
|
468
|
-
})
|
469
|
-
;
|
447
|
+
});
|
470
448
|
} else {
|
471
449
|
module.error(error.noTransition);
|
472
450
|
}
|
@@ -507,23 +485,21 @@
|
|
507
485
|
return $popup.offset();
|
508
486
|
},
|
509
487
|
calculations: function () {
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
screen
|
526
|
-
;
|
488
|
+
let $popupOffsetParent = module.get.offsetParent($popup);
|
489
|
+
let targetElement = $target[0];
|
490
|
+
let isWindowEl = $boundary[0] === window;
|
491
|
+
let targetOffset = $target.offset();
|
492
|
+
let parentOffset = settings.inline || (settings.popup && settings.movePopup)
|
493
|
+
? $target.offsetParent().offset()
|
494
|
+
: { top: 0, left: 0 };
|
495
|
+
let screenPosition = isWindowEl
|
496
|
+
? { top: 0, left: 0 }
|
497
|
+
: $boundary.offset();
|
498
|
+
let calculations = {};
|
499
|
+
let scroll = isWindowEl
|
500
|
+
? { top: $window.scrollTop(), left: $window.scrollLeft() }
|
501
|
+
: { top: 0, left: 0 };
|
502
|
+
let screen;
|
527
503
|
calculations = {
|
528
504
|
// element which is launching popup
|
529
505
|
target: {
|
@@ -559,9 +535,7 @@
|
|
559
535
|
|
560
536
|
// if popup offset context is different from target, then adjust calculations
|
561
537
|
if ($popupOffsetParent[0] !== $offsetParent[0]) {
|
562
|
-
|
563
|
-
popupOffset = $popupOffsetParent.offset()
|
564
|
-
;
|
538
|
+
let popupOffset = $popupOffsetParent.offset();
|
565
539
|
calculations.target.top -= popupOffset.top;
|
566
540
|
calculations.target.left -= popupOffset.left;
|
567
541
|
calculations.parent.width = $popupOffsetParent.outerWidth();
|
@@ -623,11 +597,9 @@
|
|
623
597
|
return false;
|
624
598
|
},
|
625
599
|
distanceFromBoundary: function (offset, calculations) {
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
boundary
|
630
|
-
;
|
600
|
+
let distanceFromBoundary = {};
|
601
|
+
let popup;
|
602
|
+
let boundary;
|
631
603
|
calculations = calculations || module.get.calculations();
|
632
604
|
|
633
605
|
// shorthand
|
@@ -647,19 +619,15 @@
|
|
647
619
|
return distanceFromBoundary;
|
648
620
|
},
|
649
621
|
offsetParent: function ($element) {
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
$node = $(parentNode)
|
656
|
-
;
|
622
|
+
let element = $element !== undefined
|
623
|
+
? $element[0]
|
624
|
+
: $target[0];
|
625
|
+
let parentNode = element.parentNode;
|
626
|
+
let $node = $(parentNode);
|
657
627
|
if (parentNode) {
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
isBody = $node.is('body')
|
662
|
-
;
|
628
|
+
let is2D = $node.css('transform') === 'none';
|
629
|
+
let isStatic = $node.css('position') === 'static';
|
630
|
+
let isBody = $node.is('body');
|
663
631
|
while (parentNode && !isBody && isStatic && is2D) {
|
664
632
|
parentNode = parentNode.parentNode;
|
665
633
|
$node = $(parentNode);
|
@@ -686,36 +654,34 @@
|
|
686
654
|
};
|
687
655
|
},
|
688
656
|
nextPosition: function (position) {
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
nextPosition = false
|
718
|
-
;
|
657
|
+
let positions = position.split(' ');
|
658
|
+
let verticalPosition = positions[0];
|
659
|
+
let horizontalPosition = positions[1];
|
660
|
+
let opposite = {
|
661
|
+
top: 'bottom',
|
662
|
+
bottom: 'top',
|
663
|
+
left: 'right',
|
664
|
+
right: 'left',
|
665
|
+
};
|
666
|
+
let adjacent = {
|
667
|
+
left: 'center',
|
668
|
+
center: 'right',
|
669
|
+
right: 'left',
|
670
|
+
};
|
671
|
+
let backup = {
|
672
|
+
'top left': 'top center',
|
673
|
+
'top center': 'top right',
|
674
|
+
'top right': 'right center',
|
675
|
+
'right center': 'bottom right',
|
676
|
+
'bottom right': 'bottom center',
|
677
|
+
'bottom center': 'bottom left',
|
678
|
+
'bottom left': 'left center',
|
679
|
+
'left center': 'top left',
|
680
|
+
};
|
681
|
+
let adjacentsAvailable = verticalPosition === 'top' || verticalPosition === 'bottom';
|
682
|
+
let oppositeTried = false;
|
683
|
+
let adjacentTried = false;
|
684
|
+
let nextPosition = false;
|
719
685
|
if (!triedPositions) {
|
720
686
|
module.verbose('All available positions available');
|
721
687
|
triedPositions = module.get.positions();
|
@@ -753,16 +719,14 @@
|
|
753
719
|
|
754
720
|
return;
|
755
721
|
}
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
distanceFromBoundary
|
765
|
-
;
|
722
|
+
let offset;
|
723
|
+
let distanceAway;
|
724
|
+
let target;
|
725
|
+
let popup;
|
726
|
+
let parent;
|
727
|
+
let positioning;
|
728
|
+
let popupOffset;
|
729
|
+
let distanceFromBoundary;
|
766
730
|
|
767
731
|
calculations = calculations || module.get.calculations();
|
768
732
|
position = position || $module.data(metadata.position) || settings.position;
|
@@ -915,8 +879,7 @@
|
|
915
879
|
$popup
|
916
880
|
.css(positioning)
|
917
881
|
.removeClass(className.position)
|
918
|
-
.addClass(position)
|
919
|
-
;
|
882
|
+
.addClass(position);
|
920
883
|
module.set.invisible();
|
921
884
|
|
922
885
|
popupOffset = module.get.popupOffset();
|
@@ -1014,19 +977,16 @@
|
|
1014
977
|
module.debug('Binding popup events to module');
|
1015
978
|
if (settings.on === 'click') {
|
1016
979
|
$module
|
1017
|
-
.on(clickEvent + eventNamespace, module.toggle)
|
1018
|
-
;
|
980
|
+
.on(clickEvent + eventNamespace, module.toggle);
|
1019
981
|
}
|
1020
982
|
if (settings.on === 'hover') {
|
1021
983
|
$module
|
1022
|
-
.on('touchstart' + eventNamespace, module.event.touchstart)
|
1023
|
-
;
|
984
|
+
.on('touchstart' + eventNamespace, module.event.touchstart);
|
1024
985
|
}
|
1025
986
|
if (module.get.startEvent()) {
|
1026
987
|
$module
|
1027
988
|
.on(module.get.startEvent() + eventNamespace, module.event.start)
|
1028
|
-
.on(module.get.endEvent() + eventNamespace, module.event.end)
|
1029
|
-
;
|
989
|
+
.on(module.get.endEvent() + eventNamespace, module.event.end);
|
1030
990
|
}
|
1031
991
|
if (settings.target) {
|
1032
992
|
module.debug('Target set to element', $target);
|
@@ -1038,8 +998,7 @@
|
|
1038
998
|
if ($popup && module.has.popup()) {
|
1039
999
|
$popup
|
1040
1000
|
.on('mouseenter' + eventNamespace, module.event.start)
|
1041
|
-
.on('mouseleave' + eventNamespace, module.event.end)
|
1042
|
-
;
|
1001
|
+
.on('mouseleave' + eventNamespace, module.event.end);
|
1043
1002
|
}
|
1044
1003
|
},
|
1045
1004
|
close: function () {
|
@@ -1055,8 +1014,7 @@
|
|
1055
1014
|
closeOnScroll: function () {
|
1056
1015
|
module.verbose('Binding scroll close event to document');
|
1057
1016
|
$scrollContext
|
1058
|
-
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully)
|
1059
|
-
;
|
1017
|
+
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully);
|
1060
1018
|
},
|
1061
1019
|
touchClose: function () {
|
1062
1020
|
module.verbose('Binding popup touchclose event to document');
|
@@ -1064,8 +1022,7 @@
|
|
1064
1022
|
.on('touchstart' + elementNamespace, function (event) {
|
1065
1023
|
module.verbose('Touched away from popup');
|
1066
1024
|
module.event.hideGracefully.call(element, event);
|
1067
|
-
})
|
1068
|
-
;
|
1025
|
+
});
|
1069
1026
|
},
|
1070
1027
|
clickaway: function () {
|
1071
1028
|
module.verbose('Binding popup close event to document');
|
@@ -1073,27 +1030,22 @@
|
|
1073
1030
|
.on(clickEvent + elementNamespace, function (event) {
|
1074
1031
|
module.verbose('Clicked away from popup');
|
1075
1032
|
module.event.hideGracefully.call(element, event);
|
1076
|
-
})
|
1077
|
-
;
|
1033
|
+
});
|
1078
1034
|
},
|
1079
1035
|
},
|
1080
1036
|
|
1081
1037
|
unbind: {
|
1082
1038
|
events: function () {
|
1083
1039
|
$window
|
1084
|
-
.off(elementNamespace)
|
1085
|
-
;
|
1040
|
+
.off(elementNamespace);
|
1086
1041
|
$module
|
1087
|
-
.off(eventNamespace)
|
1088
|
-
;
|
1042
|
+
.off(eventNamespace);
|
1089
1043
|
},
|
1090
1044
|
close: function () {
|
1091
1045
|
$document
|
1092
|
-
.off(elementNamespace)
|
1093
|
-
;
|
1046
|
+
.off(elementNamespace);
|
1094
1047
|
$scrollContext
|
1095
|
-
.off(elementNamespace)
|
1096
|
-
;
|
1048
|
+
.off(elementNamespace);
|
1097
1049
|
},
|
1098
1050
|
},
|
1099
1051
|
|
@@ -1129,9 +1081,7 @@
|
|
1129
1081
|
return settings.closable;
|
1130
1082
|
},
|
1131
1083
|
offstage: function (distanceFromBoundary, position) {
|
1132
|
-
|
1133
|
-
offstage = []
|
1134
|
-
;
|
1084
|
+
let offstage = [];
|
1135
1085
|
// return boundaries that have been surpassed
|
1136
1086
|
$.each(distanceFromBoundary, function (direction, distance) {
|
1137
1087
|
if (distance < -settings.jitter) {
|
@@ -1176,8 +1126,7 @@
|
|
1176
1126
|
if (settings.preserve) {
|
1177
1127
|
if ($.fn.transition !== undefined) {
|
1178
1128
|
$popup
|
1179
|
-
.transition('remove transition')
|
1180
|
-
;
|
1129
|
+
.transition('remove transition');
|
1181
1130
|
}
|
1182
1131
|
} else {
|
1183
1132
|
module.removePopup();
|
@@ -1230,11 +1179,9 @@
|
|
1230
1179
|
},
|
1231
1180
|
performance: {
|
1232
1181
|
log: function (message) {
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
previousTime
|
1237
|
-
;
|
1182
|
+
let currentTime;
|
1183
|
+
let executionTime;
|
1184
|
+
let previousTime;
|
1238
1185
|
if (settings.performance) {
|
1239
1186
|
currentTime = Date.now();
|
1240
1187
|
previousTime = time || currentTime;
|
@@ -1253,10 +1200,8 @@
|
|
1253
1200
|
}, 500);
|
1254
1201
|
},
|
1255
1202
|
display: function () {
|
1256
|
-
|
1257
|
-
|
1258
|
-
totalTime = 0
|
1259
|
-
;
|
1203
|
+
let title = settings.name + ':';
|
1204
|
+
let totalTime = 0;
|
1260
1205
|
time = false;
|
1261
1206
|
clearTimeout(module.performance.timer);
|
1262
1207
|
$.each(performance, function (index, data) {
|
@@ -1278,22 +1223,19 @@
|
|
1278
1223
|
},
|
1279
1224
|
},
|
1280
1225
|
invoke: function (query, passedArguments, context) {
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
response
|
1286
|
-
;
|
1226
|
+
let object = instance;
|
1227
|
+
let maxDepth;
|
1228
|
+
let found;
|
1229
|
+
let response;
|
1287
1230
|
passedArguments = passedArguments || queryArguments;
|
1288
1231
|
context = context || element;
|
1289
1232
|
if (typeof query === 'string' && object !== undefined) {
|
1290
1233
|
query = query.split(/[ .]/);
|
1291
1234
|
maxDepth = query.length - 1;
|
1292
1235
|
$.each(query, function (depth, value) {
|
1293
|
-
|
1236
|
+
let camelCaseValue = depth !== maxDepth
|
1294
1237
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1295
|
-
: query
|
1296
|
-
;
|
1238
|
+
: query;
|
1297
1239
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
1298
1240
|
object = object[camelCaseValue];
|
1299
1241
|
} else if (object[camelCaseValue] !== undefined) {
|
@@ -1515,31 +1457,20 @@
|
|
1515
1457
|
|
1516
1458
|
templates: {
|
1517
1459
|
escape: function (string) {
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
return escape[chr];
|
1529
|
-
}
|
1530
|
-
;
|
1531
|
-
if (shouldEscape.test(string)) {
|
1532
|
-
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
1533
|
-
string = string.replace(badChars, escapedChar);
|
1534
|
-
}
|
1535
|
-
|
1536
|
-
return string;
|
1460
|
+
const badChars = /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
|
1461
|
+
const escape = {
|
1462
|
+
'"': '"',
|
1463
|
+
'&': '&',
|
1464
|
+
"'": ''',
|
1465
|
+
'<': '<',
|
1466
|
+
'>': '>',
|
1467
|
+
};
|
1468
|
+
|
1469
|
+
return string.replace(badChars, (chr) => escape[chr]);
|
1537
1470
|
},
|
1538
1471
|
popup: function (text) {
|
1539
|
-
|
1540
|
-
|
1541
|
-
escape = $.fn.popup.settings.templates.escape
|
1542
|
-
;
|
1472
|
+
let html = '';
|
1473
|
+
let escape = $.fn.popup.settings.templates.escape;
|
1543
1474
|
if (text !== undefined) {
|
1544
1475
|
if (text.title) {
|
1545
1476
|
text.title = escape(text.title);
|