Blame Artworks/Webenv/Punbb/style/imports/minmax.js

Alain Reguera Delgado 46de3c
// minmax.js - written by Andrew Clover <and@doxdesk.com>
Alain Reguera Delgado 46de3c
// Adapted for PunBB by Rickard Andersson and Paul Sullivan
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
/*@cc_on
Alain Reguera Delgado 46de3c
@if (@_win32 && @_jscript_version>4)
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
var minmax_elements;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function minmax_bind(el) {
Alain Reguera Delgado 46de3c
	var em, ms;
Alain Reguera Delgado 46de3c
	var st= el.style, cs= el.currentStyle;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	if (minmax_elements==window.undefined) {
Alain Reguera Delgado 46de3c
		if (!document.body || !document.body.currentStyle) return;
Alain Reguera Delgado 46de3c
		minmax_elements= new Array();
Alain Reguera Delgado 46de3c
		window.attachEvent('onresize', minmax_delayout);
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	if (cs['max-width'])
Alain Reguera Delgado 46de3c
		st['maxWidth']= cs['max-width'];
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	ms= cs['maxWidth'];
Alain Reguera Delgado 46de3c
	if (ms && ms!='auto' && ms!='none' && ms!='0' && ms!='') {
Alain Reguera Delgado 46de3c
		st.minmaxWidth= cs.width;
Alain Reguera Delgado 46de3c
		minmax_elements[minmax_elements.length]= el;
Alain Reguera Delgado 46de3c
		minmax_delayout();
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
var minmax_delaying= false;
Alain Reguera Delgado 46de3c
function minmax_delayout() {
Alain Reguera Delgado 46de3c
	if (minmax_delaying) return;
Alain Reguera Delgado 46de3c
	minmax_delaying= true;
Alain Reguera Delgado 46de3c
	window.setTimeout(minmax_layout, 0);
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function minmax_stopdelaying() {
Alain Reguera Delgado 46de3c
	minmax_delaying= false;
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function minmax_layout() {
Alain Reguera Delgado 46de3c
	window.setTimeout(minmax_stopdelaying, 100);
Alain Reguera Delgado 46de3c
	var i, el, st, cs, optimal, inrange;
Alain Reguera Delgado 46de3c
	for (i= minmax_elements.length; i-->0;) {
Alain Reguera Delgado 46de3c
		el= minmax_elements[i]; st= el.style; cs= el.currentStyle;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		st.width= st.minmaxWidth; optimal= el.offsetWidth;
Alain Reguera Delgado 46de3c
		inrange= true;
Alain Reguera Delgado 46de3c
		if (inrange && cs.minWidth && cs.minWidth!='0' && cs.minWidth!='auto' && cs.minWidth!='') {
Alain Reguera Delgado 46de3c
			st.width= cs.minWidth;
Alain Reguera Delgado 46de3c
			inrange= (el.offsetWidth
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
		if (inrange && cs.maxWidth && cs.maxWidth!='none' && cs.maxWidth!='auto' && cs.maxWidth!='') {
Alain Reguera Delgado 46de3c
			st.width= cs.maxWidth;
Alain Reguera Delgado 46de3c
			inrange= (el.offsetWidth>optimal);
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
		if (inrange) st.width= st.minmaxWidth;
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
var minmax_SCANDELAY= 500;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function minmax_scan() {
Alain Reguera Delgado 46de3c
	var el;
Alain Reguera Delgado 46de3c
	for (var i= 0; i
Alain Reguera Delgado 46de3c
		el= document.all[i];
Alain Reguera Delgado 46de3c
		if (!el.minmax_bound) {
Alain Reguera Delgado 46de3c
			el.minmax_bound= true;
Alain Reguera Delgado 46de3c
			minmax_bind(el);
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
var minmax_scanner;
Alain Reguera Delgado 46de3c
function minmax_stop() {
Alain Reguera Delgado 46de3c
	window.clearInterval(minmax_scanner);
Alain Reguera Delgado 46de3c
	minmax_scan();
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
minmax_scan();
Alain Reguera Delgado 46de3c
minmax_scanner= window.setInterval(minmax_scan, minmax_SCANDELAY);
Alain Reguera Delgado 46de3c
window.attachEvent('onload', minmax_stop);
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
@end @*/