PageSourceSearch

https://xn--80aaemcnyid7afgeod.xn--p1ai/.s/wid/16/simple_menu.js

js xn--80aaemcnyid7afgeod.xn--p1ai collected 2026-10-09 23:49:07 UTC 11,316 bytes, 394 lines download raw bytes

1var mnFontSize = 12;
2var mnFontColor = '#000000';
3var bgColorLinks = '#E2EBED';
4var activeSmallSquareColor = '#D60808';
5var degreesToDarkenOrLighten = 25;
6var mnWidth = 200;
7var initActiveMenuItem = -1;
8var colorSquareWidth = 2;
9var marginSquare = 1;
10var darkenOnMouseOver = 1;
11
12function init_vars(vg1,vg2,vg3,vg4,vg5,vg6){
13mnFontSize = vg1;
14mnFontColor = '#'+vg2;
15bgColorLinks = '#'+vg3;
16activeSmallSquareColor = '#'+vg4;
17mnWidth = vg5;
18darkenOnMouseOver = vg6;
19}
20
21function numberBaseConverter (number,oldBase,newBase) {
22	number = number + "";
23	number = number.toUpperCase();
24	var characters = "0123456789ABCDEF";
25	var dec = 0;
26	for (var no = 0; no <=  number.length; no++) {
27		dec += (characters.indexOf(number.charAt(no))) * (Math.pow(oldBase , (number.length - no - 1)));
28	}
29	number = "";
30	var magnitude = Math.floor((Math.log(dec))/(Math.log(newBase)));
31	for (var no = magnitude; no >= 0; no--) {
32		var amount = Math.floor(dec/Math.pow(newBase,no));
33		number = number + characters.charAt(amount); 
34		dec -= amount*(Math.pow(newBase,no));
35	}
36	if(number.length==0)number=0;
37	return number;
38}
39
40// Converts a RGB color to HSV
41function toHSV(rgbColor){
42	rgbColor = rgbColor.replace('#','');		
43	
44	red = numberBaseConverter(rgbColor.substr(0,2),16,10);
45	green = numberBaseConverter(rgbColor.substr(2,2),16,10);
46	blue = numberBaseConverter(rgbColor.substr(4,2),16,10);
47	if(red.length==0)red=0;
48	if(green.length==0)green=0;
49	if(blue.length==0)blue=0;
50	red = red/255;
51	green = green/255;
52	blue = blue/255;
53	
54	maxValue = Math.max(red,green,blue);
55	minValue = Math.min(red,green,blue);
56	
57	var hue = 0;
58	
59	if(maxValue==minValue){
60		hue = 0;
61		saturation=0;
62	}else{
63		if(red == maxValue){
64			hue = (green - blue) / (maxValue-minValue)/1;	
65		}else if(green == maxValue){
66			hue = 2 + (blue - red)/1 / (maxValue-minValue)/1;	
67		}else if(blue == maxValue){
68			hue = 4 + (red - green) / (maxValue-minValue)/1;	
69		}
70		saturation = (maxValue-minValue) / maxValue;
71	}
72	hue = hue * 60; 
73	valueBrightness = maxValue;
74	
75	if(valueBrightness/1<0.5){
76		//saturation = (maxValue - minValue) / (maxValue + minValue);
77	}
78	if(valueBrightness/1>= 0.5){
79		//saturation = (maxValue - minValue) / (2 - maxValue - minValue);
80	}	
81		
82	
83	returnArray = [hue,saturation,valueBrightness];
84	return returnArray;
85}
86
87function toRgb(hue,saturation,valueBrightness){
88	Hi = Math.floor(hue / 60);
89	if(hue==360)Hi=0;
90	f = hue/60 - Hi;
91	p = (valueBrightness * (1- saturation)).toPrecision(2);
92	q = (valueBrightness * (1 - (f * saturation))).toPrecision(2);
93	t = (valueBrightness * (1 - ((1-f)*saturation))).toPrecision(2);
94
95	switch(Hi){
96		case 0:
97			red = valueBrightness;
98			green = t;
99			blue = p;				
100			break;
101		case 1: 
102			red = q;
103			green = valueBrightness;
104			blue = p;
105			break;
106		case 2: 
107			red = q;
108			green = valueBrightness;
109			blue = t;
110			break;
111		case 3: 
112			red = p;
113			green = q;;
114			blue = valueBrightness;
115			break;
116		case 4:
117			red = t;
118			green = p;
119			blue = valueBrightness;
120			break;
121		case 5:
122			red = valueBrightness;
123			green = p;
124			blue = q;
125			break;
126	}
127	
128	if(saturation==0){
129		red = valueBrightness;
130		green = valueBrightness;
131		blue = valueBrightness;		
132	}
133	
134	red*=255;
135	green*=255;
136	blue*=255;
137
138	red = Math.round(red);
139	green = Math.round(green);
140	blue = Math.round(blue);	
141	
142	red = numberBaseConverter(red,10,16);
143	green = numberBaseConverter(green,10,16);
144	blue = numberBaseConverter(blue,10,16);
145	
146	red = red + "";
147	green = green + "";
148	blue = blue + "";
149
150	while(red.length<2){
151		red = "0" + red;
152	}	
153	while(green.length<2){
154		green = "0" + green;
155	}	
156	while(blue.length<2){
157		blue = "0" + "" + blue;
158	}
159	rgbColor = "#" + red + "" + green + "" + blue;
160	return rgbColor.toUpperCase();
161}
162
163function findColorByDegrees(rgbColor,degrees){
164	rgbColor = rgbColor.replace('#','');
165	myArray = toHSV(rgbColor);
166	myArray[0]+=degrees;
167	if(myArray[0]>=360)myArray[0]-=360;
168	if(myArray[0]<0)myArray[0]+=360;	
169	return toRgb(myArray[0],myArray[1],myArray[2]);
170}
171
172function findColorByBrightness(rgbColor,brightness){
173	
174	rgbColor = rgbColor.replace('#','');
175	myArray = toHSV(rgbColor);
176	
177	myArray[2]+=brightness/100;
178	if(myArray[2]>1)myArray[2]=1;
179	if(myArray[2]<0)myArray[2]=0;	
180	
181	myArray[1]+=brightness/100;
182	if(myArray[1]>1)myArray[1]=1;
183	if(myArray[1]<0)myArray[1]=0;		
184	
185	return toRgb(myArray[0],myArray[1],myArray[2]);	
186	
187}
188
189	var timeStepOpacitySquare = 15;	// Microseconds between each opacity change	-> Lower value = faster
190	var opacityChangePerStep = 10;	// Steps - change in opacity - on mouse out	= Higher = faster	
191	var timeStepSwitchBgColor = 10;	// Microseconds between each text background change(darken or lighten)	-> Lower value = faster
192	var bgColorStep  = 0.75;	// lower value = slower bg color fading(Usually, you will always have the value 1 or a little lower)
193								// Choose a low value if the number of degrees to darken is low.
194	
195	/************************************************************************************************************
196	* END OF USER VARIABLES
197	*
198	* Don't change anything below here 
199	*
200	************************************************************************************************************/
201	var activeMenuItem = false;
202	var activeMenuLink = false;	
203	var menuObj;
204	var brightnessLink = false; 
205	var brightnessLinkMin = false;
206	var darkenBrightnessCounter = false; // Darken or lighten - this variable is set manually
207	var startHue = false;
208	var startSat = false;
209	
210	
211	
212	function showMenuItem()
213	{
214		var hsb = toHSV(this.getAttribute('bgColorItem'));
215		if(darkenOnMouseOver==1){
216			var brightness = hsb[2] - (degreesToDarkenOrLighten/100);
217		}else{
218			var brightness = hsb[2] + (degreesToDarkenOrLighten/100);
219		}
220		if(brightness<0)brightness=0;
221		if(brightness>1)brightness=1;
222		var rgb = toRgb(hsb[0],hsb[1],brightness);
223		this.style.backgroundColor = rgb;
224		this.currentBgColorItem = rgb;
225		this.setAttribute('currentBgColorItem',rgb);
226		
227		var obj = this.parentNode.getElementsByTagName('DIV')[0];
228		obj.setAttribute('okToHide','0');
229		obj.okToHide = 0;
230		this.setAttribute('okToHide','0');
231		this.okToHide = 0;
232		obj.style.visibility = 'visible';
233		
234		obj.style.opacity = 0.98;	
235		obj.style.filter = 'alpha(opacity=98)';
236		
237
238	}
239	
240	function hideMenuItem()
241	{
242		if(this.getAttribute('initActive')=='1')return;
243		if(this.initActive=='1')return;
244		var obj = this.parentNode.getElementsByTagName('DIV')[0];
245		obj.setAttribute('okToHide','1');
246		obj.okToHide = 1;
247		this.setAttribute('okToHide','1');
248		this.okToHide = 1;
249		obj.style.visibility = 'visible';		
250		if(navigator.userAgent.indexOf('Opera')>=0){
251			obj.style.visibility = 'hidden';
252		}else{
253			progressHideSquare(obj.id,(opacityChangePerStep*-1));	
254		}		
255		progressShowHideBgColor(this.id);	
256	}
257	
258	
259	function progressShowHideBgColor(inputId)
260	{
261		
262		var obj = document.getElementById(inputId);
263		var currentBgColor = obj.getAttribute('currentBgColorItem');
264		if(obj.getAttribute('okToHide')=='0')return;
265		if(!currentBgColor)currentBgColor = obj.currentBgColorItem;
266		if(currentBgColor){
267			var hsb = toHSV(currentBgColor);
268			var brightness = hsb[2];			
269			brightness+=darkenBrightnessCounter;
270			if((brightness>brightnessLink && darkenOnMouseOver==1) || (brightness<brightnessLink && darkenOnMouseOver!=1))brightness = brightnessLink;
271			var rgb = toRgb(startHue,startSat,brightness);
272			obj.style.backgroundColor = rgb;
273			obj.currentBgColorItem = rgb;
274			obj.setAttribute('currentBgColorItem',rgb);		
275			if((hsb[2]<brightness && darkenOnMouseOver==1) || (hsb[2]>brightness && darkenOnMouseOver!=1)){
276				setTimeout('progressShowHideBgColor(\'' + inputId + '\')',timeStepSwitchBgColor);				
277			}else{
278				obj.style.backgroundColor = bgColorLinks;
279			}
280		}			
281	}	
282	
283	function progressHideSquare(inputId,step)
284	{
285		
286		var obj = document.getElementById(inputId);
287
288		if(obj.getAttribute('okToHide')=='0' && step<0)return;
289				
290		if(document.all){
291			var currentOpacity = obj.style.filter.replace(/[^\d]/g,'')/1;
292
293			if(currentOpacity>=99){
294
295			}
296			else if(currentOpacity==11){
297				obj.style.visibility='hidden';
298			}else{
299				currentOpacity = currentOpacity + step;
300				if(currentOpacity<1)currentOpacity=1;
301				if(currentOpacity>99)currentOpacity=9;
302				obj.style.filter = 'alpha(opacity=' + currentOpacity + ')';
303				setTimeout('progressHideSquare("' + inputId + '",' + (step) + ')',timeStepOpacitySquare);
304			}				
305		}else{
306			step = step / 100;
307			var currentOpacity = obj.style.opacity/1;
308
309			if(currentOpacity>=0.99){
310
311			}
312			else if(currentOpacity==0.01){
313				obj.style.visibility='hidden';
314			}else{
315				currentOpacity = currentOpacity + step;
316
317				if(currentOpacity<0.01)currentOpacity=0.01;
318				if(currentOpacity>0.99)currentOpacity=0.99;
319				obj.style.opacity = currentOpacity;
320				setTimeout('progressHideSquare("' + inputId + '",' + (step*100) + ')',timeStepOpacitySquare);
321			}	
322		}		
323	}
324	
325	
326	function dhtmlgoodies_initMenu(mname)
327	{
328		menuObj = document.getElementById(mname);
329		var hsbArray = toHSV(bgColorLinks);
330		brightnessLink = hsbArray[2];
331		startHue = hsbArray[0];
332		startSat = hsbArray[1];
333		if(darkenOnMouseOver==1){
334			brightnessLinkMin = Math.max(hsbArray[2] - (degreesToDarkenOrLighten/100),0);
335			darkenBrightnessCounter = bgColorStep/100;
336		}else{
337			brightnessLinkMin = Math.min(hsbArray[2] + (degreesToDarkenOrLighten/100),1);
338			darkenBrightnessCounter = (bgColorStep/100)*-1;
339		}
340		var listItems = menuObj.getElementsByTagName('LI');
341		for(var no=0;no<listItems.length;no++){
342			listItems[no].id = 'lI' + mname + no;	
343	
344			var menuLink = listItems[no].getElementsByTagName('A')[0];
345			var height = menuLink.offsetHeight;	
346			menuLink.style.display='block';
347			menuLink.style.height=height + 'px';
348			menuLink.style.lineHeight=height + 'px';
349			menuLink.onmouseover = showMenuItem;		
350			menuLink.onmouseout = hideMenuItem;		
351			menuLink.style.backgroundColor = bgColorLinks;
352			menuLink.setAttribute('bgColorItem',bgColorLinks);
353			menuLink.bgColorItem = bgColorLinks;
354			menuLink.setAttribute('currentBgColorItem',bgColorLinks);
355			menuLink.currentBgColorItem = bgColorLinks;
356			menuLink.id = 'lL' + mname + no;
357				
358			var colorDiv = document.createElement('DIV');
359			colorDiv.innerHTML = '<span><\/span>';
360			colorDiv.style.height = height + 'px';
361			colorDiv.style.width = colorSquareWidth + 'px';
362			colorDiv.style.backgroundColor = activeSmallSquareColor;
363			colorDiv.style.marginRight = marginSquare + 'px';
364			colorDiv.style.visibility = 'hidden'			
365			colorDiv.id = 'cS' + mname + no;
366			colorDiv.style.opacity = 0.99;	// Not possible to use 1 because of JS flickering in Firefox
367			colorDiv.style.filter = 'alpha(opacity=100)';
368			
369			if(initActiveMenuItem==no){
370				colorDiv.style.visibility = 'visible';
371				menuLink.style.backgroundColor = toRgb(startHue,startSat,brightnessLinkMin);
372				menuLink.initActive = '1';
373				menuLink.setAttribute('initActive','1');
374				
375			}
376			
377			listItems[no].appendChild(colorDiv);			
378			listItems[no].appendChild(menuLink);
379
380			var clearDiv = document.createElement('DIV');
381			clearDiv.style.clear='both';
382			listItems[no].appendChild(clearDiv);
383						
384			var currentWidth = (listItems[no].offsetWidth - colorDiv.offsetWidth - marginSquare);
385			menuLink.style.width =  currentWidth + 'px';
386			while(listItems[no].offsetHeight>=(menuLink.offsetHeight*2)){		
387				currentWidth--;	
388				menuLink.style.width =  currentWidth + 'px';
389				
390			}
391		}		
392	}
393
394	

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.