Merge pull request #3481 from Hypolite/issue/#3480
Remove special case of "url" from insertFormatting
This commit is contained in:
commit
0cc15f5c3d
|
@ -37,20 +37,12 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,20 +15,12 @@ function insertFormatting(BBcode,id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "[" + BBcode + "]" + selected.text + "[/" + BBcode + "]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "[" + BBcode + "]" + textarea.value.substring(start, end) + "[/" + BBcode + "]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
$(textarea).trigger('change');
|
||||
|
||||
|
@ -76,8 +68,7 @@ function commentClose(obj,id) {
|
|||
function showHideCommentBox(id) {
|
||||
if ($('#comment-edit-form-' + id).is(':visible')) {
|
||||
$('#comment-edit-form-' + id).hide();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#comment-edit-form-' + id).show();
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +153,9 @@ function qCommentInsert(obj,id) {
|
|||
$(obj).val('');
|
||||
}
|
||||
|
||||
function confirmDelete() { return confirm(aStr.delitem); }
|
||||
function confirmDelete() {
|
||||
return confirm(aStr.delitem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide and removes an item element from the DOM after the deletion url is
|
||||
|
|
|
@ -423,20 +423,12 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -603,20 +603,12 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -71,20 +71,12 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,24 +20,14 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]"
|
||||
+ "http://" + textarea.value.substring(start, end)
|
||||
+ "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start)
|
||||
+ "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]"
|
||||
+ textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -33,20 +33,12 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,20 +50,12 @@ function insertFormatting(BBcode, id) {
|
|||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else {
|
||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||
}
|
||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
if (BBcode == "url") {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue