diff options
author | friendica <info@friendica.com> | 2014-02-04 19:39:56 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-04 19:39:56 -0800 |
commit | 8a11c2941395bdd325ac076bd22ad011fe41f3c7 (patch) | |
tree | a316119717113bea8af19c588637ca785bdc4f7d /view/js | |
parent | 9f439c3248c0464298e0b486a85ad74ec2df8270 (diff) | |
download | volse-hubzilla-8a11c2941395bdd325ac076bd22ad011fe41f3c7.tar.gz volse-hubzilla-8a11c2941395bdd325ac076bd22ad011fe41f3c7.tar.bz2 volse-hubzilla-8a11c2941395bdd325ac076bd22ad011fe41f3c7.zip |
make links in comments bookmark-able
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/main.js | 6 |
1 files changed, 4 insertions, 2 deletions
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; } |