Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. bcr_url = window.location, facebook_share(bcr_url);
  2. twitter(bcr_url);
  3. linkedin(bcr_url);
  4. google(bcr_url);
  5. upon(bcr_url);
  6. pinterest(bcr_url);
  7. reddit(bcr_url);
  8.  
  9. function facebook_share(b) {
  10. $.ajax({
  11. url: 'http://api.facebook.com/method/fql.query?format=json&query=SELECT%20url,%20share_count%20FROM%20link_stat%20WHERE%20url%20=%20%22' + b + '%22',
  12. crossDomain: true,
  13. dataType: 'jsonp'
  14. }).done(function(a) {
  15. html = '';
  16. html += '<a href="http://www.facebook.com/sharer/sharer.php?u=' + bcr_url + '" class="btn btn-fb" title="Share this on Facebook - ibacor.com" target="_BLANK"><i class="fa fa-facebook"> ' + a[0].share_count + '</i></a>';
  17. $('#bcr_fs').html(html)
  18. })
  19. }
  20.  
  21. function twitter(b) {
  22. $.ajax({
  23. url: 'http://urls.api.twitter.com/1/urls/' + 'count.json?url=' + b,
  24. crossDomain: true,
  25. dataType: 'jsonp'
  26. }).done(function(a) {
  27. html = '';
  28. html += '<a href="https://twitter.com/share?text=' + $(document).find("title").text().replace(/ /g, '+') + '&url=' + bcr_url + '" class="btn btn-tw" title="Share this on Twitter - ibacor.com" target="_BLANK"><i class="fa fa-twitter"> ' + a.count + '</i></a>';
  29. $('#bcr_tw').html(html)
  30. })
  31. }
  32.  
  33. function google(b) {
  34. $.ajax({
  35. url: pehape + '?gog=' + b,
  36. crossDomain: true,
  37. dataType: 'json'
  38. }).done(function(a) {
  39. html = '';
  40. html += '<a href="https://plus.google.com/share?url=' + bcr_url + '" class="btn btn-gp" title="Share this on Google+ - ibacor.com" target="_BLANK"><i class="fa fa-google-plus"> ' + a.kon + '</i></a>';
  41. $('#bcr_go').html(html)
  42. })
  43. }
  44.  
  45. function linkedin(b) {
  46. $.ajax({
  47. url: 'http://www.linkedin.com/countserv/count/share?url=' + b,
  48. crossDomain: true,
  49. dataType: 'jsonp'
  50. }).done(function(a) {
  51. html = '';
  52. html += '<a href="http://www.linkedin.com/shareArticle?mini=true&ro=true&trk=' + $(document).find("title").text().replace(/ /g, '+') + '&url=' + bcr_url + '" class="btn btn-in" title="Share this on Linkedin - ibacor.com" target="_BLANK"><i class="fa fa-linkedin"> ' + a.count + '</i></a>';
  53. $('#bcr_in').html(html)
  54. })
  55. }
  56.  
  57. function upon(b) {
  58. $.ajax({
  59. url: pehape + '?upo=' + b,
  60. crossDomain: true,
  61. dataType: 'json'
  62. }).done(function(a) {
  63. html = '';
  64. html += '<a href="http://www.stumbleupon.com/badge/?url=' + bcr_url + '" class="btn btn-up" title="Share this on Stumbleupon - ibacor.com" target="_BLANK"><i class="fa fa-stumbleupon"> ' + a.kon + '</i></a>';
  65. $('#bcr_up').html(html)
  66. })
  67. }
  68.  
  69. function reddit(b) {
  70. $.ajax({
  71. url: 'http://www.reddit.com/api/info.json?url=' + b,
  72. crossDomain: true,
  73. dataType: 'json'
  74. }).done(function(a) {
  75. html = '';
  76. if (a.data.children != '') {
  77. html += '<a href="http://reddit.com/submit?url=' + bcr_url + '&title=' + $(document).find("title").text().replace(/ /g, '+') + '" class="btn btn-rd" title="Share this on Reddit - ibacor.com" target="_BLANK"><i class="fa fa-reddit"> ' + a.data.children[0].data.score + '</i></a>';
  78. $('#bcr_rd').html(html)
  79. } else {
  80. html += '<a href="http://reddit.com/submit?url=' + bcr_url + '&title=' + $(document).find("title").text().replace(/ /g, '+') + '" class="btn btn-rd" title="Share this on Reddit - ibacor.com" target="_BLANK"><i class="fa fa-reddit"> 0</i></a>';
  81. $('#bcr_rd').html(html)
  82. }
  83. })
  84. }
  85.  
  86. function pinterest(b) {
  87. $.ajax({
  88. url: 'https://api.pinterest.com/v1/urls/count.json?url=' + b,
  89. crossDomain: true,
  90. dataType: 'jsonp'
  91. }).done(function(a) {
  92. html = '';
  93. html += '<a href="http://pinterest.com/pin/create/button/?url=' + bcr_url + '&media=' + $('meta[property="og:image"]').attr('content') + '" class="btn btn-pn" title="Share this on Pinterest - ibacor.com" target="_BLANK"><i class="fa fa-pinterest"> ' + a.count + '</i></a>';
  94. $('#bcr_pt').html(html)
  95. })
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement