11/*!
2- * Packery PACKAGED v2.1.1
2+ * Packery PACKAGED v2.1.2
33 * Gapless, draggable grid layouts
44 *
55 * Licensed GPLv3 for open source use
66 * or Packery Commercial License for commercial use
77 *
88 * http://packery.metafizzy.co
9- * Copyright 2016 Metafizzy
9+ * Copyright 2013-2018 Metafizzy
1010 */
1111
1212/**
1313 * Bridget makes jQuery widgets
14- * v2.0.0
14+ * v2.0.1
1515 * MIT license
1616 */
1717
1818/* jshint browser: true, strict: true, undef: true, unused: true */
1919
2020( function ( window , factory ) {
21- 'use strict' ;
22- /* globals define: false, module: false, require: false */
23-
21+ // universal module definition
22+ /*jshint strict: false */ /* globals define, module, require */
2423 if ( typeof define == 'function' && define . amd ) {
2524 // AMD
2625 define ( 'jquery-bridget/jquery-bridget' , [ 'jquery' ] , function ( jQuery ) {
27- factory ( window , jQuery ) ;
26+ return factory ( window , jQuery ) ;
2827 } ) ;
2928 } else if ( typeof module == 'object' && module . exports ) {
3029 // CommonJS
@@ -155,22 +154,19 @@ return jQueryBridget;
155154} ) ) ;
156155
157156/*!
158- * getSize v2.0.2
157+ * getSize v2.0.3
159158 * measure size of elements
160159 * MIT license
161160 */
162161
163- /*jshint browser: true, strict: true, undef: true, unused: true */
164- /*global define: false, module: false, console: false */
162+ /* jshint browser: true, strict: true, undef: true, unused: true */
163+ /* globals console: false */
165164
166165( function ( window , factory ) {
167- 'use strict' ;
168-
166+ /* jshint strict: false */ /* globals define, module */
169167 if ( typeof define == 'function' && define . amd ) {
170168 // AMD
171- define ( 'get-size/get-size' , [ ] , function ( ) {
172- return factory ( ) ;
173- } ) ;
169+ define ( 'get-size/get-size' , factory ) ;
174170 } else if ( typeof module == 'object' && module . exports ) {
175171 // CommonJS
176172 module . exports = factory ( ) ;
@@ -245,7 +241,7 @@ function getStyle( elem ) {
245241 if ( ! style ) {
246242 logError ( 'Style returned ' + style +
247243 '. Are you running this code in a hidden iframe on Firefox? ' +
248- 'See http ://bit.ly/getsizebug1' ) ;
244+ 'See https ://bit.ly/getsizebug1' ) ;
249245 }
250246 return style ;
251247}
@@ -271,8 +267,8 @@ function setup() {
271267 // -------------------------- box sizing -------------------------- //
272268
273269 /**
274- * WebKit measures the outer-width on style.width on border-box elems
275- * IE & Firefox<29 measures the inner-width
270+ * Chrome & Safari measure the outer-width on style.width on border-box elems
271+ * IE11 & Firefox<29 measures the inner-width
276272 */
277273 var div = document . createElement ( 'div' ) ;
278274 div . style . width = '200px' ;
@@ -284,10 +280,11 @@ function setup() {
284280 var body = document . body || document . documentElement ;
285281 body . appendChild ( div ) ;
286282 var style = getStyle ( div ) ;
283+ // round value for browser zoom. desandro/masonry#928
284+ isBoxSizeOuter = Math . round ( getStyleSize ( style . width ) ) == 200 ;
285+ getSize . isBoxSizeOuter = isBoxSizeOuter ;
287286
288- getSize . isBoxSizeOuter = isBoxSizeOuter = getStyleSize ( style . width ) == 200 ;
289287 body . removeChild ( div ) ;
290-
291288}
292289
293290// -------------------------- getSize -------------------------- //
@@ -365,7 +362,7 @@ return getSize;
365362} ) ;
366363
367364/**
368- * EvEmitter v1.0.2
365+ * EvEmitter v1.1.0
369366 * Lil' event emitter
370367 * MIT License
371368 */
@@ -374,7 +371,7 @@ return getSize;
374371
375372( function ( global , factory ) {
376373 // universal module definition
377- /* jshint strict: false */ /* globals define, module */
374+ /* jshint strict: false */ /* globals define, module, window */
378375 if ( typeof define == 'function' && define . amd ) {
379376 // AMD - RequireJS
380377 define ( 'ev-emitter/ev-emitter' , factory ) ;
@@ -386,7 +383,7 @@ return getSize;
386383 global . EvEmitter = factory ( ) ;
387384 }
388385
389- } ( this , function ( ) {
386+ } ( typeof window != 'undefined' ? window : this , function ( ) {
390387
391388
392389
@@ -445,13 +442,14 @@ proto.emitEvent = function( eventName, args ) {
445442 if ( ! listeners || ! listeners . length ) {
446443 return ;
447444 }
448- var i = 0 ;
449- var listener = listeners [ i ] ;
445+ // copy over to avoid interference if .off() in listener
446+ listeners = listeners . slice ( 0 ) ;
450447 args = args || [ ] ;
451448 // once stuff
452449 var onceListeners = this . _onceEvents && this . _onceEvents [ eventName ] ;
453450
454- while ( listener ) {
451+ for ( var i = 0 ; i < listeners . length ; i ++ ) {
452+ var listener = listeners [ i ]
455453 var isOnce = onceListeners && onceListeners [ listener ] ;
456454 if ( isOnce ) {
457455 // remove listener
@@ -462,20 +460,22 @@ proto.emitEvent = function( eventName, args ) {
462460 }
463461 // trigger listener
464462 listener . apply ( this , args ) ;
465- // get next listener
466- i += isOnce ? 0 : 1 ;
467- listener = listeners [ i ] ;
468463 }
469464
470465 return this ;
471466} ;
472467
468+ proto . allOff = function ( ) {
469+ delete this . _events ;
470+ delete this . _onceEvents ;
471+ } ;
472+
473473return EvEmitter ;
474474
475475} ) ) ;
476476
477477/**
478- * matchesSelector v2.0.1
478+ * matchesSelector v2.0.2
479479 * matchesSelector( element, '.selector' )
480480 * MIT license
481481 */
@@ -501,7 +501,7 @@ return EvEmitter;
501501 'use strict' ;
502502
503503 var matchesMethod = ( function ( ) {
504- var ElemProto = Element . prototype ;
504+ var ElemProto = window . Element . prototype ;
505505 // check for the standard method name first
506506 if ( ElemProto . matches ) {
507507 return 'matches' ;
@@ -529,7 +529,7 @@ return EvEmitter;
529529} ) ) ;
530530
531531/**
532- * Fizzy UI utils v2.0.1
532+ * Fizzy UI utils v2.0.7
533533 * MIT license
534534 */
535535
@@ -584,22 +584,27 @@ utils.modulo = function( num, div ) {
584584
585585// ----- makeArray ----- //
586586
587+ var arraySlice = Array . prototype . slice ;
588+
587589// turn element or nodeList into an array
588590utils . makeArray = function ( obj ) {
589- var ary = [ ] ;
590591 if ( Array . isArray ( obj ) ) {
591592 // use object if already an array
592- ary = obj ;
593- } else if ( obj && typeof obj . length == 'number' ) {
593+ return obj ;
594+ }
595+ // return empty array if undefined or null. #6
596+ if ( obj === null || obj === undefined ) {
597+ return [ ] ;
598+ }
599+
600+ var isArrayLike = typeof obj == 'object' && typeof obj . length == 'number' ;
601+ if ( isArrayLike ) {
594602 // convert nodeList to array
595- for ( var i = 0 ; i < obj . length ; i ++ ) {
596- ary . push ( obj [ i ] ) ;
597- }
598- } else {
599- // array of single index
600- ary . push ( obj ) ;
603+ return arraySlice . call ( obj ) ;
601604 }
602- return ary ;
605+
606+ // array of single index
607+ return [ obj ] ;
603608} ;
604609
605610// ----- removeFrom ----- //
@@ -614,7 +619,7 @@ utils.removeFrom = function( ary, obj ) {
614619// ----- getParent ----- //
615620
616621utils . getParent = function ( elem , selector ) {
617- while ( elem != document . body ) {
622+ while ( elem . parentNode && elem != document . body ) {
618623 elem = elem . parentNode ;
619624 if ( matchesSelector ( elem , selector ) ) {
620625 return elem ;
@@ -678,30 +683,31 @@ utils.filterFindElements = function( elems, selector ) {
678683// ----- debounceMethod ----- //
679684
680685utils . debounceMethod = function ( _class , methodName , threshold ) {
686+ threshold = threshold || 100 ;
681687 // original method
682688 var method = _class . prototype [ methodName ] ;
683689 var timeoutName = methodName + 'Timeout' ;
684690
685691 _class . prototype [ methodName ] = function ( ) {
686692 var timeout = this [ timeoutName ] ;
687- if ( timeout ) {
688- clearTimeout ( timeout ) ;
689- }
690- var args = arguments ;
693+ clearTimeout ( timeout ) ;
691694
695+ var args = arguments ;
692696 var _this = this ;
693697 this [ timeoutName ] = setTimeout ( function ( ) {
694698 method . apply ( _this , args ) ;
695699 delete _this [ timeoutName ] ;
696- } , threshold || 100 ) ;
700+ } , threshold ) ;
697701 } ;
698702} ;
699703
700704// ----- docReady ----- //
701705
702706utils . docReady = function ( callback ) {
703- if ( document . readyState == 'complete' ) {
704- callback ( ) ;
707+ var readyState = document . readyState ;
708+ if ( readyState == 'complete' || readyState == 'interactive' ) {
709+ // do async to allow for other scripts to run. metafizzy/flickity#441
710+ setTimeout ( callback ) ;
705711 } else {
706712 document . addEventListener ( 'DOMContentLoaded' , callback ) ;
707713 }
@@ -749,7 +755,7 @@ utils.htmlInit = function( WidgetClass, namespace ) {
749755 }
750756 // initialize
751757 var instance = new WidgetClass ( elem , options ) ;
752- // make available via $().data('layoutname ')
758+ // make available via $().data('namespace ')
753759 if ( jQuery ) {
754760 jQuery . data ( elem , namespace , instance ) ;
755761 }
@@ -899,13 +905,16 @@ proto.getPosition = function() {
899905 var isOriginTop = this . layout . _getOption ( 'originTop' ) ;
900906 var xValue = style [ isOriginLeft ? 'left' : 'right' ] ;
901907 var yValue = style [ isOriginTop ? 'top' : 'bottom' ] ;
908+ var x = parseFloat ( xValue ) ;
909+ var y = parseFloat ( yValue ) ;
902910 // convert percent to pixels
903911 var layoutSize = this . layout . size ;
904- var x = xValue . indexOf ( '%' ) != - 1 ?
905- ( parseFloat ( xValue ) / 100 ) * layoutSize . width : parseInt ( xValue , 10 ) ;
906- var y = yValue . indexOf ( '%' ) != - 1 ?
907- ( parseFloat ( yValue ) / 100 ) * layoutSize . height : parseInt ( yValue , 10 ) ;
908-
912+ if ( xValue . indexOf ( '%' ) != - 1 ) {
913+ x = ( x / 100 ) * layoutSize . width ;
914+ }
915+ if ( yValue . indexOf ( '%' ) != - 1 ) {
916+ y = ( y / 100 ) * layoutSize . height ;
917+ }
909918 // clean up 'auto' or other non-integer values
910919 x = isNaN ( x ) ? 0 : x ;
911920 y = isNaN ( y ) ? 0 : y ;
@@ -968,9 +977,7 @@ proto._transitionTo = function( x, y ) {
968977 var curX = this . position . x ;
969978 var curY = this . position . y ;
970979
971- var compareX = parseInt ( x , 10 ) ;
972- var compareY = parseInt ( y , 10 ) ;
973- var didNotMove = compareX === this . position . x && compareY === this . position . y ;
980+ var didNotMove = x == this . position . x && y == this . position . y ;
974981
975982 // save end position
976983 this . setPosition ( x , y ) ;
@@ -1013,8 +1020,8 @@ proto.goTo = function( x, y ) {
10131020proto . moveTo = proto . _transitionTo ;
10141021
10151022proto . setPosition = function ( x , y ) {
1016- this . position . x = parseInt ( x , 10 ) ;
1017- this . position . y = parseInt ( y , 10 ) ;
1023+ this . position . x = parseFloat ( x ) ;
1024+ this . position . y = parseFloat ( y ) ;
10181025} ;
10191026
10201027// ----- transition ----- //
@@ -1319,7 +1326,7 @@ return Item;
13191326} ) ) ;
13201327
13211328/*!
1322- * Outlayer v2.1.0
1329+ * Outlayer v2.1.1
13231330 * the brains and guts of a layout library
13241331 * MIT license
13251332 */
@@ -2698,7 +2705,10 @@ proto.disablePlacing = function() {
26982705
26992706// remove element from DOM
27002707proto . removeElem = function ( ) {
2701- this . element . parentNode . removeChild ( this . element ) ;
2708+ var parent = this . element . parentNode ;
2709+ if ( parent ) {
2710+ parent . removeChild ( this . element ) ;
2711+ }
27022712 // add space back to packer
27032713 this . layout . packer . addSpace ( this . rect ) ;
27042714 this . emitEvent ( 'remove' , [ this ] ) ;
@@ -2741,14 +2751,14 @@ return Item;
27412751} ) ) ;
27422752
27432753/*!
2744- * Packery v2.1.1
2754+ * Packery v2.1.2
27452755 * Gapless, draggable grid layouts
27462756 *
27472757 * Licensed GPLv3 for open source use
27482758 * or Packery Commercial License for commercial use
27492759 *
27502760 * http://packery.metafizzy.co
2751- * Copyright 2016 Metafizzy
2761+ * Copyright 2013-2018 Metafizzy
27522762 */
27532763
27542764( function ( window , factory ) {
@@ -3304,7 +3314,8 @@ proto.itemDragMove = function( elem, x, y ) {
33043314
33053315 // throttle
33063316 var now = new Date ( ) ;
3307- if ( this . _itemDragTime && now - this . _itemDragTime < DRAG_THROTTLE_TIME ) {
3317+ var isThrottled = this . _itemDragTime && now - this . _itemDragTime < DRAG_THROTTLE_TIME ;
3318+ if ( isThrottled ) {
33083319 clearTimeout ( this . dragTimeout ) ;
33093320 this . dragTimeout = setTimeout ( onDrag , DRAG_THROTTLE_TIME ) ;
33103321 } else {
0 commit comments