1/* 2 3 4 * DC Social Media Tabs 5 6 7 * Copyright (c) 2012 Design Chemical 8 9 10 * http://www.designchemical.com/blog/index.php/premium-jquery-plugins/jquery-social-media-tabs-plugin/ 11 12 13 * Version 1.7 (23-02-2013) 14 15 16 */ 17 18 19 20 21 22(function($){ 23 24 25 26 27 28 SocialTabsObject = function(el, options) { 29 30 31 this.create(el, options); 32 33 34 }; 35 36 37 38 39 40 $.extend(SocialTabsObject.prototype, { 41 42 43 44 45 46 version : '1.7', 47 48 49 50 51 52 create: function(el, options) { 53 54 55 56 57 58 this.defaults = { 59 60 61 widgets: 'twitter,facebook,fblike,fbrec,google,rss,flickr,delicious,youtube,digg,pinterest,lastfm,dribbble,vimeo,stumbleupon,tumblr,deviantart,linkedin,instagram', 62 63 64 twitter: { 65 66 67 title: 'Latest Tweets', 68 69 70 link: true, 71 72 73 follow: 'Follow on Twitter', 74 75 76 followId: '', 77 78 79 limit: 10, 80 81 82 retweets: false, 83 84 85 replies: false, 86 87 88 images: '', // large w: 786 h: 346, thumb w: 150 h: 150, medium w: 600 h: 264, small w: 340 h 150 89 90 91 url: '', 92 93 94 icon: 'twitter.png', 95 96 97 consumer_key:'', 98 99 100 consumer_secret:'', 101 102 103 oauth_access_token:'', 104 105 106 oauth_access_token_secret:'' 107 108 109 }, 110 111 112 facebook: { 113 114 115 title: 'Facebook', 116 117 118 link: true, 119 120 121 follow: 'Follow on Facebook', 122 123 124 limit: 10, 125 126 127 text: 'contentSnippet', 128 129 130 icon: 'facebook.png' 131 132 133 }, 134 135 136 fblike: { 137 138 139 title: '', 140 141 142 link: false, 143 144 145 follow: '', 146 147 148 limit: 36, 149 150 151 stream: false, 152 153 154 header: true, 155 156 157 icon: 'fblike.png' 158 159 160 }, 161 162 163 fbrec: { 164 165 166 title: '', 167 168 169 link: false, 170 171 172 follow: '', 173 174 175 header: true, 176 177 178 icon: 'fbrec.png' 179 180 181 }, 182 183 184 google: { 185 186 187 title: 'Google +1', 188 189 190 link: true, 191 192 193 follow: 'Add to Circles', 194 195 196 pageId: '', 197 198 199 header: 0, 200 201 202 image_width: 75, 203 204 205 image_height: 75, 206 207 208 api_key: 'AIzaSyB1UZNnscjMDjjH-pi_XbnLRld2wAqi3Ek', 209 210 211 shares: true, 212 213 214 limit: 10, 215 216 217 icon: 'google.png' 218 219 220 }, 221 222 223 youtube: { 224 225 226 title: '', 227 228 229 link: false, 230 231 232 follow: '', 233 234 235 limit: 10, 236 237 238 feed: 'uploads', // favorites 239 240 241 subscribe: true, 242 243 244 icon: 'youtube.png' 245 246 247 }, 248 249 250 flickr: { 251 252 253 title: 'Flickr', 254 255 256 link: true, 257 258 259 follow: '', 260 261 262 lang: 'en-us', 263 264 265 limit: 20, 266 267 268 icon: 'flickr.png' 269 270 271 }, 272 273 274 delicious: { 275 276 277 title: 'Delicious', 278 279 280 link: true, 281 282 283 follow: 'Follow on Delicious', 284 285 286 limit: 10, 287 288 289 icon: 'delicious.png' 290 291 292 }, 293 294 295 digg: { 296 297 298 title: 'Latest Diggs', 299 300 301 link: false, 302 303 304 limit: 10, 305 306 307 icon: 'digg.png', 308 309 310 hdrBg: "#ececec", 311 312 313 hdrTxt: "#555", 314 315 316 tabBg: "#4684be", 317 318 319 tabTxt: "#b3daff", 320 321 322 tabOnTxt: "#d41717", 323 324 325 bdyBg: "#fff", 326 327 328 stryBrdr: "#ccc", 329 330 331 lnk: "#105cb6", 332 333 334 descTxt: "#999", 335 336 337 subHd: "#999" 338 339 340 }, 341 342 343 pinterest: { 344 345 346 title: 'Pinterest', 347 348 349 link: true, 350 351 352 follow: 'Follow on Pinterest', 353 354 355 limit: 10, 356 357 358 icon: 'pinterest.png' 359 360 361 }, 362 363 364 rss: { 365 366 367 title: 'Subscribe to our RSS', 368 369 370 link: true, 371 372 373 follow: 'Subscribe', 374 375 376 limit: 10, 377 378 379 text: 'contentSnippet', 380 381 382 icon: 'rss.png' 383 384 385 }, 386 387 388 lastfm: { 389 390 391 title: 'Last.fm', 392 393 394 link: true, 395 396 397 follow: '', 398 399 400 limit: 20, 401 402 403 feed: 'recenttracks', 404 405 406 icon: 'lastfm.png' 407 408 409 }, 410 411 412 dribbble: { 413 414 415 title: 'Dribbble', 416 417 418 link: true, 419 420 421 follow: 'Follow on Dribbble', 422 423 424 limit: 10, 425 426 427 feed: 'shots', 428 429 430 icon: 'dribbble.png' 431 432 433 }, 434 435 436 vimeo: { 437 438 439 title: 'Vimeo', 440 441 442 link: true, 443 444 445 follow: 'Follow on Vimeo', 446 447 448 limit: 10, 449 450 451 feed: 'likes', 452 453 454 thumb: 'small', 455 456 457 stats: true, 458 459 460 icon: 'vimeo.png' 461 462 463 }, 464 465 466 stumbleupon: { 467 468 469 title: 'Stumbleupon', 470 471 472 link: true, 473 474 475 follow: 'Follow', 476 477 478 limit: 10, 479 480 481 feed: 'favorites', 482 483 484 icon: 'stumbleupon.png' 485 486 487 }, 488 489 490 tumblr: { 491 492 493 title: 'Tumblr', 494 495 496 link: true, 497 498 499 follow: 'Follow', 500 501 502 limit: 10, 503 504 505 thumb: 250, 506 507 508 video: 250, 509 510 511 icon: 'tumblr.png' 512 513 514 }, 515 516 517 deviantart: { 518 519 520 title: 'Deviantart', 521 522 523 link: true, 524 525 526 follow: 'Follow', 527 528 529 limit: 10, 530 531 532 icon: 'deviantart.png' 533 534 535 }, 536 537 538 linkedin: { 539 540 541 plugins: 'CompanyProfile,MemberProfile,CompanyInsider,JYMBII', 542 543 544 CompanyInsider: 'innetwork,newhires,jobchanges', 545 546 547 MemberProfile: 'true', 548 549 550 CompanyProfile: 'true', 551 552 553 icon: 'linkedin.png' 554 555 556 }, 557 558 559 instagram: { 560 561 562 title: 'Instagram', 563 564 565 limit: 10, 566 567 568 accessToken: '', 569 570 571 redirectUrl: '', 572 573 574 clientId: '', 575 576 577 thumb: 'low_resolution', 578 579 580 comments: 3, 581 582 583 likes: 8, 584 585 586 icon: 'instagram.png' 587 588 589 }, 590 591 592 tweetId: '', 593 594 595 share: true, 596 597 598 external: true, 599 600 601 method: 'slide', 602 603 604 position: 'fixed', 605 606 607 location: 'right', 608 609
610 align: 'top', 611 612 613 offset: 10, 614 615 616 speed: 600, 617 618 619 loadOpen: false, 620 621 622 autoClose: false, 623 624 625 width: 360, 626 627 628 height: 630, 629 630 631 start: 0, 632 633 634 controls: true, 635 636 637 rotate: { 638 639 640 direction: 'down', 641 642 643 delay: 6000 644 645 646 }, 647 648 649 wrapper: 'dcsmt', 650 651 652 content: 'dcsmt-content', 653 654 655 slider: 'dcsmt-slider', 656 657 658 slides: 'tab-content', 659 660 661 tabs: 'social-tabs', 662 663 664 classOpen: 'dcsmt-open', 665 666 667 classClose: 'dcsmt-close', 668 669 670 classToggle: 'dcsmt-toggle', 671 672 673 classSlide: 'dcsmt-slide', 674 675 676 active: 'active', 677 678 679 zopen: 1000, 680 681 682 imagePath: 'images/icons/' 683 684 685 }; 686 687 688 this.o = {}; 689 690 691 this.timer_on = 0; 692 693 694 this.id = 'dcsmt-'+$(el).index(); 695 696 697 this.timerId = ''; 698 699 700 701 702 703 this.o = $.extend(true,this.defaults,options); 704 705 706 707 708 709 $(el).addClass(this.o.content).wrap('<div id="'+this.id+'" class="'+this.o.wrapper+'" />'); 710 711 712 var $a = $('#'+this.id),$c = $('.'+this.o.content,$a),ca = 'active'; 713 714 715 716 717 718 $a.css({width: this.o.width+'px'}); 719 720 721 $c.append('<ul class="'+this.o.tabs+'"></ul>').append('<ul class="'+this.o.slider+'"></ul>'); 722 723 724 725 726 727 var tabs = this.o.tabs, slider = this.o.slider, slides = this.o.slides, self = this; 728 729 730 path = this.o.imagePath; 731 732 733 734 735 736 $.each(this.o.widgets.split(','), function(i,v){ 737 738 739 var cl = i == 0 ? 'dcsmt-'+v+' first' : 'dcsmt-'+v ; 740 741 742 $('.'+tabs,$c).append('<li class="'+cl+'"><a href="#" rel="'+i+'" title="'+v+'"><img src="'+path+self.o[v].icon+'" alt="" rel="'+v+'" /></a></li>'); 743 744 745 $('.'+slider,$c).append('<li class="'+slides+' tab-'+v+'"><div class="tab-inner"></div></li>'); 746 747 748 }); 749 750 751 752 753 754 var $r = $('.'+this.o.slider,$a), $s = $('.'+this.o.slides,$a), $t = $('.'+this.o.tabs,$a), $l = $('li',$t); 755 756 757 758 759 760 if(this.o.method == 'slide'){ 761 762 763 var align = this.o.align == 'left' || this.o.align == 'right' ? 'align-'+this.o.align : 'align-top' ; 764 765 766 $a.addClass(this.o.location).addClass(align).css({position: this.o.position}); 767 768 769 } else { 770 771 772 $a.addClass('static'); 773 774 775 } 776 777 778 779 780 781 hb = this.o.height-parseInt($s.css('border-top-width'),10)-parseInt($s.css('padding-top'),10)-parseInt($s.css('border-bottom-width'),10)-parseInt($s.css('padding-bottom'),10); 782 783 784 wb = this.o.width-parseInt($s.css('border-right-width'),10)-parseInt($s.css('padding-right'),10)-parseInt($s.css('border-left-width'),10)-parseInt($s.css('padding-left'),10); 785 786 787 $s.css({height: hb+'px', width: wb+'px'}); 788 789 790 $('.tab-inner',$s).css({height: hb+'px', width: wb+'px'}); 791 792 793 794 795 796 if(this.o.controls){ 797 798 799 $c.append('<div class="controls"><ul><li><a href="#" class="play"></a></li><li><a href="#" class="prev"></a></li><li><a href="#" class="next"></a></li><li><a href="#" class="'+this.o.classClose+' close"></a></li></ul></div>'); 800 801 802 $('.controls',$c).css({width: wb+'px'}); 803 804 805 } 806 807 808 809 810 811 if(this.o.method == 'slide'){ 812 813 814 this.dcslide($a,$t,$s,$l); 815 816 817 } else { 818 819 820 this.dcstatic($a,$t,$l); 821 822 823 } 824 825 826 if(this.o.loadOpen == true){ 827 828 829 this.open($a); 830 831 832 } 833 834 835 this.slickTabs(this.o.start,$a,$t,$s); 836 837 838 this.addevents($a,$t,$s,$l); 839 840 841 }, 842 843 844 845 846 847 addevents: function(a,t,s,l){ 848 849 850 var self = this, ca = this.o.active, cw = this.o.wrapper, co = this.o.classOpen, cc = this.o.classClose, ct = this.o.classToggle, 851 852 853 cs = this.o.classSlide, m = this.o.method, start = this.o.start, external = this.o.external; 854 855 856 $('a',l).click(function(){ 857 858 859 var i = parseInt($(this).attr('rel'),10); 860 861 862 if($(this).parent().hasClass(ca)){ 863 864 865 if(m == 'slide'){ 866 867 868 self.close(a,l,s); 869 870 871 } 872 873 874 } else { 875 876 877 if(!$('li.active',t).length && m == 'slide'){ 878 879 880 self.open(a); 881 882 883 } 884 885 886 self.slickTabs(i,a,t,s); 887 888 889 } 890 891 892 return false; 893 894 895 }); 896 897 898 a.hover(function(){ 899 900 901 if($('.tab-active .stream').length){ 902 903 904 $('.controls',this).fadeIn(); 905 906 907 } else { 908 909 910 $('.controls',this).hide(); 911 912 913 } 914 915 916 }, 917 918 919 function(){$('.controls',this).fadeOut(); 920 921 922 }); 923 924 925 $('.controls',a).delegate('a','click',function(){ 926 927 928 var x = $(this).attr('class'), stream = $('.tab-active .stream',a); 929 930 931 switch(x) 932 933 934 { 935 936 937 case 'prev': 938 939 940 self.pauseTimer(); 941 942 943 ticker(stream,'prev'); 944 945 946 break; 947 948 949 case 'next': 950 951 952 self.pauseTimer(); 953 954 955 ticker(stream,'next'); 956 957 958 break; 959 960 961 case 'play': 962 963 964 self.rotate(a); 965 966 967 $('.controls .play').removeClass('play').addClass('pause'); 968 969 970 break; 971 972 973 case 'pause': 974 975 976 self.pauseTimer(); 977 978 979 break; 980 981 982 } 983 984 985 return false; 986 987 988 }); 989 990 991 if(this.o.method == 'slide'){ 992 993 994 $('.'+co).click(function(e){
995 996 997 if(!a.hasClass(ca)){ 998 999 1000 self.open(a); 1001 1002 1003 } 1004 1005 1006 var i = parseInt($(this).attr('rel'),10) ? parseInt($(this).attr('rel'),10) : start ; 1007 1008 1009 self.slickTabs(i,a,t,s); 1010 1011 1012 e.preventDefault(); 1013 1014 1015 }); 1016 1017 1018 $('.'+cc).click(function(e){ 1019 1020 1021 if(a.hasClass(ca)){ 1022 1023 1024 self.close(a,l,s); 1025 1026 1027 } 1028 1029 1030 e.preventDefault(); 1031 1032 1033 }); 1034 1035 1036 $('.'+ct).click(function(e){ 1037 1038 1039 if(a.hasClass(ca)){ 1040 1041 1042 self.close(a,l,s); 1043 1044 1045 } else { 1046 1047 1048 self.open(a); 1049 1050 1051 var i = parseInt($(this).attr('rel'),10) ? parseInt($(this).attr('rel'),10) : start ; 1052 1053 1054 self.slickTabs(i,a,t,s); 1055 1056 1057 } 1058 1059 1060 e.preventDefault(); 1061 1062 1063 }); 1064 1065 1066 } 1067 1068 1069 $('.'+cs).click(function(e){ 1070 1071 1072 if(m == 'slide'){ 1073 1074 1075 if(!a.hasClass(ca)){ 1076 1077 1078 self.open(a); 1079 1080 1081 } 1082 1083 1084 } 1085 1086 1087 var i = parseInt($(this).attr('rel'),10) ? parseInt($(this).attr('rel'),10) : start ; 1088 1089 1090 self.slickTabs(i,a,t,s); 1091 1092 1093 e.preventDefault(); 1094 1095 1096 }); 1097 1098 1099 s.delegate('a','click',function(){ 1100 1101 1102 if($(this).parent().hasClass('section-share')){ 1103 1104 1105 var u = $(this).attr('href'); 1106 1107 1108 window.open(u,'sharer','toolbar=0,status=0,width=626,height=436'); 1109 1110 1111 return false; 1112 1113 1114 } else { 1115 1116 1117 if(external){this.target = '_blank';} 1118 1119 1120 } 1121 1122 1123 }); 1124 1125 1126 s.delegate('a','click',function(){ 1127 1128 1129 if($(this).parents().hasClass('tab-facebook')){ 1130 1131 1132 var u = $(this).attr('href').split('/&'); 1133 1134 1135 $(this).attr('href',u[0]); 1136 1137 1138 } 1139 1140 1141 }); 1142 1143 1144 if(this.o.autoClose == true){ 1145 1146 1147 $('body').mouseup(function(e){ 1148 1149 1150 if(a.hasClass(ca) && !$(e.target).parents().hasClass(cw)){ 1151 1152 1153 if(!$(e.target).hasClass(co) || !$(e.target).hasClass(cs)){ 1154 1155 1156 self.close(a,l,s); 1157 1158 1159 } 1160 1161 1162 } 1163 1164 1165 }); 1166 1167 1168 } 1169 1170 1171 }, 1172 1173 1174 dcslide: function(a,t,s,l){ 1175 1176 1177 t.css({position: 'absolute'}); 1178 1179 1180 s.css({position: 'relative'}); 1181 1182 1183 tw = l.outerWidth(true); 1184 1185 1186 th = t.outerHeight(); 1187 1188 1189 var p1 = {marginLeft: '-'+this.o.width+'px', top: this.o.offset+'px', left: 0}; 1190 1191 1192 var p2 = {top: 0, right: 0, marginRight: '-'+tw+'px', width: tw+'px'}; 1193 1194 1195 switch(this.o.location){ 1196 1197 1198 case 'right': 1199 1200 1201 p1 = {marginRight: '-'+this.o.width+'px', top: this.o.offset+'px', right: 0}; 1202 1203 1204 p2 = {top: 0, left: 0, marginLeft: '-'+tw+'px', width: tw+'px'}; 1205 1206 1207 break; 1208 1209 1210 case 'top': 1211 1212 1213 p1 = {marginTop: '-'+this.o.height+'px', top: 0}; 1214 1215 1216 p2 = {bottom: 0, marginBottom: '-'+th+'px'}; 1217 1218 1219 if(this.o.align == 'left'){ 1220 1221 1222 a.css({left: this.o.offset+'px'}); 1223 1224 1225 t.css({left: 0}); 1226 1227 1228 } else { 1229 1230 1231 a.css({right: this.o.offset+'px'}); 1232 1233 1234 t.css({right: 0}); 1235 1236 1237 } 1238 1239 1240 break; 1241 1242 1243 case 'bottom': 1244 1245 1246 p1 = {marginBottom: '-'+this.o.height+'px', bottom: 0}; 1247 1248 1249 p2 = {top: 0, marginTop: '-'+th+'px'}; 1250 1251 1252 if(this.o.align == 'left'){ 1253 1254 1255 a.css({left: this.o.offset+'px'}); 1256 1257 1258 t.css({left: 0}); 1259 1260 1261 } else { 1262 1263 1264 a.css({right: this.o.offset+'px'}); 1265 1266 1267 t.css({right: 0}); 1268 1269 1270 } 1271 1272 1273 break; 1274 1275 1276 } 1277 1278 1279 a.css(p1).addClass('sliding'); 1280 1281 1282 t.css(p2); 1283 1284 1285 }, 1286 1287 1288 dcstatic: function(a,t,l){ 1289 1290 1291 th = l.outerHeight(); 1292 1293 1294 a.addClass(this.o.active); 1295 1296 1297 t.css({height: th+'px'}); 1298 1299 1300 }, 1301 1302 1303 slickTabs: function(i,a,t,s){ 1304 1305 1306 var self = this; 1307 1308 1309 $('li',t).removeClass(this.o.active).eq(i).addClass(this.o.active); 1310 1311 1312 s.removeClass('tab-active').hide().eq(i).addClass('tab-active').show(); 1313 1314 1315 if(!$('li:eq('+i+')',t).hasClass('loaded') && a.hasClass(this.o.active)){ 1316 1317 1318 var type = $('li:eq('+i+') img',t).attr('rel'); 1319 1320 1321 var widget = createWidget(this.id,type,this.o[type+'Id'],this.o[type],this.o.width,this.o.height,this.o.share,this.o.tweetId); 1322 1323 1324 $('.'+this.o.slides+':eq('+i+') .tab-inner',a).empty().hide().append(widget).fadeIn(600).addClass('loaded'); 1325 1326 1327 $('li:eq('+i+')',t).addClass('loaded'); 1328 1329 1330 if(type == 'facebook' || type == 'fblike' || type == 'fbrec'){ 1331 1332 1333 fbLink(this.o[type+'Id'], $('.btn-type-'+type)); 1334 1335 1336 } else if(type == 'linkedin'){ 1337 1338 1339 $.getScript("http://platform.linkedin.com/in.js?async=true", function(){ 1340 1341 1342 IN.init(); 1343 1344 1345 });
1346 1347 1348 } 1349 1350 1351 } 1352 1353 1354 if(!a.hasClass(this.o.active) && this.o.method == 'slide'){ 1355 1356 1357 $('li',t).removeClass(this.o.active); 1358 1359 1360 } 1361 1362 1363 if(this.o.rotate.delay > 0){ 1364 1365 1366 self.pauseTimer(); 1367 1368 1369 self.rotate(a); 1370 1371 1372 $('.controls .play').removeClass('play').addClass('pause'); 1373 1374 1375 } 1376 1377 1378 }, 1379 1380 1381 open: function(a){ 1382 1383 1384 var p1 = {marginBottom: "-=5px"},p2 = {marginBottom: 0},self = this; 1385 1386 1387 a.css({zIndex: this.o.zopen}); 1388 1389 1390 switch (this.o.location) { 1391 1392 1393 case 'top': 1394 1395 1396 p1 = {marginTop: "-=5px"},p2 = {marginTop: 0}; 1397 1398 1399 break; 1400 1401 1402 case 'left': 1403 1404 1405 p1 = {marginLeft: "-=5px"},p2 = {marginLeft: 0}; 1406 1407 1408 break; 1409 1410 1411 case 'right': 1412 1413 1414 p1 = {marginRight: "-=5px"},p2 = {marginRight: 0}; 1415 1416 1417 break; 1418 1419 1420 } 1421 1422 1423 a.animate(p1, 100).animate(p2, this.o.speed).addClass(this.o.active); 1424 1425 1426 }, 1427 1428 1429 close: function(a,l,s){ 1430 1431 1432 var self = this, ca = this.o.active; 1433 1434 1435 if(a.hasClass(ca)){ 1436 1437 1438 var p = {"marginBottom": "-"+this.o.height+'px'}; 1439 1440 1441 switch (this.o.location) { 1442 1443 1444 case 'top': 1445 1446 1447 p = {"marginTop": "-"+this.o.height+'px'}; 1448 1449 1450 break; 1451 1452 1453 case 'left': 1454 1455 1456 p = {"marginLeft": "-"+this.o.width+'px'}; 1457 1458 1459 break; 1460 1461 1462 case 'right': 1463 1464 1465 p = {"marginRight": "-"+this.o.width+'px'}; 1466 1467 1468 break; 1469 1470 1471 } 1472 1473 1474 a.animate(p, this.o.speed, function(){ 1475 1476 1477 a.removeClass(ca); 1478 1479 1480 l.removeClass(ca); 1481 1482 1483 s.removeClass('tab-active'); 1484 1485 1486 }); 1487 1488 1489 self.pauseTimer(); 1490 1491 1492 } 1493 1494 1495 }, 1496 1497 1498 rotate: function(a){ 1499 1500 1501 var self = this, stream = $('.tab-active .stream',a), speed = this.o.speed, delay = this.o.rotate.delay, r = this.o.rotate.direction == 'up' ? 'prev' : 'next' ; 1502 1503 1504 this.timer_on = 1; 1505 1506 1507 this.timerId = setTimeout(function(){ 1508 1509 1510 ticker(stream,r,speed); 1511 1512 1513 self.rotate(a); 1514 1515 1516 }, delay); 1517 1518 1519 }, 1520 1521 1522 pauseTimer: function(){ 1523 1524 1525 clearTimeout(this.timerId); 1526 1527 1528 this.timer_on = 0; 1529 1530 1531 $('.controls .pause').removeClass('pause').addClass('play'); 1532 1533 1534 } 1535 1536 1537 }); 1538 1539 1540 1541 1542 1543 $.fn.dcSocialTabs = function(options, callback){ 1544 1545 1546 var d = {}; 1547 1548 1549 this.each(function(){ 1550 1551 1552 var s = $(this); 1553 1554 1555 d = s.data("socialtabs"); 1556 1557 1558 if (!d){ 1559 1560 1561 d = new SocialTabsObject(this, options, callback); 1562 1563 1564 s.data("socialtabs", d); 1565 1566 1567 } 1568 1569 1570 }); 1571 1572 1573 return d; 1574 1575 1576 }; 1577 1578 1579 1580 1581 1582 function createWidget(obj,type,id,o,w,h,share,tweetId){ 1583 1584 1585 1586 1587 1588 var ti = obj+'-'+type,c = '',t = '',p = '',href = '',n = o.limit,stream = '<ul id="'+ti+'" class="stream"></ul>',data,frl = 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0'; 1589 1590 1591 1592 1593 1594 switch (type) { 1595 1596 1597 1598 1599 1600 case 'twitter': 1601 1602 1603 var cp = id.split('/'), cq = id.split('#'), replies = o.replies == true ? '&exclude_replies=false' : '&exclude_replies=true' ; 1604 1605 1606 var param = '&include_entities=true&include_rts='+o.retweets+replies; 1607 1608 1609 url = cp.length > 1 ? o.url + '?url=list&list_id='+cp[1]+'&per_page='+n+param : o.url + '?url=timeline&screen_name='+id+'&count='+n+param+'&consumer_key='+o.consumer_key+'&consumer_secret='+o.consumer_secret+'&oauth_access_token='+o.oauth_access_token+'&oauth_access_token_secret='+o.oauth_access_token_secret; 1610 1611 1612 if(cq.length > 1){ 1613 1614 1615 var rts = o.retweets == false ? '+exclude:retweets' : '' ; 1616 1617 1618 url = o.url + '?url=search&q='+encodeURIComponent(cq[1])+'&count='+n; 1619 1620 1621 } 1622 1623 1624 href = 'https://www.twitter.com/'; 1625 1626 1627 href += cp.length > 1 || cq.length > 1 ? o.followId : id ; 1628 1629 1630 c += stream; 1631 1632 1633 getFeed(ti,type,url,data,o,id,share,tweetId); 1634 1635 1636 break; 1637 1638 1639 1640 1641 1642 case 'facebook': 1643 1644 1645 c += stream; 1646 1647 1648 url = 'https://www.facebook.com/feeds/page.php?id='+id+'&format=rss20'; 1649 1650 1651 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent(url); 1652 1653 1654 getFeed(ti,type,url,data,o,id,share,tweetId); 1655 1656 1657 break; 1658 1659 1660 1661 1662 1663 case 'fblike': 1664 1665 1666 src = 'https://www.facebook.com/plugins/likebox.php?id='+id+'&width='+w+'&connections='+n+'&stream='+o.stream+'&header='+o.header+'&height='+h; 1667 1668 1669 c += getFrame(src,w,h); 1670 1671 1672 break; 1673 1674 1675 1676 1677
1678 case 'fbrec': 1679 1680 1681 src = 'https://www.facebook.com/plugins/recommendations.php?site='+id+'&width='+w+'&height='+h+'&header='+o.header+'&colorscheme=light&font&border_color'; 1682 1683 1684 c += getFrame(src,w,h); 1685 1686 1687 break; 1688 1689 1690 1691 1692 1693 case 'google': 1694 1695 1696 href = 'https://plus.google.com/'+id; 1697 1698 1699 if(o.header > 0){ 1700 1701 1702 var ph = o.header == 1 ? 69 : 131 ; 1703 1704 1705 var gc = o.header == 1 ? 'small' : 'standard' ; 1706 1707 1708 c += '<link href="https://plus.google.com/'+o.pageId+'" rel="publisher" /><script type="text/javascript">window.___gcfg = {lang: "en"};(function(){var po = document.createElement("script");po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/plusone.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po, s);})();</script><div class="google-page '+gc+'"><g:plus href="https://plus.google.com/'+o.pageId+'" width="'+w+'" height="'+ph+'" theme="light"></g:plus></div>'; 1709 1710 1711 } 1712 1713 1714 c += stream; 1715 1716 1717 url = 'https://www.googleapis.com/plus/v1/people/'+id+'/activities/public'; 1718 1719 1720 data = {key: o.api_key, maxResults: n, prettyprint: false, fields:"items(id,kind,object(attachments(displayName,fullImage,id,image,objectType,url),id,objectType,plusoners,replies,resharers,url),published,title,url,verb)"}; 1721 1722 1723 getFeed(ti,type,url,data,o,id,share,tweetId); 1724 1725 1726 break; 1727 1728 1729 1730 1731 1732 case 'youtube': 1733 1734 1735 href = 'https://www.youtube.com/user/'+id; 1736 1737 1738 if(o.subscribe){ 1739 1740 1741 c += '<iframe src="https://www.youtube.com/subscribe_widget?p='+id+'" class="youtube-subscribe" scrolling="no" frameBorder="0"></iframe>'; 1742 1743 1744 } 1745 1746 1747 c += stream; 1748 1749 1750 url = 'https://gdata.youtube.com/feeds/base/users/'+id+'/'+o.feed+'?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile'; 1751 1752 1753 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent(url); 1754 1755 1756 getFeed(ti,type,url,data,o,id,share,tweetId); 1757 1758 1759 break; 1760 1761 1762 1763 1764 1765 case 'flickr': 1766 1767 1768 var cq = id.split('/'), fd = cq.length > 1 ? 'groups_pool' : 'photos_public' ; 1769 1770 1771 id = cq.length > 1 ? cq[1] : id ; 1772 1773 1774 href = 'http://www.flickr.com/photos/'+id; 1775 1776 1777 c += stream; 1778 1779 1780 url = 'http://api.flickr.com/services/feeds/'+fd+'.gne?id='+id+'&lang='+o.lang+'&format=json&jsoncallback=?'; 1781 1782 1783 getFeed(ti,type,url,data,o,id,share,tweetId); 1784 1785 1786 break; 1787 1788 1789 1790 1791 1792 case 'delicious': 1793 1794 1795 href = 'https://www.delicious.com/'+id; 1796 1797 1798 c += stream; 1799 1800 1801 url = 'https://feeds.delicious.com/v2/json/'+id; 1802 1803 1804 getFeed(ti,type,url,data,o,id,share,tweetId); 1805 1806 1807 break; 1808 1809 1810 1811 1812 1813 case 'digg': 1814 1815 1816 href = 'https://digg.com/users/'+id; 1817 1818 1819 c += '<div id="'+ti+'"><a href="https://digg.com/users/'+id+'"></a></div><script type="text/javascript">(function() { var s, s1, diggWidget = {id: "'+ti+'", layout: 1, colors: {hdrBg: "'+o.hdrBg+'", hdrTxt: "'+o.hdrTxt+'", tabBg: "'+o.tabBg+'", tabTxt: "'+o.tabTxt+'", tabOnTxt: "'+o.tabOnTxt+'", bdyBg: "'+o.bdyBg+'", stryBrdr: "'+o.stryBrdr+'", lnk: "'+o.lnk+'", descTxt: "'+o.descTxt+'", subHd: "'+o.subHd+'"}, title: "'+o.title+'", width: '+w+', requests: [{t: "'+id+'", p: {count: "'+n+'", method: "user.getDugg", username: "'+id+'"}}], hide: {}}; if (window.DiggWidget) { if (typeof DiggWidget == "function") { new DiggWidget(diggWidget); } else { DiggWidget.push(diggWidget); } } else { DiggWidget = [diggWidget]; s = document.createElement("SCRIPT"); s.type = "text/javascript"; s.async = true; s.src = "https://widgets.digg.com/widgets.js";s1= document.getElementsByTagName("SCRIPT")[0]; s1.parentNode.insertBefore(s, s1); } })();</script>'; 1820 1821 1822 break; 1823 1824 1825 1826 1827 1828 case 'pinterest': 1829 1830 1831 var cp = id.split('/'), ext = cp.length > 1 ? '/rss' : '/feed.rss'; 1832 1833 1834 href = 'https://www.pinterest.com/'+id; 1835 1836 1837 c += stream; 1838 1839 1840 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent(href+ext); 1841 1842 1843 getFeed(ti,type,url,data,o,id,share,tweetId); 1844 1845 1846 break; 1847 1848 1849 1850 1851 1852 case 'rss': 1853 1854 1855 href = id; 1856 1857 1858 c += stream; 1859 1860 1861 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent(href); 1862 1863 1864 getFeed(ti,type,url,data,o,id,share,tweetId); 1865 1866 1867 break; 1868 1869 1870 1871 1872 1873 case 'lastfm': 1874 1875 1876 href = 'https://www.last.fm/user/'+id; 1877 1878 1879 c += stream; 1880 1881 1882 var ver = o.feed == 'lovedtracks' ? '2.0' : '1.0' ; 1883 1884 1885 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent('https://ws.audioscrobbler.com/'+ver+'/user/'+id+'/'+o.feed+'.rss'); 1886 1887 1888 getFeed(ti,type,url,data,o,id,share,tweetId); 1889 1890 1891 break; 1892 1893 1894 1895 1896 1897 case 'dribbble': 1898 1899 1900 href = 'http://www.dribbble.com/'+id; 1901 1902 1903 url = o.feed == 'likes' ? 'http://api.dribbble.com/players/'+id+'/shots/likes' : 'http://api.dribbble.com/players/'+id+'/shots' ; 1904 1905 1906 c += stream; 1907 1908 1909 getFeed(ti,type,url,data,o,id,share,tweetId); 1910 1911 1912 break; 1913 1914 1915 1916 1917 1918 case 'vimeo': 1919 1920 1921 href = 'https://www.vimeo.com/'+id; 1922 1923 1924 c += stream; 1925 1926 1927 url = 'https://vimeo.com/api/v2/'+id+'/'+o.feed+'.json'; 1928 1929 1930 getFeed(ti,type,url,data,o,id,share,tweetId); 1931 1932 1933 break; 1934 1935 1936 1937 1938 1939 case 'stumbleupon': 1940 1941 1942 href = 'http://www.stumbleupon.com/stumbler/'+id; 1943 1944 1945 c += stream; 1946 1947 1948 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent('http://rss.stumbleupon.com/user/'+id+'/'+o.feed); 1949 1950 1951 getFeed(ti,type,url,data,o,id,share,tweetId); 1952 1953 1954 break; 1955 1956 1957 1958 1959 1960 case 'tumblr': 1961 1962 1963 href = 'https://'+id+'.tumblr.com'; 1964 1965 1966 c += stream; 1967 1968 1969 url = 'http://'+id+'.tumblr.com/api/read/json?callback=?'; 1970 1971 1972 getFeed(ti,type,url,data,o,id,share,tweetId); 1973 1974 1975 break; 1976 1977 1978 1979 1980 1981 case 'deviantart': 1982 1983 1984 href = 'https://'+id+'.deviantart.com'; 1985 1986 1987 c += stream; 1988 1989 1990 url = frl+'&num='+n+'&callback=?&q=' + encodeURIComponent('https://backend.deviantart.com/rss.xml?type=deviation&q=by%3A'+id+'+sort%3Atime+meta%3Aall'); 1991 1992 1993 getFeed(ti,type,url,data,o,id,share,tweetId); 1994 1995 1996 break; 1997 1998 1999 2000 2001 2002 case 'linkedin': 2003 2004 2005 id = id.split(','); 2006 2007 2008 $.each(o.plugins.split(','), function(i,v){ 2009 2010 2011 if(id[i]){ 2012 2013 2014 var mod = v == 'CompanyInsider' ? ' data-modules="'+o[v]+'"' : '' ; 2015 2016 2017 mod = v == 'MemberProfile' || v == 'CompanyProfile' ? ' data-related="'+o[v]+'"' : mod ; 2018 2019 2020 c += getLinkedIn(id[i],v,mod,w-20); 2021 2022 2023 } 2024 2025 2026 }); 2027 2028 2029 break; 2030 2031 2032 2033 2034 2035 case 'instagram': 2036 2037 2038 href = '#'; 2039 2040 2041 c += stream; 2042 2043 2044 url = 'https://api.instagram.com/v1'; 2045 2046 2047 var cp = id.substr(0,1), cq = id.split(cp), url1 = encodeURIComponent(cq[1]), qs = ''; 2048 2049 2050 switch(cp) 2051 2052 2053 { 2054 2055 2056 case '?': 2057 2058 2059 var p = cq[1].split('/'); 2060 2061 2062 qs = '&lat='+p[0]+'&lng='+p[1]+'&distance='+p[2]; 2063 2064 2065 url += '/media/search'; 2066 2067 2068 break; 2069 2070 2071 case '#': 2072 2073 2074 url += '/tags/'+url1+'/media/recent'; 2075 2076 2077 break; 2078 2079 2080 case '!': 2081 2082 2083 url += '/users/'+url1+'/media/recent'; 2084 2085 2086 break; 2087 2088 2089 case '@': 2090 2091 2092 url += '/locations/'+url1+'/media/recent'; 2093 2094 2095 break; 2096 2097 2098 } 2099 2100 2101 if(o.accessToken == ''){ 2102 2103 2104 if (location.hash) { 2105 2106 2107 o.accessToken = location.hash.split('=')[1] ; 2108 2109 2110 } else { 2111 2112 2113 location.href="https://instagram.com/oauth/authorize/?client_id="+o.clientId+"&redirect_uri="+o.redirectUrl+"&response_type=token"; 2114 2115 2116 } 2117 2118 2119 } 2120 2121 2122 url += '?access_token='+o.accessToken+'&client_id='+o.clientId+qs; 2123 2124 2125 getFeed(ti,type,url,data,o,id,share,tweetId); 2126 2127 2128 break; 2129 2130 2131 } 2132 2133 2134 if(type != 'digg' && type != 'linkedin'){ 2135 2136 2137 if(o.follow){ 2138 2139 2140 p = o.follow != '' ? '<a href="'+href+'" class="dcsmt-btn btn-type-'+type+'">'+o.follow+'</a>' : '' ; 2141 2142 2143 } 2144 2145 2146 t = o.title != '' ? o.title : '' ; 2147 2148 2149 t = o.link ? '<a href="'+href+'" class="btn-type-'+type+'">'+t+'</a>' : t ; 2150 2151 2152 c = t != '' ? '<div class="profile"><h3>'+t+'</h3>'+p+'</div>'+c : c ; 2153 2154 2155 } 2156 2157 2158 return c; 2159 2160 2161 }; 2162 2163 2164 2165 2166 2167 function getFeed(target,type,url,data,o,id,share,tweetId){ 2168 2169 2170 var x = '#'+target,html = [],d = '',dataType = type == 'twitter' ? 'json' : 'jsonp'; 2171 2172 2173 jQuery.ajax({ 2174 2175 2176 url: url, 2177 2178 2179 data: data, 2180 2181 2182 cache: true, 2183 2184 2185 dataType: dataType, 2186 2187 2188 success: function(a){ 2189 2190 2191 var error = '',px = $(x).width(); 2192 2193 2194 switch(type) 2195 2196 2197 { 2198 2199 2200 case 'google': 2201 2202 2203 error = a.error ? a.error : '' ; 2204 2205 2206 a = a.items; 2207 2208 2209 break; 2210 2211 2212 case 'flickr': 2213 2214 2215 a = a.items; 2216 2217 2218 break; 2219 2220 2221 case 'instagram': 2222 2223 2224 a = a.data; 2225 2226 2227 break; 2228 2229 2230 case 'twitter': 2231 2232 2233 error = a.errors ? a.errors : '' ; 2234 2235 2236 var cq = id.split('#'); 2237 2238 2239 if(cq.length > 1){a = a.statuses} ; 2240 2241 2242 break; 2243 2244 2245 case 'dribbble': 2246 2247 2248 a = a.shots; 2249 2250 2251 break; 2252 2253 2254 case 'tumblr': 2255 2256 2257 a = a.posts; 2258 2259 2260 break; 2261 2262 2263 case 'delicious': 2264 2265 2266 break; 2267 2268 2269 case 'vimeo': 2270 2271 2272 break; 2273 2274 2275 default: 2276 2277 2278 if(a.responseStatus == 200){ 2279 2280 2281 a = a.responseData.feed.entries; 2282 2283 2284 } else { 2285 2286 2287 error = a.responseDetails; 2288 2289 2290 } 2291 2292 2293 break; 2294 2295 2296 } 2297 2298 2299 if(error == ''){ 2300 2301 2302 $.each(a, function(i,item){ 2303 2304 2305 if(i < o.limit){ 2306 2307 2308 d = item.publishedDate; 2309 2310 2311 var x = '<a href="'+item.link+'" class="title">'+item.title+'</a>', sq = item.link, st = item.title, s = ''; 2312 2313 2314 html.push('<li>'); 2315 2316 2317 switch(type) 2318 2319 2320 { 2321 2322 2323 case 'twitter': 2324 2325 2326 d = parseTwitterDate(item.created_at); 2327 2328 2329 var un = item.user.screen_name, ua = item.user.profile_image_url_https ; 2330 2331 2332 html.push('<a href="https://www.twitter.com/'+un+'" class="thumb"><img src="'+ua+'" alt="" /></a>'); 2333 2334 2335 html.push('<span class="twitter-user"><a href="https://www.twitter.com/'+un+'"><strong>
2335'+item.user.name+'</strong> @'+un+'</a></span><br />'); 2336 2337 2338 html.push(linkify(item.text)); 2339 2340 2341 if(o.images != '' && item.entities.media){ 2342 2343 2344 $.each(item.entities.media, function(i,media){ 2345 2346 2347 html.push('<a href="'+media.media_url_https+'" class="twitter-image"><img src="'+media.media_url_https+':'+o.images+'" alt="" /></a>'); 2348 2349 2350 }); 2351 2352 2353 } 2354 2355 2356 sq = item.id_str; 2357 2358 2359 break; 2360 2361 2362 2363 2364 2365 case 'facebook': 2366 2367 2368 html.push(x); 2369 2370 2371 html.push(decodeURIComponent(item[o.text].replace(/http:\/\/www.facebook.com\/l.php\?u\=/gi,''))); 2372 2373 2374 break; 2375 2376 2377 2378 2379 2380 case 'delicious': 2381 2382 2383 d = item.dt; 2384 2385 2386 html.push('<a href="' + item.u + '" class="title">'+item.d+'</a>'); 2387 2388 2389 html.push('<span class="text">'+item.n+'</span>'); 2390 2391 2392 sq = item.u; 2393 2394 2395 st = item.d; 2396 2397 2398 break; 2399 2400 2401 2402 2403 2404 case 'rss': 2405 2406 2407 html.push(x+item[o.text]); 2408 2409 2410 break; 2411 2412 2413 2414 2415 2416 case 'pinterest': 2417 2418 2419 var img=$('img',item.content).attr('src') ? '<a href="'+item.link+'"><img src="'+$('img',item.content).attr('src')+'" alt="" /></a>':''; 2420 2421 2422 html.push(img); 2423 2424 2425 html.push(item.contentSnippet); 2426 2427 2428 st = item.contentSnippet; 2429 2430 2431 break; 2432 2433 2434 2435 2436 2437 case 'youtube': 2438 2439 2440 html.push(x); 2441 2442 2443 var v = []; 2444 2445 2446 v = parseQ(item.link); 2447 2448 2449 html.push('<a href="' + item.link + '" class="thumb"><img src="https://i.ytimg.com/vi/'+v['v']+'/default.jpg" alt="" /></a>'); 2450 2451 2452 html.push(item.contentSnippet); 2453 2454 2455 break; 2456 2457 2458 2459 2460 2461 case 'flickr': 2462 2463 2464 d = ''; 2465 2466 2467 html.push('<a href="' + item.link + '" class="thumb" title="'+ item.title +'"><img src="' + item.media.m + '" alt="" /></a>'); 2468 2469 2470 break; 2471 2472 2473 2474 2475 2476 case 'lastfm': 2477 2478 2479 html.push('<a href="'+item.content+'" class="title">'+item.title+'</a>'); 2480 2481 2482 break; 2483 2484 2485 2486 2487 2488 case 'dribbble': 2489 2490 2491 d = item.created_at; 2492 2493 2494 html.push('<a href="'+item.url+'" class="thumb"><img src="' + item.image_teaser_url + '" alt="' + item.title + '" /></a>'); 2495 2496 2497 html.push('<span class="meta"><span class="views">'+num(item.views_count)+'</span><span class="likes">'+num(item.likes_count)+'</span><span class="comments">'+num(item.comments_count)+'</span></span>'); 2498 2499 2500 sq = item.url; 2501 2502 2503 break; 2504 2505 2506 2507 2508 2509 case 'deviantart': 2510 2511 2512 html.push(x+item.content); 2513 2514 2515 break; 2516 2517 2518 2519 2520 2521 case 'tumblr': 2522 2523 2524 d = item.date; 2525 2526 2527 var x = '<a href="'+item['url-with-slug']+'">', z = ''; 2528 2529 2530 switch(item.type) 2531 2532 2533 { 2534 2535 2536 case 'photo': 2537 2538 2539 x += item['photo-caption']+'</a>'; 2540 2541 2542 z += '<img src="'+item['photo-url-'+o.thumb]+'" alt="" />'; 2543 2544 2545 st = item['photo-caption']; 2546 2547 2548 break; 2549 2550 2551 case 'video': 2552 2553 2554 x += item['video-caption']+'</a>'; 2555 2556 2557 z += o.video != '400' ? item['video-player-'+o.video] : item['video-player'] ; 2558 2559 2560 st = item['video-caption']; 2561 2562 2563 break; 2564 2565 2566 case 'regular': 2567 2568 2569 x += item['regular-title']+'</a>'; 2570 2571 2572 z += item['regular-body']; 2573 2574 2575 st = item['regular-title']; 2576 2577 2578 break; 2579 2580 2581 case 'quote': 2582 2583 2584 x += item['quote-source']+'</a>'; 2585 2586 2587 z += item['quote-text']; 2588 2589 2590 st = item['quote-source']; 2591 2592 2593 break; 2594 2595 2596 case 'audio': 2597 2598 2599 x = item['id3-artist'] ? '<a href="'+item['url-with-slug']+'">'+item['id3-artist']+' - '+item['id3-album']+'</a>' : '' ; 2600 2601 2602 x += item['id3-title'] ? '<a href="'+item['url-with-slug']+'" class="track">'+item['id3-title']+'</a>' : '' ; 2603 2604 2605 z += item['audio-caption'] ? item['audio-caption'] : '' ; 2606 2607 2608 z += item['audio-player'] ? item['audio-player'] : '' ; 2609 2610
2611 st = item['id3-artist']+' - '+item['id3-album']+' - '+item['id3-title']; 2612 2613 2614 break; 2615 2616 2617 case 'conversation': 2618 2619 2620 x += item['conversation-title']+'</a>'; 2621 2622 2623 z += item['conversation-text']; 2624 2625 2626 st = item['conversation-title']; 2627 2628 2629 break; 2630 2631 2632 case 'link': 2633 2634 2635 var ltxt = item['link-text'].replace(/:/g, ''); 2636 2637 2638 x = '<a href="'+item['link-url']+'">'+ltxt+'</a>'; 2639 2640 2641 z += item['link-description']; 2642 2643 2644 st = ltxt; 2645 2646 2647 break; 2648 2649 2650 } 2651 2652 2653 html.push(x); 2654 2655 2656 html.push(z); 2657 2658 2659 st = stripHtml(st); 2660 2661 2662 sq = item['url-with-slug']; 2663 2664 2665 break; 2666 2667 2668 2669 2670 2671 case 'vimeo': 2672 2673 2674 d = '', f = o.feed, at = item.name, tx = item.description; 2675 2676 2677 if(f == 'channels'){ 2678 2679 2680 if(item.logo != ''){ 2681 2682 2683 html.push('<a href="'+item.url+'" class="logo"><img src="'+item.logo+'" alt="" width="'+px+'" /></a>'); 2684 2685 2686 } 2687 2688 2689 } else if(f == 'groups'){ 2690 2691 2692 html.push('<a href="'+item.url+'" class="thumb"><img src="'+item.thumbnail+'" alt="" /></a>'); 2693 2694 2695 } else { 2696 2697 2698 var thumb = 'thumbnail_'+o.thumb, at = item.title, tx = f != 'albums' ? item.duration+' secs' : item.description ; 2699 2700 2701 html.push('<a href="'+item.url+'" class="thumb"><img src="'+item[thumb]+'" alt="" /></a>'); 2702 2703 2704 } 2705 2706 2707 html.push('<a href="'+item.url+'" class="title">'+at+'</a>'); 2708 2709 2710 html.push('<span class="text">'+tx+'</span>'); 2711 2712 2713 if(o.stats == true){ 2714 2715 2716 var m = ''; 2717 2718 2719 m += f == 'albums' || f == 'channels' || f == 'groups' ? '<span class="videos">'+num(item.total_videos)+'</span>' : '' ; 2720 2721 2722 if(f == 'channels'){ 2723 2724 2725 m += '<span class="users">'+num(item.total_subscribers)+'</span>'; 2726 2727 2728 } else if(f == 'groups'){ 2729 2730 2731 m += '<span class="users">'+num(item.total_members)+'</span>'; 2732 2733 2734 } else if(f != 'albums'){ 2735 2736 2737 m += '<span class="likes">'+num(item.stats_number_of_likes)+'</span><span class="views">'+num(item.stats_number_of_plays)+'</span><span class="comments">'+num(item.stats_number_of_comments)+'</span>'; 2738 2739 2740 } 2741 2742 2743 html.push('<span class="meta">'+m+'</span>'); 2744 2745 2746 } 2747 2748 2749 var dt = item.upload_date; 2750 2751 2752 if(f == 'likes'){ 2753 2754 2755 dt = item.liked_on; 2756 2757 2758 } else if(f == 'albums' || f == 'channels' || f == 'groups'){ 2759 2760 2761 dt = item.created_on; 2762 2763 2764 } 2765 2766 2767 html.push('<span class="date">'+dt+'</span>'); 2768 2769 2770 sq = item.url; 2771 2772 2773 st = at; 2774 2775 2776 break; 2777 2778 2779 2780 2781 2782 case 'stumbleupon': 2783 2784 2785 var src = $('img',item.content).attr('src'); 2786 2787 2788 if(src && o.feed == 'favorites'){ 2789 2790 2791 html.push('<a href="'+item.link+'" class="thumb"><img src="'+src+'" alt="" /></a>'); 2792 2793 2794 } 2795 2796 2797 html.push(x+item.contentSnippet); 2798 2799 2800 break; 2801 2802 2803 2804 2805 2806 case 'instagram': 2807 2808 2809 d = parseInt(item.created_time * 1000,10); 2810 2811 2812 html.push('<a href="'+item.link+'" class="thumb"><img src="' + item.images[o.thumb].url + '" alt="" /></a>'); 2813 2814 2815 if(item.caption !=null){ 2816 2817 2818 html.push(item.caption.text); 2819 2820 2821 } 2822 2823 2824 if(item.comments.count > 0 && o.comments > 0){ 2825 2826 2827 i = 0; 2828 2829 2830 html.push('<span class="meta"><span class="comments">'+num(item.comments.count)+' comments</span></span>'); 2831 2832 2833 $.each(item.comments.data, function(i,cmt){ 2834 2835 2836 if(o.comments > i){ 2837 2838 2839 html.push('<span class="meta item-comments"><img src="'+cmt.from.profile_picture+'" />'+cmt.from.full_name+' - '+cmt.text+'</span>'); 2840 2841 2842 i++; 2843 2844 2845 } else { 2846 2847 2848 return false; 2849 2850 2851 } 2852 2853 2854 }); 2855 2856 2857 } 2858 2859 2860 if(item.likes.count > 0 && o.likes > 0){ 2861 2862 2863 i = 0; 2864 2865 2866 html.push('<span class="meta"><span class="likes">
2866'+num(item.likes.count)+' likes</span></span>'); 2867 2868 2869 html.push('<span class="meta item-likes">'); 2870 2871 2872 $.each(item.likes.data, function(i,lk){ 2873 2874 2875 if(o.likes > i){ 2876 2877 2878 html.push('<img src="'+lk.profile_picture+'" />'); 2879 2880 2881 i++; 2882 2883 2884 } else { 2885 2886 2887 return false; 2888 2889 2890 } 2891 2892 2893 }); 2894 2895 2896 html.push('</span>'); 2897 2898 2899 } 2900 2901 2902 st = item.caption !=null ? item.caption.text : '' ; 2903 2904 2905 break; 2906 2907 2908 2909 2910 2911 case 'google': 2912 2913 2914 var g = item.object.replies ? num(item.object.replies.totalItems) : 0, m = item.object.plusoners ? num(item.object.plusoners.totalItems) : 0, p = item.object.resharers ? num(item.object.resharers.totalItems) : 0, dl; 2915 2916 2917 d = item.published; 2918 2919 2920 dl = {src: "",imgLink: "",useLink: "",useTitle: ""}; 2921 2922 2923 var k = item.object.attachments; 2924 2925 2926 if (k) if (k.length){ 2927 2928 2929 for (var l = 0; l < k.length; l++) { 2930 2931 2932 var h = k[l]; 2933 2934 2935 if (h.image) { 2936 2937 2938 dl.src = h.image.url; 2939 2940 2941 dl.imgLink = h.url; 2942 2943 2944 if (h.fullImage) { 2945 2946 2947 dl.w = h.fullImage.width || 0; 2948 2949 2950 dl.h = h.fullImage.height || 0 2951 2952 2953 } 2954 2955 2956 } 2957 2958 2959 if (h.objectType == "article") dl.useLink = h.url; 2960 2961 2962 if (h.displayName) dl.useTitle = h.displayName 2963 2964 2965 } 2966 2967 2968 if (!dl.useLink) dl.useLink = dl.imgLink; 2969 2970 2971 var img_h = o.image_height ? o.image_height : 75 ; 2972 2973 2974 var img_w = o.image_width ? o.image_width : 75 ; 2975 2976 2977 if (dl.src.indexOf("resize_h") >= 0) dl.src = dl.w >= dl.h ? dl.src.replace(/resize_h=\d+/i, "resize_h=" + img_h) : dl.src.replace(/resize_h=\d+/i, "resize_w=" + img_w) 2978 2979 2980 } 2981 2982 2983 dl = dl; 2984 2985 2986 html.push((dl.src ? (dl.useLink ? '<a href="' + dl.useLink + '" class="thumb">' : '')+'<img src="' + dl.src + '" />'+(dl.useLink ? '</a>' : '') : '')); 2987 2988 2989 var t1 = px/(dl.w/dl.h) < px/3 ? ' clear' : '' ; 2990 2991 2992 html.push((dl.useLink ? '<a href="' + dl.useLink + '" class="title'+t1+'">' : '')+(item.title ? item.title : dl.useTitle)+(dl.useLink ? '</a>' : '')); 2993 2994 2995 if(o.shares){ 2996 2997 2998 html.push('<span class="meta"><span class="plusones">+1s '+m+'</span><span class="shares">'+p+'</span><span class="comments">'+g+'</span></span>'); 2999 3000 3001 } 3002 3003 3004 sq = dl.useLink; 3005 3006 3007 st = dl.useTitle; 3008 3009 3010 break; 3011 3012 3013 } 3014 3015 3016 if(share == true){ 3017 3018 3019 s = shareLink(st,sq,tweetId,type); 3020 3021 3022 html.push('<span class="section-share">'+s+'</span>'); 3023 3024 3025 } 3026 3027 3028 if(type == 'twitter'){ 3029 3030 3031 d = d != '' ? html.push('<span class="date"><a href="https://twitter.com/'+un+'/status/'+item.id_str+'">'+nicetime(new Date(d).getTime())+'</a></span></li>') : '' ; 3032 3033 3034 } else { 3035 3036 3037 d = d != '' ? html.push('<span class="date">'+nicetime(new Date(d).getTime())+'</span></li>') : '' ; 3038 3039 3040 } 3041 3042 3043 } 3044 3045 3046 }); 3047 3048 3049 } else { 3050 3051 3052 html.push('<li class="dcsmt-error">Error. '+error+'</li>'); 3053 3054 3055 } 3056 3057 3058 $(x).html(html.join('')); 3059 3060 3061 } 3062 3063 3064 }); 3065 3066 3067 }; 3068 3069 3070 3071 3072 3073 function getFrame(src,w,h){ 3074 3075 3076 html = '<iframe src="'+src+'" scrolling="no" frameborder="0" style="border: none; background: #fff; overflow: hidden; width: '+w+'px; height: '+h+'px;" allowTransparency="true"></iframe>'; 3077 3078 3079 return html; 3080 3081 3082 }; 3083 3084 3085 3086 3087 3088 function getLinkedIn(id,a,b,w){ 3089 3090 3091 id = a == 'JYMBII' ? 'data-companyid="'+id+'"' : 'data-id="'+id+'"' ; 3092 3093 3094 out = '<script type="IN/'+a+'" data-width="'+w+'" '+id+b+' data-format="inline"></script>'; 3095 3096 3097 return out; 3098 3099 3100 }; 3101 3102 3103 3104 3105 3106 function linkify(text){ 3107 3108 3109 text = text.replace( 3110 3111 3112 /((https?\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, 3113 3114 3115 function(url){ 3116 3117 3118 var full_url = !url.match('^https?:\/\/') ? 'http://' + url : url ; 3119 3120 3121 return '<a href="' + full_url + '">' + url + '</a>'; 3122 3123 3124 } 3125 3126 3127 ); 3128 3129 3130 text = text.replace(/(^|\s)@(\w+)/g, '$1@<a href="https://www.twitter.com/$2">$2</a>'); 3131 3132 3133 text = text.replace(/(^|\s)#(\w+)/g, '$1#<a href="https://twitter.com/search/%23$2">$2</a>'); 3134 3135 3136 return text; 3137 3138 3139 } 3140 3141 3142 3143 3144 3145 function parseTwitterDate(a){ 3146 3147 3148 var out = $.browser.msie ? a.replace(/(\+\S+) (.*)/, '$2 $1') : a ; 3149 3150 3151 return out; 3152 3153 3154 } 3155 3156 3157 3158 3159 3160 function stripHtml(v){ 3161 3162 3163 var $html = $(v); 3164 3165 3166 return $html.text(); 3167 3168 3169 } 3170 3171 3172 3173 3174 3175 function shareLink(st,sq,tweetId,type){ 3176 3177 3178 var s = ''; 3179 3180 3181 if(type == 'twitter'){ 3182 3183 3184 var intent = 'https://twitter.com/intent/'; 3185 3186 3187 s = '<a href="'+intent+'tweet?in_reply_to='+sq+'&via='+tweetId+'" class="share-reply"></a>'; 3188 3189 3190 s += '<a href="'+intent+'retweet?tweet_id='+sq+'&via='+tweetId+'" class="share-retweet"></a>'; 3191 3192 3193 s += '<a href="'+intent+'favorite?tweet_id='+sq+'" class="share-favorite"></a>'; 3194 3195 3196 } else { 3197 3198 3199 var sq = encodeURIComponent(sq), st = encodeURIComponent(st); 3200 3201 3202 s = '<a href="http://www.facebook.com/sharer.php?u='+sq+'&t='+st+'" class="share-facebook"></a>'; 3203 3204 3205 s += '<a href="https://twitter.com/share?url='+sq+'&text='+st+'&via='+tweetId+'" class="share-twitter"></a>'; 3206 3207 3208 s += '<a href="https://plus.google.com/share?url='+sq+'" class="share-google"></a>'; 3209 3210 3211 s += '<a href="http://www.linkedin.com/shareArticle?mini=true&url='+sq+'&title='+st+'" class="share-linkedin"></a>'; 3212 3213 3214 return s; 3215 3216 3217 } 3218 3219 3220 return s; 3221 3222 3223 } 3224 3225 3226 3227 3228 3229 function nicetime(a){ 3230 3231 3232 var d = Math.round((+new Date - a) / 1000), fuzzy = ''; 3233 3234 3235 var chunks = new Array(); 3236 3237 3238 chunks[0] = [60 * 60 * 24 * 365 , 'year', 'years']; 3239 3240 3241 chunks[1] = [60 * 60 * 24 * 30 , 'month', 'months']; 3242 3243 3244 chunks[2] = [60 * 60 * 24 * 7, 'week', 'weeks']; 3245 3246 3247 chunks[3] = [60 * 60 * 24 , 'day', 'days']; 3248 3249 3250 chunks[4] = [60 * 60 , 'hr', 'hrs']; 3251 3252 3253 chunks[5] = [60 , 'min', 'mins']; 3254 3255 3256 var i = 0, j = chunks.length; 3257 3258 3259 for (i = 0; i < j; i++) { 3260 3261 3262 s = chunks[i][0]; 3263 3264 3265 if ((xj = Math.floor(d / s)) != 0) 3266 3267 3268 { 3269 3270 3271 n = xj == 1 ? chunks[i][1] : chunks[i][2] ; 3272 3273 3274 break; 3275 3276 3277 } 3278 3279 3280 } 3281 3282 3283 fuzzy += xj == 1 ? '1 '+n : xj+' '+n ; 3284 3285 3286 if (i + 1 < j) { 3287 3288 3289 s2 = chunks[i + 1][0]; 3290 3291 3292 if ( ((xj2 = Math.floor((d - (s * xj)) / s2)) != 0) ) 3293 3294 3295 { 3296 3297 3298 n2 = (xj2 == 1) ? chunks[i + 1][1] : chunks[i + 1][2] ; 3299 3300 3301 fuzzy += (xj2 == 1) ? ' + 1 '+n2 : ' + '+xj2+' '+n2 ; 3302 3303 3304 } 3305 3306 3307 } 3308 3309 3310 fuzzy += ' ago'; 3311 3312 3313 return fuzzy; 3314 3315 3316 } 3317 3318 3319 3320 3321 3322 function num(a){ 3323 3324 3325 var b = a; 3326 3327 3328 if (a > 999999) b = Math.floor(a / 1E6) + "M"; 3329 3330 3331 else if (a > 9999) b = Math.floor(a / 1E3) + "K"; 3332 3333 3334 else if (a > 999) b = Math.floor(a / 1E3) + "," + a % 1E3; 3335 3336 3337 return b 3338 3339 3340 }; 3341 3342 3343 3344 3345 3346 function parseQ(url){ 3347 3348 3349 var v = [], hash, q = url.split('?')[1]; 3350 3351 3352 if(q != undefined){ 3353 3354 3355 q = q.split('&'); 3356 3357 3358 for(var i = 0; i < q.length; i++){ 3359 3360 3361 hash = q[i].split('='); 3362 3363 3364 v.push(hash[1]); 3365 3366 3367 v[hash[0]] = hash[1]; 3368 3369 3370 } 3371 3372 3373 } 3374 3375 3376 return v; 3377 3378 3379 }; 3380 3381 3382 3383 3384 3385 function ticker(s,b,speed){ 3386 3387 3388 var $a = $('li:last',s),$b = $('li:first',s),$gx; 3389 3390 3391 if(b == 'next'){ 3392 3393 3394 $gx = $a.clone().hide().css({opacity: 0}); 3395 3396 3397 $b.before($gx); 3398 3399 3400 $a.remove(); 3401 3402 3403 $gx.slideDown(speed,'linear',function(){ 3404 3405 3406 $(this).animate({opacity: 1},speed); 3407 3408 3409 }); 3410 3411 3412 } else { 3413 3414 3415 var bh = $b.outerHeight(true); 3416 3417 3418 $gx = $b.clone(); 3419 3420 3421 $b.animate({marginTop: -bh+'px',opacity: 0},speed,'linear',function(){ 3422 3423 3424 $a.after($gx); 3425 3426 3427 $b.remove(); 3428 3429 3430 }); 3431 3432 3433 } 3434 3435 3436 }; 3437 3438 3439 3440 3441 3442 function fbLink(id,obj){ 3443 3444 3445 var link = ''; 3446 3447 3448 jQuery.ajax({ 3449 3450 3451 url: 'https://graph.facebook.com/'+id, 3452 3453 3454 cache: true, 3455 3456 3457 dataType: 'jsonp', 3458 3459 3460 async: false, 3461 3462 3463 success: function(a){ 3464 3465 3466 obj.attr('href',a.link); 3467 3468 3469 } 3470 3471 3472 }); 3473 3474 3475 }; 3476 3477 3478 3479 3480 3481})(jQuery); 3482 3483 3484 3485 3486 3487jQuery(window).load(function(){ 3488 3489 3490 jQuery.getScript("//platform.twitter.com/widgets.js", function(){}); 3491 3492 3493});
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.