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
|
@ -72,21 +72,19 @@
|
|||
/* setup comment textarea buttons */
|
||||
/* comment textarea buttons needs some "data-*" attributes to work:
|
||||
* data-role="insert-formatting" : to mark the element as a formatting button
|
||||
* data-comment="<string>" : string for "Comment", used by insertFormatting() function
|
||||
* data-bbcode="<string>" : name of the bbcode element to insert. insertFormatting() will insert it as "[name][/name]"
|
||||
* data-id="<string>" : id of the comment, used to find other comment-related element, like the textarea
|
||||
* */
|
||||
$('body').on('click','[data-role="insert-formatting"]', function(e) {
|
||||
e.preventDefault();
|
||||
var o = $(this);
|
||||
var comment = o.data('comment');
|
||||
var bbcode = o.data('bbcode');
|
||||
var id = o.data('id');
|
||||
if (bbcode=="img") {
|
||||
Dialog.doImageBrowser("comment", id);
|
||||
return;
|
||||
}
|
||||
insertFormatting(comment, bbcode, id);
|
||||
insertFormatting(bbcode, id);
|
||||
});
|
||||
|
||||
/* event from comment textarea button popups */
|
||||
|
|
|
@ -20,28 +20,28 @@
|
|||
<ul class="comment-edit-bb-{{$id}}">
|
||||
<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>
|
||||
<div class="comment-edit-bb-end"></div>
|
||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});"></textarea>
|
||||
|
|
|
@ -23,28 +23,28 @@
|
|||
<ul class="comment-edit-bb-{{$id}}">
|
||||
<li><a class="editicon boldbb shadow"
|
||||
style="cursor: pointer;" title="{{$edbold}}"
|
||||
onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('b', {{$id}});"></a></li>
|
||||
<li><a class="editicon italicbb shadow"
|
||||
style="cursor: pointer;" title="{{$editalic}}"
|
||||
onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('i', {{$id}});"></a></li>
|
||||
<li><a class="editicon underlinebb shadow"
|
||||
style="cursor: pointer;" title="{{$eduline}}"
|
||||
onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('u', {{$id}});"></a></li>
|
||||
<li><a class="editicon quotebb shadow"
|
||||
style="cursor: pointer;" title="{{$edquote}}"
|
||||
onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('quote', {{$id}});"></a></li>
|
||||
<li><a class="editicon codebb shadow"
|
||||
style="cursor: pointer;" title="{{$edcode}}"
|
||||
onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('code', {{$id}});"></a></li>
|
||||
<li><a class="editicon imagebb shadow"
|
||||
style="cursor: pointer;" title="{{$edimg}}"
|
||||
onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('img', {{$id}});"></a></li>
|
||||
<li><a class="editicon urlbb shadow"
|
||||
style="cursor: pointer;" title="{{$edurl}}"
|
||||
onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('url', {{$id}});"></a></li>
|
||||
<li><a class="editicon videobb shadow"
|
||||
style="cursor: pointer;" title="{{$edvideo}}"
|
||||
onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('video', {{$id}});"></a></li>
|
||||
</ul>
|
||||
<div class="comment-edit-bb-end"></div>
|
||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
|
||||
|
|
|
@ -23,33 +23,34 @@ set_template_engine($a, 'smarty3');
|
|||
}
|
||||
$a->page['htmlhead'] .= <<< EOT
|
||||
<script>
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,33 +3,34 @@
|
|||
*/
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,38 +33,38 @@
|
|||
{{/if}}
|
||||
<ul class="comment-edit-bb-{{$id}} comment-icon-list nav nav-pills pull-right">
|
||||
<li>
|
||||
<a class="icon" style="cursor: pointer;" title="{{$edimg}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}">
|
||||
<a class="icon" style="cursor: pointer;" title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}">
|
||||
<i class="fa fa-picture-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl}}" onclick="insertFormatting('{{$comment}}','url',{{$id}});">
|
||||
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl}}" onclick="insertFormatting('url',{{$id}});">
|
||||
<i class="fa fa-link"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon bb-video" style="cursor: pointer;" title="{{$edvideo}}" onclick="insertFormatting('{{$comment}}','video',{{$id}});">
|
||||
<a class="icon bb-video" style="cursor: pointer;" title="{{$edvideo}}" onclick="insertFormatting('video',{{$id}});">
|
||||
<i class="fa fa-video-camera"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="icon underline" style="cursor: pointer;" title="{{$eduline}}" onclick="insertFormatting('{{$comment}}','u',{{$id}});">
|
||||
<a class="icon underline" style="cursor: pointer;" title="{{$eduline}}" onclick="insertFormatting('u',{{$id}});">
|
||||
<i class="fa fa-underline"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon italic" style="cursor: pointer;" title="{{$editalic}}" onclick="insertFormatting('{{$comment}}','i',{{$id}});">
|
||||
<a class="icon italic" style="cursor: pointer;" title="{{$editalic}}" onclick="insertFormatting('i',{{$id}});">
|
||||
<i class="fa fa-italic"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon bold" style="cursor: pointer;" title="{{$edbold}}" onclick="insertFormatting('{{$comment}}','b',{{$id}});">
|
||||
<a class="icon bold" style="cursor: pointer;" title="{{$edbold}}" onclick="insertFormatting('b',{{$id}});">
|
||||
<i class="fa fa-bold"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon quote" style="cursor: pointer;" title="{{$edquote}}" onclick="insertFormatting('{{$comment}}','quote',{{$id}});">
|
||||
<a class="icon quote" style="cursor: pointer;" title="{{$edquote}}" onclick="insertFormatting('quote',{{$id}});">
|
||||
<i class="fa fa-quote-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -424,11 +424,9 @@ function qCommentInsert(obj,id) {
|
|||
$(obj).val("");
|
||||
}
|
||||
|
||||
function insertFormatting(comment,BBcode,id) {
|
||||
|
||||
function insertFormatting(BBcode,id) {
|
||||
var tmpStr = $("#comment-edit-text-" + id).val();
|
||||
if(tmpStr == comment) {
|
||||
tmpStr = "";
|
||||
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);
|
||||
|
@ -439,18 +437,21 @@ function insertFormatting(comment,BBcode,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,19 +12,19 @@
|
|||
<ul class="comment-edit-bb-{{$id}}">
|
||||
<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>
|
||||
</ul>
|
||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});"></textarea>
|
||||
{{if $qcomment}}
|
||||
|
|
|
@ -23,28 +23,28 @@
|
|||
<ul class="comment-edit-bb-{{$id}}">
|
||||
<li><a class="editicon boldbb shadow"
|
||||
style="cursor: pointer;" title="{{$edbold}}"
|
||||
onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('b', {{$id}});"></a></li>
|
||||
<li><a class="editicon italicbb shadow"
|
||||
style="cursor: pointer;" title="{{$editalic}}"
|
||||
onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('i', {{$id}});"></a></li>
|
||||
<li><a class="editicon underlinebb shadow"
|
||||
style="cursor: pointer;" title="{{$eduline}}"
|
||||
onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('u', {{$id}});"></a></li>
|
||||
<li><a class="editicon quotebb shadow"
|
||||
style="cursor: pointer;" title="{{$edquote}}"
|
||||
onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('quote', {{$id}});"></a></li>
|
||||
<li><a class="editicon codebb shadow"
|
||||
style="cursor: pointer;" title="{{$edcode}}"
|
||||
onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('code', {{$id}});"></a></li>
|
||||
<li><a class="editicon imagebb shadow"
|
||||
style="cursor: pointer;" title="{{$edimg}}"
|
||||
onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('img', {{$id}});"></a></li>
|
||||
<li><a class="editicon urlbb shadow"
|
||||
style="cursor: pointer;" title="{{$edurl}}"
|
||||
onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('url', {{$id}});"></a></li>
|
||||
<li><a class="editicon videobb shadow"
|
||||
style="cursor: pointer;" title="{{$edvideo}}"
|
||||
onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('video', {{$id}});"></a></li>
|
||||
</ul>
|
||||
<div class="comment-edit-bb-end"></div>
|
||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
|
||||
|
|
|
@ -797,11 +797,9 @@ function itemFiler(id) {
|
|||
* Comments
|
||||
*/
|
||||
|
||||
function insertFormatting(comment,BBcode,id) {
|
||||
|
||||
function insertFormatting(BBcode, id) {
|
||||
var tmpStr = $("#comment-edit-text-" + id).val();
|
||||
if(tmpStr == comment) {
|
||||
tmpStr = "";
|
||||
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);
|
||||
|
@ -812,18 +810,21 @@ function insertFormatting(comment,BBcode,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,28 +12,28 @@
|
|||
<ul class="comment-edit-bb" id="comment-edit-bb-{{$id}}">
|
||||
<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" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});"></textarea>
|
||||
{{if $qcomment}}
|
||||
|
|
|
@ -23,28 +23,28 @@
|
|||
<ul class="comment-edit-bb-{{$id}}">
|
||||
<li><a class="editicon boldbb shadow"
|
||||
style="cursor: pointer;" title="{{$edbold}}"
|
||||
onclick="insertFormatting('{{$comment}}','b', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('b', {{$id}});"></a></li>
|
||||
<li><a class="editicon italicbb shadow"
|
||||
style="cursor: pointer;" title="{{$editalic}}"
|
||||
onclick="insertFormatting('{{$comment}}','i', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('i', {{$id}});"></a></li>
|
||||
<li><a class="editicon underlinebb shadow"
|
||||
style="cursor: pointer;" title="{{$eduline}}"
|
||||
onclick="insertFormatting('{{$comment}}','u', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('u', {{$id}});"></a></li>
|
||||
<li><a class="editicon quotebb shadow"
|
||||
style="cursor: pointer;" title="{{$edquote}}"
|
||||
onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('quote', {{$id}});"></a></li>
|
||||
<li><a class="editicon codebb shadow"
|
||||
style="cursor: pointer;" title="{{$edcode}}"
|
||||
onclick="insertFormatting('{{$comment}}','code', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('code', {{$id}});"></a></li>
|
||||
<li><a class="editicon imagebb shadow"
|
||||
style="cursor: pointer;" title="{{$edimg}}"
|
||||
onclick="insertFormatting('{{$comment}}','img', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('img', {{$id}});"></a></li>
|
||||
<li><a class="editicon urlbb shadow"
|
||||
style="cursor: pointer;" title="{{$edurl}}"
|
||||
onclick="insertFormatting('{{$comment}}','url', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('url', {{$id}});"></a></li>
|
||||
<li><a class="editicon videobb shadow"
|
||||
style="cursor: pointer;" title="{{$edvideo}}"
|
||||
onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
|
||||
onclick="insertFormatting('video', {{$id}});"></a></li>
|
||||
</ul>
|
||||
<div class="comment-edit-bb-end"></div>
|
||||
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -8,37 +8,38 @@ function tautogrow(id) {
|
|||
$("textarea#comment-edit-text-" + id).autogrow();
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
textarea = document.getElementById("comment-edit-text-" + 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;
|
||||
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();
|
||||
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;
|
||||
}
|
||||
|
||||
function cmtBbOpen(id) {
|
||||
|
|
|
@ -19,33 +19,34 @@ function smoothly_init(&$a) {
|
|||
$a->page['htmlhead'] .= <<< EOT
|
||||
|
||||
<script>
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@
|
|||
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;">
|
||||
|
||||
<div class="comment-edit-bb">
|
||||
<a title="{{$edimg}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="{{$id}}"><i class="icon-picture"></i></a>
|
||||
<a title="{{$edurl}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="{{$id}}"><i class="icon-link"></i></a>
|
||||
<a title="{{$edvideo}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"><i class="icon-film"></i></a>
|
||||
|
||||
<a title="{{$eduline}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="{{$id}}"><i class="icon-underline"></i></a>
|
||||
<a title="{{$editalic}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="{{$id}}"><i class="icon-italic"></i></a>
|
||||
<a title="{{$edbold}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="{{$id}}"><i class="icon-bold"></i></a>
|
||||
<a title="{{$edquote}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="{{$id}}"><i class="icon-quote-left"></i></a>
|
||||
<a title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}"><i class="icon-picture"></i></a>
|
||||
<a title="{{$edurl}}" data-role="insert-formatting" data-bbcode="url" data-id="{{$id}}"><i class="icon-link"></i></a>
|
||||
<a title="{{$edvideo}}" data-role="insert-formatting" data-bbcode="video" data-id="{{$id}}"><i class="icon-film"></i></a>
|
||||
|
||||
<a title="{{$eduline}}" data-role="insert-formatting" data-bbcode="u" data-id="{{$id}}"><i class="icon-underline"></i></a>
|
||||
<a title="{{$editalic}}" data-role="insert-formatting" data-bbcode="i" data-id="{{$id}}"><i class="icon-italic"></i></a>
|
||||
<a title="{{$edbold}}" data-role="insert-formatting" data-bbcode="b" data-id="{{$id}}"><i class="icon-bold"></i></a>
|
||||
<a title="{{$edquote}}" data-role="insert-formatting" data-bbcode="quote" data-id="{{$id}}"><i class="icon-quote-left"></i></a>
|
||||
|
||||
</div>
|
||||
<input type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" class="comment-edit-submit" name="submit" value="{{$submit}}" />
|
||||
|
|
|
@ -27,27 +27,27 @@
|
|||
<div id="event-desc-text">{{$d_text}}</div>
|
||||
<textarea id="comment-edit-text-desc" rows="8" cols="64" name="desc" autocomplete="off">{{$d_orig}}</textarea>
|
||||
<div id="event-desc-text-edit-bb" class="comment-edit-bb">
|
||||
<a title="{{$edimg}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="desc"><i class="icon-picture"></i></a>
|
||||
<a title="{{$edurl}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="desc"><i class="icon-link"></i></a>
|
||||
<a title="{{$edvideo}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="desc"><i class="icon-film"></i></a>
|
||||
<a title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="desc"><i class="icon-picture"></i></a>
|
||||
<a title="{{$edurl}}" data-role="insert-formatting" data-bbcode="url" data-id="desc"><i class="icon-link"></i></a>
|
||||
<a title="{{$edvideo}}" data-role="insert-formatting" data-bbcode="video" data-id="desc"><i class="icon-film"></i></a>
|
||||
|
||||
<a title="{{$eduline}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="desc"><i class="icon-underline"></i></a>
|
||||
<a title="{{$editalic}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="desc"><i class="icon-italic"></i></a>
|
||||
<a title="{{$edbold}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="desc"><i class="icon-bold"></i></a>
|
||||
<a title="{{$edquote}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="desc"><i class="icon-quote-left"></i></a>
|
||||
<a title="{{$eduline}}" data-role="insert-formatting" data-bbcode="u" data-id="desc"><i class="icon-underline"></i></a>
|
||||
<a title="{{$editalic}}" data-role="insert-formatting" data-bbcode="i" data-id="desc"><i class="icon-italic"></i></a>
|
||||
<a title="{{$edbold}}" data-role="insert-formatting" data-bbcode="b" data-id="desc"><i class="icon-bold"></i></a>
|
||||
<a title="{{$edquote}}" data-role="insert-formatting" data-bbcode="quote" data-id="desc"><i class="icon-quote-left"></i></a>
|
||||
</div>
|
||||
|
||||
<div id="event-location-text">{{$l_text}}</div>
|
||||
<textarea id="comment-edit-text-location" rows="4" cols="64" name="location">{{$l_orig}}</textarea>
|
||||
<div id="event-location-text-edit-bb" class="comment-edit-bb">
|
||||
<a title="{{$edimg}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="img" data-id="location"><i class="icon-picture"></i></a>
|
||||
<a title="{{$edurl}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="url" data-id="location"><i class="icon-link"></i></a>
|
||||
<a title="{{$edvideo}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="location"><i class="icon-film"></i></a>
|
||||
<a title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="location"><i class="icon-picture"></i></a>
|
||||
<a title="{{$edurl}}" data-role="insert-formatting" data-bbcode="url" data-id="location"><i class="icon-link"></i></a>
|
||||
<a title="{{$edvideo}}" data-role="insert-formatting" data-bbcode="video" data-id="location"><i class="icon-film"></i></a>
|
||||
|
||||
<a title="{{$eduline}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="u" data-id="location"><i class="icon-underline"></i></a>
|
||||
<a title="{{$editalic}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="i" data-id="location"><i class="icon-italic"></i></a>
|
||||
<a title="{{$edbold}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="b" data-id="location"><i class="icon-bold"></i></a>
|
||||
<a title="{{$edquote}}" data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="quote" data-id="location"><i class="icon-quote-left"></i></a>
|
||||
<a title="{{$eduline}}" data-role="insert-formatting" data-bbcode="u" data-id="location"><i class="icon-underline"></i></a>
|
||||
<a title="{{$editalic}}" data-role="insert-formatting" data-bbcode="i" data-id="location"><i class="icon-italic"></i></a>
|
||||
<a title="{{$edbold}}" data-role="insert-formatting" data-bbcode="b" data-id="location"><i class="icon-bold"></i></a>
|
||||
<a title="{{$edquote}}" data-role="insert-formatting" data-bbcode="quote" data-id="location"><i class="icon-quote-left"></i></a>
|
||||
</div>
|
||||
|
||||
<div id="event-location-break"></div>
|
||||
|
|
|
@ -36,33 +36,34 @@ function vier_init(&$a) {
|
|||
<link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' />
|
||||
<script type="text/javascript">
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue