PageSourceSearch

https://askjan.org/commonspot/pagemode/always-include-common.js

js askjan.org collected 2026-10-01 08:34:11 UTC 6,721 bytes, 250 lines download raw bytes

1// always-include-common.js  Copyright 1998-2020 PaperThin, Inc. All rights reserved.
2
3bName = navigator.appName;
4bVer = parseInt(navigator.appVersion);
5
6var bCanRollover=0
7if (bName == "Netscape")
8{
9	if(bVer >= 3)
10		bCanRollover=1;
11}
12else if (bName == "Microsoft Internet Explorer")
13{
14	if(bVer >= 4)
15		bCanRollover=1;
16}
17
18function ImageSet(imgID,newTarget)
19{
20	if (bCanRollover)
21	{
22		document[imgID].src=newTarget;
23		
24		// Display picture tag if webP is enabled, else display img tag
25		if( document.getElementsByName(imgID + "_webP").length > 0 )
26		{
27			var imgURLArr = newTarget.split('.');
28			document.getElementsByName(imgID + "_webP")[0].srcset = imgURLArr[0] + '.webp';
29		}
30	}
31}
32
33function clearStatus()
34{
35	window.status = "";
36}
37
38function setStatbar(statbar)
39{
40// #22793 - no-op because browsers don't honor the assignment
41//	var strStatbar=unescape(statbar);
42//	window.status=strStatbar;
43}
44
45function onLoadComplete()
46{
47	if (menus_included == 1)
48		document.onmouseover = document_mouseover;	// defined in menu_ie.js
49}
50
51function HandleLink(parentID,link,displaylink)
52{
53	// links are in one of the following formats:
54	// 		cpe_60_0,CP___PAGEID=100
55	// 		CPNEWWIN:WindowName^params@CP___
56	// 			CPNEWWIN:child^top=110:left=130:ww=140:hh=150:tb=1:loc=1:dir=0:stat=1:mb=1:sb=1:rs=1@CP___PAGEID=3811,Adv-Search-2,1
57	// displaylink is the server relative URL or fully qualified URL
58	windowname = "";
59	windowparams = "";
60
61	// "CPNEWWIN:" & NewWindowName & "^" & params & "@" & linkStruct.LinkURL;
62	pos = link.indexOf("CPNEWWIN:");
63	if (pos != -1)
64	{
65		pos1 = link.indexOf ("^");
66		windowname = link.substring (pos+9, pos1);
67		pos2 = link.indexOf ("@");
68		windowparams = link.substring (pos1 + 1, pos2);
69		link = link.substring (pos2 + 1, link.length);
70	}
71
72	if (displaylink && displaylink != "")
73	{
74		if (windowname == "")
75			window.location = displaylink;
76		else
77		{
78			windowparams = FormatWindowParams(windowparams);
79			window.open (displaylink, windowname, windowparams);
80		}
81	}
82	else
83	{
84		targetLink = link;
85
86		if (link.indexOf ("CP___") != -1)
87		{
88			httpPos = -1;
89			commaPos = link.indexOf(",");
90			if (commaPos != -1)
91			{
92				targetUrl = link.substr(commaPos + 1);
93				if (targetUrl.indexOf("://") != -1 || targetUrl.indexOf("/") == 0)
94				{
95					httpPos = commaPos + 1;
96				}
97			}
98
99			if (httpPos != -1)
100			{
101				targetLink = link.substr(httpPos);
102
103				commaPos = targetLink.indexOf(",");
104				if (commaPos != -1)
105					targetLink = targetLink.substr(0, commaPos);
106			}
107			else
108				targetLink = jsDlgLoader + "?CSRF_Token=" + top.commonspot.util.cookie.readCookie('CSRFTOKEN') + "&csModule=utilities/handle-link&thelink=" + link;
109
110			if (windowname == "")
111				window.location = targetLink;
112			else
113			{
114				windowparams = FormatWindowParams(windowparams);
115				window.open (targetLink, windowname, windowparams);
116			}
117		}
118		else
119		{
120			//commaPos = link.indexOf(",");
121			//if (commaPos != -1)
122			// link = link.substr(0, commaPos);
123
124			if (windowname == "")
125				window.location = link;
126			else
127			{
128				windowparams = FormatWindowParams(windowparams);
129				window.open (link, windowname, windowparams);
130			}
131		}
132	}
133}
134
135function doWindowOpen(href,name,params)
136{
137	if (params != '')
138		window.open (href, name, params);
139	else
140		window.open (href, name);
141}
142
143// 	CPNEWWIN:child^top=110:left=130:ww=140:hh=150:tb=1:loc=1:dir=0:stat=1:mb=1:sb=1:rs=1@CP___PAGEID=3811,Adv-Search-2,1
144function FormatWindowParams(windowparams)
145{
146	if (windowparams.indexOf(":loc=") != -1 || windowparams.indexOf(":ww=") != -1 || windowparams.indexOf(":hh=") != -1 ||
147	    windowparams.indexOf(":left=") != -1 || windowparams.indexOf(":top=") != -1)
148	{
149		windowparams = substringReplace(windowparams,':left=',',left=');
150		windowparams = substringReplace(windowparams,'left=','left=');
151		windowparams = substringReplace(windowparams,':ww=',',width=');
152		windowparams = substringReplace(windowparams,'ww=','width=');
153		windowparams = substringReplace(windowparams,':hh=',',height=');
154		windowparams = substringReplace(windowparams,'hh=','height=');
155		windowparams = substringReplace(windowparams,':loc=',',location=');
156		windowparams = substringReplace(windowparams,'loc=','location=');
157		windowparams = substringReplace(windowparams,':dir=',',directories=');
158		windowparams = substringReplace(windowparams,'dir=','directories=');
159		windowparams = substringReplace(windowparams,':tb=',',toolbar=');
160		windowparams = substringReplace(windowparams,'tb=','toolbar=');
161		windowparams = substringReplace(windowparams,':stat=',',status=');
162		windowparams = substringReplace(windowparams,':mb=',',menubar=');
163		windowparams = substringReplace(windowparams,':sb=',',scrollbars=');
164		windowparams = substringReplace(windowparams,':rs=',',resizable=');
165	}
166	return windowparams;
167}
168
169
170// reset scheduled elements
171function clear_sched_element()
172{
173	evalCol = String(self.element_collection);
174	var obj;
175	if  (evalCol != 'undefined')
176	{
177		for(i=0;i<self.element_collection.length;i++)
178		{
179			sitem = self.element_collection[i];
180			sp = 'sched_elements_' + sitem.ctrl + '_' + sitem.id;
181			obj = document.getElementById(sp);
182			if (obj)
183				obj.style.display = sitem.display;
184		}
185	}
186}
187
188// handle scheduled element links
189function show_sched_element(eid)
190{
191	evalCol = String(self.element_collection);
192	dispFlag = false;
193
194	if  (evalCol != 'undefined')
195	{
196		for(i=0;i<self.element_collection.length;i++)
197		{
198
199			sitem = self.element_collection[i];
200			sp = 'sched_elements_' + sitem.ctrl + '_' + sitem.id;
201			obj = document.getElementsByName(sp);
202
203			if  (sitem.id == eid && obj != null)
204			{
205
206				dispFlag = true;
207				if  (obj.length > 0)
208				{
209					for(z=0;z<obj.length;z++)
210					{
211						obj(z).style.display = 'block';
212					}
213				}
214				else
215				{
216					obj = document.getElementById(sp)
217							if(obj)
218						obj.style.display = 'block';
219				}
220
221				for (j=0;j < self.element_collection.length;j++){
222					if (sitem.ctrl == self.element_collection[j].ctrl && i != j){
223						sp = 'sched_elements_' + self.element_collection[j].ctrl + '_' + self.element_collection[j].id;
224						obj = document.getElementsByName(sp);
225
226						if  (obj != null)
227						{
228							if  (obj.length > 0)
229							{
230								for(z=0;z<obj.length;z++)
231								{
232									obj(z).style.display = 'none';
233								}
234							}
235							else
236							{
237								obj = document.getElementById(sp)
238										if(obj)
239									obj.style.display = 'none';
240							}
241						}
242					}
243				}
244			}
245		}
246	}
247
248	if  (!dispFlag)
249		alert("You do not have access to the requested element.");
250}

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.