Created
December 21, 2013 09:13
-
-
Save asonas/8067145 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| $ -> | |
| tumblog = "gazo0141.tumblr.com" | |
| api_key ="GesVlVXWDOv1DKzVowf2jqsY8ndlgag0Uxy8HlLzN8AXAYd8FE" | |
| url = "http://api.tumblr.com/v2/blog/#{tumblog}/posts/photo?api_key=#{api_key}&jsonp=?" | |
| console.log url | |
| $.ajax | |
| url: url | |
| .done (data) -> | |
| return console.log "error" unless data.status == 200 | |
| posts = data['response']['posts'] | |
| $.each posts, (post) -> | |
| ourl = post['photos'][0]['original_size']['url'] | |
| $('ul').append('<li class="thumb"><img src="' + ourl + '"></li>') | |
| $('.thumb').nailthumb | |
| width: 200, | |
| height: 200, | |
| method: 'resize', | |
| $('.slider').bxSlider | |
| mode: 'vertical', | |
| slideWidth: 200, | |
| pager: false, | |
| controls: false, | |
| auto: true, | |
This file contains hidden or 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
| $(function() { | |
| var api_key, tumblog, url; | |
| tumblog = "gazo0141.tumblr.com"; | |
| api_key = "GesVlVXWDOv1DKzVowf2jqsY8ndlgag0Uxy8HlLzN8AXAYd8FE"; | |
| url = "http://api.tumblr.com/v2/blog/" + tumblog + "/posts/photo?api_key=" + api_key + "&jsonp=?"; | |
| return $.ajax({ | |
| url: url | |
| }).done(function(data) { | |
| var posts; | |
| if (data.status !== 200) { | |
| return console.log("error"); | |
| } | |
| posts = data['response']['posts']; | |
| $.each(posts, function(post) { | |
| var ourl; | |
| ourl = post['photos'][0]['original_size']['url']; | |
| return $('ul').append('<li class="thumb"><img src="' + ourl + '"></li>'); | |
| }); | |
| $('.thumb').nailthumb({ | |
| width: 200, | |
| height: 200, | |
| method: 'resize' | |
| }); | |
| return $('.slider').bxSlider({ | |
| mode: 'vertical', | |
| slideWidth: 200, | |
| pager: false, | |
| controls: false, | |
| auto: true | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment