Skip to content

Instantly share code, notes, and snippets.

@funkatron
Created September 20, 2010 01:37
Show Gist options
  • Save funkatron/587309 to your computer and use it in GitHub Desktop.
Save funkatron/587309 to your computer and use it in GitHub Desktop.
/* Edit this file to add your own functionality to Spaz */
/**
* Add some custom timeline filters
*
* There are five timeline filter objects:
* - Spaz.TimelineFilters.friends
* - Spaz.TimelineFilters['public']
* - Spaz.TimelineFilters.lists
* - Spaz.TimelineFilters.search
* - Spaz.TimelineFilters.other
*
* "other" is applied to all other timelines.
*
* We can use a filter to delete a timeline entry entirely by returning null
*
*/
Spaz.TimelineFilters.friends.addFilter('noTweetdeck', function(d) {
if (d.source && d.source.indexOf('TweetDeck') !== -1) { // if the source contains "TweetDeck", remove it
sch.debug('Removing '+d.id+' from results (TweetDeck)');
d = null;
}
return d;
});
Spaz.TimelineFilters.friends.addFilter('no4sq', function(d) {
if (d.text && d.text.toLowerCase().indexOf('http://4sq.com') !== -1) { // if a 4sq link is present, remove it
sch.debug('Removing '+d.id+' from results (4sq)');
d = null;
}
return d;
});
/**
* remove this default filter from these timelines -- we'll use embedly below
*/
Spaz.TimelineFilters.friends.removeFilter('getImageURLs');
Spaz.TimelineFilters.search.removeFilter('getImageURLs');
Spaz.TimelineFilters['public'].removeFilter('getImageURLs');
/**
* A helper to load media via embedly
*/
var embedly_listener = function(e) {
/*
loads media
*/
jQuery('div.timeline-entry.new div.status-text a').embedly({
maxWidth: 250,
maxHeight:300,
'method':'replace',
'wrapElement':'div',
'className':'embedly',
'embedly_wmode':'window'
}
);
};
/**
* add listeners to these hooks
*/
Spaz.Hooks.register('friends_timeline_data_success_finish', embedly_listener);
Spaz.Hooks.register('search_timeline_data_success_finish', embedly_listener);
Spaz.Hooks.register('public_timeline_data_success_finish', embedly_listener);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment