PageSourceSearch

https://www.cqsahcqmu.cn/static/default/web/newtemp/js/jquery.slider.js

js cqsahcqmu.cn collected 2026-10-09 23:13:16 UTC 4,691 bytes, 154 lines download raw bytes

1/* ==== slider nameSpace ==== */
2var slider = function() {
3	/* ==== private methods ==== */
4	function getElementsByClass(object, tag, className) {
5		var o = object.getElementsByTagName(tag);
6		for ( var i = 0, n = o.length, ret = []; i < n; i++) {
7			if (o[i].className == className) ret.push(o[i]);
8		}
9		if (ret.length == 1) ret = ret[0];
10		return ret;
11	}
12	function setOpacity (obj,o) {
13		if (obj.filters) obj.filters.alpha.opacity = Math.round(o);
14		else obj.style.opacity = o / 100;
15	}
16	/* ==== Slider Constructor ==== */
17	function Slider(oCont, speed, iW, iH, oP) {
18		this.slides = [];
19		this.over   = false;
20		this.S      = this.S0 = speed;
21		this.iW     = iW;
22		this.iH     = iH;
23		this.oP     = oP;
24		this.oc     = document.getElementById(oCont);
25		this.frm    = getElementsByClass(this.oc, 'div', 'slide');
26		this.NF     = this.frm.length;
27		this.resize();
28		for (var i = 0; i < this.NF; i++) {
29			this.slides[i] = new Slide(this, i);
30		}
31		this.oc.parent = this;
32		this.view      = this.slides[0];
33		this.Z         = this.mx;
34		/* ==== on mouse out event ==== */
35		this.oc.onmouseout = function () {
36			//this.parent.mouseout();
37			return false;
38		}
39	}
40	Slider.prototype = {
41		/* ==== animation loop ==== */
42		run : function () {
43			this.Z += this.over ? (this.mn - this.Z) * .5 : (this.mx - this.Z) * .5;
44			this.view.calc();
45			var i = this.NF;
46			while (i--) this.slides[i].move();
47		},
48		/* ==== resize  ==== */
49		resize : function () {
50			this.wh = this.oc.clientWidth;
51			this.ht = this.oc.clientHeight;
52			this.wr = this.wh * this.iW;
53			this.r  = this.ht / this.wr;
54			this.mx = this.wh / this.NF;
55			this.mn = (this.wh * (1 - this.iW)) / (this.NF - 1);
56		},
57		/* ==== rest  ==== */
58		mouseout : function () {
59			this.over      = false;
60			setOpacity(this.view.img, this.oP);
61		}
62	}
63	/* ==== Slide Constructor ==== */
64	Slide = function (parent, N) {
65		this.parent = parent;
66		this.N      = N;
67		this.x0     = this.x1 = N * parent.mx;
68		this.v      = 0;
69		this.loaded = false;
70		this.cpt    = 0;
71		this.start  = new Date();
72		this.obj    = parent.frm[N];
73		this.txt    = getElementsByClass(this.obj, 'div', 'text');
74		this.img    = getElementsByClass(this.obj, 'img', 'diapo');
75		this.bkg    = document.createElement('div');
76		this.bkg.className = 'backgroundText';
77		this.obj.insertBefore(this.bkg, this.txt);
78		if (N == 0) this.obj.style.borderLeft = 'none';
79		this.obj.style.left = Math.floor(this.x0) + 'px';
80		setOpacity(this.img, parent.oP);
81		/* ==== mouse events ==== */
82		this.obj.parent = this;
83		this.obj.onmouseover = function() {
84			this.parent.over();
85			return false;
86		}
87	}
88	Slide.prototype = {
89		/* ==== target positions ==== */
90		calc : function() {
91			var that = this.parent;
92			// left slides
93			for (var i = 0; i <= this.N; i++) {
94				that.slides[i].x1 = i * that.Z;
95			}
96			// right slides
97			for (var i = this.N + 1; i < that.NF; i++) {
98				that.slides[i].x1 = that.wh - (that.NF - i) * that.Z;
99			}
100		},
101		/* ==== HTML animation : move slides ==== */
102		move : function() {
103			var that = this.parent;
104			var s = (this.x1 - this.x0) / that.S;
105			/* ==== lateral slide ==== */
106			if (this.N && Math.abs(s) > .5) {
107				this.obj.style.left = Math.floor(this.x0 += s) + 'px';
108			}
109			/* ==== vertical text ==== */
110			var v = (this.N < that.NF - 1) ? that.slides[this.N + 1].x0 - this.x0 : that.wh - this.x0;
111			if (Math.abs(v - this.v) > .5) {
112				this.bkg.style.top = this.txt.style.top = Math.floor(2 + that.ht - (v - that.Z) * that.iH * that.r) + 'px';
113				this.v = v;
114				this.cpt++;
115			} else {
116				if (!this.pro) {
117					/* ==== adjust speed ==== */
118					this.pro = true;
119					var tps = new Date() - this.start;
120					if(this.cpt > 1) {
121						that.S = Math.max(2, (28 / (tps / this.cpt)) * that.S0);
122					}
123				}
124			}
125			if (!this.loaded) {
126				if (this.img.complete) {
127					this.img.style.visibility = 'visible';
128					this.loaded = true;
129				}
130			}
131		},
132		/* ==== light ==== */
133		over : function () {
134			this.parent.resize();
135			this.parent.over = true;
136			setOpacity(this.parent.view.img, this.parent.oP);
137			this.parent.view = this;
138			this.start = new Date();
139			this.cpt = 0;
140			this.pro = false;
141			this.calc();
142			setOpacity(this.img, 100);
143		}
144	}
145	/* ==== public method - script initialization ==== */
146	return {
147		init : function() {
148			// create instances of sliders here
149			// parameters : HTMLcontainer name, speed (2 fast - 20 slow), Horizontal ratio, vertical text ratio, opacity
150			this.s1 = new Slider("slider", 12, 2/3, 1/3.2, 95);
151			setInterval("slider.s1.run();", 16);
152		}
153	}
154}();

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.