make infscroll, publisher, stream use pub/sub to listen for the stream being reloaded, random cleanups and fix aspect-filters.js spec
This commit is contained in:
parent
296824c92b
commit
7ed21930b4
4 changed files with 10 additions and 13 deletions
|
|
@ -48,7 +48,7 @@ var AspectFilters = {
|
||||||
|
|
||||||
// select correct aspect in filter list & deselect others
|
// select correct aspect in filter list & deselect others
|
||||||
$("#aspect_nav li").removeClass('selected');
|
$("#aspect_nav li").removeClass('selected');
|
||||||
link.addClass('selected');
|
aspectLi.addClass('selected');
|
||||||
|
|
||||||
AspectFilters.fadeOut();
|
AspectFilters.fadeOut();
|
||||||
|
|
||||||
|
|
@ -168,14 +168,11 @@ var AspectFilters = {
|
||||||
for(var key in photos){
|
for(var key in photos){
|
||||||
$("#publisher textarea").addClass("with_attachments");
|
$("#publisher textarea").addClass("with_attachments");
|
||||||
photos_html = photos_html + "<li style='position:relative;'> " + ("<img src='" + photos[key] +"' data-id='" + key + "'>") + "</li>";
|
photos_html = photos_html + "<li style='position:relative;'> " + ("<img src='" + photos[key] +"' data-id='" + key + "'>") + "</li>";
|
||||||
};
|
}
|
||||||
|
|
||||||
// reinit listeners on stream
|
// reinit listeners on stream
|
||||||
photozone.html(photos_html);
|
photozone.html(photos_html);
|
||||||
Stream.initialize();
|
Diaspora.widgets.publish("stream/reloaded");
|
||||||
InfiniteScroll.initialize();
|
|
||||||
|
|
||||||
Publisher.initialize();
|
|
||||||
|
|
||||||
// fade contents back in
|
// fade contents back in
|
||||||
if(AspectFilters.requests == 0){
|
if(AspectFilters.requests == 0){
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,13 @@ var InfiniteScroll = {
|
||||||
},
|
},
|
||||||
postScrollCallbacks: [],
|
postScrollCallbacks: [],
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
|
Diaspora.widgets.subscribe("stream/reloaded", InfiniteScroll.initialize);
|
||||||
$('#main_stream').infinitescroll(InfiniteScroll.options, InfiniteScroll.postScrollCallback);
|
$('#main_stream').infinitescroll(InfiniteScroll.options, InfiniteScroll.postScrollCallback);
|
||||||
},
|
},
|
||||||
postScroll: function( callback ){
|
postScroll: function( callback ){
|
||||||
InfiniteScroll.postScrollCallbacks.push(callback);
|
InfiniteScroll.postScrollCallbacks.push(callback);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
InfiniteScroll.initialize();
|
InfiniteScroll.initialize();
|
||||||
|
|
|
||||||
|
|
@ -346,10 +346,7 @@ var Publisher = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
Publisher.cachedForm = false;
|
Diaspora.widgets.subscribe("stream/reloaded", Publisher.initialize);
|
||||||
Publisher.cachedInput = false;
|
|
||||||
Publisher.cachedHiddenInput = false;
|
|
||||||
Publisher.cachedSubmit = false;
|
|
||||||
|
|
||||||
Publisher.bindServiceIcons();
|
Publisher.bindServiceIcons();
|
||||||
Publisher.bindPublicIcon();
|
Publisher.bindPublicIcon();
|
||||||
|
|
@ -357,7 +354,7 @@ var Publisher = {
|
||||||
|
|
||||||
if ($("#status_message_fake_text").val() == "") {
|
if ($("#status_message_fake_text").val() == "") {
|
||||||
Publisher.close();
|
Publisher.close();
|
||||||
};
|
}
|
||||||
|
|
||||||
Publisher.autocompletion.initialize();
|
Publisher.autocompletion.initialize();
|
||||||
Publisher.hiddenInput().val(Publisher.input().val());
|
Publisher.hiddenInput().val(Publisher.input().val());
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,14 @@
|
||||||
var Stream = {
|
var Stream = {
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var $stream = $(".stream");
|
var $stream = $(".stream");
|
||||||
var $publisher = $("#publisher");
|
|
||||||
|
|
||||||
$(".status_message_delete").tipsy({trigger: 'hover', gravity: 'n'});
|
$(".status_message_delete").tipsy({trigger: 'hover', gravity: 'n'});
|
||||||
|
|
||||||
|
Diaspora.widgets.subscribe("stream/reloaded", Stream.initialized);
|
||||||
Diaspora.widgets.timeago.updateTimeAgo();
|
Diaspora.widgets.timeago.updateTimeAgo();
|
||||||
Diaspora.widgets.directionDetector.updateBinds();
|
Diaspora.widgets.directionDetector.updateBinds();
|
||||||
|
|
||||||
|
|
||||||
$stream.not(".show").delegate("a.show_post_comments", "click", Stream.toggleComments);
|
$stream.not(".show").delegate("a.show_post_comments", "click", Stream.toggleComments);
|
||||||
//audio linx
|
//audio linx
|
||||||
Stream.setUpAudioLinks();
|
Stream.setUpAudioLinks();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue