Advertisement
Guest User

Untitled

a guest
Feb 7th, 2015
1,196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. var social_labels = [
  2. 'Facebook',
  3. 'Google+',
  4. 'Facebook and Google+'];
  5.  
  6. function activate_icon(icon) {
  7. update_social(icon);
  8. //var icon = $('.cta_'+icon).addClass('active');
  9. };
  10. var f = g = false;
  11.  
  12. function update_social(icon) {
  13. var label = $('#yournetworks');
  14. if (icon == 'facebook') f = true;
  15. if (icon == 'gplus') g = true;
  16. if (f) label.text(social_labels[0]);
  17. if (g) label.text(social_labels[1]);
  18. if (f && g) label.text(social_labels[2]);
  19. };
  20.  
  21. jQuery(function() {
  22. setTimeout(function() {
  23. // google plus
  24. var gurl = 'https://plus.google.com/up/?continue=https://www.google.com/intl/en/images/logos/accounts_logo.png&type=st&gpsrc=ogpy0';
  25. var gimg = $('<img src="' + gurl + '" />').hide().appendTo('body').load(function() {
  26. activate_icon('gplus');
  27. });
  28.  
  29. // facebook
  30. var appId = '167052160169789'; // this needs to be set up!
  31. window.fbAsyncInit = function() {
  32. FB.init({
  33. appId: appId,
  34. status: true,
  35. cookie: true,
  36. xfbml: true
  37. });
  38. FB.getLoginStatus(function(response) {
  39. if (response.status != "unknown") activate_icon('facebook');
  40. });
  41. };
  42. // Load the SDK Asynchronously
  43. (function(d) {
  44. var js, id = 'facebook-jssdk';
  45. if (d.getElementById(id)) {
  46. return;
  47. }
  48. js = d.createElement('script');
  49. js.id = id;
  50. js.async = true;
  51. js.src = "//connect.facebook.net/en_US/all.js";
  52. d.getElementsByTagName('head')[0].appendChild(js);
  53. }(document));
  54.  
  55. }, 5000);
  56.  
  57. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement