Skip to content

Commit

Permalink
Remove jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
iranzo committed Feb 5, 2020
1 parent f7df97e commit 99cc0c8
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -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/galleria@1.6.1/dist/galleria.min.js"></script>

<script type='text/javascript'>
var mypics = []
var pic = '{{ article.instagram_id }}';

This comment has been minimized.

Copy link
@talha131

talha131 Feb 5, 2020

Member

@iranzo use const and let.

const pic = 
$.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.


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>";
Expand Down Expand Up @@ -140,7 +157,7 @@ <h1>{{ title }}</h1>
imageTimeout: 1E10,
wait: true,
});
})});
});
</script>
{% endif %}

Expand Down

0 comments on commit 99cc0c8

Please sign in to comment.