Pagina 1 van 1

bbcode box

Geplaatst: 16 jul 2003, 23:57
door Pinocchio
Ik heb wat zitten vertalen voor de bbcode box.
Ik kon geen languagepack vinden.
Misschien zien jullie er nog wat aan en anders veel plezier ermee.

Code: Selecteer alles

var theSelection = false;

var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav  = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));

var is_win   = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac    = (clientPC.indexOf("mac")!=-1);

b_help = "Bold: [B]tekst[/B]";
i_help = "Italic: [I]tekst[/I]";
u_help = "Onderstrepen: [U]tekst[/U]";
quote_help = "Quote: [quote]tekst[/quote]";
code_help = "Code: [code]code
";
img_help = "Afbeelding invoegen: [img]http://URL/foto.jpg[/img]";
url_help = "URL invoegen: http://URL plus \"Site Naam\" ";
fc_help = "Font Kleur: tekst U kunt HTML gebruiken, color=#FF0000";
fs_help = "Font Grote: Erg klein";
ft_help = "Font type: [font=Andalus]tekst[/font]";
rtl_help = "Berichtenvenster van Rechts naar Links uitlijnen.";
ltr_help = "Berichtenvenster van Links naar Rechts uitlijnen.";
mail_help = "Email invoegen: [email]Email Adres[/email]";
grad_help="Gradient tekst invoegen";
right_help="Tekst Rechts uitlijnen: [align=right]tekst[/align]";
left_help="Tekst Links uitlijnen: [align=left]tekst[/align]";
center_help="Tekst centreren: [align=center]tekst[/align]";
justify_help="Tekst zowel links als rechts uitlijnen: [align=justify]tekst[/align]";
marqr_help="Lopende tekst van Rechts naar Links: [marq=right]tekst[/marq]";
marql_help="Lopende tekst van Links naar Rechts: [marq=left]tekst[/marq]";
marqu_help="Lopende tekst van Onder naar boven: [marq=up]tekst[/marq]";
marqd_help="Lopende tekst van Boven naar Onder: [marq=down]tekst[/marq]";
stream_help="Stream bestand invoegen: [stream] URL [/stream]";
ram_help="Real Media bestand invoegen: [ram] URL [/ram]";
web_help="Web Pagina invoegen: [web] URL [/web]";
plain_help="Verwijder bbcodes van geselecteerde tekst";
hr_help="H-Line invoegen[hr]";
video_help="Video bestand invoegen: [video width=# height=#] URL [/video]";
flash_help="Flash bestand invoegen: [flash width=# height=#] URL [/flash]";
fade_help = "Fade tekst: [fade]tekst[/fade]";

var Quote = 0;
var Bold = 0;
var Italic = 0;
var Underline = 0;
var Code = 0;
var flash = 0;
var fc = 0;
var fs = 0;
var ft = 0;
var center = 0;
var right = 0;
var left = 0;
var justify = 0;
var fade = 0;
var marqd = 0;
var marqu = 0;
var marql = 0;
var marqr = 0;
var mail = 0;
var web = 0;
var video = 0;
var stream = 0;
var ram = 0;
var hr = 0;
var grad = 0;
var plain = 0;

function BBCplain() {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
temp = theSelection;
temp = temp.replace(/\[FLASH=([^\]]*)\]WIDTH=[0-9]{0,4} HEIGHT=[0-9]{0,4}\[\/FLASH\]/gi,"$1");
temp = temp.replace(/\[VIDEO=([^\]]*)\]WIDTH=[0-9]{0,4} HEIGHT=[0-9]{0,4}\[\/VIDEO\]/gi,"$1");
document.selection.createRange().text = temp.replace(/\[[^\]]*\]/gi,"");
}
}

function BBCgrad() {
var oSelect,oSelectRange;
document.post.message.focus();
oSelect = document.selection;
oSelectRange = oSelect.createRange();
if (oSelectRange.text.length < 1) { alert("Selecteer eerst de tekst a.u.b.");
return;
}
if (oSelectRange.text.length > 120) {
alert("Dit werkt alleen bij minder dan 120 tekens");
return;
}
showModalDialog("bbcode_box/grad.htm",oSelectRange,"help:nee; center:ja; status:nee; dialogHeight:50px; dialogWidth:50px");
}

function BBChr() {
document.post.message.value+="[hr]";
document.post.message.focus();
}

function BBCram() {
var FoundErrors = '';
var enterURL = prompt("De URL van Media Bestand invullen a.u.b.","http://");
if (!enterURL) {
FoundErrors += "U hebt niet de URL van het bestand ingevuld.";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = "[ram]"+enterURL+"[/ram]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function BBCstream() {
var FoundErrors = '';
var enterURL = prompt("De URL van Stream Bestand invullen a.u.b.","http://");
if (!enterURL) {
FoundErrors += "U hebt niet de URL van het bestand ingevuld.";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = "[stream]"+enterURL+"[/stream]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function BBCvideo() {
var FoundErrors = '';
var enterFURL = prompt("De URL van Video Bestand invullen a.u.b.", "http://");
if (!enterFURL) {
FoundErrors += "U hebt niet de URL van het bestand ingevuld.";
}
var enterW = prompt("Video Bestand width opgeven a.u.b.", "400");
if (!enterW) {
FoundErrors += "U hebt geen Video Bestand width opgegeven";
}
var enterH = prompt("Video Bestand height opgeven a.u.b.", "350");
if (!enterH) {
FoundErrors += "U hebt geen Video Bestand height opgegeven";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = "[video width="+enterW+" height="+enterH+"]"+enterFURL+"[/video]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function BBCweb() {
var FoundErrors = '';
var enterURL = prompt("De URL van pagina invullen a.u.b.","http://");
if (!enterURL) {
FoundErrors += "U hebt niet de URL van de pagina ingevuld";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = "[web]"+enterURL+"[/web]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function BBCmail() {
var FoundErrors = '';
var entermail = prompt("Vul het Email Adres in a.u.b.","");
if (!entermail) {
FoundErrors += "U hebt geen Email Adres ingevuld";
}
if (FoundErrors) {
alert("Fout:"+FoundErrors);
return;
}
var ToAdd = "[email]"+entermail+"[/email]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function BBCmarqu() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=up]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
if (marqu == 0) {
ToAdd = "[marq=up]";
document.post.marqu.src = "bbcode_box/images/marqu1.gif";
marqu = 1;
} else {
ToAdd = "[/marq]";
document.post.marqu.src = "bbcode_box/images/marqu.gif";
marqu = 0;
}
PostWrite(ToAdd);
}

function BBCmarql() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=left]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
if (marql == 0) {
ToAdd = "[marq=left]";
document.post.marql.src = "bbcode_box/images/marql1.gif";
marql = 1;
} else {
ToAdd = "[/marq]";
document.post.marql.src = "bbcode_box/images/marql.gif";
marql = 0;
}
PostWrite(ToAdd);
}

function BBCmarqr() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=right]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
if (marqr == 0) {
ToAdd = "[marq=right]";
document.post.marqr.src = "bbcode_box/images/marqr1.gif";
marqr = 1;
} else {
ToAdd = "[/marq]";
document.post.marqr.src = "bbcode_box/images/marqr.gif";
marqr = 0;
}
PostWrite(ToAdd);
}

function BBCdir(dirc) {
document.post.message.dir=(dirc);
}

function BBCfade() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[fade]" + theSelection + "[/fade]";
document.post.message.focus();
return;
}
}
if (fade == 0) {
ToAdd = "[fade]";
document.post.fade.src = "bbcode_box/images/fade1.gif";
fade = 1;
} else {
ToAdd = "[/fade]";
document.post.fade.src = "bbcode_box/images/fade.gif";
fade = 0;
}
PostWrite(ToAdd);
}

function BBCjustify() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=justify]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
if (justify == 0) {
ToAdd = "[align=justify]";
document.post.justify.src = "bbcode_box/images/justify1.gif";
justify = 1;
} else {
ToAdd = "[/align]";
document.post.justify.src = "bbcode_box/images/justify.gif";
justify = 0;
}
PostWrite(ToAdd);
}

function BBCleft() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=left]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
if (left == 0) {
ToAdd = "[align=left]";
document.post.left.src = "bbcode_box/images/left1.gif";
left = 1;
} else {
ToAdd = "[/align]";
document.post.left.src = "bbcode_box/images/left.gif";
left = 0;
}
PostWrite(ToAdd);
}

function BBCright() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=right]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
if (right == 0) {
ToAdd = "[align=right]";
document.post.right.src = "bbcode_box/images/right1.gif";
right = 1;
} else {
ToAdd = "[/align]";
document.post.right.src = "bbcode_box/images/right.gif";
right = 0;
}
PostWrite(ToAdd);
}

function BBCcenter() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[align=center]" + theSelection + "[/align]";
document.post.message.focus();
return;
}
}
if (center == 0) {
ToAdd = "[align=center]";
document.post.center.src = "bbcode_box/images/center1.gif";
center = 1;
} else {
ToAdd = "[/align]";
document.post.center.src = "bbcode_box/images/center.gif";
center = 0;
}
PostWrite(ToAdd);
}

function BBCft() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[font="+document.post.ft.value+"]" + theSelection + "[/font]";
document.post.message.focus();
return;
}
}
ToAdd = "[font="+document.post.ft.value+"]"+" "+"[/font]";
PostWrite(ToAdd);
}

function BBCfs() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[size="+document.post.fs.value+"]" + theSelection + "[/size]";
document.post.message.focus();
return;
}
}
ToAdd = "[size="+document.post.fs.value+"]"+" "+"[/size]";
PostWrite(ToAdd);
}

function BBCfc() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[color="+document.post.fc.value+"]" + theSelection + "[/color]";
document.post.message.focus();
return;
}
}
ToAdd = "[color="+document.post.fc.value+"]"+" "+"[/color]";
PostWrite(ToAdd);
}

function BBCmarqd() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[marq=down]" + theSelection + "[/marq]";
document.post.message.focus();
return;
}
}
if (marqd == 0) {
ToAdd = "[marq=down]";
document.post.marqd.src = "bbcode_box/images/marqd1.gif";
marqd = 1;
} else {
ToAdd = "[/marq]";
document.post.marqd.src = "bbcode_box/images/marqd.gif";
marqd = 0;
}
PostWrite(ToAdd);
}

function BBCflash() {
var FoundErrors = '';
var enterFURL = prompt("De URL van Flash Bestand invullen a.u.b.", "http://");
if (!enterFURL) {
FoundErrors += "U hebt niet de URL van het FlashB estand ingevuld.";
}
var enterW = prompt("Flash Bestand width opgeven a.u.b.", "250");
if (!enterW) {
FoundErrors += "U hebt de Flash width niet opgegeven";
}
var enterH = prompt("Flash Bestand height opgeven a.u.b.", "250");
if (!enterH) {
FoundErrors += "U hebt de Flash height niet opgegeven";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = "[flash width="+enterW+" height="+enterH+"]"+enterFURL+"[/flash]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function helpline(help) {
document.post.helpbox.value = eval(help + "_help");
document.post.helpbox.readOnly = "true";
}

function checkForm() {
formErrors = false;
if (document.post.message.value.length < 2) {
formErrors = "U moet een bericht invullen voordat u kan posten";
}
if (formErrors) {
alert(formErrors);
return false;
} else {
//formObj.preview.disabled = true;
//formObj.submit.disabled = true;
return true;
}
}

function emoticon(text) {
text = ' ' + text + ' ';
PostWrite(text);
}

function bbfontstyle(bbopen, bbclose) {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (!theSelection) {
document.post.message.value += bbopen + bbclose;
document.post.message.focus();
return;
}
document.selection.createRange().text = bbopen + theSelection + bbclose;
document.post.message.focus();
return;
} else {
document.post.message.value += bbopen + bbclose;
document.post.message.focus();
return;
}
storeCaret(document.post.message);
}

function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

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

function BBCcode() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "

Code: Selecteer alles

" + theSelection + "
";
document.post.message.focus();
return;
}
}
if (Code == 0) {
ToAdd = "

Code: Selecteer alles

";
		document.post.code.src = "bbcode_box/images/code1.gif";
		Code = 1;
	} else {
		ToAdd = "
";
document.post.code.src = "bbcode_box/images/code.gif";
Code = 0;
}
PostWrite(ToAdd);
}

function BBCquote() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "[quote]" + theSelection + "[/quote]";
document.post.message.focus();
return;
}
}
if (Quote == 0) {
ToAdd = "[quote]";
document.post.quote.src = "bbcode_box/images/quote1.gif";
Quote = 1;
} else {
ToAdd = "[/quote]";
document.post.quote.src = "bbcode_box/images/quote.gif";
Quote = 0;
}
PostWrite(ToAdd);
}

function BBCbold() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "" + theSelection + "";
document.post.message.focus();
return;
}
}
if (Bold == 0) {
ToAdd = "";
document.post.bold.src = "bbcode_box/images/bold1.gif";
Bold = 1;
} else {
ToAdd = "
";
document.post.bold.src = "bbcode_box/images/bold.gif";
Bold = 0;
}
PostWrite(ToAdd);
}

function BBCitalic() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "" + theSelection + "";
document.post.message.focus();
return;
}
}
if (Italic == 0) {
ToAdd = "";
document.post.italic.src = "bbcode_box/images/italic1.gif";
Italic = 1;
} else {
ToAdd = "
";
document.post.italic.src = "bbcode_box/images/italic.gif";
Italic = 0;
}
PostWrite(ToAdd);
}

function BBCunder() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "" + theSelection + "";
document.post.message.focus();
return;
}
}
if (Underline == 0) {
ToAdd = "";
document.post.under.src = "bbcode_box/images/under1.gif";
Underline = 1;
} else {
ToAdd = "
";
document.post.under.src = "bbcode_box/images/under.gif";
Underline = 0;
}
PostWrite(ToAdd);
}

function BBCurl() {
var FoundErrors = '';
var enterURL = prompt("URL invullen a.u.b.", "http://");
var enterTITLE = prompt("Pagina naam invullen a.u.b.", "Pagina naam");
if (!enterURL) {
FoundErrors += "U hebt geen URL ingevuld";
}
if (!enterTITLE) {
FoundErrors += "U hebt geen Pagina naam ingevuld";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = ""+enterTITLE+"";
document.post.message.value+=ToAdd;
document.post.message.focus();
}

function BBCimg() {
var FoundErrors = '';
var enterURL = prompt("De URL van de Afbeelding/Foto invullen a.u.b.","http://");
if (!enterURL) {
FoundErrors += "U hebt de URL van de Afbeelding/Foto niet ingevuld";
}
if (FoundErrors) {
alert("Fout :"+FoundErrors);
return;
}
var ToAdd = "[img]"+enterURL+"[/img]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}


[/code]