Commits

Anonymous committed 7aef7c0

Fix several opera bugs

Comments (0)

Files changed (5)

 	 * Make a xmlhttrequest, once result received the parse_response function is called 
 	 * @param 	string	Raw to send
 	 * @param	boolean	If true sessid is added to request
-	 * @param	Mixed	Can be array,object or string, if more than one, must be a string	
+	 * @param	Mixed	Can be array,object or string, if more than one, must an array 
 	 * @param	Object	Options (event, async, callback )
+	 * @param	Boolean	Used only by opera
 	 */
-	request: function(raw, param, sessid, options){
+	request: function(raw, param, sessid, options, no_watch){
 		//Opera dirty fix
-		if (Browser.Engine.presto && options && !options.no_watch) {
+		if (Browser.Engine.presto && !no_watch) {
 			this.watch_var_changed = true;
 			this.watch_var_cnt = [raw, param, sessid, options];
 			return;
 		}
 
 		//Set options
+		if (!$type(sessid)) sessid = true;
 		if (!options) options = {};
 		if (!options.event) options.event = true;
 		if (!options.callback) options.callback = null;
-		//This id dirty -_-
-		if (!$type(sessid)) sessid = true;
 		param = param || [];
 
 		//Format params
 		if (param.length > 0) {
 			query_string += '&' + param.join('&');
 		}
-
 		//Show time
 		this.current_request = new this.transport.request($extend(this.transport.options,{	
 								'url': 'http://' + this.options.frequency + '.' + this.options.server + '/?',
 				}
 			}
 		}
-		if(check){
+		if(check && !this.watch_var_changed){
 			this.check();
 		}
 	},
 	watch_var: function(){
 		if (this.watch_var_changed) {
 			this.watch_var_changed = false;
-			if (!this.watch_var_cnt[2]) this.watch_var_cnt[2] = {};
-			this.watch_var_cnt[2].no_watch = true;
+			this.watch_var_cnt[4] = true;
 			this.request.run(this.watch_var_cnt, this);
 		}
 	},
 	},
 	request: function(raw, param, sessid, options){
 		var tmp = {'event': false}
-		this._core.request(raw,param,sessid, options ? $extend(tmp,options) : tmp);
+		this._core.request(raw, param, sessid, options ? $extend(tmp, options) : tmp);
+		if (!$type(sessid) || sessid) {
+			param.unshift(this._core.get_sessid());
+		}
 		this.fire_event('cmd_' + raw.toLowerCase(), [this].combine(param));
 	},
 	get_pubid: function(){

ape/plugins/debugger/debugger.js

 		}
 		this.parent(options);
 	},
-	request: function(raw,param,sessid,options){
+	request: function(raw,param,sessid,options,no_watch){
 		console.log('Sending',raw,sessid,param,'fq',this.options.frequency);
-		this.parent(raw,param,sessid,options);
+		this.parent(raw,param,sessid,options,no_watch);
 	},
 	parse_response: function(raws){
 		console.log('Receiving',raws);

ape/plugins/move/demo.html

 		});
 	</script>
 		<div id="ape_master_container"></div>
+		<div id="debug"></div>
 	</body>
 </html>

ape/plugins/move/move.js

 		var i=0;
 		while(i<3 && i<nickname.length){
 			//Transformation du code ascii du caractère en code couleur
-			color[i] = Math.round(((nickname.charCodeAt(i)-97)/26)*200+10);			
+			color[i] = Math.abs(Math.round(((nickname.charCodeAt(i)-97)/26)*200+10));			
 			i++;
 		}
 		return color.join(',');
 		this.els.move_box = new Element('div',{'class':'move_box'}).inject(this.element);
 		this.els.move_box.addEvent('click',function(ev){ 
 			this.sendpos(ev.page.x,ev.page.y);
-		}.bind(this));
+		}.bindWithEvent(this));
 		this.els.more = new Element('div',{'id':'more'}).inject(this.element,'inside');
 
 		this.els.sendbox_container = new Element('div',{'id':'ape_sendbox_container'}).inject(this.els.more);