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