Update insertFormatting() definition
- Remove now useless comment parameter - Formatting all around - Update data-role=“insert-formatting” links - Update onclick=“insertFormatting()” links
This commit is contained in:
parent
b50f1f970f
commit
d7c9b293d3
19 changed files with 222 additions and 216 deletions
|
@ -59,33 +59,34 @@ $(document).ready(function(){
|
|||
});
|
||||
});
|
||||
|
||||
function insertFormatting(comment,BBcode,id) {
|
||||
|
||||
var tmpStr = $("#comment-edit-text-" + id).val();
|
||||
if(tmpStr == comment) {
|
||||
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);
|
||||
$("#comment-edit-text-" + id).val(tmpStr);
|
||||
}
|
||||
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);
|
||||
$("#comment-edit-text-" + id).val(tmpStr);
|
||||
}
|
||||
|
||||
textarea = document.getElementById("comment-edit-text-" +id);
|
||||
if (document.selection) {
|
||||
textarea.focus();
|
||||
selected = document.selection.createRange();
|
||||
if (BBcode == "url"){
|
||||
if (BBcode == "url") {
|
||||
selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
|
||||
} else
|
||||
selected.text = "["+BBcode+"]" + 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"){
|
||||
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);
|
||||
} 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,28 +15,28 @@
|
|||
class="comment-edit-bb">
|
||||
<li><a class="editicon boldbb shadow"
|
||||
style="cursor: pointer;" title="{{$edbold}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="b" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon italicbb shadow"
|
||||
style="cursor: pointer;" title="{{$editalic}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="i" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon underlinebb shadow"
|
||||
style="cursor: pointer;" title="{{$eduline}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="u" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon quotebb shadow"
|
||||
style="cursor: pointer;" title="{{$edquote}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="quote" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon codebb shadow"
|
||||
style="cursor: pointer;" title="{{$edcode}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="code" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon imagebb shadow"
|
||||
style="cursor: pointer;" title="{{$edimg}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon urlbb shadow"
|
||||
style="cursor: pointer;" title="{{$edurl}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="url" data-id="{{$id}}"></a></li>
|
||||
<li><a class="editicon videobb shadow"
|
||||
style="cursor: pointer;" title="{{$edvideo}}"
|
||||
data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
|
||||
data-role="insert-formatting" data-bbcode="video" data-id="{{$id}}"></a></li>
|
||||
</ul>
|
||||
<textarea id="comment-edit-text-{{$id}}"
|
||||
class="comment-edit-text-empty"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue