From 8967fd733e26075288237164f66a7bf427a9ebce Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Sun, 6 Oct 2013 19:03:32 +0200 Subject: [PATCH] hide reply button when it is not possible to reply --- isso/js/app/dom.js | 9 +++++++++ isso/js/app/isso.js | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/isso/js/app/dom.js b/isso/js/app/dom.js index ee1fbe8..7cf580f 100644 --- a/isso/js/app/dom.js +++ b/isso/js/app/dom.js @@ -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() { // Mimimi, I am IE and I am so retarded, mimimi. this.parentNode.removeChild(this); diff --git a/isso/js/app/isso.js b/isso/js/app/isso.js index 3fab8fd..6d44cb0 100644 --- a/isso/js/app/isso.js +++ b/isso/js/app/isso.js @@ -245,6 +245,19 @@ define(["behave", "app/text/html", "app/dom", "app/utils", "app/api", "app/marku clear("a.edit"); 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 {