/* * Rexbin Ajax Chatroom Interface * (C) 2007-2008 by SiberianSTAR aka Andrea Pezzino * All Rights Reserved. * * file: main.js - Main javascript file * */ var _VERSION = '1.0'; var MyInfo = new Array(); MyInfo["font_name"] = "Tahoma"; MyInfo["font_color"] = 1; MyInfo["font_webcolor"] = "#000000"; MyInfo["font_underline"] = 0; MyInfo["font_italic"] = 0; MyInfo["font_bold"] = 0; var curDate = new Date(); var MovieObject; var TblUserList; var _blinkIntervals = new Array(); var ChanModes = ''; var arrWhispWindow = new Array(); var _tabSelUser=''; var arrWhispWindowId = new Array(); var SelectedUser = ''; var _textNicks = new Array(); var _sendMsgFocus = false; var UserList; var UserInfo; var _clientY, _clientX; var _msgIndent = '     '; var _msgGrey = ''; var _msgDarkPurple =''; var _msgRed = ''; var _msgGreen = ''; var _msgDarkGreen = ''; var _msgnd = ''; var _msgTopic = '     '; var _msgTend = '
'; var topZ = 999; var startX = 500; var _showGameLobbyOrSP = 0; var _disableNudge = 0; var _disableWhisper = 0; var _lastNudgeTime = 0; /* var _curUrl = location.href; _curUrl = _curUrl.split('.'); _curUrl = _curUrl[0]; _curUrl = _curUrl.substr(7)+".rexbin.com"; */ var _curUrl = 'multiplayer.rexbin.com/chat'; var startY = 100; var nextID = 1; var dragObjTitle = null; var _tabContextMenu; var dragOffsetX = 0; var dragOffsetY = 0; var _pictureNull = ''; var arrEmoticons = new Array(); var inputHistory = new Array(); var inputHistoryCursor = 0; var arrEmoticonsNames = new Array(); var arrGameChallenges = new Array(); var _hrNudgeStyle = '
'; var _arrEmoticonsSorted = false; var _CTXPICCODE = '{PIC}'; var _CTXMENUROW = '
{PIC}{TEXT}
'; var _CTXMENUSEP = ''; var _CTXMENUDIS = '
{PIC}{TEXT}
'; var _awayButton_down = false; var _isMenuDisplayed = false; var _contextMenuDisplayed; var _userListMenu; var userCellCode = '
{P}{NICKNAME}
'; var userMessageCode = '
{PIC}{MSG}
'; var _realNicks = new Array(); var lastTabShowed = 0; // id="gameMovie_{NICKNAME}" var _GameCode ='' + '' + '' + '' + '' + ''; var _GameLoadingCode ='
' + '' + '' + '
'; var _iframeCode = ''; var _iframeScoreCode =''; function showLogin() { document.getElementById('wasaa_main').style.height='150px'; } var _nudgeRcvd = new Array(); var _nudgeSent = new Array(); function nsnudgn(vc) { _nudgeSent[vc] = 0; _nudgeRcvd[vc]=0; } function shakemcn(dv) { shakediv(dv); setTimeout("nsnudgn('"+dv+"')", 10000); } function receiveNudge(fromwho) { if (_disableNudge == 1) return; if (_nudgeRcvd['nudgeid_'+fromwho]==1) { return; } else { if (arrWhispWindow[fromwho] == '' || arrWhispWindow[fromwho] == undefined) { openWhisperWindow(fromwho, null); } else { StartBlink('whsp_' + fromwho); } writeTxtWhisp(fromwho, _hrNudgeStyle + _msgGrey + _LOCAL61 + Nick4Chat(fromwho) + _msgnd + _hrNudgeStyle); } _nudgeRcvd['nudgeid_' + fromwho]=1; shakemcn('nudgeid_' + fromwho); window.focus(); } function sendNudge(towho) { if (_disableNudge == 1) return; if (_nudgeSent['nudgeid_'+towho]==1) { writeTxtWhisp(towho, _msgDarkPurple + '» ' + _LOCAL59 + _msgnd); return; } else { writeTxtWhisp(towho, _hrNudgeStyle + _msgGrey + _LOCAL60 + _msgnd + _hrNudgeStyle); } _nudgeSent['nudgeid_' + towho]=1; shakemcn('nudgeid_' + towho); MovieObject.Whisper(towho, String.fromCharCode(1) + 'NUDGE' + String.fromCharCode(1)); } function jscb_GameInterrupt(gcode) { var who = arrGameChallenges[gcode]["who"]; writeTxtWhisp(who, _msgRed + '» '+_LOCAL1 + '' + _msgnd); document.getElementById('gameNameDiv_' + who).innerHTML = _chooseGameTxt; if (document.getElementById('game_div_' + who)) document.getElementById('game_div_' + who).innerHTML = _iframeCode; } function jscb_OpenScore(gid) { var _c = _iframeScoreCode; _c = _c.replace('{GID}', gid); if (document.getElementById('game_div_' + _tabSelUser)) document.getElementById('game_div_' + _tabSelUser).innerHTML = _c; } function jscb_GameFinish(gcode) { var who = arrGameChallenges[gcode]["who"]; var _c = _iframeScoreCode; _c = _c.replace('{GID}', arrGameChallenges[gcode]['gid']); document.getElementById('gameNameDiv_' + who).innerHTML = _chooseGameTxt; if (document.getElementById('game_div_' + who)) document.getElementById('game_div_' + who).innerHTML = _c; } function jscb_test(d) { writeTxtWhisp(_tabSelUser, d); } Object.prototype.clone = function () {var o = new Object(); for (var property in this) {o[property] = typeof (this[property]) == 'object' ? this[property].clone() : this[property]} return o} Array.prototype.clone = function () {var a = new Array(); for (var property in this) {a[property] = typeof (this[property]) == 'object' ? this[property].clone() : this[property]} return a} function pushHistory(txt) { inputHistory.push(txt); if (inputHistory.length > 20) inputHistory = inputHistory.slice(inputHistory.length-20, inputHistory.length); inputHistoryCursor = inputHistory.length-1; } function shakerndm(divname) { var p = document.getElementById(divname); if ( p.shakecount == 40 ) p.style.position=''; else { p.style.pixelLeft=-8 + (Math.floor(Math.random()*100)%3) * 8; p.style.pixelTop=-8 + (Math.floor(Math.random()*100)%3) * 8; p.shakecount++; setTimeout("shakerndm('" + divname + "')", 50); } } function shakediv(divname) { var p = document.getElementById(divname); p.style.position='relative'; p.shakecount = 0; setTimeout("shakerndm('" + divname + "')", 50); } function upHistory() { var _s = inputHistory; if (inputHistoryCursor == 0) return _s[0]; return _s[inputHistoryCursor--]; } function downHistory() { var _s = inputHistory; if (inputHistoryCursor == inputHistory.length-1) return _s[inputHistory.length-1]; return _s[inputHistoryCursor++]; } function CheckRightClick(ev, nid) { if (!ev) var ev = window.event; if (ev.button != 2) return; SelectNick("", nid); var myinf = UserInfo[MyNick()]; var hinf = UserInfo[SelectedUser]; _userListMenu.setType(8, 'disabled'); _userListMenu.setVisible(8, false); _userListMenu.setType(9, 'disabled'); _userListMenu.setType(10, 'disabled'); _userListMenu.setType(11, 'disabled'); if (myinf["mode"] == '.') { _userListMenu.setType(8, 'menu'); _userListMenu.setVisible(8, true); } if (myinf["mode"] == '@' || myinf["mode"] == '.' ) { _userListMenu.setType(9, 'menu'); _userListMenu.setType(10, 'menu'); _userListMenu.setType(11, 'menu'); } _userListMenu.setPicture(2, ''); _userListMenu.setPicture(4, ''); _userListMenu.setPicture(8, ''); _userListMenu.setPicture(9, ''); _userListMenu.setPicture(10, ''); _userListMenu.setPicture(11, ''); if (myinf["mode"] == '' || myinf["mode"] == '+') { _userListMenu.setVisible(6, false); _userListMenu.setVisible(7, false); _userListMenu.setVisible(8, false); _userListMenu.setVisible(9, false); _userListMenu.setVisible(10, false); _userListMenu.setVisible(11, false); } else { _userListMenu.setVisible(6, true); _userListMenu.setVisible(7, true); _userListMenu.setVisible(8, true); _userListMenu.setVisible(9, true); _userListMenu.setVisible(10, true); if (ChanModes.indexOf('m') == -1) _userListMenu.setVisible(11, false); else _userListMenu.setVisible(11, true); } if (SelectedUser == MyNick()) { _userListMenu.setType(2, 'disabled'); _userListMenu.setType(1, 'disabled'); _userListMenu.setType(4, 'disabled'); _userListMenu.setType(6, 'disabled'); } else { _userListMenu.setType(2, 'menu'); _userListMenu.setType(1, 'menu'); _userListMenu.setType(4, 'menu'); _userListMenu.setType(6, 'menu'); } if (hinf["ircop"] == true || SelectedUser == MyNick()) _userListMenu.setType(2, 'disabled'); else _userListMenu.setType(2, 'menu'); if (hinf["ignore"] == true) _userListMenu.setType(4, 'disabled'); if (hinf["tagged"] == true) _userListMenu.setType(2, 'disabled'); if (SelectedUser.substr(0,1) == "^" || hinf["ircop"] == true) { _userListMenu.setType(0, 'disabled'); } else { _userListMenu.setType(0, 'menu'); } if (hinf["ircop"] == true) { _userListMenu.setType(8, 'disabled'); _userListMenu.setType(9, 'disabled'); _userListMenu.setType(10, 'disabled'); _userListMenu.setType(11, 'disabled'); _userListMenu.setType(6, 'disabled'); } if (hinf["ignore"] == true) _userListMenu.setPicture(2, 'Icons/checked.gif'); if (hinf["tagged"] == true) _userListMenu.setPicture(4, 'Icons/checked.gif'); if (hinf["mode"] == ".") _userListMenu.setPicture(8, 'Icons/selected.gif'); if (hinf["mode"] == "@") _userListMenu.setPicture(9, 'Icons/selected.gif'); if (hinf["mode"] == "+") _userListMenu.setPicture(10, 'Icons/selected.gif'); if (hinf["mode"] == "" && ChanModes.indexOf('m') == -1) _userListMenu.setPicture(10, 'Icons/selected.gif'); if (hinf["mode"] == "" && ChanModes.indexOf('m') != -1) _userListMenu.setPicture(11, 'Icons/selected.gif'); if (SelectedUser == MyNick()) { _userListMenu.setVisible(12, false); _userListMenu.setVisible(13, false); _userListMenu.setVisible(14, false); _userListMenu.setVisible(15, false); } else { _userListMenu.setVisible(12, true); _userListMenu.setVisible(13, true); _userListMenu.setVisible(14, true); _userListMenu.setVisible(15, true); } _userListMenu.show(); } function disableSelection(target) { if (typeof target.onselectstart!="undefined") //IE route target.onselectstart=function() { return false } else if (typeof target.style.MozUserSelect!="undefined") //Firefox route target.style.MozUserSelect="none" else //All other route (ie: Opera) target.onmousedown=function() { return false } target.style.cursor = "default" } function ApplyFontFormat(msg) { var _c = String.fromCharCode(1) + "S "; var _k = MyInfo["font_color"]; if (_k == 10) _k = '\\n'; else if (_k == 13) _k = '\\r'; else _k = String.fromCharCode(_k); _c += _k; _k = 1; if (MyInfo["font_bold"] == 1) _k++; if (MyInfo["font_italic"] == 1) _k+=2; if (MyInfo["font_underline"] == 1) _k+=4; _k = String.fromCharCode(_k); _c += _k; _k = global_replace(" ", "\\b", MyInfo["font_name"]); _c += _k; _c += ";0 "; _c += msg; _c += String.fromCharCode(1); return _c; } function include_dom(script_filename) { var html_doc = document.getElementsByTagName('head').item(0); var js = document.createElement('script'); js.setAttribute('language', 'javascript'); js.setAttribute('type', 'text/javascript'); js.setAttribute('src', script_filename); html_doc.appendChild(js); return false; } function ApplyMyInfoTxt(k) { k.style.fontFamily = MyInfo["font_name"]; k.style.color = MyInfo["font_webcolor"]; if (MyInfo["font_bold"] == 1) k.style.fontWeight = 'bold'; else k.style.fontWeight = ''; if (MyInfo["font_underline"] == 1) k.style.textDecoration = 'underline'; else k.style.textDecoration = 'none'; if (MyInfo["font_italic"] == 1) k.style.fontStyle = 'italic'; else k.style.fontStyle = ''; } function ApplyMyInfo() { var k = document.getElementById('txtSend'); ApplyMyInfoTxt(k); for ( var i = 1; i < GetTabsCount(); i++) { var txt = document.getElementById('txtSend_' + arrWhispWindowId[i]); ApplyMyInfoTxt(txt); } } function SelectNick(nick, nid) { if (nid != -1) { var k = global_replace("tab_nick_", "id_nick_", nid); var txtNick = document.getElementById(k).innerHTML; nick = _realNicks[txtNick]; } var old_p = ''; if (SelectedUser != '') { old_p = FindUserList(SelectedUser); if (old_p != -1) document.getElementById('id_nick_' + old_p).className = ''; } SelectedUser = nick; if (nid != -1) { document.getElementById(global_replace("tab_nick_", "id_nick_", nid)).className = 'userListItem_sel'; } else { var new_p = FindUserList(SelectedUser); if (new_p != -1) document.getElementById('id_nick_' + new_p).className = 'userListItem_sel'; else SelectedUser = ''; } return false; } /*function global_replace(cosa, con, dove) { return dove.split(cosa).join(con); }*/ function jscb_Connect() { writeTxt(_msgRed + _LOCAL49 + _msgnd); writeTxt(_WELCOMEMOTD); } function jscb_UserListReceived(UsersArray) { UserList = new Array(); UserInfo = new Array(); for (var i = 0; i < UsersArray.length; i++) { var _usrInfo = UsersArray[i].split(','); var NickName = _usrInfo[3]; UserList[i] = NickName; var _usrMode = NickName.substr(0, 1); if (_usrMode != '.' && _usrMode != '@' && _usrMode != '+') _usrMode = ''; else { UserList[i] = NickName.substr(1, NickName.length - 1); NickName = UserList[i]; } UserInfo[NickName] = new Array(); if (_usrInfo[0] == "H") UserInfo[NickName]["away"] = false; else UserInfo[NickName]["away"] = true; if (_usrInfo[1] == "U") UserInfo[NickName]["ircop"] = false; else UserInfo[NickName]["ircop"] = true; UserInfo[NickName]["profile"] = _usrInfo[2]; UserInfo[NickName]["mode"] = _usrMode; UserInfo[NickName]["flood_count"] = 0; UserInfo[NickName]["flood_ticks"] = 0; UserInfo[NickName]["ignore"] = false; UserInfo[NickName]["tagged"] = false; } RenderUserList(); } function jscb_Left(nickName) { UserLeftChannel(nickName); } function UserLeftChannel(nickName) { if (nickName == SelectedUser) SelectedUser = ''; for (var i = 0; i < UserList.length; i++) if (UserList[i] == nickName) { writeTxt(_msgIndent + _msgGrey + "» " + Nick4Chat(nickName) + " " + _LOCAL3 + _msgnd); RemoveUserFromList(i); } UserInfo[nickName] = ''; _realNicks[_textNicks[nickName]] = ''; _textNicks[nickName] = ''; document.getElementById('user_chatting_count').innerHTML = '' + UserList.length + " "+ _LOCAL2 +""; ReSelect(); } function MyNick() { return MovieObject.getNickname() } function ChallengeSelPlayer(gameID) { if (_tabSelUser == '') return; if (_disableWhisper == 1) { alert(_LOCAL63); return; } RequestChallenge(_tabSelUser, gameID); } function CurChan() { return MovieObject.getChanName() } function RemoveUserFromList(id) { var curUserCnt = UserList.length; var _remNick = UserList[id]; if (_remNick == MyNick()) document.getElementById('div_my_nick').innerHTML = ''; RemoveUserFromTable(_remNick, curUserCnt-1); for (var i = id; i < curUserCnt-1; i++) UserList[i] = UserList[i+1]; UserList.pop(); } function GetTicks() { curDate = new Date(); return curDate.getHours()*3600000 + curDate.getMinutes()*60000 + curDate.getSeconds()*1000+ curDate.getMilliseconds(); } function UpdateUserFlood(nick) { if (UserInfo[nick]["ignore"] == true) return; if (UserInfo[nick]["ircop"] == true || UserInfo[nick]["mode"] != '' || UserInfo[nick]["tagged"]== true) return; var _s = GetTicks(); UserInfo[nick]["flood_count"]++; if (_s - UserInfo[nick]["flood_ticks"] > 1800) { UserInfo[nick]["flood_count"] = 0; UserInfo[nick]["flood_ticks"] = _s; return; } if (UserInfo[nick]["flood_count"] > 4) { UserInfo[nick]["ignore"] = true; UserInfo[nick]["flood_ticks"] = 0; writeTxt(_msgIndent + _msgGrey + "» " + Nick4Chat(nick) + " " + _LOCAL4 + _msgnd); if (arrWhispWindow[nick] != '' && arrWhispWindow[nick] != undefined) { writeTxtWhisp(nick, _msgIndent + _msgGrey + "» " +Nick4Chat( nick) + " " + _LOCAL4 + _msgnd); } var _p = FindUserList(nick); if (_p != -1) { document.getElementById('id_pic_' + _p).innerHTML = GetPictureByUser(nick); } } } function jscb_Join(NickName, modes) { var i = UserList.length; var _usrInfo = modes.split(','); UserList.push(NickName); _usrMode = global_replace(" ", "", _usrInfo[3]); if (_usrMode == ".'") _usrMode = "."; UserInfo[NickName] = new Array(); if (_usrInfo[0] == "H") UserInfo[NickName]["away"] = false; else UserInfo[NickName]["away"] = true; if (_usrInfo[1] == "U") UserInfo[NickName]["ircop"] = false; else UserInfo[NickName]["ircop"] = true; UserInfo[NickName]["flood_count"] = 0; UserInfo[NickName]["flood_ticks"] = 0; UserInfo[NickName]["ignore"] = false; UserInfo[NickName]["tagged"] = false; UserInfo[NickName]["profile"] = _usrInfo[2]; UserInfo[NickName]["mode"] = _usrMode; InsertNickSorted ( NickName ); writeTxt(_msgIndent + _msgGrey + "» " + Nick4Chat(NickName) + " " +_LOCAL5+ _msgnd); document.getElementById('user_chatting_count').innerHTML = '' + UserList.length + " " +_LOCAL2+""; ReSelect(); } function AmISpecator() { if (UserInfo[MyNick()]["mode"] == '' && ChanModes.indexOf("m") != -1) return true; return false; } function RemoveUserFromTable(_remNick, curUserCnt) { if (_remNick == MyNick()) { document.getElementById('div_my_nick').innerHTML = ''; return; } var i, bfound = false; for (i = 0; i < curUserCnt; i++) { if (document.getElementById('id_nick_' + i).innerHTML == _textNicks[_remNick]) { bfound= true; break; } } TblUserList.deleteRow(i); for (var a = i; a < curUserCnt - 1; a++) { document.getElementById('tab_nick_' + (a+1)).id = 'tab_nick_' + a; document.getElementById('id_nick_' + (a+1)).id = 'id_nick_' + a; document.getElementById('id_pic_' + (a+1)).id = 'id_pic_' + a; } } function RenderUserList() { _finalArray = CreateSortedArray(); for (var i = 0; i < _finalArray.length; i++) { var curRow = TblUserList.insertRow(i); var curCel = curRow.insertCell(0); var _new = userCellCode; _new = global_replace("{NUM}", i, _new); _new = global_replace("{P}", GetPictureByUser(_finalArray[i] ), _new); _new = global_replace("{NICKNAME}", Nick4List(_finalArray[i]), _new); curCel.innerHTML = _new; _textNicks[_finalArray[i]] = document.getElementById('id_nick_' + i).innerHTML; _realNicks[_textNicks[_finalArray[i]]] = _finalArray[i]; } var _new = userCellCode; _new = global_replace("{NUM}", 'me', _new); _new = global_replace("{P}", GetPictureByUser( MyNick() ), _new); _new = global_replace("{NICKNAME}", Nick4List( MyNick() ), _new); document.getElementById('div_my_nick').innerHTML = _new; _textNicks[MyNick()] = document.getElementById('id_nick_me').innerHTML; _realNicks[_textNicks[MyNick()]] = MyNick(); document.getElementById('user_chatting_count').innerHTML = '' + UserList.length + " "+_LOCAL2+""; document.getElementById('awayButton').style.visibility='visible'; writeTxt(_msgIndent + _msgGrey + "» " + _LOCAL6 + _msgnd); EnableBtns(); } function EnableBtns() { document.getElementById('btnSend').disabled=false; document.getElementById('btnAction').disabled=false; } function jscb_Topic(topicText) { writeTxt(_msgTopic + parseMessageString(topicText, true) + _msgTend); } function parseColor(msg, flag, feature) { if (flag == false) return '' + msg + ''; var _color = ''; var _fontname = ''; var _style = ''; var _c = msg; if (_c.substr(0,1)=="\\") { _c = msg.substr(1, msg.length - 1); } var _color_code = _c.substr(0, 1); var _style_code = _c.substr(1, 1); var _font_code = _c.substr(2, _c.length - 2); _font_code = _font_code.split(";",2); _font_code = _font_code[0]; _real_msg = msg.substr(msg.indexOf(" ")+1); _color_code = _color_code.charCodeAt(0); _style_code = _style_code.charCodeAt(0)-1; switch (_color_code) { case 2: _color = 'ffffff'; break; case 1: _color = '000000'; break; case 3: _color = '800000'; break; case 4: _color = '008000'; break; case 5: _color = '000080'; break; case 6: _color= '808000'; break; case 7: _color= '800080'; break; case 8: _color= '008080'; break; case 9: _color= 'c0c0c0'; break; case 110: _color= '808080'; break; case 11: _color='ff0000'; break; case 12: _color='00ff00'; break; case 114: _color='0000ff'; break; case 14: _color='ffff00'; break; case 15: _color='ff00ff'; break; case 16: _color='00ffff'; break; default: _color='000000'; break; } var _end_style = ''; if (_style_code&1) _end_style += 'font-weight:bold;'; if (_style_code&2) _end_style += 'font-style:italic;'; if (_style_code&4) _end_style += 'text-decoration:underline;'; _end_style += 'color:#'+_color+';'; _end_style += 'font-size:13px; font-family: ' + global_replace("\\b", " ", _font_code) + ';'; return '' + parseMessageString(_real_msg, feature); + ''; } function jscb_Action(sender, msg) { UpdateUserFlood(sender); if (UserInfo[sender]["ignore"] == true) return; var _feature = UserInfo[sender]["ircop"]; writeTxt('' + _msgDarkPurple + Nick4Chat(sender) + " " + parseColor(msg, false, _feature) + '' + _msgnd); } function jscb_Msg(sender, msg, color) { UpdateUserFlood(sender); if (UserInfo[sender]["ignore"] == true) return; var msgcode = userMessageCode; msgcode = msgcode.replace("{PIC}", GetPictureByUserLil(sender)); var cnick; if (UserInfo[sender]["tagged"] == true) { cnick = ''+Nick4Chat(sender)+''; } else { cnick = Nick4Chat(sender); } if (UserInfo[sender]["ircop"] == true && msg.indexOf('[nonick]') != -1) { msgcode = '' + parseColor(global_replace('[nonick]', '', msg), color, true) + ''; } else { var crepl = '' + cnick + ' : ' + parseColor(msg, color, UserInfo[sender]["ircop"]); msgcode = msgcode.replace("{MSG}", crepl); } writeHtmlCode(msgcode); if (document.getElementById('tab_0').style.display != '') { StartBlink('wasaa_gb'); } } function jscb_Whisper(sender, msg, color) { if (_disableWhisper == 1) { if (msg == String.fromCharCode(1) + 'NOWHISPER' + String.fromCharCode(1)) return; MovieObject.Whisper(sender, String.fromCharCode(1) + 'NOWHISPER' + String.fromCharCode(1)); return; } UpdateUserFlood(sender); if (UserInfo[sender]["ignore"] == true) { return; } if (msg == String.fromCharCode(1) + 'NOWHISPER' + String.fromCharCode(1)) { writeTxtWhisp(sender, _msgDarkPurple + _LOCAL62 + _msgnd); return; } if (msg == String.fromCharCode(1) + 'NUDGE' + String.fromCharCode(1)) { receiveNudge(sender); return; } var msgcode = userMessageCode; msgcode = msgcode.replace("{PIC}", GetPictureByUserLil(sender)); var crepl = '' + Nick4Chat(sender) + ' : ' + parseColor(msg, color, UserInfo[sender]["ircop"]); msgcode = msgcode.replace("{MSG}", crepl); if (arrWhispWindow[sender] == '' || arrWhispWindow[sender] == undefined) { openWhisperWindow(sender, null); } else { StartBlink('whsp_' + sender); } writeHtmlCodeWhisp(sender, msgcode); } function jscb_MsgWhisper(sender, msg, color) { UpdateUserFlood(sender); if (UserInfo[sender]["ignore"] == true) return; var msgcode = userMessageCode; msgcode = msgcode.replace("{PIC}", GetPictureByUserLil(sender)); var crepl = '' + Nick4Chat(sender) + ' '+_LOCAL7+' : ' + parseColor(msg, color, UserInfo[sender]["ircop"]); msgcode = msgcode.replace("{MSG}", crepl); writeHtmlCode(msgcode); } function jscb_WelcomeMsg(msg) { writeTxt(_msgDarkGreen + parseMessageString(msg) + _msgnd + '
'); } function FindUserList(nick) { if (_textNicks[nick] == '') return -1; if (nick == MyNick()) return 'me'; var k; for (k = 0; k < UserList.length-1; k++) if (document.getElementById('id_nick_' + k).innerHTML == _textNicks[nick]) return k; return -1; } function jscb_chanModes(chanModes) { var oldModes = ChanModes; var SomethingChanged = false; ChanModes = chanModes; if (oldModes.indexOf("m") != ChanModes.indexOf("m")) SomethingChanged = true; if (SomethingChanged == true) for (i = 0; i < UserList.length; i++) { var nick = UserList[i]; if (UserInfo[nick]["mode"] == '') { var p = FindUserList(nick); if (p != -1) document.getElementById('id_pic_' + p).innerHTML = GetPictureByUser(nick); } } } function jscb_userModeChange(who, modes, towho) { var dialogue; var oldMode = UserInfo[towho]["mode"]; if ( modes.substr(0, 1) == "-" ) { UserInfo[towho]["mode"] = ''; if (ChanModes.indexOf('m') == -1) dialogue = "a Participant"; else dialogue = "a Spectator"; } else { if (modes == '+q') { UserInfo[towho]["mode"] = '.'; dialogue = _LOCAL54; } if (modes == '+o') { UserInfo[towho]["mode"] = '@'; dialogue = _LOCAL52; } if (modes == '+v') { UserInfo[towho]["mode"] = '+'; dialogue = _LOCAL53; } } if (oldMode == UserInfo[towho]["mode"]) return; writeTxt(_msgIndent + _msgGrey + "» " + Nick4Chat(who) + " "+_LOCAL8+" " + Nick4Chat(towho) + " " + dialogue + _msgnd); RemoveUserFromTable( towho , UserList.length-1 ); InsertNickSorted ( towho ); ReSelect(); } function ReSelect() { if (SelectedUser != '') { ClearSelected(); var uds = SelectedUser; SelectedUser = ''; SelectNick(uds, -1); } } function UnSelect() { if (SelectedUser != '') { ClearSelected(); SelectedUser = ''; } } function jstrprintf() { len = arguments.length; if (len == 0) { return; } if (len == 1) { return arguments[0]; } var result; var regexstr; var replstr; var formatstr; var re; result = ""; regexstr = ""; replstr = ""; formatstr = arguments[0]; for (var i=1; i$1' + '' + '' + '' + '', caption, nextID); if (canMove) { if (newdiv.addEventListener) { newdiv.addEventListener("mousemove", function(e) { return mouseMove(e) }, true); newdiv.addEventListener("mousedown", function(e) { return mouseDown(e) }, true); newdiv.addEventListener("mouseup", function(e) { return mouseUp(e) }, true); } else { newdiv.attachEvent("onmousemove", function(e) { return mouseMove(e) }); newdiv.attachEvent("onmousedown", function(e) { return mouseDown(e) }); newdiv.attachEvent("onmouseup", function(e) { return mouseUp(e) }); } } document.body.appendChild(newdiv); var newdiv2; newdiv2 = document.createElement("div"); newdiv2.id = "dragContent" + String(nextID); newdiv2.className = "divDragContent"; newdiv2.style.width = theWidth; newdiv2.style.left = AddPx(startX); newdiv2.style.top = AddPx(startY + 20); newdiv2.style.zIndex = topZ; if (contentSource) { newdiv2.innerHTML = document.getElementById(contentSource).innerHTML; } if (canMove) { if (newdiv2.addEventListener) { newdiv2.addEventListener("mousedown", function(e) { return contentMouseDown(e) }, true); } else { newdiv2.attachEvent("onmousedown", function(e) { return contentMouseDown(e) }); } } document.body.appendChild(newdiv2); newdiv.content = newdiv2; newdiv2.titlediv = newdiv; topZ += 1; startX += 25; startY += 25; nextID++; } function contentMouseDown(e) { var dragContent = e.srcElement || e.currentTarget; if ( ! dragContent.id.match("dragContent")) { dragContent = findParentTagById(dragContent, "dragContent"); } if (dragContent) { dragContent.style.zIndex = topZ; dragContent.titlediv.style.zIndex = topZ; topZ++; } } function mouseDown(e) { var curElem = e.srcElement || e.target; var dragTitle = e.currentTarget || findParentDiv(curElem); if (dragTitle) { if (dragTitle.className != 'divDragTitle') { return; } } if (curElem && dragTitle) { addDocumentHandlers(true); dragTitle.style.zIndex = topZ; dragTitle.content.style.zIndex = topZ; topZ++; if (curElem.className != "divTitleButton") { dragObjTitle = dragTitle; dragOffsetX = e.clientX - dragTitle.offsetLeft; dragOffsetY = e.clientY - dragTitle.offsetTop; if (e.preventDefault) { e.preventDefault(); } else { document.onselectstart = function () { return false; }; e.cancelBubble = true; return false; } } } } function mouseMove(e) { if (dragObjTitle) { if (!e.preventDefault) { if (e.button == 0) { finishDrag(e); return; } } dragObjTitle.style.left = AddPx(e.clientX - dragOffsetX); dragObjTitle.style.top = AddPx(e.clientY - dragOffsetY); dragObjTitle.content.style.left = AddPx(e.clientX - dragOffsetX); dragObjTitle.content.style.top = AddPx(e.clientY - dragOffsetY + 20); if (e.preventDefault) { e.preventDefault(); } else { e.cancelBubble = true; return false; } } } function mouseUp(e) { if (dragObjTitle) { finishDrag(e); } } function finishDrag(e) { var finalX = e.clientX - dragOffsetX; var finalY = e.clientY - dragOffsetY; if (finalX < 0) { finalX = 0 }; if (finalY < 0) { finalY = 0 }; dragObjTitle.style.left = AddPx(finalX); dragObjTitle.style.top = AddPx(finalY); dragObjTitle.content.style.left = AddPx(finalX); dragObjTitle.content.style.top = AddPx(finalY + 20); dragObjTitle = null; addDocumentHandlers(false); if (e.preventDefault) { e.preventDefault(); } else { document.onselectstart = null; e.cancelBubble = true; return false; } } function addDocumentHandlers(addOrRemove) { if (addOrRemove) { if (document.body.addEventListener) { document.addEventListener("mousedown", function(e) { return mouseDown(e) }, true); document.addEventListener("mousemove", function(e) { return mouseMove(e) }, true); document.addEventListener("mouseup", function(e) { return mouseUp(e) }, true); } else { document.onmousedown = function() { mouseDown(window.event) } ; document.onmousemove = function() { mouseMove(window.event) } ; document.onmouseup = function() { mouseUp(window.event) } ; } } else { if (document.body.addEventListener) { remove.addEventListener("mousedown", function(e) { return mouseDown(e) }, true); remove.addEventListener("mousemove", function(e) { return mouseMove(e) }, true); remove.addEventListener("mouseup", function(e) { return mouseUp(e) }, true); } else { document.onmousedown = null; document.onmousemove = null; document.onmouseup = null; } } } function CUnSelect(ev) { if (window.event) ev = window.event; var tgt = ev.target != null ? ev.target : ev.srcElement; if (tgt.id.indexOf('id_nick') == -1 && tgt.parentNode.id.indexOf('id_pic') == -1) { UnSelect(); } } function ClearSelected() { for (var i = 0; i < UserList.length-1; i++) document.getElementById('id_nick_' + i).className=''; document.getElementById('id_nick_me').className=''; } function CreateSortedArray() { var _ircopArray = new Array(); var _ownerArray = new Array(); var _hostArray = new Array(); var _userArray = new Array(); for (var i = 0; i < UserList.length; i++) { var nick = UserList[i]; var info = UserInfo[nick]; if (nick == MyNick()) continue; if (info["ircop"] == true) _ircopArray.push(nick); else { if (info["mode"] == ".") _ownerArray.push(nick); else if (info["mode"] == "@") _hostArray.push(nick); else _userArray.push(nick); } } _ircopArray.sort(); _ownerArray.sort(); _hostArray.sort(); _userArray.sort(); var _finalArray = new Array(); _finalArray = _finalArray.concat(_ircopArray); _finalArray = _finalArray.concat(_ownerArray); _finalArray = _finalArray.concat(_hostArray); _finalArray = _finalArray.concat(_userArray); return _finalArray; } function GetPictureByUserLil( nick ) { var info = UserInfo[nick]; if (info["tagged"] == true) return _pictureTaggedLil; if (info["ircop"] == true) return _pictureIrcopLil; if (info["mode"] == ".") return _pictureOwnerLil; if (info["mode"] == "@") return _pictureHostLil; return _pictureNull; } function GetPictureByUser( nick ) { info = UserInfo[nick]; if (info["tagged"] == true) return _pictureTagged; if (info["ignore"] == true) return _pictureIgnore; if (info["away"] == true) return _pictureAway; if (info["ircop"] == true) return _pictureIrcop; if (info["mode"] == ".") return _pictureOwner; if (info["mode"] == "@") return _pictureHost; if (ChanModes.indexOf("m") != -1 && info["mode"] != '+') return _pictureSpect; if (info["profile"] == "PXB") return _pictureUnspec; if (info["profile"] == "PYB") return _pictureUnspec_p; if (info["profile"] == "MXB") return _pictureMale; if (info["profile"] == "MYB") return _pictureMale_p; if (info["profile"] == "FXB") return _pictureFemale; if (info["profile"] == "FYB") return _pictureFemale_p; return _pictureNull; } function Nick4Chat( nick ) { var k = nick; if (k.substr(0, 1) == "^") k = _GUESTPREFIX + k.substr(1, k.length - 1 ); return k; } function Nick4List( nick ) { var k = nick; if (k.substr(0, 1) == "^") k = _GUESTPREFIX + k.substr(1, k.length - 1 ); var suffix = ''; var info = UserInfo[nick]; if ( info["ircop"] == true) suffix=_LOCAL55; else if ( info["mode"] == ".") suffix=_LOCAL56 else if ( info["mode"] == "@") suffix=_LOCAL57 if (suffix!='')suffix=' ' + suffix; return k + suffix; } function InsertNickSorted( nick ) { if (nick == MyNick()) { var _new = userCellCode; _new = global_replace("{NUM}", 'me', _new); _new = global_replace("{P}", GetPictureByUser(nick), _new); _new = global_replace("{NICKNAME}", Nick4List(nick), _new); document.getElementById('div_my_nick').innerHTML = _new; _textNicks[nick] = document.getElementById('id_nick_me').innerHTML; _realNicks[_textNicks[nick]] = nick; return; } _finalArray = CreateSortedArray(); for (var i = 0; i < _finalArray.length; i++ ) if (_finalArray[i] == nick) break; insertAfter = i; var curRow = TblUserList.insertRow(insertAfter); var curCel = curRow.insertCell(0); var _new = userCellCode; _new = global_replace("{NUM}", insertAfter, _new); _new = global_replace("{P}", GetPictureByUser(nick), _new); _new = global_replace("{NICKNAME}", Nick4List(_finalArray[insertAfter]), _new); for (var i = UserList.length-3; i > insertAfter-1; i--) { document.getElementById('tab_nick_' + i).id = 'tab_nick_' + (i+1); document.getElementById('id_nick_' + i).id = 'id_nick_' + (i+1); document.getElementById('id_pic_' + i).id = 'id_pic_' + (i+1); } curCel.innerHTML = _new; _textNicks[nick] = document.getElementById('id_nick_' + insertAfter).innerHTML; _realNicks[_textNicks[nick]] = nick; } function scrollTxtDown(txt) { var aname; var _st = txt.split("_"); if (_st.length == 1) aname = 'divAnchor'; else aname='divAnchor_' + _st[1]; var _f = _ANCHOR; if (aname != 'divAnchor') { _f = _f.replace('divAnchor', aname ); } var k = document.getElementById(txt); var c = k.innerHTML; c = global_replace(_f, "", c); c+= _f; k.innerHTML = c; if (document.getElementById(aname)) document.getElementById(aname).scrollIntoView(); } function writeTxt(txt) { var k = document.getElementById('txtbox'); var c = k.innerHTML; if (c.length > 32768) { if (c.indexOf('') != -1) { var barr = c.substr(c.indexOf('')+19); c = barr; } } else { if (c.length>16384 && (c.indexOf('') == -1)) { c+=''; } } c+= txt + '
'; c = global_replace(_ANCHOR, "", c); c+= _ANCHOR; k.innerHTML = c; document.getElementById('divAnchor').scrollIntoView(); } function writeTxtWhisp(nick, txt) { var _ANCHOR2 = _ANCHOR; _ANCHOR2 = _ANCHOR2.replace('divAnchor', 'divAnchor_' + nick); var k = document.getElementById('txtbox_' + nick); var c = k.innerHTML; if (c.length > 32768) { if (c.indexOf('') != -1) { var barr = c.substr(c.indexOf('')+19); c = barr; } } else { if (c.length>16384 && (c.indexOf('') == -1)) { c+=''; } } c+= txt + '
'; c = global_replace(_ANCHOR2, "", c); c+= _ANCHOR2; k.innerHTML = c; document.getElementById('divAnchor_' + nick).scrollIntoView(); } function writeHtmlCodeWhisp(nick, html) { var _ANCHOR2 = _ANCHOR; _ANCHOR2 = _ANCHOR2.replace('divAnchor', 'divAnchor_' + nick); var k = document.getElementById('txtbox_' + nick); var c = k.innerHTML; if (c.length > 32768) { if (c.indexOf('') != -1) { var barr = c.substr(c.indexOf('')+19); c = barr; } } else { if (c.length>16384 && (c.indexOf('') == -1)) { c+=''; } } c+= html; c = global_replace(_ANCHOR2, "", c); c+= _ANCHOR2; k.innerHTML = c; document.getElementById('divAnchor_' + nick).scrollIntoView(); } function writeHtmlCode(html) { var k = document.getElementById('txtbox'); var c = k.innerHTML; if (c.length > 32768) { if (c.indexOf('') != -1) { var barr = c.substr(c.indexOf('')+19); c = barr; } } else { if (c.length>16384 && (c.indexOf('') == -1)) { c+=''; } } c+= html; c = global_replace(_ANCHOR, "", c); c+= _ANCHOR; k.innerHTML = c; document.getElementById('divAnchor').scrollIntoView(); } function jscb_Kick(who, towho, _reason) { for (var i = 0; i < UserList.length; i++) if (UserList[i] == towho) RemoveUserFromList(i); UserInfo[towho] = ''; _realNicks[_textNicks[towho]] = ''; _textNicks[towho] = ''; document.getElementById('user_chatting_count').innerHTML = '' + UserList.length + " " + _LOCAL2+ "";; if (towho == MyNick()) { _dcd(); writeTxt(_msgRed + "
"+_LOCAL9+" " + Nick4Chat(who) + ": " + parseMessageString(_reason) + "" + _msgnd); } else { writeTxt(_msgRed + "
Il moderatore " + Nick4Chat(who) + " "+_LOCAL10+" " + Nick4Chat(towho) + " "+_LOCAL11+" " + parseMessageString(_reason) + "" + _msgnd); } ReSelect(); } function SendAction() { if (document.getElementById('div_my_nick').innerHTML == '') return; if (AmISpecator() == true) { alert(_LOCAL12); return; } var _k = document.getElementById('txtSend').value; if (_k == '') return; pushHistory(_k); var _msgtosend = (String.fromCharCode(1) + 'ACTION ' + _k + String.fromCharCode(1)); writeTxt('' + _msgDarkPurple + Nick4Chat(MyNick()) + " " + parseColor(_k, false) + '' + _msgnd); MovieObject.SendMessage(_msgtosend); document.getElementById('txtSend').value = ''; } function jscb_Broadcast(msg) { writeTxt(_msgRed + _LOCAL13 + ":
" + _msgnd + parseMessageString(msg) + "
"); } function SendWhisper(nick) { var _k = document.getElementById('txtSend_' + nick).value; if (_k == '') return; var _msg = ApplyFontFormat(_k); var msgcode = userMessageCode; msgcode = msgcode.replace("{PIC}", GetPictureByUserLil(MyNick())); var crepl = '' + Nick4Chat(MyNick()) + ' : ' + parseColor(_msg.substr(3, _msg.length-4), true); msgcode = msgcode.replace("{MSG}", crepl); writeHtmlCodeWhisp(nick, msgcode); MovieObject.Whisper(nick, _msg); document.getElementById('txtSend_' + nick).value = ''; } function SendMessage() { if (document.getElementById('div_my_nick').innerHTML == '') return; if (AmISpecator() == true) { alert(_LOCAL12); return; } var _k = document.getElementById('txtSend').value; if (_k == '') return; pushHistory(_k); if (_k.toLowerCase().substr(0, 8) == '/version') { writeTxt(_msgGreen + _VERSIONSTRING + _msgnd + '
'); document.getElementById('txtSend').value = ''; return; } if (_k.split(" ",1)[0].toLowerCase().substr(0, 6) == "/pass") { var _pwd = _k.substr(_k.indexOf(" ")+1); SetPassword(_pwd); document.getElementById('txtSend').value = ''; return; } if (_k.split(" ",1)[0].toLowerCase().substr(0, 6) == "/topic") { var _newtopic = _k.substr(_k.indexOf(" ")+1); MovieObject.ChangeTopic(_newtopic); document.getElementById('txtSend').value = ''; return; } var _msg = ApplyFontFormat(_k); var msgcode = userMessageCode; msgcode = msgcode.replace("{PIC}", GetPictureByUserLil(MyNick())); var crepl = '' + Nick4Chat(MyNick()) + ' : ' + parseColor(_msg.substr(3, _msg.length-4), true); msgcode = msgcode.replace("{MSG}", crepl); writeHtmlCode(msgcode); MovieObject.SendMessage((_msg)); document.getElementById('txtSend').value = ''; } function _dcd() { SelectedUser = ''; document.getElementById('user_chatting_count').innerText = ''; ClearTheListbox(); document.getElementById('awayButton').style.visibility='hidden'; document.getElementById('btnSend').disabled=true; document.getElementById('btnAction').disabled=true; document.getElementById('div_my_nick').innerHTML = ''; } function ClearTheListbox() { for (i = 0; i < UserList.length-1; i++) TblUserList.deleteRow(0); } function jscb_nickChange(from, to) { if (to != MyNick()) { var p = FindUserList(from); if (p == -1) return; RemoveUserFromTable( from, UserList.length - 1); } for (var i = 0; i < UserList.length; i++) { if (UserList[i] == from) UserList[i] = to; } UserInfo[to] = UserInfo[from]; InsertNickSorted( to ); ReSelect(); } function CloseGameOrTab(who) { if (document.getElementById('game_div_' + who).innerHTML.toUpperCase().indexOf("OBJECT") != -1 || document.getElementById('game_div_' + who).innerHTML.toUpperCase().indexOf("EMBED") != -1 ) { if (document.getElementById('game_div_' + who).childNodes[1].CloseConn) document.getElementById('game_div_' + who).childNodes[1].CloseConn(); arrGameChallenges[UserInfo[who]] = ''; document.getElementById('game_div_' + who).innerHTML = _iframeCode; document.getElementById('gameNameDiv_' + who).innerHTML = _chooseGameTxt; } else { if ( document.getElementById('game_div_' + who).innerHTML.toUpperCase().indexOf("SCORETABLE.PHP") != -1) { document.getElementById('game_div_' + who).innerHTML = _iframeCode; } else CloseSelDiv(); } } function challengeSelPlayer(gid) { if (SelectedUser == '' || SelectedUser == MyNick()) return; if (_disableWhisper == 1) { alert(_LOCAL63); return; } openIfNotOpenWhisp(SelectedUser); RequestChallenge(SelectedUser, gid); } function jscb_GameAccepted(vwho, gid, gcode) { if (vwho == MyNick() ) who = arrGameChallenges[gcode]["who"]; else who = vwho; openIfNotOpenWhisp(who); if (arrGameChallenges[gcode] == undefined) { arrGameChallenges[gcode] = arrGameChallenges[0].clone(); arrGameChallenges[gcode]["s"] = 1; } if (arrGameChallenges[gcode]["s"]==0) return; if (UserInfo[who]["ignore"] == true) return; UserInfo[who]["gcode"] = gcode; document.getElementById('gameNameDiv_' + who).innerHTML = arrGameChallenges[gcode]["name"]; writeTxtWhisp(who, _msgDarkGreen + '» '+_LOCAL14+''); arrGameChallenges[gcode]["s"]=0; var _code = _GameLoadingCode; _code += _GameCode; _code = global_replace('{MOVIEPATH}', 'games/' + arrGameChallenges[gcode]["path"], _code); _code = global_replace('{GID}', gcode, _code); _code = global_replace('{NICKNAME}', who, _code); document.getElementById('game_div_' + who).innerHTML = _code; } function jsgame_LoadFinish(gcode) { document.getElementById('mvLoading_' + gcode).style.display='none'; document.getElementById('mvLoading_' + gcode).innerHTML = ''; //document.getElementById('mvLoading_' + gcode).style.display='none'; //document.getElementByID('theMovie_' + gcode).style.width='100%'; //document.getElementByID('theMovie_' + gcode).style.Height='100%'; } function jscb_GameRejected(who, gid) { if (UserInfo[who]["ignore"] == true) return; writeTxtWhisp(who, _msgRed + '» '+_LOCAL44+''); } function RejectChallenge(who, gcode) { if (arrGameChallenges[gcode]["s"]==0) return; DisableLinksGame(gcode); writeTxtWhisp(who, _msgRed + '» '+_LOCAL44+''); MovieObject.RejectGame(gcode); arrGameChallenges[gcode]["s"] = 0; } function jscb_GameError(who, gerr) { if (UserInfo[who]["ignore"] == true) return; if (gerr == '501') { writeTxtWhisp(who, _msgRed + '» '+_LOCAL45+''); } } function jscb_GameRequest(who, gid, gcode) { if (_disableWhisper == 1) { MovieObject.Whisper(who, String.fromCharCode(1) + 'NOWHISPER' + String.fromCharCode(1)); MovieObject.RejectGame(gcode); return; } if (UserInfo[who]["ignore"] == true) { MovieObject.RejectGame(gcode); return; } UpdateUserFlood(who); if (UserInfo[who]["ignore"] == true) { MovieObject.RejectGame(gcode); return; } arrGameChallenges[gcode] = new Array(); arrGameChallenges[gcode]["gid"] = gid; arrGameChallenges[gcode]["who"] = who; arrGameChallenges[gcode]["s"] = 1; MovieObject.GetGameInfo(gcode, gid); } function DisableLinksGame(gcode) { document.getElementById('rjct_link_' + gcode).style.color='#008000'; document.getElementById('rjct_link_' + gcode).style.textDecoration='none'; document.getElementById('rjct_link_' + gcode).style.cursor='default'; document.getElementById('acpt_link_' + gcode).style.color='#008000'; document.getElementById('acpt_link_' + gcode).style.textDecoration='none'; document.getElementById('acpt_link_' + gcode).style.cursor='default'; } function RequestChallenge(user, gid) { arrGameChallenges[0] = new Array(); arrGameChallenges[0]["who"] = user; arrGameChallenges[0]["gid"] = gid; MovieObject.GetGameInfo(0, gid); document.getElementById('txtbox_' + user).focus(); } function jscb_GameInfoRcvd(gcode, gname, gpath) { var who = arrGameChallenges[gcode]["who"]; if (gcode == 0) { openIfNotOpenWhisp(who); writeTxtWhisp(who, _msgDarkGreen + '» '+_LOCAL15+' ' + Nick4Chat(who) + ' '+_LOCAL16+' ' + gname + '.' + _msgnd); MovieObject.RequestGame(who, arrGameChallenges[0]["gid"]); } else { var who = arrGameChallenges[gcode]["who"]; openIfNotOpenWhisp(who); writeTxtWhisp(who, _msgDarkGreen + '» ' + Nick4Chat(who) + ' '+_LOCAL17+' ' + gname + '.
'+_LOCAL18_A+' '+_LOCAL18+' '+_LOCAL19+' '+_LOCAL20_A+' '+_LOCAL20+'
' + _msgnd); } arrGameChallenges[gcode]["name"] = gname; arrGameChallenges[gcode]["path"] = gpath; } function AcceptChallenge(who, gcode) { DisableLinksGame(gcode); MovieObject.AcceptGame(gcode); } function jscb_Away(who, flag) { UserInfo[who]["away"] = flag; if (who == MyNick()) { if (flag == true) { writeTxt(_msgIndent + _msgGrey + "» "+ _LOCAL21 + _msgnd); document.getElementById('awayButton').className = 'awayButton_down'; } else { writeTxt(_msgIndent + _msgGrey + "» "+_LOCAL22 + _msgnd); document.getElementById('awayButton').className = 'awayButton'; } } else { UpdateUserFlood(who); if (UserInfo[who]["ignore"] == true) return; if (flag == true) writeTxt(_msgIndent + _msgGrey + "» "+Nick4Chat(who)+" "+ _LOCAL23 + _msgnd); else writeTxt(_msgIndent + _msgGrey + "» "+Nick4Chat(who)+" " + _LOCAL24 + _msgnd); } var p = FindUserList(who); if (p != -1) document.getElementById('id_pic_' + p).innerHTML = GetPictureByUser(who); } function connectToChat() { ReloadMyInfo(); ApplyMyInfo(); if (UserList) _dcd(); UserList = new Array(); UserInfo = new Array(); document.getElementById('txtbox').innerHTML = _ANCHOR; _ANCHOR = document.getElementById('txtbox').innerHTML; TblUserList = document.getElementById('user_list'); writeTxt(_msgGreen + _LOCAL25 + _msgnd); if (varProfile == undefined || varTicket == undefined) MovieObject.find(_CHATNAME, _LOCAL58); else MovieObject.ConnectReg(_CHATNAME,varProfile,varTicket,varPP); } function jscb_ConnectionLost() { _dcd(); writeTxt(_msgRed + _LOCAL26 + _msgnd); UserList = new Array(); UserInfo = new Array(); MovieObject.Reconnect(); } function JoinErrorMsg(rawcode) { var _msg = ''; switch (rawcode) { case 913: _msg = _BANNEDMSG; break; case 475: _msg = _ROOMKEY; break; case 473: _msg = _ROOMINVITE; break; case 471: _msg = _ROOMFULL; break; case 403: _msg = _ROOMNOTFOUND; break; case 433: _msg = _NICKNAMEINUSE; break; } alert(_msg); } function jscb_RawJoin(rawcode) { if(rawcode=='401') { if (_tabSelUser == '') return; writeTxtWhisp(_tabSelUser, _msgIndent + _msgGrey + '» ' + _LOCAL46 + _msgnd); } else setTimeout("JoinErrorMsg(" + rawcode +")", 50); } function jscb_RequestTime(who) { var _s = new Date(); MovieObject.SendNotice(who, String.fromCharCode(1) + 'TIME ' + _s.getTime() + String.fromCharCode(1)); } function jscb_ReplyTime(who, msg) { var _s; _s = new Date(parseInt(msg)); if (_s == 'NaN') return; writeTxt(_msgIndent + _msgGrey + '» ' + Nick4Chat(who) + _LOCAL47 + _s.toLocaleString() +_msgnd); } function jscb_TopicChange(who, newtopic) { // writeTxt(_msgTopic + 'Topic has become: ' + parseMessageString(newtopic) + _msgTend); } function showSettings() { newwindow=window.open('opzioni.php','scoretable','height=250,width=350'); if (window.focus) {newwindow.focus()} return false; } function getMyInfo() { return MyInfo;} function ReloadMyInfo() { if (MovieObject.GetInfo("font_name") != undefined) MyInfo["font_name"] = MovieObject.GetInfo("font_name"); if (MovieObject.GetInfo("font_color") != undefined) MyInfo["font_color"] = MovieObject.GetInfo("font_color"); if (MovieObject.GetInfo("font_webcolor") != undefined) MyInfo["font_webcolor"] = MovieObject.GetInfo("font_webcolor"); if (MovieObject.GetInfo("font_underline")!= undefined) MyInfo["font_underline"] = MovieObject.GetInfo("font_underline"); if (MovieObject.GetInfo("font_italic") != undefined) MyInfo["font_italic"] = MovieObject.GetInfo("font_italic"); if (MovieObject.GetInfo("font_bold") != undefined) MyInfo["font_bold"] = MovieObject.GetInfo("font_bold"); if (MovieObject.GetInfo("disable_nudge") == 1) _disableNudge = 1; else _disableNudge = 0; if (MovieObject.GetInfo("disable_whisper") == 1) _disableWhisper=1; else _disableWhisper=0; MyInfo["disable_nudge"] = _disableNudge; MyInfo["disable_whisper"] = _disableWhisper; } function chk(x) { if (x == true) return 1; return 0; } function SaveAndApplyInfo(dn, dp,wb, fn, fc, b, i, u) { dn = chk(dn); dp = chk(dp); b = chk(b); i = chk(i); u = chk(u); MyInfo["font_name"] = fn; MyInfo["font_color"] = fc; MyInfo["font_webcolor"] = wb; MyInfo["font_bold"] = b; MyInfo["font_italic"] = i; MyInfo["font_underline"] = u; MyInfo["disable_nudge"] = dn; MyInfo["disable_whisper"] = dp; MovieObject.SetInfo("font_name", fn); MovieObject.SetInfo("font_color", fc); MovieObject.SetInfo("font_webcolor", wb); MovieObject.SetInfo("font_bold", b); MovieObject.SetInfo("font_italic", i); MovieObject.SetInfo("font_underline", u); MovieObject.SetInfo("disable_nudge", dn); MovieObject.SetInfo("disable_whisper", dp); ApplyMyInfo(); } function EmoticonSortFunction(a, b) { return b.length-a.length; } function AddEmoticon(emo_code, emo_path) { _arrEmoticonsSorted = false; arrEmoticons.push(emo_code); arrEmoticonsNames[emo_code] = emo_path; } function EmoLoadEnd() { if (_arrEmoticonsSorted == true) return; arrEmoticons.sort( EmoticonSortFunction ); _arrEmoticonsSorted = true; } function EmoParseMsg(msg) { EmoLoadEnd(); for (var i = 0; i < arrEmoticons.length ; i++) { msg = global_replace( special_chars(arrEmoticons[i].toLowerCase()), '', msg); msg = global_replace( special_chars(arrEmoticons[i].toUpperCase()), '', msg); } return msg; } function CloseContextMenu() { if (_isMenuDisplayed == true) { var mDiv = document.getElementById('context_menu'); mDiv.className = 'ContextMenuCls'; mDiv.innerHTML = ''; } _isMenuDisplayed = false; } function CreateContextMenu() { var _contextMenuData = new Array(); _contextMenuData["elements"] = new Array(); _contextMenuData["pictures"] = new Array(); _contextMenuData["actions"] = new Array(); _contextMenuData["visible"] = new Array(); _contextMenuData["types"] = new Array(); _contextMenuData.add = function(_name, _picture, _action, _type, _visible) { _contextMenuData["elements"].push(_name); _contextMenuData["pictures"].push(_picture); _contextMenuData["actions"].push(_action); _contextMenuData["visible"].push(_visible); _contextMenuData["types"].push(_type); } _contextMenuData.get = function (_id) { return _contextMenuData["elements"][_id]; } _contextMenuData.setName = function(_id, _newname) { _contextMenuData["elements"][_id] = _newname; } _contextMenuData.setPicture = function(_id, _newname) { _contextMenuData["pictures"][_id] = _newname; } _contextMenuData.setAction = function(_id, _newname) { _contextMenuData["actions"][_id] = _newname; } _contextMenuData.setVisible = function(_id, _newname) { _contextMenuData["visible"][_id] = _newname; } _contextMenuData.setType = function(_id, _newname) { _contextMenuData["types"][_id] = _newname; } _contextMenuData.show = function() { _renderContextMenu(_contextMenuData); } return _contextMenuData; } function ctxDis() { _contextMenuData = _contextMenuDisplayed; var _c = ''; for (var i= 0; i < _contextMenuData["elements"].length; i++) { var _name, _pic, _type, _vis; _name = _contextMenuData["elements"][i]; _pic = _contextMenuData["pictures"][i]; _type = _contextMenuData["types"][i]; _vis = _contextMenuData["visible"][i]; if (_vis == false) continue; var _S = ''; if (_type == 'menu') { _S = _CTXMENUROW; } if (_type == 'disabled') { _S = _CTXMENUDIS; } if (_type == 'separator') { _S = _CTXMENUSEP; } _S = global_replace("{NUM}", i, _S); if (_pic != '') { _S = global_replace("{PIC}", "", _S); _S = global_replace("{NUMSPAN}", "", _S); } else { _S = global_replace(_CTXPICCODE, '', _S); _S = global_replace("{NUMSPAN}", "2", _S); } _S = global_replace("{TEXT}", _name, _S); _c += _S; } var mDiv = document.getElementById('context_menu'); mDiv.className = 'ContextMenuCls'; mDiv.innerHTML = '' + _c + '
'; for (var i = 0; i < _contextMenuData["elements"].length; i++) { var _act, _type, _vis; _act = _contextMenuData["actions"][i]; _type = _contextMenuData["types"][i]; _vis = _contextMenuData["visible"][i]; if (_vis == false) continue; if (_type == 'menu') document.getElementById('id_cont_' + i).onclick = _contextMenuData["actions"][i]; } mDiv.style.left = (_clientX+document.documentElement.scrollLeft) + 'px'; mDiv.style.top = (_clientY+document.documentElement.scrollTop) + 'px'; mDiv.className = 'ContextMenuShw'; _isMenuDisplayed = true; } function _renderContextMenu(_contextMenuData) { _contextMenuDisplayed = _contextMenuData; setTimeout('ctxDis()', 10); } function ignoreUser() { var hinf = UserInfo[SelectedUser]; if (hinf["ircop"] == true) return; if (hinf["ignore"] == true) UserInfo[SelectedUser]["ignore"] = false; else UserInfo[SelectedUser]["ignore"] = true; if (UserInfo[SelectedUser]["ignore"] == true) writeTxt(_msgIndent + _msgGrey + '» ' + SelectedUser + ' ' + _LOCAL27 + _msgnd); else writeTxt(_msgIndent + _msgGrey + '» ' + SelectedUser + ' ' + _LOCAL28 + _msgnd); var p = FindUserList(SelectedUser); if ( p == -1 ) return; document.getElementById('id_pic_' + p).innerHTML = GetPictureByUser(SelectedUser); CloseContextMenu(); } function windowHeight() { if ( window.innerHeight ) return window.innerHeight; if ( document.documentElement.clientHeight ) return document.documentElement.clientHeight; if ( document.body.clientHeight ) return document.body.clientHeight; } function documentLoaded() { if (navigator.appName.indexOf("Microsoft") != -1) { MovieObject = document.getElementById('MainMovie'); } else { MovieObject = document['MainMovie']; } //document.getElementById('txtbox').style.height=windowHeight() - 250; //if (screen.Height == 1024) // document.getElementById('wasaa_bottom_id').style.paddingTop = '5%'; disableSelection(document.getElementById('_unsel_div')); disableSelection(document.getElementById('context_menu')); var _oldf = 0; if (document.body.onmousedown) document.body.onmousedown = _oldf; document.body.onmousedown = function(ev) { if (_oldf) _oldf(ev); if (!ev) ev = window.event; _clientX = ev.clientX; _clientY = ev.clientY; var _btnClick; if (window.event) _btnClick = 1; else _btnClick = 0; if (ev.button == _btnClick && _isMenuDisplayed == true) { var tgt = ev.target != null ? ev.target : ev.srcElement; var _close= true; if (tgt.id.indexOf('id_cont') != -1) _close = false; if (_close) CloseContextMenu(); } } _userListMenu = CreateContextMenu(); _userListMenu.add(_LOCAL32, '', viewProfile, 'menu', true); _userListMenu.add(_LOCAL33, '', whisperUser, 'menu', true); _userListMenu.add(_LOCAL34, '', ignoreUser, 'menu', true); _userListMenu.add('','',null,'separator', true); _userListMenu.add(_LOCAL35, '', tagUser, 'menu', true); _userListMenu.add(_LOCAL36, '', askLocalTime, 'menu', true); _userListMenu.add(_LOCAL37, '', skickUser, 'menu', true); _userListMenu.add('','',null,'separator', true); _userListMenu.add(_LOCAL38, '', setOwner, 'menu', true); _userListMenu.add(_LOCAL39, '', setHost, 'menu', true); _userListMenu.add(_LOCAL40, '', setVoice, 'menu', true); _userListMenu.add(_LOCAL41, '', setSpectator, 'menu', true); _userListMenu.add('','',null,'separator', true); _userListMenu.add('Billiard','Icons/game_icon.gif',challengeSelPlayerId2,'menu', true); _userListMenu.add('Dama Multiplayer','Icons/game_icon.gif',challengeSelPlayerId4,'menu', true); _userListMenu.add('Conquer Antarctica','Icons/game_icon.gif',challengeSelPlayerId1,'menu', true); _tabContextMenu = CreateContextMenu(); _tabContextMenu.add(_LOCAL42,'',viewPlayerProfile,'menu', true); _tabContextMenu.add('','',null,'separator', true); _tabContextMenu.add(_LOCAL43,'',closeUserTab,'menu', true); if(document.layers) { document.captureEvents(Event.KEYPRESS) } document.onkeypress=KeyPressed; connectToChat(); } function challengeSelPlayerId2() { challengeSelPlayer(2); CloseContextMenu(); } function challengeSelPlayerId4() { challengeSelPlayer(4); CloseContextMenu(); } function challengeSelPlayerId1() { challengeSelPlayer(1); CloseContextMenu(); } function closeUserTab() { if(!CheckSelDiv()) return false; if(_tabSelUser != '') { CloseWhisperWindow(_tabSelUser); _tabSelUser =''; } CloseContextMenu(); } function SetPassword(pwd) { MovieObject.SetPassword(pwd); } function setOwner() { MovieObject.SetUserMode(SelectedUser, '+q'); CloseContextMenu(); } function setHost() { MovieObject.SetUserMode(SelectedUser, '+o'); CloseContextMenu(); } function setVoice() { if (UserInfo[SelectedUser]["mode"] != '') { MovieObject.SetUserMode(SelectedUser, '-o'); } MovieObject.SetUserMode(SelectedUser, '+v'); CloseContextMenu(); } function setSpectator() { if (UserInfo[SelectedUser]["mode"] != '') { MovieObject.SetUserMode(SelectedUser, '-o'); } MovieObject.SetUserMode(SelectedUser, '-v'); CloseContextMenu(); } function viewProfile() { MovieObject.GetProfile(SelectedUser); CloseContextMenu(); } function jscb_Profile(puid) { window.open("http://"+_curUrl+"/redir.php?puid=" + puid, '', ''); } function RemoveMenuDiv(dv) { document.getElementById('wasaa_menu').removeChild( document.getElementById(dv) ); } function SelectMenuDiv(dv) { StopBlink(dv); var _l = document.getElementById('wasaa_menu').childNodes; for (var i = 0; i < _l.length; i++) { var dvc = _l[i]; if (dvc.id == dv) { if (dv == 'wasaa_sp') dvc.className='wasaa_submenu_sel_home'; else dvc.className='wasaa_submenu_sel'; } else dvc.className='wasaa_submenu'; } } function BlinkInterval(id) { var _c = document.getElementById(id); _c = _c.childNodes[0]; _c = _c.childNodes[0]; if (_c.style.color == '') _c.style.color='#99CC00'; else _c.style.color=''; } function StartBlink(id) { if (_blinkIntervals[id] != undefined && _blinkIntervals[id] != '') return; if (document.getElementById(id).className=='wasaa_submenu_sel') return; var _vInt = setInterval('BlinkInterval("' + id + '")', 600); _blinkIntervals[id] = _vInt; } function StopBlink(id) { if (_blinkIntervals[id] == undefined || _blinkIntervals[id] == '') return; var _c = document.getElementById(id); _c = _c.childNodes[0]; _c = _c.childNodes[0]; _c.style.color=''; clearInterval(_blinkIntervals[id]); _blinkIntervals[id] = ''; } function AddMenuDiv(id, func, value) { var newDiv = document.createElement('div'); newDiv.className='wasaa_submenu'; newDiv.id = id; newDiv.innerHTML = ''; document.getElementById('wasaa_menu').appendChild(newDiv); } function selectWhisperDiv(nck) { SelectMenuDiv('whsp_'+nck); } function GetTabsCount() { var i = 0; for (i = 0;; i++) { var _c = document.getElementById('tab_' + i); if (!_c) return i; } } function RemoveWhisperWindowId(id) { var _s = GetTabsCount(); document.getElementById('__whisp_tabs').removeChild( document.getElementById('tab_' + id) ); for (var a = id; a < _s-1; a++) { document.getElementById('tab_' + (a+1)).id = 'tab_' + a; arrWhispWindow[ arrWhispWindowId[a+1] ] = a; arrWhispWindowId[a+1] = arrWhispWindowId[a]; } } function ShowWhisperWindowId(id) { document.getElementById('tab_' + id).style.display=''; for (var i = 0; i < GetTabsCount(); i++) if ( id != i ) document.getElementById('tab_' + i).style.display='none'; if (id == 1) return; if (id == 0) scrollTxtDown('txtbox'); else scrollTxtDown('txtbox_' + _tabSelUser); } function ShowGameLobby() { _tabSelUser = ''; _showGameLobbyOrSP=0; SelectMenuDiv('wasaa_gb'); ShowWhisperWindowId(0); } function openIfNotOpenWhisp(who) { if (arrWhispWindow[who] == '' || arrWhispWindow[who] == undefined) openWhisperWindow(who); else StartBlink('whsp_' + who); } function CloseWhisperWindow(user) { document.getElementById('game_div_'+user).innerHTML = ''; var id = arrWhispWindow[user]; RemoveWhisperWindowId(id); arrWhispWindow[user] = ''; RemoveMenuDiv('whsp_' + user); ShowGameLobby(); } function WhisperWindow(user) { if (arrWhispWindow[user] == undefined || arrWhispWindow[user] =='') { var newDiv = document.createElement('div'); newDiv.style.display = 'none'; var _t = GetTabsCount(); newDiv.id = 'tab_' + _t; var _code = document.getElementById('__whisp_tab_code').innerHTML; _code = global_replace("{NICKNAME}", user, _code); newDiv.innerHTML = _code; arrWhispWindow[user] = _t; arrWhispWindowId[_t] = user; document.getElementById('__whisp_tabs').appendChild(newDiv); document.getElementById('gameNameDiv_' + user).innerHTML = _chooseGameTxt; document.getElementById('game_div_' + user).innerHTML = _iframeCode; ShowWhisperWindowId(_t); //document.getElementById('txtbox_' + user).style.height=windowHeight() - 250; writeTxtWhisp(user, _whisperDisclaimer); return _t; } else { return arrWhispWindow[user]; } } function CheckSelDiv() { if (_tabSelUser != '') { var _s = document.getElementById('game_div_' + _tabSelUser).innerHTML; if (_s.toUpperCase().indexOf("OBJECT") !=-1 || _s.toUpperCase().indexOf("EMBED") != -1) { if (confirm(_LOCAL29)) { //if (document.getElementById('gameMovie_' + _tabSelUser)) // document.getElementById('gameMovie_' + _tabSelUser).CloseConn(); return true; } else return false; } } return true; } function CloseSelDiv() { if(!CheckSelDiv()) return false; if (_tabSelUser != '') { CloseWhisperWindow(_tabSelUser); _tabSelUser = ''; } } function viewPlayerProfile() { } function openWhisperWindow(nick, ev) { if ((arrWhispWindow[nick] == '' || arrWhispWindow[nick] == undefined) && GetTabsCount() > 7) { alert(_LOCAL30); return; } if (nick == MyNick()) return; _tabSelUser = nick; if (ev == null) ev=window.event; if (ev) { if (ev.button==2) { if (nick.substr(0,1) == '>' || UserInfo[nick]["ircop"] == true) _tabContextMenu.setType(0, 'disabled'); else _tabContextMenu.setType(0, 'menu'); _tabContextMenu.show(); } } if (!document.getElementById('whsp_' + nick)) AddMenuDiv('whsp_' + nick, 'openWhisperWindow("' + nick + '", event);',Nick4Chat(nick)); ShowWhisperWindowId(WhisperWindow(nick)); ApplyMyInfoTxt(document.getElementById('txtSend_' + nick)); selectWhisperDiv(nick); document.getElementById('txtSend_' + nick).focus(); CloseContextMenu(); } function whisperUser() { if (_disableWhisper == 1) { alert(_LOCAL63); return; } if (UserInfo[SelectedUser]['ignore'] == true) { alert(_LOCAL48); return; } openWhisperWindow(SelectedUser); } function tagUser() { var hinf = UserInfo[SelectedUser]; if (hinf["tagged"] == true) UserInfo[SelectedUser]["tagged"] = false; else UserInfo[SelectedUser]["tagged"] = true; var p = FindUserList(SelectedUser); if ( p == -1 ) return; document.getElementById('id_pic_' + p).innerHTML = GetPictureByUser(SelectedUser); CloseContextMenu(); } function askLocalTime () { MovieObject.SendPrivmsg(SelectedUser, String.fromCharCode(1) + 'TIME' + String.fromCharCode(1)); CloseContextMenu(); } function skickUser () { CreateDropdownWindow(_LOCAL31,'250px', true, 'kick_div'); CloseContextMenu(); } function performKick(what) { var tbl=what.parentNode.parentNode.parentNode.parentNode.parentNode; var _c = tbl.parentNode.id; _c = _c.replace('dragContent',''); if (SelectedUser == '') { CloseWindow(_c); return; } var why = tbl.rows[0].cells[1].childNodes[0].value; var time = tbl.rows[1].cells[1].childNodes[0].value; if (time != 0) { why += '(' + _LOCAL50 + ' ' + _LOCAL51[time] + ')'; } MovieObject.KickBan(SelectedUser, why, time); CloseWindow(_c); } function KeyDown(e) { if (inputHistory.length == 0) return; key=(!window.event)?e.which:window.event.keyCode if (key == 38) document.getElementById('txtSend').value = upHistory(); if (key == 40) document.getElementById('txtSend').value = downHistory(); } function ResetHistory() { inputHistoryCursor = inputHistory.length - 1; } function awayButton_mouseDown() { _awayButton_down = true; document.getElementById('awayButton').className = 'awayButton_down'; } function KeyPressed(e) { key=(!window.event)?e.which:window.event.keyCode; var _sn = 'txtSend'; if (document.getElementById('tab_0').style.display == 'none') { _sn += '_' + _tabSelUser; } if (key == 11) { var c = document.getElementById(_sn); c.focus(); c.value = c.value + String.fromCharCode(3); } if (key == 13 && _sendMsgFocus == true) { if (_sn == 'txtSend') SendMessage(); else SendWhisper(_tabSelUser); } } function setMsgFocus() { _sendMsgFocus = true; } function unsetMsgFocus() { _sendMsgFocus = false; } function remove_ands(txt) { return global_replace('&', '&', txt); } function special_chars(txt) { var process = txt; process = remove_ands(process); process = global_replace('<', "<",process); process = global_replace('>', ">",process); process = global_replace('"', """,process); process = global_replace("'", "'",process); return process; } function parseBBCodes(_txt, feature) { var _newStr = ''; var _open = false; var _curstr = ''; var _cp_b = 0; var _cp_cl = 0; var _cp_i = 0; var _cp_u = 0; var _cp_bgcl = 0; var _cp_link = 0; var _cp_spt = 0; var txt = _txt; if (feature == true) { txt = global_replace("[br]", "
", txt); txt = global_replace("[;]", " ", txt); } for (var i = 0; i < txt.length; i++) { var chr = txt.substr(i , 1); if (_open == true) { if (chr == ']') _open = false; else _curstr = _curstr + chr; if (_open == false) { var __cmd = _curstr.split('='); switch (__cmd[0].toLowerCase()) { case 'u': _cp_u++; _newStr +=''; break; case 'b': _cp_b++; _newStr += ''; break; case 'link': if (feature == false) { _newStr += '[' + _curstr + ']'; break; } var _st = __cmd[1]; _st = global_replace('w3.', 'www.', _st); _st = global_replace('ht:','http://', _st); _newStr += ''; _cp_link++; break; case 'img': if (feature == false) _newStr += '[' + _curstr + ']'; else { var _st = __cmd[1]; _st = global_replace('w3.', 'www.', _st); _st = global_replace('ht:','http://', _st); _newStr += ''; } break; case 'color': if (__cmd.length == 1) _newStr += '[' + _curstr + ']'; else { _cp_cl++; _newStr += ''; } break; case 'bgcolor': if (__cmd.length == 1) _newStr += '[' + _curstr + ']'; else { _cp_bgcl++; _newStr += ''; } break; case 'i': _cp_i++; _newStr += ''; break; case '/u': if (_cp_u<1) break; _newStr += ''; _cp_u--; break; case '/b': if (_cp_b<1) break; _newStr += ''; _cp_b--; break; case '/color': if (_cp_cl<1) break; _newStr += '
'; _cp_cl--; break; case '/bgcolor': if (_cp_bgcl<1) break; _newStr += '
'; _cp_bgcl--; break; case '/link': if (_cp_link<1) break; _newStr += ''; _cp_i--; break; case '/i': if (_cp_i<1) break; _newStr += ''; _cp_i--; break; default: _newStr += '[' + _curstr + ']'; break; } } } else { if (chr == '[') { _curstr = ''; _open=true; } else _newStr = _newStr + chr; } } if (_open) _newStr += '[' + _curstr; for (var i = 0; i < _cp_b; i++) _newStr += ''; for (var i = 0; i < _cp_i; i++) _newStr += ''; for (var i = 0; i < _cp_u; i++) _newStr += ''; for (var i = 0; i < _cp_link; i++) _newStr += ''; for (var i = 0; i < _cp_cl+_cp_bgcl; i++) _newStr += '
'; return _newStr; } function parseIRCColor (message) { var pageBack = 'white'; var pageFront = 'black'; var length = message.length; var newText = ''; var bold = false; var color = false; var reverse = false; var underline = false; var foreColor = ''; var backColor = ''; for (var i = 0 ; i < length ; i++) { switch (message.charAt(i)) { case String.fromCharCode(2): if (bold) { newText += ''; bold = false; } else { newText += ''; bold = true; } break; case String.fromCharCode(3): if (color==true) { newText += '
'; color = false; } foreColor = ''; backColor = ''; if ((parseInt(message.charAt(i+1)) >= 0) && (parseInt(message.charAt(i+1)) <= 9)) { color = true; if ((parseInt(message.charAt(++i+1)) >= 0) && (parseInt(message.charAt(i+1)) <= 9)) { foreColor = getColor(parseInt(message.charAt(i)) * 10 + parseInt(message.charAt(++i))); } else { foreColor = getColor(parseInt(message.charAt(i))); } if ((message.charAt(i+1) == ',') && (parseInt(message.charAt(++i+1)) >= 0) && (parseInt(message.charAt(i+1)) <= 9)) { if ((parseInt(message.charAt(++i+1)) >= 0) && (parseInt(message.charAt(i+1)) <= 9)) { backColor = getColor(parseInt(message.charAt(i)) * 10 + parseInt(message.charAt(++i))); } else { backColor = getColor(parseInt(message.charAt(i))); } } } if (foreColor) { newText += ''; } break; case String.fromCharCode(15): if (bold) { newText += ''; bold = false; } if (color) { newText += '
'; color = false; } if (reverse) { newText += ''; reverse = false; } if (underline) { newText += ''; underline = false; } break; case String.fromCharCode(22): if (reverse) { newText += ''; reverse = false; } else { newText += ''; reverse = true; } case String.fromCharCode(31): if (underline) { newText += ''; underline = false; } else { newText += ''; underline = true; } default: newText += message.charAt(i); break; } } if (bold) newText += ''; if (color) newText += ''; if (reverse) newText += '' if (underline) newText += ''; return newText; } function getColor(numeric) { var num = parseInt(numeric); switch (num) { case 0: return 'white'; case 1: return 'black'; case 2: return 'navy'; case 3: return 'green'; case 4: return 'red'; case 5: return 'maroon'; case 6: return 'purple'; case 7: return 'orange'; case 8: return 'yellow'; case 9: return 'lime'; case 10: return 'teal'; case 11: return 'aqua'; case 12: return 'blue'; case 13: return 'fuchsia'; case 14: return 'gray'; default: return 'silver'; } } function parseURLs(msg) { var _newStr = ''; var _open = false; var _cur = ''; for (var i = 0; i < msg.length; i++) { var chr = msg.substr(i , 1); if (_open == true) { if (chr == ' ') { _open = false; var _curLink = ''; if (_cur.substr(0,7) != "http://") _curLink='http://'+_cur; else _curLink = _cur; _newStr += '' + _cur + ' '; } else { _cur += chr; } } else { if (msg.substr(i, 7).toLowerCase() == 'http://' || msg.substr(i, 4).toLowerCase() == 'www.') { var _shft = 6; if (msg.substr(i, 4).toLowerCase() == 'www.') _shft = -1; i+=_shft; _open = true; _cur = ''; if (_shft == 6) _cur = 'http://'; } else { _newStr += chr; } } } if (_open == true) { var _curLink = ''; if (_cur.substr(0,7) != "http://") _curLink='http://'+_cur; else _curLink = _cur; _newStr += '' + _cur + ' '; } return _newStr; } function parseMessageString(msg, feature) { if (feature == undefined) feature = false; var _p1 = special_chars(msg); _p1 = EmoParseMsg(_p1); _p1 = parseURLs(_p1); _p1 = parseBBCodes(_p1, feature); _p1 = parseIRCColor(_p1); return _p1; } function awayButton_mouseUp() { _awayButton_down = false; if (UserInfo[MyNick()]["away"] == false) document.getElementById('awayButton').className = 'awayButton'; else document.getElementById('awayButton').className = 'awayButton_down'; } function awayButton_mouseMove() { if (_awayButton_down == true) return; if (UserInfo[MyNick()]["away"] == false) document.getElementById('awayButton').className = 'awayButton_hover'; } function awayButton_mouseOut() { if (UserInfo[MyNick()]["away"] == true) document.getElementById('awayButton').className = 'awayButton_down'; else document.getElementById('awayButton').className = 'awayButton'; } function awayButton_click() { if (UserInfo[MyNick()]["away"] == true) { UserInfo[MyNick()]["away"] = false; document.getElementById('awayButton').className = 'awayButton'; MovieObject.returnFromAway(); } else { UserInfo[MyNick()]["away"] = true; document.getElementById('awayButton').className = 'awayButton_down'; MovieObject.goAway(); } } if ( navigator.userAgent.indexOf('Firefox') != -1) { }