rem: if(sClass=="")sClass=sValue; else sValue=sClass+" "+sValue; 
add: if(sClasses=="")sClasses=sValue; else sValue=sClasses+" "+sValue; 
context: function setClass(sValue,sAllowedContainers,sConflictingClasses,sAllowedClasses){	var bConflictFound=false;	var bAllowedFound=(sAllowedClasses=="" || sAllowedClasses==null);	var container=null;		if(sConflictingClasses==null)sConflictingClasses="";	if(sAllowedClasses==null)sAllowedClasses="";	//sAllowedContainers : string e.g. "P,DIV,SPAN"	// '*' = all containers allowed	var aCt=sAllowedContainers.split(",");	//find the container (from cursor pos or selected element)	container=getSelectedContainer();	//find allowed container	//if current container isn't allowed, take the parent, and so on ...	if(container!=null)container=getAllowedContainer(container,aCt);	if(container!=null)	{		//check if there isn't a conflict with existent classes		var aClE=container.className.split(" "); 		//array of classes already applied to the container		var aClC=sConflictingClasses.split(",");		//array of conflicting classes		var aClA=sAllowedClasses.split(",");			//array of compatible classes				if(container.className=="")bAllowedFound=true;		//if no classes already applied, every class is allowed		for(var i=0;i<aClE.length;i++)		{			for(var j=0;j<aClC.length;j++)			{				if((aClC[j]==aClE[i] && aClC[j]!="") || (aClC[j]=="*" && aClE[i]!="" && aClE[i]!=sValue))				{					bConflictFound=true;					break;				}			}			if(bConflictFound)break;						if(!bAllowedFound)			{				for(var k=0;k<aClA.length;k++)				{					if((aClA[k]==aClE[i] && aClA[k]!="") || (aClA[k]=="*" && aClE[i]!="") || (aClE[i]==sValue))					{						bAllowedFound=true;						break;						}				}				if(bAllowedFound)break;			}		}		//apply or remove it if no conflict		if(!bConflictFound && bAllowedFound)		{			var sClass=container.className;			if(sClass==sValue || sClass.indexOf(sValue+" ")>-1 || sClass.indexOf(" "+sValue)>-1)			{				sClass=sClass.replace(sValue,"");				sClass=sClass.replace("  "," ");				sValue=sClass;			}			else			{				if(sClass=="")sClass=sValue;				else sValue=sClass+" "+sValue;			}			sValue=sTrim(sValue);			if(sValue=="")container.removeAttribute("className");			else container.setAttribute("className",sValue,0);			displayClasses();		}	}}
meta: 5576	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5576/d92ddd696162a3a84bfc1a181f53ea008516a242/wym.js/buggy/editor/wym.js