PageSourceSearch

https://alevelchem.com/js/fsp.js

js alevelchem.com collected 2026-10-06 13:02:32 UTC 3,601 bytes, 156 lines download raw bytes

1/*
2FairSky Pages
3-------------
4Copyright 2004-2005 Joshua Paine
5Created by Joshua Paine of FairSky Networks <http://fairsky.us/>
6Contact at <http://fairsky.us/contact>
7Documentation at <http://fairsky.us/learning/fsp>
8Updated 2005-03-25
9
10The latest version should be available at
11<http://demo.fairsky.us/javascript/fsp.js>
12
13You may copy, reuse, or produce derivative works of this code
14only under the terms of the Linky License v0.1 or later.
15The Linky License can be found at <http://fairsky.us/linky>.
16The main points of the license are:
17	1) Do not alter or remove this notice.
18	2) Notify me of your usage through one of the means listed
19	   at <http://fairsky.us/contact>.
20*/
21
22function documentRegister(tag,effect,func,ev,exclusive)
23{
24	document.toRegister[document.toRegister.length] = {
25		tag:tag,
26		effect:effect,
27		func:func,
28		event:ev,
29		exclusive:exclusive
30	};
31}
32
33function doRegister(n)
34{
35	if(!n) n = document;
36	var t, y;
37	var r = document.toRegister;
38	for(var x=0; x<r.length; x++)
39	{
40		t = n.getElementsByTagName(r[x].tag);
41		if(r[x].tag=='*' && t.length==0) t = document.all;
42		for(y=0; y<t.length; y++)
43		{
44			if(!r[x].effect || hasClassName(t[y],"Fsp."+r[x].effect) || hasClassName(t[y],r[x].effect) || t[y].className.indexOf("Fsp."+r[x].effect+":") > -1 || t[y].className.indexOf("Fsp."+r[x].effect+".") > -1)
45			{
46				if(r[x].event == 'load')
47				{
48					t[y].load = r[x].func;
49					t[y].load({ currentTarget:t[y] });
50				}
51				else
52				{
53					addEventHandler(t[y],r[x].event,r[x].func,r[x].exclusive);
54				}
55			}
56		}
57	}
58}
59
60function addEventHandler(el,ev,func,exclusive)
61{
62	if(exclusive)
63	{
64		if(eval("el.on"+ev+" = func;")) return true;
65		else return false;
66	}
67	else
68	{
69		if(el.addEventListener)
70		{
71			el.addEventListener(ev,func,false);
72			return true;
73		}
74		else if(el.attachEvent)
75		{
76			return el.attachEvent("on"+ev, func);
77		}
78		else return false;
79	}
80}
81
82function dumpProps(obj)
83{
84	var str, p, i, val;
85	i = 0;
86	str='';
87	for(p in obj)
88	{
89		val = ''+eval('obj.'+p);
90		val = val.substring(0,300);
91		str += p+' = '+val+'\n';
92		if(i++==15){ alert(str); str=''; i=0; }
93	}
94	alert(str);
95}
96
97function fspImageToolbarRemoval()
98{
99	this.setAttribute('galleryimg','false');
100}
101
102function addClassName(el,newClass)
103{
104	var ary = el.className.split(' ');
105	var x=0;
106	while(x<ary.length && ary[x]!=newClass) x++;
107	if(x<ary.length) return false;
108	else
109	{
110		ary[ary.length] = newClass;
111		el.className = ary.join(' ');
112		return true;
113	}
114}
115
116function removeClassName(el,oldClass)
117{
118	var ary = el.className.split(' ');
119	var className = new Array();
120	for(var x=0; x<ary.length; x++) if(ary[x]!=oldClass) className[className.length] = ary[x];
121	if(ary.length==className.length) return false;
122	else
123	{
124		el.className = className.join(' ');
125		return true;
126	}
127}
128
129function replaceClassName(el,oldClass,newClass)
130{
131	var ary = el.className.split(' ');
132	var x = 0;
133	while(x<ary.length && ary[x]!=oldClass) x++;
134	if(x<ary.length)
135	{
136		el.className = ary.join(' ');
137		return true;
138	}
139	else return false;
140}
141
142function hasClassName(el,searchClass)
143{
144	var ary = el.className.split(' ');
145	var x = 0;
146	while(x<ary.length && ary[x]!=searchClass && ary[x].substr(0,ary[x].search(":"))!=searchClass) x++;
147	return (x<ary.length);
148}
149
150document.toRegister = new Array();
151document.register = documentRegister;
152document.fspUpdate = doRegister;
153
154addEventHandler(window,'load',function(){ doRegister(); },false);
155
156document.register('img',null,fspImageToolbarRemoval,'load',false);

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.