function bbcode(text) { search = new Array( //g, /\[img\](.+?)\[\/img\]/g, /\[url=([\w]+?:\/\/[^ \\"\n\r\t<]*?)\](.*?)\[\/url\]/g, /\[url\]((www|ftp|)\.[^ \\"\n\r\t<]*?)\[\/url\]/g, /\[url=((www|ftp|)\.[^ \\"\n\r\t<]*?)\](.*?)\[\/url\]/g, /\[email\](([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+))\[\/email\]/g, /\[b\](.*?)\[\/b\]/g, /\[i\](.*?)\[\/i\]/g, /\[u\](.*?)\[\/u\]/g, /\[url\](http:\/\/[^ \\"\n\r\t<]*?)\[\/url\]/g, /\n/g, /\r/g, /\[quote=(.+?)\](.+?)\[\/quote\]/gi, /_BLACKSLASHN_/g, /_BLACKSLASHR_/g, /http:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_]+)/g, /\n/g ); replace = new Array( "<", ">", "\"An", "$2", "$1", "$1", "$1", "$1", "$1", "$1", "$1", "_BLACKSLASHN_", "_BLACKSLASHR_", "
Válasz $1 üzenetére:
$2
", "\n", "\r", "
", "\n
" ); for(i = 0; i < search.length; i++) { text = text.replace(search[i],replace[i]); } return text; } var elonezes = true; function elonezet(field, signo) { var text; if(elonezes) { text = bbcode(field.value)+"\n"; if(signo != "") text += "
--
"+signo; text = smilies(text); document.getElementById('preview').innerHTML = text; document.getElementById('ta').style.display='none'; document.getElementById('preview').style.display='block'; document.getElementById('elonezes').value = 'Szerkesztem még'; } else { document.getElementById('elonezes').value = 'Előnézem'; document.getElementById('ta').style.display='block'; document.getElementById('preview').style.display='none'; } elonezes = !elonezes; } function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function posztol() { if(trim(document.bb.posztszoveg.value) == "") { window.alert('Az induló hozzászólás is kötelező!'); return; } document.bb.submit(); } function addtag(tag) { var txt; if(window.document.bb.posztszoveg.readOnly) return; addTags("["+tag+"]", "[/"+tag+"]"); // txt = window.document.bb.posztszoveg; // txt.value = (txt.value).substring(0, txt.selectionStart) + "["+tag+"]" + (txt.value).substring(txt.selectionStart, txt.selectionEnd) + "[/"+tag+"]" + (txt.value).substring(txt.selectionEnd, txt.textLength); return; } function addsmiley(text) { insertAtCursor(document.bb.posztszoveg, " "+text+" "); } function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue+ myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } function addTags(Tag,fTag,Message) { var obj = document.bb.posztszoveg; obj.focus(); if (document.selection && document.selection.createRange) // Internet Explorer { sel = document.selection.createRange(); if (sel.parentElement() == obj) sel.text = Tag + sel.text + fTag; } else if (typeof(obj) != "undefined") // Firefox { var longueur = parseInt(obj.value.length); var selStart = obj.selectionStart; var selEnd = obj.selectionEnd; obj.value = obj.value.substring(0,selStart) + Tag + obj.value.substring(selStart,selEnd) + fTag + obj.value.substring(selEnd,longueur); } else obj.value += Tag + fTag; obj.focus(); } var re_mit = Array( /(\s+)(:-?\]+)(\s+)/m, /(\s+)(\(a\))(\s+)/m, /(\s+)(:-?@)(\s+)/m, /(\s+)(\(bag\))(\s+)/mi, /(\s+)(\(b\))(\s+)/m, /(\s+)(O\.o|o\.O)(\s+)/m, /(\s+)(\(@\))(\s+)/m, /(\s+)(=D+)(\s+)/m, /(\s+)(\(c\))(\s+)/m, /(\s+)(\(cool\))(\s+)/m, /(\s+)(:'\(+)(\s+)/m, /(\s+)(:'S+)(\s+)/m, /(\s+)(\(6\))(\s+)/m, /(\s+)(\-\.\-)(\s+)/m, /(\s+)(\(G\))(\s+)/m, /(\s+)(\(gpig\))(\s+)/m, /(\s+)(\|-?D)(\s+)/m, /(\s+)(\(gun\))(\s+)/m, /(\s+)(\^\^)(\s+)/m, /(\s+)(x\|)(\s+)/mi, /(\s+)(8-?S)(\s+)/mi, /(\s+)(\(hrhr\))(\s+)/m, /(\s+)(:-?\*)(\s+)/mi, /(\s+)(\(knifed\))(\s+)/m, /(\s+)(:-?D)(\s+)/m, /(\s+)(\(L\))(\s+)/m, /(\s+)(\(pl\))(\s+)/m, /(\s+)(\(~\))(\s+)/m, /(\s+)(\(8\))(\s+)/m, /(\s+)(\(N\))(\s+)/m, /(\s+)(8-?\|)(\s+)/m, /(\s+)(:-?\$)(\s+)/m, /(\s+)(\(T\))(\s+)/m, /(\s+)(X\.)(\s+)/m, /(\s+)(=\|)(\s+)/m, /(\s+)(:-?\(+)(\s+)/m, /(\s+)(:-?O)(\s+)/mi, /(\s+)(:-?S)(\s+)/mi, /(\s+)(=\]+)(\s+)/m, /(\s+)(:-?\)+)(\s+)/m, /(\s+)(:-?#)(\s+)/m, /(\s+)(=\|:)(\s+)/m, /(\s+)(:-?p)(\s+)/mi, /(\s+)(\(ufo\))(\s+)/m, /(\s+)(:-?x)(\s+)/mi, /(\s+)(\(woot\)|\(w00t\))(\s+)/m, /(\s+)(\(weird\))(\s+)/m, /(\s+)(\(whistle\))(\s+)/m, /(\s+)(;-?\)+)(\s+)/m, /(\s+)(\(wtf\))(\s+)/m, /(\s+)(\(yes\))(\s+)/m, /(\s+)(\(zzz\))(\s+)/m, /(\s+)(\\m\/)(\s+)/m ); var re_mire = Array( "szogletes", "angel", "angry", "bag", "beer", "blink", "cat", "cheerful", "coffee", "cool", "cry", "cwy", "devil", "getlost", "gift", "gpig", "grin", "gun", "happy", "headshot", "hmm", "hrhr", "kissing", "knifed", "laughing", "love", "lunch", "movie", "music", "no", "omg", "oops", "phone", "poo", "puty", "sad", "shocked", "sick", "sideways", "smile", "stfu", "teeth", "tungue", "ufo", "vomit", "w00t", "weird", "whistle", "wink", "wtf", "yes", "zzz", "\\m/" ); function smilies(text) { text = "\n" + text + "\n"; for(i = 0; i < re_mit.length; i++) { var m; while (m = re_mit[i].exec(text)) { text = text.replace(m[0], m[1]+re_mire[i]+m[3]); } } return text.substring(1, text.length -1 ); } function hozzaszolok() { document.getElementById('topikposzt').style.display='block'; document.getElementById('topikposzt').style.marginLeft='5px'; document.bb.posztolok.value="Posztolok"; document.bb.mod.value="0"; } function valasz(id) { hozzaszolok(); if(!elonezes) elonezet(document.bb.posztszoveg, ""); ajax_do("/index.php?op=quotehsz&id="+id); window.scroll(0,0); } function modositas(id) { hozzaszolok(); if(!elonezes) elonezet(document.bb.posztszoveg, ""); ajax_do("/index.php?op=quotehsz&mod=1&id="+id); document.bb.posztolok.value="Módosítom"; document.bb.mod.value=id; window.scroll(0,0); }