rem:  toolbarItem.setAttribute("oncommand","if (event.target==this)   translateFrom('en_" + glanguagePairs[glocale][0] + "');");  
add:  if(glocale = 0) { toolbarItem.setAttribute("oncommand","quick_translate();"); } else { toolbarItem.setAttribute("oncommand","if (event.target==this)   translateFrom('en_" + glanguagePairs[glocale][0] + "');"); } 
context: function initMenus(){   var languagePair;      var contextItem = document.getElementById("translate-context");      var contextMenuPopupElement = document.createElement("menupopup");      var contextMenuItemLabel;   var contextMenuItemTooltiptext;   var contextMenuItemOncommand;      var contextMenuItemElement;      var toolbarItem = document.getElementById("translate-pg");   var toolbarMenuPopupElement = document.createElement("menupopup");     var toolbarMenuItemLabel;   var toolbarMenuItemTooltiptext;   var toolbarMenuItemOncommand ;   var toolbarMenuItemElement;   var toolMenu = document.getElementById("translate-tool-menu");   var toolMenuSeperator = document.getElementById("translate-options-separator");   	 for(var i = 1; i < glanguagePairs[glocale].length ; i++)   {	    	languagePair = glanguagePairs[glocale][i] + "_" + glanguagePairs[glocale][0];    	    	    	//setup up context menu    	contextMenuItemLabel = gTranslateBundle.getString("context.menu." + languagePair + ".label");                  contextMenuItemTooltiptext = 	gTranslateBundle.getString(languagePair + ".tooltip");    	contextMenuItemOncommand = "translateSelection('" + languagePair + "');";   		   		contextMenuItemElement = document.createElement("menuitem");    	    	contextMenuItemElement.setAttribute("label",contextMenuItemLabel);    	contextMenuItemElement.setAttribute("tooltiptext",contextMenuItemTooltiptext);    	contextMenuItemElement.setAttribute("oncommand",contextMenuItemOncommand);						contextMenuPopupElement.appendChild(contextMenuItemElement);						//setup toolbutton menu			toolbarMenuItemLabel = gTranslateBundle.getString("toolbar.menu." + languagePair + ".label");      toolbarMenuItemTooltiptext = 	gTranslateBundle.getString(languagePair + ".tooltip");    	toolbarMenuItemOncommand = "translateFrom('" + languagePair + "');";   		   		toolbarMenuItemElement = document.createElement("menuitem");   	    	toolbarMenuItemElement.setAttribute("label",toolbarMenuItemLabel);    	toolbarMenuItemElement.setAttribute("tooltiptext",toolbarMenuItemTooltiptext);    	toolbarMenuItemElement.setAttribute("oncommand",toolbarMenuItemOncommand);    	 							toolbarMenuPopupElement.appendChild(toolbarMenuItemElement);			    	    }                    //set toolbar icon        toolbarItem.setAttribute("class","translate-tool-" + glanguagePairs[glocale][0]);         //    toolbarItem.setAttribute("oncommand","if (event.target==this)   translateFrom('en_" + glanguagePairs[glocale][0] + "');");                                // add menus      if(contextItem.hasChildNodes())  //if Firefox has already started, then replace existing childnodes, otherwise append them    {     		contextItem.replaceChild(contextMenuPopupElement,contextItem.firstChild);    		toolbarItem.replaceChild(toolbarMenuPopupElement,toolbarItem.firstChild);    		    		var toolChildren = toolMenu.childNodes;    		 	    	 	for (var i in toolChildren)    	 	{    	 		//alert(toolChildren[i].nodeName);    	 		if(toolChildren[i].nodeName == "menuitem")    	 		{    	 		//	alert("removing");    	 			toolMenu.removeChild(toolChildren[i]);    	 		}    	 		//alert(i);	    	 	}    	 	    	 	    		var cloneMenu = toolbarMenuPopupElement.cloneNode(true);  // use a clone because insertBefore moves elements and does NOT copy    		var nodeLength = cloneMenu.childNodes.length;    		for( var i = 0 ; i < nodeLength  ;i++)    		{    			//alert(cloneMenu.childNodes.length);    			toolMenu.insertBefore(cloneMenu.childNodes[0],toolMenuSeperator);    		}    		    	    		    }    else  	{  			// adds both context menu and toolbar menu     		  	contextItem.appendChild(contextMenuPopupElement);    		toolbarItem.appendChild(toolbarMenuPopupElement);     		    		    		// creates list of translation languages in the tool menu	    		    		    		var cloneMenu = toolbarMenuPopupElement.cloneNode(true);  // use a clone because insertBefore moves elements and does NOT copy    		var nodeLength = cloneMenu.childNodes.length;    		    		for( var i = 0 ; i < nodeLength  ;i++)    		{    			//alert(cloneMenu.childNodes.length);    			toolMenu.insertBefore(cloneMenu.childNodes[0],toolMenuSeperator);    			    		}            var langSelected = document.getElementById("langSelect");    		langSelected.childNodes[glocale].setAttribute("checked","true");   			//alert(langSelected.childNodes[glocale].getAttribute("checked"));    		  	}  	  	  	  	  	  	  	   }
meta: 9817	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9817/17ec1660b2be0ff5d1e12e7cd84c096c354be1f8/translate.js/buggy/branch/options/chrome/content/translate.js