webshims-rails 1.14.4 → 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +58 -0
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/polyfiller.js +45 -26
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +18 -5
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +26 -22
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +24 -21
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +4 -0
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +4 -0
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +0 -1
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +17 -7
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +21 -7
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +24 -22
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +122 -97
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +20 -6
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +4 -3
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +4 -0
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +7 -5
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +29 -9
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +1 -2
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +0 -1
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +16 -6
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +16 -6
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +16 -6
- data/vendor/assets/javascripts/webshims/shims/combos/33.js +0 -1
- data/vendor/assets/javascripts/webshims/shims/combos/34.js +2 -1
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +2 -1
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +24 -22
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +24 -22
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +20 -6
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +20 -6
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +26 -22
- data/vendor/assets/javascripts/webshims/shims/combos/97.js +0 -24
- data/vendor/assets/javascripts/webshims/shims/combos/98.js +22 -25
- data/vendor/assets/javascripts/webshims/shims/combos/99.js +22 -25
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +2 -1
- data/vendor/assets/javascripts/webshims/shims/filereader.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/form-core.js +14 -5
- data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +8 -4
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +0 -1
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +24 -21
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +1 -1
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +28 -8
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +17 -20
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +17 -10
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +3 -3
- data/vendor/assets/javascripts/webshims/shims/jme/base.js +0 -24
- data/vendor/assets/javascripts/webshims/shims/jme/controls.css +23 -9
- data/vendor/assets/javascripts/webshims/shims/jme/controls.scss +21 -3
- data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols-lazy.js +13 -4
- data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols.js +22 -1
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +4 -0
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +4 -3
- data/vendor/assets/javascripts/webshims/shims/picture.js +122 -97
- data/vendor/assets/javascripts/webshims/shims/plugins/jquery.ui.position.js +470 -452
- data/vendor/assets/javascripts/webshims/shims/sizzle.js +35 -27
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +10 -2
- data/vendor/assets/javascripts/webshims/shims/styles/forms-picker.css +1 -1
- data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-forms-ext.scss +10 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +4 -2
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-picker.scss +1 -1
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +6 -24
- data/vendor/assets/javascripts/webshims/shims/styles/shim-ext.css +15 -21
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +5 -19
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +2 -2
- metadata +2 -3
- data/vendor/assets/javascripts/webshims/shims/promise.js +0 -684
@@ -531,6 +531,10 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
|
|
531
531
|
webshims.ready(swfType, initMediaElements);
|
532
532
|
}
|
533
533
|
webshims.ready('track', loadTrackUi);
|
534
|
+
|
535
|
+
if(document.readyState == 'complete'){
|
536
|
+
webshims.isReady('WINDOWLOAD', true);
|
537
|
+
}
|
534
538
|
});
|
535
539
|
|
536
540
|
})(webshims);
|
@@ -127,6 +127,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
|
|
127
127
|
var onEvent = {
|
128
128
|
onPlayPause: function(jaris, data, override){
|
129
129
|
var playing, type;
|
130
|
+
var idled = data.paused || data.ended;
|
130
131
|
if(override == null){
|
131
132
|
try {
|
132
133
|
playing = data.api.api_get("isPlaying");
|
@@ -134,7 +135,7 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
|
|
134
135
|
} else {
|
135
136
|
playing = override;
|
136
137
|
}
|
137
|
-
if(playing ==
|
138
|
+
if(playing == idled || playing == null){
|
138
139
|
|
139
140
|
data.paused = !playing;
|
140
141
|
type = data.paused ? 'pause' : 'play';
|
@@ -1211,11 +1212,11 @@ webshims.register('mediaelement-jaris', function($, webshims, window, document,
|
|
1211
1212
|
var media, error, parent;
|
1212
1213
|
if(
|
1213
1214
|
($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source', parent).last()[0] == e.target)) &&
|
1214
|
-
(media = $(e.target).closest('audio, video')) && !media.
|
1215
|
+
(media = $(e.target).closest('audio, video')) && !media.hasClass('nonnative-api-active')
|
1215
1216
|
){
|
1216
1217
|
error = media.prop('error');
|
1217
1218
|
setTimeout(function(){
|
1218
|
-
if(!media.
|
1219
|
+
if(!media.hasClass('nonnative-api-active')){
|
1219
1220
|
if(error && switchErrors[error.code]){
|
1220
1221
|
options.preferFlash = true;
|
1221
1222
|
document.removeEventListener('error', switchOptions, true);
|
@@ -10,23 +10,65 @@
|
|
10
10
|
|
11
11
|
webshim.isReady('picture', true);
|
12
12
|
setTimeout(function(){
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
});
|
13
|
+
if(window.picturefill){
|
14
|
+
var sel = 'picture, img[srcset]';
|
15
|
+
webshim.addReady(function(context){
|
16
|
+
if(context.querySelector(sel)){
|
17
|
+
window.picturefill();
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
23
21
|
});
|
24
22
|
})();
|
25
|
-
|
26
|
-
/*! Picturefill - v2.1.0-beta - 2014-06-03
|
23
|
+
/*! Picturefill - v2.1.0-beta - 2014-07-15
|
27
24
|
* http://scottjehl.github.io/picturefill
|
28
25
|
* Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */
|
26
|
+
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
|
27
|
+
|
28
|
+
window.matchMedia || (window.matchMedia = function() {
|
29
|
+
"use strict";
|
30
|
+
|
31
|
+
// For browsers that support matchMedium api such as IE 9 and webkit
|
32
|
+
var styleMedia = (window.styleMedia || window.media);
|
33
|
+
|
34
|
+
// For those that don't support matchMedium
|
35
|
+
if (!styleMedia) {
|
36
|
+
var style = document.createElement('style'),
|
37
|
+
script = document.getElementsByTagName('script')[0],
|
38
|
+
info = null;
|
39
|
+
|
40
|
+
style.type = 'text/css';
|
41
|
+
style.id = 'matchmediajs-test';
|
42
|
+
|
43
|
+
script.parentNode.insertBefore(style, script);
|
29
44
|
|
45
|
+
// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
|
46
|
+
info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
|
47
|
+
|
48
|
+
styleMedia = {
|
49
|
+
matchMedium: function(media) {
|
50
|
+
var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
|
51
|
+
|
52
|
+
// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
|
53
|
+
if (style.styleSheet) {
|
54
|
+
style.styleSheet.cssText = text;
|
55
|
+
} else {
|
56
|
+
style.textContent = text;
|
57
|
+
}
|
58
|
+
|
59
|
+
// Test if media query is true or false
|
60
|
+
return info.width === '1px';
|
61
|
+
}
|
62
|
+
};
|
63
|
+
}
|
64
|
+
|
65
|
+
return function(media) {
|
66
|
+
return {
|
67
|
+
matches: styleMedia.matchMedium(media || 'all'),
|
68
|
+
media: media || 'all'
|
69
|
+
};
|
70
|
+
};
|
71
|
+
}());
|
30
72
|
/*! Picturefill - Responsive Images that work today.
|
31
73
|
* Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
|
32
74
|
* License: MIT/GPLv2
|
@@ -38,6 +80,7 @@
|
|
38
80
|
|
39
81
|
// If picture is supported, well, that's awesome. Let's get outta here...
|
40
82
|
if ( w.HTMLPictureElement ) {
|
83
|
+
w.picturefill = function() { };
|
41
84
|
return;
|
42
85
|
}
|
43
86
|
|
@@ -51,7 +94,8 @@
|
|
51
94
|
pf.ns = "picturefill";
|
52
95
|
|
53
96
|
// srcset support test
|
54
|
-
pf.srcsetSupported =
|
97
|
+
pf.srcsetSupported = "srcset" in doc.createElement( "img" );
|
98
|
+
pf.sizesSupported = w.HTMLImageElement.sizes;
|
55
99
|
|
56
100
|
// just a string trim workaround
|
57
101
|
pf.trim = function( str ) {
|
@@ -82,8 +126,8 @@
|
|
82
126
|
* http://dev.w3.org/csswg/css-values-3/#length-value
|
83
127
|
*/
|
84
128
|
pf.getWidthFromLength = function( length ) {
|
85
|
-
// If no length was specified, or it is 0, default to `100vw` (per the spec).
|
86
|
-
length = length && parseFloat( length ) > 0 ? length : "100vw";
|
129
|
+
// If no length was specified, or it is 0 or negative, default to `100vw` (per the spec).
|
130
|
+
length = length && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 ) ? length : "100vw";
|
87
131
|
|
88
132
|
/**
|
89
133
|
* If length is specified in `vw` units, use `%` instead since the div we’re measuring
|
@@ -101,7 +145,12 @@
|
|
101
145
|
|
102
146
|
// Positioning styles help prevent padding/margin/width on `html` from throwing calculations off.
|
103
147
|
pf.lengthEl.style.cssText = "position: absolute; left: 0; width: " + length + ";";
|
104
|
-
|
148
|
+
|
149
|
+
if ( pf.lengthEl.offsetWidth <= 0 ) {
|
150
|
+
// Something has gone wrong. `calc()` is in use and unsupported, most likely. Default to `100vw` (`100%`, for broader support.):
|
151
|
+
pf.lengthEl.style.cssText = "width: 100%;";
|
152
|
+
}
|
153
|
+
|
105
154
|
return pf.lengthEl.offsetWidth;
|
106
155
|
};
|
107
156
|
|
@@ -263,38 +312,32 @@
|
|
263
312
|
return candidates;
|
264
313
|
};
|
265
314
|
|
266
|
-
pf.parseDescriptor = function( descriptor,
|
315
|
+
pf.parseDescriptor = function( descriptor, sizesattr ) {
|
267
316
|
// 11. Descriptor parser: Let candidates be an initially empty source set. The order of entries in the list
|
268
317
|
// is the order in which entries are added to the list.
|
269
|
-
var
|
270
|
-
|
318
|
+
var sizes = sizesattr || "100vw",
|
319
|
+
sizeDescriptor = descriptor && descriptor.replace(/(^\s+|\s+$)/g, ""),
|
320
|
+
widthInCssPixels = pf.findWidthFromSourceSize( sizes ),
|
271
321
|
resCandidate;
|
272
322
|
|
273
323
|
if ( sizeDescriptor ) {
|
274
324
|
var splitDescriptor = sizeDescriptor.split(" ");
|
275
325
|
|
276
326
|
for (var i = splitDescriptor.length + 1; i >= 0; i--) {
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
} else {
|
288
|
-
// get the dpr by grabbing the value of Nx
|
289
|
-
var res = curr && parseFloat( curr, 10 );
|
290
|
-
|
291
|
-
resCandidate = res && !isNaN( res ) && lastchar === "x" || lastchar === "w" ? res : 1;
|
327
|
+
if ( splitDescriptor[ i ] !== undefined ) {
|
328
|
+
var curr = splitDescriptor[ i ],
|
329
|
+
lastchar = curr && curr.slice( curr.length - 1 );
|
330
|
+
|
331
|
+
if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) {
|
332
|
+
resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) );
|
333
|
+
} else if ( lastchar === "x" ) {
|
334
|
+
var res = curr && parseFloat( curr, 10 );
|
335
|
+
resCandidate = res && !isNaN( res ) ? res : 1;
|
336
|
+
}
|
292
337
|
}
|
293
338
|
}
|
294
|
-
} else {
|
295
|
-
resCandidate = 1;
|
296
339
|
}
|
297
|
-
return resCandidate;
|
340
|
+
return resCandidate || 1;
|
298
341
|
};
|
299
342
|
|
300
343
|
/**
|
@@ -372,7 +415,7 @@
|
|
372
415
|
}
|
373
416
|
}
|
374
417
|
|
375
|
-
if ( !pf.endsWith( picImg.src, bestCandidate.url ) ) {
|
418
|
+
if ( bestCandidate && !pf.endsWith( picImg.src, bestCandidate.url ) ) {
|
376
419
|
picImg.src = bestCandidate.url;
|
377
420
|
// currentSrc attribute and property to match
|
378
421
|
// http://picture.responsiveimages.org/#the-img-element
|
@@ -405,32 +448,26 @@
|
|
405
448
|
};
|
406
449
|
|
407
450
|
/*
|
408
|
-
* Find all
|
409
|
-
*
|
410
|
-
*
|
451
|
+
* Find all `img` elements, and add them to the candidate list if they have
|
452
|
+
* a `picture` parent, a `sizes` attribute in basic `srcset` supporting browsers,
|
453
|
+
* a `srcset` attribute at all, and they haven’t been evaluated already.
|
411
454
|
*/
|
412
455
|
pf.getAllElements = function() {
|
413
|
-
var
|
414
|
-
elems = [],
|
456
|
+
var elems = [],
|
415
457
|
imgs = doc.getElementsByTagName( "img" );
|
416
458
|
|
417
|
-
for ( var h = 0, len =
|
418
|
-
|
419
|
-
elems[ h ] = pictures[ h ];
|
420
|
-
} else {
|
421
|
-
var currImg = imgs[ h - pictures.length ];
|
459
|
+
for ( var h = 0, len = imgs.length; h < len; h++ ) {
|
460
|
+
var currImg = imgs[ h ];
|
422
461
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
elems.push( currImg );
|
427
|
-
}
|
462
|
+
if ( currImg.parentNode.nodeName.toUpperCase() === "PICTURE" ||
|
463
|
+
( currImg.getAttribute( "srcset" ) !== null ) || currImg[ pf.ns ] && currImg[ pf.ns ].srcset !== null ) {
|
464
|
+
elems.push( currImg );
|
428
465
|
}
|
429
466
|
}
|
430
467
|
return elems;
|
431
468
|
};
|
432
469
|
|
433
|
-
pf.getMatch = function( picture ) {
|
470
|
+
pf.getMatch = function( img, picture ) {
|
434
471
|
var sources = picture.childNodes,
|
435
472
|
match;
|
436
473
|
|
@@ -443,9 +480,9 @@
|
|
443
480
|
continue;
|
444
481
|
}
|
445
482
|
|
446
|
-
// Hitting
|
483
|
+
// Hitting the `img` element that started everything stops the search for `sources`.
|
447
484
|
// If no previous `source` matches, the `img` itself is evaluated later.
|
448
|
-
if ( source
|
485
|
+
if ( source === img ) {
|
449
486
|
return match;
|
450
487
|
}
|
451
488
|
|
@@ -477,24 +514,22 @@
|
|
477
514
|
return match;
|
478
515
|
};
|
479
516
|
|
480
|
-
function picturefill(
|
517
|
+
function picturefill( opt ) {
|
481
518
|
var elements,
|
482
519
|
element,
|
483
|
-
|
520
|
+
parent,
|
484
521
|
firstMatch,
|
485
522
|
candidates,
|
486
|
-
picImg;
|
487
523
|
|
488
|
-
|
524
|
+
options = opt || {};
|
489
525
|
elements = options.elements || pf.getAllElements();
|
490
526
|
|
491
527
|
// Loop through all elements
|
492
528
|
for ( var i = 0, plen = elements.length; i < plen; i++ ) {
|
493
529
|
element = elements[ i ];
|
494
|
-
|
530
|
+
parent = element.parentNode;
|
495
531
|
firstMatch = undefined;
|
496
532
|
candidates = undefined;
|
497
|
-
picImg = undefined;
|
498
533
|
|
499
534
|
// expando for caching data on the img
|
500
535
|
if ( !element[ pf.ns ] ) {
|
@@ -508,16 +543,16 @@
|
|
508
543
|
continue;
|
509
544
|
}
|
510
545
|
|
511
|
-
// if
|
512
|
-
if (
|
546
|
+
// if `img` is in a `picture` element
|
547
|
+
if ( parent.nodeName.toUpperCase() === "PICTURE" ) {
|
513
548
|
|
514
549
|
// IE9 video workaround
|
515
|
-
pf.removeVideoShim(
|
550
|
+
pf.removeVideoShim( parent );
|
516
551
|
|
517
552
|
// return the first match which might undefined
|
518
553
|
// returns false if there is a pending source
|
519
554
|
// TODO the return type here is brutal, cleanup
|
520
|
-
firstMatch = pf.getMatch( element );
|
555
|
+
firstMatch = pf.getMatch( element, parent );
|
521
556
|
|
522
557
|
// if any sources are pending in this picture due to async type test(s)
|
523
558
|
// remove the evaluated attr and skip for now ( the pending test will
|
@@ -525,43 +560,32 @@
|
|
525
560
|
if ( firstMatch === false ) {
|
526
561
|
continue;
|
527
562
|
}
|
528
|
-
|
529
|
-
// Find any existing img element in the picture element
|
530
|
-
picImg = element.getElementsByTagName( "img" )[ 0 ];
|
531
563
|
} else {
|
532
|
-
// if it's an img element
|
533
564
|
firstMatch = undefined;
|
534
|
-
picImg = element;
|
535
565
|
}
|
536
566
|
|
537
|
-
if
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
// Cache and remove `srcset` if present and we’re going to be doing `sizes`/`picture` polyfilling to it.
|
545
|
-
if ( picImg.srcset && ( elemType === "PICTURE" || picImg.getAttribute( "sizes" ) ) ) {
|
546
|
-
pf.dodgeSrcset( picImg );
|
547
|
-
}
|
548
|
-
|
549
|
-
if ( firstMatch ) {
|
550
|
-
candidates = pf.processSourceSet( firstMatch );
|
551
|
-
pf.applyBestCandidate( candidates, picImg );
|
552
|
-
} else {
|
553
|
-
// No sources matched, so we’re down to processing the inner `img` as a source.
|
554
|
-
candidates = pf.processSourceSet( picImg );
|
567
|
+
// Cache and remove `srcset` if present and we’re going to be doing `picture`/`srcset`/`sizes` polyfilling to it.
|
568
|
+
if ( parent.nodeName.toUpperCase() === "PICTURE" ||
|
569
|
+
( element.srcset && !pf.srcsetSupported ) ||
|
570
|
+
( !pf.sizesSupported && ( element.srcset && element.srcset.indexOf("w") > -1 ) ) ) {
|
571
|
+
pf.dodgeSrcset( element );
|
572
|
+
}
|
555
573
|
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
574
|
+
if ( firstMatch ) {
|
575
|
+
candidates = pf.processSourceSet( firstMatch );
|
576
|
+
pf.applyBestCandidate( candidates, element );
|
577
|
+
} else {
|
578
|
+
// No sources matched, so we’re down to processing the inner `img` as a source.
|
579
|
+
candidates = pf.processSourceSet( element );
|
561
580
|
|
562
|
-
|
563
|
-
|
581
|
+
if ( element.srcset === undefined || element[ pf.ns ].srcset ) {
|
582
|
+
// Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality.
|
583
|
+
pf.applyBestCandidate( candidates, element );
|
584
|
+
} // Else, resolution-only `srcset` is supported natively.
|
564
585
|
}
|
586
|
+
|
587
|
+
// set evaluated to true to avoid unnecessary reparsing
|
588
|
+
element[ pf.ns ].evaluated = true;
|
565
589
|
}
|
566
590
|
}
|
567
591
|
|
@@ -596,7 +620,7 @@
|
|
596
620
|
}
|
597
621
|
}
|
598
622
|
|
599
|
-
|
623
|
+
runPicturefill();
|
600
624
|
|
601
625
|
/* expose methods for testing */
|
602
626
|
picturefill._ = pf;
|
@@ -615,3 +639,4 @@
|
|
615
639
|
|
616
640
|
} )( this, this.document );
|
617
641
|
|
642
|
+
|
@@ -1,497 +1,515 @@
|
|
1
1
|
/*!
|
2
|
-
* jQuery UI Position 1.
|
2
|
+
* jQuery UI Position 1.11.0
|
3
3
|
* http://jqueryui.com
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2014 jQuery Foundation and other contributors
|
6
6
|
* Released under the MIT license.
|
7
7
|
* http://jquery.org/license
|
8
8
|
*
|
9
9
|
* http://api.jqueryui.com/position/
|
10
10
|
*/
|
11
|
-
(function(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rvertical = /top|center|bottom/,
|
21
|
-
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
|
22
|
-
rposition = /^\w+/,
|
23
|
-
rpercent = /%$/,
|
24
|
-
_position = $.fn.position;
|
25
|
-
|
26
|
-
function getOffsets( offsets, width, height ) {
|
27
|
-
return [
|
28
|
-
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
|
29
|
-
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
|
30
|
-
];
|
31
|
-
}
|
32
|
-
|
33
|
-
function parseCss( element, property ) {
|
34
|
-
return parseInt( $.css( element, property ), 10 ) || 0;
|
35
|
-
}
|
36
|
-
|
37
|
-
function getDimensions( elem ) {
|
38
|
-
var raw = elem[0];
|
39
|
-
if ( raw.nodeType === 9 ) {
|
40
|
-
return {
|
41
|
-
width: elem.width(),
|
42
|
-
height: elem.height(),
|
43
|
-
offset: { top: 0, left: 0 }
|
44
|
-
};
|
45
|
-
}
|
46
|
-
if ( $.isWindow( raw ) ) {
|
47
|
-
return {
|
48
|
-
width: elem.width(),
|
49
|
-
height: elem.height(),
|
50
|
-
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
|
51
|
-
};
|
52
|
-
}
|
53
|
-
if ( raw.preventDefault ) {
|
54
|
-
return {
|
55
|
-
width: 0,
|
56
|
-
height: 0,
|
57
|
-
offset: { top: raw.pageY, left: raw.pageX }
|
58
|
-
};
|
11
|
+
(function( factory ) {
|
12
|
+
if ( typeof define === "function" && define.amd ) {
|
13
|
+
|
14
|
+
// AMD. Register as an anonymous module.
|
15
|
+
define( [ "jquery" ], factory );
|
16
|
+
} else {
|
17
|
+
|
18
|
+
// Browser globals
|
19
|
+
factory( window.webshims && window.webshims.$ || jQuery );
|
59
20
|
}
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
21
|
+
}(function( $ ) {
|
22
|
+
(function() {
|
23
|
+
|
24
|
+
$.ui = $.ui || {};
|
25
|
+
|
26
|
+
var cachedScrollbarWidth, supportsOffsetFractions,
|
27
|
+
max = Math.max,
|
28
|
+
abs = Math.abs,
|
29
|
+
round = Math.round,
|
30
|
+
rhorizontal = /left|center|right/,
|
31
|
+
rvertical = /top|center|bottom/,
|
32
|
+
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
|
33
|
+
rposition = /^\w+/,
|
34
|
+
rpercent = /%$/,
|
35
|
+
_position = $.fn.position;
|
36
|
+
|
37
|
+
function getOffsets( offsets, width, height ) {
|
38
|
+
return [
|
39
|
+
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
|
40
|
+
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
|
41
|
+
];
|
71
42
|
}
|
72
|
-
var w1, w2,
|
73
|
-
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
|
74
|
-
innerDiv = div.children()[0];
|
75
|
-
|
76
|
-
$( "body" ).append( div );
|
77
|
-
w1 = innerDiv.offsetWidth;
|
78
|
-
div.css( "overflow", "scroll" );
|
79
43
|
|
80
|
-
|
44
|
+
function parseCss( element, property ) {
|
45
|
+
return parseInt( $.css( element, property ), 10 ) || 0;
|
46
|
+
}
|
81
47
|
|
82
|
-
|
83
|
-
|
48
|
+
function getDimensions( elem ) {
|
49
|
+
var raw = elem[0];
|
50
|
+
if ( raw.nodeType === 9 ) {
|
51
|
+
return {
|
52
|
+
width: elem.width(),
|
53
|
+
height: elem.height(),
|
54
|
+
offset: { top: 0, left: 0 }
|
55
|
+
};
|
56
|
+
}
|
57
|
+
if ( $.isWindow( raw ) ) {
|
58
|
+
return {
|
59
|
+
width: elem.width(),
|
60
|
+
height: elem.height(),
|
61
|
+
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
|
62
|
+
};
|
63
|
+
}
|
64
|
+
if ( raw.preventDefault ) {
|
65
|
+
return {
|
66
|
+
width: 0,
|
67
|
+
height: 0,
|
68
|
+
offset: { top: raw.pageY, left: raw.pageX }
|
69
|
+
};
|
70
|
+
}
|
71
|
+
return {
|
72
|
+
width: elem.outerWidth(),
|
73
|
+
height: elem.outerHeight(),
|
74
|
+
offset: elem.offset()
|
75
|
+
};
|
84
76
|
}
|
85
77
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
|
95
|
-
hasOverflowY = overflowY === "scroll" ||
|
96
|
-
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
|
97
|
-
return {
|
98
|
-
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
|
99
|
-
height: hasOverflowX ? $.position.scrollbarWidth() : 0
|
100
|
-
};
|
101
|
-
},
|
102
|
-
getWithinInfo: function( element ) {
|
103
|
-
var withinElement = $( element || window ),
|
104
|
-
isWindow = $.isWindow( withinElement[0] );
|
105
|
-
return {
|
106
|
-
element: withinElement,
|
107
|
-
isWindow: isWindow,
|
108
|
-
offset: withinElement.offset() || { left: 0, top: 0 },
|
109
|
-
scrollLeft: withinElement.scrollLeft(),
|
110
|
-
scrollTop: withinElement.scrollTop(),
|
111
|
-
width: isWindow ? withinElement.width() : withinElement.outerWidth(),
|
112
|
-
height: isWindow ? withinElement.height() : withinElement.outerHeight()
|
113
|
-
};
|
114
|
-
}
|
115
|
-
};
|
78
|
+
$.position = {
|
79
|
+
scrollbarWidth: function() {
|
80
|
+
if ( cachedScrollbarWidth !== undefined ) {
|
81
|
+
return cachedScrollbarWidth;
|
82
|
+
}
|
83
|
+
var w1, w2,
|
84
|
+
div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
|
85
|
+
innerDiv = div.children()[0];
|
116
86
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
}
|
87
|
+
$( "body" ).append( div );
|
88
|
+
w1 = innerDiv.offsetWidth;
|
89
|
+
div.css( "overflow", "scroll" );
|
121
90
|
|
122
|
-
|
123
|
-
options = $.extend( {}, options );
|
91
|
+
w2 = innerDiv.offsetWidth;
|
124
92
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
scrollInfo = $.position.getScrollInfo( within ),
|
129
|
-
collision = ( options.collision || "flip" ).split( " " ),
|
130
|
-
offsets = {};
|
93
|
+
if ( w1 === w2 ) {
|
94
|
+
w2 = div[0].clientWidth;
|
95
|
+
}
|
131
96
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
];
|
167
|
-
|
168
|
-
// reduce to just the positions without the offsets
|
169
|
-
options[ this ] = [
|
170
|
-
rposition.exec( pos[ 0 ] )[ 0 ],
|
171
|
-
rposition.exec( pos[ 1 ] )[ 0 ]
|
172
|
-
];
|
173
|
-
});
|
174
|
-
|
175
|
-
// normalize collision option
|
176
|
-
if ( collision.length === 1 ) {
|
177
|
-
collision[ 1 ] = collision[ 0 ];
|
178
|
-
}
|
97
|
+
div.remove();
|
98
|
+
|
99
|
+
return (cachedScrollbarWidth = w1 - w2);
|
100
|
+
},
|
101
|
+
getScrollInfo: function( within ) {
|
102
|
+
var overflowX = within.isWindow || within.isDocument ? "" :
|
103
|
+
within.element.css( "overflow-x" ),
|
104
|
+
overflowY = within.isWindow || within.isDocument ? "" :
|
105
|
+
within.element.css( "overflow-y" ),
|
106
|
+
hasOverflowX = overflowX === "scroll" ||
|
107
|
+
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
|
108
|
+
hasOverflowY = overflowY === "scroll" ||
|
109
|
+
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
|
110
|
+
return {
|
111
|
+
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
|
112
|
+
height: hasOverflowX ? $.position.scrollbarWidth() : 0
|
113
|
+
};
|
114
|
+
},
|
115
|
+
getWithinInfo: function( element ) {
|
116
|
+
var withinElement = $( element || window ),
|
117
|
+
isWindow = $.isWindow( withinElement[0] ),
|
118
|
+
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
|
119
|
+
return {
|
120
|
+
element: withinElement,
|
121
|
+
isWindow: isWindow,
|
122
|
+
isDocument: isDocument,
|
123
|
+
offset: withinElement.offset() || { left: 0, top: 0 },
|
124
|
+
scrollLeft: withinElement.scrollLeft(),
|
125
|
+
scrollTop: withinElement.scrollTop(),
|
126
|
+
width: isWindow ? withinElement.width() : withinElement.outerWidth(),
|
127
|
+
height: isWindow ? withinElement.height() : withinElement.outerHeight()
|
128
|
+
};
|
129
|
+
}
|
130
|
+
};
|
179
131
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
}
|
132
|
+
$.fn.position = function( options ) {
|
133
|
+
if ( !options || !options.of ) {
|
134
|
+
return _position.apply( this, arguments );
|
135
|
+
}
|
185
136
|
|
186
|
-
|
187
|
-
|
188
|
-
} else if ( options.at[ 1 ] === "center" ) {
|
189
|
-
basePosition.top += targetHeight / 2;
|
190
|
-
}
|
137
|
+
// make a copy, we don't want to modify arguments
|
138
|
+
options = $.extend( {}, options );
|
191
139
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
elem = $( this ),
|
199
|
-
elemWidth = elem.outerWidth(),
|
200
|
-
elemHeight = elem.outerHeight(),
|
201
|
-
marginLeft = parseCss( this, "marginLeft" ),
|
202
|
-
marginTop = parseCss( this, "marginTop" ),
|
203
|
-
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
|
204
|
-
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
|
205
|
-
position = $.extend( {}, basePosition ),
|
206
|
-
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
|
207
|
-
|
208
|
-
if ( options.my[ 0 ] === "right" ) {
|
209
|
-
position.left -= elemWidth;
|
210
|
-
} else if ( options.my[ 0 ] === "center" ) {
|
211
|
-
position.left -= elemWidth / 2;
|
212
|
-
}
|
140
|
+
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
|
141
|
+
target = $( options.of ),
|
142
|
+
within = $.position.getWithinInfo( options.within ),
|
143
|
+
scrollInfo = $.position.getScrollInfo( within ),
|
144
|
+
collision = ( options.collision || "flip" ).split( " " ),
|
145
|
+
offsets = {};
|
213
146
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
147
|
+
dimensions = getDimensions( target );
|
148
|
+
if ( target[0].preventDefault ) {
|
149
|
+
// force left top to allow flipping
|
150
|
+
options.at = "left top";
|
151
|
+
}
|
152
|
+
targetWidth = dimensions.width;
|
153
|
+
targetHeight = dimensions.height;
|
154
|
+
targetOffset = dimensions.offset;
|
155
|
+
// clone to reuse original targetOffset later
|
156
|
+
basePosition = $.extend( {}, targetOffset );
|
157
|
+
|
158
|
+
// force my and at to have valid horizontal and vertical positions
|
159
|
+
// if a value is missing or invalid, it will be converted to center
|
160
|
+
$.each( [ "my", "at" ], function() {
|
161
|
+
var pos = ( options[ this ] || "" ).split( " " ),
|
162
|
+
horizontalOffset,
|
163
|
+
verticalOffset;
|
164
|
+
|
165
|
+
if ( pos.length === 1) {
|
166
|
+
pos = rhorizontal.test( pos[ 0 ] ) ?
|
167
|
+
pos.concat( [ "center" ] ) :
|
168
|
+
rvertical.test( pos[ 0 ] ) ?
|
169
|
+
[ "center" ].concat( pos ) :
|
170
|
+
[ "center", "center" ];
|
171
|
+
}
|
172
|
+
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
|
173
|
+
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
|
174
|
+
|
175
|
+
// calculate offsets
|
176
|
+
horizontalOffset = roffset.exec( pos[ 0 ] );
|
177
|
+
verticalOffset = roffset.exec( pos[ 1 ] );
|
178
|
+
offsets[ this ] = [
|
179
|
+
horizontalOffset ? horizontalOffset[ 0 ] : 0,
|
180
|
+
verticalOffset ? verticalOffset[ 0 ] : 0
|
181
|
+
];
|
182
|
+
|
183
|
+
// reduce to just the positions without the offsets
|
184
|
+
options[ this ] = [
|
185
|
+
rposition.exec( pos[ 0 ] )[ 0 ],
|
186
|
+
rposition.exec( pos[ 1 ] )[ 0 ]
|
187
|
+
];
|
188
|
+
});
|
189
|
+
|
190
|
+
// normalize collision option
|
191
|
+
if ( collision.length === 1 ) {
|
192
|
+
collision[ 1 ] = collision[ 0 ];
|
193
|
+
}
|
219
194
|
|
220
|
-
|
221
|
-
|
195
|
+
if ( options.at[ 0 ] === "right" ) {
|
196
|
+
basePosition.left += targetWidth;
|
197
|
+
} else if ( options.at[ 0 ] === "center" ) {
|
198
|
+
basePosition.left += targetWidth / 2;
|
199
|
+
}
|
222
200
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
201
|
+
if ( options.at[ 1 ] === "bottom" ) {
|
202
|
+
basePosition.top += targetHeight;
|
203
|
+
} else if ( options.at[ 1 ] === "center" ) {
|
204
|
+
basePosition.top += targetHeight / 2;
|
205
|
+
}
|
228
206
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
207
|
+
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
|
208
|
+
basePosition.left += atOffset[ 0 ];
|
209
|
+
basePosition.top += atOffset[ 1 ];
|
210
|
+
|
211
|
+
return this.each(function() {
|
212
|
+
var collisionPosition, using,
|
213
|
+
elem = $( this ),
|
214
|
+
elemWidth = elem.outerWidth(),
|
215
|
+
elemHeight = elem.outerHeight(),
|
216
|
+
marginLeft = parseCss( this, "marginLeft" ),
|
217
|
+
marginTop = parseCss( this, "marginTop" ),
|
218
|
+
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
|
219
|
+
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
|
220
|
+
position = $.extend( {}, basePosition ),
|
221
|
+
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
|
222
|
+
|
223
|
+
if ( options.my[ 0 ] === "right" ) {
|
224
|
+
position.left -= elemWidth;
|
225
|
+
} else if ( options.my[ 0 ] === "center" ) {
|
226
|
+
position.left -= elemWidth / 2;
|
227
|
+
}
|
233
228
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
targetHeight: targetHeight,
|
239
|
-
elemWidth: elemWidth,
|
240
|
-
elemHeight: elemHeight,
|
241
|
-
collisionPosition: collisionPosition,
|
242
|
-
collisionWidth: collisionWidth,
|
243
|
-
collisionHeight: collisionHeight,
|
244
|
-
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
|
245
|
-
my: options.my,
|
246
|
-
at: options.at,
|
247
|
-
within: within,
|
248
|
-
elem : elem
|
249
|
-
});
|
250
|
-
}
|
251
|
-
});
|
252
|
-
|
253
|
-
if ( options.using ) {
|
254
|
-
// adds feedback as second argument to using callback, if present
|
255
|
-
using = function( props ) {
|
256
|
-
var left = targetOffset.left - position.left,
|
257
|
-
right = left + targetWidth - elemWidth,
|
258
|
-
top = targetOffset.top - position.top,
|
259
|
-
bottom = top + targetHeight - elemHeight,
|
260
|
-
feedback = {
|
261
|
-
target: {
|
262
|
-
element: target,
|
263
|
-
left: targetOffset.left,
|
264
|
-
top: targetOffset.top,
|
265
|
-
width: targetWidth,
|
266
|
-
height: targetHeight
|
267
|
-
},
|
268
|
-
element: {
|
269
|
-
element: elem,
|
270
|
-
left: position.left,
|
271
|
-
top: position.top,
|
272
|
-
width: elemWidth,
|
273
|
-
height: elemHeight
|
274
|
-
},
|
275
|
-
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
|
276
|
-
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
|
277
|
-
};
|
278
|
-
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
|
279
|
-
feedback.horizontal = "center";
|
229
|
+
if ( options.my[ 1 ] === "bottom" ) {
|
230
|
+
position.top -= elemHeight;
|
231
|
+
} else if ( options.my[ 1 ] === "center" ) {
|
232
|
+
position.top -= elemHeight / 2;
|
280
233
|
}
|
281
|
-
|
282
|
-
|
234
|
+
|
235
|
+
position.left += myOffset[ 0 ];
|
236
|
+
position.top += myOffset[ 1 ];
|
237
|
+
|
238
|
+
// if the browser doesn't support fractions, then round for consistent results
|
239
|
+
if ( !supportsOffsetFractions ) {
|
240
|
+
position.left = round( position.left );
|
241
|
+
position.top = round( position.top );
|
283
242
|
}
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
243
|
+
|
244
|
+
collisionPosition = {
|
245
|
+
marginLeft: marginLeft,
|
246
|
+
marginTop: marginTop
|
247
|
+
};
|
248
|
+
|
249
|
+
$.each( [ "left", "top" ], function( i, dir ) {
|
250
|
+
if ( $.ui.position[ collision[ i ] ] ) {
|
251
|
+
$.ui.position[ collision[ i ] ][ dir ]( position, {
|
252
|
+
targetWidth: targetWidth,
|
253
|
+
targetHeight: targetHeight,
|
254
|
+
elemWidth: elemWidth,
|
255
|
+
elemHeight: elemHeight,
|
256
|
+
collisionPosition: collisionPosition,
|
257
|
+
collisionWidth: collisionWidth,
|
258
|
+
collisionHeight: collisionHeight,
|
259
|
+
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
|
260
|
+
my: options.my,
|
261
|
+
at: options.at,
|
262
|
+
within: within,
|
263
|
+
elem: elem
|
264
|
+
});
|
265
|
+
}
|
266
|
+
});
|
267
|
+
|
268
|
+
if ( options.using ) {
|
269
|
+
// adds feedback as second argument to using callback, if present
|
270
|
+
using = function( props ) {
|
271
|
+
var left = targetOffset.left - position.left,
|
272
|
+
right = left + targetWidth - elemWidth,
|
273
|
+
top = targetOffset.top - position.top,
|
274
|
+
bottom = top + targetHeight - elemHeight,
|
275
|
+
feedback = {
|
276
|
+
target: {
|
277
|
+
element: target,
|
278
|
+
left: targetOffset.left,
|
279
|
+
top: targetOffset.top,
|
280
|
+
width: targetWidth,
|
281
|
+
height: targetHeight
|
282
|
+
},
|
283
|
+
element: {
|
284
|
+
element: elem,
|
285
|
+
left: position.left,
|
286
|
+
top: position.top,
|
287
|
+
width: elemWidth,
|
288
|
+
height: elemHeight
|
289
|
+
},
|
290
|
+
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
|
291
|
+
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
|
292
|
+
};
|
293
|
+
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
|
294
|
+
feedback.horizontal = "center";
|
295
|
+
}
|
296
|
+
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
|
297
|
+
feedback.vertical = "middle";
|
298
|
+
}
|
299
|
+
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
|
300
|
+
feedback.important = "horizontal";
|
301
|
+
} else {
|
302
|
+
feedback.important = "vertical";
|
303
|
+
}
|
304
|
+
options.using.call( this, props, feedback );
|
305
|
+
};
|
288
306
|
}
|
289
|
-
options.using.call( this, props, feedback );
|
290
|
-
};
|
291
|
-
}
|
292
307
|
|
293
|
-
|
294
|
-
|
295
|
-
};
|
296
|
-
|
297
|
-
$.ui.position = {
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
308
|
+
elem.offset( $.extend( position, { using: using } ) );
|
309
|
+
});
|
310
|
+
};
|
311
|
+
|
312
|
+
$.ui.position = {
|
313
|
+
fit: {
|
314
|
+
left: function( position, data ) {
|
315
|
+
var within = data.within,
|
316
|
+
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
|
317
|
+
outerWidth = within.width,
|
318
|
+
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
|
319
|
+
overLeft = withinOffset - collisionPosLeft,
|
320
|
+
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
|
321
|
+
newOverRight;
|
322
|
+
|
323
|
+
// element is wider than within
|
324
|
+
if ( data.collisionWidth > outerWidth ) {
|
325
|
+
// element is initially over the left side of within
|
326
|
+
if ( overLeft > 0 && overRight <= 0 ) {
|
327
|
+
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
|
328
|
+
position.left += overLeft - newOverRight;
|
329
|
+
// element is initially over right side of within
|
330
|
+
} else if ( overRight > 0 && overLeft <= 0 ) {
|
331
|
+
position.left = withinOffset;
|
332
|
+
// element is initially over both left and right sides of within
|
333
|
+
} else {
|
334
|
+
if ( overLeft > overRight ) {
|
335
|
+
position.left = withinOffset + outerWidth - data.collisionWidth;
|
336
|
+
} else {
|
337
|
+
position.left = withinOffset;
|
338
|
+
}
|
339
|
+
}
|
340
|
+
// too far left -> align with left edge
|
341
|
+
} else if ( overLeft > 0 ) {
|
342
|
+
position.left += overLeft;
|
343
|
+
// too far right -> align with right edge
|
344
|
+
} else if ( overRight > 0 ) {
|
345
|
+
position.left -= overRight;
|
346
|
+
// adjust based on position and margin
|
321
347
|
} else {
|
322
|
-
position.left =
|
348
|
+
position.left = max( position.left - collisionPosLeft, position.left );
|
323
349
|
}
|
324
|
-
}
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
350
|
+
},
|
351
|
+
top: function( position, data ) {
|
352
|
+
var within = data.within,
|
353
|
+
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
|
354
|
+
outerHeight = data.within.height,
|
355
|
+
collisionPosTop = position.top - data.collisionPosition.marginTop,
|
356
|
+
overTop = withinOffset - collisionPosTop,
|
357
|
+
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
|
358
|
+
newOverBottom;
|
359
|
+
|
360
|
+
// element is taller than within
|
361
|
+
if ( data.collisionHeight > outerHeight ) {
|
362
|
+
// element is initially over the top of within
|
363
|
+
if ( overTop > 0 && overBottom <= 0 ) {
|
364
|
+
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
|
365
|
+
position.top += overTop - newOverBottom;
|
366
|
+
// element is initially over bottom of within
|
367
|
+
} else if ( overBottom > 0 && overTop <= 0 ) {
|
368
|
+
position.top = withinOffset;
|
369
|
+
// element is initially over both top and bottom of within
|
370
|
+
} else {
|
371
|
+
if ( overTop > overBottom ) {
|
372
|
+
position.top = withinOffset + outerHeight - data.collisionHeight;
|
373
|
+
} else {
|
374
|
+
position.top = withinOffset;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
// too far up -> align with top
|
378
|
+
} else if ( overTop > 0 ) {
|
379
|
+
position.top += overTop;
|
380
|
+
// too far down -> align with bottom edge
|
381
|
+
} else if ( overBottom > 0 ) {
|
382
|
+
position.top -= overBottom;
|
383
|
+
// adjust based on position and margin
|
358
384
|
} else {
|
359
|
-
position.top =
|
385
|
+
position.top = max( position.top - collisionPosTop, position.top );
|
360
386
|
}
|
361
387
|
}
|
362
|
-
|
363
|
-
|
364
|
-
position
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
388
|
+
},
|
389
|
+
flip: {
|
390
|
+
left: function( position, data ) {
|
391
|
+
var within = data.within,
|
392
|
+
withinOffset = within.offset.left + within.scrollLeft,
|
393
|
+
outerWidth = within.width,
|
394
|
+
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
|
395
|
+
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
|
396
|
+
overLeft = collisionPosLeft - offsetLeft,
|
397
|
+
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
|
398
|
+
myOffset = data.my[ 0 ] === "left" ?
|
399
|
+
-data.elemWidth :
|
400
|
+
data.my[ 0 ] === "right" ?
|
401
|
+
data.elemWidth :
|
402
|
+
0,
|
403
|
+
atOffset = data.at[ 0 ] === "left" ?
|
404
|
+
data.targetWidth :
|
405
|
+
data.at[ 0 ] === "right" ?
|
406
|
+
-data.targetWidth :
|
407
|
+
0,
|
408
|
+
offset = -2 * data.offset[ 0 ],
|
409
|
+
newOverRight,
|
410
|
+
newOverLeft;
|
411
|
+
|
412
|
+
if ( overLeft < 0 ) {
|
413
|
+
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
|
414
|
+
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
|
415
|
+
position.left += myOffset + atOffset + offset;
|
416
|
+
}
|
417
|
+
} else if ( overRight > 0 ) {
|
418
|
+
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
|
419
|
+
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
|
420
|
+
position.left += myOffset + atOffset + offset;
|
421
|
+
}
|
422
|
+
}
|
423
|
+
},
|
424
|
+
top: function( position, data ) {
|
425
|
+
var within = data.within,
|
426
|
+
withinOffset = within.offset.top + within.scrollTop,
|
427
|
+
outerHeight = within.height,
|
428
|
+
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
|
429
|
+
collisionPosTop = position.top - data.collisionPosition.marginTop,
|
430
|
+
overTop = collisionPosTop - offsetTop,
|
431
|
+
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
|
432
|
+
top = data.my[ 1 ] === "top",
|
433
|
+
myOffset = top ?
|
434
|
+
-data.elemHeight :
|
435
|
+
data.my[ 1 ] === "bottom" ?
|
436
|
+
data.elemHeight :
|
437
|
+
0,
|
438
|
+
atOffset = data.at[ 1 ] === "top" ?
|
439
|
+
data.targetHeight :
|
440
|
+
data.at[ 1 ] === "bottom" ?
|
441
|
+
-data.targetHeight :
|
442
|
+
0,
|
443
|
+
offset = -2 * data.offset[ 1 ],
|
444
|
+
newOverTop,
|
445
|
+
newOverBottom;
|
446
|
+
if ( overTop < 0 ) {
|
447
|
+
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
|
448
|
+
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
|
449
|
+
position.top += myOffset + atOffset + offset;
|
450
|
+
}
|
451
|
+
} else if ( overBottom > 0 ) {
|
452
|
+
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
|
453
|
+
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
|
454
|
+
position.top += myOffset + atOffset + offset;
|
455
|
+
}
|
456
|
+
}
|
401
457
|
}
|
402
|
-
}
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
position.left
|
458
|
+
},
|
459
|
+
flipfit: {
|
460
|
+
left: function() {
|
461
|
+
$.ui.position.flip.left.apply( this, arguments );
|
462
|
+
$.ui.position.fit.left.apply( this, arguments );
|
463
|
+
},
|
464
|
+
top: function() {
|
465
|
+
$.ui.position.flip.top.apply( this, arguments );
|
466
|
+
$.ui.position.fit.top.apply( this, arguments );
|
407
467
|
}
|
408
468
|
}
|
409
|
-
}
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
|
434
|
-
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
|
435
|
-
position.top += myOffset + atOffset + offset;
|
436
|
-
}
|
469
|
+
};
|
470
|
+
|
471
|
+
// fraction support test
|
472
|
+
(function() {
|
473
|
+
var testElement, testElementParent, testElementStyle, offsetLeft, i,
|
474
|
+
body = document.getElementsByTagName( "body" )[ 0 ],
|
475
|
+
div = document.createElement( "div" );
|
476
|
+
|
477
|
+
//Create a "fake body" for testing based on method used in jQuery.support
|
478
|
+
testElement = document.createElement( body ? "div" : "body" );
|
479
|
+
testElementStyle = {
|
480
|
+
visibility: "hidden",
|
481
|
+
width: 0,
|
482
|
+
height: 0,
|
483
|
+
border: 0,
|
484
|
+
margin: 0,
|
485
|
+
background: "none"
|
486
|
+
};
|
487
|
+
if ( body ) {
|
488
|
+
$.extend( testElementStyle, {
|
489
|
+
position: "absolute",
|
490
|
+
left: "-1000px",
|
491
|
+
top: "-1000px"
|
492
|
+
});
|
437
493
|
}
|
438
|
-
|
439
|
-
|
440
|
-
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
|
441
|
-
position.top += myOffset + atOffset + offset;
|
442
|
-
}
|
494
|
+
for ( i in testElementStyle ) {
|
495
|
+
testElement.style[ i ] = testElementStyle[ i ];
|
443
496
|
}
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
left: function() {
|
448
|
-
$.ui.position.flip.left.apply( this, arguments );
|
449
|
-
$.ui.position.fit.left.apply( this, arguments );
|
450
|
-
},
|
451
|
-
top: function() {
|
452
|
-
$.ui.position.flip.top.apply( this, arguments );
|
453
|
-
$.ui.position.fit.top.apply( this, arguments );
|
454
|
-
}
|
455
|
-
}
|
456
|
-
};
|
497
|
+
testElement.appendChild( div );
|
498
|
+
testElementParent = body || document.documentElement;
|
499
|
+
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
457
500
|
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
testElementStyle = {
|
467
|
-
visibility: "hidden",
|
468
|
-
width: 0,
|
469
|
-
height: 0,
|
470
|
-
border: 0,
|
471
|
-
margin: 0,
|
472
|
-
background: "none"
|
473
|
-
};
|
474
|
-
if ( body ) {
|
475
|
-
$.extend( testElementStyle, {
|
476
|
-
position: "absolute",
|
477
|
-
left: "-1000px",
|
478
|
-
top: "-1000px"
|
479
|
-
});
|
480
|
-
}
|
481
|
-
for ( i in testElementStyle ) {
|
482
|
-
testElement.style[ i ] = testElementStyle[ i ];
|
483
|
-
}
|
484
|
-
testElement.appendChild( div );
|
485
|
-
testElementParent = body || document.documentElement;
|
486
|
-
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
501
|
+
div.style.cssText = "position: absolute; left: 10.7432222px;";
|
502
|
+
|
503
|
+
offsetLeft = $( div ).offset().left;
|
504
|
+
supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
|
505
|
+
|
506
|
+
testElement.innerHTML = "";
|
507
|
+
testElementParent.removeChild( testElement );
|
508
|
+
})();
|
487
509
|
|
488
|
-
|
510
|
+
})();
|
489
511
|
|
490
|
-
|
491
|
-
$.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
|
512
|
+
return $.ui.position;
|
492
513
|
|
493
|
-
|
494
|
-
testElementParent.removeChild( testElement );
|
495
|
-
})();
|
514
|
+
}));
|
496
515
|
|
497
|
-
}( window.webshims && window.webshims.$ || jQuery ) );
|