-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathindex.html
85 lines (69 loc) · 3.26 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
<!-- Link to load Font Awesome Icon set from CDN -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- Bootstrap Paper -->
<link rel="stylesheet" href="https://bootswatch.com/paper/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>I woke up in a new Bugatti!!</h1>
<a href="https://instagram.com/oauth/authorize/?client_id=bb53c3eb16724cc7a43ada643a9c7200&redirect_uri=http://northdacoder.github.io/feedme/&response_type=token"><button class="btn btn-primary btn-lg">Login with <i class="fa fa-instagram"></i> Instagram</button></a>
<a href="https://instagram.com/accounts/logout/"> Logout </a>
</div>
<div class="row" id="instafeed" style="padding-top: 50px;">
<h1>User photos should load here</h1>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
console.log("Document is now ready!");
var imageHolder = $("#instafeed");
console.log($(window));
var myToken = window.location.hash.split("=");
myToken = myToken[1];
console.log(myToken);
function createHtml (data) {
console.log("createHtml function fired");
data = data.data;
for (var i = 0; i < data.length; i++) {
console.log(data[i]);
var image = data[i].images.standard_resolution.url;
console.log(image);
var htmlString = '<br>' +
'<div class="well">' +
'<h1>' + data[i].user.username + '</h1>' +
'<img src="' + image + '" class="img-thumbnail" />' +
'</div>';
imageHolder.append(htmlString);
imageHolder.append(data[i]);
}
}
function getData () {
$.ajax({
type: 'GET',
url: "https://api.instagram.com/v1/users/self/feed?access_token=" + myToken,
dataType: 'jsonp',
success: function(json) {
console.log("Data has been loaded from Instagram");
createHtml(json);
},
error: function(error) {
console.log(error);
}
});
}
getData();
});
</script>
</body>
</html>