From 8a11c2941395bdd325ac076bd22ad011fe41f3c7 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Feb 2014 19:39:56 -0800 Subject: make links in comments bookmark-able --- view/js/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'view/js') diff --git a/view/js/main.js b/view/js/main.js index c8e9fc9a2..44cb79949 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -55,6 +55,8 @@ if(typeof(insertFormatting) != 'undefined') return(insertFormatting(comment,BBcode,id)); + var urlprefix = ((BBcode == 'url') ? '#^' : ''); + var tmpStr = $("#comment-edit-text-" + id).val(); if(tmpStr == comment) { tmpStr = ""; @@ -68,11 +70,11 @@ if (document.selection) { textarea.focus(); selected = document.selection.createRange(); - selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]"; + selected.text = urlprefix+"["+BBcode+"]" + selected.text + "[/"+BBcode+"]"; } else if (textarea.selectionStart || textarea.selectionStart == "0") { var start = textarea.selectionStart; var end = textarea.selectionEnd; - textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length); + textarea.value = textarea.value.substring(0, start) + urlprefix+"["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length); } return true; } -- cgit v1.2.3