Created
April 10, 2014 10:04
-
-
Save mcwhittemore/10364108 to your computer and use it in GitHub Desktop.
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
var contentBox = $(".box")[0]; | |
if(contentBox==undefined){ | |
throw new Error("Can't find paste element"); | |
} | |
else{ | |
var $content = $(contentBox); | |
var header = $content.find(".box-header")[0]; | |
header.innerHTML = "<h3 style='text-align: center;'>Comments</h3>"; | |
var box = $content.find(".box-body")[0]; | |
box.innerHTML = ""; | |
listComments(1, 10, box); | |
} | |
function listComments(page, maxPage, box){ | |
$.get(window.location.pathname+"?page="+page).done(function(body){ | |
var comments = $("<div>"+body+"</div>").find(".commit_comment"); | |
for(var i=0; i<comments.length; i++){ | |
box.appendChild(comments[i]); | |
} | |
if(page<maxPage){ | |
listComments(page+1, maxPage, box); | |
} | |
}).fail(function(){console.log("FAIL");}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment