das Problem der alten BBCode Box war ja unter anderem, dass wenn man im Firefox ein Smilie mitten in den Text durch Draufklicken einfügen wollte, wurde es nicht an der gewünschten Stelle sondern am Ende des Textes eingefügt.
nun hat Reddog mit seiner neuen BBCode Box das gefixt, und auch ich hab meine alte BBCode Box nachgerüstet. Funzt auch prima in posting_body und auch im quick reply.
im photoalbum gibts - wenn man das sp1 drinnen hat - beim betrachten des fotos darunter auch ne textbox mit smilies daneben, und ich hab hab einefach keine Ahnung wie ich diese auch noch Firefox kompatibel machen kann, weil da der Code vollkommen anders aussieht als bei posting / quick reply..
so sieht der code vom album aus:
Code: Alles auswählen
<script language="JavaScript" type="text/javascript">
<!--
function checkForm() {
formErrors = false;
if ((document.commentform.comment.value.length < 2) && (document.commentform.rate.value == -1))
{
formErrors = "{L_COMMENT_NO_TEXT}";
}
else if (document.commentform.comment.value.length > {S_MAX_LENGTH})
{
formErrors = "{L_COMMENT_TOO_LONG}";
}
if (formErrors) {
alert(formErrors);
return false;
} else {
return true;
}
}
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//how to add smilies
function emotions(text)
{
if (document.commentform.comment.createTextRange && document.commentform.comment.caretPos)
{
var caretPos = document.commentform.comment.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
document.commentform.comment.focus();
}
else
{
document.commentform.comment.value += text;
document.commentform.comment.focus();
}
}
//pops up a window with all smilies
function openAllSmiles()
{
smiles = window.open('album_showpage.php?mode=smilies', '_phpbbsmilies', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=663');
smiles.focus();
return true;
}
// -->
</script>
Code: Alles auswählen
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function emoticon(text) {
var txtarea = document.post.message;
text = '' + text + '';
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '' ? caretPos.text + text + '' : caretPos.text + text;
txtarea.focus();
} else
if (txtarea.selectionEnd && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozWrap(txtarea, text, "");
return;
} else {
txtarea.value += text;
txtarea.focus();
}
}
Jemand ne Ahnung wie man den oberen Code auch FF-freundlichen machen könnte?