/* Copyright (c) 2010, Diaspora Inc. This file is * licensed under the Affero General Public License version 3 or later. See * the COPYRIGHT file. */ var Stream = { selector: "#main_stream", initialize: function() { //Diaspora.page.timeAgo.updateTimeAgo(); // this is not needed because // we do this in both streamelement // and comment widgets Diaspora.page.directionDetector.updateBinds(); //audio links Stream.setUpAudioLinks(); }, initializeLives: function(){ // reshare button action $(".reshare_button", this.selector).live("click", function(evt) { evt.preventDefault(); var button = $(this), box = button.siblings(".reshare_box"); if (box.length > 0) { button.toggleClass("active"); box.toggle(); } }); // ajax-loader and hide icon visibility handling for post hide and unhide $("a.stream_element_delete.vis_hide").live("click", function(evt){ $(this).toggleClass("hidden"); $(this).next("img.hide_loader").toggleClass("hidden"); }); $("a.stream_element_hide_undo").live("click", function(evt){ $(this).closest('.stream_element').find("img.hide_loader").toggleClass("hidden"); }); // this.setUpComments(); }, setUpComments: function(){ // comment link form focus $(".focus_comment_textarea", this.selector).live('click', function(evt) { Stream.focusNewComment($(this), evt); }); $("textarea.comment_box", this.selector).live("focus", function(evt) { if (this.value === undefined || this.value === ''){ var commentBox = $(this); commentBox .parent().parent() .addClass("open"); } }); $("textarea.comment_box", this.selector).live("blur", function(evt) { if (this.value === undefined || this.value === ''){ var commentBox = $(this); commentBox .parent().parent() .removeClass("open"); } }); }, setUpAudioLinks: function() { $(".stream a[target='_blank']").each(function(r){ var link = $(this); if(this.href.match(/\.mp3$|\.ogg$/)) { $("