masonry2-rails 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebdd6d2de5da49c834592862d5f1dd34e21851ff
4
- data.tar.gz: 97651874565a5934ce409c3569e76afbf38698c2
3
+ metadata.gz: f91042c7ceae2ca2b745cea6ddb3235a2d1596e7
4
+ data.tar.gz: c1f931b6ca67f5e2dc82e2f39bed7bf1772694aa
5
5
  SHA512:
6
- metadata.gz: 811a354a06b9f9a7bb64972f982bfa5c3527dd6e221e599f551aeea4bdaf773cef89b4f2efa3917f1d91e439c2b8b1212a373bd145d17b20170be572d9ad9bdd
7
- data.tar.gz: 477760439ea828893218a2ed34bade1b8559ee351306e2aef0f2ff279562d8b46d476bf0a1384c34e8ba1a7db180e030a7d5e4b44a73f37ffc8009f5c6e574af
6
+ metadata.gz: b2c3f49d4baee4a240c9210612dbee61523b41228ccf8e5994a3eeaaa442a1441b76bd78824707a292e083eb146bc790673071312bb09d8e21bbfdf40a994e54
7
+ data.tar.gz: ea6560c0245e3dc2903aa8aca12d5bb51a7d192ac0516cc9e7cbea8ea5dc4906eb79e85e01a4054a472ee91473416616a4d964f2c8e6daa0211a94e03a16efe6
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # masonry2-rails
2
2
 
3
- masonry2-rails wraps the [jQuery Masonry](http://masonry.desandro.com/) library for use in Rails 4.0 and above. Assets will minify automatically during production.
3
+ masonry2-rails wraps the [jQuery Masonry](http://masonry.desandro.com/) library for use in Rails 4.0 and above. Assets should be automatically minified during production.
4
4
 
5
5
  ## Usage
6
6
 
@@ -21,4 +21,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Andrew
21
21
 
22
22
  ## License
23
23
 
24
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
24
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,5 +1,5 @@
1
1
  module Masonry2
2
2
  module Rails
3
- VERSION = "3.3.0"
3
+ VERSION = "3.3.2"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Masonry PACKAGED v3.3.0
2
+ * Masonry PACKAGED v3.3.2
3
3
  * Cascading grid layout library
4
4
  * http://masonry.desandro.com
5
5
  * MIT License
@@ -1633,14 +1633,19 @@ Item.prototype.getPosition = function() {
1633
1633
  var layoutOptions = this.layout.options;
1634
1634
  var isOriginLeft = layoutOptions.isOriginLeft;
1635
1635
  var isOriginTop = layoutOptions.isOriginTop;
1636
- var x = parseInt( style[ isOriginLeft ? 'left' : 'right' ], 10 );
1637
- var y = parseInt( style[ isOriginTop ? 'top' : 'bottom' ], 10 );
1636
+ var xValue = style[ isOriginLeft ? 'left' : 'right' ];
1637
+ var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
1638
+ // convert percent to pixels
1639
+ var layoutSize = this.layout.size;
1640
+ var x = xValue.indexOf('%') != -1 ?
1641
+ ( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 );
1642
+ var y = yValue.indexOf('%') != -1 ?
1643
+ ( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 );
1638
1644
 
1639
1645
  // clean up 'auto' or other non-integer values
1640
1646
  x = isNaN( x ) ? 0 : x;
1641
1647
  y = isNaN( y ) ? 0 : y;
1642
1648
  // remove padding from measurement
1643
- var layoutSize = this.layout.size;
1644
1649
  x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
1645
1650
  y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
1646
1651
 
@@ -1660,10 +1665,8 @@ Item.prototype.layoutPosition = function() {
1660
1665
  var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left';
1661
1666
 
1662
1667
  var x = this.position.x + layoutSize[ xPadding ];
1663
- // set in percentage
1664
- x = layoutOptions.percentPosition && !layoutOptions.isHorizontal ?
1665
- ( ( x / layoutSize.width ) * 100 ) + '%' : x + 'px';
1666
- style[ xProperty ] = x;
1668
+ // set in percentage or pixels
1669
+ style[ xProperty ] = this.getXValue( x );
1667
1670
  // reset other property
1668
1671
  style[ xResetProperty ] = '';
1669
1672
 
@@ -1673,10 +1676,8 @@ Item.prototype.layoutPosition = function() {
1673
1676
  var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top';
1674
1677
 
1675
1678
  var y = this.position.y + layoutSize[ yPadding ];
1676
- // set in percentage
1677
- y = layoutOptions.percentPosition && layoutOptions.isHorizontal ?
1678
- ( ( y / layoutSize.height ) * 100 ) + '%' : y + 'px';
1679
- style[ yProperty ] = y;
1679
+ // set in percentage or pixels
1680
+ style[ yProperty ] = this.getYValue( y );
1680
1681
  // reset other property
1681
1682
  style[ yResetProperty ] = '';
1682
1683
 
@@ -1684,15 +1685,17 @@ Item.prototype.layoutPosition = function() {
1684
1685
  this.emitEvent( 'layout', [ this ] );
1685
1686
  };
1686
1687
 
1688
+ Item.prototype.getXValue = function( x ) {
1689
+ var layoutOptions = this.layout.options;
1690
+ return layoutOptions.percentPosition && !layoutOptions.isHorizontal ?
1691
+ ( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px';
1692
+ };
1687
1693
 
1688
- // transform translate function
1689
- var translate = is3d ?
1690
- function( x, y ) {
1691
- return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
1692
- } :
1693
- function( x, y ) {
1694
- return 'translate(' + x + 'px, ' + y + 'px)';
1695
- };
1694
+ Item.prototype.getYValue = function( y ) {
1695
+ var layoutOptions = this.layout.options;
1696
+ return layoutOptions.percentPosition && layoutOptions.isHorizontal ?
1697
+ ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px';
1698
+ };
1696
1699
 
1697
1700
 
1698
1701
  Item.prototype._transitionTo = function( x, y ) {
@@ -1717,11 +1720,7 @@ Item.prototype._transitionTo = function( x, y ) {
1717
1720
  var transX = x - curX;
1718
1721
  var transY = y - curY;
1719
1722
  var transitionStyle = {};
1720
- // flip cooridinates if origin on right or bottom
1721
- var layoutOptions = this.layout.options;
1722
- transX = layoutOptions.isOriginLeft ? transX : -transX;
1723
- transY = layoutOptions.isOriginTop ? transY : -transY;
1724
- transitionStyle.transform = translate( transX, transY );
1723
+ transitionStyle.transform = this.getTranslate( transX, transY );
1725
1724
 
1726
1725
  this.transition({
1727
1726
  to: transitionStyle,
@@ -1732,6 +1731,19 @@ Item.prototype._transitionTo = function( x, y ) {
1732
1731
  });
1733
1732
  };
1734
1733
 
1734
+ Item.prototype.getTranslate = function( x, y ) {
1735
+ // flip cooridinates if origin on right or bottom
1736
+ var layoutOptions = this.layout.options;
1737
+ x = layoutOptions.isOriginLeft ? x : -x;
1738
+ y = layoutOptions.isOriginTop ? y : -y;
1739
+
1740
+ if ( is3d ) {
1741
+ return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
1742
+ }
1743
+
1744
+ return 'translate(' + x + 'px, ' + y + 'px)';
1745
+ };
1746
+
1735
1747
  // non transition + transform support
1736
1748
  Item.prototype.goTo = function( x, y ) {
1737
1749
  this.setPosition( x, y );
@@ -1811,28 +1823,36 @@ Item.prototype._transition = function( args ) {
1811
1823
 
1812
1824
  };
1813
1825
 
1814
- var itemTransitionProperties = transformProperty && ( utils.toDashed( transformProperty ) +
1815
- ',opacity' );
1826
+ // dash before all cap letters, including first for
1827
+ // WebkitTransform => -webkit-transform
1828
+ function toDashedAll( str ) {
1829
+ return str.replace( /([A-Z])/g, function( $1 ) {
1830
+ return '-' + $1.toLowerCase();
1831
+ });
1832
+ }
1833
+
1834
+ var transitionProps = 'opacity,' +
1835
+ toDashedAll( vendorProperties.transform || 'transform' );
1816
1836
 
1817
1837
  Item.prototype.enableTransition = function(/* style */) {
1818
- // only enable if not already transitioning
1819
- // bug in IE10 were re-setting transition style will prevent
1820
- // transitionend event from triggering
1838
+ // HACK changing transitionProperty during a transition
1839
+ // will cause transition to jump
1821
1840
  if ( this.isTransitioning ) {
1822
1841
  return;
1823
1842
  }
1824
1843
 
1825
- // make transition: foo, bar, baz from style object
1826
- // TODO uncomment this bit when IE10 bug is resolved
1827
- // var transitionValue = [];
1844
+ // make `transition: foo, bar, baz` from style object
1845
+ // HACK un-comment this when enableTransition can work
1846
+ // while a transition is happening
1847
+ // var transitionValues = [];
1828
1848
  // for ( var prop in style ) {
1829
1849
  // // dash-ify camelCased properties like WebkitTransition
1830
- // transitionValue.push( toDash( prop ) );
1850
+ // prop = vendorProperties[ prop ] || prop;
1851
+ // transitionValues.push( toDashedAll( prop ) );
1831
1852
  // }
1832
1853
  // enable transition styles
1833
- // HACK always enable transform,opacity for IE10
1834
1854
  this.css({
1835
- transitionProperty: itemTransitionProperties,
1855
+ transitionProperty: transitionProps,
1836
1856
  transitionDuration: this.layout.options.transitionDuration
1837
1857
  });
1838
1858
  // listen for transition end event
@@ -2035,7 +2055,7 @@ return Item;
2035
2055
  }));
2036
2056
 
2037
2057
  /*!
2038
- * Outlayer v1.4.0
2058
+ * Outlayer v1.4.2
2039
2059
  * the brains and guts of a layout library
2040
2060
  * MIT license
2041
2061
  */
@@ -2450,7 +2470,7 @@ Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) {
2450
2470
  Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) {
2451
2471
  var _this = this;
2452
2472
  function onComplete() {
2453
- _this.emitEvent( eventName + 'Complete', [ items ] );
2473
+ _this.dispatchEvent( eventName + 'Complete', null, [ items ] );
2454
2474
  }
2455
2475
 
2456
2476
  var count = items.length;
@@ -2474,6 +2494,32 @@ Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) {
2474
2494
  }
2475
2495
  };
2476
2496
 
2497
+ /**
2498
+ * emits events via eventEmitter and jQuery events
2499
+ * @param {String} type - name of event
2500
+ * @param {Event} event - original event
2501
+ * @param {Array} args - extra arguments
2502
+ */
2503
+ Outlayer.prototype.dispatchEvent = function( type, event, args ) {
2504
+ // add original event to arguments
2505
+ var emitArgs = event ? [ event ].concat( args ) : args;
2506
+ this.emitEvent( type, emitArgs );
2507
+
2508
+ if ( jQuery ) {
2509
+ // set this.$element
2510
+ this.$element = this.$element || jQuery( this.element );
2511
+ if ( event ) {
2512
+ // create jQuery event
2513
+ var $event = jQuery.Event( event );
2514
+ $event.type = type;
2515
+ this.$element.trigger( $event, args );
2516
+ } else {
2517
+ // just trigger with type if no event available
2518
+ this.$element.trigger( type, args );
2519
+ }
2520
+ }
2521
+ };
2522
+
2477
2523
  // -------------------------- ignore & stamps -------------------------- //
2478
2524
 
2479
2525
 
@@ -2936,7 +2982,7 @@ return Outlayer;
2936
2982
 
2937
2983
 
2938
2984
  /*!
2939
- * Masonry v3.3.0
2985
+ * Masonry v3.3.2
2940
2986
  * Cascading grid layout library
2941
2987
  * http://masonry.desandro.com
2942
2988
  * MIT License
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masonry2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew H Yi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-12-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Masonry.js wrapper for Rails
14
14
  email:
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  version: '0'
45
45
  requirements: []
46
46
  rubyforge_project:
47
- rubygems_version: 2.4.5.1
47
+ rubygems_version: 2.4.8
48
48
  signing_key:
49
49
  specification_version: 4
50
50
  summary: Masonry.js wrapper for Rails