function instagramFetch(e) {
var a = e.accessToken,
t = {
access_token: a
};
fetchCMD(t, e)
}
function fetchCMD(e, a) {
var t = "";
if ("user" == a.mode) t = "https://api.instagram.com/v1/users/" + a.userID + "/media/recent/?callback=?";
else if ("liked" == a.mode) t = "https://api.instagram.com/v1/users/self/media/liked?count=" + a.count + "&callback=?";
else if ("popular" == a.mode) t = "https://api.instagram.com/v1/media/popular?callback=?";
else if ("location" == a.mode) t = "https://api.instagram.com/v1/locations/" + a.locationID + "/media/recent/?callback=?";
else {
if ("multitag" == a.mode) {
var o = a.tag.replace(/ /g, "");
return o = o.split(","), a.multiCompleteTotal = o.length - 1, a.multiCompleteCount = 0, jQuery.each(o, function(n) {
t = "https://api.instagram.com/v1/tags/" + o[n] + "/media/recent?callback=?", jQuery.getJSON(t, e, function(e) {
onPhotoLoaded(e, a, "off")
})
}), !1
}
if ("multiuser" == a.mode) {
var n = a.userID;
return n = n.split(","), a.multiCompleteTotal = n.length - 1, a.multiCompleteCount = 0, jQuery.each(n, function(o) {
t = "https://api.instagram.com/v1/users/" + n[o] + "/media/recent/?callback=?", jQuery.getJSON(t, e, function(e) {
onPhotoLoaded(e, a, "off")
})
}), !1
}
var r = a.tag.replace(/ /g, "");
t = "https://api.instagram.com/v1/tags/" + r + "/media/recent?callback=?"
}
jQuery.getJSON(t, e, function(e) {
onPhotoLoaded(e, a)
})
}
function instagramUserSearch(e) {
var a = e.accessToken,
t = e.user,
o = {
access_token: a,
q: t
};
userSearchCMD(o, e)
}
function userSearchCMD(e, a) {
var t = "https://api.instagram.com/v1/users/search?callback=?";
jQuery.getJSON(t, e, function(e) {
onUserLoaded(e, a)
})
}
function onUserLoaded(e, a) {
if (200 == e.meta.code) {
var t = e.data;
if (t.length > 0) {
for (var o in t) {
var n = t[o],
r = "";
r = '
', r += "", r += "
", jQuery(r).appendTo(a.element)
}
jQuery('').appendTo(a.element)
} else alert("No users found with this name.")
}
}
function instagramTagsLoadMore(e) {
var a = e.accessToken,
t = {
access_token: a,
max_tag_id: e.instagramBrowserNextMax
};
if ("tag" == e.mode || "contest" == e.mode) var o = e.tag.replace(/ /g, "");
loadMoreCMD(e, t, o)
}
function loadMoreCMD(e, a, t) {
var o = "https://api.instagram.com/v1/tags/" + t + "/media/recent?callback=?";
jQuery.getJSON(o, a, function(a) {
onPhotoLoaded(a, e)
})
}
function instagramUsersLoadMore(e) {
var a = e.accessToken,
t = {
access_token: a,
max_id: e.instagramBrowserNextMax
};
loadMoreUsersCMD(e, t)
}
function loadMoreUsersCMD(e, a) {
var t = "https://api.instagram.com/v1/users/" + e.userID + "/media/recent/?callback=?";
jQuery.getJSON(t, a, function(a) {
onPhotoLoaded(a, e)
})
}
function instagramLocationLoadMore(e) {
var a = e.accessToken,
t = {
access_token: a,
max_id: e.instagramBrowserNextMax
};
loadMoreLocationsCMD(e, t)
}
function loadMoreLocationsCMD(e, a) {
var t = "https://api.instagram.com/v1/locations/" + e.locationID + "/media/recent/?callback=?";
jQuery.getJSON(t, a, function(a) {
onPhotoLoaded(a, e)
})
}
function instagramLikedLoadMore(e) {
var a = e.accessToken,
t = {
access_token: a,
max_like_id: e.instagramBrowserNextMax
};
loadMoreLikedCMD(e, t)
}
function loadMoreLikedCMD(e, a) {
var t = "https://api.instagram.com/v1/users/self/media/liked?count=" + e.count + "&callback=?";
jQuery.getJSON(t, a, function(a) {
onPhotoLoaded(a, e)
})
}
function startVideoPlayer(e) {
if (e.video) {
var a = ["playpause", "progress", "volume", "fullscreen"];
0 == e.showVideoControls && (a = [""]), jQuery(".instagram-element-video").not(".converted").mediaelementplayer({
alwaysShowControls: !1,
videoVolume: "horizontal",
features: a
}), jQuery(".instagram-element-video").addClass("converted"), 0 == e.showVideoControls && jQuery(".mejs-controls").remove()
}
}
function startFancybox(e) {
jQuery(".instagram-photo").fancybox({
openEffect: "elastic",
closeEffect: "elastic",
helpers: {
title: {
type: "inside"
}
}
})
}
function convertDate(e, a) {
var t = parseInt(e);
return t = new Date(1e3 * t), t = dateFormat(t, a)
}
function onPhotoLoaded(e, a, t) {
if (e.pagination ? e.pagination.next_max_id ? a.instagramBrowserNextMax = e.pagination.next_max_id : e.pagination.next_max_like_id ? a.instagramBrowserNextMax = e.pagination.next_max_like_id : a.instagramBrowserNextMax = "Empty" : a.instagramBrowserNextMax = "Empty", 200 == e.meta.code) {
var o = e.data;
if ("" != a.element.html()) var n = !0;
else var n = !1;
if (o.length > 0) {
for (var r in o)
if (a.limit < 20 && r >= a.limit);
else {
var s = o[r];
if ("contest" == a.mode && 0 == s.user_has_liked) continue;
var i = "",
l = "";
if ("" == s.user.full_name && (s.user.full_name = s.user.username), s.user.full_name = s.user.full_name.replace(/"/g, "'"), a.showUsername && (l += "" + s.user.full_name + " "), a.showDate) {
var m = parseInt(s.created_time);
m = new Date(1e3 * m), m = dateFormat(m, "dddd, mmmm dS, yyyy, h:MM TT"), l += "" + m + ""
}
a.showDescription && s.caption && (l += "" + s.caption.text.replace(/"/g, "'") + "."), a.showLikes && (l += " (" + s.likes.count + " Likes)"), a.showComments && (l += " (" + s.comments.count + " Comments)"), a.showLocation && s.location && (l += " Location: " + s.location.name.replace(/"/g, "'") + ""), a.showLink && null != s.link && (l += " View Photo");
var c = "None";
s.videos && (c = s.videos.standard_resolution.url);
var d = a.element.selector.replace(".", "");
d = d.replace("#", ""), "video" == s.type && 1 == a.video ? (i = '', i += '', i += '' + s.user.full_name + "" + s.user.username + "", i += 'Video', i += '