PageSourceSearch

https://bergara.eus/sites/all/themes/Porto/vendor/jflickrfeed/jflickrfeed.js?thhpsx

js bergara.eus collected 2026-10-02 12:50:16 UTC 2,390 bytes, 84 lines download raw bytes

1/*
2* Copyright (C) 2009 Joel Sutherland
3* Licenced under the MIT license
4* http://www.newmediacampaigns.com/page/jquery-flickr-plugin
5*
6* Available tags for templates:
7* title, link, date_taken, description, published, author, author_id, tags, image*
8*/
9(function($) {
10	$.fn.jflickrfeed = function(settings, callback) {
11		settings = $.extend(true, {
12			flickrbase: 'http://api.flickr.com/services/feeds/',
13			feedapi: 'photos_public.gne',
14			limit: 20,
15			qstrings: {
16				lang: 'en-us',
17				format: 'json',
18				jsoncallback: '?'
19			},
20			cleanDescription: true,
21			useTemplate: true,
22			itemTemplate: '<li><a href="{{image_b}}" title="{{title}}"><span class="thumbnail"><img src="{{image_s}}" /></span></a></li>',
23			itemCallback: function(){}
24		}, settings);
25
26		var url = settings.flickrbase + settings.feedapi + '?';
27		var first = true;
28
29		for(var key in settings.qstrings){
30			if(!first)
31				url += '&';
32			url += key + '=' + settings.qstrings[key];
33			first = false;
34		}
35
36		return $(this).each(function(){
37			var $container = $(this);
38			var container = this;
39
40			$.getJSON(url, function(data){
41
42				$.each(data.items, function(i,item){
43					if(i < settings.limit){
44						// Clean out the Flickr Description
45						if(settings.cleanDescription){
46							var regex = /<p>(.*?)<\/p>/g;
47							var input = item.description;
48							if(regex.test(input)) {
49								item.description = input.match(regex)[2]
50								if(item.description!=undefined)
51									item.description = item.description.replace('<p>','').replace('</p>','');
52							}
53						}
54						
55						// Add Image Sizes
56						// http://www.flickr.com/services/api/misc.urls.html
57						item['image_s'] = item.media.m.replace('_m', '_s');
58						item['image_t'] = item.media.m.replace('_m', '_t');
59						item['image_m'] = item.media.m.replace('_m', '_m');
60						item['image'] = item.media.m.replace('_m', '');
61						item['image_b'] = item.media.m.replace('_m', '_b');
62						delete item.media;
63						
64						// Use Template
65						if(settings.useTemplate){
66							var template = settings.itemTemplate;
67							for(var key in item){
68								template = template.replace('{{' + key + '}}', item[key]);
69							}
70
71							$container.append(template)
72						}
73
74						//itemCallback
75						settings.itemCallback.call(container, item);
76					}
77				});
78				if($.isFunction(callback)){
79					callback.call(container, data);
80				}
81			});
82		});
83	}
84})(jQuery);

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.