PageSourceSearch

https://leonc.fr/2bgal/style/defaultxhtml/minmax.js

js leonc.fr collected 2026-10-02 17:59:42 UTC 2,108 bytes, 168 lines download raw bytes

1// minmax.js - written by Andrew Clover <[email protected]>
2
3// Adapted for PunBB by Rickard Andersson and Paul Sullivan
4
5
6
7/*@cc_on
8
9@if (@_win32 && @_jscript_version>4)
10
11
12
13var minmax_elements;
14
15
16
17function minmax_bind(el) {
18
19	var em, ms;
20
21	var st= el.style, cs= el.currentStyle;
22
23
24
25	if (minmax_elements==window.undefined) {
26
27		if (!document.body || !document.body.currentStyle) return;
28
29		minmax_elements= new Array();
30
31		window.attachEvent('onresize', minmax_delayout);
32
33	}
34
35
36
37	if (cs['max-width'])
38
39		st['maxWidth']= cs['max-width'];
40
41
42
43	ms= cs['maxWidth'];
44
45	if (ms && ms!='auto' && ms!='none' && ms!='0' && ms!='') {
46
47		st.minmaxWidth= cs.width;
48
49		minmax_elements[minmax_elements.length]= el;
50
51		minmax_delayout();
52
53	}
54
55}
56
57
58
59var minmax_delaying= false;
60
61function minmax_delayout() {
62
63	if (minmax_delaying) return;
64
65	minmax_delaying= true;
66
67	window.setTimeout(minmax_layout, 0);
68
69}
70
71
72
73function minmax_stopdelaying() {
74
75	minmax_delaying= false;
76
77}
78
79
80
81function minmax_layout() {
82
83	window.setTimeout(minmax_stopdelaying, 100);
84
85	var i, el, st, cs, optimal, inrange;
86
87	for (i= minmax_elements.length; i-->0;) {
88
89		el= minmax_elements[i]; st= el.style; cs= el.currentStyle;
90
91
92
93		st.width= st.minmaxWidth; optimal= el.offsetWidth;
94
95		inrange= true;
96
97		if (inrange && cs.minWidth && cs.minWidth!='0' && cs.minWidth!='auto' && cs.minWidth!='') {
98
99			st.width= cs.minWidth;
100
101			inrange= (el.offsetWidth<optimal);
102
103		}
104
105		if (inrange && cs.maxWidth && cs.maxWidth!='none' && cs.maxWidth!='auto' && cs.maxWidth!='') {
106
107			st.width= cs.maxWidth;
108
109			inrange= (el.offsetWidth>optimal);
110
111		}
112
113		if (inrange) st.width= st.minmaxWidth;
114
115	}
116
117}
118
119
120
121var minmax_SCANDELAY= 500;
122
123
124
125function minmax_scan() {
126
127	var el;
128
129	for (var i= 0; i<document.all.length; i++) {
130
131		el= document.all[i];
132
133		if (!el.minmax_bound) {
134
135			el.minmax_bound= true;
136
137			minmax_bind(el);
138
139		}
140
141	}
142
143}
144
145
146
147var minmax_scanner;
148
149function minmax_stop() {
150
151	window.clearInterval(minmax_scanner);
152
153	minmax_scan();
154
155}
156
157
158
159minmax_scan();
160
161minmax_scanner= window.setInterval(minmax_scan, minmax_SCANDELAY);
162
163window.attachEvent('onload', minmax_stop);
164
165
166
167@end @*/
168

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.