hide reply button when it is not possible to reply

This commit is contained in:
Martin Zimmermann 2013-10-06 19:03:32 +02:00
parent ab618ad898
commit 8967fd733e
2 changed files with 22 additions and 0 deletions

View File

@ -64,6 +64,15 @@ define(function() {
}); });
}; };
window.Element.prototype.detach = function() {
/*
Detach an element from the DOM and return it.
*/
this.parentNode.removeChild(this);
return this;
};
window.Element.prototype.remove = function() { window.Element.prototype.remove = function() {
// Mimimi, I am IE and I am so retarded, mimimi. // Mimimi, I am IE and I am so retarded, mimimi.
this.parentNode.removeChild(this); this.parentNode.removeChild(this);

View File

@ -245,6 +245,19 @@ define(["behave", "app/text/html", "app/dom", "app/utils", "app/api", "app/marku
clear("a.edit"); clear("a.edit");
clear("a.delete"); clear("a.delete");
// show direct reply to own comment when cookie is max aged
var show = function(el) {
if (utils.cookie(comment.id)) {
setTimeout(function() { show(el); }, 15*1000);
} else {
footer.append(el);
}
};
if (utils.cookie(comment.id)) {
show($("a.reply", footer).detach());
}
}; };
return { return {