packery-rails 1.3.2 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packery/rails/version.rb +1 -1
- data/vendor/assets/javascripts/packery.pkgd.js +705 -537
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bbc6fa5bf1ecaf07a9762810c212a598e2b40ee
|
4
|
+
data.tar.gz: 472e8e39eeb775ed5100bf8936f2282c26610c9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d46f8c6fd798274549047629786117c4e86d0c2b55bd6de4f1c8f34bb0f8ae1645cc4c1f31446e768a9ccd6c484a7a64205237c9159ebb3e1c851e993caffb47
|
7
|
+
data.tar.gz: b2279f2244935d65c81c8e13018d6b7d123fb925da84eaa4c82f4d32199db31dfd09b13b70cede10d30e3750fb84f2da1c2e7e6a9588b3fea59510ca1eb740c4
|
@@ -1,13 +1,11 @@
|
|
1
1
|
/*!
|
2
|
-
* Packery PACKAGED v1.
|
2
|
+
* Packery PACKAGED v1.4.1
|
3
3
|
* bin-packing layout library
|
4
|
-
* http://packery.metafizzy.co
|
5
|
-
*
|
6
|
-
* Commercial use requires one-time purchase of a commercial license
|
7
|
-
* http://packery.metafizzy.co/license.html
|
8
4
|
*
|
9
|
-
*
|
5
|
+
* Licensed GPLv3 for open source use
|
6
|
+
* or Flickity Commercial License for commercial use
|
10
7
|
*
|
8
|
+
* http://packery.metafizzy.co
|
11
9
|
* Copyright 2015 Metafizzy
|
12
10
|
*/
|
13
11
|
|
@@ -627,87 +625,6 @@ if ( typeof define === 'function' && define.amd ) {
|
|
627
625
|
|
628
626
|
})( window );
|
629
627
|
|
630
|
-
/*!
|
631
|
-
* docReady v1.0.4
|
632
|
-
* Cross browser DOMContentLoaded event emitter
|
633
|
-
* MIT license
|
634
|
-
*/
|
635
|
-
|
636
|
-
/*jshint browser: true, strict: true, undef: true, unused: true*/
|
637
|
-
/*global define: false, require: false, module: false */
|
638
|
-
|
639
|
-
( function( window ) {
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
var document = window.document;
|
644
|
-
// collection of functions to be triggered on ready
|
645
|
-
var queue = [];
|
646
|
-
|
647
|
-
function docReady( fn ) {
|
648
|
-
// throw out non-functions
|
649
|
-
if ( typeof fn !== 'function' ) {
|
650
|
-
return;
|
651
|
-
}
|
652
|
-
|
653
|
-
if ( docReady.isReady ) {
|
654
|
-
// ready now, hit it
|
655
|
-
fn();
|
656
|
-
} else {
|
657
|
-
// queue function when ready
|
658
|
-
queue.push( fn );
|
659
|
-
}
|
660
|
-
}
|
661
|
-
|
662
|
-
docReady.isReady = false;
|
663
|
-
|
664
|
-
// triggered on various doc ready events
|
665
|
-
function onReady( event ) {
|
666
|
-
// bail if already triggered or IE8 document is not ready just yet
|
667
|
-
var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete';
|
668
|
-
if ( docReady.isReady || isIE8NotReady ) {
|
669
|
-
return;
|
670
|
-
}
|
671
|
-
|
672
|
-
trigger();
|
673
|
-
}
|
674
|
-
|
675
|
-
function trigger() {
|
676
|
-
docReady.isReady = true;
|
677
|
-
// process queue
|
678
|
-
for ( var i=0, len = queue.length; i < len; i++ ) {
|
679
|
-
var fn = queue[i];
|
680
|
-
fn();
|
681
|
-
}
|
682
|
-
}
|
683
|
-
|
684
|
-
function defineDocReady( eventie ) {
|
685
|
-
// trigger ready if page is ready
|
686
|
-
if ( document.readyState === 'complete' ) {
|
687
|
-
trigger();
|
688
|
-
} else {
|
689
|
-
// listen for events
|
690
|
-
eventie.bind( document, 'DOMContentLoaded', onReady );
|
691
|
-
eventie.bind( document, 'readystatechange', onReady );
|
692
|
-
eventie.bind( window, 'load', onReady );
|
693
|
-
}
|
694
|
-
|
695
|
-
return docReady;
|
696
|
-
}
|
697
|
-
|
698
|
-
// transport
|
699
|
-
if ( typeof define === 'function' && define.amd ) {
|
700
|
-
// AMD
|
701
|
-
define( 'doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady );
|
702
|
-
} else if ( typeof exports === 'object' ) {
|
703
|
-
module.exports = defineDocReady( require('eventie') );
|
704
|
-
} else {
|
705
|
-
// browser global
|
706
|
-
window.docReady = defineDocReady( window.eventie );
|
707
|
-
}
|
708
|
-
|
709
|
-
})( window );
|
710
|
-
|
711
628
|
/*!
|
712
629
|
* EventEmitter v4.2.11 - git.io/ee
|
713
630
|
* Unlicense - http://unlicense.org/
|
@@ -1181,8 +1098,89 @@ if ( typeof define === 'function' && define.amd ) {
|
|
1181
1098
|
}
|
1182
1099
|
}.call(this));
|
1183
1100
|
|
1101
|
+
/*!
|
1102
|
+
* docReady v1.0.4
|
1103
|
+
* Cross browser DOMContentLoaded event emitter
|
1104
|
+
* MIT license
|
1105
|
+
*/
|
1106
|
+
|
1107
|
+
/*jshint browser: true, strict: true, undef: true, unused: true*/
|
1108
|
+
/*global define: false, require: false, module: false */
|
1109
|
+
|
1110
|
+
( function( window ) {
|
1111
|
+
|
1112
|
+
|
1113
|
+
|
1114
|
+
var document = window.document;
|
1115
|
+
// collection of functions to be triggered on ready
|
1116
|
+
var queue = [];
|
1117
|
+
|
1118
|
+
function docReady( fn ) {
|
1119
|
+
// throw out non-functions
|
1120
|
+
if ( typeof fn !== 'function' ) {
|
1121
|
+
return;
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
if ( docReady.isReady ) {
|
1125
|
+
// ready now, hit it
|
1126
|
+
fn();
|
1127
|
+
} else {
|
1128
|
+
// queue function when ready
|
1129
|
+
queue.push( fn );
|
1130
|
+
}
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
docReady.isReady = false;
|
1134
|
+
|
1135
|
+
// triggered on various doc ready events
|
1136
|
+
function onReady( event ) {
|
1137
|
+
// bail if already triggered or IE8 document is not ready just yet
|
1138
|
+
var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete';
|
1139
|
+
if ( docReady.isReady || isIE8NotReady ) {
|
1140
|
+
return;
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
trigger();
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
function trigger() {
|
1147
|
+
docReady.isReady = true;
|
1148
|
+
// process queue
|
1149
|
+
for ( var i=0, len = queue.length; i < len; i++ ) {
|
1150
|
+
var fn = queue[i];
|
1151
|
+
fn();
|
1152
|
+
}
|
1153
|
+
}
|
1154
|
+
|
1155
|
+
function defineDocReady( eventie ) {
|
1156
|
+
// trigger ready if page is ready
|
1157
|
+
if ( document.readyState === 'complete' ) {
|
1158
|
+
trigger();
|
1159
|
+
} else {
|
1160
|
+
// listen for events
|
1161
|
+
eventie.bind( document, 'DOMContentLoaded', onReady );
|
1162
|
+
eventie.bind( document, 'readystatechange', onReady );
|
1163
|
+
eventie.bind( window, 'load', onReady );
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
return docReady;
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
// transport
|
1170
|
+
if ( typeof define === 'function' && define.amd ) {
|
1171
|
+
// AMD
|
1172
|
+
define( 'doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady );
|
1173
|
+
} else if ( typeof exports === 'object' ) {
|
1174
|
+
module.exports = defineDocReady( require('eventie') );
|
1175
|
+
} else {
|
1176
|
+
// browser global
|
1177
|
+
window.docReady = defineDocReady( window.eventie );
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
})( window );
|
1181
|
+
|
1184
1182
|
/**
|
1185
|
-
* matchesSelector v1.0.
|
1183
|
+
* matchesSelector v1.0.3
|
1186
1184
|
* matchesSelector( element, '.selector' )
|
1187
1185
|
* MIT license
|
1188
1186
|
*/
|
@@ -1195,6 +1193,10 @@ if ( typeof define === 'function' && define.amd ) {
|
|
1195
1193
|
|
1196
1194
|
|
1197
1195
|
var matchesMethod = ( function() {
|
1196
|
+
// check for the standard method name first
|
1197
|
+
if ( ElemProto.matches ) {
|
1198
|
+
return 'matches';
|
1199
|
+
}
|
1198
1200
|
// check un-prefixed
|
1199
1201
|
if ( ElemProto.matchesSelector ) {
|
1200
1202
|
return 'matchesSelector';
|
@@ -1285,15 +1287,321 @@ if ( typeof define === 'function' && define.amd ) {
|
|
1285
1287
|
|
1286
1288
|
})( Element.prototype );
|
1287
1289
|
|
1290
|
+
/**
|
1291
|
+
* Fizzy UI utils v1.0.1
|
1292
|
+
* MIT license
|
1293
|
+
*/
|
1294
|
+
|
1295
|
+
/*jshint browser: true, undef: true, unused: true, strict: true */
|
1296
|
+
|
1297
|
+
( function( window, factory ) {
|
1298
|
+
/*global define: false, module: false, require: false */
|
1299
|
+
|
1300
|
+
// universal module definition
|
1301
|
+
|
1302
|
+
if ( typeof define == 'function' && define.amd ) {
|
1303
|
+
// AMD
|
1304
|
+
define( 'fizzy-ui-utils/utils',[
|
1305
|
+
'doc-ready/doc-ready',
|
1306
|
+
'matches-selector/matches-selector'
|
1307
|
+
], function( docReady, matchesSelector ) {
|
1308
|
+
return factory( window, docReady, matchesSelector );
|
1309
|
+
});
|
1310
|
+
} else if ( typeof exports == 'object' ) {
|
1311
|
+
// CommonJS
|
1312
|
+
module.exports = factory(
|
1313
|
+
window,
|
1314
|
+
require('doc-ready'),
|
1315
|
+
require('desandro-matches-selector')
|
1316
|
+
);
|
1317
|
+
} else {
|
1318
|
+
// browser global
|
1319
|
+
window.fizzyUIUtils = factory(
|
1320
|
+
window,
|
1321
|
+
window.docReady,
|
1322
|
+
window.matchesSelector
|
1323
|
+
);
|
1324
|
+
}
|
1325
|
+
|
1326
|
+
}( window, function factory( window, docReady, matchesSelector ) {
|
1327
|
+
|
1328
|
+
|
1329
|
+
|
1330
|
+
var utils = {};
|
1331
|
+
|
1332
|
+
// ----- extend ----- //
|
1333
|
+
|
1334
|
+
// extends objects
|
1335
|
+
utils.extend = function( a, b ) {
|
1336
|
+
for ( var prop in b ) {
|
1337
|
+
a[ prop ] = b[ prop ];
|
1338
|
+
}
|
1339
|
+
return a;
|
1340
|
+
};
|
1341
|
+
|
1342
|
+
// ----- modulo ----- //
|
1343
|
+
|
1344
|
+
utils.modulo = function( num, div ) {
|
1345
|
+
return ( ( num % div ) + div ) % div;
|
1346
|
+
};
|
1347
|
+
|
1348
|
+
// ----- isArray ----- //
|
1349
|
+
|
1350
|
+
var objToString = Object.prototype.toString;
|
1351
|
+
utils.isArray = function( obj ) {
|
1352
|
+
return objToString.call( obj ) == '[object Array]';
|
1353
|
+
};
|
1354
|
+
|
1355
|
+
// ----- makeArray ----- //
|
1356
|
+
|
1357
|
+
// turn element or nodeList into an array
|
1358
|
+
utils.makeArray = function( obj ) {
|
1359
|
+
var ary = [];
|
1360
|
+
if ( utils.isArray( obj ) ) {
|
1361
|
+
// use object if already an array
|
1362
|
+
ary = obj;
|
1363
|
+
} else if ( obj && typeof obj.length == 'number' ) {
|
1364
|
+
// convert nodeList to array
|
1365
|
+
for ( var i=0, len = obj.length; i < len; i++ ) {
|
1366
|
+
ary.push( obj[i] );
|
1367
|
+
}
|
1368
|
+
} else {
|
1369
|
+
// array of single index
|
1370
|
+
ary.push( obj );
|
1371
|
+
}
|
1372
|
+
return ary;
|
1373
|
+
};
|
1374
|
+
|
1375
|
+
// ----- indexOf ----- //
|
1376
|
+
|
1377
|
+
// index of helper cause IE8
|
1378
|
+
utils.indexOf = Array.prototype.indexOf ? function( ary, obj ) {
|
1379
|
+
return ary.indexOf( obj );
|
1380
|
+
} : function( ary, obj ) {
|
1381
|
+
for ( var i=0, len = ary.length; i < len; i++ ) {
|
1382
|
+
if ( ary[i] === obj ) {
|
1383
|
+
return i;
|
1384
|
+
}
|
1385
|
+
}
|
1386
|
+
return -1;
|
1387
|
+
};
|
1388
|
+
|
1389
|
+
// ----- removeFrom ----- //
|
1390
|
+
|
1391
|
+
utils.removeFrom = function( ary, obj ) {
|
1392
|
+
var index = utils.indexOf( ary, obj );
|
1393
|
+
if ( index != -1 ) {
|
1394
|
+
ary.splice( index, 1 );
|
1395
|
+
}
|
1396
|
+
};
|
1397
|
+
|
1398
|
+
// ----- isElement ----- //
|
1399
|
+
|
1400
|
+
// http://stackoverflow.com/a/384380/182183
|
1401
|
+
utils.isElement = ( typeof HTMLElement == 'function' || typeof HTMLElement == 'object' ) ?
|
1402
|
+
function isElementDOM2( obj ) {
|
1403
|
+
return obj instanceof HTMLElement;
|
1404
|
+
} :
|
1405
|
+
function isElementQuirky( obj ) {
|
1406
|
+
return obj && typeof obj == 'object' &&
|
1407
|
+
obj.nodeType == 1 && typeof obj.nodeName == 'string';
|
1408
|
+
};
|
1409
|
+
|
1410
|
+
// ----- setText ----- //
|
1411
|
+
|
1412
|
+
utils.setText = ( function() {
|
1413
|
+
var setTextProperty;
|
1414
|
+
function setText( elem, text ) {
|
1415
|
+
// only check setTextProperty once
|
1416
|
+
setTextProperty = setTextProperty || ( document.documentElement.textContent !== undefined ? 'textContent' : 'innerText' );
|
1417
|
+
elem[ setTextProperty ] = text;
|
1418
|
+
}
|
1419
|
+
return setText;
|
1420
|
+
})();
|
1421
|
+
|
1422
|
+
// ----- getParent ----- //
|
1423
|
+
|
1424
|
+
utils.getParent = function( elem, selector ) {
|
1425
|
+
while ( elem != document.body ) {
|
1426
|
+
elem = elem.parentNode;
|
1427
|
+
if ( matchesSelector( elem, selector ) ) {
|
1428
|
+
return elem;
|
1429
|
+
}
|
1430
|
+
}
|
1431
|
+
};
|
1432
|
+
|
1433
|
+
// ----- getQueryElement ----- //
|
1434
|
+
|
1435
|
+
// use element as selector string
|
1436
|
+
utils.getQueryElement = function( elem ) {
|
1437
|
+
if ( typeof elem == 'string' ) {
|
1438
|
+
return document.querySelector( elem );
|
1439
|
+
}
|
1440
|
+
return elem;
|
1441
|
+
};
|
1442
|
+
|
1443
|
+
// ----- handleEvent ----- //
|
1444
|
+
|
1445
|
+
// enable .ontype to trigger from .addEventListener( elem, 'type' )
|
1446
|
+
utils.handleEvent = function( event ) {
|
1447
|
+
var method = 'on' + event.type;
|
1448
|
+
if ( this[ method ] ) {
|
1449
|
+
this[ method ]( event );
|
1450
|
+
}
|
1451
|
+
};
|
1452
|
+
|
1453
|
+
// ----- filterFindElements ----- //
|
1454
|
+
|
1455
|
+
utils.filterFindElements = function( elems, selector ) {
|
1456
|
+
// make array of elems
|
1457
|
+
elems = utils.makeArray( elems );
|
1458
|
+
var ffElems = [];
|
1459
|
+
|
1460
|
+
for ( var i=0, len = elems.length; i < len; i++ ) {
|
1461
|
+
var elem = elems[i];
|
1462
|
+
// check that elem is an actual element
|
1463
|
+
if ( !utils.isElement( elem ) ) {
|
1464
|
+
continue;
|
1465
|
+
}
|
1466
|
+
// filter & find items if we have a selector
|
1467
|
+
if ( selector ) {
|
1468
|
+
// filter siblings
|
1469
|
+
if ( matchesSelector( elem, selector ) ) {
|
1470
|
+
ffElems.push( elem );
|
1471
|
+
}
|
1472
|
+
// find children
|
1473
|
+
var childElems = elem.querySelectorAll( selector );
|
1474
|
+
// concat childElems to filterFound array
|
1475
|
+
for ( var j=0, jLen = childElems.length; j < jLen; j++ ) {
|
1476
|
+
ffElems.push( childElems[j] );
|
1477
|
+
}
|
1478
|
+
} else {
|
1479
|
+
ffElems.push( elem );
|
1480
|
+
}
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
return ffElems;
|
1484
|
+
};
|
1485
|
+
|
1486
|
+
// ----- debounceMethod ----- //
|
1487
|
+
|
1488
|
+
utils.debounceMethod = function( _class, methodName, threshold ) {
|
1489
|
+
// original method
|
1490
|
+
var method = _class.prototype[ methodName ];
|
1491
|
+
var timeoutName = methodName + 'Timeout';
|
1492
|
+
|
1493
|
+
_class.prototype[ methodName ] = function() {
|
1494
|
+
var timeout = this[ timeoutName ];
|
1495
|
+
if ( timeout ) {
|
1496
|
+
clearTimeout( timeout );
|
1497
|
+
}
|
1498
|
+
var args = arguments;
|
1499
|
+
|
1500
|
+
var _this = this;
|
1501
|
+
this[ timeoutName ] = setTimeout( function() {
|
1502
|
+
method.apply( _this, args );
|
1503
|
+
delete _this[ timeoutName ];
|
1504
|
+
}, threshold || 100 );
|
1505
|
+
};
|
1506
|
+
};
|
1507
|
+
|
1508
|
+
// ----- htmlInit ----- //
|
1509
|
+
|
1510
|
+
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
1511
|
+
utils.toDashed = function( str ) {
|
1512
|
+
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
|
1513
|
+
return $1 + '-' + $2;
|
1514
|
+
}).toLowerCase();
|
1515
|
+
};
|
1516
|
+
|
1517
|
+
var console = window.console;
|
1518
|
+
/**
|
1519
|
+
* allow user to initialize classes via .js-namespace class
|
1520
|
+
* htmlInit( Widget, 'widgetName' )
|
1521
|
+
* options are parsed from data-namespace-option attribute
|
1522
|
+
*/
|
1523
|
+
utils.htmlInit = function( WidgetClass, namespace ) {
|
1524
|
+
docReady( function() {
|
1525
|
+
var dashedNamespace = utils.toDashed( namespace );
|
1526
|
+
var elems = document.querySelectorAll( '.js-' + dashedNamespace );
|
1527
|
+
var dataAttr = 'data-' + dashedNamespace + '-options';
|
1528
|
+
|
1529
|
+
for ( var i=0, len = elems.length; i < len; i++ ) {
|
1530
|
+
var elem = elems[i];
|
1531
|
+
var attr = elem.getAttribute( dataAttr );
|
1532
|
+
var options;
|
1533
|
+
try {
|
1534
|
+
options = attr && JSON.parse( attr );
|
1535
|
+
} catch ( error ) {
|
1536
|
+
// log error, do not initialize
|
1537
|
+
if ( console ) {
|
1538
|
+
console.error( 'Error parsing ' + dataAttr + ' on ' +
|
1539
|
+
elem.nodeName.toLowerCase() + ( elem.id ? '#' + elem.id : '' ) + ': ' +
|
1540
|
+
error );
|
1541
|
+
}
|
1542
|
+
continue;
|
1543
|
+
}
|
1544
|
+
// initialize
|
1545
|
+
var instance = new WidgetClass( elem, options );
|
1546
|
+
// make available via $().data('layoutname')
|
1547
|
+
var jQuery = window.jQuery;
|
1548
|
+
if ( jQuery ) {
|
1549
|
+
jQuery.data( elem, namespace, instance );
|
1550
|
+
}
|
1551
|
+
}
|
1552
|
+
});
|
1553
|
+
};
|
1554
|
+
|
1555
|
+
// ----- ----- //
|
1556
|
+
|
1557
|
+
return utils;
|
1558
|
+
|
1559
|
+
}));
|
1560
|
+
|
1288
1561
|
/**
|
1289
1562
|
* Outlayer Item
|
1290
1563
|
*/
|
1291
1564
|
|
1292
|
-
( function( window ) {
|
1565
|
+
( function( window, factory ) {
|
1566
|
+
|
1567
|
+
// universal module definition
|
1568
|
+
if ( typeof define === 'function' && define.amd ) {
|
1569
|
+
// AMD
|
1570
|
+
define( 'outlayer/item',[
|
1571
|
+
'eventEmitter/EventEmitter',
|
1572
|
+
'get-size/get-size',
|
1573
|
+
'get-style-property/get-style-property',
|
1574
|
+
'fizzy-ui-utils/utils'
|
1575
|
+
],
|
1576
|
+
function( EventEmitter, getSize, getStyleProperty, utils ) {
|
1577
|
+
return factory( window, EventEmitter, getSize, getStyleProperty, utils );
|
1578
|
+
}
|
1579
|
+
);
|
1580
|
+
} else if (typeof exports === 'object') {
|
1581
|
+
// CommonJS
|
1582
|
+
module.exports = factory(
|
1583
|
+
window,
|
1584
|
+
require('wolfy87-eventemitter'),
|
1585
|
+
require('get-size'),
|
1586
|
+
require('desandro-get-style-property'),
|
1587
|
+
require('fizzy-ui-utils')
|
1588
|
+
);
|
1589
|
+
} else {
|
1590
|
+
// browser global
|
1591
|
+
window.Outlayer = {};
|
1592
|
+
window.Outlayer.Item = factory(
|
1593
|
+
window,
|
1594
|
+
window.EventEmitter,
|
1595
|
+
window.getSize,
|
1596
|
+
window.getStyleProperty,
|
1597
|
+
window.fizzyUIUtils
|
1598
|
+
);
|
1599
|
+
}
|
1293
1600
|
|
1601
|
+
}( window, function factory( window, EventEmitter, getSize, getStyleProperty, utils ) {
|
1294
1602
|
|
1295
1603
|
|
1296
|
-
// -----
|
1604
|
+
// ----- helpers ----- //
|
1297
1605
|
|
1298
1606
|
var getComputedStyle = window.getComputedStyle;
|
1299
1607
|
var getStyle = getComputedStyle ?
|
@@ -1305,14 +1613,6 @@ var getStyle = getComputedStyle ?
|
|
1305
1613
|
};
|
1306
1614
|
|
1307
1615
|
|
1308
|
-
// extend objects
|
1309
|
-
function extend( a, b ) {
|
1310
|
-
for ( var prop in b ) {
|
1311
|
-
a[ prop ] = b[ prop ];
|
1312
|
-
}
|
1313
|
-
return a;
|
1314
|
-
}
|
1315
|
-
|
1316
1616
|
function isEmptyObj( obj ) {
|
1317
1617
|
for ( var prop in obj ) {
|
1318
1618
|
return false;
|
@@ -1321,17 +1621,6 @@ function isEmptyObj( obj ) {
|
|
1321
1621
|
return true;
|
1322
1622
|
}
|
1323
1623
|
|
1324
|
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
1325
|
-
function toDash( str ) {
|
1326
|
-
return str.replace( /([A-Z])/g, function( $1 ){
|
1327
|
-
return '-' + $1.toLowerCase();
|
1328
|
-
});
|
1329
|
-
}
|
1330
|
-
|
1331
|
-
// -------------------------- Outlayer definition -------------------------- //
|
1332
|
-
|
1333
|
-
function outlayerItemDefinition( EventEmitter, getSize, getStyleProperty ) {
|
1334
|
-
|
1335
1624
|
// -------------------------- CSS3 support -------------------------- //
|
1336
1625
|
|
1337
1626
|
var transitionProperty = getStyleProperty('transition');
|
@@ -1386,7 +1675,7 @@ function Item( element, layout ) {
|
|
1386
1675
|
}
|
1387
1676
|
|
1388
1677
|
// inherit EventEmitter
|
1389
|
-
extend( Item.prototype, EventEmitter.prototype );
|
1678
|
+
utils.extend( Item.prototype, EventEmitter.prototype );
|
1390
1679
|
|
1391
1680
|
Item.prototype._create = function() {
|
1392
1681
|
// transition objects
|
@@ -1454,22 +1743,31 @@ Item.prototype.layoutPosition = function() {
|
|
1454
1743
|
var layoutOptions = this.layout.options;
|
1455
1744
|
var style = {};
|
1456
1745
|
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1746
|
+
// x
|
1747
|
+
var xPadding = layoutOptions.isOriginLeft ? 'paddingLeft' : 'paddingRight';
|
1748
|
+
var xProperty = layoutOptions.isOriginLeft ? 'left' : 'right';
|
1749
|
+
var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left';
|
1750
|
+
|
1751
|
+
var x = this.position.x + layoutSize[ xPadding ];
|
1752
|
+
// set in percentage
|
1753
|
+
x = layoutOptions.percentPosition && !layoutOptions.isHorizontal ?
|
1754
|
+
( ( x / layoutSize.width ) * 100 ) + '%' : x + 'px';
|
1755
|
+
style[ xProperty ] = x;
|
1756
|
+
// reset other property
|
1757
|
+
style[ xResetProperty ] = '';
|
1758
|
+
|
1759
|
+
// y
|
1760
|
+
var yPadding = layoutOptions.isOriginTop ? 'paddingTop' : 'paddingBottom';
|
1761
|
+
var yProperty = layoutOptions.isOriginTop ? 'top' : 'bottom';
|
1762
|
+
var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top';
|
1763
|
+
|
1764
|
+
var y = this.position.y + layoutSize[ yPadding ];
|
1765
|
+
// set in percentage
|
1766
|
+
y = layoutOptions.percentPosition && layoutOptions.isHorizontal ?
|
1767
|
+
( ( y / layoutSize.height ) * 100 ) + '%' : y + 'px';
|
1768
|
+
style[ yProperty ] = y;
|
1769
|
+
// reset other property
|
1770
|
+
style[ yResetProperty ] = '';
|
1473
1771
|
|
1474
1772
|
this.css( style );
|
1475
1773
|
this.emitEvent( 'layout', [ this ] );
|
@@ -1602,7 +1900,7 @@ Item.prototype._transition = function( args ) {
|
|
1602
1900
|
|
1603
1901
|
};
|
1604
1902
|
|
1605
|
-
var itemTransitionProperties = transformProperty && (
|
1903
|
+
var itemTransitionProperties = transformProperty && ( utils.toDashed( transformProperty ) +
|
1606
1904
|
',opacity' );
|
1607
1905
|
|
1608
1906
|
Item.prototype.enableTransition = function(/* style */) {
|
@@ -1715,6 +2013,8 @@ Item.prototype.removeTransitionStyles = function() {
|
|
1715
2013
|
// remove element from DOM
|
1716
2014
|
Item.prototype.removeElem = function() {
|
1717
2015
|
this.element.parentNode.removeChild( this.element );
|
2016
|
+
// remove display: none
|
2017
|
+
this.css({ display: '' });
|
1718
2018
|
this.emitEvent( 'remove', [ this ] );
|
1719
2019
|
};
|
1720
2020
|
|
@@ -1727,9 +2027,8 @@ Item.prototype.remove = function() {
|
|
1727
2027
|
|
1728
2028
|
// start transition
|
1729
2029
|
var _this = this;
|
1730
|
-
this.
|
2030
|
+
this.once( 'transitionEnd', function() {
|
1731
2031
|
_this.removeElem();
|
1732
|
-
return true; // bind once
|
1733
2032
|
});
|
1734
2033
|
this.hide();
|
1735
2034
|
};
|
@@ -1740,13 +2039,44 @@ Item.prototype.reveal = function() {
|
|
1740
2039
|
this.css({ display: '' });
|
1741
2040
|
|
1742
2041
|
var options = this.layout.options;
|
2042
|
+
|
2043
|
+
var onTransitionEnd = {};
|
2044
|
+
var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle');
|
2045
|
+
onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd;
|
2046
|
+
|
1743
2047
|
this.transition({
|
1744
2048
|
from: options.hiddenStyle,
|
1745
2049
|
to: options.visibleStyle,
|
1746
|
-
isCleaning: true
|
2050
|
+
isCleaning: true,
|
2051
|
+
onTransitionEnd: onTransitionEnd
|
1747
2052
|
});
|
1748
2053
|
};
|
1749
2054
|
|
2055
|
+
Item.prototype.onRevealTransitionEnd = function() {
|
2056
|
+
// check if still visible
|
2057
|
+
// during transition, item may have been hidden
|
2058
|
+
if ( !this.isHidden ) {
|
2059
|
+
this.emitEvent('reveal');
|
2060
|
+
}
|
2061
|
+
};
|
2062
|
+
|
2063
|
+
/**
|
2064
|
+
* get style property use for hide/reveal transition end
|
2065
|
+
* @param {String} styleProperty - hiddenStyle/visibleStyle
|
2066
|
+
* @returns {String}
|
2067
|
+
*/
|
2068
|
+
Item.prototype.getHideRevealTransitionEndProperty = function( styleProperty ) {
|
2069
|
+
var optionStyle = this.layout.options[ styleProperty ];
|
2070
|
+
// use opacity
|
2071
|
+
if ( optionStyle.opacity ) {
|
2072
|
+
return 'opacity';
|
2073
|
+
}
|
2074
|
+
// get first property
|
2075
|
+
for ( var prop in optionStyle ) {
|
2076
|
+
return prop;
|
2077
|
+
}
|
2078
|
+
};
|
2079
|
+
|
1750
2080
|
Item.prototype.hide = function() {
|
1751
2081
|
// set flag
|
1752
2082
|
this.isHidden = true;
|
@@ -1754,23 +2084,29 @@ Item.prototype.hide = function() {
|
|
1754
2084
|
this.css({ display: '' });
|
1755
2085
|
|
1756
2086
|
var options = this.layout.options;
|
2087
|
+
|
2088
|
+
var onTransitionEnd = {};
|
2089
|
+
var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle');
|
2090
|
+
onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd;
|
2091
|
+
|
1757
2092
|
this.transition({
|
1758
2093
|
from: options.visibleStyle,
|
1759
2094
|
to: options.hiddenStyle,
|
1760
2095
|
// keep hidden stuff hidden
|
1761
2096
|
isCleaning: true,
|
1762
|
-
onTransitionEnd:
|
1763
|
-
opacity: function() {
|
1764
|
-
// check if still hidden
|
1765
|
-
// during transition, item may have been un-hidden
|
1766
|
-
if ( this.isHidden ) {
|
1767
|
-
this.css({ display: 'none' });
|
1768
|
-
}
|
1769
|
-
}
|
1770
|
-
}
|
2097
|
+
onTransitionEnd: onTransitionEnd
|
1771
2098
|
});
|
1772
2099
|
};
|
1773
2100
|
|
2101
|
+
Item.prototype.onHideTransitionEnd = function() {
|
2102
|
+
// check if still hidden
|
2103
|
+
// during transition, item may have been un-hidden
|
2104
|
+
if ( this.isHidden ) {
|
2105
|
+
this.css({ display: 'none' });
|
2106
|
+
this.emitEvent('hide');
|
2107
|
+
}
|
2108
|
+
};
|
2109
|
+
|
1774
2110
|
Item.prototype.destroy = function() {
|
1775
2111
|
this.css({
|
1776
2112
|
position: '',
|
@@ -1780,131 +2116,66 @@ Item.prototype.destroy = function() {
|
|
1780
2116
|
bottom: '',
|
1781
2117
|
transition: '',
|
1782
2118
|
transform: ''
|
1783
|
-
});
|
1784
|
-
};
|
1785
|
-
|
1786
|
-
return Item;
|
1787
|
-
|
1788
|
-
}
|
1789
|
-
|
1790
|
-
// -------------------------- transport -------------------------- //
|
2119
|
+
});
|
2120
|
+
};
|
1791
2121
|
|
1792
|
-
|
1793
|
-
// AMD
|
1794
|
-
define( 'outlayer/item',[
|
1795
|
-
'eventEmitter/EventEmitter',
|
1796
|
-
'get-size/get-size',
|
1797
|
-
'get-style-property/get-style-property'
|
1798
|
-
],
|
1799
|
-
outlayerItemDefinition );
|
1800
|
-
} else if (typeof exports === 'object') {
|
1801
|
-
// CommonJS
|
1802
|
-
module.exports = outlayerItemDefinition(
|
1803
|
-
require('wolfy87-eventemitter'),
|
1804
|
-
require('get-size'),
|
1805
|
-
require('desandro-get-style-property')
|
1806
|
-
);
|
1807
|
-
} else {
|
1808
|
-
// browser global
|
1809
|
-
window.Outlayer = {};
|
1810
|
-
window.Outlayer.Item = outlayerItemDefinition(
|
1811
|
-
window.EventEmitter,
|
1812
|
-
window.getSize,
|
1813
|
-
window.getStyleProperty
|
1814
|
-
);
|
1815
|
-
}
|
2122
|
+
return Item;
|
1816
2123
|
|
1817
|
-
})
|
2124
|
+
}));
|
1818
2125
|
|
1819
2126
|
/*!
|
1820
|
-
* Outlayer v1.
|
2127
|
+
* Outlayer v1.4.0
|
1821
2128
|
* the brains and guts of a layout library
|
1822
2129
|
* MIT license
|
1823
2130
|
*/
|
1824
2131
|
|
1825
|
-
( function( window ) {
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
// ----- vars ----- //
|
1830
|
-
|
1831
|
-
var document = window.document;
|
1832
|
-
var console = window.console;
|
1833
|
-
var jQuery = window.jQuery;
|
1834
|
-
var noop = function() {};
|
1835
|
-
|
1836
|
-
// -------------------------- helpers -------------------------- //
|
1837
|
-
|
1838
|
-
// extend objects
|
1839
|
-
function extend( a, b ) {
|
1840
|
-
for ( var prop in b ) {
|
1841
|
-
a[ prop ] = b[ prop ];
|
1842
|
-
}
|
1843
|
-
return a;
|
1844
|
-
}
|
2132
|
+
( function( window, factory ) {
|
1845
2133
|
|
2134
|
+
// universal module definition
|
1846
2135
|
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
2136
|
+
if ( typeof define == 'function' && define.amd ) {
|
2137
|
+
// AMD
|
2138
|
+
define( 'outlayer/outlayer',[
|
2139
|
+
'eventie/eventie',
|
2140
|
+
'eventEmitter/EventEmitter',
|
2141
|
+
'get-size/get-size',
|
2142
|
+
'fizzy-ui-utils/utils',
|
2143
|
+
'./item'
|
2144
|
+
],
|
2145
|
+
function( eventie, EventEmitter, getSize, utils, Item ) {
|
2146
|
+
return factory( window, eventie, EventEmitter, getSize, utils, Item);
|
2147
|
+
}
|
2148
|
+
);
|
2149
|
+
} else if ( typeof exports == 'object' ) {
|
2150
|
+
// CommonJS
|
2151
|
+
module.exports = factory(
|
2152
|
+
window,
|
2153
|
+
require('eventie'),
|
2154
|
+
require('wolfy87-eventemitter'),
|
2155
|
+
require('get-size'),
|
2156
|
+
require('fizzy-ui-utils'),
|
2157
|
+
require('./item')
|
2158
|
+
);
|
1863
2159
|
} else {
|
1864
|
-
//
|
1865
|
-
|
2160
|
+
// browser global
|
2161
|
+
window.Outlayer = factory(
|
2162
|
+
window,
|
2163
|
+
window.eventie,
|
2164
|
+
window.EventEmitter,
|
2165
|
+
window.getSize,
|
2166
|
+
window.fizzyUIUtils,
|
2167
|
+
window.Outlayer.Item
|
2168
|
+
);
|
1866
2169
|
}
|
1867
|
-
return ary;
|
1868
|
-
}
|
1869
|
-
|
1870
|
-
// http://stackoverflow.com/a/384380/182183
|
1871
|
-
var isElement = ( typeof HTMLElement === 'function' || typeof HTMLElement === 'object' ) ?
|
1872
|
-
function isElementDOM2( obj ) {
|
1873
|
-
return obj instanceof HTMLElement;
|
1874
|
-
} :
|
1875
|
-
function isElementQuirky( obj ) {
|
1876
|
-
return obj && typeof obj === 'object' &&
|
1877
|
-
obj.nodeType === 1 && typeof obj.nodeName === 'string';
|
1878
|
-
};
|
1879
|
-
|
1880
|
-
// index of helper cause IE8
|
1881
|
-
var indexOf = Array.prototype.indexOf ? function( ary, obj ) {
|
1882
|
-
return ary.indexOf( obj );
|
1883
|
-
} : function( ary, obj ) {
|
1884
|
-
for ( var i=0, len = ary.length; i < len; i++ ) {
|
1885
|
-
if ( ary[i] === obj ) {
|
1886
|
-
return i;
|
1887
|
-
}
|
1888
|
-
}
|
1889
|
-
return -1;
|
1890
|
-
};
|
1891
2170
|
|
1892
|
-
function
|
1893
|
-
var index = indexOf( ary, obj );
|
1894
|
-
if ( index !== -1 ) {
|
1895
|
-
ary.splice( index, 1 );
|
1896
|
-
}
|
1897
|
-
}
|
2171
|
+
}( window, function factory( window, eventie, EventEmitter, getSize, utils, Item ) {
|
1898
2172
|
|
1899
|
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
1900
|
-
function toDashed( str ) {
|
1901
|
-
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
|
1902
|
-
return $1 + '-' + $2;
|
1903
|
-
}).toLowerCase();
|
1904
|
-
}
|
1905
2173
|
|
2174
|
+
// ----- vars ----- //
|
1906
2175
|
|
1907
|
-
|
2176
|
+
var console = window.console;
|
2177
|
+
var jQuery = window.jQuery;
|
2178
|
+
var noop = function() {};
|
1908
2179
|
|
1909
2180
|
// -------------------------- Outlayer -------------------------- //
|
1910
2181
|
|
@@ -1920,23 +2191,22 @@ var instances = {};
|
|
1920
2191
|
* @constructor
|
1921
2192
|
*/
|
1922
2193
|
function Outlayer( element, options ) {
|
1923
|
-
|
1924
|
-
if (
|
1925
|
-
element = document.querySelector( element );
|
1926
|
-
}
|
1927
|
-
|
1928
|
-
// bail out if not proper element
|
1929
|
-
if ( !element || !isElement( element ) ) {
|
2194
|
+
var queryElement = utils.getQueryElement( element );
|
2195
|
+
if ( !queryElement ) {
|
1930
2196
|
if ( console ) {
|
1931
|
-
console.error( 'Bad ' + this.constructor.namespace +
|
2197
|
+
console.error( 'Bad element for ' + this.constructor.namespace +
|
2198
|
+
': ' + ( queryElement || element ) );
|
1932
2199
|
}
|
1933
2200
|
return;
|
1934
2201
|
}
|
1935
|
-
|
1936
|
-
|
2202
|
+
this.element = queryElement;
|
2203
|
+
// add jQuery
|
2204
|
+
if ( jQuery ) {
|
2205
|
+
this.$element = jQuery( this.element );
|
2206
|
+
}
|
1937
2207
|
|
1938
2208
|
// options
|
1939
|
-
this.options = extend( {}, this.constructor.defaults );
|
2209
|
+
this.options = utils.extend( {}, this.constructor.defaults );
|
1940
2210
|
this.option( options );
|
1941
2211
|
|
1942
2212
|
// add id for Outlayer.getFromElement
|
@@ -1979,14 +2249,14 @@ Outlayer.defaults = {
|
|
1979
2249
|
};
|
1980
2250
|
|
1981
2251
|
// inherit EventEmitter
|
1982
|
-
extend( Outlayer.prototype, EventEmitter.prototype );
|
2252
|
+
utils.extend( Outlayer.prototype, EventEmitter.prototype );
|
1983
2253
|
|
1984
2254
|
/**
|
1985
2255
|
* set options
|
1986
2256
|
* @param {Object} opts
|
1987
2257
|
*/
|
1988
2258
|
Outlayer.prototype.option = function( opts ) {
|
1989
|
-
extend( this.options, opts );
|
2259
|
+
utils.extend( this.options, opts );
|
1990
2260
|
};
|
1991
2261
|
|
1992
2262
|
Outlayer.prototype._create = function() {
|
@@ -1996,7 +2266,7 @@ Outlayer.prototype._create = function() {
|
|
1996
2266
|
this.stamps = [];
|
1997
2267
|
this.stamp( this.options.stamp );
|
1998
2268
|
// set container style
|
1999
|
-
extend( this.element.style, this.options.containerStyle );
|
2269
|
+
utils.extend( this.element.style, this.options.containerStyle );
|
2000
2270
|
|
2001
2271
|
// bind resize method
|
2002
2272
|
if ( this.options.isResizeBound ) {
|
@@ -2038,35 +2308,7 @@ Outlayer.prototype._itemize = function( elems ) {
|
|
2038
2308
|
* @returns {Array} items - item elements
|
2039
2309
|
*/
|
2040
2310
|
Outlayer.prototype._filterFindItemElements = function( elems ) {
|
2041
|
-
|
2042
|
-
elems = makeArray( elems );
|
2043
|
-
var itemSelector = this.options.itemSelector;
|
2044
|
-
var itemElems = [];
|
2045
|
-
|
2046
|
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2047
|
-
var elem = elems[i];
|
2048
|
-
// check that elem is an actual element
|
2049
|
-
if ( !isElement( elem ) ) {
|
2050
|
-
continue;
|
2051
|
-
}
|
2052
|
-
// filter & find items if we have an item selector
|
2053
|
-
if ( itemSelector ) {
|
2054
|
-
// filter siblings
|
2055
|
-
if ( matchesSelector( elem, itemSelector ) ) {
|
2056
|
-
itemElems.push( elem );
|
2057
|
-
}
|
2058
|
-
// find children
|
2059
|
-
var childElems = elem.querySelectorAll( itemSelector );
|
2060
|
-
// concat childElems to filterFound array
|
2061
|
-
for ( var j=0, jLen = childElems.length; j < jLen; j++ ) {
|
2062
|
-
itemElems.push( childElems[j] );
|
2063
|
-
}
|
2064
|
-
} else {
|
2065
|
-
itemElems.push( elem );
|
2066
|
-
}
|
2067
|
-
}
|
2068
|
-
|
2069
|
-
return itemElems;
|
2311
|
+
return utils.filterFindElements( elems, this.options.itemSelector );
|
2070
2312
|
};
|
2071
2313
|
|
2072
2314
|
/**
|
@@ -2134,7 +2376,7 @@ Outlayer.prototype._getMeasurement = function( measurement, size ) {
|
|
2134
2376
|
// use option as an element
|
2135
2377
|
if ( typeof option === 'string' ) {
|
2136
2378
|
elem = this.element.querySelector( option );
|
2137
|
-
} else if ( isElement( option ) ) {
|
2379
|
+
} else if ( utils.isElement( option ) ) {
|
2138
2380
|
elem = option;
|
2139
2381
|
}
|
2140
2382
|
// use size of element, if element
|
@@ -2177,20 +2419,13 @@ Outlayer.prototype._getItemsForLayout = function( items ) {
|
|
2177
2419
|
* @param {Boolean} isInstant
|
2178
2420
|
*/
|
2179
2421
|
Outlayer.prototype._layoutItems = function( items, isInstant ) {
|
2180
|
-
|
2181
|
-
function onItemsLayout() {
|
2182
|
-
_this.emitEvent( 'layoutComplete', [ _this, items ] );
|
2183
|
-
}
|
2422
|
+
this._emitCompleteOnItems( 'layout', items );
|
2184
2423
|
|
2185
2424
|
if ( !items || !items.length ) {
|
2186
2425
|
// no items, emit event with empty array
|
2187
|
-
onItemsLayout();
|
2188
2426
|
return;
|
2189
2427
|
}
|
2190
2428
|
|
2191
|
-
// emit layoutComplete when done
|
2192
|
-
this._itemsOn( items, 'layout', onItemsLayout );
|
2193
|
-
|
2194
2429
|
var queue = [];
|
2195
2430
|
|
2196
2431
|
for ( var i=0, len = items.length; i < len; i++ ) {
|
@@ -2297,27 +2532,34 @@ Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) {
|
|
2297
2532
|
};
|
2298
2533
|
|
2299
2534
|
/**
|
2300
|
-
*
|
2301
|
-
* @param {Array} items - Outlayer.Items
|
2535
|
+
* emit eventComplete on a collection of items events
|
2302
2536
|
* @param {String} eventName
|
2303
|
-
* @param {
|
2537
|
+
* @param {Array} items - Outlayer.Items
|
2304
2538
|
*/
|
2305
|
-
Outlayer.prototype.
|
2306
|
-
var doneCount = 0;
|
2307
|
-
var count = items.length;
|
2308
|
-
// event callback
|
2539
|
+
Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) {
|
2309
2540
|
var _this = this;
|
2541
|
+
function onComplete() {
|
2542
|
+
_this.emitEvent( eventName + 'Complete', [ items ] );
|
2543
|
+
}
|
2544
|
+
|
2545
|
+
var count = items.length;
|
2546
|
+
if ( !items || !count ) {
|
2547
|
+
onComplete();
|
2548
|
+
return;
|
2549
|
+
}
|
2550
|
+
|
2551
|
+
var doneCount = 0;
|
2310
2552
|
function tick() {
|
2311
2553
|
doneCount++;
|
2312
2554
|
if ( doneCount === count ) {
|
2313
|
-
|
2555
|
+
onComplete();
|
2314
2556
|
}
|
2315
|
-
return true; // bind once
|
2316
2557
|
}
|
2558
|
+
|
2317
2559
|
// bind callback
|
2318
2560
|
for ( var i=0, len = items.length; i < len; i++ ) {
|
2319
2561
|
var item = items[i];
|
2320
|
-
item.
|
2562
|
+
item.once( eventName, tick );
|
2321
2563
|
}
|
2322
2564
|
};
|
2323
2565
|
|
@@ -2378,7 +2620,7 @@ Outlayer.prototype.unstamp = function( elems ) {
|
|
2378
2620
|
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2379
2621
|
var elem = elems[i];
|
2380
2622
|
// filter out removed stamp elements
|
2381
|
-
removeFrom(
|
2623
|
+
utils.removeFrom( this.stamps, elem );
|
2382
2624
|
this.unignore( elem );
|
2383
2625
|
}
|
2384
2626
|
|
@@ -2397,7 +2639,7 @@ Outlayer.prototype._find = function( elems ) {
|
|
2397
2639
|
if ( typeof elems === 'string' ) {
|
2398
2640
|
elems = this.element.querySelectorAll( elems );
|
2399
2641
|
}
|
2400
|
-
elems = makeArray( elems );
|
2642
|
+
elems = utils.makeArray( elems );
|
2401
2643
|
return elems;
|
2402
2644
|
};
|
2403
2645
|
|
@@ -2581,11 +2823,10 @@ Outlayer.prototype.prepended = function( elems ) {
|
|
2581
2823
|
* @param {Array of Outlayer.Items} items
|
2582
2824
|
*/
|
2583
2825
|
Outlayer.prototype.reveal = function( items ) {
|
2826
|
+
this._emitCompleteOnItems( 'reveal', items );
|
2827
|
+
|
2584
2828
|
var len = items && items.length;
|
2585
|
-
|
2586
|
-
return;
|
2587
|
-
}
|
2588
|
-
for ( var i=0; i < len; i++ ) {
|
2829
|
+
for ( var i=0; len && i < len; i++ ) {
|
2589
2830
|
var item = items[i];
|
2590
2831
|
item.reveal();
|
2591
2832
|
}
|
@@ -2596,16 +2837,33 @@ Outlayer.prototype.reveal = function( items ) {
|
|
2596
2837
|
* @param {Array of Outlayer.Items} items
|
2597
2838
|
*/
|
2598
2839
|
Outlayer.prototype.hide = function( items ) {
|
2840
|
+
this._emitCompleteOnItems( 'hide', items );
|
2841
|
+
|
2599
2842
|
var len = items && items.length;
|
2600
|
-
|
2601
|
-
return;
|
2602
|
-
}
|
2603
|
-
for ( var i=0; i < len; i++ ) {
|
2843
|
+
for ( var i=0; len && i < len; i++ ) {
|
2604
2844
|
var item = items[i];
|
2605
2845
|
item.hide();
|
2606
2846
|
}
|
2607
2847
|
};
|
2608
2848
|
|
2849
|
+
/**
|
2850
|
+
* reveal item elements
|
2851
|
+
* @param {Array}, {Element}, {NodeList} items
|
2852
|
+
*/
|
2853
|
+
Outlayer.prototype.revealItemElements = function( elems ) {
|
2854
|
+
var items = this.getItems( elems );
|
2855
|
+
this.reveal( items );
|
2856
|
+
};
|
2857
|
+
|
2858
|
+
/**
|
2859
|
+
* hide item elements
|
2860
|
+
* @param {Array}, {Element}, {NodeList} items
|
2861
|
+
*/
|
2862
|
+
Outlayer.prototype.hideItemElements = function( elems ) {
|
2863
|
+
var items = this.getItems( elems );
|
2864
|
+
this.hide( items );
|
2865
|
+
};
|
2866
|
+
|
2609
2867
|
/**
|
2610
2868
|
* get Outlayer.Item, given an Element
|
2611
2869
|
* @param {Element} elem
|
@@ -2629,9 +2887,7 @@ Outlayer.prototype.getItem = function( elem ) {
|
|
2629
2887
|
* @returns {Array} items - Outlayer.Items
|
2630
2888
|
*/
|
2631
2889
|
Outlayer.prototype.getItems = function( elems ) {
|
2632
|
-
|
2633
|
-
return;
|
2634
|
-
}
|
2890
|
+
elems = utils.makeArray( elems );
|
2635
2891
|
var items = [];
|
2636
2892
|
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2637
2893
|
var elem = elems[i];
|
@@ -2649,23 +2905,20 @@ Outlayer.prototype.getItems = function( elems ) {
|
|
2649
2905
|
* @param {Array or NodeList or Element} elems
|
2650
2906
|
*/
|
2651
2907
|
Outlayer.prototype.remove = function( elems ) {
|
2652
|
-
elems = makeArray( elems );
|
2653
|
-
|
2654
2908
|
var removeItems = this.getItems( elems );
|
2909
|
+
|
2910
|
+
this._emitCompleteOnItems( 'remove', removeItems );
|
2911
|
+
|
2655
2912
|
// bail if no items to remove
|
2656
2913
|
if ( !removeItems || !removeItems.length ) {
|
2657
2914
|
return;
|
2658
2915
|
}
|
2659
2916
|
|
2660
|
-
this._itemsOn( removeItems, 'remove', function() {
|
2661
|
-
this.emitEvent( 'removeComplete', [ this, removeItems ] );
|
2662
|
-
});
|
2663
|
-
|
2664
2917
|
for ( var i=0, len = removeItems.length; i < len; i++ ) {
|
2665
2918
|
var item = removeItems[i];
|
2666
2919
|
item.remove();
|
2667
2920
|
// remove item from collection
|
2668
|
-
removeFrom(
|
2921
|
+
utils.removeFrom( this.items, item );
|
2669
2922
|
}
|
2670
2923
|
};
|
2671
2924
|
|
@@ -2704,6 +2957,7 @@ Outlayer.prototype.destroy = function() {
|
|
2704
2957
|
* @returns {Outlayer}
|
2705
2958
|
*/
|
2706
2959
|
Outlayer.data = function( elem ) {
|
2960
|
+
elem = utils.getQueryElement( elem );
|
2707
2961
|
var id = elem && elem.outlayerGUID;
|
2708
2962
|
return id && instances[ id ];
|
2709
2963
|
};
|
@@ -2724,14 +2978,14 @@ Outlayer.create = function( namespace, options ) {
|
|
2724
2978
|
if ( Object.create ) {
|
2725
2979
|
Layout.prototype = Object.create( Outlayer.prototype );
|
2726
2980
|
} else {
|
2727
|
-
extend( Layout.prototype, Outlayer.prototype );
|
2981
|
+
utils.extend( Layout.prototype, Outlayer.prototype );
|
2728
2982
|
}
|
2729
2983
|
// set contructor, used for namespace and Item
|
2730
2984
|
Layout.prototype.constructor = Layout;
|
2731
2985
|
|
2732
|
-
Layout.defaults = extend( {}, Outlayer.defaults );
|
2986
|
+
Layout.defaults = utils.extend( {}, Outlayer.defaults );
|
2733
2987
|
// apply new options
|
2734
|
-
extend( Layout.defaults, options );
|
2988
|
+
utils.extend( Layout.defaults, options );
|
2735
2989
|
// keep prototype.settings for backwards compatibility (Packery v1.2.0)
|
2736
2990
|
Layout.prototype.settings = {};
|
2737
2991
|
|
@@ -2748,38 +3002,7 @@ Outlayer.create = function( namespace, options ) {
|
|
2748
3002
|
|
2749
3003
|
// -------------------------- declarative -------------------------- //
|
2750
3004
|
|
2751
|
-
|
2752
|
-
* allow user to initialize Outlayer via .js-namespace class
|
2753
|
-
* options are parsed from data-namespace-option attribute
|
2754
|
-
*/
|
2755
|
-
docReady( function() {
|
2756
|
-
var dashedNamespace = toDashed( namespace );
|
2757
|
-
var elems = document.querySelectorAll( '.js-' + dashedNamespace );
|
2758
|
-
var dataAttr = 'data-' + dashedNamespace + '-options';
|
2759
|
-
|
2760
|
-
for ( var i=0, len = elems.length; i < len; i++ ) {
|
2761
|
-
var elem = elems[i];
|
2762
|
-
var attr = elem.getAttribute( dataAttr );
|
2763
|
-
var options;
|
2764
|
-
try {
|
2765
|
-
options = attr && JSON.parse( attr );
|
2766
|
-
} catch ( error ) {
|
2767
|
-
// log error, do not initialize
|
2768
|
-
if ( console ) {
|
2769
|
-
console.error( 'Error parsing ' + dataAttr + ' on ' +
|
2770
|
-
elem.nodeName.toLowerCase() + ( elem.id ? '#' + elem.id : '' ) + ': ' +
|
2771
|
-
error );
|
2772
|
-
}
|
2773
|
-
continue;
|
2774
|
-
}
|
2775
|
-
// initialize
|
2776
|
-
var instance = new Layout( elem, options );
|
2777
|
-
// make available via $().data('layoutname')
|
2778
|
-
if ( jQuery ) {
|
2779
|
-
jQuery.data( elem, namespace, instance );
|
2780
|
-
}
|
2781
|
-
}
|
2782
|
-
});
|
3005
|
+
utils.htmlInit( Layout, namespace );
|
2783
3006
|
|
2784
3007
|
// -------------------------- jQuery bridge -------------------------- //
|
2785
3008
|
|
@@ -2798,52 +3021,30 @@ Outlayer.Item = Item;
|
|
2798
3021
|
|
2799
3022
|
return Outlayer;
|
2800
3023
|
|
2801
|
-
}
|
2802
|
-
|
2803
|
-
// -------------------------- transport -------------------------- //
|
2804
|
-
|
2805
|
-
if ( typeof define === 'function' && define.amd ) {
|
2806
|
-
// AMD
|
2807
|
-
define( 'outlayer/outlayer',[
|
2808
|
-
'eventie/eventie',
|
2809
|
-
'doc-ready/doc-ready',
|
2810
|
-
'eventEmitter/EventEmitter',
|
2811
|
-
'get-size/get-size',
|
2812
|
-
'matches-selector/matches-selector',
|
2813
|
-
'./item'
|
2814
|
-
],
|
2815
|
-
outlayerDefinition );
|
2816
|
-
} else if ( typeof exports === 'object' ) {
|
2817
|
-
// CommonJS
|
2818
|
-
module.exports = outlayerDefinition(
|
2819
|
-
require('eventie'),
|
2820
|
-
require('doc-ready'),
|
2821
|
-
require('wolfy87-eventemitter'),
|
2822
|
-
require('get-size'),
|
2823
|
-
require('desandro-matches-selector'),
|
2824
|
-
require('./item')
|
2825
|
-
);
|
2826
|
-
} else {
|
2827
|
-
// browser global
|
2828
|
-
window.Outlayer = outlayerDefinition(
|
2829
|
-
window.eventie,
|
2830
|
-
window.docReady,
|
2831
|
-
window.EventEmitter,
|
2832
|
-
window.getSize,
|
2833
|
-
window.matchesSelector,
|
2834
|
-
window.Outlayer.Item
|
2835
|
-
);
|
2836
|
-
}
|
3024
|
+
}));
|
2837
3025
|
|
2838
|
-
})( window );
|
2839
3026
|
|
2840
3027
|
/**
|
2841
3028
|
* Rect
|
2842
3029
|
* low-level utility class for basic geometry
|
2843
3030
|
*/
|
2844
3031
|
|
2845
|
-
( function( window ) {
|
3032
|
+
( function( window, factory ) {
|
3033
|
+
|
3034
|
+
// universal module definition
|
3035
|
+
if ( typeof define == 'function' && define.amd ) {
|
3036
|
+
// AMD
|
3037
|
+
define( 'packery/js/rect',factory );
|
3038
|
+
} else if ( typeof exports == 'object' ) {
|
3039
|
+
// CommonJS
|
3040
|
+
module.exports = factory();
|
3041
|
+
} else {
|
3042
|
+
// browser global
|
3043
|
+
window.Packery = window.Packery || {};
|
3044
|
+
window.Packery.Rect = factory();
|
3045
|
+
}
|
2846
3046
|
|
3047
|
+
}( window, function factory() {
|
2847
3048
|
|
2848
3049
|
|
2849
3050
|
// -------------------------- Packery -------------------------- //
|
@@ -2851,8 +3052,6 @@ if ( typeof define === 'function' && define.amd ) {
|
|
2851
3052
|
// global namespace
|
2852
3053
|
var Packery = window.Packery = function() {};
|
2853
3054
|
|
2854
|
-
function rectDefinition() {
|
2855
|
-
|
2856
3055
|
// -------------------------- Rect -------------------------- //
|
2857
3056
|
|
2858
3057
|
function Rect( props ) {
|
@@ -2982,37 +3181,35 @@ Rect.prototype.canFit = function( rect ) {
|
|
2982
3181
|
|
2983
3182
|
return Rect;
|
2984
3183
|
|
2985
|
-
}
|
2986
|
-
|
2987
|
-
// -------------------------- transport -------------------------- //
|
2988
|
-
|
2989
|
-
if ( typeof define === 'function' && define.amd ) {
|
2990
|
-
// AMD
|
2991
|
-
define( 'packery/js/rect',rectDefinition );
|
2992
|
-
} else if ( typeof exports === 'object' ) {
|
2993
|
-
// CommonJS
|
2994
|
-
module.exports = rectDefinition();
|
2995
|
-
} else {
|
2996
|
-
// browser global
|
2997
|
-
window.Packery = window.Packery || {};
|
2998
|
-
window.Packery.Rect = rectDefinition();
|
2999
|
-
}
|
3000
|
-
|
3001
|
-
})( window );
|
3184
|
+
}));
|
3002
3185
|
|
3003
3186
|
/**
|
3004
3187
|
* Packer
|
3005
3188
|
* bin-packing algorithm
|
3006
3189
|
*/
|
3007
3190
|
|
3008
|
-
( function( window ) {
|
3191
|
+
( function( window, factory ) {
|
3192
|
+
|
3193
|
+
// universal module definition
|
3194
|
+
if ( typeof define == 'function' && define.amd ) {
|
3195
|
+
// AMD
|
3196
|
+
define( 'packery/js/packer',[ './rect' ], factory );
|
3197
|
+
} else if ( typeof exports == 'object' ) {
|
3198
|
+
// CommonJS
|
3199
|
+
module.exports = factory(
|
3200
|
+
require('./rect')
|
3201
|
+
);
|
3202
|
+
} else {
|
3203
|
+
// browser global
|
3204
|
+
var Packery = window.Packery = window.Packery || {};
|
3205
|
+
Packery.Packer = factory( Packery.Rect );
|
3206
|
+
}
|
3009
3207
|
|
3208
|
+
}( window, function factory( Rect ) {
|
3010
3209
|
|
3011
3210
|
|
3012
3211
|
// -------------------------- Packer -------------------------- //
|
3013
3212
|
|
3014
|
-
function packerDefinition( Rect ) {
|
3015
|
-
|
3016
3213
|
/**
|
3017
3214
|
* @param {Number} width
|
3018
3215
|
* @param {Number} height
|
@@ -3151,38 +3348,44 @@ var sorters = {
|
|
3151
3348
|
|
3152
3349
|
return Packer;
|
3153
3350
|
|
3154
|
-
}
|
3155
|
-
|
3156
|
-
// -------------------------- transport -------------------------- //
|
3157
|
-
|
3158
|
-
if ( typeof define === 'function' && define.amd ) {
|
3159
|
-
// AMD
|
3160
|
-
define( 'packery/js/packer',[ './rect' ], packerDefinition );
|
3161
|
-
} else if ( typeof exports === 'object' ) {
|
3162
|
-
// CommonJS
|
3163
|
-
module.exports = packerDefinition(
|
3164
|
-
require('./rect')
|
3165
|
-
);
|
3166
|
-
} else {
|
3167
|
-
// browser global
|
3168
|
-
var Packery = window.Packery = window.Packery || {};
|
3169
|
-
Packery.Packer = packerDefinition( Packery.Rect );
|
3170
|
-
}
|
3171
|
-
|
3172
|
-
})( window );
|
3173
|
-
|
3351
|
+
}));
|
3174
3352
|
/**
|
3175
3353
|
* Packery Item Element
|
3176
3354
|
**/
|
3177
3355
|
|
3178
|
-
( function( window ) {
|
3356
|
+
( function( window, factory ) {
|
3357
|
+
|
3358
|
+
// universal module definition
|
3359
|
+
|
3360
|
+
if ( typeof define == 'function' && define.amd ) {
|
3361
|
+
// AMD
|
3362
|
+
define( 'packery/js/item',[
|
3363
|
+
'get-style-property/get-style-property',
|
3364
|
+
'outlayer/outlayer',
|
3365
|
+
'./rect'
|
3366
|
+
],
|
3367
|
+
factory );
|
3368
|
+
} else if ( typeof exports == 'object' ) {
|
3369
|
+
// CommonJS
|
3370
|
+
module.exports = factory(
|
3371
|
+
require('desandro-get-style-property'),
|
3372
|
+
require('outlayer'),
|
3373
|
+
require('./rect')
|
3374
|
+
);
|
3375
|
+
} else {
|
3376
|
+
// browser global
|
3377
|
+
window.Packery.Item = factory(
|
3378
|
+
window.getStyleProperty,
|
3379
|
+
window.Outlayer,
|
3380
|
+
window.Packery.Rect
|
3381
|
+
);
|
3382
|
+
}
|
3179
3383
|
|
3384
|
+
}( window, function factory( getStyleProperty, Outlayer, Rect ) {
|
3180
3385
|
|
3181
3386
|
|
3182
3387
|
// -------------------------- Item -------------------------- //
|
3183
3388
|
|
3184
|
-
function itemDefinition( getStyleProperty, Outlayer, Rect ) {
|
3185
|
-
|
3186
3389
|
var transformProperty = getStyleProperty('transform');
|
3187
3390
|
|
3188
3391
|
// sub-class Item
|
@@ -3235,8 +3438,8 @@ Item.prototype.dragMove = function( x, y ) {
|
|
3235
3438
|
|
3236
3439
|
Item.prototype.dragStop = function() {
|
3237
3440
|
this.getPosition();
|
3238
|
-
var isDiffX = this.position.x
|
3239
|
-
var isDiffY = this.position.y
|
3441
|
+
var isDiffX = this.position.x != this.placeRect.x;
|
3442
|
+
var isDiffY = this.position.y != this.placeRect.y;
|
3240
3443
|
// set post-drag positioning flag
|
3241
3444
|
this.needsPositioning = isDiffX || isDiffY;
|
3242
3445
|
// reset flag
|
@@ -3326,55 +3529,57 @@ Item.prototype.removeElem = function() {
|
|
3326
3529
|
|
3327
3530
|
return Item;
|
3328
3531
|
|
3329
|
-
}
|
3330
|
-
|
3331
|
-
// -------------------------- transport -------------------------- //
|
3332
|
-
|
3333
|
-
if ( typeof define === 'function' && define.amd ) {
|
3334
|
-
// AMD
|
3335
|
-
define( 'packery/js/item',[
|
3336
|
-
'get-style-property/get-style-property',
|
3337
|
-
'outlayer/outlayer',
|
3338
|
-
'./rect'
|
3339
|
-
],
|
3340
|
-
itemDefinition );
|
3341
|
-
} else if ( typeof exports === 'object' ) {
|
3342
|
-
// CommonJS
|
3343
|
-
module.exports = itemDefinition(
|
3344
|
-
require('desandro-get-style-property'),
|
3345
|
-
require('outlayer'),
|
3346
|
-
require('./rect')
|
3347
|
-
);
|
3348
|
-
} else {
|
3349
|
-
// browser global
|
3350
|
-
window.Packery.Item = itemDefinition(
|
3351
|
-
window.getStyleProperty,
|
3352
|
-
window.Outlayer,
|
3353
|
-
window.Packery.Rect
|
3354
|
-
);
|
3355
|
-
}
|
3356
|
-
|
3357
|
-
})( window );
|
3532
|
+
}));
|
3358
3533
|
|
3359
3534
|
/*!
|
3360
|
-
* Packery v1.
|
3535
|
+
* Packery v1.4.1
|
3361
3536
|
* bin-packing layout library
|
3362
|
-
* http://packery.metafizzy.co
|
3363
|
-
*
|
3364
|
-
* Commercial use requires one-time purchase of a commercial license
|
3365
|
-
* http://packery.metafizzy.co/license.html
|
3366
3537
|
*
|
3367
|
-
*
|
3538
|
+
* Licensed GPLv3 for open source use
|
3539
|
+
* or Flickity Commercial License for commercial use
|
3368
3540
|
*
|
3541
|
+
* http://packery.metafizzy.co
|
3369
3542
|
* Copyright 2015 Metafizzy
|
3370
3543
|
*/
|
3371
3544
|
|
3372
|
-
( function( window ) {
|
3545
|
+
( function( window, factory ) {
|
3373
3546
|
|
3547
|
+
// universal module definition
|
3548
|
+
if ( typeof define == 'function' && define.amd ) {
|
3549
|
+
// AMD
|
3550
|
+
define( [
|
3551
|
+
'classie/classie',
|
3552
|
+
'get-size/get-size',
|
3553
|
+
'outlayer/outlayer',
|
3554
|
+
'packery/js/rect',
|
3555
|
+
'packery/js/packer',
|
3556
|
+
'packery/js/item'
|
3557
|
+
],
|
3558
|
+
factory );
|
3559
|
+
} else if ( typeof exports == 'object' ) {
|
3560
|
+
// CommonJS
|
3561
|
+
module.exports = factory(
|
3562
|
+
require('desandro-classie'),
|
3563
|
+
require('get-size'),
|
3564
|
+
require('outlayer'),
|
3565
|
+
require('./rect'),
|
3566
|
+
require('./packer'),
|
3567
|
+
require('./item')
|
3568
|
+
);
|
3569
|
+
} else {
|
3570
|
+
// browser global
|
3571
|
+
window.Packery = factory(
|
3572
|
+
window.classie,
|
3573
|
+
window.getSize,
|
3574
|
+
window.Outlayer,
|
3575
|
+
window.Packery.Rect,
|
3576
|
+
window.Packery.Packer,
|
3577
|
+
window.Packery.Item
|
3578
|
+
);
|
3579
|
+
}
|
3374
3580
|
|
3581
|
+
}( window, function factory( classie, getSize, Outlayer, Rect, Packer, Item ) {
|
3375
3582
|
|
3376
|
-
// used for AMD definition and requires
|
3377
|
-
function packeryDefinition( classie, getSize, Outlayer, Rect, Packer, Item ) {
|
3378
3583
|
|
3379
3584
|
// ----- Rect ----- //
|
3380
3585
|
|
@@ -3402,14 +3607,14 @@ Packery.prototype._create = function() {
|
|
3402
3607
|
// create drag handlers
|
3403
3608
|
var _this = this;
|
3404
3609
|
this.handleDraggabilly = {
|
3405
|
-
dragStart: function(
|
3406
|
-
_this.itemDragStart(
|
3610
|
+
dragStart: function() {
|
3611
|
+
_this.itemDragStart( this.element );
|
3407
3612
|
},
|
3408
|
-
dragMove: function(
|
3409
|
-
_this.itemDragMove(
|
3613
|
+
dragMove: function() {
|
3614
|
+
_this.itemDragMove( this.element, this.position.x, this.position.y );
|
3410
3615
|
},
|
3411
|
-
dragEnd: function(
|
3412
|
-
_this.itemDragEnd(
|
3616
|
+
dragEnd: function() {
|
3617
|
+
_this.itemDragEnd( this.element );
|
3413
3618
|
}
|
3414
3619
|
};
|
3415
3620
|
|
@@ -3643,10 +3848,10 @@ Packery.prototype._bindFitEvents = function( item ) {
|
|
3643
3848
|
var ticks = 0;
|
3644
3849
|
function tick() {
|
3645
3850
|
ticks++;
|
3646
|
-
if ( ticks
|
3851
|
+
if ( ticks != 2 ) {
|
3647
3852
|
return;
|
3648
3853
|
}
|
3649
|
-
_this.emitEvent( 'fitComplete', [
|
3854
|
+
_this.emitEvent( 'fitComplete', [ item ] );
|
3650
3855
|
}
|
3651
3856
|
// when item is laid out
|
3652
3857
|
item.on( 'layout', function() {
|
@@ -3670,7 +3875,7 @@ Packery.prototype.resize = function() {
|
|
3670
3875
|
// IE8 triggers resize on body size change, so they might not be
|
3671
3876
|
var hasSizes = this.size && size;
|
3672
3877
|
var innerSize = this.options.isHorizontal ? 'innerHeight' : 'innerWidth';
|
3673
|
-
if ( hasSizes && size[ innerSize ]
|
3878
|
+
if ( hasSizes && size[ innerSize ] == this.size[ innerSize ] ) {
|
3674
3879
|
return;
|
3675
3880
|
}
|
3676
3881
|
|
@@ -3775,7 +3980,7 @@ Packery.prototype._getDragEndLayoutComplete = function( elem, item ) {
|
|
3775
3980
|
return function onLayoutComplete() {
|
3776
3981
|
completeCount++;
|
3777
3982
|
// don't proceed if not complete
|
3778
|
-
if ( completeCount
|
3983
|
+
if ( completeCount != asyncCount ) {
|
3779
3984
|
return true;
|
3780
3985
|
}
|
3781
3986
|
// reset item
|
@@ -3791,7 +3996,7 @@ Packery.prototype._getDragEndLayoutComplete = function( elem, item ) {
|
|
3791
3996
|
|
3792
3997
|
// emit item drag event now that everything is done
|
3793
3998
|
if ( itemNeedsPositioning ) {
|
3794
|
-
_this.emitEvent( 'dragItemPositioned', [
|
3999
|
+
_this.emitEvent( 'dragItemPositioned', [ item ] );
|
3795
4000
|
}
|
3796
4001
|
// listen once
|
3797
4002
|
return true;
|
@@ -3824,41 +4029,4 @@ Packery.Packer = Packer;
|
|
3824
4029
|
|
3825
4030
|
return Packery;
|
3826
4031
|
|
3827
|
-
}
|
3828
|
-
|
3829
|
-
// -------------------------- transport -------------------------- //
|
3830
|
-
|
3831
|
-
if ( typeof define === 'function' && define.amd ) {
|
3832
|
-
// AMD
|
3833
|
-
define( [
|
3834
|
-
'classie/classie',
|
3835
|
-
'get-size/get-size',
|
3836
|
-
'outlayer/outlayer',
|
3837
|
-
'packery/js/rect',
|
3838
|
-
'packery/js/packer',
|
3839
|
-
'packery/js/item'
|
3840
|
-
],
|
3841
|
-
packeryDefinition );
|
3842
|
-
} else if ( typeof exports === 'object' ) {
|
3843
|
-
// CommonJS
|
3844
|
-
module.exports = packeryDefinition(
|
3845
|
-
require('desandro-classie'),
|
3846
|
-
require('get-size'),
|
3847
|
-
require('outlayer'),
|
3848
|
-
require('./rect'),
|
3849
|
-
require('./packer'),
|
3850
|
-
require('./item')
|
3851
|
-
);
|
3852
|
-
} else {
|
3853
|
-
// browser global
|
3854
|
-
window.Packery = packeryDefinition(
|
3855
|
-
window.classie,
|
3856
|
-
window.getSize,
|
3857
|
-
window.Outlayer,
|
3858
|
-
window.Packery.Rect,
|
3859
|
-
window.Packery.Packer,
|
3860
|
-
window.Packery.Item
|
3861
|
-
);
|
3862
|
-
}
|
3863
|
-
|
3864
|
-
})( window );
|
4032
|
+
}));
|