All pastes #829362 Raw Edit

Mine

public javascript v1 · immutable
#829362 ·published 2007-12-23 02:43 UTC
rendered paste body
var ItemView = null;//ItemProto Definition: entry,name,description,class,subclass,...var ItemProto = [];var buttonPosition = new Array(2);buttonPosition['buttoninfo'] = new Array(2);buttonPosition['buttoninfo']['top'] = 0;buttonPosition['buttoninfo']['left'] = 0;buttonPosition['buttonbuy'] = new Array(2);buttonPosition['buttonbuy']['top'] = 0;buttonPosition['buttonbuy']['left'] = 0;var currentButton = new Array();function CreateItems(){	var _tr = [];	var _th = [];	for (itr in ItemProto) 	{		_table = tvWrapper.appendChild(tvDocument.createElement('table'));		_table.setAttribute("style", "float:left");		_table.style.padding = "5px 0px 0px 5px";		_table.cellSpacing = "0";		_table.cellPadding = "0";				_tbody = _table.appendChild(tvDocument.createElement('tbody'));		_tr[1] =_tbody.appendChild(tvDocument.createElement('tr'));				_td = _tr[1].appendChild(tvDocument.createElement('td'));		_td.id = 'i_main';		_td.style.backgroundImage = "url('http://realms.aleajecta.com/dev/ShopEngine/images/Bubble.png')";		_td.style.padding = '20px 10px 10px 20px';				_ImgShowCase = _td.appendChild(tvDocument.createElement('img'));		_ImgShowCase.name = ItemProto[itr]['entry'];		_ImgShowCase.className = 'showcase';		_ImgShowCase.src = 'http://realms.aleajecta.com/dev/ShopEngine/images/thumbs/' + ItemProto[itr]['photo'];		_ImgShowCase.style.position = 'relative';		_ImgShowCase.style.marginRight = '4px';		_ImgShowCase.style.height = '125px';		_ImgShowCase.style.zIndex = '999';		/*_ImgShowCase.onmouseover = function()		{			MouseOverBorder(this, 'onmouseout');			return true;		};*/		_ImgShowCase.onmouseup = function()		{			AddBubble(this);			DelItemButton();		};		_ImgShowCase.onmousedown = function()		{			AddItemButton(this);			return false;		};				_ImgButtonInfo = _td.appendChild(tvDocument.createElement('img'));		_ImgButtonInfo.name = ItemProto[itr]['entry'];		_ImgButtonInfo.className = "buttoninfo";		_ImgButtonInfo.src = 'http://realms.aleajecta.com/dev/ShopEngine/images/Info.png';		_ImgButtonInfo.style.position = 'absolute';		_ImgButtonInfo.style.display = 'none';		_ImgButtonInfo.style.zIndex = '1000';		_ImgButtonInfo.onmouseover = function()		{			MouseOverBorder(this, 'onmouseout');		};		_ImgButtonInfo.onmouseup = function()		{			AddBubble(this);			DelItemButton();		};				_ImgButtonBuy = _td.appendChild(tvDocument.createElement('img'));		_ImgButtonBuy.name = ItemProto[itr]['entry'];		_ImgButtonBuy.className = 'buttonbuy';		_ImgButtonBuy.src = 'http://realms.aleajecta.com/dev/ShopEngine/images/Buy.png';		_ImgButtonBuy.style.position = 'absolute';		_ImgButtonBuy.style.display = 'none';		_ImgButtonBuy.style.zIndex = '1000';		_ImgButtonInfo.onmouseover = function()		{			MouseOverBorder(this, 'onmouseout');		};				_th[1] = _tr[1].appendChild(tvDocument.createElement('th'));		_th[1].id = 'i_first';		_th[1].style.backgroundImage = "url('http://realms.aleajecta.com/dev/ShopEngine/images/Bubble.png')";		_th[1].style.backgroundPosition = 'top right';		_th[1].style.position = 'relative';		_th[1].style.width = '5px';		_th[1].style.height = '8px';				_tr[2] = _tbody.appendChild(tvDocument.createElement('tr'));				_th[2] = _tr[2].appendChild(tvDocument.createElement('th'));		_th[2].id = 'i_second';		_th[2].style.backgroundImage = "url('http://realms.aleajecta.com/dev/ShopEngine/images/Bubble.png')";		_th[2].style.backgroundPosition = 'bottom left';		_th[2].style.position = 'relative';		_th[2].style.width = '5px';		_th[2].style.height = '8px';				_th[3] = _tr[2].appendChild(tvDocument.createElement('th'));		_th[3].id = 'i_third';		_th[3].style.backgroundImage = "url('http://realms.aleajecta.com/dev/ShopEngine/images/Bubble.png')";		_th[3].style.backgroundPosition = 'bottom right';		_th[3].style.position = 'relative';		_th[3].style.width = '5px';		_th[3].style.height = '8px';	}	return true;}function LoadItemsProto(){	req.onreadystatechange = function() 	{		if (req.readyState == 4) 		{			var data = req.responseJS;			if (!data) 			{				//Error Output.. For TV viewer. :)				DocumentBlur(true);				alert(req.responseText);			}			else			{				for(var itr in req.responseJS)					ItemProto[ req.responseJS[itr]['entry'] ] = req.responseJS[itr];				eventSystem.addEvent('CreateItems();DocumentBlur(true);',0);							}			req.onreadystatechange  = null;		}	};	DocumentBlur(false);    req.open('GET', 'http://realms.aleajecta.com/dev/ShopEngine/index.php?JsRequest&QuerySql&type=select&table=item_template&colum=entry,name,maker,sellPrice,photo&order=name&limit=200', true);    req.send({ });}function LoadItemDescription(entry){	//alert(GetElementById('tvFrame').contentDocument.getElementById('itemDescription'));	if(ItemProto[entry]['description'])	{		if(target = GetElementById('tvFrame').contentDocument.getElementById('itemDescription'))			target.innerHTML = ItemProto[entry]['description'].wordWrap(78,'<BR />',0);		return;	}	req.onreadystatechange = function() 	{		if (req.readyState == 4) 		{			if (!req.responseJS) 			{				//Error Output.. For TV viewer. :)				alert(req.responseText);			}			else			{				//alert(req.responseJS);				ItemProto[entry]['description'] = req.responseJS[0]['description'] ? req.responseJS[0]['description'] : 'Description For This Item Is Unavailable';								if(target = GetElementById('tvFrame').contentDocument.getElementById('itemDescription'))					target.innerHTML = ItemProto[entry]['description'].wordWrap(78,'<BR />',0);			}			req.onreadystatechange  = null;		}	};    req.open('GET', 'http://realms.aleajecta.com/dev/ShopEngine/index.php?JsRequest&QuerySql&type=select&table=item_template&colum=description&where=entry:equal:'+entry, true);	req.send({ });//'+ItemProto[owner.id]['description'].wordWrap(78,'<BR />',0)+'}function MakeItemButtonPosition(owner,childClassName){	//_current = _current.parentNode	for (var itr in owner.childNodes) 	{		if(!owner.childNodes[itr].className)			continue;		if (owner.childNodes[itr].className == 'showcase') 		{			if (childClassName == 'buttoninfo') 			{				buttonPosition[childClassName]['top'] = owner.childNodes[itr].offsetTop + owner.childNodes[itr].clientHeight - 40;				buttonPosition[childClassName]['left'] = owner.childNodes[itr].offsetLeft + 5;			}			else if(childClassName == 'buttonbuy')			{				buttonPosition[childClassName]['top'] = owner.childNodes[itr].offsetTop + owner.childNodes[itr].clientHeight - 50;				buttonPosition[childClassName]['left'] = owner.childNodes[itr].offsetLeft + owner.childNodes[itr].clientWidth - 32;			}		}	}	}function AddItemButton(owner){	if(currentButton.length)		DelItemButton();	owner = owner.parentNode;	for(var i in owner.childNodes)	{		if(!owner.childNodes[i].className)			continue;				//alert(_current.childNodes[i].id);		if (owner.childNodes[i].className == 'buttoninfo') 		{			MakeItemButtonPosition(owner,owner.childNodes[i].className);			owner.childNodes[i].style.top = buttonPosition[owner.childNodes[i].className]['top'];			owner.childNodes[i].style.left = buttonPosition[owner.childNodes[i].className]['left'];			owner.childNodes[i].style.display = 'block';			currentButton.push(owner.childNodes[i]);		}		if (owner.childNodes[i].className == 'buttonbuy') 		{			MakeItemButtonPosition(owner,owner.childNodes[i].className);			owner.childNodes[i].style.top = buttonPosition[owner.childNodes[i].className]['top'];			owner.childNodes[i].style.left = buttonPosition[owner.childNodes[i].className]['left'];			owner.childNodes[i].style.display = 'block';			currentButton.push(owner.childNodes[i]);		}	}}function DelItemButton(){	while (currentButton.length) 	{		currentButton.pop().style.display = 'none';	}}