diff --git a/.meteor/packages b/.meteor/packages index 191b55934..bb050bd6e 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -12,5 +12,4 @@ router moment spiderable email -profiler database-forms \ No newline at end of file diff --git a/client/css/screen.css b/client/css/screen.css index 04bfcad93..c4510b12f 100644 --- a/client/css/screen.css +++ b/client/css/screen.css @@ -829,7 +829,7 @@ body.pageslide-open { position: relative; } /* line 7, ../sass/modules/_posts.scss */ .posts .post { - position: absolute; + position: relative; width: 100%; /* For modern browsers */ /* For IE 6/7 (trigger hasLayout) */ diff --git a/client/sass/modules/_posts.scss b/client/sass/modules/_posts.scss index 042bcf4b3..bc2c1ecf2 100644 --- a/client/sass/modules/_posts.scss +++ b/client/sass/modules/_posts.scss @@ -5,7 +5,7 @@ .posts{ position:relative; .post{ - position:absolute; + position:relative; width:100%; @include cf; &.animate{ diff --git a/client/views/posts/post_item.js b/client/views/posts/post_item.js index c1c308733..4c0fbaf3e 100644 --- a/client/views/posts/post_item.js +++ b/client/views/posts/post_item.js @@ -60,33 +60,28 @@ Template.post_item.helpers({ }); Template.post_item.rendered = function(){ - var self = this; - var rank = self.data._rank; - var $this = $(this.find(".post")); - - if(self.data){ - var distanceFromTop= 0; - for(var i=1; i<=rank; i++){ - distanceFromTop+= $('.post-'+i).height(); - } - - // if this is the first rendering, just go straight to the correct spot, - // and don't animate our way there. - if (_.isUndefined(self.current_distance)) { - self.current_distance = distanceFromTop; - $this.css("top", self.current_distance + "px"); - - // otherwise, stay in the old spot, but once the browser has rendered - // us there, animate to a new spot - } else { - $this.css("top", self.current_distance + "px"); - - Meteor.defer(function() { - self.current_distance = distanceFromTop; - $this.addClass('animate').css("top", self.current_distance + "px"); - }); - } + // animate post from previous position to new position + var instance = this; + var rank = instance.data._rank; + var $this = $(this.firstNode); + var previousPosition = 0; + var newPosition = 0; + for(var i=1; i<=rank; i++){ + newPosition += $('.post-'+i).height(); } + + // if element has a currentPosition (i.e. it's not the first ever render) + if(previousPosition = instance.currentPosition){ + // calculate difference between old position and new position and send element there + var delta = previousPosition - newPosition; + $this.css("top", delta + "px"); + } + + Meteor.defer(function() { + instance.currentPosition = newPosition; + // bring element back to its new original position + $this.addClass('animate').css("top", "0px"); + }); }; Template.post_item.events = { diff --git a/server/users.js b/server/users.js index 4ad247f00..efae230d7 100644 --- a/server/users.js +++ b/server/users.js @@ -55,8 +55,8 @@ Meteor.methods({ }); // permissions for the profiler -Meteor.Profiler.allow = function(userId) { - var user = Meteor.users.findOne(userId); - return user && user.isAdmin; -}; +// Meteor.Profiler.allow = function(userId) { +// var user = Meteor.users.findOne(userId); +// return user && user.isAdmin; +// }; diff --git a/smart.json b/smart.json index 2c37aa419..58feb83e3 100644 --- a/smart.json +++ b/smart.json @@ -3,7 +3,6 @@ "packages": { "router": {}, "moment": {}, - "profiler": {"git": "https://github.com/tmeasday/meteor-profiler.git"}, "database-forms": {} } } diff --git a/smart.lock b/smart.lock index 6ebacee8c..e23bc1d60 100644 --- a/smart.lock +++ b/smart.lock @@ -2,16 +2,12 @@ "meteor": { "git": "https://github.com/meteor/meteor.git", "branch": "master", - "commit": "471f661c5b32bf66746077defbbac8b2b26046c6" + "commit": "f07715dc70de16a7aab84e56ab0c6cbd9c1f9dc6" }, "dependencies": { "basePackages": { "router": {}, "moment": {}, - "profiler": { - "git": "https://github.com/tmeasday/meteor-profiler.git", - "branch": "master" - }, "database-forms": {} }, "packages": { @@ -25,11 +21,6 @@ "tag": "v1.7.0", "commit": "c64b6ec0e714b9556f4b6643d430b868ba69d3d7" }, - "profiler": { - "git": "https://github.com/tmeasday/meteor-profiler.git", - "branch": "master", - "commit": "25a14a4e94a4748745738031baab1400860eede7" - }, "database-forms": { "git": "https://github.com/lyudmil/database-forms.git", "tag": "v0.0.2", @@ -39,11 +30,6 @@ "git": "https://github.com/tmeasday/meteor-page-js-ie-support.git", "tag": "v1.3.5", "commit": "b99ed8380aefd10b2afc8f18d9eed4dd0d8ea9cb" - }, - "node-modules": { - "git": "https://github.com/possibilities/meteor-node-modules.git", - "tag": "v0.0.5", - "commit": "d502e5091759073a6baed856fadd93012749842d" } } }