Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

117 lines (103 sloc) 3.775 kb
<html>
<head>
<script src="/javascripts/3dparty/jsOAuth-1.3.1/jsOAuth.min.js"></script>
<script src="/javascripts/twitter/init.js"></script>
<script src="/javascripts/twitter/timeline.js"></script>
<script src="/javascripts/fowl/storage.js"></script>
<script src="/javascripts/fowl/pubsub.js"></script>
<script src="/javascripts/fowl/timeline.js"></script>
<script src="/javascripts/fowl/init.js"></script>
<script>
function storeCredentials( aScreenName, aUserId, accessTokenKey, accessTokenSecret, consumerKey, consumerSecret ){
fowl.storage.set({
'screen_name': aScreenName,
'user_id': aUserId,
'access_token_key': accessTokenKey,
'access_token_secret': accessTokenSecret,
'consumer_key': consumerKey,
'consumer_secret': consumerSecret
});
}
function getCredentials(){
var credentials = {};
credentials.accessTokenKey = fowl.storage.get('access_token_key');
credentials.accessTokenSecret = fowl.storage.get('access_token_secret');
credentials.consumerKey = fowl.storage.get('consumer_key');
credentials.consumerSecret = fowl.storage.get('consumer_secret');
return credentials;
}
function getUserInfo(){
var userInfo = {};
userInfo.screenName = fowl.storage.get('screen_name');
userInfo.userId = fowl.storage.get('user_id');
return userInfo;
};
function init(){
var credentials = getCredentials();
if( !credentials.accessTokenKey ){
return;
}
fowl.pubsub.subscribe(fowl.timeline.EventType.HOME, function( status, tweets, firstChunk ){
var popup = chrome.extension.getViews({ type: 'popup' })[0],
homeTimeline = fowl.storage.get('home_timeline'),
homeTimelineNew = fowl.storage.get('home_timeline_new');
if( !homeTimelineNew ){
homeTimelineNew = [];
}
if( !firstChunk ){
homeTimelineNew = tweets.concat( homeTimelineNew );
fowl.storage.set('home_timeline_new', homeTimelineNew);
}
if( popup ){
popup.updateTimelineWithType( 'home', homeTimelineNew, true );
homeTimelineNew = [];
fowl.storage.set('home_timeline_new', homeTimelineNew);
}
// tweets.forEach(function( tweet ){
// console.group('TWEET');
// console.log(tweet.user.screen_name);
// console.log(tweet.text);
// console.groupEnd('TWEET');
// });
});
var params = {
consumerKey: credentials.consumerKey,
consumerSecret: credentials.consumerSecret,
accessTokenKey: credentials.accessTokenKey,
accessTokenSecret: credentials.accessTokenSecret
};
T.init(params, function(){
var timeline = fowl.storage.get('home_timeline') || [];
fowl.timeline.home.init( timeline );
fowl.timeline.home.fetch();
setInterval(function(){
fowl.timeline.home.fetch();
}, 60 * 1000);
});
}
init();
</script>
<!--
<script>
(function(){
if( !fowl.storage.get('access_token_key') ){
// show link to options page where user can authorize
}
else{
var params = {
consumerKey: fowl.storage.get('consumer_key'),
consumerSecret: fowl.storage.get('consumer_secret'),
accessTokenKey: fowl.storage.get('access_token_key'),
accessTokenSecret: fowl.storage.get('access_token_secret')
};
T.init(params, function(){
setTimeout(function(){
fowl.init();
}, 0);
});
}
})();
</script>
-->
</head>
</html>
Jump to Line
Something went wrong with that request. Please try again.