PageSourceSearch

https://www.blackjason.com/js/common.js

js blackjason.com collected 2026-10-04 18:55:40 UTC 10,092 bytes, 386 lines download raw bytes

1function AJAX(G) {
2	var K = [],
3	$ = this,
4	L = AJAX.__pool__ || (AJAX.__pool__ = []); (function(E) {
5		var D = function() {};
6		E = E ? E: {};
7		var C = ["url", "content", "method", "async", "encode", "timeout", "ontimeout", "onrequeststart", "onrequestend", "oncomplete", "onexception"],
8		A = ["", "", "GET", true, I("GBK"), 3600000, D, D, D, D, D],
9		B = C.length;
10		while (B--) $[C[B]] = _(E[C[B]], A[B]);
11		if (!N()) return false;
12	})(G);
13	function _(_, $) {
14		return _ != undefined ? _: $
15	}
16	function N() {
17		var A, $ = [window.XMLHttpRequest, "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
18		for (var B = 0; B < L.length; B += 1) if (L[B].readyState == 0 || L[B].readyState == 4) return L[B];
19		for (B = 0; B < $.length; B += 1) {
20			try {
21				if (window.XMLHttpRequest) {
22					A = ($[B] && typeof($[B]) == "function" ? new $[B] : new XMLHttpRequest($[B]));
23				}else
24				{
25					A = ($[B] && typeof($[B]) == "function" ? new $[B] : new ActiveXObject($[B]));
26				}	
27				break
28			} catch(_) {
29				A = false;
30				continue
31			}
32		}
33		if (!A) {
34			throw "Cannot init XMLHttpRequest object!";
35			return false
36		} else {
37			L[L.length] = A;
38			
39			return A
40		}
41	}
42	function E($) {
43		return document.getElementById($)
44	}
45	function C($) {
46		var _ = $ * 1;
47		return (isNaN(_) ? 0 : _)
48	}
49	function D($) {
50		return (typeof($) == "string" ? ($ = E($)) ? $: false: $)
51	}
52	function F() {
53		return ((new Date) * 1)
54	}
55	function M($, _) {
56		K[$ + ""] = _
57	}
58	function H($) {
59		return (K[$ + ""])
60	}
61	function J(_, $, B) {
62		return (function A(C) {
63			C = C.replace(/([^\u0080-\u00FF]+)/g,
64			function($0, $1) {
65				return _($1)
66			}).replace(/([\u0080-\u00FF])/g,
67			function($0, $1) {
68				return escape($1).replace("%", "%u00")
69			});
70			for (var E = 0,
71			D = $.length; E < D; E += 1) C = C.replace($[E], B[E]);
72			return (C)
73		})
74	}
75	function I($) {
76		if ($.toUpperCase() == "UTF-8") return (encodeURIComponent);
77		else return (J(escape, [/\+/g], ["%2B"]))
78	}
79	function O(A, B) {
80		if (!A.nodeName) return;
81		var _ = "|" + A.nodeName.toUpperCase() + "|";
82		if ("|INPUT|TEXTAREA|OPTION|".indexOf(_) > -1) A.value = B;
83		else {
84			try {
85				A.innerHTML = B
86			} catch($) {}
87		}
88	}
89	function P(_) {
90		if (typeof(_) == "function") return _;
91		else {
92			_ = D(_);
93			if (_) return (function($) {
94				O(_, $.responseText)
95			});
96			else return $.oncomplete
97		}
98	}
99	function B(_, A, $) {
100		var C = 0,
101		B = [];
102		while (C < _.length) {
103			B[C] = _[C] ? ($[C] ? $[C](_[C]) : _[C]) : A[C];
104			C += 1
105		}
106		while (C < A.length) {
107			B[C] = A[C];
108			C += 1
109		}
110		return B
111	}
112	function A() {
113		var E, C = false,
114		K = N(),
115		J = B(arguments, [$.url, $.content, $.oncomplete, $.method, $.async, null], [null, null, P, null, null, null]),
116		G = J[0],
117		I = J[1],
118		L = J[2],
119		M = J[3],
120		H = J[4],
121		A = J[5],
122		O = M.toUpperCase() == "POST" ? true: false;
123		if (!G) {
124			throw "url is null";
125			return false
126		}
127		var _ = {
128			url: G,
129			content: I,
130			method: M,
131			params: A
132		};
133		if (!O) G += (G.indexOf("?") > -1 ? "&": "?") + "timestamp=" + F();
134		K.open(M, G, H);
135		$.onrequeststart(_);
136		if (O) K.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
137		K.setRequestHeader("X-Request-With", "XMLHttpRequest");
138		E = setTimeout(function() {
139			C = true;
140			K.abort()
141		},
142		$.timeout);
143		var D = function() {
144			if (C) {
145				$.ontimeout(_);
146				$.onrequestend(_)
147			} else if (K.readyState == 4) {
148				clearTimeout(E);
149				_.status = K.status;
150				try {
151					if (K.status == 200) L(K, A);
152					else $.onexception(_)
153				} catch(B) {
154					$.onexception(_)
155				}
156				$.onrequestend(_)
157			}
158		};
159		K.onreadystatechange = D;
160		if (O) K.send(I);
161		else K.send("");
162		if (H == false) D();
163		return true
164	}
165	this.setcharset = function(_) {
166		if (!$.encode) $.encode = I(_)
167	};
168	this.get = function(C, B, _) {
169		return A(C, "", B, "GET", $.async, _)
170	};
171	this.update = function(H, J, _, D, E) {
172		_ = C(_);
173		D = C(D);
174		if (_ < 1) D = 1;
175		var B = function() {
176			A(J, "", H, "GET", $.async, E)
177		},
178		G = F(),
179		I = function($) {
180			B();
181			$--;
182			if ($ > 0) M(G, setTimeout(function() {
183				I($)
184			},
185			_))
186		};
187		I(D);
188		return G
189	};
190	this.stopupdate = function($) {
191		clearTimeout(H($))
192	};
193	this.post = function(D, _, C, B) {
194		return A(D, _, C, "POST", $.async, B)
195	};
196	this.postf = function(O, J, B) {
197		var H = [],
198		L,
199		_,
200		G,
201		I,
202		M,
203		K = arguments.length,
204		C = arguments;
205		O = O ? D(O) : false;
206		if (!O || O.nodeName != "FORM") return false;
207		validfoo = O.getAttribute("onvalidate");
208		validfoo = validfoo ? (typeof(validfoo) == "string" ? new Function(validfoo) : validfoo) : null;
209		if (validfoo && !validfoo()) return false;
210		var E = O.getAttribute("action"),
211		N = O.getAttribute("method"),
212		F = $.formToStr(O);
213		if (F.length == 0) return false;
214		if (N.toUpperCase() == "POST") return A(E, F, J, "POST", true, B);
215		else {
216			E += (E.indexOf("?") > -1 ? "&": "?") + F;
217			return A(E, "", J, "GET", true, B)
218		}
219	};
220	this.formToStr = function(C) {
221		var B = "",
222		E = "",
223		_, A;
224		for (var D = 0; D < C.length; D += 1) {
225			_ = C[D];
226			if (_.name != "") {
227				switch (_.type) {
228				case "select-one":
229					if (_.selectedIndex > -1) A = _.options[_.selectedIndex].value;
230					else A = "";
231					break;
232				case "checkbox":
233				case "radio":
234					if (_.checked == true) A = _.value;
235					break;
236				default:
237					A = _.value
238				}
239				A = $.encode(A);
240				B += E + _.name + "=" + A;
241				E = "&"
242			}
243		}
244		return B
245	}
246}
247//-------------------------------------------------------
248
249
250function checkAll(bool,tagname,name)
251{
252	var checkboxArray;checkboxArray=getElementsByName(tagname,name)
253	for (var i=0;i<checkboxArray.length;i++){checkboxArray[i].checked = bool;}
254}
255
256function checkOthers(tagname,name)
257{
258	var checkboxArray;checkboxArray=getElementsByName(tagname,name)
259	for (var i=0;i<checkboxArray.length;i++){
260		if (checkboxArray[i].checked == false){
261			checkboxArray[i].checked = true;
262		}else if (checkboxArray[i].checked == true){
263			checkboxArray[i].checked = false;
264		}
265	}
266}
267
268function textareasize(obj){
269	if(obj.scrollHeight > 70){
270		obj.style.height = obj.scrollHeight + 'px';
271	}
272}
273
274function set(obj,value){
275	obj.innerHTML = value
276}
277
278function view(id){
279	document.getElementById(id).style.display='inline'	
280}
281
282function hide(id){
283	document.getElementById(id).style.display='none'		
284}
285
286function getScroll(){var t;if(document.documentElement&&document.documentElement.scrollTop){t=document.documentElement.scrollTop;}else if(document.body){t=document.body.scrollTop;}return(t);} 
287
288
289function HtmlEncode(str)
290{   
291	 var s = "";
292	 if(str.length == 0) return "";
293	 s    =    str.replace(/&/g,"&amp;");
294	 s    =    s.replace(/</g,"&lt;");
295	 s    =    s.replace(/>/g,"&gt;");
296	 s    =    s.replace(/ /g,"&nbsp;");
297	 s    =    s.replace(/\'/g,"&#39;");
298	 s    =    s.replace(/\"/g,"&quot;"); 
299	 return   s;   
300}  
301
302function getElementsByName(tag,name){
303    var rtArr=new Array();
304    var el=document.getElementsByTagName(tag);
305    for(var i=0;i<el.length;i++){
306        if(el[i].name==name)
307              rtArr.push(el[i]);
308    }
309    return rtArr;
310}
311
312function closeWin(){
313	document.body.removeChild(document.getElementById("bg")); 
314	document.body.removeChild(document.getElementById("msg"));
315	if(document.getElementById("searchtype"))document.getElementById("searchtype").style.display="";
316}
317
318function openWindow(zindex,width,height,alpha){
319	var iWidth = document.documentElement.scrollWidth; 
320	var iHeight = document.documentElement.clientHeight; 
321	var bgDiv = document.createElement("div");
322	bgDiv.id="bg";
323	bgDiv.style.cssText = "top:0;width:"+iWidth+"px;height:"+document.documentElement.scrollHeight+"px;filter:Alpha(Opacity="+alpha+");opacity:0.3;z-index:"+zindex+";";
324	document.body.appendChild(bgDiv); 
325	var msgDiv=document.createElement("div");
326	msgDiv.id="msg";
327	msgDiv.style.cssText ="z-index:"+(zindex+1)+";width:"+width+"px; height:"+(parseInt(height)-0+29+16)+"px;left:"+((iWidth-width-2)/2)+"px;top:"+(getScroll()+(height=="auto"?150:(iHeight>(parseInt(height)+29+2+16+30)?(iHeight-height-2-29-16-30)/2:0)))+"px";
328	msgDiv.innerHTML="<div class='msgtitle'><div id='msgtitle'></div><img onclick='closeWin()' src='/"+sitePath+"pic/btn_close.gif' /></div><div id='msgbody' style='height:"+height+"px'></div>";
329	document.body.appendChild(msgDiv);
330}
331
332function openWindow2(zindex,width,height,alpha){
333	var iWidth = document.documentElement.scrollWidth; 
334	var bgDiv = document.createElement("div");
335	bgDiv.id="bg";
336	bgDiv.style.cssText = "top:0;width:"+iWidth+"px;height:"+document.documentElement.scrollHeight+"px;filter:Alpha(Opacity="+alpha+");opacity:0.3;z-index:"+zindex+";";
337	document.body.appendChild(bgDiv); 
338	var msgDiv=document.createElement("div");
339	msgDiv.id="msg";
340	msgDiv.style.cssText ="position: absolute;z-index:"+(zindex+1)+";width:"+width+"px; height:"+(height=="auto"?height:(height+"px"))+";";
341	document.body.appendChild(msgDiv);	
342}
343
344function selectTogg(){
345	var selects=document.getElementsByTagName("select");
346	for(var i=0;i<selects.length;i++){
347		selects[i].style.display=(selects[i].style.display=="none"?"":"none");
348	}
349}
350function checkInput(str,type){
351	switch(type){
352		case "mail":
353			if(!/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi.test(str)){alert('邮箱填写错误');return false;}
354			break;
355		case "num" :
356			if(isNaN(str)){alert('QQ填写错误');return false;}
357			break;
358	}
359	return true;
360}
361
362function copyToClipboard(txt) {    
363	if(window.clipboardData){    
364		window.clipboardData.clearData();    
365		window.clipboardData.setData("Text", txt);
366		alert('复制成功!')
367	}else{
368		alert('请手动复制!')	
369	}   
370}
371function   getUrlArgs()   
372  {   
373     return  location.pathname;
374  }
375
376
377
378
379
380
381//
382
383
384
385
386

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.