PageSourceSearch

https://consorziolarada.it/jquery-social-stream/js/jquery.social.stream.1.5.13.js

js consorziolarada.it collected 2026-10-05 01:04:20 UTC 42,523 bytes, 1,240 lines download raw bytes

1/*
2 * DC jQuery Social Stream
3 * Copyright (c) 2013 Design Chemical
4 * http://www.designchemical.com/blog/index.php/premium-jquery-plugins/jquery-social-stream-plugin/
5 * Version 1.5.13 (28-06-2015)
6 *
7 */
8 
9(function($){
10
11	SocialStreamObject = function(el, options) {
12		this.create(el, options);
13	};
14	
15	$.extend(SocialStreamObject.prototype, {
16		
17		version   : '1.5.13',
18		
19		create: function(el, options) {
20		
21			this.defaults = {
22				feeds: {
23					facebook: {
24						id: '',
25						intro: 'Posted',
26						out: 'intro,thumb,title,text,user,share',
27						text: 'content',
28						comments: 3,
29						image_width: 4, //3 = 600 4 = 480 5 = 320 6 = 180,
30						url: 'facebook.php',
31						feed: 'feed', // feed, posts
32						icon: 'facebook.png'
33					},
34					twitter: {
35						id: '',
36						intro: 'Tweeted',
37						search: 'Tweeted',
38						out: 'intro,thumb,text,share',
39						retweets: false,
40						replies: false,
41						images: '', // large w: 786 h: 346, thumb w: 150 h: 150, medium w: 600 h: 264, small w: 340 h 150
42						url: 'twitter.php',
43						icon: 'twitter.png'
44					},
45					google: {
46						id: '',
47						intro: 'Shared',
48						out: 'intro,thumb,title,text,share',
49						api_key: 'AIzaSyAWNgUpUj_W26tP3yev5Ysr4Zb53OIPgR4',
50						image_height: 75,
51						image_width: 75,
52						shares: true,
53						icon: 'google.png'
54					},
55					youtube: {
56						id: '',
57						intro: 'Uploaded',
58						search: 'Search',
59						out: 'intro,thumb,title,text,user,share',
60						text: 0,
61						api_key: 'AIzaSyB1zptnRspzltRVLGQJMBCH2yYujYp7ytI',
62						thumb: 'medium', //default 120 x 90, medium 320 x 180, high 480 x 360, standard 640 x 480
63						icon: 'youtube.png'
64					},
65					flickr: {
66						id: '',
67						intro: 'Uploaded',
68						out: 'intro,thumb,title,text,share',
69						lang: 'en-us',
70						icon: 'flickr.png'
71					},
72					delicious: {
73						id: '',
74						intro: 'Bookmarked',
75						out: 'intro,thumb,title,text,user,share',
76						icon: 'delicious.png'
77					},
78					pinterest: {
79						id: '',
80						intro: 'Pinned',
81						out: 'intro,thumb,text,user,share',
82						icon: 'pinterest.png'
83					},
84					rss: {
85						id: '',
86						intro: 'Posted',
87						out: 'intro,title,text,user,share',
88						text: 'contentSnippet',
89						icon: 'rss.png'
90					},
91					lastfm: {
92						id: '',
93						intro: 'Listened to,Loved,Replied',
94						out: 'intro,thumb,title,text,user,share',
95						feed: 'recenttracks,lovedtracks,replytracker',
96						icon: 'lastfm.png'
97					},
98					dribbble: {
99						id: '',
100						intro: 'Posted,Liked',
101						out: 'intro,thumb,title,text,user,share',
102						feed: 'shots,likes',
103						icon: 'dribbble.png'
104					},
105					vimeo: {
106						id: '',
107						intro: 'Liked,Video,Appeared In,Video,Album,Channel,Group',
108						out: 'intro,thumb,title,text,user,share',
109						feed: 'likes,videos,appears_in,all_videos,albums,channels,groups',
110						thumb: 'medium',
111						stats: true,
112						icon: 'vimeo.png'
113					},
114					stumbleupon: {
115						id: '',
116						intro: 'Shared,Reviewed',
117						out: 'intro,thumb,title,text,user,share',
118						feed: 'favorites,reviews',
119						icon: 'stumbleupon.png'
120					},
121					deviantart: {
122						id: '',
123						intro: 'Deviation',
124						out: 'intro,thumb,title,text,user,share',
125						icon: 'deviantart.png'
126					},
127					tumblr: {
128						id: '',
129						intro: 'Posted',
130						out: 'intro,title,text,user,share',
131						thumb: 100,
132						video: 250,
133						icon: 'tumblr.png'
134					},
135					instagram: {
136						id: '',
137					    intro: 'Posted',
138						search: 'Search',
139					    out: 'intro,thumb,text,user,share,meta',
140						accessToken: '',
141						redirectUrl: '',
142						clientId: '',
143						thumb: 'low_resolution',
144					    comments: 3,
145						likes: 8,
146						icon: 'instagram.png'
147					}
148				},
149				remove: '',
150				twitterId: '',
151				days: 5,
152				limit: 10,
153				max: 'days',
154				external: true,
155				speed: 600,
156				height: 550,
157				wall: false,
158				centre: false,
159				order: 'date',
160				filter: true,
161				controls: true,
162				rotate: {
163					direction: 'up',
164					delay: 8000
165				},
166				transition: '0.8s',
167				cache: true,
168				container: 'dcsns',
169				cstream: 'stream',
170				content: 'dcsns-content',
171				iconPath: 'images/dcsns-dark/',
172				imagePath: 'images/dcsns-dark/',
173				debug: false
174			};
175			
176			this.o = {}, this.timer_on = 0, this.id = 'dcsns-'+$(el).index(), this.timerId = '', this.o = $.extend(true,this.defaults,options), opt = this.o, $load = $('<div class="dcsns-loading">creating stream ...</div>');
177			
178			$(el).addClass(this.o.container).append('<div class="'+this.o.content+'"><ul class="'+this.o.cstream+'"></ul></div>');
179			
180			var $c = $('.'+this.o.content,el), $a = $('.'+this.o.cstream,el), $l = $('li',$a);
181
182			if(opt.height > 0 && opt.wall == false){
183				$c.css({height:opt.height+'px'});
184			}
185
186			if(this.o.filter == true || this.o.controls == true){
187				var x = '<div class="dcsns-toolbar">';
188				if(this.o.filter == true){
189					var fclass = this.o.center == true ? 'option-set filter dc-center' : 'option-set filter';
190					x += '<ul id="dcsns-filter" class="' + fclass + '">';
191					x += this.o.wall == true ? '<li><a href="#filter" data-group="dc-filter"  data-filter="*" class="selected link-all">all</a></li>' : '' ;
192					var $f = $('.filter',el);
193					$.each(opt.feeds, function(k,v){
194						x += v.id != '' ? '<li class="active f-'+k+'"><a href="#filter" rel="'+k+'" data-group="dc-filter" data-filter=".dcsns-'+k+'"><img src="'+opt.imagePath+opt.feeds[k].icon+'" alt="" /></a></li>' : '' ;
195					});
196					x += '</ul>';
197				}
198				if(this.o.controls == true && opt.wall == false){
199					var play = this.o.rotate.delay <= 0 ? '' : '<li><a href="#" class="play"></a></li>' ;
200					x += '<div class="controls"><ul>'+play+'<li><a href="#" class="prev"></a></li><li><a href="#" class="next"></a></li></ul></div>';
201				}
202				x += '</div>';
203				if(opt.wall == false){
204					$(el).append(x);
205				} else {
206					$(el).before(x);
207				}
208			}
209			
210			if(this.o.wall == true){
211				$('.dcsns-toolbar').append($load);
212				var w = $("#dcsns-filter.dc-center").width()/2;
213				$("#dcsns-filter.dc-center").css({'margin-left': -w + "px"}).fadeIn();
214				this.createwall($a);
215			} else {
216				$c.append($load);
217			}
218			
219			this.createstream(el,$a,0,opt.days);
220			
221			this.addevents(el,$a);
222			
223			if(this.o.rotate.delay > 0){
224				this.rotate(el);
225			}
226			
227			$load.remove();
228		},
229		
230		createstream: function(obj,s,f1,f2){
231			$.each(opt.feeds, function(k,v){
232				if(opt.feeds[k].id != ''){
233					var txt = [];
234					$.each(opt.feeds[k].intro.split(','), function(i,v){
235						v = $.trim(v);
236						txt.push(v);
237					});
238					$.each(opt.feeds[k].id.split(','), function(i,v){
239						v = $.trim(v);
240						if(opt.feeds[k].feed && v.split('#').length < 2){
241							if(k == 'youtube' && v.split('/').length > 1) {
242								getFeed(k,v,opt.iconPath,opt.feeds[k],obj,opt,f1,f2,'posted','',i);
243							} else {
244								$.each(opt.feeds[k].feed.split(','), function(i,feed){
245									getFeed(k,v,opt.iconPath,opt.feeds[k],obj,opt,f1,f2,txt[i],feed,i);
246								});
247							}
248						} else {
249							intro = v.split('#').length < 2 ? opt.feeds[k].intro : opt.feeds[k].search ;
250							getFeed(k,v,opt.iconPath,opt.feeds[k],obj,opt,f1,f2,intro,'',i);
251						}
252					});
253				}
254			});
255		},
256		
257		createwall: function(obj){
258				obj.isotope({
259					itemSelector : 'li.dcsns-li',
260					transitionDuration: opt.transition,
261					getSortData : {
262						postDate : function( itemElem ){
263							return parseInt($(itemElem).attr('rel'),10);
264						}
265					},
266					sortBy : 'postDate',
267					masonry: {
268						isFitWidth: opt.center
269					}
270				});
271		},
272		
273		addevents: function(obj,$a){
274			var self = this, speed = this.o.speed;
275			var $container = $('.stream',obj), filters = {}
276			$('.controls',obj).delegate('a','click',function(){
277				var x = $(this).attr('class');
278				switch(x)
279				{
280					case 'prev':
281					self.pauseTimer();
282					ticker($a,'prev',speed);
283					break;
284					case 'next':
285					self.pauseTimer();
286					ticker($a,'next',speed);
287					break;
288					case 'play':
289					self.rotate(obj);
290					$('.controls .play').removeClass('play').addClass('pause');
291					break;
292					case 'pause':
293					self.pauseTimer();
294					break;
295				}
296				return false;
297			});
298			$('.filter',obj).delegate('a','click',function(){
299				if(opt.wall == false){
300					var rel = $(this).attr('rel');
301					if($(this).parent().hasClass('active')){
302						$('.dcsns-'+rel,$a).slideUp().addClass('inactive');
303						$(this).parent().animate({opacity: 0.3},400);
304					} else {
305						$('.dcsns-'+rel,$a).slideDown().removeClass('inactive');
306						$(this).parent().animate({opacity: 1},400);
307					}
308					$(this).parent().toggleClass('active');
309				}
310				return false;
311			});
312			if(this.o.external){
313				$a.delegate('a','click',function(){
314					if(!$(this).parent().hasClass('section-share')){
315						this.target = '_blank';
316					}
317				});
318			}
319		},
320		rotate: function(a){
321			var self = this, stream = $('.'+this.o.cstream,a), speed = this.o.speed, delay = this.o.rotate.delay, r = this.o.rotate.direction == 'up' ? 'prev' : 'next' ;
322			this.timer_on = 1;
323			$('.controls .play').removeClass('play').addClass('pause');
324			this.timerId = setTimeout(function(){
325				ticker(stream,r,speed);
326				self.rotate(a);
327			}, delay);
328		},
329		pauseTimer: function(){
330			clearTimeout(this.timerId);
331			this.timer_on = 0;
332			$('.controls .pause').removeClass('pause').addClass('play');
333		}
334	});
335	
336	$.fn.dcSocialStream = function(options, callback){
337		var d = {};
338		this.each(function(){
339			var s = $(this);
340			d = s.data("socialtabs");
341			if (!d){
342				d = new SocialStreamObject(this, options, callback);
343				s.data("socialtabs", d);
344			}
345		});
346		return d;
347	};
348	
349	function getFeed(type,id,path,o,obj,opt,f1,f2,intro,feed,fn){
350	
351		var stream = $('.stream',obj), list = [],d = '', px = 300, c = [],data, href, url, n = opt.limit, txt = [], src;
352		frl = 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num='+n+'&callback=?&q=';
353		
354		switch (type) {
355			
356			case 'facebook':
357			var cp = id.split('/');
358			var curl = o.url.replace(/\&#038;/gi, "&");
359			url = url = cp.length > 1 ? 'https://graph.facebook.com/'+cp[1]+'/photos?fields=id,link,from,name,picture,images,comments&limit='+n : curl + '?id='+id+'&limit='+n+'&feed='+o.feed;
360			break;
361			
362			case 'twitter':
363			var curl = o.url.replace(/\&#038;/gi, "&");
364			var cp = id.split('/'), cq = id.split('#'), cu = o.url.split('?'), replies = o.replies == true ? '&exclude_replies=false' : '&exclude_replies=true' ;
365			var param = '&include_entities=true&include_rts='+o.retweets+replies;
366			url1 = cu.length > 1 ? curl + '&' : curl + '?';
367			url = cp.length > 1 ? url1 + 'url=list&list_id='+cp[1]+'&per_page='+n+param : url1 + 'url=timeline&screen_name='+id+'&count='+n+param;
368			if(cq.length > 1){
369				var rts = o.retweets == false ? '+exclude:retweets' : '' ;
370				url = url1 + 'url=search&q='+cq[1]+'&count='+n;
371			}
372			break;
373
374			case 'google': 
375			n = n > 100 ? 100 : n ;
376			href = 'https://plus.google.com/'+id;
377			url = 'https://www.googleapis.com/plus/v1/people/'+id+'/activities/public';
378			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)"};
379			break;
380
381			case 'youtube': 
382			n = n > 50 ? 50 : n ;
383			var cp = id.split('/'), cq = decodeURIComponent(id).split('#'), cc = id.split('!');
384			if(cq.length > 1){
385				url = 'https://www.googleapis.com/youtube/v3/search?part=snippet&key=' + o.api_key + '&pageToken=&order=date&maxResults=' + n + '&q=' + cq[1];
386				href = 'https://www.youtube.com/results?search_query=' + cq[1];
387			} else {
388				if(cc.length > 1){
389					id = cc[1];
390					id = 'UU' + cc[1].substring(2);
391					href = 'https://www.youtube.com/channel/UC' + id.substring(2);
392				} else {
393					id = cp.length > 1 ? cp[1] : id ;
394					if(id.substr(0,2) != 'UU'){
395						if(id.substr(0,2) != 'UC'){
396							// is playlist ID
397							href = 'https://www.youtube.com/playlist?list=' + id;
398						} else {
399							// is channel ID
400							href = 'https://www.youtube.com/channel/' + id;
401							id = 'UU' + id.substring(2);
402						}
403					} else {
404						// is list ID
405						href = 'https://www.youtube.com/channel/UC' + id.substring(2);
406					}
407				}
408				url = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=' + id + '&key=' + o.api_key + '&pageToken=&maxResults=' + n;
409			}
410			break;
411			
412			case 'flickr':
413			var cq = id.split('/'), fd = cq.length > 1 ? 'groups_pool' : 'photos_public' ;
414			id = cq.length > 1 ? cq[1] : id ;
415			href = 'https://www.flickr.com/photos/'+id;
416			url = 'https://api.flickr.com/services/feeds/'+fd+'.gne?id='+id+'&lang='+o.lang+'&format=json&jsoncallback=?';
417			break;
418			
419			case 'delicious':
420			href = 'https://www.delicious.com/'+id;
421			url = 'http://feeds.delicious.com/v2/json/'+id;
422			break;
423			
424			case 'pinterest':
425			var cp = id.split('/');
426			url = 'https://www.pinterest.com/'+id+'/';
427			url += cp.length > 1 ? 'rss' : 'feed.rss';
428			href = 'http://www.pinterest.com/'+id;
429			url = frl + encodeURIComponent(url);
430			break;
431			
432			case 'rss':
433			href = id;
434			url = frl + encodeURIComponent(id);
435			break;
436			
437			case 'lastfm':
438			href = 'https://www.last.fm/user/'+id;
439			var ver = feed == 'lovedtracks' ? '2.0' : '1.0' ;
440			url = frl + encodeURIComponent('https://ws.audioscrobbler.com/'+ver+'/user/'+id+'/'+feed+'.rss');
441			break;
442			
443			case 'dribbble':
444			href = 'https://www.dribbble.com/'+id;
445			url = feed == 'likes' ? 'http://api.dribbble.com/players/'+id+'/shots/likes' : 'http://api.dribbble.com/players/'+id+'/shots' ;
446			break;
447			
448			case 'vimeo':
449			href = 'https://www.vimeo.com/'+id;
450			url = 'https://vimeo.com/api/v2/'+id+'/'+feed+'.json';
451			break;
452			
453			case 'stumbleupon':
454			href = 'https://www.stumbleupon.com/stumbler/'+id;
455			url = frl + encodeURIComponent('http://rss.stumbleupon.com/user/'+id+'/'+feed);
456			break;
457			
458			case 'deviantart':
459			href = 'https://'+id+'.deviantart.com';
460			url = frl + encodeURIComponent('https://backend.deviantart.com/rss.xml?type=deviation&q=by%3A'+id+'+sort%3Atime+meta%3Aall');
461			break;
462			
463			case 'tumblr':
464			href = 'http://'+id+'.tumblr.com';
465			url = 'http://'+id+'.tumblr.com/api/read/json?callback=?&num='+n;
466			break;
467			
468			case 'instagram':
469			href = '#';
470			url = 'https://api.instagram.com/v1';
471			var cp = id.substr(0,1), cq = id.split(cp), url1 = cq[1], qs = '', ts = 0;
472			switch(cp)
473			{
474				case '?':
475				var p = cq[1].split('/');
476				qs = '&lat='+p[0]+'&lng='+p[1]+'&distance='+p[2];
477				url += '/media/search';
478				break;
479				case '#':
480				url += '/tags/'+url1+'/media/recent';
481				ts = 1;
482				break;
483				case '!':
484				url += '/users/'+url1+'/media/recent';
485				break;
486				case '@':
487				url += '/locations/'+url1+'/media/recent';
488				break;
489			}
490			if(o.accessToken == '' && ts == 0){
491				if (location.hash) {
492					o.accessToken = location.hash.split('=')[1] ;
493				} else {
494					location.href="https://instagram.com/oauth/authorize/?client_id="+o.clientId+"&redirect_uri="+o.redirectUrl+"&response_type=token"; 
495				}
496			}
497			url += '?access_token='+o.accessToken+'&client_id='+o.clientId+'&count='+n+qs;
498			break;
499		}
500		var dataType = type == 'twitter' || type == 'facebook' ? 'json' : 'jsonp';
501		jQuery.ajax({
502			url: url,
503			data: data,
504			cache: opt.cache,
505			dataType: dataType,
506			success: function(a){
507				var error = '';
508				switch(type)
509				{
510					case 'facebook':
511						if(cp.length > 1){
512							a = a.data;
513						} else {
514							a = a.responseData.feed.entries;
515						}
516					break;
517					case 'google':
518						error = a.error ? a.error : '' ;
519						a = a.items;
520					break;
521					case 'flickr':
522						a = a.items;
523					break;
524					case 'instagram':
525						a = a.data;
526					break;
527					case 'twitter':
528						error = a.errors ? a.errors : '' ;
529						if(cq.length > 1){a = a.statuses} ;
530					break;
531					case 'youtube':
532						a = a.items;
533					break;
534					case 'dribbble':
535						a = a.shots;
536					break;
537					case 'tumblr':
538						a = a.posts;
539					break;
540					case 'delicious':
541					break;
542					case 'vimeo':
543					break;
544					case 'rss':
545						if(a.responseStatus == 200){
546							id = a.responseData.feed.title ? a.responseData.feed.title : id ;
547							a = a.responseData.feed.entries;
548						} else {
549							error = a.responseDetails;
550						}
551					break;
552					default:
553						if(a.responseStatus == 200){
554							a = a.responseData.feed.entries;
555						} else {
556							error = a.responseDetails;
557						}
558					break;
559				}
560				if(error == ''){
561					$.each(a, function(i,item){
562						if(i < n){
563							var html = [], q = item.link, u='<a href="'+href+'">'+id+'</a>', w='', x = '<a href="'+q+'">'+item.title+'</a>', y='', z='', zz='', m='', d = item.publishedDate, sq = q, st = item.title, s = '';
564							switch(type)
565							{
566								case 'facebook':
567								if(cp.length > 1){
568									id = item.from.id;
569									var d = new Date();
570									d = d.setFbAlbum(item.created_time);
571									var set = parseQ(item.link);
572									st = cp[0] != '' ? cp[0] : item.from.name ;
573									u = '<a href="'+item.link+'">'+st+'</a>';
574									x = '';
575									if(item.images[o.image_width] == undefined){o.image_width = 0;}
576									z = '<a href="'+item.link+'"><img src="'+item.images[o.image_width].source+'" alt="" /></a>';
577									if(item.name){
578										z +='<p>
578'+item.name+'</p>';
579									}
580									if(o.comments > 0 && item.comments){
581										i = 0;
582										m += '<span class="meta"><span class="comments">comments</span></span>';
583										$.each(item.comments.data, function(i,cmt){
584											if(o.comments > i){
585												m += '<span class="meta item-comments"><a href="https://facebook.com/'+cmt.from.id+'">'+cmt.from.name+'</a>'+cmt.message+'</span>';
586												i++;
587											} else {
588												return false;
589											}
590										});
591									}
592									z += m;
593								} else {
594									x = '';
595									thumb = item.thumb;
596									if(thumb != null)
597									{
598										if(thumb.indexOf('safe_image.php') != -1) {
599											thumb = unescape(thumb.match(/url=([^&]+)/)[1]);
600										} 
601										y = '<a href="'+q+'"><img src="'+thumb+'" alt="" /></a>';
602									}
603									u = '<a href="'+item.pageLink+'">'+item.pageName+'</a>';
604									href = item.pageLink;
605									z = linkify(item.content);
606									st = item.content;
607								}
608								break;
609								
610								case 'twitter':
611								d = parseTwitterDate(item.created_at);
612								var un = item.user.screen_name, ua = item.user.profile_image_url_https ;
613								href = 'https://www.twitter.com/'+un;
614								q = href;
615								y = '<a href="'+q+'" class="thumb"><img src="'+ua+'" alt="" /></a>' ;
616								z = '<span class="twitter-user"><a href="https://www.twitter.com/'+un+'"><strong>'+item.user.name+' </strong>@'+un+'</a></span>';
617								z += linkify(item.text);
618								if(o.images != '' && item.entities.media){
619									$.each(item.entities.media, function(i,media){
620										z += '<a href="'+media.media_url_https+'"><img src="'+media.media_url_https+':'+o.images+'" alt="" /></a>';
621									});
622								}
623								sq = item.id_str;
624								break;
625								
626								case 'delicious':
627								var d = new Date();
628								d = d.setRFC3339(item.dt);
629								x = '<a href="'+item.u+'">'+item.d+'</a>';
630								q = item.u;
631								z = item.n;
632								sq = item.u;
633								st = item.d;
634								break;
635								
636								case 'rss':
637								z = item[o.text];
638								break;
639								
640								case 'pinterest':
641								var src = $('img',item.content).attr('src');
642								y = src ? '<a href="'+q+'"><img src="'+src+'" alt="" /></a>' : '' ;
643								z = item.contentSnippet;
644								st = z;
645								break;
646
647								case 'youtube':
648								x =	item.snippet.title;
649								var vidId = cq.length > 1 ? item.id.videoId : item.snippet.resourceId.videoId ;
650								var ytthumb = o.thumb == '0' ? 'medium' : o.thumb ;
651								q = 'https://www.youtube.com/watch?v='+vidId+'&feature=youtube_gdata';
652								sq = q;
653								y = '<a href="'+q+'" title="'+item.snippet.title+'"><img src="'+item.snippet.thumbnails[ytthumb].url+'" alt="" /></a>';
654								z = o.text > 0 ? cut(item.snippet.description,o.text) : item.snippet.description ;
655								d = item.snippet.publishedAt;
656								var profile = 'Youtube';
657								if(cq.length > 1){
658									profile = decodeURIComponent(id);
659								} else if(cp.length > 1){
660									profile = cp[0];
661								} else if(cc.length > 1){
662									profile = cc[0];
663								}
664								u='<a href="'+href+'">'+profile+'</a>';
665								break;
666								
667								case 'flickr':
668								d = parseTwitterDate(item.published);
669								x =	item.title;
670								y = '<a href="' + q + '" title="'+ item.title +'"><img src="' + item.media.m + '" alt="" /></a>';
671								break;
672								
673								case 'lastfm':
674								q = item.content;
675								break;
676								
677								case 'dribbble':
678								q = item.url;
679								d = item.created_at;
680								x = '<a href="'+q+'">'+item.title+'</a>';
681								y = '<a href="'+q+'"><img src="' + item.image_teaser_url + '" alt="' + item.title + '" /></a>';
682								z = '<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>';
683								sq = item.url;
684								break;
685								
686								case 'instagram':
687								d = parseInt(item.created_time * 1000,10);
688								x = '';
689								y = '<a href="'+ q +'"><img src="' + item.images[o.thumb].url + '" alt="" /></a>';
690								z = item.caption !=null ? htmlEncode(item.caption.text) : '' ;
691								if(item.comments.count > 0 && o.comments > 0){
692									i = 0;
693									m += '<span class="meta"><span class="comments">'+num(item.comments.count)+' comments</span></span>';
694									$.each(item.comments.data, function(i,cmt){
695										if(o.comments > i){
696											m += '<span class="meta item-comments"><img src="'+cmt.from.profile_picture+'" />';
697											m += cmt.from.full_name+' - '+cmt.text+'</span>';
698											i++;
699										} else {
700											return false;
701										}
702									});
703								}
704								if(item.likes.count > 0 && o.likes > 0){
705									i = 0;
706									m += '<span class="meta"><span class="likes">'+num(item.likes.count)+' likes</span></span>';
707									m += '<span class="meta item-likes">';
708									$.each(item.likes.data, function(i,lk){
709										if(o.likes > i){
710											m += '<img src="'+lk.profile_picture+'" />';
711											i++;
712										} else {
713											return false;
714										}
715									});
716									m += '</span>';
717								}
718								u = '<a href="'+q+'">'+item.user.username+'</a>';
719								href = 'https://instagram.com/'+item.user.username;
720								st = item.caption !=null ? item.caption.text : '' ;
721								break;
722
723								case 'vimeo':
724								f = feed, at = item.name, tx = item.description, q = item.url;
725								if(f == 'channels'){
726									y = item.logo != '' ? '<a href="'+q+'" class="logo"><img src="'+item.logo+'" alt="" width="'+px+'" /></a>' : '' ;
727								} else if(f == 'groups'){
728									y = '<a href="'+q+'"><img src="'+item.thumbnail+'" alt="" /></a>';
729								} else {
730									var thumb = 'thumbnail_'+o.thumb, at = item.title, tx = f != 'albums' ? item.duration+' secs' : item.description ;
731									y = '<a href="'+item.url+'" title="'+at+'"><img src="'+item[thumb]+'" alt="" /></a>';
732								}
733								x = '<a href="'+q+'">'+at+'</a>';
734								z = tx;
735								if(o.stats == true){
736									var m = '';
737									m += f == 'albums' || f == 'channels' || f == 'groups' ? '<span class="videos">'+num(item.total_videos)+'</span>' : '' ;
738									if(f == 'channels'){
739										m += '<span class="users">'+num(item.total_subscribers)+'</span>';
740									} else if(f == 'groups'){
741										m += '<span class="users">'+num(item.total_members)+'</span>';
742									} else if(f != 'albums'){
743										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>';
744									}
745									z += '<span class="meta">'+m+'</span>';
746								}
747								var dt = item.upload_date;
748								if(f == 'likes'){
749									dt = item.liked_on;
750								} else if(f == 'albums' || f == 'channels' || f == 'groups'){
751									dt = item.created_on;
752								}
753								var d = new Date();
754								d = d.setVimeo(dt);
755								sq = q;
756								st = at;
757								break;	
758								
759								case 'stumbleupon':
760								var src = $('img',item.content).attr('src');
761								y = src != '' && feed == 'favorites' ? '<a href="'+q+'"><img src="'+src+'" alt="" /></a>' : '' ;
762								z = item.contentSnippet;
763								break;
764								
765								case 'deviantart':
766								var src = $('img',item.content).attr('src');
767								y = src ? '<a href="'+q+'"><img src="'+src+'" alt="" /></a>' : '' ;
768								z = item.contentSnippet;
769								break;
770								
771								case 'tumblr':
772								q = item['url-with-slug'];
773								d = item.date;
774								x = '<a href="'+q+'">';
775								switch(item.type)
776								{
777									case 'photo':
778									x = item['photo-caption'];
779									z = '<a href="'+q+'"><img src="'+item['photo-url-'+o.thumb]+'" alt="" /></a>';
780									st = x;
781									break;
782									case 'video':
783									x += item['video-caption'];
784									z = o.video != '400' ? item['video-player-'+o.video] : item['video-player'] ;
785									st = x;
786									break;
787									case 'regular':
788									x += item['regular-title'];
789									z = item['regular-body'];
790									st = x;
791									break;
792									case 'quote':
793									x += item['quote-source'];
794									z = item['quote-text'];
795									st = x;
796									break;
797									case 'audio':
798									x = item['id3-artist'] ? '<a href="'+q+'">'+item['id3-artist']+' - '+item['id3-album']+'</a>' : '' ;
799									x += item['id3-title'] ? '<a href="'+q+'" class="track">'+item['id3-title']+'</a>' : '' ;
800									z = item['audio-caption'];
801									z += item['audio-player'];
802									st = item['id3-artist']+' - '+item['id3-album']+' - '+item['id3-title'];
803									break;
804									case 'conversation':
805									x += item['conversation-title'];
806									z = item['conversation-text'];
807									st = x;
808									break;
809									case 'link':
810									var ltxt = item['link-text'].replace(/:/g, '').replace(/\?/g, '').replace(/\!/g, '').replace(/\./g, '').replace(/\'/g, '').replace(/\(/g, '').replace(/\)/g, '').replace(/\@/g, '').replace(/\#/g, '').replace(/\|/g, '').replace(/\&/g, '');
811									x = '<a href="'+item['link-url']+'">'+ltxt+'</a>';
812									z = item['link-description'];
813									st = ltxt;
814									break;
815								}
816								x += item.type != 'photo' || item.type != 'audio' ? '</a>' : '' ;
817								st = stripHtml(st);
818								sq = q;
819								break;
820								
821								case 'google':
822								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;
823								var d = new Date();
824								d = d.setRFC3339(item.published);
825								dl = {src: "",imgLink: "",useLink: "",useTitle: ""};
826								var k = item.object.attachments;
827								if (k) if (k.length){
828									for (var l = 0; l < k.length; l++) {
829										var h = k[l];
830										if (h.image) {
831											dl.src = h.image.url;
832											dl.imgLink = h.url;
833											if (h.fullImage) {
834												dl.w = h.fullImage.width || 0;
835												dl.h = h.fullImage.height || 0
836											}
837										}
838										if (h.objectType == "article") dl.useLink = h.url;
839										if (h.displayName) dl.useTitle = h.displayName
840									}
841									if (!dl.useLink) dl.useLink = dl.imgLink;
842									var img_h = o.image_height ? o.image_height : 75 ;
843									var img_w = o.image_width ? o.image_width : 75 ;
844									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)
845								}
846								dl = dl;
847								q = dl.useLink;
848								y = (dl.src ? (dl.useLink ? '<a href="' + dl.useLink + '">' : '')+'<img src="' + dl.src + '" />'+(dl.useLink ? '</a>' : '') : '');
849								var t1 = px/(dl.w/dl.h) < px/3 ? ' class="clear"' : '' ;
850								x = (dl.useLink ? '<a href="' + dl.useLink + '"'+t1+'>' : '')+(item.title ? item.title : dl.useTitle)+(dl.useLink ? '</a>' : '');
851								if(o.shares){
852									z = '<span class="meta"><span class="plusones">+1s '+m+'</span><span class="shares">'+p+'</span><span class="comments">'+g+'</span></span>';
853								}
854								sq = q;
855								st = dl.useTitle;
856								break;
857							}
858							
859							icon = '<a href="'+href+'"><img src="'+path+o.icon+'" alt="" class="icon" /></a>';
860
861							if(type == 'twitter'){
862								var intent = 'https://twitter.com/intent/';
863								s = '<a href="'+intent+'tweet?in_reply_to='+sq+'&via='+opt.twitterId+'" class="share-reply"></a>';
864								s += '<a href="'+intent+'retweet?tweet_id='+sq+'&via='+opt.twitterId+'" class="share-retweet"></a>';
865								s += '<a href="'+intent+'favorite?tweet_id='+sq+'" class="share-favorite"></a>';
866								s += share('','https://twitter.com/'+un+'/status/'+sq,opt.twitterId);
867							} else {
868								s = share(st,sq,opt.twitterId);
869							}
870
871							$.each(o.out.split(','), function(i,v){
872								
873								zz += v != 'intro' ? '<span class="section-'+v+'">' : '' ;
874								switch(v)
875								{
876									case 'intro':
877									if(type == 'twitter'){
878										zintro = '<span class="section-'+v+'"><a href="'+q+'">'+decodeURIComponent(intro)+'</a> <span><a href="https://twitter.com/'+un+'/status/'+item.id_str+'">'+nicetime(new Date(d).getTime(),0)+'</a></span></span>';
879									} else {
880										zintro = '<span class="section-'+v+'"><a href="'+q+'">'+decodeURIComponent(intro)+'</a> <span>'+nicetime(new Date(d).getTime(),0)+'</span></span>';
881									}
882									break;
883									case 'title':
884									zz += x;
885									break;
886									case 'thumb':
887									if(type == 'rss'){
888										var src = item.content.indexOf("img") >= 0 ? $('img',item.content).attr('src') : '' ;
889										y = src ? '<a href="'+q+'" class="thumb"><img src="'+src+'" alt="" /></a>' : '' ;
890									}
891									zz += y;
892									break;
893									case 'text':
894									zz += z;
895									break;
896									case 'user':
897									zz += u;
898									break;
899									case 'meta':
900									zz += m;
901									break;
902									case 'share':
903									zz += s;
904									break;
905								}
906								zz += v != 'intro' ? '</span>' : '' ;
907							});
908							
909							var df = type == 'instagram' ? nicetime(d,1) : nicetime(new Date(d).getTime(),1);
910							var ob = df;
911							switch(opt.order)
912							{
913								case 'random':
914								ob = randomish(6);
915								break;
916								case 'none':
917								ob = 1;
918								break;
919							}
920							var out = '<li rel="'+ob+'" class="dcsns-li dcsns-'+type+' dcsns-feed-'+fn+'">'+w+'<div class="inner">'+zz+'<span class="clear"></span></div>'+zintro+icon+'</li>', str = decodeURIComponent(opt.remove), rem = q;
921							if(type == 'twitter'){
922								rem = 'https://twitter.com/'+un+'/status/'+item.id_str;
923							}
924							if( str.indexOf( rem ) !== -1 && rem != '' ){
925								n = n + 1;
926							} else {
927								if(opt.max == 'days'){
928									if(df <= f2 * 86400 && df >= f1 * 86400){
929										list.push(out);
930									} else if(df > f2 * 86400) {
931										return false;
932									}
933								} else {
934									list.push(out);
935								}
936							}
937						}
938					});
939				} else if(opt.debug == true){
940					list.push('<li class="dcsns-li dcsns-error">Error. '+error+'</li>');
941				}
942			},
943			complete: function(){
944				var $newItems = $(list.join(''));
945				if(opt.wall == true){
946					stream.isotope( 'insert', $newItems );	
947					if(type == 'facebook' && cp.length < 2){
948						setTimeout(function(){
949							stream.isotope('layout');
950						},1000);
951						$('img',stream).on('load', function(){ stream.isotope('layout'); });
952					}
953					if(type == 'twitter'){
954						setTimeout(function(){
955							stream.isotope('layout');
956						},1000);
957						$('img',stream).on('load', function(){ stream.isotope('layout'); });
958					}
959				} else {
960					stream.append($newItems);
961					sortstream(stream,'asc');
962				}
963				if(type == 'flickr' && cq.length > 1){
964					flickrHrefLink(cq[1],$newItems);
965				}
966			}
967			
968		});
969		return;
970	}
971
972	function linkify(text){
973		text = text.replace(
974			/((https?\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi,
975			function(url){
976				var full_url = !url.match('^https?:\/\/') ? 'http://' + url : url ;
977				return '<a href="' + full_url + '">' + url + '</a>';
978			}
979		);
980		text = text.replace(/(^|\s)@(\w+)/g, '$1@<a href="http://www.twitter.com/$2">$2</a>');
981		text = text.replace(/(^|\s)#(\w+)/g, '$1#<a href="http://twitter.com/search/%23$2">$2</a>');
982		return text;
983	}
984	
985	function cut(text,n){
986		var short = text.substr(0, n);
987		if (/^\S/.test(text.substr(n)))
988		short = short.replace(/\s+\S*$/, "");
989		return short;
990	}
991	
992	function htmlEncode(v){
993		return $('<div/>').text(v).html();
994	}
995	
996	function stripHtml(v){
997		var $html = $(v);
998		return $html.text();
999	}
1000
1001	Date.prototype.setRFC3339 = function(dString){
1002	   var utcOffset, offsetSplitChar;
1003	   var offsetMultiplier = 1;
1004	   var dateTime = dString.split('T');
1005	   var date = dateTime[0].split('-');
1006	   var time = dateTime[1].split(':');
1007	   var offsetField = time[time.length - 1];
1008	   var offsetString;
1009	   offsetFieldIdentifier = offsetField.charAt(offsetField.length - 1);
1010	   if (offsetFieldIdentifier == 'Z') {
1011		  utcOffset = 0;
1012		  time[time.length - 1] = offsetField.substr(0, offsetField.length - 2);
1013	   } else {
1014		  if (offsetField[offsetField.length - 1].indexOf('+') != -1) {
1015			 offsetSplitChar = '+';
1016			 offsetMultiplier = 1;
1017		  } else {
1018			 offsetSplitChar = '-';
1019			 offsetMultiplier = -1;
1020		  }
1021		  offsetString = offsetField.split(offsetSplitChar);
1022		  time[time.length - 1] == offsetString[0];
1023		  offsetString = offsetString[1].split(':');
1024		  utcOffset = (offsetString[0] * 60) + offsetString[1];
1025		  utcOffset = utcOffset * 60 * 1000;
1026	   }
1027	   this.setTime(Date.UTC(date[0], date[1] - 1, date[2], time[0], time[1], time[2]) + (utcOffset * offsetMultiplier ));
1028	   return this;
1029	};
1030	
1031	Date.prototype.setFbAlbum = function(dString){
1032	   var utcOffset, offsetSplitChar = '+', offsetMultiplier = 1, dateTime = dString.split('T'), date = dateTime[0].split('-'), time = dateTime[1].split(':'), offsetField = time[time.length - 1], offsetString;
1033		  if (offsetField[offsetField.length - 1].indexOf('+') != -1) {
1034			 offsetSplitChar = '-';
1035			 offsetMultiplier = -1;
1036		  }
1037		  offsetTime = offsetField.split(offsetSplitChar);
1038		  utcOffset = parseInt((offsetTime[1]/100),10) * 60 * 1000;
1039	   this.setTime(Date.UTC(date[0], date[1] - 1, date[2], time[0], time[1], offsetTime[0]) + (utcOffset * offsetMultiplier ));
1040	   return this;
1041	};
1042	
1043	Date.prototype.setVimeo = function(dString){
1044	   var utcOffset = 0, offsetSplitChar, offsetMultiplier = 1;
1045	   var dateTime = dString.split(' ');
1046	   var date = dateTime[0].split('-');
1047	   var time = dateTime[1].split(':');
1048	   this.setTime(Date.UTC(date[0], date[1] - 1, date[2], time[0], time[1], time[2]) + (utcOffset * offsetMultiplier ));
1049	   return this;
1050	};
1051
1052	function parseTwitterDate(a){
1053		var out = !!navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.indexOf("MSIE")>= 0 ? a.replace(/(\+\S+) (.*)/, '$2 $1') : a ; 
1054		return out;
1055	}
1056	
1057	function nicetime(a,out){
1058        var d = Math.round((+new Date - a) / 1000), fuzzy = '', n = 'mins';
1059        if(out == 1) {
1060            return d;
1061        } else if(out == 0) {
1062            var chunks = new Array();
1063                    chunks[0] = [60 * 60 * 24 * 365 , 'year', 'years'];
1064                    chunks[1] = [60 * 60 * 24 * 30 , 'month', 'months'];
1065                    chunks[2] = [60 * 60 * 24 * 7, 'week', 'weeks'];
1066                    chunks[3] = [60 * 60 * 24 , 'day', 'days'];
1067                    chunks[4] = [60 * 60 , 'hr', 'hrs'];
1068                    chunks[5] = [60 , 'min', 'mins'];
1069                    var i = 0, j = chunks.length;
1070                    for (i = 0; i < j; i++) {
1071                        s = chunks[i][0];
1072                        if ((xj = Math.floor(d / s)) != 0)
1073                        {
1074                            n = xj == 1 ? chunks[i][1] : chunks[i][2] ;
1075                            break;
1076                        }
1077                    }
1078                    fuzzy += xj == 1 ? '1 '+n : xj+' '+n ;
1079                    if (i + 1 < j) {
1080                        s2 = chunks[i + 1][0];
1081                        if ( ((xj2 = Math.floor((d - (s * xj)) / s2)) != 0) )
1082                        {
1083                            n2 = (xj2 == 1) ? chunks[i + 1][1] : chunks[i + 1][2] ;
1084                            fuzzy += (xj2 == 1) ? ' + 1 '+n2 : ' + '+xj2+' '+n2 ;
1085                        }
1086                    }
1087					fuzzy += ' ago';
1088            return fuzzy;
1089            }
1090        }
1091
1092		function num(a){
1093            var b = a;
1094            if (a > 999999) b = Math.floor(a / 1E6) + "M";
1095            else if (a > 9999) b = Math.floor(a / 1E3) + "K";
1096            else if (a > 999) b = Math.floor(a / 1E3) + "," + a % 1E3;
1097            return b
1098        }
1099		
1100		function parseQ(url){
1101			var v = [], hash, q = url.split('?')[1];
1102			if(q != undefined){
1103				q = q.split('&');
1104				for(var i = 0; i < q.length; i++){
1105					hash = q[i].split('=');
1106					v.push(hash[1]);
1107					v[hash[0]] = hash[1];
1108				}
1109			}
1110			return v;
1111		}
1112		
1113		function getImg(content){
1114			var imgArr = new Array(), reg = /<img .*?src=["\']([^ ^"^\']*)["\']/gi, check, image;
1115			while (check = reg.exec(content)){
1116				imgArr.push(check[1]);
1117			}
1118			if(imgArr.length > 0 && imgArr[0].indexOf('sndcdn.com') === -1){
1119				var image = imgArr[0];
1120				if(image.indexOf('instagram.com/profiles') !== -1) { image = imgArr[1]; }
1121				image = image.replace("_m.jpg", ".jpg");
1122				if(image.indexOf('fbcdn') == -1) {
1123					image = image.replace("_b.jpg", "_f.jpg");
1124					image = image.replace("_b.png", "_f.png");
1125				} else {
1126					if(image.indexOf('safe_image.php') == -1) {
1127						var id = image.split("_"), object_id = id[1];
1128						image = 'https://graph.facebook.com/'+object_id+'/picture?type=normal';
1129					}
1130				}
1131				image = image.replace("_s.jpg", "_b.jpg");
1132				image = image.replace("_m.png", ".png");
1133				image = image.replace("_s.png", "_b.png");
1134				image = image.replace(/\&amp;/g,'&');
1135				if(image.indexOf('safe_image.php') != -1){
1136					image = unescape(image.match(/url=([^&]+)/)[1]);
1137				}
1138				if(image.indexOf('app_full_proxy.php') != -1){
1139					image = unescape(image.match(/src=([^&]+)/)[1]);
1140				}
1141				if(this.prefix == 'https://'){
1142					var image_tmp = image.replace('http://', 'https://');
1143					image = image_tmp;
1144				}
1145			} else {
1146				return false
1147			}
1148			return image;
1149		}
1150		
1151		function sortstream(obj,d){
1152			var $l = $('li',obj);
1153			$l.sort(function(a, b){
1154				var keyA = parseInt($(a).attr('rel'),10), keyB = parseInt($(b).attr('rel'),10);
1155				if(d == 'asc'){
1156					return (keyA > keyB) ? 1 : -1;
1157				} else {
1158					return (keyA < keyB) ? 1 : -1;
1159				}
1160				return 0;
1161			});
1162			$.each($l, function(index, row){
1163				obj.append(row);
1164			});
1165			$('.dcsns-loading').slideUp().remove();
1166			return;
1167		}
1168		
1169		function randomish(l){
1170			var i = 0, out = '';
1171			while(i < l){
1172				out += Math.floor((Math.random()*10)+1)+'';
1173				i++;
1174			}
1175			return out;
1176		}
1177		
1178		function ticker(s,b,speed){
1179			var $a = $('li:last',s),$b = $('li:first',s),$gx,bh = $b.outerHeight(true);
1180			if($('li',s).not('.inactive').length > 2){
1181				if(b == 'next'){
1182					$gx = $a.clone().hide();
1183					$b.before($gx);
1184					$a.remove();
1185					if($a.hasClass('inactive')){
1186						ticker(s,b,speed);
1187					} else {
1188						$('.inner',$gx).css({opacity: 0});
1189						$gx.slideDown(speed,'linear',function(){
1190							$('.inner',this).animate({opacity: 1},speed);
1191						});
1192						return;
1193					}
1194				} else {
1195					$gx = $b.clone();
1196					if($b.hasClass('inactive')){
1197						$a.after($gx);
1198						$b.remove();
1199						ticker(s,b,speed);
1200					} else {
1201						$b.animate({marginTop: -bh+'px'},speed,'linear',function(){
1202							$a.after($gx);
1203							$b.remove();
1204						});
1205						$('.inner',$b).animate({opacity: 0},speed);
1206					}
1207				}
1208			}
1209		}
1210
1211		function flickrHrefLink(id,obj){
1212			jQuery.ajax({
1213				url: 'http://api.flickr.com/services/feeds/groups_pool.gne?id='+id+'&format=json&jsoncallback=?',
1214				dataType: 'jsonp',
1215				success: function(a){
1216					$('.icon',obj).each(function(){
1217						$(this).parent().attr('href',a.link);
1218					});
1219				}
1220			});
1221		}
1222		
1223		function share(st,sq,twitterId){
1224			var s = '', sq = encodeURIComponent(sq), st = encodeURIComponent(st);
1225			s = '<a href="https://www.facebook.com/sharer.php?u='+sq+'&t='+st+'" class="share-facebook" target="_blank"></a>';
1226			s += '<a href="https://twitter.com/share?url='+sq+'&text='+st+'&via='+twitterId+'" class="share-twitter" target="_blank"></a>';
1227			s += '<a href="https://plus.google.com/share?url='+sq+'" class="share-google" target="_blank"></a>';
1228			s += '<a href="http://www.linkedin.com/shareArticle?mini=true&url='+sq+'&title='+st+'" class="share-linkedin" target="_blank"></a>';
1229			return s;
1230        }
1231})(jQuery);
1232
1233jQuery(window).load(function(){
1234	jQuery.getScript("//platform.twitter.com/widgets.js", function(){});
1235	jQuery('.section-share a').click(function(){
1236		var u = jQuery(this).attr('href');
1237		window.open(u,'sharer','toolbar=0,status=0,width=626,height=436');
1238		return false;
1239	});
1240});

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.