Seite 1 von 1

Frage zu: BBCodes & smilies enhancement 1.2.2

Verfasst: 21.08.2005 21:11
von Gumfuzi
http://www.phpbb.com/phpBB/viewtopic.ph ... 708#981708

Code: Alles auswählen

############################################################## 
## MOD Title:          BBCodes & smilies enhancement
## MOD Author:         -=ET=- < n/a > (n/a) http://www.golfexpert.net/phpbb
## MOD Description:    This MOD lets you insert BBCodes & smilies
##                     where you want, select 2 times the same font
##                     size, it provides a useful interface for urls,
##                     keeps your animated smilies animated, and so on...
## MOD Version:        1.2.2
## 
## Installation Level: Moderate
## Installation Time:  15 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      8
##      posting.php
##      privmsg.php
##      admin/admin_users.php
##      includes/bbcode.php
##      language/lang_english/lang_main.php
##      templates/subSilver/bbcode.tpl
##      templates/subSilver/posting_body.tpl
##      templates/subSilver/posting_smilies.tpl
In der posting_body.tpl stehen die ganzen "find"-Codes bei mir nicht in der Datei drin. Wenn ich den Mod noch nicht installiert habe, dann brauche ich doch (wie sonst immer) nur die "normale" Installanleitung... oder ist das bei dem Mod anders?

Warum geht es auf dieser Seite ohne Probleme, wenn ich via Firefox einen BBcode einfügen will?
Bei manchen Seiten kommt dann nur immer ein BBCode und nicht beide (bei einem markierten Wort).
Welcher Mod steht hier auf phpBB.de dahinter?

Verfasst: 23.08.2005 12:24
von Gumfuzi
@phpBB.de:
wie habt ihr das Problem hier im Forum gelöst, denn hier funzt es wunderbar?

Wäre für einen Tipp sehr dankbar!

Verfasst: 29.08.2005 20:44
von Gumfuzi
Lösung:
habe nun folgenden Code in der posting_body.tpl ersetzt:

Neuer Code:

Code: Alles auswählen

function checkForm() {

	formErrors = false;    

	if (document.post.message.value.length < 2) {
		formErrors = "{L_EMPTY_MESSAGE}";
	}

	if (formErrors) {
		alert(formErrors);
		return false;
	} else {
		bbstyle(-1);
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}

function emoticon(text) {
	var txtarea = document.post.message;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

function bbfontstyle(bbopen, bbclose) {
	var txtarea = document.post.message;

	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			txtarea.value += bbopen + bbclose;
			txtarea.focus();
			return;
		}
		document.selection.createRange().text = bbopen + theSelection + bbclose;
		txtarea.focus();
		return;
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbopen, bbclose);
		return;
	}
	else
	{
		txtarea.value += bbopen + bbclose;
		txtarea.focus();
	}
	storeCaret(txtarea);
}


function bbstyle(bbnumber) {
	var txtarea = document.post.message;

	txtarea.focus();
	donotinsert = false;
	theSelection = false;
	bblast = 0;

	if (bbnumber == -1) { // Close all open tags & default button names
		while (bbcode[0]) {
			butnumber = arraypop(bbcode) - 1;
			txtarea.value += bbtags[butnumber + 1];
			buttext = eval('document.post.addbbcode' + butnumber + '.value');
			eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
		}
		imageTag = false; // All tags are closed including image tags :D
		txtarea.focus();
		return;
	}

	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text; // Get text selection
		if (theSelection) {
			// Add tags around selection
			document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
			txtarea.focus();
			theSelection = '';
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
		return;
	}
	
	// Find last occurance of an open tag the same as the one just clicked
	for (i = 0; i < bbcode.length; i++) {
		if (bbcode[i] == bbnumber+1) {
			bblast = i;
			donotinsert = true;
		}
	}

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				txtarea.value += bbtags[butnumber + 1];
				buttext = eval('document.post.addbbcode' + butnumber + '.value');
				eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
				imageTag = false;
			}
			txtarea.focus();
			return;
	} else { // Open tags
	
		if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another
			txtarea.value += bbtags[15];
			lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
			document.post.addbbcode14.value = "Img";	// Return button back to normal state
			imageTag = false;
		}
		
		// Open tag
		txtarea.value += bbtags[bbnumber];
		if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
		arraypush(bbcode,bbnumber+1);
		eval('document.post.addbbcode'+bbnumber+'.value += "*"');
		txtarea.focus();
		return;
	}
	storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2) 
		selEnd = selLength;

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}
Nun funzt es mit dem Firefox auch!