PageSourceSearch

https://jacktheripper.de/js/fade.js

js jacktheripper.de collected 2026-10-02 14:07:41 UTC 3,528 bytes, 118 lines download raw bytes

1fadeColor = "#FFCCCC";  // color to fade to
2stepIn = 20; // delay when fading in
3stepOut = 30; // delay when fading out
4
5/* set to true or false; true will
6** cause all links to fade automatically
7** (you won't need to add class="fade")
8***/
9autoFade = true;  
10
11/* set to true or false; true will cause all CSS
12** classes with "fade" in them to fade onmouseover
13***/
14sloppyClass = true;
15
16/* set to true or false; true will make the script
17** work for Macs (IE 5+), but you will have to give
18** a name (name="blah") to each link that you want
19** to fade.
20***/
21macCompat = false;
22
23hexa = new makearray(16);
24for(var i = 0; i < 10; i++)
25    hexa[i] = i;
26hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
27hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
28
29document.onmouseover = domouseover;
30document.onmouseout = domouseout;
31
32fadeColor = dehexize(fadeColor.toLowerCase());
33
34var fadeId = new Array();
35
36function dehexize(Color){
37	var colorArr = new makearray(3);
38	for (i=1; i<7; i++){
39		for (j=0; j<16; j++){
40			if (Color.charAt(i) == hexa[j]){
41				if (i%2 !=0)
42					colorArr[Math.floor((i-1)/2)]=eval(j)*16;
43				else
44					colorArr[Math.floor((i-1)/2)]+=eval(j);
45			}
46		}
47	}
48	return colorArr;
49}
50
51function domouseover() {
52	if(document.all){
53		var srcElement = event.srcElement;
54		if ((srcElement.tagName == "A" && autoFade && srcElement.className != "nofade") || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) {
55				if (!srcElement.startColor) {
56					srcElement.startColor = (srcElement.style.color)? srcElement.style.color: srcElement.currentStyle.color;
57					srcElement.startColor = dehexize(srcElement.startColor.toLowerCase());
58				}
59				var link = (macCompat? srcElement.name: srcElement.uniqueID);
60				if (link) fade(srcElement.startColor,fadeColor,link,stepIn);				
61				else if (macCompat) alert("Error: Mac Compatility mode enabled, but link has no name.");
62		}
63	}
64}
65
66function domouseout() {
67	if (document.all){
68		var srcElement = event.srcElement;
69		if ((srcElement.tagName == "A" && autoFade && srcElement.className != "nofade") || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) {
70			var link = (macCompat? srcElement.name: srcElement.uniqueID);
71			if (link) fade(fadeColor,srcElement.startColor,link,stepIn);
72		}
73	}
74}
75
76function makearray(n) {
77    this.length = n;
78    for(var i = 1; i <= n; i++)
79        this[i] = 0;
80    return this;
81}
82
83function hex(i) {
84    if (i < 0)
85        return "00";
86    else if (i > 255)
87        return "ff";
88    else
89       return "" + hexa[Math.floor(i/16)] + hexa[i%16];
90}
91
92function setColor(r, g, b, element) {
93      var hr = hex(r); var hg = hex(g); var hb = hex(b);
94      element.style.color = "#"+hr+hg+hb;
95}
96
97function fade(s,e,element,step) {
98	var sr = s[0]; var sg = s[1]; var sb = s[2];
99	var er = e[0]; var eg = e[1]; var eb = e[2];
100	
101	if (fadeId[0] != null && fade[0] != element && eval(fadeId[0])) {
102		var orig = eval(fadeId[0]);
103		setColor(orig.startColor[0],orig.startColor[1],orig.startColor[2],orig);
104		var i = 1;
105		while(i < fadeId.length) {
106			clearTimeout(fadeId[i]);
107			i++;
108		}
109	}
110		
111	for(var i = 0; i <= step; i++) {
112		fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
113			step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
114			")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step);
115	}
116	fadeId[0] = element;
117}
118

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.