Fix infieldLabels in infiniteScrolled comment forms. We were initing every widget twice?

This commit is contained in:
Raphael Sofaer 2011-04-07 18:19:13 -07:00
parent d7c4e15835
commit ea932c8706
4 changed files with 15 additions and 7 deletions

View file

@ -12,9 +12,6 @@ Diaspora.widgetCollection = function() {
Diaspora.widgetCollection.prototype.add = function(widgetId, widget) {
this[widgetId] = this.collection[widgetId] = new widget();
if(this.ready) {
this.collection[widgetId].start();
}
};
Diaspora.widgetCollection.prototype.remove = function(widgetId) {
@ -32,4 +29,4 @@ Diaspora.widgets = Diaspora.widgets || new Diaspora.widgetCollection();
$(document).ready(function() {
Diaspora.widgets.init();
});
});

View file

@ -16,8 +16,16 @@ var InfiniteScroll = {
loadingText: "",
loadingImg: '/images/ajax-loader.gif'
},
postScrollCallback: function(){},
postScrollCallback: function(){
for (var callback in InfiniteScroll.postScrollCallbacks){
InfiniteScroll.postScrollCallbacks[callback]();
}
},
postScrollCallbacks: [],
initialize: function(){
$('#main_stream').infinitescroll(InfiniteScroll.options, InfiniteScroll.postScrollCallback);
},
postScroll: function( callback ){
InfiniteScroll.postScrollCallbacks.push(callback);
}
}

View file

@ -18,6 +18,9 @@ var View = {
$(document).bind('afterReveal.facebox', function() {
jQuery("#facebox label").inFieldLabels();
});
InfiniteScroll.postScroll(function(){
$('#main_stream .comments label').inFieldLabels();
});
/* Showing debug messages */

View file

@ -9,9 +9,9 @@ Diaspora.widgets.add("timeago", function() {
this.selector = "abbr.timeago";
this.start = function() {
InfiniteScroll.postScrollCallback = function(){
InfiniteScroll.postScroll(function(){
Diaspora.widgets.timeago.updateTimeAgo();
}
});
if(Diaspora.widgets.i18n.language === "en") {
return;
}