Last active
April 20, 2017 17:31
-
-
Save mattes/5253271 to your computer and use it in GitHub Desktop.
print skype status
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
<!DOCTYPE html> | |
<head> | |
<title>Skype Status</title> | |
</head> | |
<body> | |
<h1>Return Skype Status</h1> | |
<p>return skype status (requires the skype privacy setting set to true)<br> | |
using Open Data tables with YQL (<a href="http://www.datatables.org/">www.datatables.org</a>)</p> | |
<p>Offline (1), Online (2), Away (3), Do not disturb (3)</p> | |
<p><span id="user"></span> <span id="status">Loading ...</span></p> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
var getSkypeStatus = function(user, callback) { | |
if(!user) throw new Error('missing user'); | |
var query = 'select * from skype.user.status where user="' + user + '";'; | |
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=' + encodeURI(query + '&format=json&env=store://datatables.org/alltableswithkeys&callback=?'), | |
function(data){ | |
if(data.query.count > 0) { | |
if(callback) return callback.call(null, data.query.results.result); | |
} else { | |
if(callback) return callback.call(null, false); | |
} | |
}); | |
} | |
var user = 'mkadenbach'; | |
$('#user').html(user + 's skype status:'); | |
getSkypeStatus(user, function(status){ | |
if(status) { | |
$('#status').html(status.message.en + ' (' + status.status + ')'); | |
} else { | |
$('#status').html('unable to load status'); | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear developer, your code does not work. Please take a look again. It's not cool for you to have wrong codes on github, people all over the world are eyeing our codes, and many of them are looking for people for possible hiring.