forked from likebeta/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphoto.html
52 lines (49 loc) · 1.69 KB
/
photo.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
---
title: photo
layout: page
photo: true
---
<article>
<div id="archives">
<div id="photo" class="photo">
<h4>instagram</h4>
<div class="instagram">
<ul id="instagram"></ul>
</div>
<div class="clear"></div>
<h4>flickr</h4>
<div id="flickr" class="flickr"></div>
</div>
</div>
</article>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$.getJSON('https://api.instagram.com/v1/users/717790068/media/recent?client_id=e3ab8b93bd294dcb8338c38e1e7f627c&count=100&callback=?',
function(data) {
if (data.meta.code != 200) return;
var strHtml = '<ul>';
for (var i = 0; i < data.data.length; i++) {
var photo = data.data[i];
strHtml += '<li><a href="' + photo.link + '" target="_blank">';
strHtml += '<img src="' + photo.images.thumbnail.url + '" />';
strHtml += '</a></li>';
}
strHtml += '</ul>';
$('#instagram').html(strHtml);
});
$.getJSON('http://api.flickr.com/services/rest/?method=flickr.people.getPhotos&api_key=8079916309bfb2fb4d93c9684b4709b9&user_id=96149834@N05&format=json&per_page=100&page=1&jsoncallback=?',
function(data) {
if (data.stat != 'ok') return;
if (data.photos.total <= 0) return;
var strHtml = '<ul>';
for (var i = 0; i < data.photos.total; i++) {
var photo = data.photos.photo[i];
strHtml += '<li><a href="http://www.flickr.com/photos/likebeta/' + photo.id + '/" target="_blank">';
strHtml += '<img src="http://farm' + photo.farm + '.static.flickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_m.jpg" />';
strHtml += '</a></li>';
}
strHtml += '</ul>';
$('#flickr').html(strHtml);
});
})
</script>