Skip to content

Instantly share code, notes, and snippets.

@celsofabri
Last active August 26, 2016 18:32
Show Gist options
  • Save celsofabri/e85f9dde51d4870d461ff465384921eb to your computer and use it in GitHub Desktop.
Save celsofabri/e85f9dde51d4870d461ff465384921eb to your computer and use it in GitHub Desktop.
LoadFeed Instagram/Recruiterbox
var instagramUrl = 'https://api.instagram.com/v1/users/self/media/recent/?access_token=myToken&callback=?&limit=1&count=12';
var recruiterboxUrl = 'https://jsapi.recruiterbox.com/v1/openings?client_name=myAccountName&limit=5';
// Instagram Media Load
var loadFeed = function(url, callback) {
$.ajax({
url: url,
dataType: 'json',
success: function(response) {
callback(response);
}
});
};
var instagramLoadGallery = function(images) {
var galleryContent = '<div class="follow-us-container">';
images.data.forEach(image => {
galleryContent += `<a target="_blank" title="${image.caption.text}" class="follow-us-item" href="${image.link}">
<img src="${image.images.standard_resolution.url}" alt="${image.caption.text}" />
</a>`;
});
galleryContent += '</div>';
$('.follow-us-instagram').html(galleryContent);
};
var recruiterboxOpenings = function(openings) {
var openingContent = '<div class="jobs-container">';
openings.objects.forEach(opening =>{
openingContent += `<div class="jobs-item">
<h4 class="jobs-title">${opening.title}</h4>
<a href="${opening.hosted_url}" title="${opening.title} - Saiba mais" target="_blank" class="jobs-link">Saiba mais</a>
</div>`;
});
openingContent += '</div>';
$('.jobs-recruiterbox').html(openingContent);
}
loadFeed(instagramUrl, instagramLoadGallery);
loadFeed(recruiterboxUrl, recruiterboxOpenings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment