rem: if(!this.items[i].disabled) { 
add: if(this.items[i].disabled) console.attributes=dattr; else { 
context: function Lightbar_draw(current){	var attr=this.bg<<4|this.fg;	var cattr=this.hbg<<4|this.hfg;	var dattr=this.dbg<<4|this.dfg;	var kattr=this.bg<<4|this.kfg;	var kcattr=this.hbg<<4|this.khfg;	var ret=undefined;	if(current!=undefined)		this.current=current;	if(!(user.settings & USER_ANSI)) {		return;	}	if(!(user.settings & USER_COLOR)) {		return;	}	if(this.direction < 0 || this.direction > 1) {		alert("Unknown lightbar direction!");		return;	}	/* Check that a vertical lightbar fits on the screen */	if(this.direction==0 && (this.ypos+this.items.length-1 > console.screen_rows)) {		alert("Screen too short for lightbar!");		return;	}	/* Ensure current is valid */	if(this.current<0 || this.current >= this.items.length) {		alert("current parameter is out of range!");		this.current=0;		if(this.items.length<=0)			return;	}	var orig_cur=this.current;	while(this.items[this.current].retval==undefined || this.items[this.current].disabled) {		this.current++;		if(this.current==this.items.length)			this.current=0;		if(this.current==orig_cur) {			alert("No items with a return value!");			return;		}	}	/* Check that a horizontal lightbar fits on the screen */	if(this.direction==1) {		var end=this.xpos;		var i;		for(i=0; i<this.items.length; i++) {			if(this.force_width>0) {				end+=this.force_width+1;				continue;			}			if(this.items[i].width==undefined) {				if(this.items[i]==undefined) {					alert("Sparse items array!");					return;				}				if(this.items[i].text==undefined) {					alert("No text for item "+i+"!");					return;				}				var cleaned=this.items[i].text;				cleaned=cleaned.replace(/\|/g,'');				end+=cleaned.length+1;			}			else {				end+=this.items[i].width			}		}	}	var i;	var j;	var k;	/* Draw items */	var curx=this.xpos;	var cury=this.ypos;	var cursx=this.xpos;	var cursy=this.ypos;	var item_count=0;	for(i=0; i<this.items.length; i++) {		var width;		// Some basic validation.		if(this.items[i]==undefined) {			alert("Sparse items array!");			return;		}		if(this.items[i].text==undefined) {			alert("No text for item "+i+"!");			return;		}		var cleaned=this.items[i].text;		cleaned=cleaned.replace(/\|/g,'');		if(this.force_width>0)			width=this.force_width;		else {			width=cleaned.length;			if(this.items[i].width!=undefined)				width=this.items[i].width;		}		var lpadding=this.lpadding;		var rpadding=this.rpadding;		if(this.items[i].lpadding!=undefined)			lpadding=this.items[i].lpadding;		if(this.items[i].rpadding!=undefined)			rpadding=this.items[i].rpadding;		console.gotoxy(curx, cury);		if(lpadding != undefined && lpadding != null) {			console.attributes=attr;			console.write(lpadding);			curx+= lpadding.length;		}		if(i==this.current) {			cursx=curx;			cursy=cury;		}		k=0;		if(cleaned.length < width) {			if(this.align==1) {				if(this.current==i)					console.attributes=cattr;				else {					if(this.items[i].disabled)						console.attributes=dattr;					else						console.attributes=attr;				}				for(;k<width-cleaned.length;k++)					console.write(' ');			}			if(this.align==2) {				if(this.current==i)					console.attributes=cattr;				else {					if(this.items[i].disabled)						console.attributes=dattr;					else						console.attributes=attr;				}				for(;k<(width-cleaned.length)/2;k++)					console.write(' ');			}		}		for(j=0; j<this.items[i].text.length; j++) {			if(width > -1 && k > width)				break;			if(this.items[i].text.substr(j,1)=='|') {				if(!this.items[i].disabled) {					if(this.current==i)						console.attributes=kcattr;					else						console.attributes=kattr;				}				j++;			}			else {				if(this.current==i)					console.attributes=cattr;				else {					if(this.items[i].disabled)						console.attributes=dattr;					else						console.attributes=attr;				}			}			console.write(this.items[i].text.substr(j,1));			k++;		}		if(this.current==i)			console.attributes=cattr;		else {			if(this.items[i].disabled)				console.attributes=dattr;			else				console.attributes=attr;		}		while(k<width) {			console.write(" ");			k++;		}		if(rpadding != undefined && rpadding != null) {			console.attributes=attr;			console.write(rpadding);			curx+= rpadding.length;		}		if(this.direction==0) {			cury++;			curx=this.xpos;		}		else {			console.attributes=attr;			curx+=width;			for(j=0; j<this.hblanks; j++) {				console.write(" ");				curx++;			}		}		if(this.items[i].retval!=undefined)			item_count++;	}	if(item_count==0) {		alert("No items with a return value!");		return;	}}
meta: 9592	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9592/4f223d12f8505cb351da184b25e6b6e9ae060fd6/lightbar.js/buggy/load/lightbar.js