1(function ($) { 2 $(function () { 3 $('div.share-social a').each(function (idx) { 4 var el = $(this), 5 cnt = el.data('count'), 6 u = el.data('url'), // share url 7 z = el.data("zero-counter"); // show zero counter 8 if (!u) u = location.href; 9 if (!z) z = 1; 10 if (cnt == "delicious") { 11 function delicious_count(url) { 12 var shares; 13 $.getJSON('http://feeds.delicious.com/v2/json/urlinfo/data?callback=?&url=' + url, function (data) { 14 shares = data[0] ? data[0].total_posts : 0; 15 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 16 }); 17 } 18 delicious_count(u); 19 } else if (cnt == "facebook") { 20 function fb_count(url) { 21 var shares; 22 $.getJSON('http://graph.facebook.com/?callback=?&ids=' + url, function (data) { 23 shares = data[url] ? data[url].shares : 0; 24 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 25 }) 26 } 27 fb_count(u); 28 } else if (cnt == "linkedin") { 29 function lnkd_count(url) { 30 var shares; 31 $.getJSON('http://www.linkedin.com/countserv/count/share?callback=?&url=' + url, function (data) { 32 shares = data.count; 33 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 34 }) 35 } 36 lnkd_count(u); 37 } else if (cnt == "mail") { 38 function mail_count(url) { 39 var shares; 40 $.getJSON('http://connect.mail.ru/share_count?callback=1&func=?&url_list=' + url, function (data) { 41 shares = data.hasOwnProperty(url) ? data[url].shares : 0; 42 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 43 }) 44 } 45 mail_count(u); 46 } else if (cnt == "odnoklassniki") { 47 function odkl_count(url) { 48 var shares; 49 $.getScript('http://www.odnoklassniki.ru/dk?st.cmd=extLike&uid=' + idx + '&ref=' + url); 50 if (!window.ODKL) window.ODKL = {}; 51 window.ODKL.updateCount = function (idx, number) { 52 shares = number; 53 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 54 } 55 } 56 odkl_count(u); 57 } else if (cnt == "pinterest") { 58 function pin_count(url) { 59 var shares; 60 $.getJSON('http://api.pinterest.com/v1/urls/count.json?callback=?&url=' + url, function (data) { 61 shares = data.count; 62 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 63 }) 64 } 65 pin_count(u); 66 } else if (cnt == "twitter") { 67 function twi_count(url) { 68 var shares; 69 $.getJSON('http://urls.api.twitter.com/1/urls/count.json?callback=?&url=' + url, function (data) { 70 shares = data.count; 71 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 72 }) 73 } 74 twi_count(u); 75 } else if (cnt == "vk" || cnt == "vk2") { 76 function vk_count(url) { 77 var shares; 78 $.getScript('http://vk.com/share.php?act=count&index=' + idx + '&url=' + url); 79 if (!window.VK) window.VK = {}; 80 window.VK.Share = { 81 count: function (idx, number) { 82 shares = number; 83 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 84 } 85 } 86 } 87 vk_count(u); 88 } else if (cnt == "ya") { 89 function ya_count(url) { 90 if (!window.Ya) window.Ya = {}; 91 window.Ya.Share = { 92 showCounter: function (number) { 93 window.yaShares = number 94 } 95 }; 96 $.getScript('http://wow.ya.ru/ajax/share-counter.xml?url=' + url, function () { 97 var shares = window.yaShares; 98 if (shares > 0 || z == 1) el.append('<span class="share-counter">' + (shares ? shares : 0) + '</span>') 99 }) 100 } 101 ya_count(u); 102 } 103 }) 104 }) 105})(jQuery); 106 107function test() { 108 alert('hi'); 109}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.