Seite 1 von 1

Smilie Einfügen: Firefox Problem

Verfasst: 08.01.2006 19:10
von ATARI
Moinsen,


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>
und hier der (firefox-freundliche) Code aus meiner quick_reply.tpl

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();
	}
}
(Codeauszug)

Jemand ne Ahnung wie man den oberen Code auch FF-freundlichen machen könnte?

Verfasst: 23.02.2006 12:16
von warhammer73
Hast Du die ganze Box getauscht, oder nur die Teile für den Firefox getauscht ?
Falls letzteres: Was hast Du alles gemacht ?



Danke !

Verfasst: 23.02.2006 14:17
von ATARI
ich hab die "alte" bbcode box (die meiner meinung eh viel besser ist als die überladene neue) und hab mir von reddogs box die js sachen abgekuckt.

ergebnis: die coole bbcodebox + firefox kompatible .js datei. harhar

Verfasst: 23.02.2006 15:44
von warhammer73
ATARI hat geschrieben:ich hab die "alte" bbcode box (die meiner meinung eh viel besser ist als die überladene neue) und hab mir von reddogs box die js sachen abgekuckt.

ergebnis: die coole bbcodebox + firefox kompatible .js datei. harhar
Hast Du nen bischen genauer was Du alles geändert hast ? :roll:

Verfasst: 23.02.2006 15:49
von ATARI
ja einfach die .js datei von reddogs box genommen und alles rausgeschmissen was in der .js vom alten mod nicht drinnen ist, wie zb. table bbcode und so.

Verfasst: 24.02.2006 12:41
von warhammer73
Ich habe gerade gesucht, ausser dem Atlas Mod habe ich gar keine
js-Datei ?