/** * This class is the client part of phpFreeChat * (depends on prototype library) * @author Stephane Gully */ var pfcClient = Class.create(); //defining the rest of the class implmentation pfcClient.prototype = { initialize: function() { /* user description */ this.nickname = ''; this.timeout = null; this.refresh_delay = ; /* unique client id for each windows used to identify a open window * this id is passed every time the JS communicate with server * (2 clients can use the same session: then only the nickname is shared) */ this.clientid = 'b79f929fd100f4bb3d4c662ed8ecd723'; this.el_words = $('words'); this.el_handle = $('handle'); this.el_container = $('container'); this.el_online = $('online'); this.el_errors = $('errors'); this.minmax_status = false; var cookie = getCookie('minmax_status'); if (cookie != null) this.minmax_status = (cookie == 'true'); cookie = getCookie('nickmarker'); this.nickmarker = (cookie == 'true'); if (cookie == '' || cookie == null) this.nickmarker = false; cookie = getCookie('clock'); this.clock = (cookie == 'true'); if (cookie == '' || cookie == null) this.clock = false; cookie = getCookie('showsmileys'); this.showsmileys = (cookie == 'true'); if (cookie == '' || cookie == null) this.showsmileys = false; cookie = getCookie('showwhosonline'); this.showwhosonline = (cookie == 'true'); if (cookie == '' || cookie == null) this.showwhosonline = false; /* '' means no forced color, let CSS choose the text color */ this.current_text_color = ''; cookie = getCookie('current_text_color'); if (cookie != null) this.switch_text_color(cookie); this.isconnected = false; this.nicklist = Array(); this.nickcolor = Array(); this.colorlist = Array(); this.blinktmp = Array(); this.blinkloop = Array(); this.blinktimeout = Array(); /* the events callbacks */ this.el_words.onkeypress = this.callbackWords_OnKeypress.bindAsEventListener(this); this.el_words.onkeydown = this.callbackWords_OnKeydown.bindAsEventListener(this); this.el_words.onfocus = this.callbackWords_OnFocus.bindAsEventListener(this); this.el_handle.onkeydown = this.callbackHandle_OnKeydown.bindAsEventListener(this); this.el_handle.onchange = this.callbackHandle_OnChange.bindAsEventListener(this); this.el_container.onmousemove = this.callbackContainer_OnMousemove.bindAsEventListener(this); this.el_container.onmousedown = this.callbackContainer_OnMousedown.bindAsEventListener(this); this.el_container.onmouseup = this.callbackContainer_OnMouseup.bindAsEventListener(this); document.body.onunload = this.callback_OnUnload.bindAsEventListener(this); /* the i18n translations */ var i18n = { hide_nickname_color: '