diff options
Diffstat (limited to 'static/js')
-rw-r--r-- | static/js/posts.js | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/static/js/posts.js b/static/js/posts.js index 077b654..5be272a 100644 --- a/static/js/posts.js +++ b/static/js/posts.js @@ -124,8 +124,14 @@ function convertContent(actorName, content, opid) { isOP = " (OP)"; } - - newContent = newContent.replace(quote, '<a class="reply" title="' + link + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>'); + + var q = link + + if(document.getElementById(link + "-content") != null) { + q = document.getElementById(link + "-content").innerText; + } + + newContent = newContent.replace(quote, '<a class="reply" title="' + q + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>'); }) } @@ -143,6 +149,35 @@ function convertContent(actorName, content, opid) return newContent } +function convertContentNoLink(actorName, content, opid) +{ + var re = /(>>)(https?:\/\/)?(www\.)?.+\/\w+/gm; + var match = content.match(re); + var newContent = content; + if(match) + { + match.forEach(function(quote, i){ + var link = quote.replace('>>', '') + var isOP = "" + if(link == opid) + { + isOP = " (OP)"; + } + + var q = link + + if(document.getElementById(link + "-content") != null) { + q = document.getElementById(link + "-content").innerText; + } + + newContent = newContent.replace(quote, '>>>' + shortURL(actorName, link) + isOP); + + }) + } + + return newContent +} + function closeReply() { document.getElementById("reply-box").style.display = "none"; |