PageSourceSearch

http://www.wtzzz.com/source/plugin/chs_tiebalist/template/js/tiebalist.js

js wtzzz.com collected 2026-10-08 03:28:00 UTC 5,430 bytes, 177 lines download raw bytes

1function getAncestryByClassName(obj,className) {
2	if (!obj) return null;
3	var ancestry=obj;
4	while (ancestry&&(!hasClass(ancestry,className))) {
5		ancestry=ancestry.parentNode;
6	}
7	return ancestry;
8}
9function showElement(obj) {
10    if(obj.style.visibility) {
11		obj.style.visibility = 'visible';
12	} else {
13		obj.style.display = '';
14	}
15}
16function hideElement(obj) {
17    if(obj.style.visibility) {
18		obj.style.visibility = 'hidden';
19	} else {
20		obj.style.display = 'none';
21	}
22}
23function showPicture(obj,i) {
24	if (!obj) return;
25	var pictureDisplay=getAncestryByClassName(obj,'picturedisplay');
26	var thumbList=($C('thumblist',pictureDisplay,'ul'))[0];
27	var pictureBox=($C('picturebox',pictureDisplay,'div'))[0];
28	var bigPictures=$C('bigpicture',pictureBox,'div');
29	var num=bigPictures.length;
30	var curPicture=null;;
31	for (var j=0;j<num;j++) if (j==i) {curPicture=bigPictures[j];break;}
32	var curImg=($C('picture',curPicture,'img'))[0];
33	var picUrl=curImg.getAttribute('file');
34	if (!curImg.getAttribute('loaded')) {
35		imgtmp=new Image();
36		imgtmp.onerror=function (){this.error=true;};
37		imgtmp.src=picUrl;
38		var waittimer=setInterval(function(){
39			if (imgtmp.height>2||imgtmp.complete||imgtmp.error){
40				clearInterval(waittimer);
41				if (!imgtmp.error){
42					var zw = imgtmp.width;
43					var zh = imgtmp.height;
44					var zr = zw / zh;
45					fixw = pictureMaxWidth == undefined ? '600' : pictureMaxWidth;
46					if(zw > fixw) {
47					    zw = fixw;
48					    zh = zw / zr;
49					}
50					curImg.width = zw;
51					curImg.height = zh;
52					curImg.src=picUrl;
53					
54				}else {
55					curImg.width = 213;
56					curImg.height = 160;
57					curImg.src='source/plugin/chs_tiebalist/template/images/nopic.jpg';
58				}
59				curImg.setAttribute('loaded',1);
60				hideElement(thumbList);
61				showElement(pictureBox);
62				for (var j=0;j<num;j++) {
63					if (j==i) showElement(bigPictures[j]);
64					else hideElement(bigPictures[j]);
65				}
66			}
67		},100);
68		
69	}else {
70		hideElement(thumbList);
71		showElement(pictureBox);
72		for (var j=0;j<num;j++) {
73			if (j==i) showElement(bigPictures[j]);
74			else hideElement(bigPictures[j]);
75		}
76	}
77	if(!curImg.id) {
78		curImg.id = 'img_' + Math.random();
79	}
80	var turnLeftBTN=($C('icon_turnleft',pictureBox,'a'))[0];
81	var turnRightBTN=($C('icon_turnright',pictureBox,'a'))[0];
82	if (turnLeftBTN) {
83		turnLeftBTN.setAttribute('imgid',curImg.id);
84	}
85	if (turnRightBTN) {
86		turnRightBTN.setAttribute('imgid',curImg.id);
87	}
88	var largePicBTN=($C('icon_viewlarge',pictureBox,'a'))[0];
89	if (largePicBTN){
90		largePicBTN.href=picUrl;
91	}
92	
93	var prev=($C('goprevious',curPicture))[0];
94	var next=($C('gonext',curPicture))[0];
95	if (i>0) {
96		prev.onclick=function(){showPicture(pictureBox,i-1);return false;};
97		showElement(prev);
98	}else{
99		hideElement(prev);
100	}
101	if (i<num-1) {
102		next.onclick=function(){showPicture(pictureBox,i+1);return false;};
103		showElement(next);
104	}else{
105		hideElement(next);
106	}
107}
108function closePicture(obj) {
109    if (!obj) return;
110	var pictureDisplay=getAncestryByClassName(obj,'picturedisplay');
111	var pictureBox=($C('picturebox',pictureDisplay,'div'))[0];
112	var thumbList=($C('thumblist',pictureDisplay,'ul'))[0];
113	hideElement(pictureBox);
114	showElement(thumbList);
115}
116function turnImg(obj,direct) {
117	if (!obj) return;
118    var imgid=obj.getAttribute('imgid');
119    imageRotate(imgid, direct);
120}
121function imageRotate(imgid, direct) {
122	var image = $(imgid);
123	if(!image.getAttribute('deg')) {
124		var deg = 0;
125		image.setAttribute('ow', image.width);
126		image.setAttribute('oh', image.height);
127	} else {
128		var deg = parseInt(image.getAttribute('deg'));
129	}
130	var ow = image.getAttribute('ow');
131	var oh = image.getAttribute('oh');
132	deg = direct == 1 ? deg - 90 : deg + 90;
133	if(deg > 270) {
134		deg = 0;
135	} else if(deg < 0) {
136		deg = 270;
137	}
138	image.setAttribute('deg', deg);
139	switch(deg) {
140		case 0:var cow=ow,coh=oh;cx = 0, cy = 0;break;
141		case 90:var cow = oh, coh = ow;cx = 0, cy = (ow-oh)/2;break;
142		case 180:var cow = ow, coh = oh;cx = 0, cy = 0;break;
143		case 270:var cow = oh, coh = ow;cx = 0, cy = (ow-oh)/2;break;
144	}
145	image.parentNode.style.height=coh+'px';
146	var rotate = (function() {
147		if (hasTransform) {
148			return function(dom, angle) {  
149				dom.style[css3Transform] = 'translate('+cx+'px,'+cy+'px) rotate(' + angle + 'deg) scale(1,1)';  
150			};//code
151		}else if (BROWSER.ie) {   
152			return function(dom, angle) {  
153				var rad = angle * (Math.PI / 180),  
154				dx = (1 - Math.cos(Math.PI / 4 + rad) / Math.cos(Math.PI / 4)) * dom.offsetWidth / 2,  
155				dy = (1 - Math.sin(Math.PI / 4 + rad) / Math.cos(Math.PI / 4)) * dom.offsetHeight / 2,  
156				m11 = Math.cos(rad),  
157				m12 = -1 * Math.sin(rad),  
158				m21 = Math.sin(rad),  
159				m22 = m11;
160				dom.style.filter = 'progid:DXImageTransform.Microsoft.Matrix(Dx=' + dx + ',Dy=' + dy + ',M11=' + m11 + ',M12=' + m12 + ',M21=' + m21 + ',M22=' + m22 + ',SizingMethod="auto expand")';
161			};
162		}else return null;
163	})();
164	if (rotate!=null) rotate(image, deg);
165}
166function testTransform() {
167	var style = document.createElement("div").style;
168	var transformTypes=["transform", "MozTransform", "webkitTransform", "OTransform", "msTransform"];
169	var count=transformTypes.length;
170	for(var i=0;i<count;i++) {
171		css=transformTypes[i];
172		if (css in style) {
173			css3Transform = css; return true;
174		}
175	}
176	return false;
177}

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.