Skip to content

Instantly share code, notes, and snippets.

@alaahaytham
Created July 1, 2012 10:31
Show Gist options
  • Save alaahaytham/3027851 to your computer and use it in GitHub Desktop.
Save alaahaytham/3027851 to your computer and use it in GitHub Desktop.
function getUnreadItems() {
$.ajax({
url : "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=" + account + "&count=1",
dataType : "jsonp",
success: function(results) {
var id = results['0'].id;
var text = results['0'].text;
var initialValue = results['0'].id;
var avatar = results['0'].user.profile_image_url;
$('#avatar img').attr("src", avatar);
$('#tweet').text(text);
localStorge['id'] = results['0'].id;
if (id !== initialValue) {
var n
n = window.webkitNotifications.createNotification('', 'New Tweet', localStorage['text']);
n.show();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment