PageSourceSearch

https://astra-hotel.ch/wp-content/plugins/wp-social-feed/bower_com…/js/jquery.socialfeed.js?ver=6.9.9

js astra-hotel.ch collected 2026-10-03 21:38:21 UTC 38,190 bytes, 769 lines download raw bytes

1if (typeof Object.create !== 'function') {
2    Object.create = function(obj) {
3        function F() {}
4        F.prototype = obj;
5        return new F();
6    };
7}
8
9(function($, window, document, undefined) {
10    $.fn.socialfeed = function(_options) {
11
12
13        var defaults = {
14            plugin_folder: '', // a folder in which the plugin is located (with a slash in the end)
15            template: 'template.html', // a path to the template file
16            show_media: false, // show images of attachments if available
17            media_min_width: 300,
18            length: 500, // maximum length of post message shown
19            date_format: 'll'
20        };
21        //---------------------------------------------------------------------------------
22        var options = $.extend(defaults, _options),
23            container = $(this),
24            template,
25            social_networks = ['facebook', 'instagram', 'vk', 'google', 'blogspot', 'twitter', 'pinterest', 'rss'],
26            posts_to_load_count = 0,
27            loaded_post_count = 0;
28        // container.empty().css('display', 'block');
29        //---------------------------------------------------------------------------------
30
31        //---------------------------------------------------------------------------------
32        // This function performs consequent data loading from all of the sources by calling corresponding functions
33        function calculatePostsToLoadCount() {
34            social_networks.forEach(function(network) {
35                if (options[network]) {
36                    if (options[network].accounts) {
37                        posts_to_load_count += options[network].limit * options[network].accounts.length;
38                    } else {
39                        posts_to_load_count += options[network].limit;
40                    }
41                }
42            });
43        }
44
45        calculatePostsToLoadCount();
46
47        function fireCallback() {
48            var fire = true;
49            /*$.each(Object.keys(loaded), function() {
50                if (loaded[this] > 0)
51                    fire = false;
52            });*/
53            if (fire && options.callback) {
54                options.callback();
55            }
56        }
57
58        var Utility = {
59            request: function(url, callback) {
60                $.ajax({
61                    url: url,
62                    dataType: 'jsonp',
63                    success: callback
64                });
65            },
66            get_request: function(url, callback) {
67                $.get(url, callback, 'json');
68            },
69            wrapLinks: function(string, social_network) {
70                var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
71                if (social_network === 'google-plus') {
72                    string = string.replace(/(@|#)([a-z0-9_]+['])/ig, Utility.wrapGoogleplusTagTemplate);
73                } else {
74                    string = string.replace(exp, Utility.wrapLinkTemplate);
75                }
76                return string;
77            },
78            wrapLinkTemplate: function(string) {
79                return '<a target="_blank" href="' + string + '">' + string + '<\/a>';
80            },
81            wrapGoogleplusTagTemplate: function(string) {
82                return '<a target="_blank" href="https://plus.google.com/s/' + string + '" >' + string + '<\/a>';
83            },
84            shorten: function(string) {
85                string = $.trim(string);
86                if (string.length > options.length) {
87                    return jQuery.trim(string).substring(0, options.length).split(" ").slice(0, -1).join(" ") + "...";
88                } else {
89                    return string;
90                }
91            },
92            stripHTML: function(string) {
93                if (typeof string === "undefined" || string === null) {
94                    return '';
95                }
96                return string.replace(/(<([^>]+)>)|nbsp;|\s{2,}|/ig, "");
97            }
98        };
99
100        function SocialFeedPost(social_network, data) {
101            this.content = data;
102            this.content.social_network = social_network;
103            this.content.attachment = (this.content.attachment === undefined) ? '' : this.content.attachment;
104            this.content.time_ago = data.dt_create.fromNow();
105            this.content.date = data.dt_create.format(options.date_format);
106            this.content.dt_create = this.content.dt_create.valueOf();
107            this.content.text = Utility.wrapLinks(Utility.shorten(data.message + ' ' + data.description), data.social_network);
108            this.content.moderation_passed = (options.moderation) ? options.moderation(this.content) : true;
109
110            Feed[social_network].posts.push(this);
111        }
112        SocialFeedPost.prototype = {
113            render: function() {
114                var rendered_html = Feed.template(this.content);
115                var data = this.content;
116
117                if ($(container).children('[social-feed-id=' + data.id + ']').length !== 0) {
118                    return false;
119                }
120                if ($(container).children().length === 0) {
121                    $(container).append(rendered_html);
122                } else {
123                    var i = 0,
124                        insert_index = -1;
125                    $.each($(container).children(), function() {
126                        if ($(this).attr('dt-create') < data.dt_create) {
127                            insert_index = i;
128                            return false;
129                        }
130                        i++;
131                    });
132                    $(container).append(rendered_html);
133                    if (insert_index >= 0) {
134                        insert_index++;
135                        var before = $(container).children('div:nth-child(' + insert_index + ')'),
136                            current = $(container).children('div:last-child');
137                        $(current).insertBefore(before);
138                    }
139
140                }
141                if (options.media_min_width) {
142
143                    var query = '[social-feed-id=' + data.id + '] img.attachment';
144                    var image = $(query);
145
146                    // preload the image
147                    var height, width = '';
148                    var img = new Image();
149                    var imgSrc = image.attr("src");
150
151                    $(img).load(function() {
152
153                        if (img.width < options.media_min_width) {
154                            image.hide();
155                        }
156                        // garbage collect img
157                        delete img;
158
159                    }).error(function() {
160                        // image couldnt be loaded
161                        image.hide();
162
163                    }).attr({
164                        src: imgSrc
165                    });
166
167                }
168
169                loaded_post_count++;
170                if (loaded_post_count == posts_to_load_count) {
171                    fireCallback();
172                }
173
174            }
175
176        };
177
178        var Feed = {
179            template: false,
180            init: function() {
181                Feed.getTemplate(function() {
182                    social_networks.forEach(function(network) {
183                        if (options[network]) {
184                            if ( options[network].accounts ) {
185                                //loaded[network] = 0;
186                                options[network].accounts.forEach(function(account) {
187                                    //loaded[network]++;
188                                    Feed[network].getData(account);
189                                });
190                            } else if ( options[network].urls ) {
191                                options[network].urls.forEach(function(url) {
192                                    Feed[network].getData(url);
193                                });
194                            } else {
195                                Feed[network].getData();
196                            }
197                        }
198                    });
199                });
200            },
201            getTemplate: function(callback) {
202                if (Feed.template)
203                    return callback();
204                else {
205                    if (options.template_html) {
206                        Feed.template = doT.template(options.template_html);
207                        return callback();
208                    } else {
209                        $.get(options.template, function(template_html) {
210                            Feed.template = doT.template(template_html);
211                            return callback();
212                        });
213                    }
214                }
215            },
216            twitter: {
217                posts: [],
218                loaded: false,
219                api: 'http://api.tweecool.com/',
220
221                getData: function(account) {
222
223                    var cb = new Codebird();
224                    cb.setConsumerKey(options.twitter.consumer_key, options.twitter.consumer_secret);
225
226                    // Allow setting your own proxy with Codebird
227                    if (options.twitter.proxy !== undefined) {
228                        cb.setProxy(options.twitter.proxy);
229                    }
230
231                    switch (account[0]) {
232                        case '@':
233                            var userid = account.substr(1);
234                            cb.__call(
235                                "statuses_userTimeline",
236                                "id=" + userid + "&count=" + options.twitter.limit,
237                                Feed.twitter.utility.getPosts,
238                                true // this parameter required
239                            );
240                            break;
241                        case '#':
242                            var hashtag = account.substr(1);
243                            cb.__call(
244                                "search_tweets",
245                                "q=" + hashtag + "&count=" + options.twitter.limit,
246                                function(reply) {
247                                    Feed.twitter.utility.getPosts(reply.statuses);
248                                },
249                                true // this parameter required
250                            );
251                            break;
252                        default:
253                    }
254                },
255                utility: {
256                    getPosts: function(json) {
257                        if (json) {
258                            $.each(json, function() {
259                                var element = this;
260                                var post = new SocialFeedPost('twitter', Feed.twitter.utility.unifyPostData(element));
261                                post.render();
262                            });
263                        }
264                    },
265                    unifyPostData: function(element) {
266                        var post = {};
267                        if (element.id) {
268                            post.id = element.id;
269                            //prevent a moment.js console warning due to Twitter's poor date format.
270                            post.dt_create = moment(new Date(element.created_at));
271                            post.author_link = 'http://twitter.com/' + element.user.screen_name;
272                            post.author_picture = element.user.profile_image_url;
273                            post.post_url = post.author_link + '/status/' + element.id_str;
274                            post.author_name = element.user.name;
275                            post.message = element.text;
276                            post.description = '';
277                            post.link = 'http://twitter.com/' + element.user.screen_name + '/status/' + element.id_str;
278
279                            if (options.show_media === true) {
280                                if (element.entities.media && element.entities.media.length > 0) {
281                                    var image_url = element.entities.media[0].media_url;
282                                    if (image_url) {
283                                        post.attachment = '<img class="attachment" src="' + image_url + '" />';
284                                    }
285                                }
286                            }
287                        }
288                        return post;
289                    }
290                }
291            },
292            facebook: {
293                posts: [],
294                graph: 'https://graph.facebook.com/',
295                loaded: false,
296                getData: function(account) {
297                    var proceed = function(request_url){
298                        Utility.request(request_url, Feed.facebook.utility.getPosts);
299                    };
300                    var fields = '?fields=id,from,name,message,created_time,story,description,link';
301                       fields += (options.show_media === true)?',picture,object_id':'';
302                    var request_url, limit = '&limit=' + options.facebook.limit,
303                        query_extention = '&access_token=' + options.facebook.access_token + '&callback=?';
304                    switch (account[0]) {
305                        case '@':
306                            var username = account.substr(1);
307                            Feed.facebook.utility.getUserId(username, function(userdata) {
308                                if (userdata.id !== '') {
309                                    request_url = Feed.facebook.graph + 'v2.4/' + userdata.id + '/posts'+ fields + limit + query_extention;
310                                    proceed(request_url);
311                                }
312                            });
313                            break;
314                        case '!':
315                            var page = account.substr(1);
316                            request_url = Feed.facebook.graph + 'v2.4/' + page + '/feed'+ fields + limit + query_extention;
317                            proceed(request_url);
318                            break;
319                        default:
320                            proceed(request_url);
321                    }
322                },
323                utility: {
324                    getUserId: function(username, callback) {
325                        var query_extention = '&access_token=' + options.facebook.access_token + '&callback=?';
326                        var url = 'https://graph.facebook.com/' + username + '?' + query_extention;
327                        var result = '';
328                        $.get(url, callback, 'json');
329                    },
330                    prepareAttachment: function(element) {
331                        var image_url = element.picture;
332                        if (image_url.indexOf('_b.') !== -1) {
333                            //do nothing it is already big
334                        } else if (image_url.indexOf('safe_image.php') !== -1) {
335                            image_url = Feed.facebook.utility.getExternalImageURL(image_url, 'url');
336
337                        } else if (image_url.indexOf('app_full_proxy.php') !== -1) {
338                            image_url = Feed.facebook.utility.getExternalImageURL(image_url, 'src');
339
340                        } else if (element.object_id) {
341                            image_url = Feed.facebook.graph + element.object_id + '/picture/?type=normal';
342                        }
343                        return '<img class="attachment" src="' + image_url + '" />';
344                    },
345                    getExternalImageURL: function(image_url, parameter) {
346                        image_url = decodeURIComponent(image_url).split(parameter + '=')[1];
347                        if (image_url.indexOf('fbcdn-sphotos') === -1) {
348                            return image_url.split('&')[0];
349                        } else {
350                            return image_url;
351                        }
352
353                    },
354                    getPosts: function(json) {
355                        if (json['data']) {
356                            json['data'].forEach(function(element) {
357                                var post = new SocialFeedPost('facebook', Feed.facebook.utility.unifyPostData(element));
358                                post.render();
359                            });
360                        }
361                    },
362                    unifyPostData: function(element) {
363                        var post = {},
364                            text = (element.message) ? element.message : element.story;
365
366                        post.id = element.id;
367                        post.dt_create = moment(element.created_time);
368                        post.author_link = 'http://facebook.com/' + element.from.id;
369                        post.author_picture = Feed.facebook.graph + element.from.id + '/picture';
370                        post.author_name = element.from.name;
371                        post.name = element.name || "";
372                        post.message = (text) ? text : '';
373                        post.description = (element.description) ? element.description : '';
374                        post.link = (element.link) ? element.link : 'http://facebook.com/' + element.from.id;
375
376                        if (options.show_media === true) {
377                            if (element.picture) {
378                                var attachment = Feed.facebook.utility.prepareAttachment(element);
379                                if (attachment) {
380                                    post.attachment = attachment;
381                                }
382                            }
383                        }
384                        return post;
385                    }
386                }
387            },
388            google: {
389                posts: [],
390                loaded: false,
391                api: 'https://www.googleapis.com/plus/v1/',
392                getData: function(account) {
393                    var request_url;
394                    switch (account[0]) {
395                        case '#':
396                            var hashtag = account.substr(1);
397                            request_url = Feed.google.api + 'activities?query=' + hashtag + '&key=' + options.google.access_token + '&maxResults=' + options.google.limit;
398                            Utility.get_request(request_url, Feed.google.utility.getPosts);
399                            break;
400                        case '@':
401                            var username = account.substr(1);
402                            request_url = Feed.google.api + 'people/' + username + '/activities/public?key=' + options.google.access_token + '&maxResults=' + options.google.limit;
403                            Utility.get_request(request_url, Feed.google.utility.getPosts);
404                            break;
405                        default:
406                    }
407                },
408                utility: {
409                    getPosts: function(json) {
410                        if (json.items) {
411                            $.each(json.items, function(i) {
412                                var post = new SocialFeedPost('google', Feed.google.utility.unifyPostData(json.items[i]));
413                                post.render();
414                            });
415                        }
416                    },
417                    unifyPostData: function(element) {
418                        var post = {};
419
420                        post.id = element.id;
421                        post.attachment = '';
422                        post.description = '';
423                        post.dt_create = moment(element.published);
424                        post.author_link = element.actor.url;
425                        post.author_picture = element.actor.image.url;
426                        post.author_name = element.actor.displayName;
427
428                        if (options.show_media === true) {
429                            if (element.object.attachments) {
430                                $.each(element.object.attachments, function() {
431                                    var image = '';
432                                    if (this.fullImage) {
433                                        image = this.fullImage.url;
434                                    } else {
435                                        if (this.objectType === 'album') {
436                                            if (this.thumbnails && this.thumbnails.length > 0) {
437                                                if (this.thumbnails[0].image) {
438                                                    image = this.thumbnails[0].image.url;
439                                                }
440                                            }
441                                        }
442                                    }
443                                    post.attachment = '<img class="attachment" src="' + image 
443+ '"/>';
444                                });
445                            }
446                        }
447                        post.message = element.title;
448                        post.link = element.url;
449
450                        return post;
451                    }
452                }
453            },
454            instagram: {
455                posts: [],
456                api: 'https://api.instagram.com/v1/',
457                loaded: false,
458                accessType: function() {
459                    // If we have both the client_id and access_token set in options,
460                    // use access_token for authentication. If client_id is not set
461                    // then use access_token. If neither are set, log an error to console.
462                    if (typeof options.instagram.access_token === 'undefined' && typeof options.instagram.client_id === 'undefined') {
463                        console.log('You need to define a client_id or access_token to authenticate with Instagram\'s API.');
464                        return undefined;
465                    }
466                    if (options.instagram.access_token) { options.instagram.client_id = undefined; }
467                    options.instagram.access_type = (typeof options.instagram.client_id === 'undefined' ? 'access_token' : 'client_id');
468                    return options.instagram.access_type;
469                },
470                getData: function(account) {
471                    var url;
472
473                    // API endpoint URL depends on which authentication type we're using.
474                    if (this.accessType() !== 'undefined') {
475                        var authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type];
476                    }
477
478                    switch (account[0]) {
479                        case '@':
480                            var username = account.substr(1);
481                            url = Feed.instagram.api + 'users/search/?q=' + username + '&' + authTokenParams + '&count=1' + '&callback=?';
482                            Utility.request(url, Feed.instagram.utility.getUsers);
483                            break;
484                        case '#':
485                            var hashtag = account.substr(1);
486                            url = Feed.instagram.api + 'tags/' + hashtag + '/media/recent/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?';
487                            Utility.request(url, Feed.instagram.utility.getImages);
488                            break;
489                        case '&':
490                            var id = account.substr(1);
491                            url = Feed.instagram.api + 'users/' + id + '/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?';
492                            Utility.request(url, Feed.instagram.utility.getUsers);
493                        default:
494                    }
495                },
496                utility: {
497                    getImages: function(json) {
498                        if (json.data) {
499                            json.data.forEach(function(element) {
500                                var post = new SocialFeedPost('instagram', Feed.instagram.utility.unifyPostData(element));
501                                post.render();
502                            });
503                        }
504                    },
505                    getUsers: function(json) {
506                        // API endpoint URL depends on which authentication type we're using.
507                        if (options.instagram.access_type !== 'undefined') {
508                            var authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type];
509                        }
510
511                        if (!jQuery.isArray(json.data)) json.data = [json.data]
512                        json.data.forEach(function(user) {
513                            var url = Feed.instagram.api + 'users/' + user.id + '/media/recent/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?';
514                            Utility.request(url, Feed.instagram.utility.getImages);
515                        });
516                    },
517                    unifyPostData: function(element) {
518                        var post = {};
519
520                        post.id = element.id;
521                        post.dt_create = moment(element.created_time * 1000);
522                        post.author_link = 'http://instagram.com/' + element.user.username;
523                        post.author_picture = element.user.profile_picture;
524                        post.author_name = element.user.full_name || element.user.username;
525                        post.message = (element.caption && element.caption) ? element.caption.text : '';
526                        post.description = '';
527                        post.link = element.link;
528                        if (options.show_media) {
529                            post.attachment = '<img class="attachment" src="' + element.images.standard_resolution.url + '' + '" />';
530                        }
531                        return post;
532                    }
533                }
534            },
535            vk: {
536                posts: [],
537                loaded: false,
538                base: 'http://vk.com/',
539                api: 'https://api.vk.com/method/',
540                user_json_template: 'https://api.vk.com/method/' + 'users.get?fields=first_name,%20last_name,%20screen_name,%20photo&uid=',
541                group_json_template: 'https://api.vk.com/method/' + 'groups.getById?fields=first_name,%20last_name,%20screen_name,%20photo&gid=',
542                getData: function(account) {
543                    var request_url;
544
545                    switch (account[0]) {
546                        case '@':
547                            var username = account.substr(1);
548                            request_url = Feed.vk.api + 'wall.get?owner_id=' + username + '&filter=' + options.vk.source + '&count=' + options.vk.limit + '&callback=?';
549                            Utility.get_request(request_url, Feed.vk.utility.getPosts);
550                            break;
551                        case '#':
552                            var hashtag = account.substr(1);
553                            request_url = Feed.vk.api + 'newsfeed.search?q=' + hashtag + '&count=' + options.vk.limit + '&callback=?';
554                            Utility.get_request(request_url, Feed.vk.utility.getPosts);
555                            break;
556                        default:
557                    }
558                },
559                utility: {
560                    getPosts: function(json) {
561                        if (json.response) {
562                            $.each(json.response, function() {
563                                if (this != parseInt(this) && this.post_type === 'post') {
564                                    var owner_id = (this.owner_id) ? this.owner_id : this.from_id,
565                                        vk_wall_owner_url = (owner_id > 0) ? (Feed.vk.user_json_template + owner_id + '&callback=?') : (Feed.vk.group_json_template + (-1) * owner_id + '&callback=?'),
566                                        element = this;
567                                    Utility.get_request(vk_wall_owner_url, function(wall_owner) {
568                                        Feed.vk.utility.unifyPostData(wall_owner, element, json);
569                                    });
570                                }
571                            });
572                        }
573                    },
574                    unifyPostData: function(wall_owner, element, json) {
575                        var post = {};
576
577                        post.id = element.id;
578                        post.dt_create = moment.unix(element.date);
579                        post.description = ' ';
580                        post.message = Utility.stripHTML(element.text);
581                        if (options.show_media) {
582                            if (element.attachment) {
583                                if (element.attachment.type === 'link')
584                                    post.attachment = '<img class="attachment" src="' + element.attachment.link.image_src + '" />';
585                                if (element.attachment.type === 'video')
586                                    post.attachment = '<img class="attachment" src="' + element.attachment.video.image_big + '" />';
587                                if (element.attachment.type === 'photo')
588                                    post.attachment = '<img class="attachment" src="' + element.attachment.photo.src_big + '" />';
589                            }
590                        }
591
592                        if (element.from_id > 0) {
593                            var vk_user_json = Feed.vk.user_json_template + element.from_id + '&callback=?';
594                            Utility.get_request(vk_user_json, function(user_json) {
595                                var vk_post = new SocialFeedPost('vk', Feed.vk.utility.getUser(user_json, post, element, json));
596                                vk_post.render();
597                            });
598
599                        } else {
600                            var vk_group_json = Feed.vk.group_json_template + (-1) * element.from_id + '&callback=?';
601                            Utility.get_request(vk_group_json, function(user_json) {
602                                var vk_post = new SocialFeedPost('vk', Feed.vk.utility.getGroup(user_json, post, element, json));
603                                vk_post.render();
604                            });
605                        }
606                    },
607                    getUser: function(user_json, post, element, json) {
608                        post.author_name = user_json.response[0].first_name + ' ' + user_json.response[0].last_name;
609                        post.author_picture = user_json.response[0].photo;
610                        post.author_link = Feed.vk.base + user_json.response[0].screen_name;
611                        post.link = Feed.vk.base + user_json.response[0].screen_name + '?w=wall' + element.from_id + '_' + element.i
611d;
612
613                        return post;
614                    },
615                    getGroup: function(user_json, post, element, json) {
616                        post.author_name = user_json.response[0].name;
617                        post.author_picture = user_json.response[0].photo;
618                        post.author_link = Feed.vk.base + user_json.response[0].screen_name;
619                        post.link = Feed.vk.base + user_json.response[0].screen_name + '?w=wall-' + user_json.response[0].gid + '_' + element.id;
620
621                        return post;
622                    }
623                }
624            },
625            blogspot: {
626                loaded: false,
627                getData: function(account) {
628                    var url;
629
630                    switch (account[0]) {
631                        case '@':
632                            var username = account.substr(1);
633                            url = 'http://' + username + '.blogspot.com/feeds/posts/default?alt=json-in-script&callback=?';
634                            request(url, getPosts);
635                            break;
636                        default:
637                    }
638                },
639                utility: {
640                    getPosts: function(json) {
641                        $.each(json.feed.entry, function() {
642                            var post = {},
643                                element = this;
644                            post.id = element.id['$t'].replace(/[^a-z0-9]/gi, '');
645                            post.dt_create = moment((element.published['$t']));
646                            post.author_link = element.author[0]['uri']['$t'];
647                            post.author_picture = 'http:' + element.author[0]['gd$image']['src'];
648                            post.author_name = element.author[0]['name']['$t'];
649                            post.message = element.title['$t'] + '</br></br>' + stripHTML(element.content['$t']);
650                            post.description = '';
651                            post.link = element.link.pop().href;
652
653                            if (options.show_media) {
654                                if (element['media$thumbnail']) {
655                                    post.attachment = '<img class="attachment" src="' + element['media$thumbnail']['url'] + '" />';
656                                }
657                            }
658
659                            post.render();
660
661                        });
662                    }
663                }
664            },
665            pinterest: {
666                posts: [],
667                loaded: false,
668                apiv1: 'https://api.pinterest.com/v1/',
669
670                getData: function(account) {
671                    var request_url,
672                      limit = 'limit=' + options.pinterest.limit,
673                      fields = 'fields=id,created_at,link,note,creator(url,first_name,last_name,image),image',
674                      query_extention = fields + '&access_token=' 
674+ options.pinterest.access_token + '&' + limit + '&callback=?';
675                    switch (account[0]) {
676                        case '@':
677                            var username = account.substr(1);
678                            if (username === 'me') {
679                                request_url = Feed.pinterest.apiv1 + 'me/pins/?' + query_extention;
680                            } else {
681                                request_url = Feed.pinterest.apiv1 + 'boards/' + username + '/pins?' + query_extention;
682                            }
683                            break;
684                        default:
685                    }
686                    Utility.request(request_url, Feed.pinterest.utility.getPosts);
687                },
688                utility: {
689
690                    getPosts: function(json) {
691                        json.data.forEach(function(element) {
692                            var post = new SocialFeedPost('pinterest', Feed.pinterest.utility.unifyPostData(element));
693                            post.render();
694                        });
695                    },
696
697                    unifyPostData: function(element){
698                        var post = {};
699
700                        post.id = element.id;
701                        post.dt_create= moment(element.created_at);
702                        post.author_link = element.creator.url;
703                        post.author_picture = element.creator.image['60x60' ].url;
704                        post.author_name =  element.creator.first_name + element.creator.last_name;
705                        post.message = element.note;
706                        post.description = '';
707                        post.social_network = 'pinterest';
708                        post.link = element.link ? element.link : 'https://www.pinterest.com/pin/' + element.id;
709                        if (options.show_media) {
710                            post.attachment = '<img class="attachment" src="' + element.image['original'].url + '" />';
711                        }
712                        return post;
713                    }
714                }
715            },
716            rss : {
717                posts: [],
718                loaded: false,
719                api : 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0',
720
721                getData: function(url) {
722                    var limit = '&num='+ options.rss.limit,
723                      request_url = Feed.rss.api + limit + '&q=' + encodeURIComponent(url);
724
725                    Utility.request(request_url, Feed.rss.utility.getPosts);
726                },
727                utility: {
728
729                    getPosts: function(json) {
730                        $.each(json.responseData.feed.entries, function(index, element) {
731                            var post = new SocialFeedPost('rss', Feed.rss.utility.unifyPostData(index, element));
732                            post.render();
733                        });
734                    },
735
736                    unifyPostData: function(index, element){
737                        var post = {};
738
739                        post.id = index;
740                        post.dt_create= moment(element.publishedDate, 'ddd, DD MMM YYYY HH:mm:ss ZZ', 'en');
741                        post.author_link = '';
742                        post.author_picture = '';
743                        post.author_name = element.author;
744                        post.message = Utility.stripHTML(element.title);
745                        post.description = Utility.stripHTML(element.content);
746                        post.social_network = 'rss';
747                        post.link = element.link;
748                        if (options.show_media && element.mediaGroups ) {
749                            post.attachment = '<img class="attachment" src="' + element.mediaGroups[0].contents[0].url + '" />';
750                        }
751                        return post;
752                    }
753                }
754            }
755        };
756
757        //make the plugin chainable
758        return this.each(function() {
759            // Initialization
760            Feed.init();
761            if (options.update_period) {
762                setInterval(function() {
763                    return Feed.init();
764                }, options.update_period);
765            }
766        })
767    };
768
769})(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.