use el.on("click") to load more comments and prevent default

pull/98/head
Martin Zimmermann 10 years ago
parent d0a50c7905
commit 94ee6a6981

@ -67,38 +67,37 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
entrypoint.append(el); entrypoint.append(el);
$("a.load_hidden", el).toggle("click", $("a.load_hidden", el).on("click", function() {
function() { el.remove();
el.remove(); api.fetch($("#isso-thread").getAttribute("data-isso-id"),
api.fetch($("#isso-thread").getAttribute("data-isso-id"), config["reveal-on-click"], config["max-comments-nested"],
config["reveal-on-click"], config["max-comments-nested"], comment.id,
comment.id, lastcreated).then(
lastcreated).then( function(rv) {
function(rv) { if (rv.total_replies === 0) {
if (rv.total_replies === 0) { return;
return; }
}
var lastcreated = 0;
rv.replies.forEach(function(commentObject) {
insert(commentObject, false);
if(commentObject.created > lastcreated) {
lastcreated = commentObject.created;
}
});
if(rv.hidden_replies > 0) {
insert_loader(rv, lastcreated);
}
if (window.location.hash.length > 0) { var lastcreated = 0;
$(window.location.hash).scrollIntoView(); rv.replies.forEach(function(commentObject) {
insert(commentObject, false);
if(commentObject.created > lastcreated) {
lastcreated = commentObject.created;
} }
},
function(err) {
console.log(err);
}); });
});
if(rv.hidden_replies > 0) {
insert_loader(rv, lastcreated);
}
if (window.location.hash.length > 0) {
$(window.location.hash).scrollIntoView();
}
},
function(err) {
console.log(err);
});
});
}; };
var insert = function(comment, scrollIntoView) { var insert = function(comment, scrollIntoView) {

Loading…
Cancel
Save