Merge pull request #7728 from MrPetovan/task/7682-better-insert-link-button
Discriminate between links and non-links in [url] BBCode tag insertion
This commit is contained in:
commit
2b8642d2b5
8 changed files with 59 additions and 161 deletions
|
@ -45,29 +45,6 @@ function vier_init(App $a)
|
|||
$a->page['htmlhead'] .= <<< EOT
|
||||
<link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' />
|
||||
<script type="text/javascript">
|
||||
|
||||
function insertFormatting(BBcode, id) {
|
||||
var tmpStr = $("#comment-edit-text-" + id).val();
|
||||
if (tmpStr == "") {
|
||||
$("#comment-edit-text-" + id).addClass("comment-edit-text-full");
|
||||
$("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
|
||||
openMenu("comment-edit-submit-wrapper-" + id);
|
||||
}
|
||||
|
||||
textarea = document.getElementById("comment-edit-text-" +id);
|
||||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
selected.text = "["+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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function showThread(id) {
|
||||
$("#collapsed-comments-" + id).show()
|
||||
$("#collapsed-comments-" + id + " .collapsed-comments").show()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue