Permalink
Browse files

Update API to work with the new Notifications UI

  • Loading branch information...
1 parent e839ea2 commit 64bd35fe2a9bb7d7d845df227c1e673ace921389 @sindresorhus committed Aug 6, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 api.js
View
16 api.js
@@ -15,19 +15,19 @@
}();
window.gitHubNotifCount = function( callback ) {
- var NOTIFICATIONS_URL = 'https://github.com/inbox/notifications';
+ var NOTIFICATIONS_URL = 'https://github.com/notifications';
var tmp = document.createElement('div');
+
xhr( 'GET', NOTIFICATIONS_URL, function( data ) {
+ var countElem;
tmp.innerHTML = data;
- var notifElem = tmp.querySelector('#notifications');
- if ( notifElem ) {
- var countElem = notifElem.querySelector('.unread_count');
- var count = countElem ? countElem.textContent : '';
- callback( count );
+ countElem = tmp.querySelector('.big li:first-child .count');
+
+ if ( countElem ) {
+ callback( countElem.textContent !== '0' ? countElem.textContent : '' );
} else {
callback( false );
}
});
};
-
-})();
+})();

0 comments on commit 64bd35f

Please sign in to comment.