All pastes #937852 Raw Edit

Woopra.com woopra_chat.js Source

public javascript v1 · immutable
·published 2008-03-11 07:37 UTC
rendered paste body
var chatMouseX = -1;var chatWindowX = 0;var chatMouseY = -1;var chatWindowY = 0;var minimized = 0;function _MouseDownPerformed(a){	chatMouseX = -1;	chatMouseY = -1;	var b = (window.event) ? a.srcElement : a.target;	if(b != document.getElementById("wooBar")){		return;	}	if(window.attachEvent){		chatMouseX = a.clientX;		chatMouseY = a.clientY;	} else {		chatMouseX = a.pageX;		chatMouseY = a.pageY;	}	chatWindowX = document.getElementById("wooFloatingChat").offsetLeft;	chatWindowY = document.getElementById("wooFloatingChat").offsetTop;}function _MouseOutPerformed(a){	var b = (window.event) ? a.srcElement : a.target;	chatMouseX = -1;	chatMouseY = -1;	if(b != document.getElementById("wooBar")){		return;	}}function _MouseMovePerformed(a){	var b = (window.event) ? a.srcElement : a.target;	if(b != document.getElementById("wooBar")){}	if(chatMouseX == -1 || chatMouseY == -1){		return;	}	var c = 0;	var d = 0;	if(window.attachEvent){		c = a.clientX - chatMouseX;		d = a.clientY - chatMouseY;	} else {		c = a.pageX - chatMouseX;		d = a.pageY - chatMouseY;	}	document.getElementById("wooFloatingChat").style.left = (chatWindowX + c) + "px";	document.getElementById("wooFloatingChat").style.top = (chatWindowY + d) + "px";}function _Close(a){	chat_inited = 0;	var f = document.getElementById('woo_chat_frame');	f.src = "about:blank";	f.style.display = "none";	var b = document.getElementById('wooFloatingChat');	b.style.display = "none";}function _Minimize(a){	var b = (window.event) ? a.srcElement : a.target;	minimized = 1 - minimized;	var c = document.getElementById('wooFloatingChat');	var d = document.getElementById('woo_chat_frame');	if(minimized == 1){		b.style.backgroundImage = 'url(' + woopra_static_host + '/images/min.png)';		c.style.height = '20px';		d.style.height = '0px';	} else {		b.style.backgroundImage = 'url(' + woopra_static_host + '/images/plus.png)';		c.style.height = '320px';		d.style.height = '300px';	}}function _DoInitChat(){	chat = document.createElement('div');	chat.id = 'wooFloatingChat';	chat.style.position = 'fixed';	chat.style.right = '0';	chat.style.bottom = '0';	chat.style.width = '300px';	chat.style.height = '320px';	chat.style.border = 'none';	bar = document.createElement('div');	bar.id = 'wooBar';	bar.style.background = '#2F5CB0';	bar.style.top = '0';	bar.style.left = '0';	bar.style.width = '300px';	bar.style.height = '20px';	bar.style.backgroundImage = 'url(' + woopra_static_host + '/images/bar.png)';	cmin = document.createElement('div');	cmin.style.overflow = 'hidden';	cmin.style.cursor = 'pointer';	cmin.style.position = 'absolute';	cmin.style.right = '22px';	cmin.style.width = '16px';	cmin.style.height = '16px';	cmin.style.top = '1px';	cmin.style.backgroundImage = 'url(' + woopra_static_host + '/images/plus.png)';	cclose = document.createElement('div');	cclose.style.overflow = 'hidden';	cclose.style.position = 'absolute';	cclose.style.cursor = 'pointer';	cclose.style.right = '2px';	cclose.style.width = '16px';	cclose.style.height = '16px';	cclose.style.top = '1px';	cclose.style.backgroundImage = 'url(' + woopra_static_host + '/images/close.png)';	if(window.attachEvent){		cclose.attachEvent('onclick',_Close);		cmin.attachEvent('onclick',_Minimize);	} else {		cclose.addEventListener('click',_Close,false);		cmin.addEventListener('click',_Minimize,false);	}	if(window.attachEvent){		document.getElementsByTagName('html')[0].style.height = '100%';		document.getElementsByTagName('html')[0].style.overflow = 'hidden';		document.body.style.margin = '0';		document.body.style.height = '100%';		document.body.style.overflow = 'auto';		chat.style.position = 'absolute';		chat.style.right = '18';	}	imframe = document.createElement('iframe');	imframe.id = 'woo_chat_frame';	imframe.src = woopra_engine_host + '/serverfiles/chatframe.html?' + _GetCookie() + '&' + window.location.host;	imframe.width = '300px';	imframe.height = '300px';	imframe.style.top = '20px';	imframe.style.border = 'none';	imframe.style.backgroundColor = '#2F5CB0';	bar.appendChild(cclose);	bar.appendChild(cmin);	chat.appendChild(bar);	chat.appendChild(imframe);	document.body.appendChild(chat);}if(window.attachEvent){	document.attachEvent('onmousedown',_MouseDownPerformed);	document.attachEvent('onmouseup',_MouseOutPerformed);	document.attachEvent('onmousemove',_MouseMovePerformed);}if(window.addEventListener){	document.addEventListener('mousedown',_MouseDownPerformed,false);	document.addEventListener('mouseup',_MouseOutPerformed,false);	document.addEventListener('mousemove',_MouseMovePerformed,false);}_DoInitChat();