PageSourceSearch

http://kiss.com.tw/js/jcarousellite.js

js kiss.com.tw collected 2026-10-02 19:09:36 UTC 3,850 bytes, 126 lines download raw bytes

1(function ($) {
2		$.fn.jCarouselLite = function (o) {
3				o = $.extend({
4						btnPrev: null,
5						btnNext: null,
6						btnGo: null,
7						mouseWheel: false,
8						auto: null,
9						speed: 200,
10						easing: null,
11						vertical: false,
12						circular: true,
13						visible: 3,
14						start: 0,
15						scroll: 1,
16						beforeStart: null,
17						afterEnd: null
18				},
19				o || {});
20				return this.each(function () {
21						var b = false,
22						animCss = o.vertical ? "top" : "left",
23						sizeCss = o.vertical ? "height" : "width";
24						var c = $(this),
25						ul = $("ul", c),
26						tLi = $("li", ul),
27						tl = tLi.size(),
28						v = o.visible;
29						if (o.circular) {
30								ul.prepend(tLi.slice(tl - v - 1 + 1).clone()).append(tLi.slice(0, v).clone());
31								o.start += v
32						}
33						var f = $("li", ul),
34						itemLength = f.size(),
35						curr = o.start;
36						c.css("visibility", "visible");
37						f.css({
38								overflow: "hidden",
39								float: o.vertical ? "none" : "left"
40						});
41						ul.css({
42								margin: "0",
43								padding: "0",
44								position: "relative",
45								"list-style-type": "none",
46								"z-index": "1"
47						});
48						c.css({
49								overflow: "hidden",
50								position: "relative",
51								"z-index": "2",
52								left: "0px"
53						});
54						var g = o.vertical ? height(f) : width(f);
55						var h = g * itemLength;
56						var j = g * v;
57						f.css({
58								width: f.width(),
59								height: f.height()
60						});
61						ul.css(sizeCss, h + "px").css(animCss, -(curr * g));
62						c.css(sizeCss, j + "px");
63						if (o.btnPrev) $(o.btnPrev).click(function () {
64								return go(curr - o.scroll)
65						});
66						if (o.btnNext) $(o.btnNext).click(function () {
67								return go(curr + o.scroll)
68						});
69						if (o.btnGo) $.each(o.btnGo, function (i, a) {
70								$(a).click(function () {
71										return go(o.circular ? o.visible + i : i)
72								})
73						});
74						if (o.mouseWheel && c.mousewheel) c.mousewheel(function (e, d) {
75								return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll)
76						});
77						if (o.auto) setInterval(function () {
78								go(curr + o.scroll)
79						},
80						o.auto + o.speed);
81						function vis() {
82								return f.slice(curr).slice(0, v)
83						};
84						function go(a) {
85								if (!b) {
86										if (o.beforeStart) o.beforeStart.call(this, vis());
87										if (o.circular) {
88												if (a <= o.start - v - 1) {
89														ul.css(animCss, -((itemLength - (v * 2)) * g) + "px");
90														curr = a == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll
91												} else if (a >= itemLength - v + 1) {
92														ul.css(animCss, -((v) * g) + "px");
93														curr = a == itemLength - v + 1 ? v + 1 : v + o.scroll
94												} else curr = a
95										} else { if (a < 0 || a > itemLength - v) return;
96												else curr = a
97										}
98										b = true;
99										ul.animate(animCss == "left" ? {
100												left: -(curr * g)
101										} : {
102												top: -(curr * g)
103										},
104										o.speed, o.easing, function () {
105												if (o.afterEnd) o.afterEnd.call(this, vis());
106												b = false
107										});
108										if (!o.circular) {
109												$(o.btnPrev + "," + o.btnNext).removeClass("disabled");
110												$((curr - o.scroll < 0 && o.btnPrev) || (curr + o.scroll > itemLength - v && o.btnNext) || []).addClass("disabled")
111										}
112								}
113								return false
114						}
115				})
116		};
117		function css(a, b) {
118				return parseInt($.css(a[0], b)) || 0
119		};
120		function width(a) {
121				return a[0].offsetWidth + css(a, 'marginLeft') + css(a, 'marginRight')
122		};
123		function height(a) {
124				return a[0].offsetHeight + css(a, 'marginTop') + css(a, 'marginBottom')
125		}
126})(jQuery);

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.