PageSourceSearch

https://www.craxford-family.co.uk/js/net.js

js craxford-family.co.uk collected 2026-10-02 14:13:24 UTC 6,805 bytes, 220 lines download raw bytes

1/*
2url-loading object and a request queue built on top of it
3*/
4
5/* namespacing object */
6var net=new Object();
7
8net.READY_STATE_UNINITIALIZED=0;
9net.READY_STATE_LOADING=1;
10net.READY_STATE_LOADED=2;
11net.READY_STATE_INTERACTIVE=3;
12net.READY_STATE_COMPLETE=4;
13
14
15/*--- content loader object for cross-browser requests ---*/
16net.ContentLoader=function(url,onload,onerror,method,params,contentType){
17  this.req=null;
18  this.onload=onload;
19  this.onerror=(onerror) ? onerror : this.defaultError;
20  this.loadXMLDoc(url,method,params,contentType);
21}
22
23net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){
24  if (!method){
25    method="GET";
26  }
27  if (!contentType && method=="POST"){
28    contentType='application/x-www-form-urlencoded';
29  }
30  if (window.XMLHttpRequest){
31    this.req=new XMLHttpRequest();
32  } else if (window.ActiveXObject){
33    this.req=new ActiveXObject("Microsoft.XMLHTTP");
34  }
35  if (this.req){
36    try{
37      var loader=this;
38      this.req.onreadystatechange=function(){
39        net.ContentLoader.onReadyState.call(loader);
40      }
41      this.req.open(method,url,true);
42      if (contentType){
43        this.req.setRequestHeader('Content-Type', contentType);
44      }
45      this.req.send(params);
46    }catch (err){
47      this.onerror.call(this);
48    }
49  }
50}
51
52
53net.ContentLoader.onReadyState=function(){
54  var req=this.req;
55  var ready=req.readyState;
56  if (ready==net.READY_STATE_COMPLETE){
57    var httpStatus=req.status;
58    if (httpStatus==200 || httpStatus==0){
59      this.onload.call(this);
60    }else{
61      this.onerror.call(this);
62    }
63  }
64}
65
66net.ContentLoader.prototype.defaultError=function(){
67  alert("There was a problem returning data from the server. This may be temporary, so please try again later. Here is some information about the status of this request:"
68    +"\n\nreadyState:"+this.req.readyState
69    +"\nstatus: "+this.req.status
70    +"\nheaders: "+this.req.getAllResponseHeaders());
71}
72
73function showPreview(mediaID,path,entitystr) {
74	if(jQuery('#prev'+entitystr).html() == "")
75		jQuery('#prev'+entitystr).html('<div id="ld'+entitystr+'"><img src="' + cmstngpath + 'img/spinner.gif" style="border:0px"> '+loadingmsg+'</div><img src="' + smallimage_url + 'mediaID=' + mediaID + '&path=' + encodeURIComponent(path) + '" style="display:none" onload="jQuery(\'#ld\'+\'' + entitystr + '\').hide(); this.style.display=\'\';"/>');
76	jQuery('#prev'+entitystr).fadeIn(100);
77}
78
79function closePreview(entitystr) {
80	jQuery('#prev'+entitystr).fadeOut(100);
81}
82
83var loginOverlay;
84function openLogin(url) {
85	loginOverlay = new LITBox(url,{width:600, height:380, doneLoading:function(){setFocus('tngusername');}});
86	return false;
87}
88
89function setFocus(field) {
90	if(jQuery('#'+field).length)
91		jQuery('#'+field).focus();
92}
93
94function sendLogin(form, url) {
95	var params = jQuery(form).serialize();
96	jQuery.ajax({
97		url: url,
98		data: params,
99		dataType: 'json',
100		success: function(vars){
101			if(jQuery('#'+vars.div).length) {
102				jQuery('#'+vars.div).html(vars.msg);
103				jQuery('#'+vars.div).effect('highlight',{},400);
104			}
105		}
106	});
107	return false;
108}
109
110var newuserok = false;
111function checkNewUser(userfield, olduserfield, submitform) {
112	if(olduserfield && userfield.value == olduserfield.value) {
113		newuserok = true;
114		return true;
115	}
116	else {
117		var params = {checkuser: userfield.value};
118		jQuery.ajax({
119			url: 'ajx_checknewuser.php',
120			data: params,
121			dataType: 'json',
122			success: function(vars){
123				newuserok = vars.rval;
124				if(newuserok) {
125					if(submitform)
126						document.editprofile.submit();
127					else
128						jQuery('#checkmsg').html('<span class=\"msgapproved\">' + vars.html + '</span>');
129				}
130				else
131					jQuery('#checkmsg').html('<span class=\"msgerror\">' + vars.html + '</span>');
132			}
133		});
134		return false;
135	}
136}
137
138function checkEmail(email) {
139	var domains = ",AC,AD,AE,AERO,AF,AG,AI,AL,AM,AN,AO,AQ,AR,ARPA,AS,AT,AU,AW,AX,AZ,BA,BB,BD,BE,BF,BG,BH,BI,BIZ,BJ,BM,BN,BO,BR,BS,BT,BV,BW,BY,BZ,CA,CAT,CC,CD,CF,CG,CH,CI,CK,CL,CM,CN,CO,COM,COOP,CR,CU,CV,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EDU,EE,EG,ER,ES,ET,EU,FI,FJ,FK,FM,FO,FR,GA,GB,GD,GE,GF,GG,GH,GI,GL,GM,GN,GOV,GP,GQ,GR,GS,GT,GU,GW,GY,HK,HM,HN,HR,HT,HU,ID,IE,IL,IM,IN,INFO,INT,IO,IQ,IR,IS,IT,JE,JM,JO,JOBS,JP,KE,KG,KH,KI,KM,KN,KR,KW,KY,KZ,LA,LB,LC,LI,LK,LR,LS,LT,LU,LV,LY,MA,MC,MD,MG,MH,MIL,MK,ML,MM,MN,MO,MOBI,MP,MQ,MR,MS,MT,MU,MUSEUM,MV,MW,MX,MY,MZ,NA,NAME,NC,NE,NET,NF,NG,NI,NL,NO,NP,NR,NU,NZ,OM,ORG,PA,PE,PF,PG,PH,PK,PL,PM,PN,PR,PRO,PS,PT,PW,PY,QA,RE,RO,RU,RW,SA,SB,SC,SD,SE,SG,SH,SI,SJ,SK,SL,SM,SN,SO,SR,ST,SU,SV,SY,SZ,TC,TD,TEL,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TP,TR,TRAVEL,TT,TV,TW,TZ,UA,UG,UK,UM,US,UY,UZ,VA,VC,VE,VG,VI,VN,VU,WF,WS,YE,YT,YU,ZA,ZM,ZW,";
140	var rval = /^\w+([\.\+-]*\w+)*@\w+([\.\+-]*\w+)*(\.\w{2,6})+$/.test(email);
141	if(rval) {
142		var thisdomain = email.substr(email.lastIndexOf(".")+1);
143		rval = domains.indexOf(','+thisdomain.toUpperCase()+',') >= 0 ? true : false;
144	}
145	return rval;
146}
147
148
149if (!Array.prototype.indexOf) {
150	Array.prototype.indexOf = function(obj, start) {
151	     for (var i = (start || 0), j = this.length; i < j; i++) {
152	         if (this[i] === obj) { return i; }
153	     }
154	     return -1;
155	}
156}
157
158function openSearch() {
159	jQuery('#searchdrop').slideToggle(200);
160	jQuery('#searchfirst').focus();
161	return false;
162}
163
164function goToPage(button, address, tree, perpage) {
165	var pagenum = jQuery(button).prev(".tngpage").val();
166	if(!isNaN(pagenum) && pagenum >= 1) {
167		offset = (pagenum - 1) * perpage;
168		window.location.href = address + '=' + offset + '&tree=' + tree + '&tngpage=' + pagenum;
169	}
170}
171
172function pageEnter(field,e) {
173	var keycode;
174	if (window.event) keycode = window.event.keyCode;
175	else if (e) keycode = e.which;
176	else return false;
177	if(keycode == 13)
178		return true;
179	else
180		return false;
181}
182
183function toggleMobileMenu(menuName) {
184	var menu = jQuery('ul#m' + menuName + 'menu');
185	if(menu.hasClass('on'))
186		menu.removeClass('on');
187	else {
188		jQuery('.mhead ul').removeClass('on');
189		menu.addClass('on'); 
190	}
191	return false;
192}
193
194jQuery(document).ready(function() {
195	jQuery('li a.mobileicon').click(function() {
196		jQuery('ul.on').each(function(index,item){
197			jQuery(item).removeClass('on');
198		})
199	});
200	jQuery('.toggleicon').click(function(e) {
201		var target = jQuery(e.target);
202		var targetId = target.attr('id');
203		var affectedRows = jQuery('.' + targetId);
204		if(target.attr('src').indexOf('desc') > 0) {
205			target.attr('src',cmstngpath + "img/tng_sort_asc.gif");
206			target.attr('title',collapse_msg);
207			jQuery('.l' + targetId).attr('rowspan',affectedRows.length + 1);
208		}
209		else {
210			target.attr('src',cmstngpath + "img/tng_sort_desc.gif");
211			target.attr('title',expand_msg);
212			jQuery('.l' + targetId).removeAttr('rowspan');
213		}
214		if(targetId.substring(0,1) == "m") {
215			jQuery('#dr'+targetId).toggle();
216			jQuery('#ss'+targetId).toggle();
217		}
218		affectedRows.toggle();
219	});
220});

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.