e2ee in comments and a bit of cleanup so not every theme has to define how to insert bbcode, only if they're doing something special (e.g. this is how to implement a javascript plugin :-)), and I got rid of the predefined http:// in the bbcode for urls. You're almost always pasting a url which already has that bit and it just creates an extra step.

This commit is contained in:
friendica
2013-11-14 15:41:25 -08:00
parent 33f570a187
commit 592c24e162
6 changed files with 55 additions and 42 deletions

View File

@@ -49,6 +49,37 @@
$("#comment-edit-text-" + id).val(tmpStr + ins);
}
function insertbbcomment(comment,BBcode,id) {
// allow themes to override this
if(typeof(insertFormatting != 'undefined'))
return(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);
}
textarea = document.getElementById("comment-edit-text-" +id);
if (document.selection) {
textarea.focus();
selected = document.selection.createRange();
selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
} else if (textarea.selectionStart || textarea.selectionStart == "0") {
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
}
return true;
}
function qCommentInsert(obj,id) {
var tmpStr = $("#comment-edit-text-" + id).val();
if(tmpStr == aStr['comment']) {