masonry-rails 0.2.1 → 0.2.3

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.
@@ -0,0 +1,97 @@
1
+ /*!
2
+ * Packery layout mode v1.0.0
3
+ * sub-classes Packery
4
+ * http://packery.metafizzy.co
5
+ */
6
+
7
+ /*jshint browser: true, strict: true, undef: true, unused: true */
8
+
9
+ ( function( window ) {
10
+
11
+ 'use strict';
12
+
13
+ // -------------------------- helpers -------------------------- //
14
+
15
+ // extend objects
16
+ function extend( a, b ) {
17
+ for ( var prop in b ) {
18
+ a[ prop ] = b[ prop ];
19
+ }
20
+ return a;
21
+ }
22
+
23
+ // -------------------------- masonryDefinition -------------------------- //
24
+
25
+ // used for AMD definition and requires
26
+ function packeryDefinition( LayoutMode, Packery, getSize ) {
27
+ // create an Outlayer layout class
28
+ var PackeryMode = LayoutMode.create('packery');
29
+
30
+ // save on to these methods
31
+ var _getElementOffset = PackeryMode.prototype._getElementOffset;
32
+ // var layout = PackeryMode.prototype.layout;
33
+ var _getMeasurement = PackeryMode.prototype._getMeasurement;
34
+
35
+ // sub-class Masonry
36
+ extend( PackeryMode.prototype, Packery.prototype );
37
+
38
+ // set back, as it was overwritten by Packery
39
+ PackeryMode.prototype._getElementOffset = _getElementOffset;
40
+ // PackeryMode.prototype.layout = layout;
41
+ PackeryMode.prototype._getMeasurement = _getMeasurement;
42
+
43
+ // set packery in _resetLayout
44
+ var _resetLayout = PackeryMode.prototype._resetLayout;
45
+ PackeryMode.prototype._resetLayout = function() {
46
+ this.packer = this.packer || new Packery.Packer();
47
+ _resetLayout.apply( this, arguments );
48
+ };
49
+
50
+ var _getItemLayoutPosition = PackeryMode.prototype._getItemLayoutPosition;
51
+ PackeryMode.prototype._getItemLayoutPosition = function( item ) {
52
+ // set packery rect
53
+ item.rect = item.rect || new Packery.Rect();
54
+ return _getItemLayoutPosition.call( this, item );
55
+ };
56
+
57
+ // HACK copy over isOriginLeft/Top options
58
+ var _manageStamp = PackeryMode.prototype._manageStamp;
59
+ PackeryMode.prototype._manageStamp = function() {
60
+ this.options.isOriginLeft = this.isotope.options.isOriginLeft;
61
+ this.options.isOriginTop = this.isotope.options.isOriginTop;
62
+ _manageStamp.apply( this, arguments );
63
+ };
64
+
65
+ PackeryMode.prototype.needsResizeLayout = function() {
66
+ // don't trigger if size did not change
67
+ var size = getSize( this.element );
68
+ // check that this.size and size are there
69
+ // IE8 triggers resize on body size change, so they might not be
70
+ var hasSizes = this.size && size;
71
+ var innerSize = this.options.isHorizontal ? 'innerHeight' : 'innerWidth';
72
+ return hasSizes && size[ innerSize ] !== this.size[ innerSize ];
73
+ };
74
+
75
+ return PackeryMode;
76
+ }
77
+
78
+ // -------------------------- transport -------------------------- //
79
+
80
+ if ( typeof define === 'function' && define.amd ) {
81
+ // AMD
82
+ define( [
83
+ 'isotope/js/layout-mode',
84
+ 'packery/js/packery',
85
+ 'get-size/get-size'
86
+ ],
87
+ packeryDefinition );
88
+ } else {
89
+ // browser global
90
+ packeryDefinition(
91
+ window.Isotope.LayoutMode,
92
+ window.Packery,
93
+ window.getSize
94
+ );
95
+ }
96
+
97
+ })( window );
@@ -0,0 +1,152 @@
1
+ /*!
2
+ * masonryHorizontal layout mode for Isotope
3
+ * http://isotope.metafizzy.co
4
+ */
5
+
6
+ /*jshint browser: true, strict: true, undef: true, unused: true */
7
+
8
+ ( function( window ) {
9
+
10
+ 'use strict';
11
+
12
+ // -------------------------- helpers -------------------------- //
13
+
14
+ var indexOf = Array.prototype.indexOf ?
15
+ function( items, value ) {
16
+ return items.indexOf( value );
17
+ } :
18
+ function ( items, value ) {
19
+ for ( var i=0, len = items.length; i < len; i++ ) {
20
+ var item = items[i];
21
+ if ( item === value ) {
22
+ return i;
23
+ }
24
+ }
25
+ return -1;
26
+ };
27
+
28
+ // -------------------------- definition -------------------------- //
29
+
30
+ function masonryHorizontalDefinition( getSize, LayoutMode ) {
31
+ // create an Outlayer layout class
32
+ var MasonryHorizontal = LayoutMode.create('masonryHorizontal');
33
+
34
+ MasonryHorizontal.prototype._resetLayout = function() {
35
+ this.getRowHeight();
36
+ this._getMeasurement( 'gutter', 'outerHeight' );
37
+
38
+ this.rowHeight += this.gutter;
39
+ // measure rows
40
+ this.rows = Math.floor( ( this.isotope.size.innerHeight + this.gutter ) / this.rowHeight );
41
+ this.rows = Math.max( this.rows, 1 );
42
+
43
+ // reset row Xs
44
+ var i = this.rows;
45
+ this.rowXs = [];
46
+ while (i--) {
47
+ this.rowXs.push( 0 );
48
+ }
49
+
50
+ this.maxX = 0;
51
+ };
52
+
53
+ MasonryHorizontal.prototype._getItemLayoutPosition = function( item ) {
54
+ item.getSize();
55
+ // how many rows does this brick span
56
+ var rowSpan = Math.ceil( item.size.outerHeight / this.rowHeight );
57
+ rowSpan = Math.min( rowSpan, this.rows );
58
+
59
+ var rowGroup = this._getRowGroup( rowSpan );
60
+ // get the minimum X value from the rows
61
+ var minimumX = Math.min.apply( Math, rowGroup );
62
+ var shortRowIndex = indexOf( rowGroup, minimumX );
63
+
64
+ // position the brick
65
+ var position = {
66
+ x: minimumX,
67
+ y: this.rowHeight * shortRowIndex
68
+ };
69
+
70
+ // apply setHeight to necessary rows
71
+ var setWidth = minimumX + item.size.outerWidth;
72
+ var setSpan = this.rows + 1 - rowGroup.length;
73
+ for ( var i = 0; i < setSpan; i++ ) {
74
+ this.rowXs[ shortRowIndex + i ] = setWidth;
75
+ }
76
+
77
+ return position;
78
+ };
79
+
80
+ /**
81
+ * @param {Number} rowSpan - number of rows the element spans
82
+ * @returns {Array} rowGroup
83
+ */
84
+ MasonryHorizontal.prototype._getRowGroup = function( rowSpan ) {
85
+ if ( rowSpan < 2 ) {
86
+ // if brick spans only one row, use all the row Xs
87
+ return this.rowXs;
88
+ }
89
+
90
+ var rowGroup = [];
91
+ // how many different places could this brick fit horizontally
92
+ var groupCount = this.rows + 1 - rowSpan;
93
+ // for each group potential horizontal position
94
+ for ( var i = 0; i < groupCount; i++ ) {
95
+ // make an array of rowX values for that one group
96
+ var groupRowXs = this.rowXs.slice( i, i + rowSpan );
97
+ // and get the max value of the array
98
+ rowGroup[i] = Math.max.apply( Math, groupRowXs );
99
+ }
100
+ return rowGroup;
101
+ };
102
+
103
+ MasonryHorizontal.prototype._manageStamp = function( stamp ) {
104
+ var stampSize = getSize( stamp );
105
+ var offset = this.isotope._getElementOffset( stamp );
106
+ // get the rows that this stamp affects
107
+ var firstY = this.isotope.options.isOriginTop ? offset.top : offset.bottom;
108
+ var lastY = firstY + stampSize.outerHeight;
109
+ var firstRow = Math.floor( firstY / this.rowHeight );
110
+ firstRow = Math.max( 0, firstRow );
111
+ var lastRow = Math.floor( lastY / this.rowHeight );
112
+ lastRow = Math.min( this.rows - 1, lastRow );
113
+ // set rowXs to outside edge of the stamp
114
+ var stampMaxX = ( this.isotope.options.isOriginLeft ? offset.left : offset.right ) +
115
+ stampSize.outerWidth;
116
+ for ( var i = firstRow; i <= lastRow; i++ ) {
117
+ this.rowXs[i] = Math.max( stampMaxX, this.rowXs[i] );
118
+ }
119
+ };
120
+
121
+ MasonryHorizontal.prototype._getContainerSize = function() {
122
+ this.maxX = Math.max.apply( Math, this.rowXs );
123
+
124
+ return {
125
+ width: this.maxX
126
+ };
127
+ };
128
+
129
+ MasonryHorizontal.prototype.needsResizeLayout = function() {
130
+ return this.needsVerticalResizeLayout();
131
+ };
132
+
133
+ return MasonryHorizontal;
134
+
135
+ }
136
+
137
+ if ( typeof define === 'function' && define.amd ) {
138
+ // AMD
139
+ define( [
140
+ 'get-size/get-size',
141
+ 'isotope/js/layout-mode'
142
+ ],
143
+ masonryHorizontalDefinition );
144
+ } else {
145
+ // browser global
146
+ masonryHorizontalDefinition(
147
+ window.getSize,
148
+ window.Isotope.LayoutMode
149
+ );
150
+ }
151
+
152
+ })( window );
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Masonry PACKAGED v3.1.5
3
+ * Cascading grid layout library
4
+ * http://masonry.desandro.com
5
+ * MIT License
6
+ * by David DeSandro
7
+ */
8
+
9
+ !function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c(a.jQuery)}(window),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c}var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(this),function(a){function b(a){"function"==typeof a&&(b.isReady?a():f.push(a))}function c(a){var c="readystatechange"===a.type&&"complete"!==e.readyState;if(!b.isReady&&!c){b.isReady=!0;for(var d=0,g=f.length;g>d;d++){var h=f[d];h()}}}function d(d){return d.bind(e,"DOMContentLoaded",c),d.bind(e,"readystatechange",c),d.bind(a,"load",c),b}var e=a.document,f=[];b.isReady=!1,"function"==typeof define&&define.amd?(b.isReady="function"==typeof requirejs,define("doc-ready/doc-ready",["eventie/eventie"],d)):a.docReady=d(a.eventie)}(this),function(){function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b<a.length;b+=1)c.push(a[b].listener);return c},d.getListenersAsObject=function(a){var b,c=this.getListeners(a);return c instanceof Array&&(b={},b[a]=c),b||c},d.addListener=function(a,c){var d,e=this.getListenersAsObject(a),f="object"==typeof c;for(d in e)e.hasOwnProperty(d)&&-1===b(e[d],c)&&e[d].push(f?c:{listener:c,once:!1});return this},d.on=c("addListener"),d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})},d.once=c("addOnceListener"),d.defineEvent=function(a){return this.getListeners(a),this},d.defineEvents=function(a){for(var b=0;b<a.length;b+=1)this.defineEvent(a[b]);return this},d.removeListener=function(a,c){var d,e,f=this.getListenersAsObject(a);for(e in f)f.hasOwnProperty(e)&&(d=b(f[e],c),-1!==d&&f[e].splice(d,1));return this},d.off=c("removeListener"),d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)},d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)},d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener,g=a?this.removeListeners:this.addListeners;if("object"!=typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"==typeof e?f.call(this,d,e):g.call(this,d,e));return this},d.removeEvent=function(a){var b,c=typeof a,d=this._getEvents();if("string"===c)delete d[a];else if(a instanceof RegExp)for(b in d)d.hasOwnProperty(b)&&a.test(b)&&delete d[b];else delete this._events;return this},d.removeAllListeners=c("removeEvent"),d.emitEvent=function(a,b){var c,d,e,f,g=this.getListenersAsObject(a);for(e in g)if(g.hasOwnProperty(e))for(d=g[e].length;d--;)c=g[e][d],c.once===!0&&this.removeListener(a,c.listener),f=c.listener.apply(this,b||[]),f===this._getOnceReturnValue()&&this.removeListener(a,c.listener);return this},d.trigger=c("emitEvent"),d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)},d.setOnceReturnValue=function(a){return this._onceReturnValue=a,this},d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},d._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return e.EventEmitter=f,a},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return a}):"object"==typeof module&&module.exports?module.exports=a:this.EventEmitter=a}.call(this),function(a){function b(a){if(a){if("string"==typeof d[a])return a;a=a.charAt(0).toUpperCase()+a.slice(1);for(var b,e=0,f=c.length;f>e;e++)if(b=c[e]+a,"string"==typeof d[b])return b}}var c="Webkit Moz ms Ms O".split(" "),d=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return b}):"object"==typeof exports?module.exports=b:a.getStyleProperty=b}(window),function(a){function b(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b}function c(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=g.length;c>b;b++){var d=g[b];a[d]=0}return a}function d(a){function d(a){if("string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var d=f(a);if("none"===d.display)return c();var e={};e.width=a.offsetWidth,e.height=a.offsetHeight;for(var k=e.isBorderBox=!(!j||!d[j]||"border-box"!==d[j]),l=0,m=g.length;m>l;l++){var n=g[l],o=d[n];o=h(a,o);var p=parseFloat(o);e[n]=isNaN(p)?0:p}var q=e.paddingLeft+e.paddingRight,r=e.paddingTop+e.paddingBottom,s=e.marginLeft+e.marginRight,t=e.marginTop+e.marginBottom,u=e.borderLeftWidth+e.borderRightWidth,v=e.borderTopWidth+e.borderBottomWidth,w=k&&i,x=b(d.width);x!==!1&&(e.width=x+(w?0:q+u));var y=b(d.height);return y!==!1&&(e.height=y+(w?0:r+v)),e.innerWidth=e.width-(q+u),e.innerHeight=e.height-(r+v),e.outerWidth=e.width+s,e.outerHeight=e.height+t,e}}function h(a,b){if(e||-1===b.indexOf("%"))return b;var c=a.style,d=c.left,f=a.runtimeStyle,g=f&&f.left;return g&&(f.left=a.currentStyle.left),c.left=b,b=c.pixelLeft,c.left=d,g&&(f.left=g),b}var i,j=a("boxSizing");return function(){if(j){var a=document.createElement("div");a.style.width="200px",a.style.padding="1px 2px 3px 4px",a.style.borderStyle="solid",a.style.borderWidth="1px 2px 3px 4px",a.style[j]="border-box";var c=document.body||document.documentElement;c.appendChild(a);var d=f(a);i=200===b(d.width),c.removeChild(a)}}(),d}var e=a.getComputedStyle,f=e?function(a){return e(a,null)}:function(a){return a.currentStyle},g=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],d):"object"==typeof exports?module.exports=d(require("get-style-property")):a.getSize=d(a.getStyleProperty)}(window),function(a,b){function c(a,b){return a[h](b)}function d(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}}function e(a,b){d(a);for(var c=a.parentNode.querySelectorAll(b),e=0,f=c.length;f>e;e++)if(c[e]===a)return!0;return!1}function f(a,b){return d(a),c(a,b)}var g,h=function(){if(b.matchesSelector)return"matchesSelector";for(var a=["webkit","moz","ms","o"],c=0,d=a.length;d>c;c++){var e=a[c],f=e+"MatchesSelector";if(b[f])return f}}();if(h){var i=document.createElement("div"),j=c(i,"div");g=j?c:f}else g=e;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return g}):window.matchesSelector=g}(this,Element.prototype),function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){for(var b in a)return!1;return b=null,!0}function d(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function e(a,e,f){function h(a,b){a&&(this.element=a,this.layout=b,this.position={x:0,y:0},this._create())}var i=f("transition"),j=f("transform"),k=i&&j,l=!!f("perspective"),m={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[i],n=["transform","transition","transitionDuration","transitionProperty"],o=function(){for(var a={},b=0,c=n.length;c>b;b++){var d=n[b],e=f(d);e&&e!==d&&(a[d]=e)}return a}();b(h.prototype,a.prototype),h.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},h.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},h.prototype.getSize=function(){this.size=e(this.element)},h.prototype.css=function(a){var b=this.element.style;for(var c in a){var d=o[c]||c;b[d]=a[c]}},h.prototype.getPosition=function(){var a=g(this.element),b=this.layout.options,c=b.isOriginLeft,d=b.isOriginTop,e=parseInt(a[c?"left":"right"],10),f=parseInt(a[d?"top":"bottom"],10);e=isNaN(e)?0:e,f=isNaN(f)?0:f;var h=this.layout.size;e-=c?h.paddingLeft:h.paddingRight,f-=d?h.paddingTop:h.paddingBottom,this.position.x=e,this.position.y=f},h.prototype.layoutPosition=function(){var a=this.layout.size,b=this.layout.options,c={};b.isOriginLeft?(c.left=this.position.x+a.paddingLeft+"px",c.right=""):(c.right=this.position.x+a.paddingRight+"px",c.left=""),b.isOriginTop?(c.top=this.position.y+a.paddingTop+"px",c.bottom=""):(c.bottom=this.position.y+a.paddingBottom+"px",c.top=""),this.css(c),this.emitEvent("layout",[this])};var p=l?function(a,b){return"translate3d("+a+"px, "+b+"px, 0)"}:function(a,b){return"translate("+a+"px, "+b+"px)"};h.prototype._transitionTo=function(a,b){this.getPosition();var c=this.position.x,d=this.position.y,e=parseInt(a,10),f=parseInt(b,10),g=e===this.position.x&&f===this.position.y;if(this.setPosition(a,b),g&&!this.isTransitioning)return void this.layoutPosition();var h=a-c,i=b-d,j={},k=this.layout.options;h=k.isOriginLeft?h:-h,i=k.isOriginTop?i:-i,j.transform=p(h,i),this.transition({to:j,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},h.prototype.goTo=function(a,b){this.setPosition(a,b),this.layoutPosition()},h.prototype.moveTo=k?h.prototype._transitionTo:h.prototype.goTo,h.prototype.setPosition=function(a,b){this.position.x=parseInt(a,10),this.position.y=parseInt(b,10)},h.prototype._nonTransition=function(a){this.css(a.to),a.isCleaning&&this._removeStyles(a.to);for(var b in a.onTransitionEnd)a.onTransitionEnd[b].call(this)},h.prototype._transition=function(a){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(a);var b=this._transn;for(var c in a.onTransitionEnd)b.onEnd[c]=a.onTransitionEnd[c];for(c in a.to)b.ingProperties[c]=!0,a.isCleaning&&(b.clean[c]=!0);if(a.from){this.css(a.from);var d=this.element.offsetHeight;d=null}this.enableTransition(a.to),this.css(a.to),this.isTransitioning=!0};var q=j&&d(j)+",opacity";h.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:q,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(m,this,!1))},h.prototype.transition=h.prototype[i?"_transition":"_nonTransition"],h.prototype.onwebkitTransitionEnd=function(a){this.ontransitionend(a)},h.prototype.onotransitionend=function(a){this.ontransitionend(a)};var r={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};h.prototype.ontransitionend=function(a){if(a.target===this.element){var b=this._transn,d=r[a.propertyName]||a.propertyName;if(delete b.ingProperties[d],c(b.ingProperties)&&this.disableTransition(),d in b.clean&&(this.element.style[a.propertyName]="",delete b.clean[d]),d in b.onEnd){var e=b.onEnd[d];e.call(this),delete b.onEnd[d]}this.emitEvent("transitionEnd",[this])}},h.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(m,this,!1),this.isTransitioning=!1},h.prototype._removeStyles=function(a){var b={};for(var c in a)b[c]="";this.css(b)};var s={transitionProperty:"",transitionDuration:""};return h.prototype.removeTransitionStyles=function(){this.css(s)},h.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},h.prototype.remove=function(){if(!i||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var a=this;this.on("transitionEnd",function(){return a.removeElem(),!0}),this.hide()},h.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var a=this.layout.options;this.transition({from:a.hiddenStyle,to:a.visibleStyle,isCleaning:!0})},h.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var a=this.layout.options;this.transition({from:a.visibleStyle,to:a.hiddenStyle,isCleaning:!0,onTransitionEnd:{opacity:function(){this.isHidden&&this.css({display:"none"})}}})},h.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},h}var f=a.getComputedStyle,g=f?function(a){return f(a,null)}:function(a){return a.currentStyle};"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property"],e):(a.Outlayer={},a.Outlayer.Item=e(a.EventEmitter,a.getSize,a.getStyleProperty))}(window),function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){return"[object Array]"===l.call(a)}function d(a){var b=[];if(c(a))b=a;else if(a&&"number"==typeof a.length)for(var d=0,e=a.length;e>d;d++)b.push(a[d]);else b.push(a);return b}function e(a,b){var c=n(b,a);-1!==c&&b.splice(c,1)}function f(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()}function g(c,g,l,n,o,p){function q(a,c){if("string"==typeof a&&(a=h.querySelector(a)),!a||!m(a))return void(i&&i.error("Bad "+this.constructor.namespace+" element: "+a));this.element=a,this.options=b({},this.constructor.defaults),this.option(c);var d=++r;this.element.outlayerGUID=d,s[d]=this,this._create(),this.options.isInitLayout&&this.layout()}var r=0,s={};return q.namespace="outlayer",q.Item=p,q.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},b(q.prototype,l.prototype),q.prototype.option=function(a){b(this.options,a)},q.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),b(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},q.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},q.prototype._itemize=function(a){for(var b=this._filterFindItemElements(a),c=this.constructor.Item,d=[],e=0,f=b.length;f>e;e++){var g=b[e],h=new c(g,this);d.push(h)}return d},q.prototype._filterFindItemElements=function(a){a=d(a);for(var b=this.options.itemSelector,c=[],e=0,f=a.length;f>e;e++){var g=a[e];if(m(g))if(b){o(g,b)&&c.push(g);for(var h=g.querySelectorAll(b),i=0,j=h.length;j>i;i++)c.push(h[i])}else c.push(g)}return c},q.prototype.getItemElements=function(){for(var a=[],b=0,c=this.items.length;c>b;b++)a.push(this.items[b].element);return a},q.prototype.layout=function(){this._resetLayout(),this._manageStamps();var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,a),this._isLayoutInited=!0},q.prototype._init=q.prototype.layout,q.prototype._resetLayout=function(){this.getSize()},q.prototype.getSize=function(){this.size=n(this.element)},q.prototype._getMeasurement=function(a,b){var c,d=this.options[a];d?("string"==typeof d?c=this.element.querySelector(d):m(d)&&(c=d),this[a]=c?n(c)[b]:d):this[a]=0},q.prototype.layoutItems=function(a,b){a=this._getItemsForLayout(a),this._layoutItems(a,b),this._postLayout()},q.prototype._getItemsForLayout=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];e.isIgnored||b.push(e)}return b},q.prototype._layoutItems=function(a,b){function c(){d.emitEvent("layoutComplete",[d,a])}var d=this;if(!a||!a.length)return void c();this._itemsOn(a,"layout",c);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f],i=this._getItemLayoutPosition(h);i.item=h,i.isInstant=b||h.isLayoutInstant,e.push(i)}this._processLayoutQueue(e)},q.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},q.prototype._processLayoutQueue=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];this._positionItem(d.item,d.x,d.y,d.isInstant)}},q.prototype._positionItem=function(a,b,c,d){d?a.goTo(b,c):a.moveTo(b,c)},q.prototype._postLayout=function(){this.resizeContainer()},q.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var a=this._getContainerSize();a&&(this._setContainerMeasure(a.width,!0),this._setContainerMeasure(a.height,!1))}},q.prototype._getContainerSize=k,q.prototype._setContainerMeasure=function(a,b){if(void 0!==a){var c=this.size;c.isBorderBox&&(a+=b?c.paddingLeft+c.paddingRight+c.borderLeftWidth+c.borderRightWidth:c.paddingBottom+c.paddingTop+c.borderTopWidth+c.borderBottomWidth),a=Math.max(a,0),this.element.style[b?"width":"height"]=a+"px"}},q.prototype._itemsOn=function(a,b,c){function d(){return e++,e===f&&c.call(g),!0}for(var e=0,f=a.length,g=this,h=0,i=a.length;i>h;h++){var j=a[h];j.on(b,d)}},q.prototype.ignore=function(a){var b=this.getItem(a);b&&(b.isIgnored=!0)},q.prototype.unignore=function(a){var b=this.getItem(a);b&&delete b.isIgnored},q.prototype.stamp=function(a){if(a=this._find(a)){this.stamps=this.stamps.concat(a);for(var b=0,c=a.length;c>b;b++){var d=a[b];this.ignore(d)}}},q.prototype.unstamp=function(a){if(a=this._find(a))for(var b=0,c=a.length;c>b;b++){var d=a[b];e(d,this.stamps),this.unignore(d)}},q.prototype._find=function(a){return a?("string"==typeof a&&(a=this.element.querySelectorAll(a)),a=d(a)):void 0},q.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var a=0,b=this.stamps.length;b>a;a++){var c=this.stamps[a];this._manageStamp(c)}}},q.prototype._getBoundingRect=function(){var a=this.element.getBoundingClientRect(),b=this.size;this._boundingRect={left:a.left+b.paddingLeft+b.borderLeftWidth,top:a.top+b.paddingTop+b.borderTopWidth,right:a.right-(b.paddingRight+b.borderRightWidth),bottom:a.bottom-(b.paddingBottom+b.borderBottomWidth)}},q.prototype._manageStamp=k,q.prototype._getElementOffset=function(a){var b=a.getBoundingClientRect(),c=this._boundingRect,d=n(a),e={left:b.left-c.left-d.marginLeft,top:b.top-c.top-d.marginTop,right:c.right-b.right-d.marginRight,bottom:c.bottom-b.bottom-d.marginBottom};return e},q.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},q.prototype.bindResize=function(){this.isResizeBound||(c.bind(a,"resize",this),this.isResizeBound=!0)},q.prototype.unbindResize=function(){this.isResizeBound&&c.unbind(a,"resize",this),this.isResizeBound=!1},q.prototype.onresize=function(){function a(){b.resize(),delete b.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var b=this;this.resizeTimeout=setTimeout(a,100)},q.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},q.prototype.needsResizeLayout=function(){var a=n(this.element),b=this.size&&a;return b&&a.innerWidth!==this.size.innerWidth},q.prototype.addItems=function(a){var b=this._itemize(a);return b.length&&(this.items=this.items.concat(b)),b},q.prototype.appended=function(a){var b=this.addItems(a);b.length&&(this.layoutItems(b,!0),this.reveal(b))},q.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){var c=this.items.slice(0);this.items=b.concat(c),this._resetLayout(),this._manageStamps(),this.layoutItems(b,!0),this.reveal(b),this.layoutItems(c)}},q.prototype.reveal=function(a){var b=a&&a.length;if(b)for(var c=0;b>c;c++){var d=a[c];d.reveal()}},q.prototype.hide=function(a){var b=a&&a.length;if(b)for(var c=0;b>c;c++){var d=a[c];d.hide()}},q.prototype.getItem=function(a){for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];if(d.element===a)return d}},q.prototype.getItems=function(a){if(a&&a.length){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c],f=this.getItem(e);f&&b.push(f)}return b}},q.prototype.remove=function(a){a=d(a);var b=this.getItems(a);if(b&&b.length){this._itemsOn(b,"remove",function(){this.emitEvent("removeComplete",[this,b])});for(var c=0,f=b.length;f>c;c++){var g=b[c];g.remove(),e(g,this.items)}}},q.prototype.destroy=function(){var a=this.element.style;a.height="",a.position="",a.width="";for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];d.destroy()}this.unbindResize(),delete this.element.outlayerGUID,j&&j.removeData(this.element,this.constructor.namespace)},q.data=function(a){var b=a&&a.outlayerGUID;return b&&s[b]},q.create=function(a,c){function d(){q.apply(this,arguments)}return Object.create?d.prototype=Object.create(q.prototype):b(d.prototype,q.prototype),d.prototype.constructor=d,d.defaults=b({},q.defaults),b(d.defaults,c),d.prototype.settings={},d.namespace=a,d.data=q.data,d.Item=function(){p.apply(this,arguments)},d.Item.prototype=new p,g(function(){for(var b=f(a),c=h.querySelectorAll(".js-"+b),e="data-"+b+"-options",g=0,k=c.length;k>g;g++){var l,m=c[g],n=m.getAttribute(e);try{l=n&&JSON.parse(n)}catch(o){i&&i.error("Error parsing "+e+" on "+m.nodeName.toLowerCase()+(m.id?"#"+m.id:"")+": "+o);continue}var p=new d(m,l);j&&j.data(m,a,p)}}),j&&j.bridget&&j.bridget(a,d),d},q.Item=p,q}var h=a.document,i=a.console,j=a.jQuery,k=function(){},l=Object.prototype.toString,m="object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName},n=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1};"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","doc-ready/doc-ready","eventEmitter/EventEmitter","get-size/get-size","matches-selector/matches-selector","./item"],g):a.Outlayer=g(a.eventie,a.docReady,a.EventEmitter,a.getSize,a.matchesSelector,a.Outlayer.Item)}(window),function(a){function b(a,b){var d=a.create("masonry");return d.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var a=this.cols;for(this.colYs=[];a--;)this.colYs.push(0);this.maxY=0},d.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var a=this.items[0],c=a&&a.element;this.columnWidth=c&&b(c).outerWidth||this.containerWidth}this.columnWidth+=this.gutter,this.cols=Math.floor((this.containerWidth+this.gutter)/this.columnWidth),this.cols=Math.max(this.cols,1)},d.prototype.getContainerWidth=function(){var a=this.options.isFitWidth?this.element.parentNode:this.element,c=b(a);this.containerWidth=c&&c.innerWidth},d.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth%this.columnWidth,d=b&&1>b?"round":"ceil",e=Math[d](a.size.outerWidth/this.columnWidth);e=Math.min(e,this.cols);for(var f=this._getColGroup(e),g=Math.min.apply(Math,f),h=c(f,g),i={x:this.columnWidth*h,y:g},j=g+a.size.outerHeight,k=this.cols+1-f.length,l=0;k>l;l++)this.colYs[h+l]=j;return i},d.prototype._getColGroup=function(a){if(2>a)return this.colYs;for(var b=[],c=this.cols+1-a,d=0;c>d;d++){var e=this.colYs.slice(d,d+a);b[d]=Math.max.apply(Math,e)}return b},d.prototype._manageStamp=function(a){var c=b(a),d=this._getElementOffset(a),e=this.options.isOriginLeft?d.left:d.right,f=e+c.outerWidth,g=Math.floor(e/this.columnWidth);g=Math.max(0,g);var h=Math.floor(f/this.columnWidth);h-=f%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var i=(this.options.isOriginTop?d.top:d.bottom)+c.outerHeight,j=g;h>=j;j++)this.colYs[j]=Math.max(i,this.colYs[j])},d.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var a={height:this.maxY};return this.options.isFitWidth&&(a.width=this._getContainerFitWidth()),a},d.prototype._getContainerFitWidth=function(){for(var a=0,b=this.cols;--b&&0===this.colYs[b];)a++;return(this.cols-a)*this.columnWidth-this.gutter},d.prototype.needsResizeLayout=function(){var a=this.containerWidth;return this.getContainerWidth(),a!==this.containerWidth},d}var c=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++){var e=a[c];if(e===b)return c}return-1};"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],b):a.Masonry=b(a.Outlayer,a.getSize)}(window);
metadata CHANGED
@@ -1,97 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masonry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristian Mandrup
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - '>'
17
+ - - ">"
32
18
  - !ruby/object:Gem::Version
33
19
  version: 2.10.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.10'
34
23
  type: :development
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
- - - '>'
27
+ - - ">"
39
28
  - !ruby/object:Gem::Version
40
29
  version: 2.10.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.10'
41
33
  - !ruby/object:Gem::Dependency
42
34
  name: rdoc
43
35
  requirement: !ruby/object:Gem::Requirement
44
36
  requirements:
45
- - - '>'
37
+ - - ">"
46
38
  - !ruby/object:Gem::Version
47
- version: '3.12'
39
+ version: 4.0.0
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '4.0'
48
43
  type: :development
49
44
  prerelease: false
50
45
  version_requirements: !ruby/object:Gem::Requirement
51
46
  requirements:
52
- - - '>'
47
+ - - ">"
48
+ - !ruby/object:Gem::Version
49
+ version: 4.0.0
50
+ - - "~>"
53
51
  - !ruby/object:Gem::Version
54
- version: '3.12'
52
+ version: '4.0'
55
53
  - !ruby/object:Gem::Dependency
56
54
  name: bundler
57
55
  requirement: !ruby/object:Gem::Requirement
58
56
  requirements:
59
- - - '>'
57
+ - - ">"
60
58
  - !ruby/object:Gem::Version
61
59
  version: 1.2.0
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.2'
62
63
  type: :development
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - '>'
67
+ - - ">"
67
68
  - !ruby/object:Gem::Version
68
69
  version: 1.2.0
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.2'
69
73
  - !ruby/object:Gem::Dependency
70
74
  name: jeweler
71
75
  requirement: !ruby/object:Gem::Requirement
72
76
  requirements:
73
- - - '>'
77
+ - - ">"
74
78
  - !ruby/object:Gem::Version
75
79
  version: 1.8.4
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.8'
76
83
  type: :development
77
84
  prerelease: false
78
85
  version_requirements: !ruby/object:Gem::Requirement
79
86
  requirements:
80
- - - '>'
87
+ - - ">"
81
88
  - !ruby/object:Gem::Version
82
89
  version: 1.8.4
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '1.8'
83
93
  - !ruby/object:Gem::Dependency
84
94
  name: simplecov
85
95
  requirement: !ruby/object:Gem::Requirement
86
96
  requirements:
87
- - - '>='
97
+ - - "~>"
88
98
  - !ruby/object:Gem::Version
89
99
  version: '0.5'
90
100
  type: :development
91
101
  prerelease: false
92
102
  version_requirements: !ruby/object:Gem::Requirement
93
103
  requirements:
94
- - - '>='
104
+ - - "~>"
95
105
  - !ruby/object:Gem::Version
96
106
  version: '0.5'
97
107
  description: Masonry will rock your world!
@@ -102,8 +112,8 @@ extra_rdoc_files:
102
112
  - LICENSE.txt
103
113
  - README.md
104
114
  files:
105
- - .document
106
- - .rspec
115
+ - ".document"
116
+ - ".rspec"
107
117
  - Gemfile
108
118
  - Gemfile.lock
109
119
  - LICENSE.txt
@@ -149,11 +159,19 @@ files:
149
159
  - spec/index.html
150
160
  - spec/spec_helper.rb
151
161
  - vendor/assets/images/masonry/loader.gif
152
- - vendor/assets/javascripts/debounce.js
153
- - vendor/assets/javascripts/jquery.debounced_resize.js
154
- - vendor/assets/javascripts/jquery.isotope.js
155
- - vendor/assets/javascripts/jquery.isotope.min.js
156
- - vendor/assets/javascripts/jquery.throttled_resize.js
162
+ - vendor/assets/javascripts/isotope/debounce.js
163
+ - vendor/assets/javascripts/isotope/isotope.js
164
+ - vendor/assets/javascripts/isotope/item.js
165
+ - vendor/assets/javascripts/isotope/jquery.debounced_resize.js
166
+ - vendor/assets/javascripts/isotope/jquery.isotope.js
167
+ - vendor/assets/javascripts/isotope/jquery.isotope.min.js
168
+ - vendor/assets/javascripts/isotope/jquery.throttled_resize.js
169
+ - vendor/assets/javascripts/isotope/layout-mode.js
170
+ - vendor/assets/javascripts/isotope/layout/cells-by-column.js
171
+ - vendor/assets/javascripts/isotope/layout/cells-by-row.js
172
+ - vendor/assets/javascripts/isotope/layout/fit-columns.js
173
+ - vendor/assets/javascripts/isotope/layout/horizontal.js
174
+ - vendor/assets/javascripts/isotope/layout/packery.js
157
175
  - vendor/assets/javascripts/masonry/box-maker.js
158
176
  - vendor/assets/javascripts/masonry/jquery.event-drag.js
159
177
  - vendor/assets/javascripts/masonry/jquery.imagesloaded.js
@@ -167,6 +185,8 @@ files:
167
185
  - vendor/assets/javascripts/masonry/jquery.pageless.min.js
168
186
  - vendor/assets/javascripts/masonry/jquery.sausage.js
169
187
  - vendor/assets/javascripts/masonry/jquery.sausage.min.js
188
+ - vendor/assets/javascripts/masonry/layout/horizontal.js
189
+ - vendor/assets/javascripts/masonry/masonry.min.js
170
190
  - vendor/assets/javascripts/masonry/modernizr-transitions.js
171
191
  - vendor/assets/stylesheets/isotope.css
172
192
  - vendor/assets/stylesheets/isotope/base.css
@@ -192,17 +212,17 @@ require_paths:
192
212
  - lib
193
213
  required_ruby_version: !ruby/object:Gem::Requirement
194
214
  requirements:
195
- - - '>='
215
+ - - ">="
196
216
  - !ruby/object:Gem::Version
197
217
  version: '0'
198
218
  required_rubygems_version: !ruby/object:Gem::Requirement
199
219
  requirements:
200
- - - '>='
220
+ - - ">="
201
221
  - !ruby/object:Gem::Version
202
222
  version: '0'
203
223
  requirements: []
204
224
  rubyforge_project:
205
- rubygems_version: 2.0.0
225
+ rubygems_version: 2.2.2
206
226
  signing_key:
207
227
  specification_version: 4
208
228
  summary: Use JQuery Masonry with Rails asset pipeline