angular-masonry
Advanced tools
Comparing version 0.14.0 to 0.15.0
/*! | ||
* angular-masonry 0.13.0 | ||
* Pascal Hartig, weluse GmbH, http://weluse.de/ | ||
* angular-masonry 0.15.0 | ||
* Pascal Hartig, https://passy.me/ | ||
* License: MIT | ||
@@ -49,7 +49,7 @@ */ | ||
} | ||
this.appendBrick = function appendBrick(element, id) { | ||
this.addBrick = function addBrick(method, element, id) { | ||
if (destroyed) { | ||
return; | ||
} | ||
function _append() { | ||
function _add() { | ||
if (Object.keys(bricks).length === 0) { | ||
@@ -62,3 +62,3 @@ $element.masonry('resize'); | ||
defaultLoaded(element); | ||
$element.masonry('appended', element, true); | ||
$element.masonry(method, element, true); | ||
} | ||
@@ -74,10 +74,10 @@ } | ||
if (!self.loadImages) { | ||
_append(); | ||
_add(); | ||
_layout(); | ||
} else if (self.preserveOrder) { | ||
_append(); | ||
_add(); | ||
element.imagesLoaded(_layout); | ||
} else { | ||
element.imagesLoaded(function imagesLoaded() { | ||
_append(); | ||
_add(); | ||
_layout(); | ||
@@ -157,3 +157,5 @@ }); | ||
var id = scope.$id, index; | ||
ctrl.appendBrick(element, id); | ||
var prependBrick = scope.$eval(attrs.prepend); | ||
var method = prependBrick ? 'prepended' : 'appended'; | ||
ctrl.addBrick(method, element, id); | ||
element.on('$destroy', function () { | ||
@@ -160,0 +162,0 @@ ctrl.removeBrick(id, element); |
/*! | ||
* angular-masonry 0.13.0 | ||
* Pascal Hartig, weluse GmbH, http://weluse.de/ | ||
* angular-masonry 0.15.0 | ||
* Pascal Hartig, https://passy.me/ | ||
* License: MIT | ||
*/ | ||
!function(){"use strict";angular.module("wu.masonry",[]).controller("MasonryCtrl",["$scope","$element","$timeout",function(a,b,c){function d(a){a.addClass("loaded")}var e={},f=[],g=!1,h=this,i=null;this.preserveOrder=!1,this.loadImages=!0,this.scheduleMasonryOnce=function(){var a=arguments,b=f.filter(function(b){return b[0]===a[0]}).length>0;b||this.scheduleMasonry.apply(null,arguments)},this.scheduleMasonry=function(){i&&c.cancel(i),f.push([].slice.call(arguments)),i=c(function(){g||(f.forEach(function(a){b.masonry.apply(b,a)}),f=[])},30)},this.appendBrick=function(a,c){function f(){0===Object.keys(e).length&&b.masonry("resize"),void 0===e[c]&&(e[c]=!0,d(a),b.masonry("appended",a,!0))}function i(){h.scheduleMasonryOnce("layout")}g||(h.loadImages?h.preserveOrder?(f(),a.imagesLoaded(i)):a.imagesLoaded(function(){f(),i()}):(f(),i()))},this.removeBrick=function(a,c){g||(delete e[a],b.masonry("remove",c),this.scheduleMasonryOnce("layout"))},this.destroy=function(){g=!0,b.data("masonry")&&b.masonry("destroy"),a.$emit("masonry.destroyed"),e={}},this.reload=function(){b.masonry(),a.$emit("masonry.reloaded")}}]).directive("masonry",function(){return{restrict:"AE",controller:"MasonryCtrl",link:{pre:function(a,b,c,d){var e=a.$eval(c.masonry||c.masonryOptions),f=angular.extend({itemSelector:c.itemSelector||".masonry-brick",columnWidth:parseInt(c.columnWidth,10)||c.columnWidth},e||{});b.masonry(f),a.masonryContainer=b[0];var g=a.$eval(c.loadImages);d.loadImages=g!==!1;var h=a.$eval(c.preserveOrder);d.preserveOrder=h!==!1&&void 0!==c.preserveOrder;var i=a.$eval(c.reloadOnShow);i!==!1&&void 0!==c.reloadOnShow&&a.$watch(function(){return b.prop("offsetParent")},function(a,b){a&&!b&&d.reload()});var j=a.$eval(c.reloadOnResize);j!==!1&&void 0!==c.reloadOnResize&&a.$watch("masonryContainer.offsetWidth",function(a,b){a!=b&&d.reload()}),a.$emit("masonry.created",b),a.$on("$destroy",d.destroy)}}}}).directive("masonryBrick",function(){return{restrict:"AC",require:"^masonry",scope:!0,link:{pre:function(a,b,c,d){var e,f=a.$id;d.appendBrick(b,f),b.on("$destroy",function(){d.removeBrick(f,b)}),a.$on("masonry.reload",function(){d.scheduleMasonryOnce("reloadItems"),d.scheduleMasonryOnce("layout")}),a.$watch("$index",function(){void 0!==e&&e!==a.$index&&(d.scheduleMasonryOnce("reloadItems"),d.scheduleMasonryOnce("layout")),e=a.$index})}}}})}(); | ||
!function(){"use strict";angular.module("wu.masonry",[]).controller("MasonryCtrl",["$scope","$element","$timeout",function(a,b,c){function d(a){a.addClass("loaded")}var e={},f=[],g=!1,h=this,i=null;this.preserveOrder=!1,this.loadImages=!0,this.scheduleMasonryOnce=function(){var a=arguments,b=f.filter(function(b){return b[0]===a[0]}).length>0;b||this.scheduleMasonry.apply(null,arguments)}, | ||
// Make sure it's only executed once within a reasonable time-frame in | ||
// case multiple elements are removed or added at once. | ||
this.scheduleMasonry=function(){i&&c.cancel(i),f.push([].slice.call(arguments)),i=c(function(){g||(f.forEach(function(a){b.masonry.apply(b,a)}),f=[])},30)},this.addBrick=function(a,c,f){function i(){0===Object.keys(e).length&&b.masonry("resize"),void 0===e[f]&&( | ||
// Keep track of added elements. | ||
e[f]=!0,d(c),b.masonry(a,c,!0))}function j(){ | ||
// I wanted to make this dynamic but ran into huuuge memory leaks | ||
// that I couldn't fix. If you know how to dynamically add a | ||
// callback so one could say <masonry loaded="callback($element)"> | ||
// please submit a pull request! | ||
h.scheduleMasonryOnce("layout")}g||(h.loadImages?h.preserveOrder?(i(),c.imagesLoaded(j)):c.imagesLoaded(function(){i(),j()}):(i(),j()))},this.removeBrick=function(a,c){g||(delete e[a],b.masonry("remove",c),this.scheduleMasonryOnce("layout"))},this.destroy=function(){g=!0,b.data("masonry")&&b.masonry("destroy"),a.$emit("masonry.destroyed"),e={}},this.reload=function(){b.masonry(),a.$emit("masonry.reloaded")}}]).directive("masonry",function(){return{restrict:"AE",controller:"MasonryCtrl",link:{pre:function(a,b,c,d){var e=a.$eval(c.masonry||c.masonryOptions),f=angular.extend({itemSelector:c.itemSelector||".masonry-brick",columnWidth:parseInt(c.columnWidth,10)||c.columnWidth},e||{});b.masonry(f),a.masonryContainer=b[0];var g=a.$eval(c.loadImages);d.loadImages=g!==!1;var h=a.$eval(c.preserveOrder);d.preserveOrder=h!==!1&&void 0!==c.preserveOrder;var i=a.$eval(c.reloadOnShow);i!==!1&&void 0!==c.reloadOnShow&&a.$watch(function(){return b.prop("offsetParent")},function(a,b){a&&!b&&d.reload()});var j=a.$eval(c.reloadOnResize);j!==!1&&void 0!==c.reloadOnResize&&a.$watch("masonryContainer.offsetWidth",function(a,b){a!=b&&d.reload()}),a.$emit("masonry.created",b),a.$on("$destroy",d.destroy)}}}}).directive("masonryBrick",function(){return{restrict:"AC",require:"^masonry",scope:!0,link:{pre:function(a,b,c,d){var e,f=a.$id,g=a.$eval(c.prepend),h=g?"prepended":"appended";d.addBrick(h,b,f),b.on("$destroy",function(){d.removeBrick(f,b)}),a.$on("masonry.reload",function(){d.scheduleMasonryOnce("reloadItems"),d.scheduleMasonryOnce("layout")}),a.$watch("$index",function(){void 0!==e&&e!==a.$index&&(d.scheduleMasonryOnce("reloadItems"),d.scheduleMasonryOnce("layout")),e=a.$index})}}}})}(); |
{ | ||
"name": "angular-masonry", | ||
"description": "An AngularJS directive for Masonry.", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"main": "./angular-masonry.js", | ||
@@ -19,7 +19,7 @@ "ignore": [ | ||
"dependencies": { | ||
"masonry": "~3.3.0", | ||
"masonry": "~4.0.0", | ||
"angular": "^1.3.0", | ||
"jquery": "~2.1.0", | ||
"imagesloaded": "~3.1.0", | ||
"jquery-bridget": "~1.1.0" | ||
"imagesloaded": "~4.1.0", | ||
"jquery-bridget": "~2.0.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
@@ -0,1 +1,18 @@ | ||
<a name="0.15.0"></a> | ||
# [0.15.0](https://github.com/passy/angular-masonry/compare/v0.14.1...v0.15.0) (2016-01-23) | ||
### Features | ||
* **deps:** masonry v4, imagesloaded v4 ([81ec0dc](https://github.com/passy/angular-masonry/commit/81ec0dc)) | ||
<a name="0.14.1"></a> | ||
# [0.14.1](https://github.com/passy/angular-masonry/compare/v0.14.0...v0.14.1) (2015-09-09) | ||
### Bug Fixes | ||
* **dist:** fix missing build artifacts | ||
<a name="0.14.0"></a> | ||
@@ -2,0 +19,0 @@ # [0.14.0](https://github.com/passy/angular-masonry/compare/v0.13.0...v0.14.0) (2015-12-03) |
{ | ||
"name": "angular-masonry", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"main": "angular-masonry.js", | ||
@@ -10,5 +10,5 @@ "devDependencies": { | ||
"grunt-contrib-connect": "^0.11.2", | ||
"grunt-contrib-uglify": "^0.9.1", | ||
"grunt-contrib-uglify": "^0.11.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-conventional-changelog": "^4.1.0", | ||
"grunt-conventional-changelog": "^5.0.0", | ||
"grunt-karma": "^0.12.0", | ||
@@ -30,6 +30,6 @@ "grunt-ngmin": "0.0.3", | ||
"angular": "^1.4.1", | ||
"imagesloaded": "^3.1.8", | ||
"jquery-bridget": "^1.1.0", | ||
"masonry-layout": "^3.3.0" | ||
"imagesloaded": "^4.1.0", | ||
"jquery-bridget": "^2.0.0", | ||
"masonry-layout": "^4.0.0" | ||
} | ||
} |
@@ -14,42 +14,16 @@ # AngularJS Masonry Directive [![Build Status](https://travis-ci.org/passy/angular-masonry.png)](https://travis-ci.org/passy/angular-masonry) [![Dependency Status](https://gemnasium.com/passy/angular-masonry.png)](https://gemnasium.com/passy/angular-masonry) [![Code Climate](https://codeclimate.com/github/passy/angular-masonry.png)](https://codeclimate.com/github/passy/angular-masonry) | ||
3. Include dependencies in your HTML. | ||
1. When using bower: | ||
```html | ||
<script src="bower_components/jquery/dist/jquery.js"></script> | ||
<script src="bower_components/jquery-bridget/jquery.bridget.js"></script> | ||
<script src="bower_components/get-style-property/get-style-property.js"></script> | ||
<script src="bower_components/get-size/get-size.js"></script> | ||
<script src="bower_components/eventEmitter/EventEmitter.js"></script> | ||
<script src="bower_components/eventie/eventie.js"></script> | ||
<script src="bower_components/doc-ready/doc-ready.js"></script> | ||
<script src="bower_components/matches-selector/matches-selector.js"></script> | ||
<script src="bower_components/fizzy-ui-utils/utils.js"></script> | ||
<script src="bower_components/outlayer/item.js"></script> | ||
<script src="bower_components/outlayer/outlayer.js"></script> | ||
<script src="bower_components/masonry/masonry.js"></script> | ||
<script src="bower_components/imagesloaded/imagesloaded.js"></script> | ||
<script src="bower_components/angular/angular.js"></script> | ||
<script src="bower_components/angular-masonry/angular-masonry.js"></script> | ||
``` | ||
```html | ||
<script src="bower_components/jquery/dist/jquery.js"></script> | ||
<script src="bower_components/jquery-bridget/jquery-bridget.js"></script> | ||
<script src="bower_components/ev-emitter/ev-emitter.js"></script> | ||
<script src="bower_components/desandro-matches-selector/matches-selector.js"></script> | ||
<script src="bower_components/fizzy-ui-utils/utils.js"></script> | ||
<script src="bower_components/outlayer/item.js"></script> | ||
<script src="bower_components/outlayer/outlayer.js"></script> | ||
<script src="bower_components/masonry/masonry.js"></script> | ||
<script src="bower_components/imagesloaded/imagesloaded.js"></script> | ||
<script src="bower_components/angular/angular.js"></script> | ||
<script src="bower_components/angular-masonry/angular-masonry.js"></script> | ||
``` | ||
2. When using npm: | ||
```html | ||
<script src="node_modules/jquery/dist/jquery.js"></script> | ||
<script src="node_modules/jquery-bridget/jquery.bridget.js"></script> | ||
<script src="node_modules/desandro-get-style-property/get-style-property.js"></script> | ||
<script src="node_modules/get-size/get-size.js"></script> | ||
<script src="node_modules/wolfy87-eventemitter/EventEmitter.js"></script> | ||
<script src="node_modules/eventie/eventie.js"></script> | ||
<script src="node_modules/doc-ready/doc-ready.js"></script> | ||
<script src="node_modules/desandro-matches-selector/matches-selector.js"></script> | ||
<script src="node_modules/fizzy-ui-utils/utils.js"></script> | ||
<script src="node_modules/outlayer/item.js"></script> | ||
<script src="node_modules/outlayer/outlayer.js"></script> | ||
<script src="node_modules/masonry-layout/masonry.js"></script> | ||
<script src="node_modules/imagesloaded/imagesloaded.js"></script> | ||
<script src="node_modules/angular/angular.js"></script> | ||
<script src="node_modules/angular-masonry/angular-masonry.js"></script> | ||
``` | ||
4. Use the `masonry` directive. | ||
@@ -56,0 +30,0 @@ |
/*! | ||
* angular-masonry <%= pkg.version %> | ||
* Pascal Hartig, weluse GmbH, http://weluse.de/ | ||
* Pascal Hartig, https://passy.me/ | ||
* License: MIT | ||
@@ -5,0 +5,0 @@ */ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
522
48413
16
205
+ Addeddesandro-matches-selector@2.0.2(transitive)
+ Addedev-emitter@1.1.1(transitive)
+ Addedfizzy-ui-utils@2.0.7(transitive)
+ Addedget-size@2.0.3(transitive)
+ Addedimagesloaded@4.1.4(transitive)
+ Addedjquery@3.7.1(transitive)
+ Addedjquery-bridget@2.0.1(transitive)
+ Addedmasonry-layout@4.2.2(transitive)
+ Addedoutlayer@2.1.1(transitive)
- Removeddesandro-get-style-property@1.0.4(transitive)
- Removeddesandro-matches-selector@1.0.3(transitive)
- Removeddoc-ready@1.0.4(transitive)
- Removedeventie@1.0.6(transitive)
- Removedfizzy-ui-utils@1.0.1(transitive)
- Removedget-size@1.2.2(transitive)
- Removedimagesloaded@3.2.0(transitive)
- Removedjquery@2.2.4(transitive)
- Removedjquery-bridget@1.1.0(transitive)
- Removedmasonry-layout@3.3.2(transitive)
- Removedoutlayer@1.4.2(transitive)
- Removedwolfy87-eventemitter@4.3.0(transitive)
Updatedimagesloaded@^4.1.0
Updatedjquery-bridget@^2.0.0
Updatedmasonry-layout@^4.0.0