diabook-themes: smal fix in bbcode-js
This commit is contained in:
parent
b3f18945ba
commit
6db33fc513
|
@ -526,10 +526,16 @@ function insertFormatting(BBcode,id) {
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
selected = document.selection.createRange();
|
selected = document.selection.createRange();
|
||||||
|
if (BBcode == "url"){
|
||||||
|
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||||
|
} else
|
||||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||||
var start = textarea.selectionStart;
|
var start = textarea.selectionStart;
|
||||||
var end = textarea.selectionEnd;
|
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.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -527,10 +527,16 @@ function insertFormatting(BBcode,id) {
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
selected = document.selection.createRange();
|
selected = document.selection.createRange();
|
||||||
|
if (BBcode == "url"){
|
||||||
|
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||||
|
} else
|
||||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||||
var start = textarea.selectionStart;
|
var start = textarea.selectionStart;
|
||||||
var end = textarea.selectionEnd;
|
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.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -528,10 +528,16 @@ function insertFormatting(BBcode,id) {
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
selected = document.selection.createRange();
|
selected = document.selection.createRange();
|
||||||
|
if (BBcode == "url"){
|
||||||
|
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||||
|
} else
|
||||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||||
var start = textarea.selectionStart;
|
var start = textarea.selectionStart;
|
||||||
var end = textarea.selectionEnd;
|
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.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -538,10 +538,16 @@ function insertFormatting(BBcode,id) {
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
selected = document.selection.createRange();
|
selected = document.selection.createRange();
|
||||||
|
if (BBcode == "url"){
|
||||||
|
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||||
|
} else
|
||||||
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
|
||||||
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
|
||||||
var start = textarea.selectionStart;
|
var start = textarea.selectionStart;
|
||||||
var end = textarea.selectionEnd;
|
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.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue