Join the Pact

Your Instagram pics from Join the Pact

Published 4th Dec 2014


$(document).ready(function() {

var startTime = "12-04-2014";
var tag = "GetHomeSafely";

var blocklist= getjson();
var startUnixtime = Date.parse(startTime).getTime()/1000;

$('#instafeed').attr('rel', $("#instafeed img").length);

var myButton = $('#mybutton');
var feed = new Instafeed({
get: 'tagged',
tagName: tag,
clientId: 'a04eed9a4f4d4ccab7ebc8b9581fa175',
filter: function(image) {



if (image.created_time > startUnixtime) {

if ($.inArray(image.user.username, blocklist) == -1) {
return true;
}
else {
return false;
}

}
else {
return false;
}
},
after: function() {var images = $("#instafeed a").fancybox({
wrapCSS : 'fancybox-custom',
closeClick : true,

openEffect : 'none',

helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background' : 'rgba(238,238,238,0.85)'
}
}
}
});

$('#mybutton').show();

if (!this.hasNext()) {
myButton.hide();
}

if ($('#instafeed').attr('rel') == $("#instafeed img").length) {
$('#instafeed-message').html('

No more Images at this time, please check back soon for updates.');
}

},
template: 'View in Instagram" href="{{model.images.standard_resolution.url}}">',
});

myButton.bind('click', function() {
$('#instafeed').attr('rel', $("#instafeed img").length);
feed.next();
});

feed.run();

(function () {
'use strict';
var _slice = Array.prototype.slice;

try {
// Can't be used with DOM elements in IE < 9
_slice.call(document.documentElement);
} catch (e) { // Fails in IE < 9
// This will work for genuine arrays, array-like objects,
// NamedNodeMap (attributes, entities, notations),
// NodeList (e.g., getElementsByTagName), HTMLCollection (e.g., childNodes),
// and will not fail on other DOM objects (as do DOM elements in IE < 9)
Array.prototype.slice = function (begin, end) {
// IE < 9 gets unhappy with an undefined end argument
end = (typeof end !== 'undefined') ? end : this.length;

// For native Array objects, we use the native slice function
if (Object.prototype.toString.call(this) === 'object Array'){
return _slice.call(this, begin, end);
}

// For array like object we handle it ourselves.
var i, cloned = [],
size, len = this.length;

// Handle negative value for "begin"
var start = begin || 0;
start = (start >= 0) ? start: len + start;

// Handle negative value for "end"
var upTo = (end) ? end : len;
if (end < 0) {
upTo = len + end;
}

// Actual expected size of the slice
size = upTo - start;

if (size > 0) {
cloned = new Array(size);
if (this.charAt) {
for (i = 0; i < size; i++) {
clonedi = this.charAt(start + i);
}
} else {
for (i = 0; i < size; i++) {
clonedi = thisstart + i;
}
}
}

return cloned;
};
}
}());

});

function getjson() {

var blocklist=[];
$.ajax(
{url: "http://taggallery.bauerweb.co.uk/taggallery/blocklist?callback=11122333",
async:false,
dataType: 'jsonp',
success: function( data ) {
$.each(data, function( key, val ) {
blocklist.push(val);
});
}
});

return blocklist;
}