rem: textarea.buttonEvents[buttonArray[buttonIndex].keynum] = function() { buttonArray[buttonIndex].action(buttonArray[buttonIndex].tag, textarea); 
add: textarea.buttonEvents[buttonArray[buttonIndex].keynum] = new Object(); textarea.buttonEvents[buttonArray[buttonIndex].keynum].tag = buttonArray[buttonIndex].tag; textarea.buttonEvents[buttonArray[buttonIndex].keynum].action = buttonArray[buttonIndex].action; textarea.buttonEvents[buttonArray[buttonIndex].keynum].runme = function() { if (this.action == 'bbCode') { bbCode(this.tag, textarea); } else if (this.action == 'bbcURL') { bbcURL(this.tag, textarea); } 
context: function initTextarea(textarea) {	textarea.buttonEvents = new Array();			textarea.buildButtons = function(buttonArray) {		// Builds the buttons before the text area based on the information in the array		var bbCodeButtons = document.createElement("div");		bbCodeButtons.id = 'qsf_bbcode_buttons';				var oldButtonIndex = 0;				for (var buttonIndex in buttonArray) {			// Check if we want to add a break			if (buttonArray[buttonIndex].action == 'bbcFont' && 					buttonArray[oldButtonIndex].action != 'bbcFont') {				bbCodeButtons.appendChild(document.createElement("br"));					}						var button = null;					if (buttonArray[buttonIndex].action == 'bbcFont') {				button = createSelect(buttonArray[buttonIndex], textarea);			} else {				button = createButton(buttonArray[buttonIndex], textarea);			}			bbCodeButtons.appendChild(button);						// If there is a keynum attached then add that to our events array			if (buttonArray[buttonIndex].keynum) {				textarea.buttonEvents[buttonArray[buttonIndex].keynum] = function() {					buttonArray[buttonIndex].action(buttonArray[buttonIndex].tag, textarea);				};			}						oldButtonIndex = buttonIndex;		}		bbCodeButtons.appendChild(document.createElement("br"));				textarea.parentNode.insertBefore(bbCodeButtons, textarea);	};		textarea.createSmilies = function(smiliesData, headingLabel) {		var clickableArea = document.getElementById('clickablesmilies');			if (!clickableArea) clickableArea = document.getElementById('quicksmilies');		if (clickableArea) {			var smilesDiv = document.createElement("div");							var list = document.createElement("ul");						for (var smileItem in smiliesData) {				var listItem = document.createElement("li");				var itemAnchor = document.createElement("a");				var itemImg = document.createElement("img");								itemAnchor.href = "#";				itemAnchor.smile = smileItem;				itemAnchor.onclick = function() {					insertSmiley(this.smile, textarea);					return false;				};								itemImg.src = smiliesData[smileItem];				itemImg.alt = smileItem;								itemAnchor.appendChild(itemImg);				listItem.appendChild(itemAnchor);				list.appendChild(listItem);			}						smilesDiv.appendChild(list);						var heading = document.createElement("strong");			var headingText = document.createTextNode(headingLabel);			heading.appendChild(headingText);			smilesDiv.insertBefore(heading, list);						clickableArea.appendChild(smilesDiv);						if (typeof fnLoadPngs != 'undefined') {				fnLoadPngs(); // IE needs extra processing on PNGs			}		}	};		var handler = function(text) {		// Main data fetching handler		var responseData = text.parseJSON();					if (responseData.length == 0) return;				// copy across language variables		textarea.jsdata_address = responseData['lang']['jsdata_address'];		textarea.jsdata_detail = responseData['lang']['jsdata_detail'];		textarea.jsdata_url = responseData['lang']['jsdata_url'];				// Create buttons using button data		textarea.buildButtons(responseData['buttons']);				// Create smilies using clickable smilies data		textarea.createSmilies(responseData['clickablesmilies'], responseData['lang']['jsdata_smiles']);	};			textarea.dataFetcher = getHTTPObject(handler);	textarea.dataFetcher.requestData('jsdata', 'data', 'bbcode');	textarea.caretPos = false;	textarea.onfocus = function() {		// Attach events to textarea but only after it has gotten the focus once				textarea.onclick= function() {			if (textarea.createTextRange) {				textarea.caretPos = document.selection.createRange().duplicate();			}		};				textarea.onkeyup = textarea.onclick;		textarea.onmouseout = textarea.onclick;		textarea.onfocus = textarea.onclick;	}	// Keyboard shortcuts	textarea.onkeydown = function(e) {		// Check if they are trying to move to another cell!		var keynum;				if(window.event) // IE		{			keynum = window.event.keyCode;			if (!(window.event.modifiers & window.event.CONTROL_MASK)) return true;		}		else if(e.which) // Netscape/Firefox/Opera		{			keynum = e.which;			if (!e.ctrlKey) return true;		}				// Handles a CTRL+keynum event to see if there's a control to use for it		for (var eventNum in textarea.buttonEvents) {			if (eventNum == keynum) {				textarea.buttonEvents[eventNum]();				return false;			}		}		return true;	};}
meta: 7771	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/7771/7fdfcb9e43b9eefbdf28615c72105456e5d5a38f/postboxplain.js/clean/trunk/qsf/javascript/postboxplain.js