-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,18 +92,35 @@ <h1>{{ title }}</h1> | |
{% if article.instagram_id %} | ||
<div class="galleria"> | ||
</div> | ||
<script src="//code.jquery.com/jquery.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/galleria.min.js"></script> | ||
|
||
<script type='text/javascript'> | ||
var mypics = [] | ||
var pic = '{{ article.instagram_id }}'; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
$.getJSON("https://www.instagram.com/p/" + pic + "/?__a=1", function( data ) { | ||
$.each(data.graphql.shortcode_media, function(key,val){ | ||
|
||
var request = new XMLHttpRequest(); | ||
request.open('GET', "https://www.instagram.com/p/" + pic + "/?__a=1", true); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
request.onload = function() { | ||
if (this.status >= 200 && this.status < 400) { | ||
// Success! | ||
var data = JSON.parse(this.response); | ||
} else { | ||
// We reached our target server, but it returned an error | ||
|
||
} | ||
}; | ||
|
||
request.onerror = function() { | ||
// There was a connection error of some sort | ||
}; | ||
|
||
request.send(); | ||
|
||
data.graphql.shortcode_media.forEach(function(key,val){ | ||
if (key == '__typename'){ | ||
var items = []; | ||
if (val == 'GraphSidecar'){ | ||
$.each( data.graphql.shortcode_media.edge_sidecar_to_children.edges, function( key, val ) { | ||
data.graphql.shortcode_media.edge_sidecar_to_children.edges.forEach(function( key, val ) { | ||
var mynewitem = {}; | ||
mynewitem.image = val.node.display_url; | ||
mynewitem.title = "<a href='https://www.instagram.com/p/" + pic + "/'>" + "https://www.instagram.com/p/" + pic + "/</a>"; | ||
|
@@ -140,7 +157,7 @@ <h1>{{ title }}</h1> | |
imageTimeout: 1E10, | ||
wait: true, | ||
}); | ||
})}); | ||
}); | ||
</script> | ||
{% endif %} | ||
|
||
|
@iranzo use
const
andlet
.