// JavaScript Document var socialLink = new Array(); socialLink['facebook'] = 'http://www.facebook.com/'; socialLink['twitter'] = 'http://www.twitter.com/'; socialLink['hyves'] = '.hyves.nl/'; var socialAccount = new Array(); socialAccount['facebook'] = 'kortingisleuk'; socialAccount['twitter'] = 'kortingisleuk'; socialAccount['hyves'] = 'korting-is-leuk'; var date = new Date; // Generic JS date object var unixtime_ms = date.getTime(); // Returns milliseconds since the epoch var unixtime = parseInt(unixtime_ms / 1000); $(document).ready(function() { if($('div.socialCounter').length > 0) { var aTotal = $('div.socialCounter a').length - 1; for (iLoop = 0; iLoop <= aTotal; iLoop++) { var className = $('div.socialCounter a:eq('+ iLoop +')').attr('class'); if(className == 'facebook') { $.ajax({ type: "GET", url: 'https://graph.facebook.com/'+ socialAccount['facebook'], dataType: "jsonp", jsonpCallback: "loadFB" }); } if(className == 'twitter') { $.getJSON('https://api.twitter.com/1/users/show.json?callback=?&screen_name='+socialAccount['twitter'], function(json) { $("div.socialCounter a.twitter").append(''+json.followers_count+''); }); } if(className == 'hyves') { $.ajax({ type: "GET", //url: "https://data.hyves-api.nl/?oauth_consumer_key=MTAxNzRfZhyPk_80IGuOx6KMfkDUZg%3D%3D&oauth_timestamp="+unixtime+"&oauth_version=1.0&oauth_signature_method=PLAINTEXT&ha_version=2.1&ha_format=json&ha_method=hubs.get&oauth_token=YXRfMjgxNDk3NDE0X8HR-9CmJHaNaFbH5y-wzg8%3D&hubid=00c6e13498d2a346208c5ed2c6b681ce9f&oauth_signature=MTAxNzRfO-l3r5GskxTWJNMpULbCCg%253D%253D%269KE88jIHD2SUM-1KKIsJJw%253D%253D&ha_callback=loadHyves", url: "https://data.hyves-api.nl/?oauth_consumer_key=MTAxNzRfZhyPk_80IGuOx6KMfkDUZg%3D%3D&oauth_timestamp="+unixtime+"&oauth_version=1.0&oauth_signature_method=PLAINTEXT&ha_version=2.1&ha_format=json&ha_method=hubs.get&hubid=00c6e13498d2a346208c5ed2c6b681ce9f&oauth_signature=MTAxNzRfO-l3r5GskxTWJNMpULbCCg%253D%253D%26&ha_callback=loadHyves", dataType: "jsonp" }); } } } }); function loadHyves(json){ $("div.socialCounter a.hyves").append(''+json.hub[0].userscount+'') } function loadFB(json){ $("div.socialCounter a.facebook").append(''+json.likes+''); }