Created
December 15, 2011 23:49
-
-
Save dhg/1483546 to your computer and use it in GitHub Desktop.
Test
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
$(document).ready(function() { | |
//Global Vars ----------------------------------------------------- | |
var posts = $('.posts'), | |
afterString, | |
subdomain = readParams('r'), | |
loader = $('.wash'), | |
loadMore = $('.loadmore-button'), | |
activePost = 0, | |
post, | |
subredditHint = $('.subreddit-hint p'), | |
hintIndex = 0, | |
lock = false, | |
commandDown = false; | |
//Initial Load ------------------------------------------------------------------------------- | |
window.scrollTo(0,0); | |
// If viewType cookied, set it | |
if($.cookie("viewType")) { | |
$('body') | |
.removeClass('fullview') | |
.removeClass('listview') | |
.addClass($.cookie("viewType")); | |
} | |
//Initial JSON load | |
loadJSON(); | |
//JSON ------------------------------------------------------------------------------- | |
// Load data | |
function loadJSON() { | |
$.getJSON("http://www.reddit.com/"+subdomain+".json?limit=25&after="+afterString+"&jsonp=?", null, function(data) { | |
$.each(data.data.children, function(i, post) { | |
renderPost(post.data); | |
afterString = post.data.name; | |
}); | |
}).complete(function() { | |
post = $('.post'); | |
classifyImages(); | |
loader.fadeOut(100); | |
loadMore.removeClass('loading'); | |
lock = false; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment