Skip to content

Commit

Permalink
Merge remote branch 'crash/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
codebutler committed Oct 18, 2010
2 parents 155f904 + c7d157e commit 85e096d
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
18 changes: 18 additions & 0 deletions xpi/handlers/dropbox.js
@@ -0,0 +1,18 @@
// Authors:
// Ian Gallagher <crash@neg9.org>
// Dropbox seems to have recently started issuing cookies with the Secure flag set,
// so this handler will not be too useful. But for people who have login sessions
// more than a few weeks old at the time of it's writing, or just something odd that
// happens, it will work.

register({
name: 'Dropbox',
url: 'https://www.dropbox.com/home#:::',
domains: [ 'dropbox.com' ],
sessionCookieNames: [ 'lid' ],

identifyUser: function () {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelector("#topnav strong").textContent;
}
});
13 changes: 13 additions & 0 deletions xpi/handlers/evernote.js
@@ -0,0 +1,13 @@
// Authors:
// Ian Gallagher <crash@neg9.org>
register({
name: 'Evernote',
url: 'https://www.evernote.com/Home.action',
domains: [ 'evernote.com' ],
sessionCookieNames: [ 'auth' ],

identifyUser: function () {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelectorAll("#nav td")[2].textContent.match(/Sign out \((.*)\).*/)[1];
}
});
13 changes: 9 additions & 4 deletions xpi/handlers/foursquare.js
Expand Up @@ -2,6 +2,7 @@
// Eric Butler <eric@codebutler.com>
register({
name: 'Foursquare',
url: 'http://foursquare.com/',
domains: [ 'foursquare.com' ],
sessionCookieNames: [ 'ext_id', 'XSESSIONID' ],

Expand All @@ -11,15 +12,19 @@ register({
},

identifyUser: function () {
var resp = this.httpGet('http://foursquare.com/user');
var resp = this.httpGet(this.siteUrl);
var path = resp.request.channel.URI.path;
var userId = path.split('/')[2];

// Maybe this is useful for something in the future..?
this.userId = userId;
this.userName = resp.body.querySelectorAll('.withImage a')[1].innerHTML
this.userAvatar = resp.body.querySelector('.withImage img').src;

// 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;
}
},
});
});
13 changes: 12 additions & 1 deletion xpi/handlers/google.js
Expand Up @@ -13,6 +13,17 @@ register({

identifyUser: function() {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelectorAll(".gb4")[0].textContent;
this.userName = resp.body.querySelector(".gb4").textContent;

// Grab avatar from Google Profiles page, if they have one
var profile = this.httpGet('http://www.google.com/profiles/me');
var avatar_element = profile.body.querySelector('.ll_profilephoto.photo');

if (avatar_element) {
this.userAvatar = avatar_element.src;
if (this.userAvatar.substr(0, 4) != 'http') {
this.userAvatar = 'http://www.google.com' + this.userAvatar;
}
}
}
});
13 changes: 13 additions & 0 deletions xpi/handlers/slicemanager.js
@@ -0,0 +1,13 @@
// Authors:
// Ian Gallagher <crash@neg9.org>
register({
name: 'Slicehost SliceManager',
url: 'https://manage.slicehost.com/slices',
domains: [ 'manage.slicehost.com' ],
sessionCookieNames: [ '_coach_session_id' ],

identifyUser: function () {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelector("#welcome a").textContent;
}
});

0 comments on commit 85e096d

Please sign in to comment.