-
-
Save rashad612/3027859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] = localStorge['id'] || null; | |
if (localStorage['id'] !== initialValue) { | |
localStorage['id'] = id; | |
var 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