Skip to content
Browse files

Updated foursquare and pivotal tracker handlers. Added posterous hand…

…ler.
  • Loading branch information...
1 parent 4a415b6 commit 1733122c684731f86676717599ef70ded0f2a562 @codebutler committed Feb 13, 2011
Showing with 33 additions and 11 deletions.
  1. +2 −7 xpi/handlers/foursquare.js
  2. +4 −4 xpi/handlers/pivotal.js
  3. +27 −0 xpi/handlers/posterous.js
View
9 xpi/handlers/foursquare.js
@@ -19,12 +19,7 @@ register({
// Maybe this is useful for something in the future..?
this.userId = userId;
- // Get image object for user avatar (contains their name, too!)
- var user_img = resp.body.querySelector('.withImage img');
- this.userName = user_img.alt;
- this.userAvatar = user_img.src;
- if (this.userAvatar.substr(0, 4) != 'http') {
- this.userAvatar = 'http://foursquare.com/' + this.userAvatar;
- }
+ this.userName = resp.body.querySelector('#personDetail h2 a').textContent;
+ this.userAvatar = resp.body.querySelector('#personDetail img').src;
},
});
View
8 xpi/handlers/pivotal.js
@@ -3,22 +3,22 @@
register({
name: 'Pivotal Tracker',
url: 'http://www.pivotaltracker.com/dashboard',
- sessionCookieNames: [ '_myapp_session' ],
+ sessionCookieNames: [ 'tracker_session' ],
domains: [ 'pivotaltracker.com' ],
processPacket: function () {
- var cookie = this.firstPacket.cookies['_myapp_session'];
+ var cookie = this.firstPacket.cookies['tracker_session'];
var railsSession = RailsHelper.parseSessionCookie(cookie);
if (!railsSession.signin_person_id) {
this.sessionId = null;
return;
}
this.sessionId = railsSession.session_id;
- this.firstPacket._myapp_session = railsSession;
+ this.firstPacket.tracker_session = railsSession;
},
identifyUser: function () {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelector('.welcome_message').textContent.replace('Welcome,', '').trim();
}
-});
+});
View
27 xpi/handlers/posterous.js
@@ -0,0 +1,27 @@
+// Authors:
+// Eric Butler <eric@codebutler.com>
+
+register({
+ name: 'Posterous',
+
+ matchPacket: function (packet) {
+ if (packet.cookies['_sharebymail_session_id'] && packet.cookies['posterous_mp']) {
+ var data = JSON.parse(unescape(packet.cookies['posterous_mp']));
+ return data.all && data.all.registered == "true";
+ }
+ return false;
+ },
+
+ processPacket: function () {
+ this.sessionId = this.firstPacket.cookies['_sharebymail_session_id'];
+ },
+
+ identifyUser: function () {
+ var resp = this.httpGet('http://posterous.com/manage/settings/contact');
+ var firstName = resp.body.querySelector('#user_firstname').value;
+ var lastName = resp.body.querySelector('#user_lastname').value;
+
+ this.userName = firstName + ' ' + lastName;
+ this.userAvatar = resp.body.querySelector('img[alt="user photo"]').src;
+ }
+});

0 comments on commit 1733122

Please sign in to comment.
Something went wrong with that request. Please try again.