1(function() { 2 var Instafeed, root; 3 4 Instafeed = (function() { 5 6 function Instafeed(params, context) { 7 var option, value; 8 this.options = { 9 target: 'instafeed', 10 template: '<a href="{{permalink}}" target="_blank"><img src="{{media_url}}" alt="{{caption}}" loading="lazy"></a>' 11 }; 12 if (typeof params === 'object') { 13 for (option in params) { 14 value = params[option]; 15 this.options[option] = value; 16 } 17 } 18 this.context = context != null ? context : this; 19 } 20 21 Instafeed.prototype.run = function() { 22 var options = this.options; 23 $.ajax({ 24 type: "GET", 25 url: SITEBASEURL + 'api/instagram/media', 26 contentType: "application/json; charset=utf-8", 27 dataType: "json", 28 success:function(data){getInstagramFeedDataSuccess(data, options)}, 29 error: getInstagramFeedDataError 30 }); 31 return true; 32 }; 33 return Instafeed; 34 35 })(); 36 37 root = typeof exports !== "undefined" && exports !== null ? exports : window; 38 39 root.Instafeed = Instafeed; 40 41}).call(this); 42 43var getInstagramFeedDataSuccess = function (data, options) { 44 var template = options.template; 45 var instaChildren = []; 46 47 data.data.forEach(function(post){ 48 if (post.thumbnail_url) { post.media_url = post.thumbnail_url} 49 50 instaChildren.push(createTemplate(post, template)); 51 }); 52 $('#' + options.target).html(instaChildren.join('')); 53} 54 55function createTemplate (post, template) { 56 var templateVars = template.match(/\{{(.*?)\}}/g); 57 var newTemplate = template; 58 59 templateVars.forEach(function(y) { 60 var currentVar = y.split('{{').pop().split('}}')[0]; 61 62 newTemplate = newTemplate.replace(y, post[currentVar]); 63 }); 64 return (newTemplate) 65} 66 67var getInstagramFeedDataError = function (data) { 68 console.log(data) 69 $("#instafeedTab").css("display", "none"); 70} 71 72$(document).ready(function () { 73 74 var getFB = $('.socialNetworkIconFacebook').attr('href'); 75 $('#facebookfeedContainer > div').attr('data-href', getFB); 76 $('#facebookfeedContainer blockquote').attr('cite', getFB); 77 $('#facebookfeedContainer blockquote a').attr('href', getFB); 78 (function (d, s, id) { 79 var js, fjs = d.getElementsByTagName(s)[0]; 80 if (d.getElementById(id)) return; 81 js = d.createElement(s); js.id = id; 82 TOREVIEW: 83 // js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.10&appId=476392739205776"; 84 js.src = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v17.0"; 85 js.setAttribute('nonce', '3Z6APp5S'); 86 js.setAttribute('crossorigin', 'anonymous'); 87 js.async = true; 88 js.defer = true; 89 90 fjs.parentNode.insertBefore(js, fjs); 91 92 }(document, 'script', 'facebook-jssdk')); 93}); 94 95 96/* 97 * twitter-entities.js 98 * This function converts a tweet with "entity" metadata 99 * from plain text to linkified HTML. 100 * 101 * See the documentation here: http://dev.twitter.com/pages/tweet_entities 102 * Basically, add ?include_entities=true to your timeline call 103 * 104 * Copyright 2010, Wade Simmons 105 * Licensed under the MIT license 106 * http://wades.im/mons 107 * 108 * Requires jQuery 109 */ 110 111 /* 112 * 113 *This has been modifed for use in saffire events 114 * 115 */ 116function escapeHTML(text) { 117 return $('<div/>').text(text).html() 118} 119 120function linkify_entities(tweet) { 121 if (!(tweet.entities)) { 122 return tweet.text 123 } 124 125 // This is very naive, should find a better way to parse this 126 var index_map = {} 127 128 if (tweet.entities.urls != undefined) { 129 $.each(tweet.entities.urls, function (i, entry) { 130 index_map[entry.indices[0]] = [entry.indices[1], function (text) { return "<a href='" + escapeHTML(entry.url) + "' target='_blank'>" + escapeHTML(entry.display_url) + "</a>" } ] 131 }) 132 } 133 134 if (tweet.entities.hashtags != undefined) { 135 $.each(tweet.entities.hashtags, function (i, entry) { 136 index_map[entry.indices[0]] = [entry.indices[1], function (text) { return "<a href='http://twitter.com/search?q=" + escape("#" + entry.text) + "' target='_blank'>" + escapeHTML(text) + "</a>" } ] 137 }) 138 } 139 140 if (tweet.entities.user_mentions != undefined) { 141 $.each(tweet.entities.user_mentions, function (i, entry) {
142 index_map[entry.indices[0]] = [entry.indices[1], function (text) { return "<a title='" + escapeHTML(entry.name) + "' href='http://twitter.com/" + escapeHTML(entry.screen_name) + "' target='_blank'>" + escapeHTML(text) + "</a>" } ] 143 }) 144 } 145 146 if (tweet.entities.media != undefined) { 147 $.each(tweet.entities.media, function (i, entry) { 148 if (PAGESSL) { 149 entry.media_url = entry.media_url.replace('http://', 'https://'); 150 } 151 index_map[entry.indices[0]] = [entry.indices[1], function (text) { return "<a href='" + escapeHTML(entry.url) + "' target='_blank' class='twitterWidgetImageLink'><img src='" + escapeHTML(entry.media_url) + ":thumb' alt='' /></a>" } ] 152 }) 153 } 154 155 var result = "" 156 var last_i = 0 157 var i = 0 158 159 // iterate through the string looking for matches in the index_map 160 for (i=0; i < tweet.text.length; ++i) { 161 var ind = index_map[i] 162 if (ind) { 163 var end = ind[0] 164 var func = ind[1] 165 166 if (i > last_i) { 167 result += '<span>'+tweet.text.substring(last_i, i)+'</span>' 168 } 169 result += func(tweet.text.substring(i, end)) 170 i = end - 1 171 last_i = end 172 } 173 } 174 175 if (i > last_i) { 176 result += tweet.text.substring(last_i, i) 177 } 178 179 return result 180}
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.