All pastes #634234 Raw Edit

heavybox

public text v1 · immutable
#634234 ·published 2007-07-26 08:47 UTC
rendered paste body
/*
	HEAVYBOX - MODIFIED v1.0.4
	--------
	Modification for proxy websites. Originally for Colin Palmer, funkyproxy.com
	No iframe, just a div. Meant for loading Advanced Options in.
	--------
	Copyright ©2007 Nick Berlette, Riuv International
	Developed by Nick Berlette
	
	Parent website - http://www.heading1.com
	More information and guide - http://www.heading1.com/exploration/heavybox/
	
	LEGAL NOTICE:
	Go ahead and use it, and feel free to share it. But PLEASE do not claim any of my code as your own. Thanks :)
	
	------------------------------------------------------
	
	------------------
	CONFIGURATIONS, FEEL FREE TO EDIT THESE.
	------------------
*/
var loading = true; // Show "Loading..." page before displaying actual page's contents? true means yes, false means no.
var position = 'absolute'; // Choose between fixed (stays put) or absolute (scrolls with the content)
var top = '150'; // Distance from the top of the page (in pixels)
var left = '150'; // Distance from the left of the page (in pixels)
/*
	------------------
	CONFIGURATIONS DONE, DO NOT EDIT BELOW THIS LINE
	------------------
*/

function $ (element) {
	return document.getElementById(element);	
}
function $$ (tag) {
	return document.getElementsByTagName(tag);	
}
function getElementsByClassName (className) {
	children = document.getElementsByTagName('*') || document.all;
	elements = new Array();  
	for (i = 0; i < children.length; i++) {
		child = children[i];
		classNames = child.className.split(' ');
		for (var x = 0; x < classNames.length; x++) {
			if (classNames[x] == className) {
				elements.push(child);
				break;
			}
		}
	}
	return elements;
}
function change_opacity (element, opacity) {
	object = $(element);
	object.style.filter = 'alpha(opacity=' + opacity + ')';
	object.style.MozOpacity = opacity / 100;
	object.style.KhtmlOpacity = opacity / 100;
	object.opacity = opacity / 100;	
}
function fade_out (id) {
	for (i = 0; i <= 100; i++) {
		x = 100 - i;
		setTimeout('change_opacity(\'' + id + '\', ' + x + ')', i+100);
	}	
}
function fade_in (id) {
	for (i = 0; i <= 100; i++) {
		setTimeout('change_opacity(\'' + id + '\', ' + i + ')', i+100);
	}	
}
function heavybox_deploy (contents) {
	if(loading) {
		$('loader_frame').innerHTML = '<img src="img/loading.gif" alt="" border="0" /> Loading&hellip;';
	}
	change_opacity('heavybox', 0);
	$('heavybox').style.visibility = 'visible';
	setTimeout("fade_in('heavybox')", 400);
	setTimeout("$('loader_frame').innerHTML = '" + contents + "'", 2000);
}
function heavybox_withdraw () {
	fade_out('heavybox');
	setTimeout("$('heavybox').style.visibility = 'hidden'", 1500);
	withdraw = function () {
		if(loading) {
			$('loader_frame').innerHTML = '<img src="img/loading.gif" alt="" border="0" /> Loading&hellip;';	
		}
		$('heavybox').style.top = top + 'px';
		$('heavybox').style.left = left + 'px';	
	}
	setTimeout('withdraw()', 1600);
}
function heavybox_write () {
	position = position ? position : 'fixed';
	document.write('<div id="heavybox" style="position: ' + position + '; top: ' + top + 'px; left: ' + left + 'px;"><div id="dragger" class="top" onmousedown="drag_object($(\'heavybox\'), event);">');
	document.write('<a href="#" onclick="heavybox_withdraw(); return false;" class="right"><img src="img/close.gif" alt="X" border="0" /></a>');
	document.write('</div><div class="loader">');
	document.write('<div class="page" id="loader_frame" style="width: 300px; height: 215px; overflow: auto;"></div>');
	document.write('</div></div>');
}
function agent (string) { 
	return (Math.max(navigator.userAgent.toLowerCase().indexOf(string), 0)); 
}
function coordinates (e, flip) {
	if(flip) {
		if(agent('msie')) {
			return event.clientY + document.body.scrollTop;
		} else {
			return e.pageY;	
		}
	} else {
		if(agent('msie')) {
			return event.clientX + document.body.scrollTop;	
		} else {
			return e.pageX;	
		}
	}
}
function drag_object (element, e) {
	function drag (e) { 
		if(dragging) { 
			element.style.top = (object_x = coordinates(e, 1) + start_y - mouse_y + 'px'); 
			element.style.left = (object_y = coordinates(e) + start_x - mouse_x + 'px'); 
		} 
	}
	var start_x = parseInt(element.style.left), start_y = parseInt(element.style.top);
	var mouse_x  = coordinates(e), mouse_y = coordinates(e, 1);
	var object_x, object_y;
	var dragging = true;
	document.onmousemove = drag;
	document.onmouseup = function () {
		dragging = false;
	}
}