PageSourceSearch

https://siescoms.edu.in/js/acmeticker/js/acmeticker.js

js siescoms.edu.in collected 2026-10-08 23:38:02 UTC 8,080 bytes, 354 lines download raw bytes

1(function ($) {
2	'use strict';
3	$.fn.AcmeTicker = function (options) {
4		/*Merge options and default options*/
5		let opts = $.extend({}, $.fn.AcmeTicker.defaults, options);
6
7		/*Functions Scope*/
8		let thisTicker = $(this), intervalID, timeoutID, isPause = false;
9
10		/*Always wrap, used in many place*/
11		thisTicker.wrap("<div class='acmeticker-wrap'></div>");
12
13		/*Wrap is always relative*/
14		thisTicker.parent().css({
15			position: 'relative'
16		})
17		/*Hide expect first*/
18		thisTicker.children("li").not(":first").hide();
19
20		/*Lets init*/
21		init();
22		function init() {
23			switch (opts.type) {
24				case 'vertical':
25				case 'horizontal':
26					vertiZontal()
27					break;
28
29				case 'marquee':
30					marQuee()
31					break;
32
33				case 'typewriter':
34					typeWriter()
35					break;
36
37				default:
38					break
39			}
40		}
41
42		/*Vertical - horizontal
43		* **Do not change code lines*/
44		function vertiZontal(prevNext = false) {
45			let speed = opts.speed,
46				autoplay = opts.autoplay,
47				direction = opts.direction;
48
49			if (prevNext) {
50				speed = 0;
51				autoplay = 0;
52				clearInterval(intervalID);
53				intervalID = false;
54			}
55
56			function play() {
57				if (isPause) {
58					clearInterval(intervalID);
59					intervalID = false;
60					return false;
61				}
62				let dChild,
63					eqType,
64					mType,
65					mVal;
66
67				dChild = thisTicker.find('li:first');
68				if (direction === 'up' || direction === 'right') {
69					eqType = '-=';
70				}
71				else {
72					eqType = '+=';
73				}
74				if (opts.type === 'horizontal') {
75					mType = 'left';
76					mVal = dChild.outerWidth(true);
77				}
78				else {
79					mType = 'margin-top';
80					mVal = dChild.outerHeight(true);
81				}
82				if (prevNext === 'prev') {
83					thisTicker.find('li:last').detach().prependTo(thisTicker);
84				}
85				else {
86					dChild.detach().appendTo(thisTicker);
87				}
88
89				thisTicker.find('li').css({
90					opacity: '0',
91					display: 'none'
92				});
93				thisTicker.find('li:first').css({
94					opacity: '1',
95					position: 'absolute',
96					display: 'block',
97					[mType]: eqType + mVal + 'px',
98				});
99				thisTicker.find('li:first').animate(
100					{ [mType]: '0px' },
101					speed,
102					function () {
103						clearInterval(intervalID);
104						intervalID = false;
105						vertiZontal();
106					});
107			}
108			if (intervalID) {
109				return false
110			}
111			intervalID = setInterval(play, autoplay);
112		}
113
114		/*Type-Writer
115		* **Do not change code lines*/
116		function typeWriter(prevNext = false) {
117			if (isPause) {
118				return false;
119			}
120			if (prevNext) {
121				clearInterval(intervalID);
122				intervalID = false;
123
124				clearTimeout(timeoutID);
125				timeoutID = false;
126
127				if (prevNext === 'prev') {
128					thisTicker.find('li:last').detach().prependTo(thisTicker);
129				}
130				else {
131					thisTicker.find('li:first').detach().appendTo(thisTicker);
132				}
133			}
134
135			let speed = opts.speed,
136				autoplay = opts.autoplay,
137				typeEl = thisTicker.find('li:first'),
138				wrapEl = typeEl.children(),
139				count = 0;
140
141			if (typeEl.attr('data-text')) {
142				wrapEl.text(typeEl.attr('data-text'))
143			}
144
145			let allText = typeEl.text();
146
147			thisTicker.find('li').css({
148				opacity: '0',
149				display: 'none'
150			});
151
152			function tNext() {
153				thisTicker.find('li:first').detach().appendTo(thisTicker);
154
155				clearTimeout(timeoutID);
156				timeoutID = false;
157
158				typeWriter();
159			}
160
161			function type() {
162				count++;
163				let typeText = allText.substring(0, count);
164				if (!typeEl.attr('data-text')) {
165					typeEl.attr('data-text', allText);
166				}
167
168				if (count <= allText.length) {
169					wrapEl.text(typeText);
170					typeEl.css({
171						opacity: '1',
172						display: 'block',
173					});
174				}
175				else {
176					clearInterval(intervalID);
177					intervalID = false;
178					timeoutID = setTimeout(tNext, autoplay);
179				}
180			}
181			if (!intervalID) {
182				intervalID = setInterval(type, speed);
183			}
184		}
185
186		/*marQuee
187		* **Do not change code lines*/
188		function marQuee() {
189			/*Marquee Special*/
190			let speed = opts.speed,
191				direction = opts.direction,
192				wrapWidth,
193				dir = 'left',
194				totalTravel,
195				defTiming,
196				listWidth = 0,
197				mPause = false;
198
199			mInit();
200			function mInit() {
201				thisTicker.css({
202					position: 'absolute'
203				})
204				thisTicker.find('li').css({
205					display: 'inline-block',
206					marginRight: '10px',
207				});
208				let tickerList = thisTicker.find("li");
209				wrapWidth = thisTicker.parent().outerWidth(true);
210
211				if (direction === 'right') {
212					dir = 'right'
213				}
214
215				/*Calculating ticker width*/
216				thisTicker.width(10000);/*temporary width to prevent inline elements wrapping to initial width of ticker*/
217				tickerList.each(function () {
218					listWidth += $(this).outerWidth(true) + 5;/*+5 for some missing px*/
219				});
220				thisTicker.width(listWidth);
221
222				totalTravel = listWidth + wrapWidth;
223				defTiming = totalTravel / speed;
224
225				marQueeIt(listWidth, listWidth / speed);
226			}
227
228			function marQueeIt(lPos, lSpeed) {
229				thisTicker.animate(
230					{ [dir]: '-=' + lPos },
231					lSpeed,
232					"linear",
233					function () {
234						thisTicker.css({
235							[dir]: wrapWidth
236						});
237						marQueeIt(totalTravel, defTiming);
238					}
239				);
240			}
241
242			function mRestart() {
243				let offset = thisTicker.offset(),
244					rOffset = direction === 'right' ? (listWidth - offset.left) : offset.left,
245					remainingSpace = rOffset + listWidth,
246					remainingTime = remainingSpace / speed;
247
248				marQueeIt(remainingSpace, remainingTime);
249			}
250			function mToggle() {
251				mPause = !mPause;
252				$(document).trigger('acmeTickerToggle', thisTicker, mPause)
253				if (mPause) {
254					thisTicker.stop();
255				}
256				else {
257					mRestart();
258				}
259			}
260
261			opts.controls.toggle && opts.controls.toggle.on('click', function (e) {
262				mToggle();
263			});
264			if (opts.pauseOnHover) {
265				thisTicker.on('mouseenter', function () {
266					thisTicker.stop();
267				}).on('mouseleave', function () {
268					mRestart();
269				});
270			}
271			if (opts.pauseOnFocus) {
272				thisTicker.on('focusin', function () {
273					thisTicker.stop();
274				}).on('focusout', function () {
275					mRestart();
276				});
277			}
278		}
279		/*marQuee End*/
280
281		/*Actions/Controls*/
282		if (opts.type !== 'marquee') {
283			opts.controls.prev && opts.controls.prev.on('click', function (e) {
284				e.preventDefault();
285				switch (opts.type) {
286					case 'typewriter':
287						typeWriter('prev')
288						break;
289
290					default:
291						vertiZontal('prev')
292						break
293				}
294			});
295			opts.controls.next && opts.controls.next.on('click', function (e) {
296				e.preventDefault();
297				switch (opts.type) {
298					case 'typewriter':
299						typeWriter('next')
300						break;
301
302					default:
303						vertiZontal('next')
304						break
305				}
306			});
307			function restart() {
308				if (!isPause) {
309					init();
310				}
311			}
312			opts.controls.toggle && opts.controls.toggle.on('click', function (e) {
313				e.preventDefault();
314				isPause = !isPause;
315				$(document).trigger('acmeTickerToggle', thisTicker, isPause)
316				restart();
317			});
318			if (opts.pauseOnHover) {
319				thisTicker.on('mouseenter', function () {
320					isPause = true;
321					restart();
322				}).on('mouseleave', function () {
323					isPause = false;
324					restart();
325				});
326			}
327			if (opts.pauseOnFocus) {
328				thisTicker.on('focusin', function () {
329					isPause = true;
330					restart();
331				}).on('focusout', function () {
332					isPause = false;
333					restart();
334				});
335			}
336		}
337	};
338
339	// plugin defaults - added as a property on our plugin function
340	$.fn.AcmeTicker.defaults = {
341		/*Note: Marquee only take speed not autoplay*/
342		type: 'horizontal',/*vertical/horizontal/marquee/typewriter*/
343		autoplay: 2000,/*true/false/number*/ /*For vertical/horizontal 4000*//*For typewriter 2000*/
344		speed: 50,/*true/false/number*/ /*For vertical/horizontal 600*//*For marquee 0.05*//*For typewriter 50*/
345		direction: 'up',/*up/down/left/right*//*For vertical up/down*//*For horizontal/marquee right/left*//*For typewriter direction doesnot work*/
346		pauseOnFocus: true,
347		pauseOnHover: true,
348		controls: {
349			prev: '',/*Can be used for vertical/horizontal/typewriter*//*not work for marquee*/
350			next: '',/*Can be used for vertical/horizontal/typewriter*//*not work for marquee*/
351			toggle: ''/*Can be used for vertical/horizontal/marquee/typewriter*/
352		}
353	};
354})(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.