Permalink
Browse files

Add handler for quora.com

 * In response to http://www.quora.com/Why-hasnt-anyone-created-a-handler-to-use-Firesheep-on-Quora
 * This needs to be tested, I'm currently in a strange network and haven't done a real test of this yet.
  • Loading branch information...
1 parent 80d47b2 commit ddb21c3c2ab5764df37d158a57686ae7e5e7448b @craSH committed Jul 7, 2011
Showing with 30 additions and 0 deletions.
  1. +30 −0 xpi/handlers/quora.js
View
@@ -0,0 +1,30 @@
+// Authors:
+// Ian Gallagher
+register({
+ name: 'Quora',
+ domains: [ 'www.quora.com' ],
+ siteUrl: 'http://www.quora.com',
+ sessionCookieNames: [ 'm-s', 'm-b' ],
+
+ identifyUser: function () {
+ // Grab the user name from the header menu
+ var resp = this.httpGet(this.siteUrl);
+ var profile_link = resp.body.querySelector(".profile .nav_item");
+ this.userName = profile_link.innerHTML;
+
+ // Grab about page to get the profile photo if it exists
+ var profile_url = profile_link.href;
+ var avatar_element;
+ try {
+ var profile = this.httpGet(profile_url);
+ avatar_element = profile.body.querySelector(".profile_photo .profile_photo_img").src;
+ }
+ catch(err) {
+ // They likley don't have a profile setup, no avatar for us :(
+ avatar_element = null;
+ }
+ if (avatar_element) {
+ this.userAvatar = avatar_element;
+ }
+ }
+});

0 comments on commit ddb21c3

Please sign in to comment.