Blame Identity/Webenv/App/Punbb/style/imports/minmax.js

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