Sha256: c06b1ed719ae0bd848f74f8ea1ac5a003b0247280e648e62a9864aee97a96527

Contents?: true

Size: 1.92 KB

Versions: 12

Compression:

Stored size: 1.92 KB

Contents

SocialStream.Timeline = (function(SS, $, undefined){
	var initCallbacks = [];

	var addInitCallback = function(callback){
		initCallbacks.push(callback);
	}

	var init = function(){
		$.each(initCallbacks, function(i, callback){ callback(); });
	}

	var initPrivacyTooltips = function(activityId) {
		var fullId = '.activity_audience';
		var summaryId = '.activity_audience_summary';

		if (activityId != undefined) {
			fullId = '#' + activityId + ' ' + fullId;
			summaryId = '#' + activityId + ' ' + summaryId;
		}

		$(fullId).hide();
		$(summaryId).tipsy({
			html: true,
			title: function(){
				return $(this).siblings('.activity_audience').html();
			}
		});
	};

	var initComments = function(){
		//if there are 4 or more commments we only show the last 2 and a link to show the rest
		$("#wall .activity_comments").each(function(){
			var comments = $(this).children(".subactivity");  	
			//check if there are more than 3 comments
			if (comments.size() > 3){
				$(this).prepend("<div class='hide_show_comments'><a href='#' onclick='SocialStream.Timeline.showAllComments(\""+ 
					$(this).attr('id') +"\"); return false;'>" + I18n.t('comment.view_all') + "(" +
					comments.size() + ")</a></div><div class='space_comments'></div>");
				comments.slice(0,comments.size()-2).hide();
				//hide alto space_comments
				$(this).children(".space_comments").slice(0,comments.size()-2).hide();
			}
		});

	}

	var showAllComments = function(id){
		$("#"+id).children().show();
		//and hide the hide_show_comments
		$("#"+id).children(".hide_show_comments").hide();
	};


	var newActivity = function(activityId){
		initPrivacyTooltips(activityId);
		SS.Wall.unblockForms();
	}

	addInitCallback(initPrivacyTooltips);
	addInitCallback(initComments);

	return {
		addInitCallback: addInitCallback,
		init: init,
		initPrivacyTooltips: initPrivacyTooltips,
		showAllComments: showAllComments,
                newActivity: newActivity
	};
}) (SocialStream, jQuery);

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
social_stream-0.24.1 base/app/assets/javascripts/social_stream.timeline.js
social_stream-base-0.18.1 app/assets/javascripts/social_stream.timeline.js
social_stream-0.24.0 base/app/assets/javascripts/social_stream.timeline.js
social_stream-base-0.18.0 app/assets/javascripts/social_stream.timeline.js
social_stream-0.23.4 base/app/assets/javascripts/social_stream.timeline.js
social_stream-base-0.17.3 app/assets/javascripts/social_stream.timeline.js
social_stream-0.23.3 base/app/assets/javascripts/social_stream.timeline.js
social_stream-base-0.17.2 app/assets/javascripts/social_stream.timeline.js
social_stream-0.23.2 base/app/assets/javascripts/social_stream.timeline.js
social_stream-base-0.17.1 app/assets/javascripts/social_stream.timeline.js
social_stream-0.23.1 base/app/assets/javascripts/social_stream.timeline.js
social_stream-base-0.17.0 app/assets/javascripts/social_stream.timeline.js