Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Commit

Permalink
Update API to work with the new Notifications UI
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 6, 2012
1 parent e839ea2 commit 64bd35f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api.js
Expand Up @@ -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.