PageSourceSearch

https://dv8house.com/rw_common/themes/split/js/RGBAColor.js

js dv8house.com collected 2026-09-24 13:57:22 UTC 2,515 bytes, 99 lines download raw bytes

1var IS_RGBA_SUPPORTED = (function(){
2	var value = 'rgba(1,1,1,0.5)',
3	el = document.createElement('p'),
4	result = false;
5	try {
6	el.style.color = value;
7	result = /^rgba/.test(el.style.color);
8	} catch(e) { }
9	el = null;
10	return result;
11	})();
12
13function getComputedCSS(_elem, _style) {
14
15	var computedStyle;
16	if (typeof _elem.currentStyle != 'undefined') {
17		var camelStyle=_style.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');});
18		computedStyle = _elem.currentStyle[camelStyle];
19		//alert('Old currentStyle access. CamelStyle: '+camelStyle);
20	}
21	else {
22		//alert('getComputedStyle is supported. Getting it');
23		computedStyle = window.getComputedStyle(_elem, null).getPropertyValue(_style);
24	}
25
26	return computedStyle;
27}
28
29
30
31function getRGBValue() {
32	var theElement=document.getElementById("standard");
33	var rgbVal=getComputedCSS(theElement,'background-color');
34	var color=new RGBColor(rgbVal);
35	
36	if (color.ok) {
37		return color.toRGB();
38	}
39	
40	else {
41		//alert("Can't process color");
42	}
43}
44
45
46function HexToAHex(hexcolor, alpha) {
47	//alpha=parseFloat(alpha);
48	////alert('Alpha is: '+alpha);
49	if (hexcolor.charAt(0) == '#') { // remove # if any
50		hexcolor = hexcolor.substr(1,6);
51	}
52	//alpha=1;
53	
54	var hexAlpha= Math.round((alpha*255)).toString(16);
55	var aHexColor="#"+hexAlpha+hexcolor;
56	return aHexColor;
57}
58
59function RGBAToAHex(rgba) {
60	rgba=rgba.replace(/\s/g,"");
61	rgb=rgba.replace(/rgba/,"rgb");
62	rgbArray=rgb.split(',');
63	rgb=rgbArray[0]+","+rgbArray[1]+","+rgbArray[2]+")";
64	var alphaVal=rgbArray[3];
65	alphaVal=alphaVal.replace(")","");
66	var color=new RGBColor(rgb);
67	var theHex=color.toHex();
68	var theAHex=HexToAHex(theHex,alphaVal);
69	return theAHex;
70}
71
72function fixIEAlpha(element,bgcolor) {
73	if (!element.style.backgroundImage) {
74		element.style.backgroundColor='transparent';
75		element.style.zoom='1';
76		element.style.filter= 'progid:DXImageTransform.Microsoft.gradient(startColorstr='+bgcolor+',endColorstr='+bgcolor+')';
77		}
78}
79
80function addBGAlpha(element,alpha) {
81	var theElement=document.getElementById(element);
82	
83	var rgbVal=getComputedCSS(theElement, 'background-color');
84	//alert('Computed Value: '+rgbVal);
85	var color=new RGBColor(rgbVal);
86	if (color.ok) {	
87		var rgbVal=color.toRGB();
88	rgbVal=rgbVal.replace(/\s/g, "");
89	var rgbaVal=rgbVal.substring(0,rgbVal.length-1)+','+alpha+')';
90	rgbaVal=rgbaVal.replace('rgb', 'rgba');
91		if(IS_RGBA_SUPPORTED) {
92				theElement.style.backgroundColor=rgbaVal;
93			}
94		else {
95			fixIEAlpha(theElement,RGBAToAHex(rgbaVal));
96		}
97	}
98	
99}

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.