Skip to content

Commit

Permalink
Merge pull request #733 from GrosPoulet/master
Browse files Browse the repository at this point in the history
Fix for plug-in : instagram.js
  • Loading branch information
GrosPoulet authored May 29, 2021
2 parents d69481a + b939263 commit 8d69071
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions plugins/instagram.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'Instagram',
version:'0.3',
version:'0.4',
prepareImgLinks:function (callback) {
var res = [];
var sharedData = null;
Expand Down Expand Up @@ -239,15 +239,14 @@ hoverZoomPlugins.push({
}
} else {
data = JSON.parse(dataFromSessionStorage);
fullsizeUrl = (data.display_url ? data.display_url : data.graphql.shortcode_media.display_url);
fullsizeUrl = (data.display_url ? data.display_url : (data.graphql && data.graphql.shortcode_media ? data.graphql.shortcode_media.display_url : ''));
cLog('photo fullsizeUrl (from sessionStorage):' + fullsizeUrl);
}

if (fullsizeUrl != undefined) {
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.push(fullsizeUrl);
link.data().hoverZoomSrc.reverse();
link.data().hoverZoomSrc.unshift(fullsizeUrl);
}
link.addClass('hoverZoomLink');
callback(link);
Expand All @@ -270,14 +269,13 @@ hoverZoomPlugins.push({
// store whole response in sessionStorage
sessionStorage.setItem(shortcode, response);

fullsizeUrl = data.graphql.shortcode_media.display_url;
if (data.graphql && data.graphql.shortcode_media) fullsizeUrl = data.graphql.shortcode_media.display_url;
cLog('photo fullsizeUrl (from API call):' + fullsizeUrl);

if (fullsizeUrl != undefined) {
if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
link.data().hoverZoomSrc.push(fullsizeUrl);
link.data().hoverZoomSrc.reverse();
link.data().hoverZoomSrc.unshift(fullsizeUrl);
}
link.addClass('hoverZoomLink');
callback(link);
Expand Down

0 comments on commit 8d69071

Please sign in to comment.